* [PATCH] startup: don't fallback to shell from menu
@ 2024-11-25 15:39 Ahmad Fatoum
2024-11-29 12:03 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-11-25 15:39 UTC (permalink / raw)
To: barebox; +Cc: Christian Melki, Ahmad Fatoum
The code to determine whether to drop to shell or to run the menu is a
bit hard to follow and may even be used to circumvent the menu in some
circumstances.
Fix this by wrapping the menu in an infinite loop and refuse dropping to
shell.
Suggested-by: Christian Melki <christian.melki@t2data.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/startup.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/common/startup.c b/common/startup.c
index d71d83c221dc..4c497d95bedb 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -318,16 +318,17 @@ static int run_init(void)
if (IS_ENABLED(CONFIG_NET) && !IS_ENABLED(CONFIG_CONSOLE_DISABLE_INPUT))
eth_open_all();
- if (autoboot == AUTOBOOT_MENU)
+ if (autoboot != AUTOBOOT_MENU) {
+ if (autoboot == AUTOBOOT_ABORT && autoboot == global_autoboot_state)
+ watchdog_inhibit_all();
+
+ run_shell();
+ }
+
+ while (1)
run_command(MENUFILE);
- if (autoboot == AUTOBOOT_ABORT && autoboot == global_autoboot_state)
- watchdog_inhibit_all();
-
- run_shell();
- run_command(MENUFILE);
-
- return 0;
+ unreachable();
}
typedef void (*ctor_fn_t)(void);
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] startup: don't fallback to shell from menu
2024-11-25 15:39 [PATCH] startup: don't fallback to shell from menu Ahmad Fatoum
@ 2024-11-29 12:03 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-11-29 12:03 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Christian Melki
On Mon, 25 Nov 2024 16:39:15 +0100, Ahmad Fatoum wrote:
> The code to determine whether to drop to shell or to run the menu is a
> bit hard to follow and may even be used to circumvent the menu in some
> circumstances.
>
> Fix this by wrapping the menu in an infinite loop and refuse dropping to
> shell.
>
> [...]
Applied, thanks!
[1/1] startup: don't fallback to shell from menu
https://git.pengutronix.de/cgit/barebox/commit/?id=96852a962d0c (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-29 12:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-25 15:39 [PATCH] startup: don't fallback to shell from menu Ahmad Fatoum
2024-11-29 12:03 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox