Commit 20106abf authored by Ye Weihua's avatar Ye Weihua Committed by Zheng Zengkai
Browse files

livepatch: Check whole stack when CONFIG_PREEMPT is set

hulk inclusion
category: feature
bugzilla: 119440 https://gitee.com/openeuler/kernel/issues/I4DDEL



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

The previous code does not consider the scenario where preemption
is enabled. In the kernel with CONFIG_PREEMPT enabled, even if the
function entry does not have a jump instruction, the function may
be interrupted by an interrupt. If preemption is triggered when
the interrupt is returned, the function is in the middle of the
call stack of the thread.

The stack depth optimization solution needs to be adjusted as
follows:
	1. For functions with jump instructions in the entry,
	check the entire thread stack in any case.
	2. For a function whose entry does not have a jump
	instruction:
		a. If CONFIG_PREEMPT is disabled, the function
		entry code cannot be on any thread stack.
		Therefore, no check is required.
		b. If CONFIG_PREEMPT is turned on, check entire
		thread stack.

Signed-off-by: default avatarYe Weihua <yeweihua4@huawei.com>
Reviewed-by: default avatarKuohai Xu <xukuohai@huawei.com>

Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent d3d0ca13
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment