Skip to content

Commit 00c8f01

Browse files
jpoimboeIngo Molnar
authored andcommitted
objtool: Fix ORC 'signal' propagation
There have been some recently reported ORC unwinder warnings like: WARNING: can't access registers at entry_SYSCALL_64_after_hwframe+0x63/0xcd WARNING: stack going in the wrong direction? at __sys_setsockopt+0x2c6/0x5b0 net/socket.c:2271 And a KASAN warning: BUG: KASAN: stack-out-of-bounds in unwind_next_frame (arch/x86/include/asm/ptrace.h:136 arch/x86/kernel/unwind_orc.c:455) It turns out the 'signal' bit isn't getting propagated from the unwind hints to the ORC entries, making the unwinder confused at times. Fixes: ffb1b4a ("x86/unwind/orc: Add 'signal' field to ORC metadata") Reported-by: kernel test robot <[email protected]> Reported-by: Dmitry Vyukov <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/97eef9db60cd86d376a9a40d49d77bb67a8f6526.1676579666.git.jpoimboe@kernel.org
1 parent 1c34496 commit 00c8f01

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

tools/objtool/check.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,7 @@ static int read_unwind_hints(struct objtool_file *file)
23302330

23312331
cfi.cfa.offset = bswap_if_needed(file->elf, hint->sp_offset);
23322332
cfi.type = hint->type;
2333+
cfi.signal = hint->signal;
23332334
cfi.end = hint->end;
23342335

23352336
insn->cfi = cfi_hash_find_or_add(&cfi);

tools/objtool/include/objtool/cfi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct cfi_state {
3434
unsigned char type;
3535
bool bp_scratch;
3636
bool drap;
37+
bool signal;
3738
bool end;
3839
};
3940

tools/objtool/orc_gen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static int init_orc_entry(struct orc_entry *orc, struct cfi_state *cfi,
2727
}
2828

2929
orc->end = cfi->end;
30+
orc->signal = cfi->signal;
3031

3132
if (cfi->cfa.base == CFI_UNDEFINED) {
3233
orc->sp_reg = ORC_REG_UNDEFINED;

0 commit comments

Comments
 (0)