Merge tag 'objtool-core-2021-04-28' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 28 Apr 2021 19:53:24 +0000 (12:53 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 28 Apr 2021 19:53:24 +0000 (12:53 -0700)
Pull objtool updates from Ingo Molnar:

 - Standardize the crypto asm code so that it looks like compiler-
   generated code to objtool - so that it can understand it. This
   enables unwinding from crypto asm code - and also fixes the last
   known remaining objtool warnings for LTO and more.

 - x86 decoder fixes: clean up and fix the decoder, and also extend it a
   bit

 - Misc fixes and cleanups

* tag 'objtool-core-2021-04-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
  x86/crypto: Enable objtool in crypto code
  x86/crypto/sha512-ssse3: Standardize stack alignment prologue
  x86/crypto/sha512-avx2: Standardize stack alignment prologue
  x86/crypto/sha512-avx: Standardize stack alignment prologue
  x86/crypto/sha256-avx2: Standardize stack alignment prologue
  x86/crypto/sha1_avx2: Standardize stack alignment prologue
  x86/crypto/sha_ni: Standardize stack alignment prologue
  x86/crypto/crc32c-pcl-intel: Standardize jump table
  x86/crypto/camellia-aesni-avx2: Unconditionally allocate stack buffer
  x86/crypto/aesni-intel_avx: Standardize stack alignment prologue
  x86/crypto/aesni-intel_avx: Fix register usage comments
  x86/crypto/aesni-intel_avx: Remove unused macros
  objtool: Support asm jump tables
  objtool: Parse options from OBJTOOL_ARGS
  objtool: Collate parse_options() users
  objtool: Add --backup
  objtool,x86: More ModRM sugar
  objtool,x86: Rewrite ADD/SUB/AND
  objtool,x86: Support %riz encodings
  objtool,x86: Simplify register decode
  ...

1  2 
tools/objtool/arch/x86/decode.c
tools/objtool/check.c
tools/objtool/include/objtool/arch.h
tools/objtool/objtool.c

  #include <objtool/elf.h>
  #include <objtool/arch.h>
  #include <objtool/warn.h>
 +#include <arch/elf.h>
  
- static unsigned char op_to_cfi_reg[][2] = {
-       {CFI_AX, CFI_R8},
-       {CFI_CX, CFI_R9},
-       {CFI_DX, CFI_R10},
-       {CFI_BX, CFI_R11},
-       {CFI_SP, CFI_R12},
-       {CFI_BP, CFI_R13},
-       {CFI_SI, CFI_R14},
-       {CFI_DI, CFI_R15},
- };
  static int is_x86_64(const struct elf *elf)
  {
        switch (elf->ehdr.e_machine) {
@@@ -94,12 -104,14 +108,14 @@@ int arch_decode_instruction(const struc
                            struct list_head *ops_list)
  {
        struct insn insn;
-       int x86_64, sign, ret;
-       unsigned char op1, op2, rex = 0, rex_b = 0, rex_r = 0, rex_w = 0,
-                     rex_x = 0, modrm = 0, modrm_mod = 0, modrm_rm = 0,
-                     modrm_reg = 0, sib = 0;
 -      int x86_64;
++      int x86_64, ret;
+       unsigned char op1, op2,
+                     rex = 0, rex_b = 0, rex_r = 0, rex_w = 0, rex_x = 0,
+                     modrm = 0, modrm_mod = 0, modrm_rm = 0, modrm_reg = 0,
+                     sib = 0, /* sib_scale = 0, */ sib_index = 0, sib_base = 0;
        struct stack_op *op = NULL;
        struct symbol *sym;
+       u64 imm;
  
        x86_64 = is_x86_64(elf);
        if (x86_64 == -1)
@@@ -2449,12 -2434,9 +2444,12 @@@ static int handle_insn_ops(struct instr
  
        list_for_each_entry(op, &insn->stack_ops, list) {
  
-               if (update_cfi_state(insn, &state->cfi, op))
+               if (update_cfi_state(insn, next_insn, &state->cfi, op))
                        return 1;
  
 +              if (!insn->alt_group)
 +                      continue;
 +
                if (op->dest.type == OP_DEST_PUSHF) {
                        if (!state->uaccess_stack) {
                                state->uaccess_stack = 1;
Simple merge
@@@ -59,9 -118,13 +118,14 @@@ struct objtool_file *objtool_open_read(
        if (!file.elf)
                return NULL;
  
+       if (backup && !objtool_create_backup(objname)) {
+               WARN("can't create backup file");
+               return NULL;
+       }
        INIT_LIST_HEAD(&file.insn_list);
        hash_init(file.insn_hash);
 +      INIT_LIST_HEAD(&file.retpoline_call_list);
        INIT_LIST_HEAD(&file.static_call_list);
        INIT_LIST_HEAD(&file.mcount_loc_list);
        file.c_file = !vmlinux && find_section_by_name(file.elf, ".comment");