1. 14 1月, 2021 1 次提交
    • J
      objtool: Don't add empty symbols to the rbtree · a2e38dff
      Josh Poimboeuf 提交于
      Building with the Clang assembler shows the following warning:
      
        arch/x86/kernel/ftrace_64.o: warning: objtool: missing symbol for insn at offset 0x16
      
      The Clang assembler strips section symbols.  That ends up giving
      objtool's find_func_containing() much more test coverage than normal.
      Turns out, find_func_containing() doesn't work so well for overlapping
      symbols:
      
           2: 000000000000000e     0 NOTYPE  LOCAL  DEFAULT    2 fgraph_trace
           3: 000000000000000f     0 NOTYPE  LOCAL  DEFAULT    2 trace
           4: 0000000000000000   165 FUNC    GLOBAL DEFAULT    2 __fentry__
           5: 000000000000000e     0 NOTYPE  GLOBAL DEFAULT    2 ftrace_stub
      
      The zero-length NOTYPE symbols are inside __fentry__(), confusing the
      rbtree search for any __fentry__() offset coming after a NOTYPE.
      
      Try to avoid this problem by not adding zero-length symbols to the
      rbtree.  They're rare and aren't needed in the rbtree anyway.
      
      One caveat, this actually might not end up being the right fix.
      Non-empty overlapping symbols, if they exist, could have the same
      problem.  But that would need bigger changes, let's see if we can get
      away with the easy fix for now.
      Reported-by: NArnd Bergmann <arnd@kernel.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      a2e38dff
  2. 16 12月, 2020 1 次提交
  3. 01 9月, 2020 1 次提交
  4. 18 6月, 2020 2 次提交
  5. 03 6月, 2020 1 次提交
  6. 01 6月, 2020 1 次提交
    • M
      objtool: Rename rela to reloc · f1974222
      Matt Helsley 提交于
      Before supporting additional relocation types rename the relevant
      types and functions from "rela" to "reloc". This work be done with
      the following regex:
      
        sed -e 's/struct rela/struct reloc/g' \
            -e 's/\([_\*]\)rela\(s\{0,1\}\)/\1reloc\2/g' \
            -e 's/tmprela\(s\{0,1\}\)/tmpreloc\1/g' \
            -e 's/relasec/relocsec/g' \
            -e 's/rela_list/reloc_list/g' \
            -e 's/rela_hash/reloc_hash/g' \
            -e 's/add_rela/add_reloc/g' \
            -e 's/rela->/reloc->/g' \
            -e '/rela[,\.]/{ s/\([^\.>]\)rela\([\.,]\)/\1reloc\2/g ; }' \
            -e 's/rela =/reloc =/g' \
            -e 's/relas =/relocs =/g' \
            -e 's/relas\[/relocs[/g' \
            -e 's/relaname =/relocname =/g' \
            -e 's/= rela\;/= reloc\;/g' \
            -e 's/= relas\;/= relocs\;/g' \
            -e 's/= relaname\;/= relocname\;/g' \
            -e 's/, rela)/, reloc)/g' \
            -e 's/\([ @]\)rela\([ "]\)/\1reloc\2/g' \
            -e 's/ rela$/ reloc/g' \
            -e 's/, relaname/, relocname/g' \
            -e 's/sec->rela/sec->reloc/g' \
            -e 's/(\(!\{0,1\}\)rela/(\1reloc/g' \
            -i \
            arch.h \
            arch/x86/decode.c  \
            check.c \
            check.h \
            elf.c \
            elf.h \
            orc_gen.c \
            special.c
      
      Notable exceptions which complicate the regex include gelf_*
      library calls and standard/expected section names which still use
      "rela" because they encode the type of relocation expected. Also, keep
      "rela" in the struct because it encodes a specific type of relocation
      we currently expect.
      
      It will eventually turn into a member of an anonymous union when a
      susequent patch adds implicit addend, or "rel", relocation support.
      Signed-off-by: NMatt Helsley <mhelsley@vmware.com>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      f1974222
  7. 29 5月, 2020 2 次提交
  8. 15 5月, 2020 1 次提交
  9. 01 5月, 2020 1 次提交
  10. 23 4月, 2020 3 次提交
  11. 22 4月, 2020 2 次提交
  12. 26 3月, 2020 9 次提交
  13. 21 2月, 2020 1 次提交
  14. 19 7月, 2019 2 次提交
  15. 18 7月, 2019 2 次提交
  16. 21 5月, 2019 1 次提交
    • T
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 · 1ccea77e
      Thomas Gleixner 提交于
      Based on 2 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details you
        should have received a copy of the gnu general public license along
        with this program if not see http www gnu org licenses
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details [based]
        [from] [clk] [highbank] [c] you should have received a copy of the
        gnu general public license along with this program if not see http
        www gnu org licenses
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 355 file(s).
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NJilayne Lovejoy <opensource@jilayne.com>
      Reviewed-by: NSteve Winslow <swinslow@gmail.com>
      Reviewed-by: NAllison Randal <allison@lohutok.net>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190519154041.837383322@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ccea77e
  17. 03 4月, 2019 1 次提交
  18. 21 11月, 2018 2 次提交
  19. 01 11月, 2018 1 次提交
  20. 08 9月, 2018 1 次提交
    • A
      objtool: Support per-function rodata sections · 4a60aa05
      Allan Xavier 提交于
      Add support for processing switch jump tables in objects with multiple
      .rodata sections, such as those created by '-ffunction-sections' and
      '-fdata-sections'.  Currently, objtool always looks in .rodata for jump
      table information, which results in many "sibling call from callable
      instruction with modified stack frame" warnings with objects compiled
      using those flags.
      
      The fix is comprised of three parts:
      
      1. Flagging all .rodata sections when importing ELF information for
         easier checking later.
      
      2. Keeping a reference to the section each relocation is from in order
         to get the list_head for the other relocations in that section.
      
      3. Finding jump tables by following relocations to .rodata sections,
         rather than always referencing a single global .rodata section.
      
      The patch has been tested without data sections enabled and no
      differences in the resulting orc unwind information were seen.
      
      Note that as objtool adds terminators to end of each .text section the
      unwind information generated between a function+data sections build and
      a normal build aren't directly comparable. Manual inspection suggests
      that objtool is now generating the correct information, or at least
      making more of an effort to do so than it did previously.
      Signed-off-by: NAllan Xavier <allan.x.xavier@oracle.com>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/099bdc375195c490dda04db777ee0b95d566ded1.1536325914.git.jpoimboe@redhat.com
      4a60aa05
  21. 14 7月, 2018 1 次提交
  22. 02 7月, 2018 1 次提交
    • J
      objtool: Support GCC 8 '-fnoreorder-functions' · 08b393d0
      Josh Poimboeuf 提交于
      Since the following commit:
      
        cd77849a ("objtool: Fix GCC 8 cold subfunction detection for aliased functions")
      
      ... if the kernel is built with EXTRA_CFLAGS='-fno-reorder-functions',
      objtool can get stuck in an infinite loop.
      
      That flag causes the new GCC 8 cold subfunctions to be placed in .text
      instead of .text.unlikely.  But it also has an unfortunate quirk: in the
      symbol table, the subfunction (e.g., nmi_panic.cold.7) is nested inside
      the parent (nmi_panic).
      
      That function overlap confuses objtool, and causes it to get into an
      infinite loop in next_insn_same_func().  Here's Allan's description of
      the loop:
      
        "Objtool iterates through the instructions in nmi_panic using
        next_insn_same_func. Once it reaches the end of nmi_panic at 0x534 it
        jumps to 0x528 as that's the start of nmi_panic.cold.7. However, since
        the instructions starting at 0x528 are still associated with nmi_panic
        objtool will get stuck in a loop, continually jumping back to 0x528
        after reaching 0x534."
      
      Fix it by shortening the length of the parent function so that the
      functions no longer overlap.
      Reported-and-analyzed-by: NAllan Xavier <allan.x.xavier@oracle.com>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Allan Xavier <allan.x.xavier@oracle.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/9e704c52bee651129b036be14feda317ae5606ae.1530136978.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      08b393d0
  23. 14 5月, 2018 1 次提交
  24. 16 1月, 2018 1 次提交