Skip to content

Commit ce65652

Browse files
Peter Zijlstrasuryasaimadhu
authored andcommitted
x86/entry: Fixup objtool/ibt validation
Commit 47f33de ("x86/sev: Mark the code returning to user space as syscall gap") added a bunch of text references without annotating them, resulting in a spree of objtool complaints: vmlinux.o: warning: objtool: vc_switch_off_ist+0x77: relocation to !ENDBR: entry_SYSCALL_64+0x15c vmlinux.o: warning: objtool: vc_switch_off_ist+0x8f: relocation to !ENDBR: entry_SYSCALL_compat+0xa5 vmlinux.o: warning: objtool: vc_switch_off_ist+0x97: relocation to !ENDBR: .entry.text+0x21ea vmlinux.o: warning: objtool: vc_switch_off_ist+0xef: relocation to !ENDBR: .entry.text+0x162 vmlinux.o: warning: objtool: __sev_es_ist_enter+0x60: relocation to !ENDBR: entry_SYSCALL_64+0x15c vmlinux.o: warning: objtool: __sev_es_ist_enter+0x6c: relocation to !ENDBR: .entry.text+0x162 vmlinux.o: warning: objtool: __sev_es_ist_enter+0x8a: relocation to !ENDBR: entry_SYSCALL_compat+0xa5 vmlinux.o: warning: objtool: __sev_es_ist_enter+0xc1: relocation to !ENDBR: .entry.text+0x21ea Since these text references are used to compare against IP, and are not an indirect call target, they don't need ENDBR so annotate them away. Fixes: 47f33de ("x86/sev: Mark the code returning to user space as syscall gap") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20220520082604.GQ2578@worktop.programming.kicks-ass.net
1 parent 47f33de commit ce65652

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

arch/x86/entry/entry_64.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,12 @@ syscall_return_via_sysret:
216216
popq %rdi
217217
popq %rsp
218218
SYM_INNER_LABEL(entry_SYSRETQ_unsafe_stack, SYM_L_GLOBAL)
219+
ANNOTATE_NOENDBR
219220
swapgs
220221
sysretq
221222
SYM_INNER_LABEL(entry_SYSRETQ_end, SYM_L_GLOBAL)
223+
ANNOTATE_NOENDBR
224+
int3
222225
SYM_CODE_END(entry_SYSCALL_64)
223226

224227
/*

arch/x86/entry/entry_64_compat.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ sysret32_from_system_call:
298298
*/
299299
movq RSP-ORIG_RAX(%rsp), %rsp
300300
SYM_INNER_LABEL(entry_SYSRETL_compat_unsafe_stack, SYM_L_GLOBAL)
301+
ANNOTATE_NOENDBR
301302

302303
/*
303304
* The original userspace %rsp (RSP-ORIG_RAX(%rsp)) is stored
@@ -316,6 +317,8 @@ SYM_INNER_LABEL(entry_SYSRETL_compat_unsafe_stack, SYM_L_GLOBAL)
316317
swapgs
317318
sysretl
318319
SYM_INNER_LABEL(entry_SYSRETL_compat_end, SYM_L_GLOBAL)
320+
ANNOTATE_NOENDBR
321+
int3
319322
SYM_CODE_END(entry_SYSCALL_compat)
320323

321324
/*

0 commit comments

Comments
 (0)