|
Message-ID: <CABCJKufL6=FiaeD8T0P+mK4JeR9J80hhjvJ6Z9S-m9UnCESxVA@mail.gmail.com> Date: Wed, 21 Oct 2020 17:22:59 -0700 From: Sami Tolvanen <samitolvanen@...gle.com> To: Peter Zijlstra <peterz@...radead.org> Cc: Josh Poimboeuf <jpoimboe@...hat.com>, Jann Horn <jannh@...gle.com>, "the arch/x86 maintainers" <x86@...nel.org>, Masahiro Yamada <masahiroy@...nel.org>, Steven Rostedt <rostedt@...dmis.org>, Will Deacon <will@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Paul E. McKenney" <paulmck@...nel.org>, Kees Cook <keescook@...omium.org>, Nick Desaulniers <ndesaulniers@...gle.com>, clang-built-linux <clang-built-linux@...glegroups.com>, Kernel Hardening <kernel-hardening@...ts.openwall.com>, linux-arch <linux-arch@...r.kernel.org>, Linux ARM <linux-arm-kernel@...ts.infradead.org>, linux-kbuild <linux-kbuild@...r.kernel.org>, kernel list <linux-kernel@...r.kernel.org>, linux-pci@...r.kernel.org Subject: Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps On Wed, Oct 21, 2020 at 1:56 AM Peter Zijlstra <peterz@...radead.org> 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/x86/entry/entry_64.S: > > > > __switch_to_asm()+0x0: undefined stack state > > > > .entry.text+0xffd: sibling call from callable instruction with > > > > modified stack frame > > > > .entry.text+0x48: stack state mismatch: cfa1=7-8 cfa2=-1+0 > > > > > > Not sure what this one's about, there's no OBJECT_FILES_NON_STANDARD? > > > > Correct, because with LTO, we won't have an ELF binary to process > > until we compile everything into vmlinux.o, and at that point we can > > no longer skip individual object files. > > I think what Josh was trying to say is; this file is subject to objtool > on a normal build and does not generate warnings. So why would it > generate warnings when subject to objtool as result of a vmlinux run > (due to LTO or otherwise). > > In fact, when I build a x86_64-defconfig and then run: > > $ objtool check -barf defconfig-build/vmlinux.o Note that I'm passing also --vmlinux and --duplicate to objtool when processing vmlinux.o, and this series has a patch to split noinstr validation from --vmlinux, so that's skipped. > I do not see these in particular, although I do see a lot of: > > "sibling call from callable instruction with modified stack frame" > "falls through to next function" > > that did not show up in the individual objtool runs during the build. I'm able to reproduce these warnings with gcc 9.3 + allyesconfig, with KASAN and GCOV_KERNEL disabled, as they are not enabled in LTO builds either. This is without the LTO series applied, so we also have the retpoline warnings: $ ./tools/objtool/objtool check -arfld vmlinux.o 2>&1 | grep -vE '(sibling|instr)' vmlinux.o: warning: objtool: wakeup_long64()+0x61: indirect jump found in RETPOLINE build vmlinux.o: warning: objtool: .text+0x826308a: indirect jump found in RETPOLINE build vmlinux.o: warning: objtool: .text+0x82630c5: indirect jump found in RETPOLINE build vmlinux.o: warning: objtool: .head.text+0x748: indirect jump found in RETPOLINE build vmlinux.o: warning: objtool: set_bringup_idt_handler.constprop.0()+0x0: undefined stack state vmlinux.o: warning: objtool: .entry.text+0x1634: redundant CLD vmlinux.o: warning: objtool: camellia_cbc_dec_32way()+0xb3: stack state mismatch: cfa1=7+520 cfa2=7+8 vmlinux.o: warning: objtool: camellia_ctr_32way()+0x1a: stack state mismatch: cfa1=7+520 cfa2=7+8 vmlinux.o: warning: objtool: aesni_gcm_init_avx_gen2()+0x12: unsupported stack pointer realignment vmlinux.o: warning: objtool: aesni_gcm_enc_update_avx_gen2()+0x12: unsupported stack pointer realignment vmlinux.o: warning: objtool: aesni_gcm_dec_update_avx_gen2()+0x12: unsupported stack pointer realignment vmlinux.o: warning: objtool: aesni_gcm_finalize_avx_gen2()+0x12: unsupported stack pointer realignment vmlinux.o: warning: objtool: aesni_gcm_init_avx_gen4()+0x12: unsupported stack pointer realignment vmlinux.o: warning: objtool: aesni_gcm_enc_update_avx_gen4()+0x12: unsupported stack pointer realignment vmlinux.o: warning: objtool: aesni_gcm_dec_update_avx_gen4()+0x12: unsupported stack pointer realignment vmlinux.o: warning: objtool: aesni_gcm_finalize_avx_gen4()+0x12: unsupported stack pointer realignment vmlinux.o: warning: objtool: sha1_transform_avx2()+0xc: unsupported stack pointer realignment vmlinux.o: warning: objtool: sha1_ni_transform()+0x7: unsupported stack pointer realignment vmlinux.o: warning: objtool: sha256_transform_rorx()+0x13: unsupported stack pointer realignment vmlinux.o: warning: objtool: sha512_transform_ssse3()+0x14: unsupported stack pointer realignment vmlinux.o: warning: objtool: sha512_transform_avx()+0x14: unsupported stack pointer realignment vmlinux.o: warning: objtool: sha512_transform_rorx()+0x7: unsupported stack pointer realignment vmlinux.o: warning: objtool: __x86_retpoline_rdi()+0x10: return with modified stack frame vmlinux.o: warning: objtool: __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=7+8 vmlinux.o: warning: objtool: __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=-1+0 vmlinux.o: warning: objtool: reset_early_page_tables()+0x0: stack state mismatch: cfa1=7+8 cfa2=-1+0 vmlinux.o: warning: objtool: .entry.text+0x48: stack state mismatch: cfa1=7-8 cfa2=-1+0 vmlinux.o: warning: objtool: .entry.text+0x15fd: stack state mismatch: cfa1=7-8 cfa2=-1+0 vmlinux.o: warning: objtool: .entry.text+0x168c: stack state mismatch: cfa1=7-8 cfa2=-1+0 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 the first .entry.text warning: $ ./tools/objtool/objtool check -barfld vmlinux.o ... vmlinux.o: warning: objtool: set_bringup_idt_handler.constprop.0()+0x0: undefined stack state vmlinux.o: warning: objtool: xen_hypercall_set_trap_table()+0x0: <=== (sym) ... vmlinux.o: warning: objtool: .entry.text+0xffd: sibling call from callable instruction with modified stack frame vmlinux.o: warning: objtool: .entry.text+0xfcb: (branch) Segmentation fault Going back to the allyesconfig+LTO vmlinux.o, the "undefined stack state" warning looks quite similar: $ ./tools/objtool/objtool check -barlfd vmlinux.o vmlinux.o: warning: objtool: __switch_to_asm()+0x0: undefined stack state vmlinux.o: warning: objtool: xen_hypercall_set_trap_table()+0x0: <=== (sym) vmlinux.o: warning: objtool: .entry.text+0xffd: sibling call from callable instruction with modified stack frame vmlinux.o: warning: objtool: .entry.text+0xfcb: (branch) Segmentation fault Sami
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.