* [PATCH] x86/asm: Make objtool unreachable macros independent from GCC version
@ 2017-07-25 14:44 Josh Poimboeuf
2017-07-25 14:57 ` [tip:x86/asm] " tip-bot for Josh Poimboeuf
0 siblings, 1 reply; 2+ messages in thread
From: Josh Poimboeuf @ 2017-07-25 14:44 UTC (permalink / raw)
To: x86; +Cc: linux-kernel, Kees Cook
The ASM_UNREACHABLE macro isn't GCC version-specific, so move it outside
the GCC 4.5+ check. Otherwise the 0-day robot will report objtool
warnings for uses of ASM_UNREACHABLE with GCC 4.4.
Also move the annotate_unreachable() macro so the related macros can
stay together.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: aa5d1b81500e ("x86/asm: Add ASM_UNREACHABLE")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
include/linux/compiler-gcc.h | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 09428df81873..2a34493e4d04 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -128,6 +128,22 @@
#define __always_unused __attribute__((unused))
#define __mode(x) __attribute__((mode(x)))
+#ifdef CONFIG_STACK_VALIDATION
+#define annotate_unreachable() ({ \
+ asm("%c0:\n\t" \
+ ".pushsection .discard.unreachable\n\t" \
+ ".long %c0b - .\n\t" \
+ ".popsection\n\t" : : "i" (__LINE__)); \
+})
+#define ASM_UNREACHABLE \
+ "999:\n\t" \
+ ".pushsection .discard.unreachable\n\t" \
+ ".long 999b - .\n\t" \
+ ".popsection\n\t"
+#else
+#define annotate_unreachable()
+#endif
+
/* gcc version specific checks */
#if GCC_VERSION < 30200
@@ -203,22 +219,6 @@
#endif
#endif
-#ifdef CONFIG_STACK_VALIDATION
-#define annotate_unreachable() ({ \
- asm("%c0:\n\t" \
- ".pushsection .discard.unreachable\n\t" \
- ".long %c0b - .\n\t" \
- ".popsection\n\t" : : "i" (__LINE__)); \
-})
-#define ASM_UNREACHABLE \
- "999:\n\t" \
- ".pushsection .discard.unreachable\n\t" \
- ".long 999b - .\n\t" \
- ".popsection\n\t"
-#else
-#define annotate_unreachable()
-#endif
-
/*
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
--
2.13.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip:x86/asm] x86/asm: Make objtool unreachable macros independent from GCC version
2017-07-25 14:44 [PATCH] x86/asm: Make objtool unreachable macros independent from GCC version Josh Poimboeuf
@ 2017-07-25 14:57 ` tip-bot for Josh Poimboeuf
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2017-07-25 14:57 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, keescook, torvalds, hpa, tglx, fengguang.wu, peterz,
jpoimboe, mingo
Commit-ID: 1ee6f00d1164955b7bdadd36fc0f2736754784d9
Gitweb: http://git.kernel.org/tip/1ee6f00d1164955b7bdadd36fc0f2736754784d9
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Tue, 25 Jul 2017 09:44:51 -0500
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 25 Jul 2017 16:54:07 +0200
x86/asm: Make objtool unreachable macros independent from GCC version
The ASM_UNREACHABLE macro isn't GCC version-specific, so move it outside
the GCC 4.5+ check. Otherwise the 0-day robot will report objtool
warnings for uses of ASM_UNREACHABLE with GCC 4.4.
Also move the annotate_unreachable() macro so the related macros can
stay together.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: aa5d1b81500e ("x86/asm: Add ASM_UNREACHABLE")
Link: http://lkml.kernel.org/r/fb18337dbf230fd36450d9faf19a2b2533dbcba1.1500993873.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/compiler-gcc.h | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 179375b..17cbe3c 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -128,6 +128,22 @@
#define __always_unused __attribute__((unused))
#define __mode(x) __attribute__((mode(x)))
+#ifdef CONFIG_STACK_VALIDATION
+#define annotate_unreachable() ({ \
+ asm("%c0:\n\t" \
+ ".pushsection .discard.unreachable\n\t" \
+ ".long %c0b - .\n\t" \
+ ".popsection\n\t" : : "i" (__LINE__)); \
+})
+#define ASM_UNREACHABLE \
+ "999:\n\t" \
+ ".pushsection .discard.unreachable\n\t" \
+ ".long 999b - .\n\t" \
+ ".popsection\n\t"
+#else
+#define annotate_unreachable()
+#endif
+
/* gcc version specific checks */
#if GCC_VERSION < 30200
@@ -201,22 +217,6 @@
#endif
#endif
-#ifdef CONFIG_STACK_VALIDATION
-#define annotate_unreachable() ({ \
- asm("%c0:\n\t" \
- ".pushsection .discard.unreachable\n\t" \
- ".long %c0b - .\n\t" \
- ".popsection\n\t" : : "i" (__LINE__)); \
-})
-#define ASM_UNREACHABLE \
- "999:\n\t" \
- ".pushsection .discard.unreachable\n\t" \
- ".long 999b - .\n\t" \
- ".popsection\n\t"
-#else
-#define annotate_unreachable()
-#endif
-
/*
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-25 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-25 14:44 [PATCH] x86/asm: Make objtool unreachable macros independent from GCC version Josh Poimboeuf
2017-07-25 14:57 ` [tip:x86/asm] " tip-bot for Josh Poimboeuf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox