]> git.baikalelectronics.ru Git - kernel.git/commit
Do not replace whole memcpy in apply alternatives
authorPetr Vandrovec <petr@vandrovec.name>
Sun, 12 Aug 2007 08:12:52 +0000 (10:12 +0200)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 12 Aug 2007 08:42:37 +0000 (01:42 -0700)
commitca70a23d782f66f330e04706d320da643eb6f2e7
treed3b01b918c779bbce433e753c3fb0207390c4950
parent2faf6711b0beae5ea2114600c8e6f706ca8f61a0
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 <petr@vandrovec.name>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86_64/lib/memcpy.S