Re: [PATCH] Add a text_poke syscall

From: Jiri Kosina
Date: Thu Nov 21 2013 - 05:02:26 EST


On Tue, 19 Nov 2013, Andi Kleen wrote:

> > > + err = get_user_pages_fast((unsigned long)addr, npages, 1, pages);
> > > + if (err < 0)
> > > + return err;
> > > + err = 0;
> > > + mutex_lock(&text_mutex);
> > > + bp_target_mm = current->mm;
> > > + bp_int3_addr = (u8 *)addr + 1;
> >
> > Do you need an smp_wmb here? (Maybe there's a strong enough barrier in
> > __text_poke_bp.)
>
> __text_poke_bp already has enough barriers (although I don't
> think they are really needed in any case)

As an author of those barriers I have to ask -- why do you think so? The
first one is there to avoid int3 handler seeing !patching_in_progress
while it has actually been entered due to text_poke_bp() kicking in.

The second one is there for exactly the inverse reason.

Both are pairing to smp_rmb() in poke_int3_handler().

Thanks,

--
Jiri Kosina
SUSE Labs

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/