Re: [PATCH 2/2] x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit
From: Josh Poimboeuf
Date: Mon Mar 19 2018 - 22:28:12 EST
On Mon, Mar 19, 2018 at 04:22:55PM -0700, Matthias Kaehlcke wrote:
> > Here's a (surprisingly easy) fix for this particular issue, though I'd
> > be shocked if there weren't a bunch more issues lurking elsewhere. Let
> > me know how it goes.
>
> Thanks for having a look, this fixes the vast majority of warnings in
> a defconfig build!
Wow. Consider me shocked :-)
> The remaining warnings are:
>
> arch/x86/mm/pti.o: warning: objtool: pti_init() falls through to next
> function pti_user_pagetable_walk_pmd()
> s/debugfs/file.o: warning: objtool: full_proxy_llseek() falls through to next function full_proxy_read()
> fs/debugfs/file.o: warning: objtool: full_proxy_read() falls through to next function full_proxy_write()
> fs/debugfs/file.o: warning: objtool: full_proxy_write() falls through to next function full_proxy_poll()
> fs/debugfs/file.o: warning: objtool: full_proxy_poll() falls through to next function full_proxy_unlocked_ioctl()
> fs/debugfs/file.o: warning: objtool: full_proxy_unlocked_ioctl() falls through to next function fops_u8_open()
These all seem to be related to some weirdness with the UD2 instruction,
not necessarily an objtool issue per se.
Any chance this fixes some of the warnings? If not, I can try to build
with clang and look a little deeper.
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index ab4711c63601..315a8757b565 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -124,7 +124,12 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
# define ASM_UNREACHABLE
#endif
#ifndef unreachable
-# define unreachable() do { annotate_reachable(); do { } while (1); } while (0)
+#define unreachable() \
+ do { \
+ annotate_unreachable(); \
+ barrier_before_unreachable(); \
+ __builtin_unreachable(); \
+ } while (0)
#endif
/*