|
Message-ID: <CABCJKucVjFtrOsw58kn4OnW5kdkUh8G7Zs4s6QU9s6O7soRiAA@mail.gmail.com> Date: Tue, 20 Oct 2020 12:24:37 -0700 From: Sami Tolvanen <samitolvanen@...gle.com> To: Josh Poimboeuf <jpoimboe@...hat.com> Cc: Peter Zijlstra <peterz@...radead.org>, 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 Tue, Oct 20, 2020 at 11:52 AM Josh Poimboeuf <jpoimboe@...hat.com> 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 <jpoimboe@...hat.com> 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 to objtool checks. So either you should be > > > > > removing the OBJECT_FILES_NON_STANDARD annotations for anything that > > > > > is linked into the main kernel (which would be a nice cleanup, if that > > > > > is possible), > > > > > > > > This, I've had to do that for a number of files already for the limited > > > > vmlinux.o passes we needed for noinstr validation. > > > > > > Getting rid of OBJECT_FILES_NON_STANDARD is indeed the end goal, though > > > I'm not sure how practical that will be for some of the weirder edge > > > case. > > > > > > On a related note, I have some old crypto cleanups which need dusting > > > off. > > > > 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. The sibling call warning is in swapgs_restore_regs_and_return_to_usermode and the stack state mismatch in entry_SYSCALL_64_after_hwframe. > > arch/x86/entry/entry_64_compat.S: > > .entry.text+0x1754: unsupported instruction in callable function This comes from a sysretl instruction in entry_SYSCALL_compat. > > .entry.text+0x1634: redundant CLD > > .entry.text+0x15fd: stack state mismatch: cfa1=7-8 cfa2=-1+0 > > .entry.text+0x168c: stack state mismatch: cfa1=7-8 cfa2=-1+0 > > Ditto. These are all from entry_SYSENTER_compat_after_hwframe. > > arch/x86/kernel/head_64.S: > > .head.text+0xfb: unsupported instruction in callable function > > Ditto. This is lretq in secondary_startup_64_no_verify. > > arch/x86/crypto/camellia-aesni-avx2-asm_64.S: > > camellia_cbc_dec_32way()+0xb3: stack state mismatch: cfa1=7+520 cfa2=7+8 > > camellia_ctr_32way()+0x1a: stack state mismatch: cfa1=7+520 cfa2=7+8 > > I can clean off my patches for all the crypto warnings. Great, sounds good. > > 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=-1+0 > > Is this with upstream? I thought we fixed that with > UNWIND_HINT_RET_OFFSET. Yes, and the UNWIND_HINT_RET_OFFSET is there. > > Josh, Peter, any thoughts on what would be the preferred way to fix > > these, or how to tell objtool to ignore this code? > > One way or another, the patches need to be free of warnings before > getting merged. I can help, though I'm traveling and only have limited > bandwidth for at least the rest of the month. > > Ideally we'd want to have objtool understand everything, with no > whitelisting, but some cases (e.g. suspend code) can be tricky. > > I wouldn't be opposed to embedding the whitelist in the binary, in a > discardable section. It should be relatively easy, but as I mentioned I > may or may not have time to work on it for a bit. I'm working half > days, and now the ocean beckons from the window of my camper. Something similar to STACK_FRAME_NON_STANDARD()? Using that seems to result in "BUG: why am I validating an ignored function?" warnings, so I suspect some additional changes are needed. 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.