1. 27 7月, 2022 3 次提交
  2. 09 3月, 2021 1 次提交
    • A
      kallsyms: fix nonconverging kallsyms table with lld · c6b3ef1b
      Arnd Bergmann 提交于
      stable inclusion
      from stable-5.10.17
      commit 3dc2ba46500124ac350f9cd1a378e799f8f7fc88
      bugzilla: 48169
      
      --------------------------------
      
      [ Upstream commit efe6e306 ]
      
      ARM randconfig builds with lld sometimes show a build failure
      from kallsyms:
      
        Inconsistent kallsyms data
        Try make KALLSYMS_EXTRA_PASS=1 as a workaround
      
      The problem is the veneers/thunks getting added by the linker extend
      the symbol table, which in turn leads to more veneers being needed,
      so it may take a few extra iterations to converge.
      
      This bug has been fixed multiple times before, but comes back every time
      a new symbol name is used. lld uses a different set of identifiers from
      ld.bfd, so the additional ones need to be added as well.
      
      I looked through the sources and found that arm64 and mips define similar
      prefixes, so I'm adding those as well, aside from the ones I observed. I'm
      not sure about powerpc64, which seems to already be handled through a
      section match, but if it comes back, the "__long_branch_" and "__plt_"
      prefixes would have to get added as well.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      c6b3ef1b
  3. 24 9月, 2020 1 次提交
    • M
      scripts/kallsyms: skip ppc compiler stub *.long_branch.* / *.plt_branch.* · 516d980f
      Masahiro Yamada 提交于
      PowerPC allmodconfig often fails to build as follows:
      
          LD      .tmp_vmlinux.kallsyms1
          KSYM    .tmp_vmlinux.kallsyms1.o
          LD      .tmp_vmlinux.kallsyms2
          KSYM    .tmp_vmlinux.kallsyms2.o
          LD      .tmp_vmlinux.kallsyms3
          KSYM    .tmp_vmlinux.kallsyms3.o
          LD      vmlinux
          SORTTAB vmlinux
          SYSMAP  System.map
        Inconsistent kallsyms data
        Try make KALLSYMS_EXTRA_PASS=1 as a workaround
        make[2]: *** [../Makefile:1162: vmlinux] Error 1
      
      Setting KALLSYMS_EXTRA_PASS=1 does not help.
      
      This is caused by the compiler inserting stubs such as *.long_branch.*
      and *.plt_branch.*
      
        $ powerpc-linux-nm -n .tmp_vmlinux.kallsyms2
         [ snip ]
        c00000000210c010 t 00000075.plt_branch.da9:19
        c00000000210c020 t 00000075.plt_branch.1677:5
        c00000000210c030 t 00000075.long_branch.memmove
        c00000000210c034 t 00000075.plt_branch.9e0:5
        c00000000210c044 t 00000075.plt_branch.free_initrd_mem
          ...
      
      Actually, the problem mentioned in scripts/link-vmlinux.sh comments;
      "In theory it's possible this results in even more stubs, but unlikely"
      is happening here, and ends up with another kallsyms step required.
      
      scripts/kallsyms.c already ignores various compiler stubs. Let's do
      similar to make kallsysms for PowerPC always succeed in 2 steps.
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      516d980f
  4. 06 7月, 2020 1 次提交
    • D
      KVM: arm64: Add build rules for separate VHE/nVHE object files · 76217129
      David Brazdil 提交于
      Add new folders arch/arm64/kvm/hyp/{vhe,nvhe} and Makefiles for building code
      that runs in EL2 under VHE/nVHE KVM, repsectivelly. Add an include folder for
      hyp-specific header files which will include code common to VHE/nVHE.
      
      Build nVHE code with -D__KVM_NVHE_HYPERVISOR__, VHE code with
      -D__KVM_VHE_HYPERVISOR__.
      
      Under nVHE compile each source file into a `.hyp.tmp.o` object first, then
      prefix all its symbols with "__kvm_nvhe_" using `objcopy` and produce
      a `.hyp.o`. Suffixes were chosen so that it would be possible for VHE and nVHE
      to share some source files, but compiled with different CFLAGS.
      
      The nVHE ELF symbol prefix is added to kallsyms.c as ignored. EL2-only symbols
      will never appear in EL1 stack traces.
      
      Due to symbol prefixing, add a section in image-vars.h for aliases of symbols
      that are defined in nVHE EL2 and accessed by kernel in EL1 or vice versa.
      Signed-off-by: NDavid Brazdil <dbrazdil@google.com>
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20200625131420.71444-4-dbrazdil@google.com
      76217129
  5. 05 5月, 2020 1 次提交
    • L
      gcc-10 warnings: fix low-hanging fruit · 9d82973e
      Linus Torvalds 提交于
      Due to a bug-report that was compiler-dependent, I updated one of my
      machines to gcc-10.  That shows a lot of new warnings.  Happily they
      seem to be mostly the valid kind, but it's going to cause a round of
      churn for getting rid of them..
      
      This is the really low-hanging fruit of removing a couple of zero-sized
      arrays in some core code.  We have had a round of these patches before,
      and we'll have many more coming, and there is nothing special about
      these except that they were particularly trivial, and triggered more
      warnings than most.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9d82973e
  6. 19 3月, 2020 1 次提交
    • M
      scripts/kallsyms: fix wrong kallsyms_relative_base · 7883a143
      Mikhail Petrov 提交于
      There is the code in the read_symbol function in 'scripts/kallsyms.c':
      
      	if (is_ignored_symbol(name, type))
      		return NULL;
      
      	/* Ignore most absolute/undefined (?) symbols. */
      	if (strcmp(name, "_text") == 0)
      		_text = addr;
      
      But the is_ignored_symbol function returns true for name="_text" and
      type='A'. So the next condition is not executed and the _text variable
      is always zero.
      
      It makes the wrong kallsyms_relative_base symbol as a result of the code
      (CONFIG_KALLSYMS_BASE_RELATIVE is defined):
      
      	if (base_relative) {
      		output_label("kallsyms_relative_base");
      		output_address(relative_base);
      		printf("\n");
      	}
      
      Because the output_address function uses the _text variable.
      
      So the kallsyms_lookup function and all related functions in the kernel
      do not work properly. For example, the stack trace in oops:
      
       Call Trace:
       [aa095e58] [809feab8] kobj_ns_ops_tbl+0x7ff09ac8/0x7ff1c1c4 (unreliable)
       [aa095e98] [80002b64] kobj_ns_ops_tbl+0x7f50db74/0x80000010
       [aa095ef8] [809c3d24] kobj_ns_ops_tbl+0x7feced34/0x7ff1c1c4
       [aa095f28] [80002ed0] kobj_ns_ops_tbl+0x7f50dee0/0x80000010
       [aa095f38] [8000f238] kobj_ns_ops_tbl+0x7f51a248/0x80000010
      
      The right stack trace:
      
       Call Trace:
       [aa095e58] [809feab8] module_vdu_video_init+0x2fc/0x3bc (unreliable)
       [aa095e98] [80002b64] do_one_initcall+0x40/0x1f0
       [aa095ef8] [809c3d24] kernel_init_freeable+0x164/0x1d8
       [aa095f28] [80002ed0] kernel_init+0x14/0x124
       [aa095f38] [8000f238] ret_from_kernel_thread+0x14/0x1c
      
      [masahiroy@kernel.org:
      
      This issue happens on binutils <= 2.22
      The following commit fixed it:
      https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d2667025dd30611514810c28bee9709e4623012a
      
      The symbol type of _text is 'T' on binutils >= 2.23
      The minimal supported binutils version for the kernel build is 2.21
      ]
      Signed-off-by: NMikhail Petrov <Mikhail.Petrov@mir.dev>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      7883a143
  7. 11 2月, 2020 1 次提交
  8. 04 2月, 2020 2 次提交
  9. 14 12月, 2019 1 次提交
  10. 25 11月, 2019 16 次提交
  11. 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
  12. 19 2月, 2019 3 次提交
  13. 28 1月, 2019 1 次提交
  14. 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
  15. 10 9月, 2018 2 次提交
  16. 29 5月, 2018 1 次提交
  17. 17 5月, 2018 1 次提交
  18. 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
  19. 02 3月, 2018 1 次提交