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.

x86/sev: Mark snp_abort() noreturn

Mark both the function prototype and definition as noreturn in order to
prevent the compiler from doing transformations which confuse objtool
like so:

vmlinux.o: warning: objtool: sme_enable+0x71: unreachable instruction

This triggers with gcc-12.

Add it and sev_es_terminate() to the objtool noreturn tracking array
too. Sort it while at it.

Suggested-by: Michael Matz <matz@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220824152420.20547-1-bp@alien8.de

+25 -23
+1 -1
arch/x86/include/asm/sev.h
··· 195 195 void snp_set_memory_private(unsigned long vaddr, unsigned int npages); 196 196 void snp_set_wakeup_secondary_cpu(void); 197 197 bool snp_init(struct boot_params *bp); 198 - void snp_abort(void); 198 + void __init __noreturn snp_abort(void); 199 199 int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned long *fw_err); 200 200 #else 201 201 static inline void sev_es_ist_enter(struct pt_regs *regs) { }
+1 -1
arch/x86/kernel/sev.c
··· 2112 2112 return true; 2113 2113 } 2114 2114 2115 - void __init snp_abort(void) 2115 + void __init __noreturn snp_abort(void) 2116 2116 { 2117 2117 sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED); 2118 2118 }
+23 -21
tools/objtool/check.c
··· 162 162 163 163 /* 164 164 * Unfortunately these have to be hard coded because the noreturn 165 - * attribute isn't provided in ELF data. 165 + * attribute isn't provided in ELF data. Keep 'em sorted. 166 166 */ 167 167 static const char * const global_noreturns[] = { 168 - "__stack_chk_fail", 169 - "panic", 170 - "do_exit", 171 - "do_task_dead", 172 - "kthread_exit", 173 - "make_task_dead", 174 - "__module_put_and_kthread_exit", 175 - "kthread_complete_and_exit", 176 - "__reiserfs_panic", 177 - "lbug_with_loc", 178 - "fortify_panic", 179 - "usercopy_abort", 180 - "machine_real_restart", 181 - "rewind_stack_and_make_dead", 182 - "kunit_try_catch_throw", 183 - "xen_start_kernel", 184 - "cpu_bringup_and_idle", 185 - "do_group_exit", 186 - "stop_this_cpu", 187 168 "__invalid_creds", 188 - "cpu_startup_entry", 169 + "__module_put_and_kthread_exit", 170 + "__reiserfs_panic", 171 + "__stack_chk_fail", 189 172 "__ubsan_handle_builtin_unreachable", 173 + "cpu_bringup_and_idle", 174 + "cpu_startup_entry", 175 + "do_exit", 176 + "do_group_exit", 177 + "do_task_dead", 190 178 "ex_handler_msr_mce", 179 + "fortify_panic", 180 + "kthread_complete_and_exit", 181 + "kthread_exit", 182 + "kunit_try_catch_throw", 183 + "lbug_with_loc", 184 + "machine_real_restart", 185 + "make_task_dead", 186 + "panic", 187 + "rewind_stack_and_make_dead", 188 + "sev_es_terminate", 189 + "snp_abort", 190 + "stop_this_cpu", 191 + "usercopy_abort", 192 + "xen_start_kernel", 191 193 }; 192 194 193 195 if (!func)