[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190607085259.GE3463@hirez.programming.kicks-ass.net>
Date: Fri, 7 Jun 2019 10:52:59 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Nadav Amit <namit@...are.com>
Cc: the arch/x86 maintainers <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Andy Lutomirski <luto@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Jason Baron <jbaron@...mai.com>, Jiri Kosina <jkosina@...e.cz>,
David Laight <David.Laight@...LAB.COM>,
Borislav Petkov <bp@...en8.de>,
Julia Cartwright <julia@...com>, Jessica Yu <jeyu@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Edward Cree <ecree@...arflare.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH 12/15] x86/static_call: Add out-of-line static call
implementation
On Fri, Jun 07, 2019 at 10:38:46AM +0200, Peter Zijlstra wrote:
> On Fri, Jun 07, 2019 at 06:13:58AM +0000, Nadav Amit wrote:
> > > On Jun 5, 2019, at 6:08 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>
> > > +void arch_static_call_transform(void *site, void *tramp, void *func)
> > > +{
> > > + unsigned char opcodes[CALL_INSN_SIZE];
> > > + unsigned char insn_opcode;
> > > + unsigned long insn;
> > > + s32 dest_relative;
> > > +
> > > + mutex_lock(&text_mutex);
> > > +
> > > + insn = (unsigned long)tramp;
> > > +
> > > + insn_opcode = *(unsigned char *)insn;
> > > + if (insn_opcode != 0xE9) {
> > > + WARN_ONCE(1, "unexpected static call insn opcode 0x%x at %pS",
> > > + insn_opcode, (void *)insn);
> > > + goto unlock;
> >
> > This might happen if a kprobe is installed on the call, no?
> >
> > I don’t know if you want to be more gentle handling of this case (or perhaps
> > modify can_probe() to prevent such a case).
> >
>
> yuck.. yes, that's something that needs consideration.
For jump_label this is avoided by jump_label_text_reserved(), I'm
thinking static_call should do the same.
Powered by blists - more mailing lists