• Paolo \'Blaisorblade\' Giarrusso's avatar
    [PATCH] ptrace POKEUSR: add comment about the DR7 check. · 0f7e10c4
    Paolo \'Blaisorblade\' Giarrusso authored
    The DR7 register on i386/x86_64 has a special meaning, so there is a
    special check to do.  Since the code is rather difficult, I added an
    explaination about it.  Also, while studying the i386 Intel Manual, I saw
    that x86_64, even on 32bit emulation, allows using values which are
    disallowed on i386.  It's almost obvious that what it allows is setting a
    8-byte wide data watchpoint (in fact I double checked the AMD manuals, just
    in case, and this is true; I couldn't find a mention of this in my Intel
    manuals).
    
    But since the original ia32 emulation code has this comment:
    
    	/* You are not expected to understand this ... I don't neither. */
    
    I am dubious that the code in ptrace32.c is wrong: does x86_64 supports
    8byte-wide watchpoints in 32-bit emulation?  I've checked the AMD manual
    Vol.  2 (no.  24593), which says that to set the length to 8 bits "long
    mode must be enabled".  This means, actually, that the current code is
    safe, notwithstanding the comment (which I removed).
    Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
    Cc: Roland McGrath <roland@redhat.com>, Andi Kleen <ak@suse.de>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    0f7e10c4
ptrace.c 14.5 KB