Commit 98ce3754 authored by Chen Zhongjin's avatar Chen Zhongjin Committed by Yongqiang Liu
Browse files

x86/unwind: Fix orc entry for paravirt {save,restore}_fl

hulk inclusion
category: bugfix
bugzilla: 187818, https://gitee.com/openeuler/kernel/issues/I6DK3O


CVE: NA

--------------------------------

When CONFIG_PARAVIRT is enabled, the code of {save,restore}_fl is
defined as:

ff 14 25 00 00 00 00    callq  *0x0

which will be patched to call the xen paravirt function, or native
implementation, in 'paravirt_patch_64.c':

pushfq; popq %rax // for native_save_fl
pushq %rdi; popfq // for native_restore_fl

The orc metadata is generated with insn 'callq', so it can become
inconsistent with the real insn 'push;pop'.
This makes stacktrace on the 'pop' insn fail and incorrect stacktrace
result can be returned.

To prevent reliable stacktrace broken, check the insns when unwind
pt_regs stack frame:

When there are 'push;pop' combination and both insns don't change orc
entry, it means the stack state is inconsistent with orc on pop.
Add one slot to sp_offset for on original orc entry to get the correct
orc entry.

Signed-off-by: default avatarChen Zhongjin <chenzhongjin@huawei.com>
Reviewed-by: default avatarXu Kuohai <xukuohai@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 22792bc8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment