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>] [day] [month] [year] [list]
Date:	Wed, 6 Jun 2012 23:30:27 +0200
From:	Sam Ravnborg <sam@...nborg.org>
To:	Michal Marek <mmarek@...e.cz>,
	linux-kbuild <linux-kbuild@...r.kernel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: [PATCH] kbuild: always show verbose section mismatch warnings

>From 7a299bd90526f46c72620110ab04a116311dd141 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@...nborg.org>
Date: Wed, 6 Jun 2012 23:23:30 +0200
Subject: [PATCH] kbuild: always show verbose section mismatch warnings

The number of section mismatch warnings are down on an acceptable level.
So lets always see the full warning - in the vain hope that
users will recognize the function names and fix them.

This patch enable section mismatch analysis for each link,
but you need to enable CONFIG_DEBUG_SECTION_MISMATCH to
have vmlinux.o analyzed.
This saves us from one time-consuming link step in the final
link of the kernel (which we hit for all changes).

Signed-off-by: Sam Ravnborg <sam@...nborg.org>
Cc: Steven Rostedt <rostedt@...dmis.org>
---

Steven triggered this patch with a comment on G+:
https://plus.google.com/116317370665849559569/posts/RvEpCqrWPLU

And I had in mind to do it anyway..

 lib/Kconfig.debug        |   14 ++++----------
 scripts/Makefile.build   |    4 +---
 scripts/Makefile.modpost |    1 -
 scripts/link-vmlinux.sh  |   12 ++++++------
 4 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index a42d3ae..5b03f74 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -145,16 +145,10 @@ config DEBUG_SECTION_MISMATCH
 	    the analysis would not catch the illegal reference.
 	    This option tells gcc to inline less (but it does result in
 	    a larger kernel).
-	  - Run the section mismatch analysis for each module/built-in.o file.
-	    When we run the section mismatch analysis on vmlinux.o, we
-	    lose valueble information about where the mismatch was
-	    introduced.
-	    Running the analysis for each module/built-in.o file
-	    tells where the mismatch happens much closer to the
-	    source. The drawback is that the same mismatch is
-	    reported at least twice.
-	  - Enable verbose reporting from modpost in order to help resolve
-	    the section mismatches that are reported.
+	  - Run the section mismatch analysis on vmlinux.o.
+	    This will in most cases duplicate already reported warnings,
+	    but may catch section mismatchs involving diferent parts
+	    of the kernel.
 
 config DEBUG_KERNEL
 	bool "Kernel debugging"
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index ff1720d..db81790 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -159,9 +159,7 @@ ifneq ($(KBUILD_CHECKSRC),0)
 endif
 
 # Do section mismatch analysis for each module/built-in.o
-ifdef CONFIG_DEBUG_SECTION_MISMATCH
-  cmd_secanalysis = ; scripts/mod/modpost $@
-endif
+cmd_secanalysis = ; scripts/mod/modpost $@
 
 # Compile C sources (.c)
 # ---------------------------------------------------------------------------
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 08dce14..5dc9086 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -79,7 +79,6 @@ modpost = scripts/mod/modpost                    \
  $(if $(KBUILD_EXTMOD),-I $(modulesymfile))      \
  $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
  $(if $(KBUILD_EXTMOD),-o $(modulesymfile))      \
- $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S)      \
  $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
  $(if $(cross_build),-c)
 
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index cd9c6c6..a2f89e6 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -129,12 +129,12 @@ fi
 # We need access to CONFIG_ symbols
 . ./.config
 
-#link vmlinux.o
-info LD vmlinux.o
-modpost_link vmlinux.o
-
-# modpost vmlinux.o to check for section mismatches
-${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o
+# Section mismatch check on vmlinux.o
+if [ ! -n "${CONFIG_DEBUG_SECTION_MISMATCH}" ]; then
+	info LD vmlinux.o
+	modpost_link vmlinux.o
+	${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o
+fi
 
 # Update version
 info GEN .version
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ