Re: [RFC PATCH 4/6] uprobes/x86: Emulate rip-relative call's
From: Denys Vlasenko
Date: Thu Apr 10 2014 - 09:42:19 EST
On 04/09/2014 05:43 PM, Oleg Nesterov wrote:
> On 04/08, Jim Keniston wrote:
>>
>> On Sun, 2014-04-06 at 22:16 +0200, Oleg Nesterov wrote:
>>> 0xe8. Anything else?
>>
>> No, I think e8 is the only call instruction uprobes will see.
>
> Good.
There is this monstrosity, "16-bit override for branches" in 64-mode:
66 e8 nn nn callw <offset16>
Nobody sane uses it because it truncates instruction pointer.
Or rather, *I think* it should truncate it (i.e. zero-extend to full width),
but conceivably some CPUs can be buggy wrt that:
they can decide to modify only lower 16 bits of IP,
or even they can decided to use signed <offset16> but apply it
to full-width RIP.
AMD manuals are not clear on what exactly should happen.
I am sure no one sane uses this form of branch instructions
in 32-bit and 64-bit code.
I don't think we should be trying to support it "correctly"
(we can just let program crash with SIGILL or something),
we only need to make sure we don't overlook its existence
and thus are not tricked into touching or modifying unrelated data.
Imagine that 66 e8 nn nn bytes are exactly at the end of
a page, and we wrongly assume that offset is 32-bit, not 16-bit.
--
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/