On Wed, Feb 10, 2021 at 09:39:20PM +0100, Pierre Labastie wrote:
> On Wed, 2021-02-10 at 16:32 +0000, Ken Moffat wrote:
> > On Wed, Feb 10, 2021 at 10:44:31AM +0100, Pierre Labastie wrote:
> > > On Tue, 2021-02-09 at 17:14 -0500, Jean-Marc Pigeon wrote:

> > > 
> > > Since you two are the only ones (among the persons on this list, up
> > > to
> > > now) who see this, I guess it has something to do with either:
> > > - an option in the config, that you use and the others don't
> > > - some CFLAGS settings, but I doubt it, because the kernel build
> > > system
> > > resets them
> > > 
> > > > 
> > > > > > 
> > > > > > Feb  8 20:45:13 leshp klogd: [62379.838193] objtool[10870]:
> > > > > > segfault at 70 ip 000000000040c13e sp 00007ffd0f655670 error
> > > > > > 4 in
> > > > > > objtool[402000+11000]
> > > > > > followed by a dump of the code bytes.
> > > 
> > > objtool is a kernel thing. According to
> > > tools/objtool/Documentation/stack-validation.txt,
> > > "
> > > The kernel CONFIG_STACK_VALIDATION option enables a host tool named
> > > objtool which runs at compile time.  It has a "check" subcommand
> > > which
> > > analyzes every .o file and ensures the validity of its stack
> > > metadata.
> > > It enforces a set of rules on asm code and C inline assembly code
> > > so
> > > that stack traces can be reliable.
> > > "
> > > 
> > > Note that I do have that option set to y, but maybe other options
> > > in
> > > the "Compile-time checks and compiler options" may differ...
> > > 
> > > rebuilding with "make V=1", I see that objtool is run after each
> > > compilation. It might be interesting to compare the options that
> > > are
> > > passed to objtool in my case and in yours. Mine has:
> > > ./tools/objtool/objtool check  --retpoline --uaccess \
> > > arch/x86/kernel/apic/apic.o
> > > 
> > > (same options for any object file, but I show the one that might be
> > > faulty in your case).
> > > 
> > > Maybe "gdb objtool" would allow to learn more (but may need to
> > > recompile objtool with debug enabled, I'm not sure how to do that)
> > > 
> > > Pierre
> > > 
> > 
> > Hi all,
> > 
> > I've gone back to my skylake and attempted a fresh build of 5.10.14.
> > I used KBUILD_VERBOSE=1, for objtool I have:
> > 
> > ./tools/objtool/objtool orc generate  --no-fp --retpoline --uaccess \
> > arch/x86/kernel/apic/apic.o
> > 
> > Note that the segfault seems to be happening *before* what you quote
> > above (in generate, check presumably comes after that).
> > 
> > The full command leading up to the error (not reformatted,
> > everything between gcc and apic.c is one line):
> > 
> > make -f ./scripts/Makefile.build obj=arch/x86/kernel/apic \
> >  \
> > need-builtin=1 \
> > need-modorder=1
> >   gcc -Wp,-MMD,arch/x86/kernel/apic/.apic.o.d -nostdinc -isystem
> > /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.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 -include ./include/linux/compiler_types.h
> > -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef
> > -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing
> > -fno-common -fshort-wchar -fno-PIE
> > -Werror=implicit-function-declaration -Werror=implicit-int
> > -Werror=return-type -Wno-format-security -std=gnu89 -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 -march=core2
> > -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -Wno-sign-compare
> > -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern
> > -mindirect-branch-register -fno-jump-tables
> > -fno-delete-null-pointer-checks -Wno-frame-address
> > -Wno-format-truncation -Wno-format-overflow
> > -Wno-address-of-packed-member -O2 -fno-allow-store-data-races
> > -Wframe-larger-than=2048 -fstack-protector-strong
> > -Wno-unused-but-set-variable -Wimplicit-fallthrough
> > -Wno-unused-const-variable -pg -mrecord-mcount -mfentry
> > -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla
> > -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds
> > -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict
> > -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check
> > -fconserve-stack -Werror=date-time
> > -Werror=incompatible-pointer-types -Werror=designated-init
> > -fcf-protection=none -Wno-packed-not-aligned
> > -fplugin=./scripts/gcc-plugins/latent_entropy_plugin.so
> > -fplugin=./scripts/gcc-plugins/structleak_plugin.so
> > -fplugin=./scripts/gcc-plugins/randomize_layout_plugin.so
> > -DLATENT_ENTROPY_PLUGIN -fplugin-arg-structleak_plugin-byref-all
> > -DSTRUCTLEAK_PLUGIN -DRANDSTRUCT_PLUGIN
> > -fplugin-arg-randomize_layout_plugin-performance-mode
> > -DKBUILD_MODFILE='"arch/x86/kernel/apic/apic"'
> > -DKBUILD_BASENAME='"apic"' -DKBUILD_MODNAME='"apic"' -c -o
> > arch/x86/kernel/apic/apic.o arch/x86/kernel/apic/apic.c
> >    ./tools/objtool/objtool orc generate  --no-fp --retpoline
> > --uaccess arch/x86/kernel/apic/apic.o
> > make[3]: *** [scripts/Makefile.build:279:
> > arch/x86/kernel/apic/apic.o] Segmentation fault
> > 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:1805: arch/x86] Error 2
> > 
> > I'm attaching my gzipped config.
> > 
> > The segfault is actually in objtool -
> > 
> > Feb 10 16:10:09 leshp klogd: [  176.318096] objtool[11443]: segfault
> > at 70 ip 000000000040c07e sp 00007ffc68d330c0 error 4 in
> > objtool[402000+11000]
> > Feb 10 16:10:09 leshp klogd: [  176.318106] Code: 89 68 10 49 89 6d
> > 50 49 39 dc 74 b9 48 8b 43 48 8b 4b 50 48 83 c2 18 48 89 42 e8 48 63
> > 43 54 48 89 42 f8 48 8b 43 40 48 8b 1b <8b> 40 70 48 c1 e0 20 48 01
> > c8 48 89 42 f0 49 39 dc 75 cf 45 31 c0
> > Feb 10 16:12:54 leshp klogd: [  340.875536] objtool[21151]: segfault
> > at 70 ip 000000000040c07e sp 00007ffe2c1a00a0 error 4 in
> > objtool[402000+11000]
> > Feb 10 16:12:54 leshp klogd: [  340.875545] Code: 89 68 10 49 89 6d
> > 50 49 39 dc 74 b9 48 8b 43 48 8b 4b 50 48 83 c2 18 48 89 42 e8 48 63
> > 43 54 48 89 42 f8 48 8b 43 40 48 8b 1b <8b> 40 70 48 c1 e0 20 48 01
> > c8 48 89 42 f0 49 39 dc 75 cf 45 31 c0
> > 
> > Unfortunately, at this point I'm out of my depth and I don't have
> > gdb installed yet.
> 
> At least, I can see why there is a difference with me: The objtool
> command is different: mine is:
> objtool check  --retpoline --uaccess <.o file>
> yours is:
> objtool orc generate  --no-fp --retpoline --uaccess <.o file>
> 
> Looks like I need to change the Frame pointer unwinder to the ORC
> unwinder to have the same config as you.
> 

The benefits of the ORC unwinder are mentioned at
https://www.kernel.org/doc/html/latest/x86/orc-unwinder.html

It has been around for quite some time, but I probably picked it up
when it first appeared (test an -rc kernel, pick up new options
which might be useful).  I guess that old configs from before its
introduction still default to the old unwinder.

> No segfault with the orc unwinder, but now the objtool command is the
> same as you.
> 
> Not sure what to do now. Will have a look at your files.
> 
> Pierre
> 

Thanks.

ĸen
-- 
Any attempt to brew coffee with a teapot should result in the error
code "418 I'm a teapot". The resulting entity body MAY be short and
stout.     -- rfc 2324 (1st April 1998)

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to