From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: jpoimboe@kernel.org, x86@kernel.org, baron@akamai.com,
ardb@kernel.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
linux-kernel@vger.kernel.org, christian@bricart.de,
song@kernel.org, mcgrof@kernel.org
Subject: Re: [PATCH] x86/static_call: Fix __static_call_fixup()
Date: Wed, 16 Aug 2023 11:39:55 +0200 [thread overview]
Message-ID: <20230816093955.GD980931@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20230815204112.1f7ab2bf@gandalf.local.home>
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@infradead.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.
next prev parent reply other threads:[~2023-08-16 9:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 23:08 [PATCH] x86/static_call: Fix __static_call_fixup() Peter Zijlstra
2023-08-15 23:14 ` Peter Zijlstra
2023-08-16 0:10 ` Josh Poimboeuf
2023-08-16 9:39 ` Peter Zijlstra
2023-08-16 0:41 ` Steven Rostedt
2023-08-16 9:39 ` Peter Zijlstra [this message]
2023-08-16 10:44 ` [PATCH v2] " Peter Zijlstra
2023-08-16 21:02 ` Josh Poimboeuf
2023-08-17 11:47 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
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=20230816093955.GD980931@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ardb@kernel.org \
--cc=baron@akamai.com \
--cc=bp@alien8.de \
--cc=christian@bricart.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@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