* [PATCH] objtool: fix CONFIG_STACK_VALIDATION warning for out-of-tree modules
@ 2017-02-15 18:21 Josh Poimboeuf
2017-02-15 18:55 ` Marc MERLIN
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Josh Poimboeuf @ 2017-02-15 18:21 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, Marc MERLIN, Jessica Yu, Michal Marek
When building a CONFIG_STACK_VALIDATION enabled kernel without the
libelf devel package installed, the Makefile prints a warning:
"Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
But when building an out-of-tree module, the warning doesn't show.
Instead it tries to use objtool, and the build fails with:
/bin/sh: ./tools/objtool/objtool: No such file or directory
Make sure the warning and the disabling of objtool occur in all cases,
by moving the CONFIG_STACK_VALIDATION checks outside the 'ifeq
($(KBUILD_EXTMOD),)' block in the Makefile.
Reported-by: Marc MERLIN <marc@merlins.org>
Suggested-by: Jessica Yu <jeyu@redhat.com>
Fixes: 3b27a0c85d70 ("objtool: Detect and warn if libelf is missing and don't break the build")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
Makefile | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index 8e223e0..bcf7036 100644
--- a/Makefile
+++ b/Makefile
@@ -908,6 +908,18 @@ mod_sign_cmd = true
endif
export mod_sign_cmd
+ifdef CONFIG_STACK_VALIDATION
+ has_libelf := $(call try-run,\
+ echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
+ ifeq ($(has_libelf),1)
+ objtool_target := tools/objtool FORCE
+ else
+ $(warning "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
+ SKIP_STACK_VALIDATION := 1
+ export SKIP_STACK_VALIDATION
+ endif
+endif
+
ifeq ($(KBUILD_EXTMOD),)
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
@@ -1035,18 +1047,6 @@ prepare0: archprepare gcc-plugins
# All the preparing..
prepare: prepare0 prepare-objtool
-ifdef CONFIG_STACK_VALIDATION
- has_libelf := $(call try-run,\
- echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
- ifeq ($(has_libelf),1)
- objtool_target := tools/objtool FORCE
- else
- $(warning "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
- SKIP_STACK_VALIDATION := 1
- export SKIP_STACK_VALIDATION
- endif
-endif
-
PHONY += prepare-objtool
prepare-objtool: $(objtool_target)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] objtool: fix CONFIG_STACK_VALIDATION warning for out-of-tree modules
2017-02-15 18:21 [PATCH] objtool: fix CONFIG_STACK_VALIDATION warning for out-of-tree modules Josh Poimboeuf
@ 2017-02-15 18:55 ` Marc MERLIN
2017-02-15 18:59 ` Jessica Yu
2017-02-20 9:13 ` [tip:core/urgent] objtool: Fix CONFIG_STACK_VALIDATION=y " tip-bot for Josh Poimboeuf
2 siblings, 0 replies; 4+ messages in thread
From: Marc MERLIN @ 2017-02-15 18:55 UTC (permalink / raw)
To: Josh Poimboeuf; +Cc: Ingo Molnar, linux-kernel, Jessica Yu, Michal Marek
On Wed, Feb 15, 2017 at 12:21:17PM -0600, Josh Poimboeuf wrote:
> When building a CONFIG_STACK_VALIDATION enabled kernel without the
> libelf devel package installed, the Makefile prints a warning:
>
> "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
>
> But when building an out-of-tree module, the warning doesn't show.
> Instead it tries to use objtool, and the build fails with:
>
> /bin/sh: ./tools/objtool/objtool: No such file or directory
>
> Make sure the warning and the disabling of objtool occur in all cases,
> by moving the CONFIG_STACK_VALIDATION checks outside the 'ifeq
> ($(KBUILD_EXTMOD),)' block in the Makefile.
>
> Reported-by: Marc MERLIN <marc@merlins.org>
> Suggested-by: Jessica Yu <jeyu@redhat.com>
> Fixes: 3b27a0c85d70 ("objtool: Detect and warn if libelf is missing and don't break the build")
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-By: Marc MERLIN <marc@merlins.org>
saruman:/usr/src/linux-block# dpkg --remove libelf-dev
saruman:/usr/src/linux-block/tools/objtool# make clean
saruman:/usr/src/linux-block# dkms install bbswitch/0.8
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
make -j8 KERNELRELEASE=4.10.0-rc7-mm3kb1+ KVERSION=4.10.0-rc7-mm3kb1+...(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.10.0-rc7-mm3kb1+ (x86_64)
saruman:/usr/src/linux-block# patch -p1 -s < objtool.patch
saruman:/usr/src/linux-block# dkms install bbswitch/0.8
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
make -j8 KERNELRELEASE=4.10.0-rc7-mm3kb1+ KVERSION=4.10.0-rc7-mm3kb1+...
cleaning build area...
DKMS: build completed.
bbswitch.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.10.0-rc7-mm3kb1+/updates/dkms/
depmod...
DKMS: install completed.
All good, thank you.
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | PGP 1024R/763BE901
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] objtool: fix CONFIG_STACK_VALIDATION warning for out-of-tree modules
2017-02-15 18:21 [PATCH] objtool: fix CONFIG_STACK_VALIDATION warning for out-of-tree modules Josh Poimboeuf
2017-02-15 18:55 ` Marc MERLIN
@ 2017-02-15 18:59 ` Jessica Yu
2017-02-20 9:13 ` [tip:core/urgent] objtool: Fix CONFIG_STACK_VALIDATION=y " tip-bot for Josh Poimboeuf
2 siblings, 0 replies; 4+ messages in thread
From: Jessica Yu @ 2017-02-15 18:59 UTC (permalink / raw)
To: Josh Poimboeuf; +Cc: Ingo Molnar, linux-kernel, Marc MERLIN, Michal Marek
+++ Josh Poimboeuf [15/02/17 12:21 -0600]:
>When building a CONFIG_STACK_VALIDATION enabled kernel without the
>libelf devel package installed, the Makefile prints a warning:
>
> "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
>
>But when building an out-of-tree module, the warning doesn't show.
>Instead it tries to use objtool, and the build fails with:
>
> /bin/sh: ./tools/objtool/objtool: No such file or directory
>
>Make sure the warning and the disabling of objtool occur in all cases,
>by moving the CONFIG_STACK_VALIDATION checks outside the 'ifeq
>($(KBUILD_EXTMOD),)' block in the Makefile.
>
>Reported-by: Marc MERLIN <marc@merlins.org>
>Suggested-by: Jessica Yu <jeyu@redhat.com>
>Fixes: 3b27a0c85d70 ("objtool: Detect and warn if libelf is missing and don't break the build")
>Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
With this patch the warning now prints for OOT modules, and more
importantly, the build no longer breaks for them, so:
Reviewed-by: Jessica Yu <jeyu@redhat.com>
>---
> Makefile | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
>diff --git a/Makefile b/Makefile
>index 8e223e0..bcf7036 100644
>--- a/Makefile
>+++ b/Makefile
>@@ -908,6 +908,18 @@ mod_sign_cmd = true
> endif
> export mod_sign_cmd
>
>+ifdef CONFIG_STACK_VALIDATION
>+ has_libelf := $(call try-run,\
>+ echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
>+ ifeq ($(has_libelf),1)
>+ objtool_target := tools/objtool FORCE
>+ else
>+ $(warning "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
>+ SKIP_STACK_VALIDATION := 1
>+ export SKIP_STACK_VALIDATION
>+ endif
>+endif
>+
>
> ifeq ($(KBUILD_EXTMOD),)
> core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
>@@ -1035,18 +1047,6 @@ prepare0: archprepare gcc-plugins
> # All the preparing..
> prepare: prepare0 prepare-objtool
>
>-ifdef CONFIG_STACK_VALIDATION
>- has_libelf := $(call try-run,\
>- echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
>- ifeq ($(has_libelf),1)
>- objtool_target := tools/objtool FORCE
>- else
>- $(warning "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
>- SKIP_STACK_VALIDATION := 1
>- export SKIP_STACK_VALIDATION
>- endif
>-endif
>-
> PHONY += prepare-objtool
> prepare-objtool: $(objtool_target)
>
>--
>2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:core/urgent] objtool: Fix CONFIG_STACK_VALIDATION=y warning for out-of-tree modules
2017-02-15 18:21 [PATCH] objtool: fix CONFIG_STACK_VALIDATION warning for out-of-tree modules Josh Poimboeuf
2017-02-15 18:55 ` Marc MERLIN
2017-02-15 18:59 ` Jessica Yu
@ 2017-02-20 9:13 ` tip-bot for Josh Poimboeuf
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2017-02-20 9:13 UTC (permalink / raw)
To: linux-tip-commits
Cc: marc, mmarek, hpa, jeyu, mingo, torvalds, peterz, jpoimboe,
linux-kernel, tglx
Commit-ID: 9f0c18aec620bc9d82268b3cb937568dd07b43ff
Gitweb: http://git.kernel.org/tip/9f0c18aec620bc9d82268b3cb937568dd07b43ff
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Wed, 15 Feb 2017 12:21:17 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 20 Feb 2017 09:49:34 +0100
objtool: Fix CONFIG_STACK_VALIDATION=y warning for out-of-tree modules
When building a CONFIG_STACK_VALIDATION enabled kernel without the
libelf devel package installed, the Makefile prints a warning:
"Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
But when building an out-of-tree module, the warning doesn't show.
Instead it tries to use objtool, and the build fails with:
/bin/sh: ./tools/objtool/objtool: No such file or directory
Make sure the warning and the disabling of objtool occur in all cases,
by moving the CONFIG_STACK_VALIDATION checks outside the 'ifeq
($(KBUILD_EXTMOD),)' block in the Makefile.
Tested-By: Marc MERLIN <marc@merlins.org>
Suggested-by: Jessica Yu <jeyu@redhat.com>
Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Jessica Yu <jeyu@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 3b27a0c85d70 ("objtool: Detect and warn if libelf is missing and don't break the build")
Link: http://lkml.kernel.org/r/b3088ae4a8698143d4851965793c61fec2135b1f.1487182864.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
Makefile | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index f1e6a02..32c8457 100644
--- a/Makefile
+++ b/Makefile
@@ -908,6 +908,18 @@ mod_sign_cmd = true
endif
export mod_sign_cmd
+ifdef CONFIG_STACK_VALIDATION
+ has_libelf := $(call try-run,\
+ echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
+ ifeq ($(has_libelf),1)
+ objtool_target := tools/objtool FORCE
+ else
+ $(warning "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
+ SKIP_STACK_VALIDATION := 1
+ export SKIP_STACK_VALIDATION
+ endif
+endif
+
ifeq ($(KBUILD_EXTMOD),)
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
@@ -1035,18 +1047,6 @@ prepare0: archprepare gcc-plugins
# All the preparing..
prepare: prepare0 prepare-objtool
-ifdef CONFIG_STACK_VALIDATION
- has_libelf := $(call try-run,\
- echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
- ifeq ($(has_libelf),1)
- objtool_target := tools/objtool FORCE
- else
- $(warning "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
- SKIP_STACK_VALIDATION := 1
- export SKIP_STACK_VALIDATION
- endif
-endif
-
PHONY += prepare-objtool
prepare-objtool: $(objtool_target)
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-20 9:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15 18:21 [PATCH] objtool: fix CONFIG_STACK_VALIDATION warning for out-of-tree modules Josh Poimboeuf
2017-02-15 18:55 ` Marc MERLIN
2017-02-15 18:59 ` Jessica Yu
2017-02-20 9:13 ` [tip:core/urgent] objtool: Fix CONFIG_STACK_VALIDATION=y " tip-bot for Josh Poimboeuf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).