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: Move noreturn function list to separate file

This makes it a little cleaner and easier to maintain.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Link: https://lore.kernel.org/r/cecacf07a69a244c74474c18b7652627de67a528.1681853186.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

+50 -44
+2 -3
tools/objtool/Documentation/objtool.txt
··· 306 306 3. file.o: warning: objtool: foo+0x48c: bar() is missing a __noreturn annotation 307 307 308 308 The call from foo() to bar() doesn't return, but bar() is missing the 309 - __noreturn annotation. NOTE: In addition to adding the __noreturn 310 - annotation, the function name also needs to be added to 311 - 'global_noreturns' in tools/objtool/check.c. 309 + __noreturn annotation. NOTE: In addition to annotating the function 310 + with __noreturn, please also add it to tools/objtool/noreturns.h. 312 311 313 312 4. file.o: warning: objtool: func(): can't find starting instruction 314 313 or
+3 -41
tools/objtool/check.c
··· 192 192 struct instruction *insn; 193 193 bool empty = true; 194 194 195 - /* 196 - * Unfortunately these have to be hard coded because the noreturn 197 - * attribute isn't provided in ELF data. Keep 'em sorted. 198 - */ 195 + #define NORETURN(func) __stringify(func), 199 196 static const char * const global_noreturns[] = { 200 - "__invalid_creds", 201 - "__module_put_and_kthread_exit", 202 - "__reiserfs_panic", 203 - "__stack_chk_fail", 204 - "__ubsan_handle_builtin_unreachable", 205 - "arch_call_rest_init", 206 - "arch_cpu_idle_dead", 207 - "btrfs_assertfail", 208 - "cpu_bringup_and_idle", 209 - "cpu_startup_entry", 210 - "do_exit", 211 - "do_group_exit", 212 - "do_task_dead", 213 - "ex_handler_msr_mce", 214 - "fortify_panic", 215 - "hlt_play_dead", 216 - "hv_ghcb_terminate", 217 - "kthread_complete_and_exit", 218 - "kthread_exit", 219 - "kunit_try_catch_throw", 220 - "machine_real_restart", 221 - "make_task_dead", 222 - "mpt_halt_firmware", 223 - "nmi_panic_self_stop", 224 - "panic", 225 - "panic_smp_self_stop", 226 - "rest_init", 227 - "rewind_stack_and_make_dead", 228 - "sev_es_terminate", 229 - "snp_abort", 230 - "start_kernel", 231 - "stop_this_cpu", 232 - "usercopy_abort", 233 - "x86_64_start_kernel", 234 - "x86_64_start_reservations", 235 - "xen_cpu_bringup_again", 236 - "xen_start_kernel", 197 + #include "noreturns.h" 237 198 }; 199 + #undef NORETURN 238 200 239 201 if (!func) 240 202 return false;
+45
tools/objtool/noreturns.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + /* 4 + * This is a (sorted!) list of all known __noreturn functions in the kernel. 5 + * It's needed for objtool to properly reverse-engineer the control flow graph. 6 + * 7 + * Yes, this is unfortunate. A better solution is in the works. 8 + */ 9 + NORETURN(__invalid_creds) 10 + NORETURN(__module_put_and_kthread_exit) 11 + NORETURN(__reiserfs_panic) 12 + NORETURN(__stack_chk_fail) 13 + NORETURN(__ubsan_handle_builtin_unreachable) 14 + NORETURN(arch_call_rest_init) 15 + NORETURN(arch_cpu_idle_dead) 16 + NORETURN(btrfs_assertfail) 17 + NORETURN(cpu_bringup_and_idle) 18 + NORETURN(cpu_startup_entry) 19 + NORETURN(do_exit) 20 + NORETURN(do_group_exit) 21 + NORETURN(do_task_dead) 22 + NORETURN(ex_handler_msr_mce) 23 + NORETURN(fortify_panic) 24 + NORETURN(hlt_play_dead) 25 + NORETURN(hv_ghcb_terminate) 26 + NORETURN(kthread_complete_and_exit) 27 + NORETURN(kthread_exit) 28 + NORETURN(kunit_try_catch_throw) 29 + NORETURN(machine_real_restart) 30 + NORETURN(make_task_dead) 31 + NORETURN(mpt_halt_firmware) 32 + NORETURN(nmi_panic_self_stop) 33 + NORETURN(panic) 34 + NORETURN(panic_smp_self_stop) 35 + NORETURN(rest_init) 36 + NORETURN(rewind_stack_and_make_dead) 37 + NORETURN(sev_es_terminate) 38 + NORETURN(snp_abort) 39 + NORETURN(start_kernel) 40 + NORETURN(stop_this_cpu) 41 + NORETURN(usercopy_abort) 42 + NORETURN(x86_64_start_kernel) 43 + NORETURN(x86_64_start_reservations) 44 + NORETURN(xen_cpu_bringup_again) 45 + NORETURN(xen_start_kernel)