Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b8d3f2448b8f4ba24f301e23585547ba1acc1f04
Commit:     b8d3f2448b8f4ba24f301e23585547ba1acc1f04
Parent:     3864e8ccbba1dcdea87398ab80fdc8ae0fab7c45
Author:     Petr Vandrovec <[EMAIL PROTECTED]>
AuthorDate: Sun Aug 12 10:12:52 2007 +0200
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sun Aug 12 01:42:37 2007 -0700

    Do not replace whole memcpy in apply alternatives
    
    apply_alternatives uses memcpy() to apply alternatives.  Which has the
    unfortunate effect that while applying memcpy alternative to memcpy
    itself it tries to overwrite itself with nops - which causes #UD fault
    as it overwrites half of an instruction in copy loop, and from this
    point on only possible outcome is triplefault and reboot.
    
    So let's overwrite only first two instructions of memcpy - as long as
    the main memcpy loop is not in first two bytes it will work fine.
    
    Signed-off-by: Petr Vandrovec <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/x86_64/lib/memcpy.S |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86_64/lib/memcpy.S b/arch/x86_64/lib/memcpy.S
index 0ea0ddc..c22981f 100644
--- a/arch/x86_64/lib/memcpy.S
+++ b/arch/x86_64/lib/memcpy.S
@@ -124,6 +124,8 @@ ENDPROC(__memcpy)
        .quad memcpy
        .quad 1b
        .byte X86_FEATURE_REP_GOOD
-       .byte .Lfinal - memcpy
+       /* Replace only beginning, memcpy is used to apply alternatives, so it
+        * is silly to overwrite itself with nops - reboot is only outcome... */
+       .byte 2b - 1b
        .byte 2b - 1b
        .previous
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to