mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Zheng Yejian <zhengyejian@huaweicloud.com>
Cc: peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
	brgerst@gmail.com, samitolvanen@google.com, kees@kernel.org,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/unwind/orc: Fix unwind for newly forked tasks
Date: Fri, 13 Sep 2024 16:11:08 -0700	[thread overview]
Message-ID: <20240913231108.a3ukhoyhp2xactdq@treble> (raw)
In-Reply-To: <20240913024501.1337327-1-zhengyejian@huaweicloud.com>

On Fri, Sep 13, 2024 at 10:45:01AM +0800, Zheng Yejian wrote:
> 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@huaweicloud.com>

Thanks!

Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>

-- 
Josh

  reply	other threads:[~2024-09-13 23:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13  2:45 Zheng Yejian
2024-09-13 23:11 ` Josh Poimboeuf [this message]
2024-10-11  6:50   ` Zheng Yejian
2024-10-11 15:39     ` Josh Poimboeuf
2024-10-12  7:34       ` Zheng Yejian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240913231108.a3ukhoyhp2xactdq@treble \
    --to=jpoimboe@kernel.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=samitolvanen@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zhengyejian@huaweicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®