Re: [PATCH] Add a text_poke syscall v2

From: Linus Torvalds
Date: Wed Nov 27 2013 - 18:04:50 EST


On Wed, Nov 27, 2013 at 2:31 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
> No, we're not... sysexit/sysret doesn't count.

So sysexit/sysret doesn't count as a serializing instruction, no. But
it doesn't need to, because *self*-modifying code doesn't need a
serializing instruction, only a branch. It's only *cross*-modifying
code that needs a serializing instruction.

So the IPI is sufficient for the cross-modifying case, and the sysret
is sufficient for the self-modifying case. And we also don't need to
worry about "what happens if we schedule to another CPU, and
self-modifying becomes cross-modifying", because the scheduling will
then do the serializing instruction.

So IPI for other CPU's (limited to the mm-mask) and just a system call
for local CPU should be perfectly fine.

Linus
--
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/