lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.20.1612021456160.13571@knanqh.ubzr>
Date:   Fri, 2 Dec 2016 15:11:50 -0500 (EST)
From:   Nicolas Pitre <nicolas.pitre@...aro.org>
To:     Paul Bolle <pebolle@...cali.nl>
cc:     Jarod Wilson <jarod@...hat.com>, Tony Luck <tony.luck@...el.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Prarit Bhargava <prarit@...hat.com>,
        linux-kernel@...r.kernel.org
Subject: Re: Odd build breakage in 4.9-rc7

On Thu, 1 Dec 2016, Paul Bolle wrote:

> On Thu, 2016-12-01 at 12:42 -0500, Nicolas Pitre wrote:
> > OK I understand what the problem is.  However most of those hunks below 
> > are definitely wrong. ;-)
> 
> Probably. By now I've narrowed it down to just these two hunks:

And they're both wrong. ;-) There is no relation between MODVERSIONS and 
TRIM_UNUSED_KSYMS.

> > I'm trying to determine the best way to fix it. Stay tuned.
> 
> Will do. I'm curious to see what a proper fix might look like.

Here it is:

----- >8
Subject: kbuild: fix building bzImage with CONFIG_TRIM_UNUSED_KSYMS enabled

When building a specific target such as bzImage, modules aren't normally
built. However if CONFIG_TRIM_UNUSED_KSYMS is enabled, no built modules
means none of the exported symbols are used and therefore they will all
be trimmed away from the final kernel. A subsequent "make modules" will
fail because modpost cannot find the needed symbols for those modules in
the kernel binary.

Let's make sure modules are also built whenever CONFIG_TRIM_UNUSED_KSYMS
is enabled and that the kernel binary is properly rebuilt accordingly.

Signed-off-by: Nicolas Pitre <nico@...aro.org>

diff --git a/Makefile b/Makefile
index 9f9c3b577c..b816089e5d 100644
--- a/Makefile
+++ b/Makefile
@@ -607,6 +607,13 @@ else
 include/config/auto.conf: ;
 endif # $(dot-config)
 
+# For the kernel to actually contain only the needed exported symbols,
+# we have to build modules as well to determine what those symbols are.
+# (this can be evaluated only once include/config/auto.conf has been included)
+ifdef CONFIG_TRIM_UNUSED_KSYMS
+  KBUILD_MODULES := 1
+endif
+
 # The all: target is the default when no target is given on the
 # command line.
 # This allow a user to issue only 'make' to build a kernel including modules
@@ -944,7 +951,7 @@ ifdef CONFIG_GDB_SCRIPTS
 endif
 ifdef CONFIG_TRIM_UNUSED_KSYMS
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
-	  "$(MAKE) KBUILD_MODULES=1 -f $(srctree)/Makefile vmlinux_prereq"
+	  "$(MAKE) -f $(srctree)/Makefile vmlinux"
 endif
 
 # standalone target for easier testing

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ