lkml.org 
[lkml]   [2019]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@infradead.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.

\
 
 \ /
  Last update: 2019-06-07 10:54    [W:0.144 / U:18.996 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site