Thread (34 messages) 34 messages, 7 authors, 2012-05-23

Re: [PATCH v10 3.3-rc2 1/9] uprobes: Install and remove breakpoints.

From: Denys Vlasenko <hidden>
Date: 2012-02-08 09:40:53
Also in: lkml

On Tue, Feb 7, 2012 at 6:17 PM, Srikar Dronamraju
[off-list ref] 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

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

-- 
vda

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help