aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
Commit message (Collapse)AuthorAgeFilesLines
* modpost: Fix modpost license checking of vmlinux.oFrank Rowand2012-04-131-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | commit 258f742635360175564e9470eb060ff4d4b984e7 upstream. Commit f02e8a6596b7 ("module: Sort exported symbols") sorts symbols placing each of them in its own elf section. This sorting and merging into the canonical sections are done by the linker. Unfortunately modpost to generate Module.symvers file parses vmlinux.o (which is not linked yet) and all modules object files (which aren't linked yet). These aren't sanitized by the linker yet. That breaks modpost that can't detect license properly for modules. This patch makes modpost aware of the new exported symbols structure. [ This above is a slightly corrected version of the explanation of the problem, copied from commit 62a2635610db ("modpost: Fix modpost's license checking V3"). That commit fixed the problem for module object files, but not for vmlinux.o. This patch fixes modpost for vmlinux.o. ] Signed-off-by: Frank Rowand <frank.rowand@am.sony.com> Signed-off-by: Alessio Igor Bogani <abogani@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* modpost: Fix modpost's license checking V3Alessio Igor Bogani2012-04-131-1/+28
| | | | | | | | | | | | | | | | | | | | | | | commit 62a2635610dbc83c5e8d724e00941eee4d18c186 upstream. The commit f02e8a6 sorts symbols placing each of them in its own elf section. The sorting and merging into the canonical sections are done by the linker. Unfortunately modpost to generate Module.symvers file parses vmlinux (already linked) and all modules object files (which aren't linked yet). These aren't sanitized by the linker yet. That breaks modpost that can't detect license properly for modules. This patch makes modpost aware of the new exported symbols structure. Thanks to Arnaud Lacombe <lacombar@gmail.com> and Anders Kaseorg <andersk@ksplice.com> for providing useful suggestions about code. This work was supported by a hardware donation from the CE Linux Forum. Reported-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Alessio Igor Bogani <abogani@kernel.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* modpost: fix ALL_INIT_DATA_SECTIONSJan Beulich2012-04-131-1/+1
| | | | | | | | | | | commit 9aaf440f8fabcebf9ea79a62ccf4c212e6544b49 upstream. This was lacking a comma between two supposed to be separate strings. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* modpost: Update 64k section support for binutils 2.18.50Anders Kaseorg2011-05-191-10/+6
| | | | | | | | | | | | | | | | | Binutils 2.18.50 made a backwards-incompatible change in the way it writes ELF objects with over 65280 sections, to improve conformance with the ELF specification and interoperability with other ELF tools. Specifically, it no longer adds 256 to section indices SHN_LORESERVE and higher to skip over the reserved range SHN_LORESERVE through SHN_HIRESERVE; those values are only considered special in the st_shndx field, and not in other places where section indices are stored. See: http://sourceware.org/bugzilla/show_bug.cgi?id=5900 http://groups.google.com/group/generic-abi/browse_thread/thread/e8bb63714b072e67/6c63738f12cc8a17 Signed-off-by: Anders Kaseorg <andersk@ksplice.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* modpost: fix trailing commaRandy Dunlap2011-03-171-8/+15
| | | | | | | | | | | | | | | | | | | | Consolidate locations that print a section whitelist into calls to print_section_list(). Fix print_section_list() so that it does not print a trailing comma & space: If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console, becomes: If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Merge branch 'for-next' of ↵Linus Torvalds2011-01-131-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits) Documentation/trace/events.txt: Remove obsolete sched_signal_send. writeback: fix global_dirty_limits comment runtime -> real-time ppc: fix comment typo singal -> signal drivers: fix comment typo diable -> disable. m68k: fix comment typo diable -> disable. wireless: comment typo fix diable -> disable. media: comment typo fix diable -> disable. remove doc for obsolete dynamic-printk kernel-parameter remove extraneous 'is' from Documentation/iostats.txt Fix spelling milisec -> ms in snd_ps3 module parameter description Fix spelling mistakes in comments Revert conflicting V4L changes i7core_edac: fix typos in comments mm/rmap.c: fix comment sound, ca0106: Fix assignment to 'channel'. hrtimer: fix a typo in comment init/Kconfig: fix typo anon_inodes: fix wrong function name in comment fix comment typos concerning "consistent" poll: fix a typo in comment ... Fix up trivial conflicts in: - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c) - fs/ext4/ext4.h Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.
| * tree-wide: fix comment/printk typosUwe Kleine-König2010-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | "gadget", "through", "command", "maintain", "maintain", "controller", "address", "between", "initiali[zs]e", "instead", "function", "select", "already", "equal", "access", "management", "hierarchy", "registration", "interest", "relative", "memory", "offset", "already", Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | modpost: Fix address calculation in reloc_location()Olof Johansson2010-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a segfault in modpost that is observed when the gold linker is used to link the input objects. The problem is that reloc_location (modpost.c) is computing the address of the relocation target incorrectly. Here, elf->hdr points to the beginning of the ELF file in memory, sechdr points to the relocation section header, section is the index of the section being relocated, and sechdrs[section].sh_offset would be the offset of that section, relative to the beginning of the ELF file. Adding elf->hdr + sechdrs[section].sh_offset gives you the address of the beginning of the section, and adding r->r_offset to that gives you the address of the location to be relocated. You do not need to subtract sechdrs[section].sh_addr from that -- the result of this is an address outside the file, and causes the segfault when addend_386_rel tries to dereference it. This bug is not observed when GNU ld is used to link the inputs. The object file ubuntu/omnibook/omnibook.o is the result of an ld -r of several other files. When GNU ld does an ld -r, it sets the vaddr field for each section to 0, but gold lays out the section addresses sequentially instead: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 00000000 000034 004794 00 AX 0 0 4 [ 2] .data PROGBITS 0000b9d0 0047c8 0009c0 00 WA 0 0 4 [ 3] .bss NOBITS 000162f8 005188 00013c 00 WA 0 0 4 [ 4] .rodata.str1.1 PROGBITS 00004f2d 0052c4 001b1a 01 AMS 0 0 1 [ 5] .init.text PROGBITS 00004794 006dde 0005fa 00 AX 0 0 1 [ 6] .exit.text PROGBITS 00004d8e 0073d8 00018a 00 AX 0 0 1 ... So the bug in the tool remained undiscovered because the section's vaddr always happened to be 0. Signed-off-by: Raymes Khoury <raymes@google.com> Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Michal Marek <mmarek@suse.cz>
* | modpost: Put .zdebug* section on white listH.J. Lu2010-12-161-0/+1
|/ | | | | | | | | "as --compress-debug-sections" will generate compressed debug sections with section names ".zdebug*". This patch puts .zdebug* section on white list. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Merge branch 'kbuild' of ↵Linus Torvalds2010-10-281-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: initramfs: Fix build break on symbol-prefixed archs initramfs: fix initramfs size calculation initramfs: generalize initramfs_data.xxx.S variants scripts/kallsyms: Enable error messages while hush up unnecessary warnings scripts/setlocalversion: update comment kbuild: Use a single clean rule for kernel and external modules kbuild: Do not run make clean in $(srctree) scripts/mod/modpost.c: fix commentary accordingly to last changes kbuild: Really don't clean bounds.h and asm-offsets.h
| * scripts/mod/modpost.c: fix commentary accordingly to last changesAndy Shevchenko2010-08-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The last commits 37ed19d5cce35a40d3913cf9aa208ce9f60db3d7 5003bab82d56754b27be01eef24495a02e00039d have introduced new behaviour of sec2annotation() method. However, the commentary inside the method was left as before. Let's fix it accordingly. Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Andrew Morton <akpm@linux-foundation.org> Acked-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
* | Merge branch 'params' of ↵Linus Torvalds2010-08-121-0/+13
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus * 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: (22 commits) param: don't deref arg in __same_type() checks param: update drivers/acpi/debug.c to new scheme param: use module_param in drivers/message/fusion/mptbase.c ide: use module_param_named rather than module_param_call param: update drivers/char/ipmi/ipmi_watchdog.c to new scheme param: lock if_sdio's lbs_helper_name and lbs_fw_name against sysfs changes. param: lock myri10ge_fw_name against sysfs changes. param: simple locking for sysfs-writable charp parameters param: remove unnecessary writable charp param: add kerneldoc to moduleparam.h param: locking for kernel parameters param: make param sections const. param: use free hook for charp (fix leak of charp parameters) param: add a free hook to kernel_param_ops. param: silence .init.text references from param ops Add param ops struct for hvc_iucv driver. nfs: update for module_param_named API change AppArmor: update for module_param_named API change param: use ops in struct kernel_param, rather than get and set fns directly param: move the EXPORT_SYMBOL to after the definitions. ...
| * | param: silence .init.text references from param opsRusty Russell2010-08-111-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Ideally, we'd check that it was only the "set" function which was __init, and that the permissions were r/o. But that's a little hard. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
* | | MN10300: Permit .GCC-command-line sectionsDavid Howells2010-08-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Permit .GCC-command-line sections in modules. Otherwise modpost says things like: WARNING: drivers/mtd/chips/map_ram.o (.GCC-command-line): unexpected non-allocatable section. Did you forget to use "ax"/"aw" in a .S file? Note that for example <linux/init.h> contains section definitions for use in .S files. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | | fix "scripts/mod/modpost.c: fix memory leak"Andrew Morton2010-08-111-2/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix error introduced by 37ed19d5cce35a40d3913cf9aa208ce9f60db3d7 ("scripts/mod/modpost.c: fix memory leak"). - don't kfree("") - fix one missed conversion Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Alexey Fomenko <ext-alexey.fomenko@nokia.com> Cc: Trevor Keith <tsrk@tsrk.net> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | scripts/mod/modpost.c: fix memory leakAlexey Fomenko2010-08-091-14/+40
|/ | | | | | | | | | | | sec2annotation returns malloc'ed buffer directly to printf as an argument. Free this buffer after printing. Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com> Cc: Trevor Keith <tsrk@tsrk.net> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge commit 'v2.6.35' into kbuild/kbuildMichal Marek2010-08-041-1/+6
|\ | | | | | | | | Conflicts: arch/powerpc/Makefile
| * powerpc: Fix module building for gcc 4.5 and 64 bitStephen Rothwell2010-07-081-0/+5
| | | | | | | | | | | | | | | | Gcc 4.5 is now generating out of line register save and restore in the function prefix and postfix when we use -Os. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| * kbuild: Fix modpost segfaultKrzysztof Halasa2010-06-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alan <alan@clueserver.org> writes: > program: /home/alan/GitTrees/linux-2.6-mid-ref/scripts/mod/modpost -o > Module.symvers -S vmlinux.o > > Program received signal SIGSEGV, Segmentation fault. It just hit me. It's the offset calculation in reloc_location() which overflows: return (void *)elf->hdr + sechdrs[section].sh_offset + (r->r_offset - sechdrs[section].sh_addr); E.g. for the first rodata r entry: r->r_offset < sechdrs[section].sh_addr and the expression in the parenthesis produces 0xFFFFFFE0 or something equally wise. Reported-by: Alan <alan@clueserver.org> Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Tested-by: Alan <alan@clueserver.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
* | modpost: support objects with more than 64k sectionsDenys Vlasenko2010-08-031-26/+76
|/ | | | | | | | | | | | | | | | | This patch makes modpost able to process object files with more than 64k sections. Needed for huge kernel builds (allyesconfig, for example) with -ffunction-sections. 64k sections handling is covered, for example, by this document: "IA-64 gABI Proposal 74: Section Indexes" http://www.codesourcery.com/public/cxx-abi/abi/prop-74-sindex.html Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Anders Kaseorg <andersk@mit.edu> Acked-by: Sam Ravnborg <sam@ravnborg.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
* modpost: don't allow *driver to reference .init.*Uwe Kleine-König2010-01-301-1/+10
| | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* modpost: make symbol white list a per mismatch type variableUwe Kleine-König2010-01-301-18/+31
| | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* modpost: remove now unused NO_MISMATCH constantUwe Kleine-König2010-01-301-3/+0
| | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* modpost: pass around const struct sectioncheck * instead of enum mismatchUwe Kleine-König2010-01-301-7/+9
| | | | | | This prepares having a per-check whitelist of symbol names. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* modpost: give most mismatch constants a better nameUwe Kleine-König2010-01-301-28/+28
| | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* modpost: define ALL_XXX{IN,EX}IT_SECTIONSUwe Kleine-König2010-01-291-6/+9
| | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* modpost: members of *driver structs should not point to __init functionsUwe Kleine-König2010-01-291-1/+1
| | | | | | | | Either the functions referred to in a driver struct should live in .devinit or the driver should be registered using platform_driver_probe (or equivalent for different driver types) with ->probe being NULL. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* Merge branch 'for-33' of git://repo.or.cz/linux-kbuildLinus Torvalds2009-12-171-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-33' of git://repo.or.cz/linux-kbuild: (29 commits) net: fix for utsrelease.h moving to generated gen_init_cpio: fixed fwrite warning kbuild: fix make clean after mismerge kbuild: generate modules.builtin genksyms: properly consider EXPORT_UNUSED_SYMBOL{,_GPL}() score: add asm/asm-offsets.h wrapper unifdef: update to upstream revision 1.190 kbuild: specify absolute paths for cscope kbuild: create include/generated in silentoldconfig scripts/package: deb-pkg: use fakeroot if available scripts/package: add KBUILD_PKG_ROOTCMD variable scripts/package: tar-pkg: use tar --owner=root Kbuild: clean up marker net: add net_tstamp.h to headers_install kbuild: move utsrelease.h to include/generated kbuild: move autoconf.h to include/generated drop explicit include of autoconf.h kbuild: move compile.h to include/generated kbuild: drop include/asm kbuild: do not check for include/asm-$ARCH ... Fixed non-conflicting clean merge of modpost.c as per comments from Stephen Rothwell (modpost.c had grown an include of linux/autoconf.h that needed to be changed to generated/autoconf.h)
* | modpost: fix segfault with short symbol namesMichal Marek2009-12-151-2/+2
| | | | | | | | | | | | | | | | memcmp() is wrong here, the symbol name can be shorter than KSYMTAB_PFX or CRC_PFX. Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* | Kbuild: clear marker out of modpostWenji Huang2009-12-151-164/+0
| | | | | | | | | | | | | | | | Remove the unnecessary functions and variables. Signed-off-by: Wenji Huang <wenji.huang@oracle.com> Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* | module: make MODULE_SYMBOL_PREFIX into a CONFIG optionAlan Jenkins2009-12-151-0/+9
|/ | | | | | | | | | | | | | | | | | | | The next commit will require the use of MODULE_SYMBOL_PREFIX in .tmp_exports-asm.S. Currently it is mixed in with C structure definitions in "asm/module.h". Move the definition of this arch option into Kconfig, so it can be easily accessed by any code. This also lets modpost.c use the same definition. Previously modpost relied on a hardcoded list of architectures in mk_elfconfig.c. A build test for blackfin, one of the two MODULE_SYMBOL_PREFIX archs, showed the generated code was unchanged. vmlinux was identical save for build ids, and an apparently randomized suffix on a single "__key" symbol in the kallsyms data). Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Acked-by: Mike Frysinger <vapier@gentoo.org> (blackfin) CC: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* Fix all -Wmissing-prototypes warnings in x86 defconfigTrevor Keith2009-09-231-2/+2
| | | | | | | Signed-off-by: Trevor Keith <tsrk@tsrk.net> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* kbuild: add hint about __refdata to modpostSam Ravnborg2009-06-091-1/+1
| | | | | | | As requested by Guennadi Liakhovetski Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* initconst adjustmentsJan Beulich2009-06-091-10/+38
| | | | | | | | | | | | | - add .init.rodata to INIT_DATA, and group all initconst flavors together - move strings generated from __setup_param() into .init.rodata - add .*init.rodata to modpost's sets of init sections - make modpost warn about references between meminit and cpuinit as well as memexit and cpuexit sections (as CPU and memory hotplug are independently selectable features) Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* kbuild, modpost: fix unexpected non-allocatable warning with mipsSam Ravnborg2009-05-041-1/+11
| | | | | | | | | | | | | | mips emit the following debug sections: .mdebug* and .pdr They were included in the check for non-allocatable section and caused modpost to warn. Manuel Lauss suggested to fix this by adding the relevant sections to the list of sections we do not check. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reported-by: Manuel Lauss <mano@roarinelk.homelinux.net>
* kbuild, modpost: fix "unexpected non-allocatable" warning with SUSE gccSam Ravnborg2009-05-041-1/+1
| | | | | | | | | | | | | | | | | | | Jean reported that he saw one warning for each module like the one below: WARNING: arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.o (.comment.SUSE.OPTs): unexpected non-allocatable section. The warning appeared with the improved version of the check of the flags in the sections. That check already ignored sections named ".comment" - but SUSE store additional info in the comment section and has named it in a SUSE specific way. Therefore modpost failed to ignore the section. The fix is to extend the pattern so we ignore all sections that start with the name ".comment.". Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reported-by: Jean Delvare <khali@linux-fr.org> Tested-by: Jean Delvare <khali@linux-fr.org>
* kbuild, modpost: fix unexpected non-allocatable section when cross compilingAnders Kaseorg2009-05-041-12/+23
| | | | | | | | | | | | | | | The missing TO_NATIVE(sechdrs[i].sh_flags) was causing many unexpected non-allocatable section warnings when cross-compiling for an architecture with a different endianness. Fix endianness of all the fields in the ELF header and section headers, not just some of them so we are not hit by this anohter time. Signed-off-by: Anders Kaseorg <andersk@mit.edu> Reported-by: Sean MacLennan <smaclennan@pikatech.com> Tested-by: Sean MacLennan <smaclennan@pikatech.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* kbuild, modpost: Check the section flags, to catch missing "ax"/"aw"Anders Kaseorg2009-05-011-32/+19
| | | | | | | | | | | | | | | | | | | | | | | | When you put .section ".foo" in an assembly file instead of .section "foo", "ax" , one of the possible symptoms is that modpost will see an ld-generated section name ".foo.1" in section_rel() or section_rela(). But this heuristic has two problems: it will miss a bad section that has no relocations, and it will incorrectly flag many gcc-generated sections as bad when compiling with -ffunction-sections -fdata-sections. On mips it fixes a lot of bogus warnings with gcc 4.4.0 lije this one: WARNING: crypto/cryptd.o (.text.T.349): unexpected section name. So instead of checking whether the section name matches a particular pattern, we directly check for a missing SHF_ALLOC in the section flags. Signed-off-by: Anders Kaseorg <andersk@mit.edu> Tested-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* kbuild: fix comment in modpost.cSam Ravnborg2009-05-011-2/+1
| | | | | | | | | There is some confusion on naming of the head section. Correct naming is .head.text. Fix comment so we use correct naming. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* kbuild: fix Module.markers permission error under cygwinCedric Hombourger2009-05-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | While building the kernel, we end-up calling modpost with -K and -M options for the same file (Modules.markers). This is resulting in modpost's main function calling read_markers() and then write_markers() on the same file. We then have read_markers() mmap'ing the file, and writer_markers() opening that same file for writing. The issue is that read_markers() exits without munmap'ing the file and is as a matter holding a reference on Modules.markers. When write_markers() is opening that very same file for writing, we still have a reference on it and cygwin (Windows?) is then making fopen() fail with EPERM. Calling release_file() before exiting read_markers() clears that reference (and memory leak) and fopen() then succeeds. Tested on both cygwin (1.3.22) and Linux. Also ran modpost within valgrind on Linux to make sure that the munmap'ed file was not accessed after read_markers() Signed-off-by: Cedric Hombourger <chombourger@gmail.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* Remove unused support code for refok sections.Tim Abbott2009-04-271-18/+0
| | | | | | | | | | | | | | | | | The old refok sections .text.init.refok .data.init.refok .exit.text.refok have been deprecated since commit 312b1485fb509c9bc32eda28ad29537896658cb8. After the other patches in this patch series nothing is put in these sections, so clean things up by eliminating all the remaining references to them. Signed-off-by: Tim Abbott <tabbott@mit.edu> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* kbuild: remove pointless strdup() on arguments passed to new_module() in modpostJan Beulich2009-04-111-2/+2
| | | | | | | new_module() itself already calls strdup() on its modname parameter. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
* module: include other structures in module version checkRusty Russell2009-03-311-2/+2
| | | | | | | | | | | | | | | | | With CONFIG_MODVERSIONS, we version 'struct module' using a dummy export, but other things matter too: 1) 'struct modversion_info' determines the layout of the __versions section, 2) 'struct kernel_param' determines the layout of the __params section, 3) 'struct kernel_symbol' determines __ksymtab*. 4) 'struct marker' determines __markers. 5) 'struct tracepoint' determines __tracepoints. So we rename 'struct_module' to 'module_layout' and include these in the signature. Now it's general we can add others later on without confusion. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* modpost: NOBITS sections may point beyond the end of the fileTejun Heo2009-02-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Impact: fix link failure on certain toolchains with specific configs Recent percpu change made x86_64 split .data.init section into three separate segments - data.init, percpu and data.init2. data.init2 gets .data.nosave and .bss.* and is followed by .notes segment. Depending on configuration both segments might contain no data, in which case the tool chain makes the section header to contain offset beyond the end of the file. modpost isn't too happy about it and fails build - as reported by Pawel Dziekonski: Building modules, stage 2. MODPOST 416 modules FATAL: vmlinux is truncated. sechdrs[i].sh_offset=10354688 > sizeof(*hrd)=64 make[1]: *** [__modpost] Error 1 Teach modpost that NOBITS section may point beyond the end of the file and that .modinfo can't be NOBITS. Reported-by: Pawel Dziekonski <dzieko@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* Staging: add TAINT_CRAP flag to drivers/staging modulesGreg Kroah-Hartman2008-10-101-0/+9
| | | | | | | | | | | | | | | | | | | We need to add a flag for all code that is in the drivers/staging/ directory to prevent all other kernel developers from worrying about issues here, and to notify users that the drivers might not be as good as they are normally used to. Based on code from Andreas Gruenbacher and Jeff Mahoney to provide a TAINT flag for the support level of a kernel module in the Novell enterprise kernel release. This is the code that actually modifies the modules, adding the flag to any files in the drivers/staging directory. Cc: Andreas Gruenbacher <agruen@suse.de> Cc: Jeff Mahoney <jeffm@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Marker depmod fix core kernel listMathieu Desnoyers2008-10-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Theodore Ts'o (tytso@mit.edu) wrote: > > I've been playing with adding some markers into ext4 to see if they > could be useful in solving some problems along with Systemtap. It > appears, though, that as of 2.6.27-rc8, markers defined in code which is > compiled directly into the kernel (i.e., not as modules) don't show up > in Module.markers: > > kvm_trace_entryexit arch/x86/kvm/kvm-intel %u %p %u %u %u %u %u %u > kvm_trace_handler arch/x86/kvm/kvm-intel %u %p %u %u %u %u %u %u > kvm_trace_entryexit arch/x86/kvm/kvm-amd %u %p %u %u %u %u %u %u > kvm_trace_handler arch/x86/kvm/kvm-amd %u %p %u %u %u %u %u %u > > (Note the lack of any of the kernel_sched_* markers, and the markers I > added for ext4_* and jbd2_* are missing as wel.) > > Systemtap apparently depends on in-kernel trace_mark being recorded in > Module.markers, and apparently it's been claimed that it used to be > there. Is this a bug in systemtap, or in how Module.markers is getting > built? And is there a file that contains the equivalent information > for markers located in non-modules code? I think the problem comes from "markers: fix duplicate modpost entry" (commit d35cb360c29956510b2fe1a953bd4968536f7216) Especially : - add_marker(mod, marker, fmt); + if (!mod->skip) + add_marker(mod, marker, fmt); } return; fail: Here is a fix that should take care if this problem. Thanks for the bug report! Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Tested-by: "Theodore Ts'o" <tytso@mit.edu> CC: Greg KH <greg@kroah.com> CC: David Smith <dsmith@redhat.com> CC: Roland McGrath <roland@redhat.com> CC: Sam Ravnborg <sam@ravnborg.org> CC: Wenji Huang <wenji.huang@oracle.com> CC: Takashi Nishiie <t-nishiie@np.css.fujitsu.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* scripts/mod/modpost.c: fix spelling of module and happensBen Dooks2008-07-301-1/+1
| | | | | | | | | | Spelling fixes in scripts/mod/modpost.c Signed-off-by: Ben Dooks <ben-linux@fluff.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* markers: fix duplicate modpost entryMathieu Desnoyers2008-07-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a kernel was rebuilt, the previous Module.markers was not cleared. It caused markers with different format strings to appear as duplicates when a markers was changed. This problem is present since scripts/mod/modpost.c started to generate Module.markers, commit b2e3e658b344c6bcfb8fb694100ab2f2b5b2edb0 It therefore applies to 2.6.25, 2.6.26 and linux-next. I merely merged the patches from Roland, Wenji and Takashi here. Credits to Roland McGrath <roland@redhat.com> Wenji Huang <wenji.huang@oracle.com> and Takashi Nishiie <t-nishiie@np.css.fujitsu.com> for providing the individual fixes. - Changelog : - Integrated Takashi's Makefile modification to clear Module.markers upon make clean. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Roland McGrath <roland@redhat.com> Cc: Wenji Huang <wenji.huang@oracle.com> Cc: Takashi Nishiie <t-nishiie@np.css.fujitsu.com> Cc: <stable@kernel.org> [2.6.25.x, 2.6.26.x] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* kbuild: ignore powerpc specific symbols in modpostSam Ravnborg2008-06-121-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Kumar Gala <galak@kernel.crashing.org> wrote: We have a case in powerpc in which we want to link some library routines with all module objects. The routines are intended for handling out-of-line function call register save/restore so having them as EXPORT_SYMBOL() is counter productive (we do also need to link the same "library" code into the kernel). Without this patch a powerpc build would error out and fail to build modules with the added register save/restore module. There were two obvious solutions: 1) To link the .o file before the modpost stage 2) To ignore the symbols in modpost Option 1) was ruled out because we do not have any separate linking stage for single file modules. This patch implements option 2 - and do so only for powerpc. The symbols we ignore are all undefined symbols named: _restgpr_*, _savegpr_*, _rest32gpr_*, _save32gpr_* Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Kumar Gala <galak@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org>
* kbuild: disable modpost warnings for linkonce sectionsAndi Kleen2008-05-111-1/+1
| | | | | | | | | | | | | | | | | | Disable modpost warnings for linkonce sections My build gives lots of warnings like WARNING: sound/core/snd.o (.gnu.linkonce.wi.mpspec_def.h.30779716): unexpected section name. The (.[number]+) following section name are ld generated and not expected. Did you forget to use "ax"/"aw" in a .S file? Note that for example <linux/init.h> contains section definitions for use in .S files. But for .linkonce. duplicated sections are actually ok and expected. So just disable the warning for this case. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>