twx-linux/tools/objtool
Josh Poimboeuf ae7e9d29a3 objtool: Fix INSN_CONTEXT_SWITCH handling in validate_unret()
[ Upstream commit a8df7d0ef92eca28c610206c6748daf537ac0586 ]

The !CONFIG_IA32_EMULATION version of xen_entry_SYSCALL_compat() ends
with a SYSCALL instruction which is classified by objtool as
INSN_CONTEXT_SWITCH.

Unlike validate_branch(), validate_unret() doesn't consider
INSN_CONTEXT_SWITCH in a non-function to be a dead end, so it keeps
going past the end of xen_entry_SYSCALL_compat(), resulting in the
following warning:

  vmlinux.o: warning: objtool: xen_reschedule_interrupt+0x2a: RET before UNTRAIN

Fix that by adding INSN_CONTEXT_SWITCH handling to validate_unret() to
match what validate_branch() is already doing.

Fixes: a09a6e2399ba ("objtool: Add entry UNRET validation")
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/f5eda46fd09f15b1f5cde3d9ae3b92b958342add.1744095216.git.jpoimboe@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-25 10:45:05 +02:00
..
arch x86/cpu: Rename original retbleed methods 2023-08-16 21:47:53 +02:00
Documentation objtool: Move noreturn function list to separate file 2023-05-16 06:31:55 -07:00
include/objtool objtool/x86: Fix SRSO mess 2023-08-16 09:39:16 +02:00
.gitignore
Build
builtin-check.c
check.c objtool: Fix INSN_CONTEXT_SWITCH handling in validate_unret() 2025-04-25 10:45:05 +02:00
elf.c objtool: initialize all of struct elf 2023-07-10 09:52:28 +02:00
Makefile
noreturns.h cred: get rid of CONFIG_DEBUG_CREDENTIALS 2023-12-20 17:01:51 +01:00
objtool.c objtool: Propagate early errors 2023-11-20 11:58:52 +01:00
orc_dump.c
orc_gen.c objtool: Add elf_create_section_pair() 2023-06-07 10:03:17 -07:00
special.c objtool: Get rid of reloc->addend 2023-06-07 10:03:23 -07:00
sync-check.sh
weak.c