Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-13 Thread Josh Poimboeuf
On Fri, Nov 13, 2020 at 03:31:34PM -0800, Sami Tolvanen wrote: > > #else /* !CONFIG_STACK_VALIDATION */ > > @@ -123,6 +129,8 @@ struct unwind_hint { > > .macro UNWIND_HINT sp_reg:req sp_offset=0 type:req end=0 > > .endm > > #endif > > +.macro STACK_FRAME_NON_STANDARD func:req > > +.endm > > Th

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-13 Thread Sami Tolvanen
On Fri, Nov 13, 2020 at 2:34 PM Josh Poimboeuf wrote: > > On Fri, Nov 13, 2020 at 12:24:32PM -0800, Sami Tolvanen wrote: > > > I still don't see this warning for some reason. > > > > Do you have CONFIG_XEN enabled? I can reproduce this on ToT master as > > follows: > > > > $ git rev-parse HEAD >

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-13 Thread Josh Poimboeuf
On Fri, Nov 13, 2020 at 02:54:32PM -0800, Sami Tolvanen wrote: > On Fri, Nov 13, 2020 at 2:34 PM Josh Poimboeuf wrote: > > > > On Fri, Nov 13, 2020 at 12:24:32PM -0800, Sami Tolvanen wrote: > > > > I still don't see this warning for some reason. > > > > > > Do you have CONFIG_XEN enabled? I can re

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-13 Thread Sami Tolvanen
On Fri, Nov 13, 2020 at 2:34 PM Josh Poimboeuf wrote: > > On Fri, Nov 13, 2020 at 12:24:32PM -0800, Sami Tolvanen wrote: > > > I still don't see this warning for some reason. > > > > Do you have CONFIG_XEN enabled? I can reproduce this on ToT master as > > follows: > > > > $ git rev-parse HEAD >

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-13 Thread Josh Poimboeuf
On Fri, Nov 13, 2020 at 12:24:32PM -0800, Sami Tolvanen wrote: > > I still don't see this warning for some reason. > > Do you have CONFIG_XEN enabled? I can reproduce this on ToT master as follows: > > $ git rev-parse HEAD > 585e5b17b92dead8a3aca4e3c9876fbca5f7e0ba > $ make defconfig && \ > ./scr

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-13 Thread Josh Poimboeuf
On Fri, Nov 13, 2020 at 12:24:32PM -0800, Sami Tolvanen wrote: > On Fri, Nov 13, 2020 at 11:54 AM Josh Poimboeuf wrote: > > > > On Tue, Nov 10, 2020 at 10:59:55AM -0800, Sami Tolvanen wrote: > > > On Tue, Nov 10, 2020 at 9:46 AM Josh Poimboeuf > > > wrote: > > > > > > > > On Mon, Nov 09, 2020 at

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-13 Thread Sami Tolvanen
On Fri, Nov 13, 2020 at 11:54 AM Josh Poimboeuf wrote: > > On Tue, Nov 10, 2020 at 10:59:55AM -0800, Sami Tolvanen wrote: > > On Tue, Nov 10, 2020 at 9:46 AM Josh Poimboeuf wrote: > > > > > > On Mon, Nov 09, 2020 at 08:29:24PM -0600, Josh Poimboeuf wrote: > > > > On Mon, Nov 09, 2020 at 03:11:41P

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-13 Thread Josh Poimboeuf
On Tue, Nov 10, 2020 at 10:59:55AM -0800, Sami Tolvanen wrote: > On Tue, Nov 10, 2020 at 9:46 AM Josh Poimboeuf wrote: > > > > On Mon, Nov 09, 2020 at 08:29:24PM -0600, Josh Poimboeuf wrote: > > > On Mon, Nov 09, 2020 at 03:11:41PM -0800, Sami Tolvanen wrote: > > > > CONFIG_XEN > > > > > > > > __s

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-10 Thread Sami Tolvanen
On Tue, Nov 10, 2020 at 9:46 AM Josh Poimboeuf wrote: > > On Mon, Nov 09, 2020 at 08:29:24PM -0600, Josh Poimboeuf wrote: > > On Mon, Nov 09, 2020 at 03:11:41PM -0800, Sami Tolvanen wrote: > > > CONFIG_XEN > > > > > > __switch_to_asm()+0x0: undefined stack state > > > xen_hypercall_set_trap_tabl

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-10 Thread Josh Poimboeuf
On Mon, Nov 09, 2020 at 08:29:24PM -0600, Josh Poimboeuf wrote: > On Mon, Nov 09, 2020 at 03:11:41PM -0800, Sami Tolvanen wrote: > > CONFIG_XEN > > > > __switch_to_asm()+0x0: undefined stack state > > xen_hypercall_set_trap_table()+0x0: <=== (sym) With your branch + GCC 9 I can recreate all the

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-10 Thread Josh Poimboeuf
On Mon, Nov 09, 2020 at 08:48:01PM -0800, Sami Tolvanen wrote: > On Mon, Nov 9, 2020 at 6:29 PM Josh Poimboeuf wrote: > > How would I recreate all these warnings? > > You can reproduce all of these using a normal gcc build without any of > the LTO patches by running objtool check -arfld vmlinux.o

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-09 Thread Sami Tolvanen
On Mon, Nov 9, 2020 at 6:29 PM Josh Poimboeuf wrote: > How would I recreate all these warnings? You can reproduce all of these using a normal gcc build without any of the LTO patches by running objtool check -arfld vmlinux.o. However, with gcc you'll see even more warnings due to duplicate symbol

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-09 Thread Nick Desaulniers
On Mon, Nov 9, 2020 at 6:29 PM Josh Poimboeuf wrote: > > Also, any details on how to build clang would be appreciated, it's been > a while since I tried. $ git clone https://github.com/llvm/llvm-project.git --depth 1 $ mkdir llvm-project/llvm/build $ cd !$ $ cmake .. -DCMAKE_BUILD_TYPE=Release -G

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-09 Thread Josh Poimboeuf
On Mon, Nov 09, 2020 at 03:11:41PM -0800, Sami Tolvanen wrote: > On Fri, Oct 23, 2020 at 10:36 AM Sami Tolvanen > wrote: > > > > On Wed, Oct 21, 2020 at 05:22:59PM -0700, Sami Tolvanen wrote: > > > There are a couple of differences, like the first "undefined stack > > > state" warning pointing to

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-11-09 Thread Sami Tolvanen
On Fri, Oct 23, 2020 at 10:36 AM Sami Tolvanen wrote: > > On Wed, Oct 21, 2020 at 05:22:59PM -0700, Sami Tolvanen wrote: > > There are a couple of differences, like the first "undefined stack > > state" warning pointing to set_bringup_idt_handler.constprop.0() > > instead of __switch_to_asm(). I t

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-23 Thread Nick Desaulniers
On Fri, Oct 23, 2020 at 10:48 AM Sami Tolvanen wrote: > > On Thu, Oct 22, 2020 at 09:25:53AM +0200, Peter Zijlstra wrote: > > > There's a new linker flag for renaming duplicates: > > > > > > https://sourceware.org/bugzilla/show_bug.cgi?id=26391 > > > > > > But I guess that doesn't help us now. >

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-23 Thread Sami Tolvanen
On Thu, Oct 22, 2020 at 09:25:53AM +0200, Peter Zijlstra wrote: > On Wed, Oct 21, 2020 at 04:27:47PM -0500, Josh Poimboeuf wrote: > > On Wed, Oct 21, 2020 at 11:32:13AM +0200, Peter Zijlstra wrote: > > > On Wed, Oct 21, 2020 at 10:56:06AM +0200, Peter Zijlstra wrote: > > > > > > > I do not see the

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-23 Thread Sami Tolvanen
On Wed, Oct 21, 2020 at 05:22:59PM -0700, Sami Tolvanen wrote: > There are a couple of differences, like the first "undefined stack > state" warning pointing to set_bringup_idt_handler.constprop.0() > instead of __switch_to_asm(). I tried running this with --backtrace, > but objtool segfaults at th

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-22 Thread Peter Zijlstra
On Wed, Oct 21, 2020 at 04:27:47PM -0500, Josh Poimboeuf wrote: > On Wed, Oct 21, 2020 at 11:32:13AM +0200, Peter Zijlstra wrote: > > On Wed, Oct 21, 2020 at 10:56:06AM +0200, Peter Zijlstra wrote: > > > > > I do not see these in particular, although I do see a lot of: > > > > > > "sibling call

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-21 Thread Sami Tolvanen
On Wed, Oct 21, 2020 at 1:56 AM Peter Zijlstra wrote: > > On Tue, Oct 20, 2020 at 12:24:37PM -0700, Sami Tolvanen wrote: > > > > Building allyesconfig with this series and LTO enabled, I still see > > > > the following objtool warnings for vmlinux.o, grouped by source file: > > > > > > > > arch/x8

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-21 Thread Josh Poimboeuf
On Wed, Oct 21, 2020 at 11:32:13AM +0200, Peter Zijlstra wrote: > On Wed, Oct 21, 2020 at 10:56:06AM +0200, Peter Zijlstra wrote: > > > I do not see these in particular, although I do see a lot of: > > > > "sibling call from callable instruction with modified stack frame" > > defconfig-build/v

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-21 Thread Josh Poimboeuf
On Wed, Oct 21, 2020 at 11:51:33AM +0200, Peter Zijlstra wrote: > On Tue, Oct 20, 2020 at 01:52:17PM -0500, Josh Poimboeuf wrote: > > > arch/x86/lib/retpoline.S: > > > __x86_retpoline_rdi()+0x10: return with modified stack frame > > > __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-21 Thread Sami Tolvanen
On Wed, Oct 21, 2020 at 1:56 AM Peter Zijlstra wrote: > > On Tue, Oct 20, 2020 at 12:24:37PM -0700, Sami Tolvanen wrote: > > > > Building allyesconfig with this series and LTO enabled, I still see > > > > the following objtool warnings for vmlinux.o, grouped by source file: > > > > > > > > arch/x8

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-21 Thread Peter Zijlstra
On Tue, Oct 20, 2020 at 01:52:17PM -0500, Josh Poimboeuf wrote: > > arch/x86/lib/retpoline.S: > > __x86_retpoline_rdi()+0x10: return with modified stack frame > > __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=7+8 > > __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2020 at 10:56:06AM +0200, Peter Zijlstra wrote: > I do not see these in particular, although I do see a lot of: > > "sibling call from callable instruction with modified stack frame" defconfig-build/vmlinux.o: warning: objtool: msr_write()+0x10a: sibling call from callable ins

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-21 Thread Peter Zijlstra
On Wed, Oct 21, 2020 at 10:56:06AM +0200, Peter Zijlstra wrote: > The "falls through to next function" seems to be limited to things like: > > warning: objtool: setup_vq() falls through to next function setup_vq.cold() > warning: objtool: e1000_xmit_frame() falls through to next function > e

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-21 Thread Peter Zijlstra
On Tue, Oct 20, 2020 at 12:24:37PM -0700, Sami Tolvanen wrote: > > > Building allyesconfig with this series and LTO enabled, I still see > > > the following objtool warnings for vmlinux.o, grouped by source file: > > > > > > arch/x86/entry/entry_64.S: > > > __switch_to_asm()+0x0: undefined stack st

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-20 Thread Sami Tolvanen
On Tue, Oct 20, 2020 at 11:52 AM Josh Poimboeuf wrote: > > On Tue, Oct 20, 2020 at 09:45:06AM -0700, Sami Tolvanen wrote: > > On Thu, Oct 15, 2020 at 1:39 PM Josh Poimboeuf wrote: > > > > > > On Thu, Oct 15, 2020 at 12:22:16PM +0200, Peter Zijlstra wrote: > > > > On Thu, Oct 15, 2020 at 01:23:41A

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-20 Thread Josh Poimboeuf
On Tue, Oct 20, 2020 at 09:45:06AM -0700, Sami Tolvanen wrote: > On Thu, Oct 15, 2020 at 1:39 PM Josh Poimboeuf wrote: > > > > On Thu, Oct 15, 2020 at 12:22:16PM +0200, Peter Zijlstra wrote: > > > On Thu, Oct 15, 2020 at 01:23:41AM +0200, Jann Horn wrote: > > > > > > > It would probably be good to

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-20 Thread Sami Tolvanen
On Thu, Oct 15, 2020 at 1:39 PM Josh Poimboeuf wrote: > > On Thu, Oct 15, 2020 at 12:22:16PM +0200, Peter Zijlstra wrote: > > On Thu, Oct 15, 2020 at 01:23:41AM +0200, Jann Horn wrote: > > > > > It would probably be good to keep LTO and non-LTO builds in sync about > > > which files are subjected

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-15 Thread Josh Poimboeuf
On Thu, Oct 15, 2020 at 12:22:16PM +0200, Peter Zijlstra wrote: > On Thu, Oct 15, 2020 at 01:23:41AM +0200, Jann Horn wrote: > > > It would probably be good to keep LTO and non-LTO builds in sync about > > which files are subjected to objtool checks. So either you should be > > removing the OBJECT

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-15 Thread Peter Zijlstra
On Thu, Oct 15, 2020 at 01:23:41AM +0200, Jann Horn wrote: > It would probably be good to keep LTO and non-LTO builds in sync about > which files are subjected to objtool checks. So either you should be > removing the OBJECT_FILES_NON_STANDARD annotations for anything that > is linked into the mai

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-14 Thread Kees Cook
On Mon, Oct 12, 2020 at 05:32:00PM -0700, Sami Tolvanen wrote: > Running objtool --vmlinux --duplicate on vmlinux.o produces a few > warnings about indirect jumps with retpoline: > > vmlinux.o: warning: objtool: wakeup_long64()+0x61: indirect jump > found in RETPOLINE build > ... > > This c

Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-14 Thread Jann Horn
+objtool folks On Tue, Oct 13, 2020 at 2:35 AM Sami Tolvanen wrote: > Running objtool --vmlinux --duplicate on vmlinux.o produces a few > warnings about indirect jumps with retpoline: > > vmlinux.o: warning: objtool: wakeup_long64()+0x61: indirect jump > found in RETPOLINE build > ... > > T

[PATCH v6 22/25] x86/asm: annotate indirect jumps

2020-10-12 Thread Sami Tolvanen
Running objtool --vmlinux --duplicate on vmlinux.o produces a few warnings about indirect jumps with retpoline: vmlinux.o: warning: objtool: wakeup_long64()+0x61: indirect jump found in RETPOLINE build ... This change adds ANNOTATE_RETPOLINE_SAFE annotations to the jumps in assembly code to