lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <173041018251.3137.16955177475088158234.tip-bot2@tip-bot2>
Date: Thu, 31 Oct 2024 21:29:42 -0000
From: "tip-bot2 for Zheng Yejian" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Zheng Yejian <zhengyejian@...weicloud.com>,
 Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject: [tip: objtool/core] x86/unwind/orc: Fix unwind for newly forked tasks

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     3bf19a0fb690022ec22ce87a5afeb1030cbcb56c
Gitweb:        https://git.kernel.org/tip/3bf19a0fb690022ec22ce87a5afeb1030cbcb56c
Author:        Zheng Yejian <zhengyejian@...weicloud.com>
AuthorDate:    Fri, 13 Sep 2024 10:45:01 +08:00
Committer:     Josh Poimboeuf <jpoimboe@...nel.org>
CommitterDate: Thu, 17 Oct 2024 15:13:07 -07:00

x86/unwind/orc: Fix unwind for newly forked tasks

When arch_stack_walk_reliable() is called to unwind for newly forked
tasks, the return value is negative which means the call stack is
unreliable. This obviously does not meet expectations.

The root cause is that after commit 3aec4ecb3d1f ("x86: Rewrite
 ret_from_fork() in C"), the 'ret_addr' of newly forked task is changed
to 'ret_from_fork_asm' (see copy_thread()), then at the start of the
unwind, it is incorrectly interprets not as a "signal" one because
'ret_from_fork' is still used to determine the initial "signal" (see
__unwind_start()). Then the address gets incorrectly decremented in the
call to orc_find() (see unwind_next_frame()) and resulting in the
incorrect ORC data.

To fix it, check 'ret_from_fork_asm' rather than 'ret_from_fork' in
__unwind_start().

Fixes: 3aec4ecb3d1f ("x86: Rewrite ret_from_fork() in C")
Signed-off-by: Zheng Yejian <zhengyejian@...weicloud.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
---
 arch/x86/kernel/unwind_orc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index d00c28a..d4705a3 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -723,7 +723,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
 		state->sp = task->thread.sp + sizeof(*frame);
 		state->bp = READ_ONCE_NOCHECK(frame->bp);
 		state->ip = READ_ONCE_NOCHECK(frame->ret_addr);
-		state->signal = (void *)state->ip == ret_from_fork;
+		state->signal = (void *)state->ip == ret_from_fork_asm;
 	}
 
 	if (get_stack_info((unsigned long *)state->sp, state->task,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ