Re: linux-next: Tree for Apr 14 (objtool crazy)
From: Josh Poimboeuf
Date: Tue Apr 14 2020 - 18:19:43 EST
On Tue, Apr 14, 2020 at 06:50:15AM -0700, Randy Dunlap wrote:
> On 4/13/20 7:39 PM, Stephen Rothwell wrote:
> > Hi all,
> >
> > Changes since 20200413:
> >
>
>
> I killed objtool after 49 minutes of CPU time:
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 6159 rdunlap 30 10 42756 8028 0 R 100.0 0.099 49:19.02 objtool
>
>
> /bin/sh: line 1: 6159 Terminated ./tools/objtool/objtool orc generate --no-fp --no-unreachable --uaccess drivers/i2c/busses/i2c-parport.o
I took an initial look at this one. I can dig more tomorrow unless
Peter beats me to it.
(gdb) bt
#0 0x000000000040df55 in sec_offset_hash (sec=0xc30930, offset=4334561216) at elf.h:104
#1 0x000000000040e907 in find_rela_by_dest_range (elf=0x7ffff64a4010, sec=0xc30930, offset=18446744073709551608, len=1) at elf.c:227
#2 0x000000000040ea67 in find_rela_by_dest (elf=0x7ffff64a4010, sec=0xc30710, offset=18446744073709551608) at elf.c:246
#3 0x0000000000408038 in find_jump_table (file=0x427620 <file>, func=0xc32bf0, insn=0xc4f840) at check.c:1118
#4 0x0000000000408242 in mark_func_jump_tables (file=0x427620 <file>, func=0xc32bf0) at check.c:1170
#5 0x00000000004083b6 in add_jump_table_alts (file=0x427620 <file>) at check.c:1215
#6 0x0000000000408b95 in decode_sections (file=0x427620 <file>) at check.c:1413
#7 0x000000000040bf44 in check (_objname=0x7fffffffceff "drivers/i2c/busses/i2c-parport.o", orc=true) at check.c:2508
#8 0x0000000000405580 in cmd_orc (argc=1, argv=0x7fffffffc9d8) at builtin-orc.c:41
#9 0x0000000000411297 in handle_internal_command (argc=6, argv=0x7fffffffc9d0) at objtool.c:96
#10 0x0000000000411349 in main (argc=6, argv=0x7fffffffc9d0) at objtool.c:119
It's an infinite loop in find_rela_by_dest_range() because offset is -8.
That comes from find_jump_table():
table_offset = text_rela->addend;
table_sec = text_rela->sym->sec;
...
table_rela = find_rela_by_dest(file->elf, table_sec, table_offset);
which comes from this gem:
00000000000001fd <line_set>:
1fd: 48 b8 00 00 00 00 00 movabs $0x0,%rax
204: 00 00 00
1ff: R_X86_64_64 .rodata-0x8
So objtool is getting confused by that -0x8 rela addend.
--
Josh