Patch "x86/unwind/orc: Fix unwind for newly forked tasks" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-unwind-orc-fix-unwind-for-newly-forked-tasks.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit cf72d9cf74d58d8bb89d8dc17d4fec006b0fabf3
Author: Zheng Yejian <zhengyejian@xxxxxxxxxxxxxxx>
Date:   Fri Sep 13 10:45:01 2024 +0800

    x86/unwind/orc: Fix unwind for newly forked tasks
    
    [ Upstream commit 3bf19a0fb690022ec22ce87a5afeb1030cbcb56c ]
    
    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@xxxxxxxxxxxxxxx>
    Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index d00c28aaa5be4..d4705a348a804 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,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux