From: Petr Vandrovec <petr@vandrovec.name>
To: ak@suse.de
Cc: discuss@x86-64.org, linux-kernel@vger.kernel.org,
torvalds@linux-foundation.org
Subject: [PATCH] Fix triplefault on x86-64 bootup
Date: Sun, 12 Aug 2007 10:12:52 +0200 [thread overview]
Message-ID: <20070812081252.GA23309@vana.vc.cvut.cz> (raw)
Hello,
after I upgraded kernel on my box to current git, only thing it did
was rebooting in a loop. After some digging I found that it is silly
to apply alternative to memcpy by using that every same memcpy...
Sorry if it is known bug, I do not see it reported in my LKML mailbox...
Petr
From: Petr Vandrovec <petr@vandrovec.name>
Do not replace whole memcpy in apply alternatives
apply_alternatives uses memcpy() to apply alternatives. Which has
unfortunate effect that while applying memcpy alternative memcpy itself
it tries to overwrite itself with nops - which causes #UD fault as it
overwrites half of 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 main memcpy loop is
not in first two bytes it will work fine.
Signed-off-by: Petr Vandrovec <petr@vandrovec.name>
---
commit 7c6f7d582f301e16899a43fd6c775ed103e8a8d2
tree 112d7320e8a21120e4e43f1ac91918ca0352ff56
parent f81e9b8cc6301f6328eafaa553ef35441874b1a4
author Petr Vandrovec <petr@vandrovec.name> Sun, 12 Aug 2007 01:05:11 -0700
committer Petr Vandrovec <petr@vandrovec.name> Sun, 12 Aug 2007 01:05:11 -0700
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
next reply other threads:[~2007-08-12 8:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-12 8:12 Petr Vandrovec [this message]
2007-08-12 8:40 ` Linus Torvalds
2007-08-12 8:59 ` Linus Torvalds
2007-08-12 10:01 ` Andi Kleen
2007-08-12 9:59 ` Andi Kleen
2007-08-12 17:56 ` Linus Torvalds
2007-08-12 9:57 ` [discuss] " Andi Kleen
2007-08-12 10:09 ` Please remove ab144f5ec64c42218a555ec1dbde6b60cf2982d6 was " Andi Kleen
2007-08-12 10:42 ` Petr Vandrovec
2007-08-12 13:55 ` Andi Kleen
2007-08-12 13:46 ` Paolo Ornati
2007-08-12 17:57 ` Linus Torvalds
2007-08-12 10:46 ` Alexey Dobriyan
2007-08-12 13:53 ` Andi Kleen
2007-08-12 13:12 ` Alexey Dobriyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070812081252.GA23309@vana.vc.cvut.cz \
--to=petr@vandrovec.name \
--cc=ak@suse.de \
--cc=discuss@x86-64.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®