14 Feb, 2015

1 commit

  • KASan uses constructors for initializing redzones for global variables.
    Globals instrumentation in GCC 4.9.2 produces constructors with priority
    (.init_array.00099)

    Currently kernel ignores such constructors. Only constructors with
    default priority supported (.init_array)

    This patch adds support for constructors with priorities. For kernel
    image we put pointers to constructors between __ctors_start/__ctors_end
    and do_ctors() will call them on start up. For modules we merge
    .init_array.* sections into resulting .init_array. Module code properly
    handles constructors in .init_array section.

    Signed-off-by: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Cc: Konstantin Serebryany
    Cc: Dmitry Chernenkov
    Signed-off-by: Andrey Konovalov
    Cc: Yuri Gribov
    Cc: Konstantin Khlebnikov
    Cc: Sasha Levin
    Cc: Christoph Lameter
    Cc: Joonsoo Kim
    Cc: Dave Hansen
    Cc: Andi Kleen
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrey Ryabinin
     

06 Feb, 2015

1 commit

  • These __ksymtab*/__kcrctab* sections currently have non-zero addresses.
    Non-zero section addresses in a relocatable ELF confuse GDB and it ends
    up not relocating all symbols when add-symbol-file is used on modules
    which have exports. The kernel's module loader does not care about
    these addresses, so let's just set them to zero.

    Before:

    $ readelf -S lib/notifier-error-inject.ko | grep 'Name\| __ksymtab_gpl'
    [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
    [ 8] __ksymtab_gpl PROGBITS 0000000c 0001b4 000010 00 A 0 0 4

    (gdb) add-symbol-file lib/notifier-error-inject.ko 0x500000 -s .bss 0x700000
    add symbol table from file "lib/notifier-error-inject.ko" at
    .text_addr = 0x500000
    .bss_addr = 0x700000
    (gdb) p ¬ifier_err_inject_dir
    $3 = (struct dentry **) 0x0

    After:

    $ readelf -S lib/notifier-error-inject.ko | grep 'Name\| __ksymtab_gpl'
    [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
    [ 8] __ksymtab_gpl PROGBITS 00000000 0001b4 000010 00 A 0 0 4

    (gdb) add-symbol-file lib/notifier-error-inject.ko 0x500000 -s .bss 0x700000
    add symbol table from file "lib/notifier-error-inject.ko" at
    .text_addr = 0x500000
    .bss_addr = 0x700000
    (gdb) p ¬ifier_err_inject_dir
    $3 = (struct dentry **) 0x700000

    Signed-off-by: Rabin Vincent
    Signed-off-by: Rusty Russell

    Rabin Vincent
     

19 May, 2011

1 commit

  • This patch places every exported symbol in its own section
    (i.e. "___ksymtab+printk"). Thus the linker will use its SORT() directive
    to sort and finally merge all symbol in the right and final section
    (i.e. "__ksymtab").

    The symbol prefixed archs use an underscore as prefix for symbols.
    To avoid collision we use a different character to create the temporary
    section names.

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

    Signed-off-by: Alessio Igor Bogani
    Signed-off-by: Rusty Russell (folded in '+' fixup)
    Tested-by: Dirk Behme

    Alessio Igor Bogani
     

24 Jun, 2009

1 commit

  • x86 throws away .discard section but no other archs do. Also,
    .discard is not thrown away while linking modules. Make every arch
    and module linking throw it away. This will be used to define dummy
    variables for percpu declarations and definitions.

    This patch is based on Ivan Kokshaysky's alpha percpu patch.

    [ Impact: always throw away everything in .discard ]

    Signed-off-by: Tejun Heo
    Cc: Ivan Kokshaysky
    Cc: Richard Henderson
    Cc: Russell King
    Cc: Haavard Skinnemoen
    Cc: Bryan Wu
    Cc: Mikael Starvik
    Cc: Jesper Nilsson
    Cc: David Howells
    Cc: Yoshinori Sato
    Cc: Tony Luck
    Cc: Hirokazu Takata
    Cc: Geert Uytterhoeven
    Cc: Michal Simek
    Cc: Ralf Baechle
    Cc: Kyle McMartin
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Paul Mundt
    Cc: David S. Miller
    Cc: Jeff Dike
    Cc: Chris Zankel
    Cc: Rusty Russell
    Cc: Ingo Molnar

    Tejun Heo