• Prasanna S.P's avatar
    [PATCH] x86: error_code is not safe for kprobes · d28c4393
    Prasanna S.P authored
    This patch moves the entry.S:error_entry to .kprobes.text section,
    since code marked unsafe for kprobes jumps directly to entry.S::error_entry,
    that must be marked unsafe as well.
    This patch also moves all the ".previous.text" asm directives to ".previous"
    for kprobes section.
    
    AK: Following a similar i386 patch from Chuck Ebbert
    AK: Also merged Jeremy's fix in.
    
    +From: Jeremy Fitzhardinge <jeremy@goop.org>
    
    KPROBE_ENTRY does a .section .kprobes.text, and expects its users to
    do a .previous at the end of the function.
    
    Unfortunately, if any code within the function switches sections, for
    example .fixup, then the .previous ends up putting all subsequent code
    into .fixup.  Worse, any subsequent .fixup code gets intermingled with
    the code its supposed to be fixing (which is also in .fixup).  It's
    surprising this didn't cause more havok.
    
    The fix is to use .pushsection/.popsection, so this stuff nests
    properly.  A further cleanup would be to get rid of all
    .section/.previous pairs, since they're inherently fragile.
    
    +From: Chuck Ebbert <76306.1226@compuserve.com>
    
    Because code marked unsafe for kprobes jumps directly to
    entry.S::error_code, that must be marked unsafe as well.
    The easiest way to do that is to move the page fault entry
    point to just before error_code and let it inherit the same
    section.
    
    Also moved all the ".previous" asm directives for kprobes
    sections to column 1 and removed ".text" from them.
    Signed-off-by: default avatarChuck Ebbert <76306.1226@compuserve.com>
    Signed-off-by: default avatarAndi Kleen <ak@suse.de>
    d28c4393
entry.S 21.2 KB