Re: gcc-8 objtool warnings

From: Arnd Bergmann
Date: Mon Sep 11 2017 - 10:34:59 EST


On Thu, Aug 24, 2017 at 9:19 PM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> On Thu, Aug 24, 2017 at 12:14:27PM +0200, Arnd Bergmann wrote:
>> On Wed, Aug 23, 2017 at 6:01 PM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>> > On Wed, Aug 23, 2017 at 03:38:02PM +0200, Arnd Bergmann wrote:
>> >> On Wed, Aug 23, 2017 at 2:48 PM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>> >> > On Wed, Aug 23, 2017 at 02:22:34PM +0200, Arnd Bergmann wrote:
>> >> >> ...
>> >> >>
>> >> >> 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?
>> >>
>> >> Attached here now.
>> >
>> > Ok, looks like I'll need to add support for this new pattern (jumping to
>> > a .cold section in .text.unlikely).
>> >
>> > I'm also about to start work on fixing that other issue you found with
>> > GCC's inefficient update of the stack pointer.
>> >
>> > I really appreciate your finding all these warnings (and getting advance
>> > GCC 8 testing). Thanks again!
>>
>> No worries. I've disabled the four warnings in objtool that triggered now
>> and almost all are gone, but I still get a few warnings after doing additional
>> randconfig builds.
>
> Ok, I've got a fix for *most* of them below.
>
> Still need to fix the gc.o warning, which at first glance looks like a
> new switch statement pattern.

I now got around to testing your patch, and ran into a few remaining
problems:

1. one configuration causing tons of warnings, on most compiler
versions (4.9 and newer), and even a couple of "unreachable
instruction warnings on gcc-4.3.

arch/x86/mm/pageattr.o: warning: objtool: set_memory_x()+0x3a: call
without frame pointer save/setup
security/keys/keyring.o: warning: objtool: keyring_read()+0x70: leave
instruction with modified stack frame
arch/x86/events/intel/pt.o: warning: objtool:
pt_event_addr_filters_sync uses BP as a scratch register

2. one configuration showing two warnings in a file that is compile
with "-O0", reproducible with gcc-4.9 and above (gcc-6 and above show
slightly different results from older versions):

crypto/jitterentropy.o: warning: objtool: jent_stuck()+0xbc: leave
instruction with modified stack frame
crypto/jitterentropy.o: warning: objtool:
jent_entropy_collector_free()+0x64: leave instruction with modified
stack frame

or

crypto/jitterentropy.o: warning: objtool: jent_fold_time()+0x3b: call
without frame pointer save/setup
crypto/jitterentropy.o: warning: objtool: jent_stuck()+0x1d: call
without frame pointer save/setup
crypto/jitterentropy.o: warning: objtool: jent_unbiased_bit()+0x15:
call without frame pointer save/setup
crypto/jitterentropy.o: warning: objtool: jent_read_entropy()+0x32:
call without frame pointer save/setup
crypto/jitterentropy.o: warning: objtool:
jent_entropy_collector_free()+0x19: call without frame pointer
save/setup

3. A few dozen "sibling call from callable instruction with modified
stack frame" warnings in one configuration using gcc-8, e.g.
drivers/infiniband/hw/cxgb4/ev.o: warning: objtool:
c4iw_ev_dispatch()+0xff: sibling call from callable instruction with
modified stack frame
drivers/infiniband/ulp/srpt/ib_srpt.o: warning: objtool:
srpt_rdma_read_done.cold.40()+0xa3: sibling call from callable
instruction with modified stack frame
drivers/isdn/hardware/avm/b1.o: warning: objtool:
b1_parse_version()+0x234: sibling call from callable instruction with
modified stack frame
drivers/isdn/hardware/mISDN/mISDNisar.o: warning: objtool:
isar_fill_fifo()+0x17f: sibling call from callable instruction with
modified stack frame

4. a small number of other warnings in various configurations, also using gcc-8:

fs/btrfs/extent_io.o: warning: objtool: __clear_extent_bit() falls
through to next function endio_readpage_release_extent()
drivers/mtd/nand/nand_base.o: warning: objtool:
nand_scan_tail()+0x25f: sibling call from callable instruction with
modified stack frame
fs/fat/inode.o: warning: objtool: parse_options()+0x26c: unreachable instruction
drivers/media/tuners/tuner-simple.o: warning: objtool:
simple_set_params.cold.20()+0x0: unreachable instruction
drivers/media/tuners/tda8290.o: warning: objtool:
tda829x_attach.cold.18()+0x0: unreachable instruction
drivers/media/tuners/xc5000.o: warning: objtool:
xc5000_set_digital_params.cold.32()+0xe5: unreachable instruction
drivers/mtd/nand/nand_base.o: warning: objtool:
nand_scan_tail()+0x231: sibling call from callable instruction with
modified stack frame
fs/btrfs/extent_io.o: warning: objtool: __clear_extent_bit() falls
through to next function set_extent_bit()
drivers/edac/mce_amd.o: warning: objtool: f16h_mc2_mce()+0x32: sibling
call from callable instruction with modified stack frame
drivers/gpu/drm/radeon/cik.o: warning: objtool:
cik_init_microcode()+0x4d: sibling call from callable instruction with
modified stack frame
drivers/media/dvb-frontends/drxk_hard.o: warning: objtool:
set_qam.constprop.9()+0x778: sibling call from callable instruction
with modified stack frame
drivers/message/fusion/mptbase.o: warning: objtool:
mpt_HardResetHandler() falls through to next function
mpt_Soft_Hard_ResetHandler()
drivers/message/fusion/mptbase.o: warning: objtool:
mpt_Soft_Hard_ResetHandler() falls through to next function
mptbase_sas_persist_operation()
drivers/video/fbdev/tridentfb.o: warning: objtool:
trident_pci_probe.part.9()+0x1e1: sibling call from callable
instruction with modified stack frame
drivers/message/fusion/mptbase.o: warning: objtool:
mpt_Soft_Hard_ResetHandler() falls through to next function
mptbase_sas_persist_operation()

I've uploaded the relevant files for you to

https://drive.google.com/file/d/0B_XQwQ5KlfJAbUtrTVJaRmJIZUk/view?usp=sharing

Arnd