17 Dec, 2020

1 commit

  • Add the --mcount option for generating __mcount_loc sections
    needed for dynamic ftrace. Using this pass requires the kernel to
    be compiled with -mfentry and CC_USING_NOP_MCOUNT to be defined
    in Makefile.

    Bug: 145210207
    Change-Id: I34eeeb00c184bf265391549094fc15525536886b
    Link: https://lore.kernel.org/lkml/20200625200235.GQ4781@hirez.programming.kicks-ass.net/
    Signed-off-by: Peter Zijlstra
    [Sami: rebased, dropped config changes, fixed to actually use --mcount,
    and wrote a commit message.]
    Signed-off-by: Sami Tolvanen
    Reviewed-by: Kees Cook

    Peter Zijlstra
     

10 Sep, 2020

1 commit

  • Some alternatives associated with a specific feature need to be treated
    in a special way. Since the features and how to treat them vary from one
    architecture to another, move the special case handling to arch specific
    code.

    Reviewed-by: Miroslav Benes
    Signed-off-by: Julien Thierry
    Signed-off-by: Josh Poimboeuf

    Julien Thierry
     

02 Sep, 2020

2 commits

  • Now that the objtool_file can be obtained outside of the check function,
    orc generation builtin no longer requires check to explicitly call its
    orc related functions.

    Signed-off-by: Julien Thierry
    Reviewed-by: Miroslav Benes
    Signed-off-by: Josh Poimboeuf

    Julien Thierry
     
  • Structure objtool_file can be used by different subcommands. In fact
    it already is, by check and orc.

    Provide a function that allows to initialize objtool_file, that builtin
    can call, without relying on check to do the correct setup for them and
    explicitly hand the objtool_file to them.

    Reviewed-by: Miroslav Benes
    Signed-off-by: Julien Thierry
    Signed-off-by: Josh Poimboeuf

    Julien Thierry
     

01 Sep, 2020

1 commit

  • Add the inline static call implementation for x86-64. The generated code
    is identical to the out-of-line case, except we move the trampoline into
    it's own section.

    Objtool uses the trampoline naming convention to detect all the call
    sites. It then annotates those call sites in the .static_call_sites
    section.

    During boot (and module init), the call sites are patched to call
    directly into the destination function. The temporary trampoline is
    then no longer used.

    [peterz: merged trampolines, put trampoline in section]

    Signed-off-by: Josh Poimboeuf
    Signed-off-by: Peter Zijlstra (Intel)
    Signed-off-by: Ingo Molnar
    Cc: Linus Torvalds
    Link: https://lore.kernel.org/r/20200818135804.864271425@infradead.org

    Josh Poimboeuf
     

20 May, 2020

2 commits

  • Objtool currently only compiles for x86 architectures. This is
    fine as it presently does not support tooling for other
    architectures. However, we would like to be able to convert other
    kernel tools to run as objtool sub commands because they too
    process ELF object files. This will allow us to convert tools
    such as recordmcount to use objtool's ELF code.

    Since much of recordmcount's ELF code is copy-paste code to/from
    a variety of other kernel tools (look at modpost for example) this
    means that if we can convert recordmcount we can convert more.

    We define weak definitions for subcommand entry functions and other weak
    definitions for shared functions critical to building existing
    subcommands. These return 127 when the command is missing which signify
    tools that do not exist on all architectures. In this case the "check"
    and "orc" tools do not exist on all architectures so we only add them
    for x86. Future changes adding support for "check", to arm64 for
    example, can then modify the SUBCMD_CHECK variable when building for
    arm64.

    Objtool is not currently wired in to KConfig to be built for other
    architectures because it's not needed for those architectures and
    there are no commands it supports other than those for x86. As more
    command support is enabled on various architectures the necessary
    KConfig changes can be made (e.g. adding "STACK_VALIDATION") to
    trigger building objtool.

    [ jpoimboe: remove aliases, add __weak macro, add error messages ]

    Cc: Julien Thierry
    Signed-off-by: Matt Helsley
    Signed-off-by: Josh Poimboeuf

    Matt Helsley
     
  • The objtool_file structure describes the files objtool works on,
    is used by the check subcommand, and the check.h header is included
    by the orc subcommands so it's presently used by all subcommands.

    Since the structure will be useful in all subcommands besides check,
    and some subcommands may not want to include check.h to get the
    definition, split the structure out into a new header meant for use
    by all objtool subcommands.

    Signed-off-by: Matt Helsley
    Reviewed-by: Julien Thierry
    Signed-off-by: Josh Poimboeuf

    Matt Helsley