Re: gcc-8 objtool warnings

From: Josh Poimboeuf
Date: Wed Aug 23 2017 - 08:48:24 EST


On Wed, Aug 23, 2017 at 02:22:34PM +0200, Arnd Bergmann wrote:
> Hi Josh,
>
> I upgraded the compiler to gcc-8.0.0 (from earlier this week) and into one
> configuration that produces countless objtool warnings, starting with
>
> kernel/panic.o: warning: objtool: nmi_panic()+0x31: sibling call from
> callable instruction with modified stack frame
> kernel/panic.o: warning: objtool: __warn()+0x26: sibling call from
> callable instruction with modified stack frame
> kernel/panic.o: warning: objtool: nmi_panic.cold.0()+0x0: call without
> frame pointer save/setup
> kernel/panic.o: warning: objtool: __warn.cold.1()+0x0: call without
> frame pointer save/setup
> arch/x86/kernel/irq_64.o: warning: objtool: handle_irq()+0x8a: sibling
> call from callable instruction with modified stack frame
> arch/x86/kernel/dumpstack.o: warning: objtool: oops_end()+0x83:
> sibling call from callable instruction with modified stack frame
> kernel/exit.o: warning: objtool: do_exit()+0x39: sibling call from
> callable instruction with modified stack frame
> kernel/exit.o: warning: objtool: do_exit.cold.1()+0x0: call without
> frame pointer save/setup
> kernel/cred.o: warning: objtool: put_cred_rcu()+0x26: sibling call
> from callable instruction with modified stack frame
> kernel/cred.o: warning: objtool: put_cred_rcu.cold.1()+0x0: call
> without frame pointer save/setup
> mm/oom_kill.o: warning: objtool: oom_kill_process.isra.4()+0xfe:
> sibling call from callable instruction with modified stack frame
> mm/oom_kill.o: warning: objtool: out_of_memory()+0x556: sibling call
> from callable instruction with modified stack frame
> mm/oom_kill.o: warning: objtool: oom_kill_process.isra.4.cold.5()+0x0:
> call without frame pointer save/setup
> mm/oom_kill.o: warning: objtool: out_of_memory.cold.6()+0x0: call
> without frame pointer save/setup
> mm/page_alloc.o: warning: objtool: warn_alloc()+0x2f: sibling call
> from callable instruction with modified stack frame
> mm/page_alloc.o: warning: objtool: warn_alloc.cold.20()+0x9: call
> without frame pointer save/setup
> arch/x86/kernel/apic/io_apic.o: warning: objtool: mp_save_irq()+0x6c:
> sibling call from callable instruction with modified stack frame
>
> See https://pastebin.com/1EehhrcP for the .config file.
>
> I looked at a few examples, and they all seem to involve calling panic()
> at the end of a a function in .text.unlikely, e.g.
>
> 0000000000000390 <put_cred_rcu>:
> 390: 55 push %rbp
> 391: 48 89 e5 mov %rsp,%rbp
> 394: 41 55 push %r13
> 396: 41 54 push %r12
> 398: 53 push %rbx
> 399: 48 89 fb mov %rdi,%rbx
> 39c: 4c 8d ab 60 ff ff ff lea -0xa0(%rbx),%r13
> 3a3: e8 00 00 00 00 callq 3a8 <put_cred_rcu+0x18>
> 3a4: R_X86_64_PC32 __sanitizer_cov_trace_pc-0x4
> 3a8: 44 8b a3 70 ff ff ff mov -0x90(%rbx),%r12d
> 3af: 41 81 fc 44 61 65 44 cmp $0x44656144,%r12d
> 3b6: 0f 85 00 00 00 00 jne 3bc <put_cred_rcu+0x2c>
> 3b8: R_X86_64_PC32 .text.unlikely-0x4
>
> ...
>
> 0000000000000000 <put_cred_rcu.cold.1>:
> 0: e8 00 00 00 00 callq 5 <put_cred_rcu.cold.1+0x5>
> 1: R_X86_64_PC32 __sanitizer_cov_trace_pc-0x4
> 5: 44 8b 8b 64 ff ff ff mov -0x9c(%rbx),%r9d
> c: 48 8b 8b 68 ff ff ff mov -0x98(%rbx),%rcx
> 13: 44 89 e2 mov %r12d,%edx
> 16: 44 8b 83 60 ff ff ff mov -0xa0(%rbx),%r8d
> 1d: 4c 89 ee mov %r13,%rsi
> 20: 48 c7 c7 00 00 00 00 mov $0x0,%rdi
> 23: R_X86_64_32S .rodata.str1.8+0x28
> 27: e8 00 00 00 00 callq 2c <__kstrtab_creds_are_invalid+0x3>
> 28: R_X86_64_PC32 panic-0x4

Thanks. Can you send me one of the .o files?

--
Josh