From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Marc MERLIN <marc@merlins.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Please turn "Cannot use CONFIG_STACK_VALIDATION" into build error
Date: Mon, 13 Feb 2017 12:41:06 -0600 [thread overview]
Message-ID: <20170213184106.kkn7dnfszm7u72ek@treble> (raw)
In-Reply-To: <20170213080709.o5oxyu646ajawzwp@merlins.org>
On Mon, Feb 13, 2017 at 12:07:09AM -0800, Marc MERLIN wrote:
> Hi Josh,
>
> I'll start with the story as to why.
> i've lost more hours than I care to list, because I was unable to build
> the virtualbox kernel driver with newer kernels.
> Sadly, it gives no useful debug info outside of
> make[1]: *** No rule to make target '/tmp/vbox.0/linux/SUPDrv-linux.o', needed by '/tmp/vbox.0/vboxdrv.o'. Stop.
>
> It took some pretty deep debugging to finally see this:
> Trying rule prerequisite 'tools/objtool/objtool'.
> Looking for a rule with intermediate file 'tools/objtool/objtool'.
> Avoiding implicit rule recursion.
> which look quite inoccuous and don't look as errors at all.
> When I filed a bug with the vbox folks, they were unable to find out why
> the module refused to build on my kernel, and I was stuck with older
> kernels as a result.
>
> Then, I had another module, bbswitch, to turn off the nvidia chip on my
> laptop to save battery. That one also failed to build with newer
> kernels, but thankfully made it more clear that the problem was related
> to tools/objtool/objtool missing.
>
> But why was it missing? No idea...
> I trace that down to CONFIG_STACK_VALIDATION which there seems to be no
> menu option for, so I manually disable it in .config, rebuild, and it's
> automatically re-enabled. Gah.
Hm, that doesn't sound right. Nothing automatically enables
CONFIG_STACK_VALIDATION. It should be disabled unless manually enabled.
Maybe you got it confused with CONFIG_HAVE_STACK_VALIDATION, which is
always enabled?
BTW, there is a config option for it in the menu:
Kernel hacking
Compile-time checks and compiler options
Compile-time stack metadata validation
> More hair pulling, and finally I make a typo
> saruman:/usr/src/linux-block# make xonfig
> Makefile:1044: "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
> scripts/kconfig/conf --silentoldconfig Kconfig
> Makefile:1044: "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
> make: *** No rule to make target 'xonfig'. Stop.
>
> Sure enough, this was my problem, but I never saw the error message
> because I build kernels with
> make-kpkg --revision 1gandalf kernel-image
> which does other stuff and hid that warning, which really should have
> been a fatal error in my opinion.
>
> Given that
> 1) CONFIG_STACK_VALIDATION seems silently auto enabled.
> 2) without libelf-dev, the kernel will build but will leave a tree
> missing objtool, which in turn causes (all?) 3rd party modules to fail
> building.
Yes, this is a bug.
> 3) and that it's kind of non trivial to find out why if that happens,
>
> Would you consider making
> "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
> a build error as opposed to a warning?
> This sure would have saved me countless errors of debugging the wrong
> things.
Correct me if I'm wrong, but it sounds like make-kpkg suppressed stderr?
If so, that should be fixed.
When I try to build an OOT module with CONFIG_STACK_VALIDATION enabled
and elfutils-libelf-devel missing (on Fedora), I get:
make: Entering directory '/home/jpoimboe/git/linux'
make[1]: Entering directory '/home/jpoimboe/ktest/output'
CC [M] /home/jpoimboe/livepatch-test/1/livepatch2.o
/bin/sh: ./tools/objtool/objtool: No such file or directory
/home/jpoimboe/git/linux/scripts/Makefile.build:300: recipe for target '/home/jpoimboe/livepatch-test/1/livepatch2.o' failed
make[2]: *** [/home/jpoimboe/livepatch-test/1/livepatch2.o] Error 1
/home/jpoimboe/git/linux/Makefile:1490: recipe for target '_module_/home/jpoimboe/livepatch-test/1' failed
make[1]: *** [_module_/home/jpoimboe/livepatch-test/1] Error 2
make[1]: Leaving directory '/home/jpoimboe/ktest/output'
Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
make: Leaving directory '/home/jpoimboe/git/linux'
It's not a perfect error message, but the
'/bin/sh: ./tools/objtool/objtool: No such file or directory'
is at least a big clue. I'm curious why you didn't see that.
Anyway, the above libelf-dev warning is just a warning and not a build
error because CONFIG_STACK_VALIDATION is enabled for allyesconfig, and
it's not a severe enough problem to warrant breaking the build.
Ideally the same warning should be printed when building OOT modules.
I'll try to figure out if there's a way to do that it.
--
Josh
next prev parent reply other threads:[~2017-02-13 18:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-13 8:07 Marc MERLIN
2017-02-13 18:41 ` Josh Poimboeuf [this message]
2017-02-13 21:31 ` Marc MERLIN
2017-02-13 22:00 ` Josh Poimboeuf
2017-02-13 22:05 ` Marc MERLIN
2017-02-13 23:08 ` Jessica Yu
2017-02-14 13:59 ` Josh Poimboeuf
2017-02-14 14:06 ` Josh Poimboeuf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170213184106.kkn7dnfszm7u72ek@treble \
--to=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marc@merlins.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®