Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Allow stack operations in UNWIND_HINT_UNDEFINED regions

If the code specified UNWIND_HINT_UNDEFINED, skip the "undefined stack
state" warning due to a stack operation. Just ignore the stack op and
continue to propagate the undefined state.

Link: https://lore.kernel.org/r/820c5b433f17c84e8761fb7465a8d319d706b1cf.1685981486.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+13
+12
tools/objtool/check.c
··· 33 33 static struct cfi_init_state initial_func_cfi; 34 34 static struct cfi_state init_cfi; 35 35 static struct cfi_state func_cfi; 36 + static struct cfi_state force_undefined_cfi; 36 37 37 38 struct instruction *find_insn(struct objtool_file *file, 38 39 struct section *sec, unsigned long offset) ··· 2241 2240 2242 2241 insn->hint = true; 2243 2242 2243 + if (hint->type == UNWIND_HINT_TYPE_UNDEFINED) { 2244 + insn->cfi = &force_undefined_cfi; 2245 + continue; 2246 + } 2247 + 2244 2248 if (hint->type == UNWIND_HINT_TYPE_SAVE) { 2245 2249 insn->hint = false; 2246 2250 insn->save = true; ··· 2798 2792 { 2799 2793 struct cfi_reg *cfa = &cfi->cfa; 2800 2794 struct cfi_reg *regs = cfi->regs; 2795 + 2796 + /* ignore UNWIND_HINT_UNDEFINED regions */ 2797 + if (cfi->force_undefined) 2798 + return 0; 2801 2799 2802 2800 /* stack operations don't make sense with an undefined CFA */ 2803 2801 if (cfa->base == CFI_UNDEFINED) { ··· 4617 4607 init_cfi_state(&init_cfi); 4618 4608 init_cfi_state(&func_cfi); 4619 4609 set_func_state(&func_cfi); 4610 + init_cfi_state(&force_undefined_cfi); 4611 + force_undefined_cfi.force_undefined = true; 4620 4612 4621 4613 if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3))) 4622 4614 goto out;
+1
tools/objtool/include/objtool/cfi.h
··· 36 36 bool drap; 37 37 bool signal; 38 38 bool end; 39 + bool force_undefined; 39 40 }; 40 41 41 42 #endif /* _OBJTOOL_CFI_H */