Re: [PATCH?] uprobes: change uprobe_write_opcode() to modify thepage directly

From: H. Peter Anvin
Date: Wed Dec 04 2013 - 13:33:30 EST


On 12/04/2013 09:15 AM, Linus Torvalds wrote:
> On Wed, Dec 4, 2013 at 8:54 AM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>>
>> That is why I talk about the atomic instruction word... most (but not
>> *all*) architectures have a fundamental minimum unit of instructions
>> which is aligned and can be atomically written. Typically this is 1, 2,
>> or 4 bytes.
>
> Note that it's not just about the "atomically written", it's also
> about the guarantee that it's atomically *read*.
>
> x86 can certainly atomically write a 4-byte instruction too, it's just
> that there's no guarantee - even if the instruction is aligned etc -
> that the actual instruction decoding always ends up reading it that
> way. It might re-read an instruction after encountering a prefix byte
> etc etc. So even if it's all properly aligned, the reading side might
> do something odd.
>

True, at least in theory, but the atomic instruction quantum on x86 is a
byte.

-hpa


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