mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Adrian Bunk <bunk@kernel.org>, Andi Kleen <andi@firstfloor.org>,
	rjw@sisk.pl, pavel@suse.cz, linux-kernel@vger.kernel.org
Subject: Re: [PATCH x86] [15/16] Force __cpuinit on for CONFIG_PM without HOTPLUG_CPU
Date: Tue, 15 Jan 2008 16:17:42 +0100	[thread overview]
Message-ID: <20080115151742.GB10722@elte.hu> (raw)
In-Reply-To: <20080114201214.GC9257@uranus.ravnborg.org>


* Sam Ravnborg <sam@ravnborg.org> wrote:

> > find below the current set of warnings on -git. There are 62.
> 
> The correct figure is 112.
> 
> You need to do a:
> make KCFLAGS=-fno-unit-at-a-time
> build to see them all.

btw., please add a .config option to trigger the -fno-unit-at-a-time 
flags. Something like CONFIG_SECTION_ERRORS=y - plus perhaps combine it 
with the patch below that turns such section bugs into detectable build 
errors. A distro does not want to build a kernel that could potentially 
corrupt kernel memory. (it's a security risk as well.) If we make the 
err=1 dependent on CONFIG_SECTION_ERRORS then we'll have this 
configurable.

	Ingo

---------------->
Subject: x86: link mismatch error
From: Ingo Molnar <mingo@elte.hu>

turn the build warning into a build error.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 scripts/mod/modpost.c |   63 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 24 deletions(-)

Index: linux/scripts/mod/modpost.c
===================================================================
--- linux.orig/scripts/mod/modpost.c
+++ linux/scripts/mod/modpost.c
@@ -863,8 +863,8 @@ static void find_symbols_between(struct 
  * Try to find symbols near it so user can find it.
  * Check whitelist before warning - it may be a false positive.
  **/
-static void warn_sec_mismatch(const char *modname, const char *fromsec,
-			      struct elf_info *elf, Elf_Sym *sym, Elf_Rela r)
+static int error_sec_mismatch(const char *modname, const char *fromsec,
+			     struct elf_info *elf, Elf_Sym *sym, Elf_Rela r)
 {
 	const char *refsymname = "";
 	Elf_Sym *before, *after;
@@ -874,6 +874,7 @@ static void warn_sec_mismatch(const char
 	const char *secstrings = (void *)hdr +
 				 sechdrs[hdr->e_shstrndx].sh_offset;
 	const char *secname = secstrings + sechdrs[sym->st_shndx].sh_name;
+	int err = 0;
 
 	find_symbols_between(elf, r.r_offset, fromsec, &before, &after);
 
@@ -885,32 +886,38 @@ static void warn_sec_mismatch(const char
 	if (secref_whitelist(modname, secname, fromsec,
 			     before ? elf->strtab + before->st_name : "",
 	                     refsymname))
-		return;
+		goto out;
 
 	if (before && after) {
-		warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+		merror("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
 		     "(between '%s' and '%s')\n",
 		     modname, fromsec, (unsigned long long)r.r_offset,
 		     secname, refsymname,
 		     elf->strtab + before->st_name,
 		     elf->strtab + after->st_name);
+		err = 1;
 	} else if (before) {
-		warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+		merror("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
 		     "(after '%s')\n",
 		     modname, fromsec, (unsigned long long)r.r_offset,
 		     secname, refsymname,
 		     elf->strtab + before->st_name);
+		err = 1;
 	} else if (after) {
-		warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+		merror("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
 		     "before '%s' (at offset -0x%llx)\n",
 		     modname, fromsec, (unsigned long long)r.r_offset,
 		     secname, refsymname,
 		     elf->strtab + after->st_name);
+		err = 1;
 	} else {
-		warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
+		merror("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
 		     modname, fromsec, (unsigned long long)r.r_offset,
 		     secname, refsymname);
+		err = 1;
 	}
+out:
+	return err;
 }
 
 static unsigned int *reloc_location(struct elf_info *elf,
@@ -997,10 +1004,10 @@ static int addend_mips_rel(struct elf_in
  * to find all references to a section that reference a section that will
  * be discarded and warns about it.
  **/
-static void check_sec_ref(struct module *mod, const char *modname,
-			  struct elf_info *elf,
-			  int section(const char*),
-			  int section_ref_ok(const char *))
+static int check_sec_ref(struct module *mod, const char *modname,
+			 struct elf_info *elf,
+			 int section(const char*),
+			 int section_ref_ok(const char *))
 {
 	int i;
 	Elf_Sym  *sym;
@@ -1049,9 +1056,11 @@ static void check_sec_ref(struct module 
 
 				secname = secstrings +
 					sechdrs[sym->st_shndx].sh_name;
-				if (section(secname))
-					warn_sec_mismatch(modname, name,
-							  elf, sym, r);
+				if (section(secname)) {
+					if (error_sec_mismatch(modname, name,
+							  elf, sym, r))
+						return 1;
+				}
 			}
 		} else if (sechdrs[i].sh_type == SHT_REL) {
 			Elf_Rel *rel;
@@ -1100,12 +1109,15 @@ static void check_sec_ref(struct module 
 
 				secname = secstrings +
 					sechdrs[sym->st_shndx].sh_name;
-				if (section(secname))
-					warn_sec_mismatch(modname, name,
-							  elf, sym, r);
+				if (section(secname)) {
+					if (error_sec_mismatch(modname, name,
+							  elf, sym, r))
+						return 1;
+				}
 			}
 		}
 	}
+	return 0;
 }
 
 /*
@@ -1249,7 +1261,7 @@ static int exit_section_ref_ok(const cha
 	return 0;
 }
 
-static void read_symbols(char *modname)
+static int read_symbols(char *modname)
 {
 	const char *symname;
 	char *version;
@@ -1257,9 +1269,10 @@ static void read_symbols(char *modname)
 	struct module *mod;
 	struct elf_info info = { };
 	Elf_Sym *sym;
+	int err = 0;
 
 	if (!parse_elf(&info, modname))
-		return;
+		goto out;
 
 	mod = new_module(modname);
 
@@ -1289,8 +1302,8 @@ static void read_symbols(char *modname)
 		handle_moddevtable(mod, &info, sym, symname);
 	}
 	if (is_vmlinux(modname) && vmlinux_section_warnings) {
-		check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok);
-		check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok);
+		err |= check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok);
+		err |= check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok);
 	}
 
 	version = get_modinfo(info.modinfo, info.modinfo_len, "version");
@@ -1309,6 +1322,8 @@ static void read_symbols(char *modname)
 	 * important anyhow */
 	if (modversions)
 		mod->unres = alloc_symbol("struct_module", 0, mod->unres);
+out:
+	return err;
 }
 
 #define SZ 500
@@ -1693,8 +1708,10 @@ int main(int argc, char **argv)
 	if (module_read)
 		read_dump(module_read, 0);
 
+	err = 0;
+
 	while (optind < argc) {
-		read_symbols(argv[optind++]);
+		err |= read_symbols(argv[optind++]);
 	}
 
 	for (mod = modules; mod; mod = mod->next) {
@@ -1703,8 +1720,6 @@ int main(int argc, char **argv)
 		check_exports(mod);
 	}
 
-	err = 0;
-
 	for (mod = modules; mod; mod = mod->next) {
 		if (mod->skip)
 			continue;

  reply	other threads:[~2008-01-15 15:18 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03 15:42 [PATCH x86] [0/16] Various i386/x86-64 changes Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [1/16] Make clocksource watchdog cycle through online CPUs Andi Kleen
2008-01-04  8:51   ` Ingo Molnar
2008-01-04 12:59     ` Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [2/16] Add a counter for per cpu clocksource watchdog checks and report them in /proc/interrupts Andi Kleen
2008-01-04  8:53   ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [3/16] Turn irq debugging options into module params Andi Kleen
2008-01-04  8:55   ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [4/16] Add /proc/irq/*/spurious to dump the spurious irq debugging state Andi Kleen
2008-01-04  8:58   ` Ingo Molnar
2008-01-04 12:22     ` Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [5/16] Replace hard coded reservations in x86-64 early boot code with dynamic table Andi Kleen
2008-01-04  9:00   ` Ingo Molnar
2008-01-04 12:23     ` Andi Kleen
2008-01-04 12:38     ` [PATCH x86] [5/16] Replace hard coded reservations in x86-64 early boot code with dynamic table II Andi Kleen
2008-01-04 14:41       ` Ingo Molnar
2008-01-04 15:03         ` Andi Kleen
2008-01-04 17:51           ` Sam Ravnborg
2008-01-04 18:06             ` Andi Kleen
2008-01-04 18:47               ` Joe Perches
2008-01-04 22:13                 ` Andi Kleen
2008-01-04 22:46                   ` J. Bruce Fields
2008-01-04 20:56               ` Sam Ravnborg
2008-01-04 12:41   ` [PATCH x86] [5/16] Replace hard coded reservations in x86-64 early boot code with dynamic table Cyrill Gorcunov
2008-01-03 15:42 ` [PATCH x86] [6/16] Add a new arch_early_alloc() interface for x86-64 Andi Kleen
2008-01-03 16:22   ` Eric Dumazet
2008-01-03 17:17     ` Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [7/16] Convert lockdep to use arch_early_alloc() if available for its large arrays Andi Kleen
2008-01-04  9:03   ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [8/16] Make lockdep_init __init Andi Kleen
2008-01-04  9:06   ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [9/16] Remove CPU capabitilites printks on i386 Andi Kleen
2008-01-04  9:11   ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [10/16] Document fdimage/isoimage completely in make help Andi Kleen
2008-01-04  9:00   ` Sam Ravnborg
2008-01-04  9:15     ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [11/16] Compile apm and voyager module only when selected in Kconfig Andi Kleen
2008-01-04  4:15   ` Stephen Rothwell
2008-01-03 15:42 ` [PATCH x86] [12/16] Optimize lock prefix switching to run less frequently Andi Kleen
2008-01-04  9:42   ` Thomas Gleixner
2008-01-04 12:17     ` Andi Kleen
2008-01-04 14:19       ` Thomas Gleixner
2008-01-04 14:39         ` Andi Kleen
2008-01-04 15:02           ` Pekka Enberg
2008-01-04 15:04             ` Andi Kleen
2008-01-04 20:34           ` Thomas Gleixner
2008-01-04 22:11             ` Andi Kleen
2008-01-05  1:19               ` Ingo Molnar
2008-01-05 14:37                 ` Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [13/16] i386: Set CFQ as default in i386 defconfig Andi Kleen
2008-01-04  9:19   ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [14/16] Enable RDC321X subarch only on 32bit Andi Kleen
2008-01-04  9:22   ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [15/16] Force __cpuinit on for CONFIG_PM without HOTPLUG_CPU Andi Kleen
2008-01-03 17:22   ` Rafael J. Wysocki
2008-01-03 17:42     ` Andi Kleen
2008-01-03 21:41       ` Rafael J. Wysocki
2008-01-04  9:23         ` Ingo Molnar
2008-01-10 17:14           ` Rafael J. Wysocki
2008-01-03 18:14   ` Adrian Bunk
2008-01-03 18:43     ` Andi Kleen
2008-01-10  9:54       ` Adrian Bunk
2008-01-10  9:58         ` Andi Kleen
2008-01-10 10:19           ` Adrian Bunk
2008-01-10 11:15             ` Andi Kleen
2008-01-10 11:26               ` Adrian Bunk
2008-01-10 11:42                 ` Andi Kleen
2008-01-10 12:47                   ` Adrian Bunk
2008-01-10 13:12                     ` Andi Kleen
2008-01-10 15:09                       ` Adrian Bunk
2008-01-14 13:52                         ` Ingo Molnar
2008-01-14 14:09                           ` Sam Ravnborg
2008-01-14 14:58                             ` Ingo Molnar
2008-01-14 15:01                               ` Ingo Molnar
2008-01-14 18:20                                 ` Adrian Bunk
2008-01-14 19:10                                   ` Ingo Molnar
2008-01-14 19:52                                     ` Adrian Bunk
2008-01-14 20:01                                       ` Sam Ravnborg
2008-01-14 20:18                                         ` Adrian Bunk
2008-01-14 20:27                                           ` Sam Ravnborg
2008-01-14 20:34                                             ` Adrian Bunk
2008-01-15 22:14                                           ` Ingo Molnar
2008-01-15 22:51                                             ` Adrian Bunk
2008-01-14 19:59                                 ` Sam Ravnborg
2008-01-15 22:12                                   ` [patch for v2.6.24] fix section mismatch warning in page_alloc.c Ingo Molnar
2008-01-14 15:05                               ` [PATCH x86] [15/16] Force __cpuinit on for CONFIG_PM without HOTPLUG_CPU Ingo Molnar
2008-01-14 15:24                                 ` Ingo Molnar
2008-01-14 20:12                                   ` Sam Ravnborg
2008-01-15 15:17                                     ` Ingo Molnar [this message]
2008-01-15 16:25                                       ` Sam Ravnborg
2008-01-15 17:11                                         ` Andi Kleen
2008-01-15 17:27                                           ` Adrian Bunk
2008-01-15 18:21                                           ` Sam Ravnborg
2008-01-15 18:29                                             ` Andi Kleen
2008-01-15 18:31                                               ` Sam Ravnborg
2008-01-15 18:47                                             ` Adrian Bunk
2008-01-14 18:17                               ` Adrian Bunk
2008-01-14 15:25                           ` Adrian Bunk
2008-01-10 17:17                   ` Rafael J. Wysocki
2008-01-11 23:06                     ` [PATCH] x86: Change unnecessary dependencies on CONFIG_PM Rafael J. Wysocki
2008-01-03 15:42 ` [PATCH x86] [16/16] Mark memory_setup __init Andi Kleen
2008-01-04  9:25   ` Ingo Molnar
2008-01-04  9:53     ` Ingo Molnar

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=20080115151742.GB10722@elte.hu \
    --to=mingo@elte.hu \
    --cc=andi@firstfloor.org \
    --cc=bunk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=rjw@sisk.pl \
    --cc=sam@ravnborg.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®