17 Mar, 2014

1 commit

  • x86-64 has a problem: per-cpu variables are actually represented by
    their absolute offsets within the per-cpu area, but the symbols are
    not emitted as absolute. Thus kallsyms naively creates them as offsets
    from _text, meaning their values change if the kernel is relocated
    (especially noticeable with CONFIG_RANDOMIZE_BASE):

    $ egrep ' (gdt_|_(stext|_per_cpu_))' /root/kallsyms.nokaslr
    0000000000000000 D __per_cpu_start
    0000000000004000 D gdt_page
    0000000000014280 D __per_cpu_end
    ffffffff810001c8 T _stext
    ffffffff81ee53c0 D __per_cpu_offset
    $ egrep ' (gdt_|_(stext|_per_cpu_))' /root/kallsyms.kaslr1
    000000001f200000 D __per_cpu_start
    000000001f204000 D gdt_page
    000000001f214280 D __per_cpu_end
    ffffffffa02001c8 T _stext
    ffffffffa10e53c0 D __per_cpu_offset

    Making them absolute symbols is the Right Thing, but requires fixes to
    the relocs tool. So for the moment, we add a --absolute-percpu option
    which makes them absolute from a kallsyms perspective:

    $ egrep ' (gdt_|_(stext|_per_cpu_))' /proc/kallsyms # no KASLR
    0000000000000000 A __per_cpu_start
    000000000000a000 A gdt_page
    0000000000013040 A __per_cpu_end
    ffffffff802001c8 T _stext
    ffffffff8099b180 D __per_cpu_offset
    ffffffff809a3000 D __per_cpu_load
    $ egrep ' (gdt_|_(stext|_per_cpu_))' /proc/kallsyms # With KASLR
    0000000000000000 A __per_cpu_start
    000000000000a000 A gdt_page
    0000000000013040 A __per_cpu_end
    ffffffff89c001c8 T _stext
    ffffffff8a39d180 D __per_cpu_offset
    ffffffff8a3a5000 D __per_cpu_load

    Based-on-the-original-screenplay-by: Andy Honig
    Signed-off-by: Rusty Russell
    Acked-by: Kees Cook

    Rusty Russell
     

10 Dec, 2013

1 commit

  • Actually CONFIG_PAGE_OFFSET isn't same with PAGE_OFFSET, so
    it isn't easy to figue out PAGE_OFFSET defined in header
    file from scripts.

    Because CONFIG_PAGE_OFFSET may not be defined in some ARCHs(
    64bit ARCH), or defined as bogus value in !MMU case, so
    this patch only applys the filter on ARM when CONFIG_PAGE_OFFSET
    is defined as the original problem is only on ARM.

    Cc:
    Cc: Rusty Russell
    Fixes: f6537f2f0eba4eba3354e48dbe3047db6d8b6254
    Singed-off-by: Ming Lei
    Signed-off-by: Rusty Russell

    Ming Lei
     

02 Nov, 2013

1 commit

  • This patch uses CONFIG_PAGE_OFFSET to filter symbols which
    are not in kernel address space because these symbols are
    generally for generating code purpose and can't be run at
    kernel mode, so we needn't keep them in /proc/kallsyms.

    For example, on ARM there are some symbols which may be
    linked in relocatable code section, then perf can't parse
    symbols any more from /proc/kallsyms, this patch fixes the
    problem (introduced b9b32bf70f2fb710b07c94e13afbc729afe221da)

    Cc: Russell King
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Michal Marek
    Signed-off-by: Ming Lei
    Signed-off-by: Rusty Russell
    Cc: stable@vger.kernel.org

    Ming Lei
     

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
     

25 Feb, 2013

1 commit

  • The shell '.' command is not required to search the current directory as
    a fallback and in fact newer versions of bash in sh-mode do not do this.
    Force reading the file from the current directory if $KCONFIG_CONFIG
    contains no '/'.

    Reported-by: Stephen Rothwell
    Signed-off-by: Michal Marek

    Michal Marek
     

22 Feb, 2013

1 commit


12 Sep, 2012

1 commit


11 Sep, 2012

1 commit

  • Commit 1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123 ("kbuild: link of
    vmlinux moved to a script") introduced in v3.5-rc1 broke kallsyms on
    architectures which have symbol prefixes.

    The --symbol-prefix argument used to be added to the KALLSYMS command
    line from the architecture Makefile, however this isn't picked up by the
    new scripts/link-vmlinux.sh. This resulted in symbols like
    kallsyms_addresses being added which weren't correctly overriding the
    weak symbols such as _kallsyms_addresses. These could then trigger
    BUG_ONs in kallsyms code.

    This is fixed by removing the KALLSYMS addition from the architecture
    Makefile, and using CONFIG_SYMBOL_PREFIX in the link-vmlinux.sh script
    to determine whether to add the --symbol-prefix argument.

    Signed-off-by: James Hogan
    Signed-off-by: Bob Liu

    James Hogan
     

10 Aug, 2012

1 commit


08 Jul, 2012

1 commit

  • ... at least in the top-level Makefile and scripts/link-vmlinux.sh.
    There are some more instances of the 'echo ; exit 1' pattern in
    some arch Makefiles and kconfig.

    Reported-by: Linus Torvalds
    Signed-off-by: Michal Marek

    Michal Marek
     

29 May, 2012

1 commit

  • Pull kbuild updates from Michal Marek.

    Fixed up nontrivial merge conflict in Makefile as per Stephen Rothwell
    and linux-next (and trivial arch/sparc/Makefile changes due to removed
    sparc32 logic).

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    mips: Fix KBUILD_CPPFLAGS definition
    kbuild: fix ia64 link
    kbuild: document KBUILD_LDS, KBUILD_VMLINUX_{INIT,MAIN} and LDFLAGS_vmlinux
    kbuild: link of vmlinux moved to a script
    kbuild: refactor final link of sparc32
    kbuild: drop unused KBUILD_VMLINUX_OBJS from top-level Makefile
    kbuild: Makefile: remove unnecessary check for m68knommu ARCH

    Linus Torvalds
     

10 May, 2012

1 commit

  • ia64 build failed like this:

    CC init/version.o
    LD init/built-in.o
    KSYM .tmp_kallsyms1.o
    ld: .tmp_kallsyms1.o: linking constant-gp files with non-constant-gp files
    ld: failed to merge target specific data of file .tmp_kallsyms1.o
    make: *** [vmlinux] Error 1

    This was introduced when link of vmlinux was migrated to a script.
    Add missing option to as to fix this.

    Reported-by: Tony Luck
    Tested-by: Tony Luck
    Signed-off-by: Sam Ravnborg
    Signed-off-by: Michal Marek

    Sam Ravnborg
     

06 May, 2012

1 commit

  • Move the final link of vmlinux to a script to improve
    readability and maintainability of the code.

    The Makefile fragments used to link vmlinux has over the
    years seen far too many changes and the logic had become
    hard to follow.

    As the process by nature is serialized there was
    nothing gained including this in the Makefile.

    "um" has special link requirments - and the
    only way to handle this was to hard-code the linking
    of "um" in the script.
    This was better than trying to modularize it only for the
    benefit of "um" anyway.

    The shell script has been improved after input from:
    Arnaud Lacombe
    Nick Bowler

    Signed-off-by: Sam Ravnborg
    Cc: Arnaud Lacombe
    Cc: Nick Bowler
    Cc: Richard Weinberger
    Signed-off-by: Michal Marek

    Sam Ravnborg