2023-04-12 23:50:39

by Josh Poimboeuf

[permalink] [raw]
Subject: [PATCH v2 02/11] init: Mark start_kernel() __noreturn

Now that arch_call_rest_init() is __noreturn, mark its caller
start_kernel() __noreturn.

Signed-off-by: Josh Poimboeuf <[email protected]>
---
include/linux/start_kernel.h | 2 +-
init/main.c | 2 +-
tools/objtool/check.c | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/start_kernel.h b/include/linux/start_kernel.h
index 864921e54c92..a9806a44a605 100644
--- a/include/linux/start_kernel.h
+++ b/include/linux/start_kernel.h
@@ -8,7 +8,7 @@
/* Define the prototype for start_kernel here, rather than cluttering
up something else. */

-extern asmlinkage void __init start_kernel(void);
+extern asmlinkage void __init __noreturn start_kernel(void);
extern void __init __noreturn arch_call_rest_init(void);
extern void __ref __noreturn rest_init(void);

diff --git a/init/main.c b/init/main.c
index 161ed956d738..65aab4e9bb49 100644
--- a/init/main.c
+++ b/init/main.c
@@ -937,7 +937,7 @@ static void __init print_unknown_bootoptions(void)
memblock_free(unknown_options, len);
}

-asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
+asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(void)
{
char *command_line;
char *after_dashes;
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e7442e7ad676..a6f9a4aeb77b 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -222,6 +222,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
"rewind_stack_and_make_dead",
"sev_es_terminate",
"snp_abort",
+ "start_kernel",
"stop_this_cpu",
"usercopy_abort",
"xen_cpu_bringup_again",
--
2.39.2


Subject: [tip: objtool/core] init: Mark start_kernel() __noreturn

The following commit has been merged into the objtool/core branch of tip:

Commit-ID: 25a6917ca63ad4470bf88535c56f0dec72b570fe
Gitweb: https://git.kernel.org/tip/25a6917ca63ad4470bf88535c56f0dec72b570fe
Author: Josh Poimboeuf <[email protected]>
AuthorDate: Wed, 12 Apr 2023 16:49:32 -07:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Fri, 14 Apr 2023 17:31:23 +02:00

init: Mark start_kernel() __noreturn

Now that arch_call_rest_init() is __noreturn, mark its caller
start_kernel() __noreturn.

Signed-off-by: Josh Poimboeuf <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lore.kernel.org/r/7069acf026a195f26a88061227fba5a3b0337b9a.1681342859.git.jpoimboe@kernel.org
---
include/linux/start_kernel.h | 2 +-
init/main.c | 2 +-
tools/objtool/check.c | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/start_kernel.h b/include/linux/start_kernel.h
index 864921e..a9806a4 100644
--- a/include/linux/start_kernel.h
+++ b/include/linux/start_kernel.h
@@ -8,7 +8,7 @@
/* Define the prototype for start_kernel here, rather than cluttering
up something else. */

-extern asmlinkage void __init start_kernel(void);
+extern asmlinkage void __init __noreturn start_kernel(void);
extern void __init __noreturn arch_call_rest_init(void);
extern void __ref __noreturn rest_init(void);

diff --git a/init/main.c b/init/main.c
index 161ed95..65aab4e 100644
--- a/init/main.c
+++ b/init/main.c
@@ -937,7 +937,7 @@ static void __init print_unknown_bootoptions(void)
memblock_free(unknown_options, len);
}

-asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
+asmlinkage __visible void __init __no_sanitize_address __noreturn start_kernel(void)
{
char *command_line;
char *after_dashes;
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 3d7227f..9aaad9d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -222,6 +222,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
"rewind_stack_and_make_dead",
"sev_es_terminate",
"snp_abort",
+ "start_kernel",
"stop_this_cpu",
"usercopy_abort",
"xen_cpu_bringup_again",