1. 04 2月, 2020 2 次提交
  2. 14 12月, 2019 1 次提交
  3. 25 11月, 2019 16 次提交
  4. 08 7月, 2019 1 次提交
    • V
      kallsyms: exclude kasan local symbols on s390 · 33177f01
      Vasily Gorbik 提交于
      gcc asan instrumentation emits the following sequence to store frame pc
      when the kernel is built with CONFIG_RELOCATABLE:
      debug/vsprintf.s:
              .section        .data.rel.ro.local,"aw"
              .align  8
      .LC3:
              .quad   .LASANPC4826@GOTOFF
      .text
              .align  8
              .type   number, @function
      number:
      .LASANPC4826:
      
      and in case reloc is issued for LASANPC label it also gets into .symtab
      with the same address as actual function symbol:
      $ nm -n vmlinux | grep 0000000001397150
      0000000001397150 t .LASANPC4826
      0000000001397150 t number
      
      In the end kernel backtraces are almost unreadable:
      [  143.748476] Call Trace:
      [  143.748484] ([<000000002da3e62c>] .LASANPC2671+0x114/0x190)
      [  143.748492]  [<000000002eca1a58>] .LASANPC2612+0x110/0x160
      [  143.748502]  [<000000002de9d830>] print_address_description+0x80/0x3b0
      [  143.748511]  [<000000002de9dd64>] __kasan_report+0x15c/0x1c8
      [  143.748521]  [<000000002ecb56d4>] strrchr+0x34/0x60
      [  143.748534]  [<000003ff800a9a40>] kasan_strings+0xb0/0x148 [test_kasan]
      [  143.748547]  [<000003ff800a9bba>] kmalloc_tests_init+0xe2/0x528 [test_kasan]
      [  143.748555]  [<000000002da2117c>] .LASANPC4069+0x354/0x748
      [  143.748563]  [<000000002dbfbb16>] do_init_module+0x136/0x3b0
      [  143.748571]  [<000000002dbff3f4>] .LASANPC3191+0x2164/0x25d0
      [  143.748580]  [<000000002dbffc4c>] .LASANPC3196+0x184/0x1b8
      [  143.748587]  [<000000002ecdf2ec>] system_call+0xd8/0x2d8
      
      Since LASANPC labels are not even unique and get into .symtab only due
      to relocs filter them out in kallsyms.
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      33177f01
  5. 19 2月, 2019 3 次提交
  6. 28 1月, 2019 1 次提交
  7. 06 1月, 2019 1 次提交
    • M
      kallsyms: lower alignment on ARM · 72d3ebb9
      Mathias Krause 提交于
      As mentioned in the info pages of gas, the '.align' pseudo op's
      interpretation of the alignment value is architecture specific.
      It might either be a byte value or taken to the power of two.
      
      On ARM it's actually the latter which leads to unnecessary large
      alignments of 16 bytes for 32 bit builds or 256 bytes for 64 bit
      builds.
      
      Fix this by switching to '.balign' instead which is consistent
      across all architectures.
      Signed-off-by: NMathias Krause <minipli@googlemail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      72d3ebb9
  8. 10 9月, 2018 2 次提交
  9. 29 5月, 2018 1 次提交
  10. 17 5月, 2018 1 次提交
  11. 07 3月, 2018 1 次提交
    • A
      scripts/kallsyms: filter arm64's __efistub_ symbols · 1212f7a1
      Ard Biesheuvel 提交于
      On arm64, the EFI stub and the kernel proper are essentially the same
      binary, although the EFI stub executes at a different virtual address
      as the kernel. For this reason, the EFI stub is restricted in the
      symbols it can link to, which is ensured by prefixing all EFI stub
      symbols with __efistub_ (and emitting __efistub_ prefixed aliases for
      routines that may be shared between the core kernel and the stub)
      
      These symbols are leaking into kallsyms, polluting the namespace, so
      let's filter them explicitly.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      1212f7a1
  12. 02 3月, 2018 1 次提交
  13. 14 10月, 2017 1 次提交
    • G
      scripts/kallsyms.c: ignore symbol type 'n' · 51962a9d
      Guenter Roeck 提交于
      gcc on aarch64 may emit synbols of type 'n' if the kernel is built with
      '-frecord-gcc-switches'.  In most cases, those symbols are reported with
      nm as
      
      	000000000000000e n $d
      
      and with objdump as
      
      	0000000000000000 l    d  .GCC.command.line	0000000000000000 .GCC.command.line
      	000000000000000e l       .GCC.command.line	0000000000000000 $d
      
      Those symbols are detected in is_arm_mapping_symbol() and ignored.
      However, if "--prefix-symbols=<prefix>" is configured as well, the
      situation is different.  For example, in efi/libstub, arm64 images are
      built with
      
      	'--prefix-alloc-sections=.init --prefix-symbols=__efistub_'.
      
      In combination with '-frecord-gcc-switches', the symbols are now reported
      by nm as:
      
      	000000000000000e n __efistub_$d
      and by objdump as:
      	0000000000000000 l    d  .GCC.command.line	0000000000000000 .GCC.command.line
      	000000000000000e l       .GCC.command.line	0000000000000000 __efistub_$d
      
      Those symbols are no longer ignored and included in the base address
      calculation.  This results in a base address of 000000000000000e, which
      in turn causes kallsyms to abort with
      
          kallsyms failure:
      	relative symbol value 0xffffff900800a000 out of range in relative mode
      
      The problem is seen in little endian arm64 builds with CONFIG_EFI
      enabled and with '-frecord-gcc-switches' set in KCFLAGS.
      
      Explicitly ignore symbols of type 'n' since those are clearly debug
      symbols.
      
      Link: http://lkml.kernel.org/r/1507136063-3139-1-git-send-email-linux@roeck-us.netSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
      Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      51962a9d
  14. 04 2月, 2017 1 次提交
    • A
      kbuild: modversions: add infrastructure for emitting relative CRCs · 56067812
      Ard Biesheuvel 提交于
      This add the kbuild infrastructure that will allow architectures to emit
      vmlinux symbol CRCs as 32-bit offsets to another location in the kernel
      where the actual value is stored. This works around problems with CRCs
      being mistaken for relocatable symbols on kernels that self relocate at
      runtime (i.e., powerpc with CONFIG_RELOCATABLE=y)
      
      For the kbuild side of things, this comes down to the following:
      
       - introducing a Kconfig symbol MODULE_REL_CRCS
      
       - adding a -R switch to genksyms to instruct it to emit the CRC symbols
         as references into the .rodata section
      
       - making modpost distinguish such references from absolute CRC symbols
         by the section index (SHN_ABS)
      
       - making kallsyms disregard non-absolute symbols with a __crc_ prefix
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      56067812
  15. 11 12月, 2016 1 次提交
  16. 08 4月, 2016 2 次提交
  17. 16 3月, 2016 2 次提交
    • A
      kallsyms: add support for relative offsets in kallsyms address table · 2213e9a6
      Ard Biesheuvel 提交于
      Similar to how relative extables are implemented, it is possible to emit
      the kallsyms table in such a way that it contains offsets relative to
      some anchor point in the kernel image rather than absolute addresses.
      
      On 64-bit architectures, it cuts the size of the kallsyms address table
      in half, since offsets between kernel symbols can typically be expressed
      in 32 bits.  This saves several hundreds of kilobytes of permanent
      .rodata on average.  In addition, the kallsyms address table is no
      longer subject to dynamic relocation when CONFIG_RELOCATABLE is in
      effect, so the relocation work done after decompression now doesn't have
      to do relocation updates for all these values.  This saves up to 24
      bytes (i.e., the size of a ELF64 RELA relocation table entry) per value,
      which easily adds up to a couple of megabytes of uncompressed __init
      data on ppc64 or arm64.  Even if these relocation entries typically
      compress well, the combined size reduction of 2.8 MB uncompressed for a
      ppc64_defconfig build (of which 2.4 MB is __init data) results in a ~500
      KB space saving in the compressed image.
      
      Since it is useful for some architectures (like x86) to retain the
      ability to emit absolute values as well, this patch also adds support
      for capturing both absolute and relative values when
      KALLSYMS_ABSOLUTE_PERCPU is in effect, by emitting absolute per-cpu
      addresses as positive 32-bit values, and addresses relative to the
      lowest encountered relative symbol as negative values, which are
      subtracted from the runtime address of this base symbol to produce the
      actual address.
      
      Support for the above is enabled by default for all architectures except
      IA-64 and Tile-GX, whose symbols are too far apart to capture in this
      manner.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Tested-by: NKees Cook <keescook@chromium.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2213e9a6
    • A
      kallsyms: don't overload absolute symbol type for percpu symbols · 8c996940
      Ard Biesheuvel 提交于
      Commit c6bda7c9 ("kallsyms: fix percpu vars on x86-64 with
      relocation") overloaded the 'A' (absolute) symbol type to signify that a
      symbol is not subject to dynamic relocation.  However, the original A
      type does not imply that at all, and depending on the version of the
      toolchain, many A type symbols are emitted that are in fact relative to
      the kernel text, i.e., if the kernel is relocated at runtime, these
      symbols should be updated as well.
      
      For instance, on sparc32, the following symbols are emitted as absolute
      (kindly provided by Guenter Roeck):
      
        f035a420 A _etext
        f03d9000 A _sdata
        f03de8c4 A jiffies
        f03f8860 A _edata
        f03fc000 A __init_begin
        f041bdc8 A __init_text_end
        f0423000 A __bss_start
        f0423000 A __init_end
        f044457d A __bss_stop
        f044457d A _end
      
      On x86_64, similar behavior can be observed:
      
        ffffffff81a00000 A __end_rodata_hpage_align
        ffffffff81b19000 A __vvar_page
        ffffffff81d3d000 A _end
      
      Even if only a couple of them pass the symbol range check that results
      in them to be taken into account for the final kallsyms symbol table, it
      is obvious that 'A' does not mean the symbol does not need to be updated
      at relocation time, and overloading its meaning to signify that is
      perhaps not a good idea.
      
      So instead, add a new percpu_absolute member to struct sym_entry, and
      when --absolute-percpu is in effect, use it to record symbols whose
      addresses should be emitted as final values rather than values that
      still require relocation at runtime.  That way, we can drop the check
      against the 'A' type.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Tested-by: NKees Cook <keescook@chromium.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Michal Marek <mmarek@suse.cz>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8c996940
  18. 07 4月, 2015 2 次提交