]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.21/x86-debug-objtool-annotate-warn-related-ud2-as-reachable.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.14.21 / x86-debug-objtool-annotate-warn-related-ud2-as-reachable.patch
1 From 2b5db66862b95532cb6cca8165ae6eb73633cf85 Mon Sep 17 00:00:00 2001
2 From: Josh Poimboeuf <jpoimboe@redhat.com>
3 Date: Thu, 8 Feb 2018 17:09:26 -0600
4 Subject: x86/debug, objtool: Annotate WARN()-related UD2 as reachable
5
6 From: Josh Poimboeuf <jpoimboe@redhat.com>
7
8 commit 2b5db66862b95532cb6cca8165ae6eb73633cf85 upstream.
9
10 By default, objtool assumes that a UD2 is a dead end. This is mainly
11 because GCC 7+ sometimes inserts a UD2 when it detects a divide-by-zero
12 condition.
13
14 Now that WARN() is moving back to UD2, annotate the code after it as
15 reachable so objtool can follow the code flow.
16
17 Reported-by: Borislav Petkov <bp@alien8.de>
18 Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
19 Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
20 Cc: Andy Lutomirski <luto@kernel.org>
21 Cc: Arjan van de Ven <arjan@linux.intel.com>
22 Cc: Brian Gerst <brgerst@gmail.com>
23 Cc: Denys Vlasenko <dvlasenk@redhat.com>
24 Cc: H. Peter Anvin <hpa@zytor.com>
25 Cc: Linus Torvalds <torvalds@linux-foundation.org>
26 Cc: Peter Zijlstra <peterz@infradead.org>
27 Cc: Thomas Gleixner <tglx@linutronix.de>
28 Cc: kbuild test robot <fengguang.wu@intel.com>
29 Link: http://lkml.kernel.org/r/0e483379275a42626ba8898117f918e1bf661e40.1518130694.git.jpoimboe@redhat.com
30 Signed-off-by: Ingo Molnar <mingo@kernel.org>
31 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32
33 ---
34 arch/x86/include/asm/bug.h | 6 +++++-
35 1 file changed, 5 insertions(+), 1 deletion(-)
36
37 --- a/arch/x86/include/asm/bug.h
38 +++ b/arch/x86/include/asm/bug.h
39 @@ -77,7 +77,11 @@ do { \
40 unreachable(); \
41 } while (0)
42
43 -#define __WARN_FLAGS(flags) _BUG_FLAGS(ASM_UD0, BUGFLAG_WARNING|(flags))
44 +#define __WARN_FLAGS(flags) \
45 +do { \
46 + _BUG_FLAGS(ASM_UD0, BUGFLAG_WARNING|(flags)); \
47 + annotate_reachable(); \
48 +} while (0)
49
50 #include <asm-generic/bug.h>
51