x86/debug, objtool: Annotate WARN()-related UD2 as reachable

"Linux Kernel Mailing List" <[email protected]> Thu, 15 Feb 2018 01:31:43 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/2b5db66862b95532cb6cca8165ae6eb73633cf85
Commit:     2b5db66862b95532cb6cca8165ae6eb73633cf85
Parent:     fe24e27128252c230a34a6c628da2bf1676781ea
Refname:    refs/heads/master
Author:     Josh Poimboeuf <[email protected]>
AuthorDate: Thu Feb 8 17:09:26 2018 -0600
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu Feb 15 01:15:49 2018 +0100

    x86/debug, objtool: Annotate WARN()-related UD2 as reachable
    
    By default, objtool assumes that a UD2 is a dead end.  This is mainly
    because GCC 7+ sometimes inserts a UD2 when it detects a divide-by-zero
    condition.
    
    Now that WARN() is moving back to UD2, annotate the code after it as
    reachable so objtool can follow the code flow.
    
    Reported-by: Borislav Petkov <[email protected]>
    Signed-off-by: Josh Poimboeuf <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Arjan van de Ven <[email protected]>
    Cc: Brian Gerst <[email protected]>
    Cc: Denys Vlasenko <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: kbuild test robot <[email protected]>
    Link: http://lkml.kernel.org/r/0e483379275a42626ba8898117f918e1bf661e40.1518130694.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar <[email protected]>
---
 arch/x86/include/asm/bug.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index 34d99af43994..71e6f4bf9161 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -77,7 +77,11 @@ do {								\
 	unreachable();						\
 } while (0)
 
-#define __WARN_FLAGS(flags)	_BUG_FLAGS(ASM_UD0, BUGFLAG_WARNING|(flags))
+#define __WARN_FLAGS(flags)					\
+do {								\
+	_BUG_FLAGS(ASM_UD0, BUGFLAG_WARNING|(flags));		\
+	annotate_reachable();					\
+} while (0)
 
 #include <asm-generic/bug.h>
 
--
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