Bug 211693 - objtool segfault with certain kernel config and binutils-2.36.1
Summary: objtool segfault with certain kernel config and binutils-2.36.1
Status: RESOLVED CODE_FIX
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: x86-64 (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: platform_x86_64@kernel-bugs.osdl.org
URL: https://lore.kernel.org/lkml/9500f9c8...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-11 03:17 UTC by Xi Ruoyao
Modified: 2021-02-28 03:03 UTC (History)
0 users

See Also:
Kernel Version: 5.10.15
Subsystem:
Regression: No
Bisected commit-id:


Attachments
.config which triggers the bug (24.04 KB, application/gzip)
2021-02-11 03:17 UTC, Xi Ruoyao
Details

Description Xi Ruoyao 2021-02-11 03:17:27 UTC
Created attachment 295217 [details]
.config which triggers the bug

Hi kernel developers.

Since binutils-2.36.1 is released, we managed to incorporate them into Linux From Scratch (http://www.linuxfromscratch.org/lfs/view/development/).  Unfortunately, some users and editors report that they are getting segfaults from objtool trying to build the kernel.

$ make mrproper
$ gzip -cd ~/config-segfault.gz > .config
$ make arch/x86/kernel/apic/apic.o
(long output ...)
  CC      arch/x86/kernel/apic/apic.o
make[3]: *** [scripts/Makefile.build:279: arch/x86/kernel/apic/apic.o] Segmentation fault (core dumped)
make[3]: *** Deleting file 'arch/x86/kernel/apic/apic.o'
make[2]: *** [scripts/Makefile.build:496: arch/x86/kernel/apic] Error 2
make[1]: *** [scripts/Makefile.build:496: arch/x86/kernel] Error 2
make: *** [Makefile:1801: arch/x86] Error 2

It's reproducible with kernel source code of 5.10.x (at least 5.10.14 and 5.10.15).  It only happens if binutils-2.36 or 2.36.1 is used.  Binutils-2.35.x builds the kernel without any problem.

The stack backtrace is:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000000040c0ae in elf_rebuild_rela_reloc_section (nr=<optimized out>, 
    sec=0x2c6cee0) at elf.c:890
#1  elf_rebuild_reloc_section (elf=<optimized out>, sec=sec@entry=0x2c6cee0)
    at elf.c:911
#2  0x0000000000408b0d in create_static_call_sections (file=0x41f920 <file>)
    at check.c:520
#3  check (file=file@entry=0x41f920 <file>) at check.c:2918
#4  0x000000000040b2d2 in cmd_orc (argc=1, argv=<optimized out>)
    at builtin-orc.c:47
#5  0x00000000004026cb in handle_internal_command (argv=0x7fff961e2e00, argc=6)
    at objtool.c:128
#6  main (argc=6, argv=0x7fff961e2e00) at objtool.c:151

The .config file content triggering the issue is attached.
Comment 1 Xi Ruoyao 2021-02-11 03:19:40 UTC
Some discussion of this issue is at:

http://lists.linuxfromscratch.org/pipermail/lfs-support/2021-February/054087.html
Comment 2 Xi Ruoyao 2021-02-28 03:02:27 UTC
Fixed in 5.10.17, by backporting a patch.

Note You need to log in before you can comment on or make changes to this bug.