Skip to content

Commit dda520d

Browse files
zx2c4richardweinberger
authored andcommitted
um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups
QEMU has a -no-reboot option, which halts instead of reboots when the guest asks to reboot. This is invaluable when used with CONFIG_PANIC_TIMEOUT=-1 (and panic_on_warn), because it allows panics and warnings to be caught immediately in CI. Implement this in UML too, by way of a basic setup param. Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 7ac73fb commit dda520d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

arch/um/os-Linux/skas/process.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <stdlib.h>
8+
#include <stdbool.h>
89
#include <unistd.h>
910
#include <sched.h>
1011
#include <errno.h>
@@ -707,10 +708,24 @@ void halt_skas(void)
707708
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT);
708709
}
709710

711+
static bool noreboot;
712+
713+
static int __init noreboot_cmd_param(char *str, int *add)
714+
{
715+
noreboot = true;
716+
return 0;
717+
}
718+
719+
__uml_setup("noreboot", noreboot_cmd_param,
720+
"noreboot\n"
721+
" Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n"
722+
" This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n"
723+
" crashes in CI\n");
724+
710725
void reboot_skas(void)
711726
{
712727
block_signals_trace();
713-
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT);
728+
UML_LONGJMP(&initial_jmpbuf, noreboot ? INIT_JMP_HALT : INIT_JMP_REBOOT);
714729
}
715730

716731
void __switch_mm(struct mm_id *mm_idp)

0 commit comments

Comments
 (0)