From: Weinan Liu <wnliu@google.com>
To: jpoimboe@kernel.org
Cc: indu.bhagat@oracle.com, irogers@google.com,
joe.lawrence@redhat.com, kernel-team@meta.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-toolchains@vger.kernel.org,
live-patching@vger.kernel.org, mark.rutland@arm.com,
peterz@infradead.org, puranjay@kernel.org,
roman.gushchin@linux.dev, rostedt@goodmis.org, song@kernel.org,
will@kernel.org, wnliu@google.com
Subject: Re: [PATCH 1/2] arm64: Implement arch_stack_walk_reliable
Date: Wed, 19 Mar 2025 18:37:56 +0000 [thread overview]
Message-ID: <20250319183757.404779-1-wnliu@google.com> (raw)
In-Reply-To: <ifqn5txrr25ffky7lxtnjtb4b2gekq5jy4fmbiwtwfvofb4wgw@py7v7xpzaqxa>
On Tue, Mar 18, 2025 at 10:39 PM Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> On Tue, Mar 18, 2025 at 08:58:52PM -0700, Song Liu wrote:
> > On a closer look, I think we also need some logic in unwind_find_stack()
> > so that we can see when the unwinder hits the exception boundary. For
> > this reason, we may still need unwind_state.unreliable. I will look into
> > fixing this and send v2.
>
> Isn't that what FRAME_META_TYPE_PT_REGS is for?
>
> Maybe it can just tell kunwind_stack_walk() to set a bit in
> kunwind_state which tells kunwind_next_frame_record_meta() to quit the
> unwind early for the FRAME_META_TYPE_PT_REGS case. That also has the
> benefit of stopping the unwind as soon as the exception is encounterd.
>
After reviewing the code flow, it seems like we should treat all -EINVALID
cases or `FRAME_META_TYPE_PT_REGS` cases as unreliable unwinds.
Would a simplification like the one below work?
Or we can return a special value for success cases in kunwind_next_regs_pc()
```
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index 69d0567a0c38..0eb69fa6161a 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -296,7 +296,8 @@ do_kunwind(struct kunwind_state *state, kunwind_consume_fn consume_state,
if (!consume_state(state, cookie))
break;
ret = kunwind_next(state);
- if (ret < 0)
+ if (ret < 0 || state->source == KUNWIND_SOURCE_REGS_PC)
+ state->common.unreliable = true;
break;
}
}
```
--
Weinan
next prev parent reply other threads:[~2025-03-19 18:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-08 1:27 [PATCH 0/2] arm64: livepatch: Enable livepatch without sframe Song Liu
2025-03-08 1:27 ` [PATCH 1/2] arm64: Implement arch_stack_walk_reliable Song Liu
2025-03-13 18:12 ` Breno Leitao
2025-03-13 19:10 ` Song Liu
2025-03-18 18:45 ` Josh Poimboeuf
2025-03-18 20:14 ` Song Liu
2025-03-18 23:00 ` Josh Poimboeuf
2025-03-18 23:38 ` Song Liu
2025-03-19 1:03 ` Josh Poimboeuf
2025-03-19 3:58 ` Song Liu
2025-03-19 5:39 ` Josh Poimboeuf
2025-03-19 18:37 ` Weinan Liu [this message]
2025-03-19 19:09 ` Song Liu
2025-03-08 1:27 ` [PATCH 2/2] arm64: Implement HAVE_LIVEPATCH Song Liu
2025-03-12 14:05 ` Miroslav Benes
2025-03-13 18:09 ` Breno Leitao
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=20250319183757.404779-1-wnliu@google.com \
--to=wnliu@google.com \
--cc=indu.bhagat@oracle.com \
--cc=irogers@google.com \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-toolchains@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.org \
--cc=puranjay@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=will@kernel.org \
/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®