lkml.org 
[lkml]   [2012]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Re: [PATCH v10 3.3-rc2 1/9] uprobes: Install and remove breakpoints.
(2012/02/08 18:40), Denys Vlasenko wrote:
> On Tue, Feb 7, 2012 at 6:17 PM, Srikar Dronamraju
> <srikar@linux.vnet.ibm.com> wrote:
>> Changelog: (Since v10): Add code to clear REX.B prefix pointed out by Denys Vlasenko
>> and fix suggested by Masami Hiramatsu.
> ...
>> + /*
>> + * Point cursor at the modrm byte. The next 4 bytes are the
>> + * displacement. Beyond the displacement, for some instructions,
>> + * is the immediate operand.
>> + */
>> + cursor = uprobe->insn + insn_offset_modrm(insn);
>> + insn_get_length(insn);
>> + if (insn->rex_prefix.nbytes)
>> + *cursor &= 0xfe; /* Clearing REX.B bit */
>
> It looks like cursor points to mod/reg/rm byte, not rex byte.
> Comment above says it too. You seem to be clearing a bit
> in a wrong byte. I think it should be

Right, but...

>
> /* Clear REX.b bit (extension of MODRM.rm field):
> * we want to encode rax/rcx, not r8/r9.
> */
> if (insn->rex_prefix.nbytes)
> insn->rex_prefix.bytes[0] &= 0xfe;

No, that is a meaningless operation.
As I originally said,

> insn_get_length(insn);
> if (insn->rex_prefix.nbytes) {
> cursor = uprobe->insn + insn_offset_rex_prefix(insn);
> *cursor &= 0xfe; /* Clearing REX.B bit */
> }

You have to move the cursor itself, since the .rex_prefix
is just a copied data...

Thanks,

--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com


\
 
 \ /
  Last update: 2012-02-09 02:29    [W:0.148 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site