[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230816093955.GD980931@hirez.programming.kicks-ass.net>
Date: Wed, 16 Aug 2023 11:39:55 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: jpoimboe@...nel.org, x86@...nel.org, baron@...mai.com,
ardb@...nel.org, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
linux-kernel@...r.kernel.org, christian@...cart.de,
song@...nel.org, mcgrof@...nel.org
Subject: Re: [PATCH] x86/static_call: Fix __static_call_fixup()
On Tue, Aug 15, 2023 at 08:41:12PM -0400, Steven Rostedt wrote:
> On Wed, 16 Aug 2023 01:08:09 +0200
> Peter Zijlstra <peterz@...radead.org> wrote:
>
>
> > diff --git a/arch/x86/kernel/static_call.c b/arch/x86/kernel/static_call.c
> > index b70670a98597..2e67512d7104 100644
> > --- a/arch/x86/kernel/static_call.c
> > +++ b/arch/x86/kernel/static_call.c
> > @@ -186,6 +186,16 @@ EXPORT_SYMBOL_GPL(arch_static_call_transform);
> > */
> > bool __static_call_fixup(void *tramp, u8 op, void *dest)
> > {
> > + /*
> > + * Not all .return_sites are a static_call trampoline (most are not).
> > + * Check if the next 3 bytes are still kernel text, if not, then this
> > + * definitely is not a trampoline and we need not worry further.
> > + *
> > + * This avoids the memcmp() below tripping over pagefaults etc..
> > + */
> > + if (!kernel_text_address(tramp+7))
>
> The comment says "next 3 bytes" and the test is "tramp+7". Why the magic 7 number?
>
> If the tramp is 5 bytes, shouldn't it be +8?
0 based, 7 is the last of the 8 bytes. +8 would be one beyond.
Powered by blists - more mailing lists