[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPhsuW4QjDx1_2xXVjPzy2HueR+ZGb-q=zsn4S-TYSp38Tp-Zg@mail.gmail.com>
Date: Thu, 13 Mar 2025 12:10:56 -0700
From: Song Liu <song@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-toolchains@...r.kernel.org, live-patching@...r.kernel.org,
indu.bhagat@...cle.com, puranjay@...nel.org, wnliu@...gle.com,
irogers@...gle.com, joe.lawrence@...hat.com, jpoimboe@...nel.org,
mark.rutland@....com, peterz@...radead.org, roman.gushchin@...ux.dev,
rostedt@...dmis.org, will@...nel.org, kernel-team@...a.com
Subject: Re: [PATCH 1/2] arm64: Implement arch_stack_walk_reliable
On Thu, Mar 13, 2025 at 11:12 AM Breno Leitao <leitao@...ian.org> wrote:
>
> On Fri, Mar 07, 2025 at 05:27:41PM -0800, Song Liu wrote:
> > With proper exception boundary detection, it is possible to implment
> > arch_stack_walk_reliable without sframe.
> >
> > Note that, arch_stack_walk_reliable does not guarantee getting reliable
> > stack in all scenarios. Instead, it can reliably detect when the stack
> > trace is not reliable, which is enough to provide reliable livepatching.
> >
> > This version has been inspired by Weinan Liu's patch [1].
> >
> > [1] https://lore.kernel.org/live-patching/20250127213310.2496133-7-wnliu@google.com/
> > Signed-off-by: Song Liu <song@...nel.org>
>
> Tested-by: Breno Leitao <leitao@...ian.org>
Thanks for the testing!
>
> > arch/arm64/Kconfig | 2 +-
> > arch/arm64/include/asm/stacktrace/common.h | 1 +
> > arch/arm64/kernel/stacktrace.c | 44 +++++++++++++++++++++-
> > 3 files changed, 45 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index 940343beb3d4..ed4f7bf4a879 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -275,6 +275,7 @@ config ARM64
> > select HAVE_SOFTIRQ_ON_OWN_STACK
> > select USER_STACKTRACE_SUPPORT
> > select VDSO_GETRANDOM
> > + select HAVE_RELIABLE_STACKTRACE
>
> Can we really mark this is reliable stacktrace? I am wondering
> if we need an intermediate state (potentially reliable stacktrace?)
> until we have a fully reliable stack unwinder.
AFAICT, we do not expect arch_stack_walk_reliable() to always
return a reliable stack. Instead, it is expected to return -EINVAL if
the stack trace is not reliable. OTOH, arch_stack_walk() doesn't
warn the caller when the stack trace is not reliable. This is exactly
what we need for live patch: we just need to make the patch
transition when the stack trace is reliable and none of the functions
in the stack is being patched. If the stack trace is not reliable, we
will retry the transition at a later time.
Thanks,
Song
Powered by blists - more mailing lists