69 lines
2.1 KiB
Diff
69 lines
2.1 KiB
Diff
From: Ben Hutchings <ben@decadent.org.uk>
|
|
Date: Wed, 14 Mar 2018 00:50:58 +0000
|
|
Subject: Revert "x86/debug: Use UD2 for WARN()"
|
|
Forwarded: not-needed
|
|
|
|
This reverts commit 9a01e5477fa4535be47f6d7a8756cef7d3e90507, which
|
|
was commit 3b3a371cc9bc980429baabe0a8e5f307f3d1f463 upstream. This
|
|
is an unnecessary ABI change.
|
|
---
|
|
arch/x86/include/asm/bug.h | 15 +++++++++------
|
|
arch/x86/kernel/traps.c | 2 +-
|
|
2 files changed, 10 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
|
|
index 6804d6642767..71e6f4bf9161 100644
|
|
--- a/arch/x86/include/asm/bug.h
|
|
+++ b/arch/x86/include/asm/bug.h
|
|
@@ -5,20 +5,23 @@
|
|
#include <linux/stringify.h>
|
|
|
|
/*
|
|
- * Despite that some emulators terminate on UD2, we use it for WARN().
|
|
+ * Since some emulators terminate on UD2, we cannot use it for WARN.
|
|
+ * Since various instruction decoders disagree on the length of UD1,
|
|
+ * we cannot use it either. So use UD0 for WARN.
|
|
*
|
|
- * Since various instruction decoders/specs disagree on the encoding of
|
|
- * UD0/UD1.
|
|
+ * (binutils knows about "ud1" but {en,de}codes it as 2 bytes, whereas
|
|
+ * our kernel decoder thinks it takes a ModRM byte, which seems consistent
|
|
+ * with various things like the Intel SDM instruction encoding rules)
|
|
*/
|
|
|
|
-#define ASM_UD0 ".byte 0x0f, 0xff" /* + ModRM (for Intel) */
|
|
+#define ASM_UD0 ".byte 0x0f, 0xff"
|
|
#define ASM_UD1 ".byte 0x0f, 0xb9" /* + ModRM */
|
|
#define ASM_UD2 ".byte 0x0f, 0x0b"
|
|
|
|
#define INSN_UD0 0xff0f
|
|
#define INSN_UD2 0x0b0f
|
|
|
|
-#define LEN_UD2 2
|
|
+#define LEN_UD0 2
|
|
|
|
#ifdef CONFIG_GENERIC_BUG
|
|
|
|
@@ -76,7 +79,7 @@ do { \
|
|
|
|
#define __WARN_FLAGS(flags) \
|
|
do { \
|
|
- _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \
|
|
+ _BUG_FLAGS(ASM_UD0, BUGFLAG_WARNING|(flags)); \
|
|
annotate_reachable(); \
|
|
} while (0)
|
|
|
|
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
|
|
index 3d9b2308e7fa..446c9ef8cfc3 100644
|
|
--- a/arch/x86/kernel/traps.c
|
|
+++ b/arch/x86/kernel/traps.c
|
|
@@ -181,7 +181,7 @@ int fixup_bug(struct pt_regs *regs, int trapnr)
|
|
break;
|
|
|
|
case BUG_TRAP_TYPE_WARN:
|
|
- regs->ip += LEN_UD2;
|
|
+ regs->ip += LEN_UD0;
|
|
return 1;
|
|
}
|
|
|