29 Apr, 2013

1 commit

  • Commit a4b6a77b77ba4f526392612c2365797fab956014 ("module: fix symbol
    versioning with symbol prefixes") broke the MODVERSIONS loading of any
    module using memcmp (e.g. ipv6) on x86_32, as it's defined to
    __builtin_memcmp which is expanded by VMLINUX_SYMBOL_STR. Use
    __VMLINUX_SYMBOL_STR instead which doesn't expand the argument.

    Reported-by: Tetsuo Handa
    Reported-by: Andy Shevchenko
    Signed-off-by: James Hogan
    Cc: H. Peter Anvin
    Tested-by: Tetsuo Handa
    Tested-by: Andy Shevchenko
    Signed-off-by: Rusty Russell
    Cc: # 3.9

    James Hogan
     

05 Apr, 2013

2 commits


20 Mar, 2013

1 commit

  • Fix symbol versioning on architectures with symbol prefixes. Although
    the build was free from warnings the actual modules still wouldn't load
    as the ____versions table contained unprefixed symbol names, which were
    being compared against the prefixed symbol names when checking the
    symbol versions.

    This is fixed by modifying modpost to add the symbol prefix to the
    ____versions table it outputs (Modules.symvers still contains unprefixed
    symbol names). The check_modstruct_version() function is also fixed as
    it checks the version of the unprefixed "module_layout" symbol which
    would no longer work.

    Signed-off-by: James Hogan
    Cc: Michal Marek
    Cc: Sam Ravnborg
    Cc: Greg Kroah-Hartman
    Cc: Jonathan Kliegman
    Signed-off-by: Rusty Russell (use VMLINUX_SYMBOL_STR)

    James Hogan
     

15 Mar, 2013

1 commit

  • We have CONFIG_SYMBOL_PREFIX, which three archs define to the string
    "_". But Al Viro broke this in "consolidate cond_syscall and
    SYSCALL_ALIAS declarations" (in linux-next), and he's not the first to
    do so.

    Using CONFIG_SYMBOL_PREFIX is awkward, since we usually just want to
    prefix it so something. So various places define helpers which are
    defined to nothing if CONFIG_SYMBOL_PREFIX isn't set:

    1) include/asm-generic/unistd.h defines __SYMBOL_PREFIX.
    2) include/asm-generic/vmlinux.lds.h defines VMLINUX_SYMBOL(sym)
    3) include/linux/export.h defines MODULE_SYMBOL_PREFIX.
    4) include/linux/kernel.h defines SYMBOL_PREFIX (which differs from #7)
    5) kernel/modsign_certificate.S defines ASM_SYMBOL(sym)
    6) scripts/modpost.c defines MODULE_SYMBOL_PREFIX
    7) scripts/Makefile.lib defines SYMBOL_PREFIX on the commandline if
    CONFIG_SYMBOL_PREFIX is set, so that we have a non-string version
    for pasting.

    (arch/h8300/include/asm/linkage.h defines SYMBOL_NAME(), too).

    Let's solve this properly:
    1) No more generic prefix, just CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX.
    2) Make linux/export.h usable from asm.
    3) Define VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR().
    4) Make everyone use them.

    Signed-off-by: Rusty Russell
    Reviewed-by: James Hogan
    Tested-by: James Hogan (metag)

    Rusty Russell
     

28 Feb, 2013

1 commit

  • Pull kbuild changes from Michal Marek:

    - Alias generation in modpost is cross-compile safe.

    - kernel/timeconst.h is now generated using a bc script instead of
    perl.

    - scripts/link-vmlinux.sh now works with an alternative
    $KCONFIG_CONFIG.

    - destination-y for exported headers is supported in Kbuild files
    again.

    - depmod is called with -P $CONFIG_SYMBOL_PREFIX on architectures that
    need it.

    - CONFIG_DEBUG_INFO_REDUCED disables var-tracking

    - scripts/setlocalversion works with too much translated locales ;)

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    kbuild: Fix reading of .config in link-vmlinux.sh
    kbuild: Unset language specific variables in setlocalversion script
    Kbuild: Disable var tracking with CONFIG_DEBUG_INFO_REDUCED
    depmod: pass -P $CONFIG_SYMBOL_PREFIX
    kbuild: Fix destination-y for installed headers
    scripts/link-vmlinux.sh: source variables from KCONFIG_CONFIG
    kernel: Replace timeconst.pl with a bc script
    mod/file2alias: make modalias generation safe for cross compiling

    Linus Torvalds
     

25 Jan, 2013

1 commit


21 Jan, 2013

1 commit

  • ARC relocatable object files contain one/more .gnu.linkonce.arcextmap.*
    sections (collated by kernel/vmlinux.lds into .arcextmap in final link).
    This section is used by debuggers to display the extension instructions
    and need-not be loaded by target (hence !SHF_ALLOC)

    The final kernel binary only needs .arcextmap entry in modpost's ignore
    list (section_white_list[]). However when building modules, modpost scans
    each object file individually, hence tripping on non-aggregated
    .gnu.linkonce.arcextmap.* entries as well.

    Thus need for the 2 entires !

    Signed-off-by: Vineet Gupta
    Acked-by: Sam Ravnborg
    Signed-off-by: Rusty Russell

    Vineet Gupta
     

01 Dec, 2012

1 commit


12 Oct, 2012

2 commits

  • Pull kbuild changes from Michal Marek:
    "The main part of kbuild for v3.7 contains:
    - Fix for scripts/Makefile.modpost to not choke on a '.ko' substring
    in the build directory path
    - Two warning fixes (modpost and main Makefile)
    - __compiletime_error works also with gcc 4.3
    - make tar{gz,bz2,xz}-pkg uses default compression settings instead
    of saving as many bytes as possible (this should actually be in the
    misc branch, I don't know why I applied it here)."

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    compiler-gcc4.h: correct verion check for __compiletime_error
    modpost: Permit .GCC.command.line sections
    Kbuild: use normal compression settings for tar*-pkg
    scripts/Makefile.modpost: error in finding modules from .mod files.
    kbuild: Remove useless warning while appending KCFLAGS

    Linus Torvalds
     
  • Allow .GCC.command.line sections in modules to prevent modpost warnings:
    WARNING: sound/usb/snd-usbmidi-lib.o (.GCC.command.line): unexpected non-allocatable section.
    Did you forget to use "ax"/"aw" in a .S file?
    Note that for example contains
    section definitions for use in .S files.

    Signed-off-by: Jonathan Kliegman
    Signed-off-by: Michal Marek

    Jonathan Kliegman
     

04 Oct, 2012

1 commit


17 Jun, 2012

1 commit

  • Functions used for PCI fixups (like DECLARE_PCI_FIXUP_HEADER) are often
    marked __init. This is okay as long as nobody is using PCI hotplug.
    However if one does execute
    | echo 1 > /sys/bus/pci/rescan

    and we hit a module which is marked __init istead of __devinit then we
    go boom because the code is removed after the kernel booted. This patch
    help to see those section mismatches.

    Cc: Michal Marek
    Cc: linux-kbuild@vger.kernel.org
    Cc: Rusty Russell
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Bjorn Helgaas

    Sebastian Andrzej Siewior
     

23 May, 2012

2 commits


10 Apr, 2012

1 commit

  • 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
    Signed-off-by: Alessio Igor Bogani
    Signed-off-by: Linus Torvalds

    Frank Rowand
     

31 Mar, 2012

1 commit

  • Pull kbuild changes from Michal Marek:
    - Unification of cmd_uimage among archs that use it
    - make headers_check tries harder before reporting a missing
    include
    - kbuild portability fix for shells that do not support echo -e
    - make clean descends into samples/
    - setlocalversion grep fix
    - modpost typo fix
    - dtc warnings fix

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    setlocalversion: Use "grep -q" instead of piping output to "read dummy"
    modpost: fix ALL_INIT_DATA_SECTIONS
    Kbuild: centralize MKIMAGE and cmd_uimage definitions
    headers_check: recursively search for linux/types.h inclusion
    scripts/Kbuild.include: Fix portability problem of "echo -e"
    scripts: dtc: fix compile warnings
    kbuild: clean up samples directory
    kbuild: disable -Wmissing-field-initializers for W=1

    Linus Torvalds
     

27 Mar, 2012

1 commit


15 Feb, 2012

1 commit

  • It turns out that many compilers don't show section warnings on ARM
    currently because handling for ARM_CALL relocs are missing from
    modpost.c.

    Based on commit c2e26114 ([ARM] 3205/1: Handle new EABI relocations when
    loading kernel modules) it seems that R_ARM_PC24, R_ARM_CALL and
    R_ARM_JUMP24 can be handled the same way.

    Note that at least Debian libc6-dev is missing defines for both
    R_ARM_CALL and R_ARM_JUMP24 in /usr/include/elf.h. So for now
    we need to define them in modpost.c if not defined.

    Acked-by: Rusty Russell
    Cc: Ben Hutchings
    Cc: Anders Kaseorg
    Cc: Greg KH
    Signed-off-by: Tony Lindgren
    Signed-off-by: Russell King

    Tony Lindgren
     

07 Nov, 2011

1 commit

  • Use of the GPL or a compatible licence doesn't necessarily make the code
    any good. We already consider staging modules to be suspect, and this
    should also be true for out-of-tree modules which may receive very
    little review.

    Signed-off-by: Ben Hutchings
    Reviewed-by: Dave Jones
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Rusty Russell (patched oops-tracing.txt)

    Ben Hutchings
     

24 Jul, 2011

1 commit

  • 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 and Anders Kaseorg
    for providing useful suggestions about code.

    This work was supported by a hardware donation from the CE Linux Forum.

    Reported-by: Jan Beulich
    Signed-off-by: Alessio Igor Bogani
    Signed-off-by: Rusty Russell

    Alessio Igor Bogani
     

19 May, 2011

1 commit

  • 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
    Signed-off-by: Rusty Russell

    Anders Kaseorg
     

17 Mar, 2011

1 commit

  • 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
    Signed-off-by: Michal Marek

    Randy Dunlap
     

14 Jan, 2011

1 commit

  • * '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.

    Linus Torvalds
     

28 Dec, 2010

1 commit

  • 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
    Signed-off-by: Olof Johansson
    Signed-off-by: Michal Marek

    Olof Johansson
     

17 Dec, 2010

1 commit


02 Nov, 2010

1 commit

  • "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
    Signed-off-by: Jiri Kosina

    Uwe Kleine-König
     

29 Oct, 2010

1 commit

  • * '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

    Linus Torvalds
     

26 Aug, 2010

1 commit

  • 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
    Cc: Rusty Russell
    Cc: Andrew Morton
    Acked-by: WANG Cong
    Signed-off-by: Michal Marek

    Andy Shevchenko
     

13 Aug, 2010

2 commits

  • * '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.
    ...

    Linus Torvalds
     
  • 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 contains
    section definitions for use in .S files.

    Signed-off-by: David Howells
    Signed-off-by: Linus Torvalds

    David Howells
     

11 Aug, 2010

2 commits


10 Aug, 2010

1 commit

  • sec2annotation returns malloc'ed buffer directly to printf as an argument.
    Free this buffer after printing.

    Signed-off-by: Alexey Fomenko
    Cc: Trevor Keith
    Cc: Rusty Russell
    Cc: Michal Marek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Fomenko
     

04 Aug, 2010

1 commit


03 Aug, 2010

1 commit

  • 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
    Signed-off-by: Anders Kaseorg
    Acked-by: Sam Ravnborg
    Cc: Rusty Russell
    Cc: Andi Kleen
    Signed-off-by: Michal Marek

    Denys Vlasenko
     

08 Jul, 2010

1 commit


12 Jun, 2010

1 commit

  • Alan 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
    Signed-off-by: Krzysztof Hałasa
    Tested-by: Alan
    Signed-off-by: Michal Marek

    Krzysztof Halasa
     

31 Jan, 2010

2 commits