[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180104173203.zgy3g36wgaoeuii7@treble>
Date: Thu, 4 Jan 2018 11:32:03 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Markus <M4rkusXXL@....de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: objtool segfault with ORC unwinder enabled
On Thu, Jan 04, 2018 at 05:56:30PM +0100, Markus wrote:
> On Thursday, 4 January 2018 16:46:13 CET Josh Poimboeuf wrote:
> > On Wed, Jan 03, 2018 at 06:26:19PM +0100, Markus wrote:
> > > > > > I'm unable to recreate. Can you attach one of the .o files (like
> > > > > > the
> > > > > > above irq.o)?
> > > > >
> > > > > Sure, see attached. (From vanilla linux-4.14.11.)
> > > >
> > > > There's something weird with the toolchain. The object file doesn't
> > > > have an ELF section symbol for the .irqentry.text section.
> > > >
> > > > Are there any special KCFLAGS being added? Can you build the object
> > > > with V=1 to show the full gcc command line?
> > >
> > > I have not added anything. There is no env variable set like $KCFLAGS or
> > > $CFLAGS. (If that was the question.)
> > >
> > > I think you mean this line from output:
> > > gcc -Wp,-MD,arch/x86/kernel/.irq.o.d -nostdinc -isystem
> > > /usr/lib/gcc/x86_64- pc-linux-gnu/6.4.0/include -I./arch/x86/include
> > > -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi
> > > -I./arch/x86/include/generated/uapi -I./ include/uapi
> > > -I./include/generated/uapi -include ./include/linux/kconfig.h -
> > > D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-
> > > aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration
> > > -Wno- format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2
> > > -mno-3dnow - mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387
> > > -mno-fp-ret-in-387 - mpreferred-stack-boundary=3 -mskip-rax-setup
> > > -mtune=generic -mno-red-zone - mcmodel=kernel -funit-at-a-time
> > > -DCONFIG_AS_CFI=1 -
> > > DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1
> > > -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1
> > > -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 - DCONFIG_AS_AVX512=1
> > > -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno- sign-compare
> > > -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -
> > > Wno-frame-address -O2 --param=allow-store-data-races=0 -DCC_HAVE_ASM_GOTO
> > > - Wframe-larger-than=2048 -fno-stack-protector
> > > -Wno-unused-but-set-variable - Wno-unused-const-variable
> > > -fomit-frame-pointer -fno-var-tracking-assignments -
> > > Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-
> > > stack-check -fconserve-stack -Werror=implicit-int
> > > -Werror=strict-prototypes - Werror=date-time
> > > -Werror=incompatible-pointer-types -Werror=designated-init -
> > > Iarch/x86/kernel/../include/asm/trace -DKBUILD_BASENAME='"irq"' -
> > > DKBUILD_MODNAME='"irq"' -c -o arch/x86/kernel/.tmp_irq.o
> > > arch/x86/kernel/irq.c
> > >
> > > The next line is the objtool that segfaults.
> >
> > I don't see anything unusual there. Are there any Gentoo patches
> > against either the kernel or GCC which would strip unused symbols?
>
> The kernel is the vanilla kernel. (4.14.11 and also 4.15-rc6)
> Its not a gentoo specific gcc patch. (Then every gentoo user would be
> affected?)
>
> But I enabled ld.gold as default linker like 5 years ago. Never had a problem
> with this.
>
> Is ld.gold supposed to fail here?
>
> I switched back to ld.bfd and it seems to work.
Ah, that explains it. With CONFIG_MODVERSIONS, the linker does some
work after gcc, but before objtool. Can you try this patch? (Note this
isn't the final patch, as this breaks the CONFIG_MODVERSIONS=n case.)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index cb8997ed0149..3cf3cc6077ea 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -270,7 +270,7 @@ endif
# 'OBJECT_FILES_NON_STANDARD_foo.o := 'n': override directory skip for a file
cmd_objtool = $(if $(patsubst y%,, \
$(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \
- $(__objtool_obj) $(objtool_args) "$(@)";)
+ $(__objtool_obj) $(objtool_args) "$(@D)/.tmp_$(@F)";)
objtool_obj = $(if $(patsubst y%,, \
$(OBJECT_FILES_NON_STANDARD_$(basetarget).o)$(OBJECT_FILES_NON_STANDARD)n), \
$(__objtool_obj))
@@ -286,16 +286,16 @@ objtool_dep = $(objtool_obj) \
define rule_cc_o_c
$(call echo-cmd,checksrc) $(cmd_checksrc) \
$(call cmd_and_fixdep,cc_o_c) \
+ $(call echo-cmd,objtool) $(cmd_objtool) \
$(cmd_modversions_c) \
$(cmd_checkdoc) \
- $(call echo-cmd,objtool) $(cmd_objtool) \
$(call echo-cmd,record_mcount) $(cmd_record_mcount)
endef
define rule_as_o_S
$(call cmd_and_fixdep,as_o_S) \
- $(cmd_modversions_S) \
- $(call echo-cmd,objtool) $(cmd_objtool)
+ $(call echo-cmd,objtool) $(cmd_objtool) \
+ $(cmd_modversions_S)
endef
# List module undefined symbols (or empty line if not enabled)
Powered by blists - more mailing lists