diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-02 02:11:52 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-02 02:45:53 +0200 |
commit | dbd1fe39f92e9b8f2ba2c6cf34c6850c4d2ea4b2 (patch) | |
tree | 4293fbdbbbf3b963c4e966756feb95af5beb5104 /src/tests/qemu/init.c | |
parent | messages: reduce maximum staged packets per peer (diff) | |
download | wireguard-monolithic-historical-dbd1fe39f92e9b8f2ba2c6cf34c6850c4d2ea4b2.tar.xz wireguard-monolithic-historical-dbd1fe39f92e9b8f2ba2c6cf34c6850c4d2ea4b2.zip |
qemu: add watchdog for not hanging on oops
Diffstat (limited to 'src/tests/qemu/init.c')
-rw-r--r-- | src/tests/qemu/init.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/tests/qemu/init.c b/src/tests/qemu/init.c index ea578c1..130fd0e 100644 --- a/src/tests/qemu/init.c +++ b/src/tests/qemu/init.c @@ -20,7 +20,7 @@ #include <linux/random.h> #include <linux/version.h> - __attribute__((noreturn)) static void poweroff(void) +__attribute__((noreturn)) static void poweroff(void) { fflush(stdout); fflush(stderr); @@ -112,6 +112,26 @@ static void enable_logging(void) close(fd); } +static void watchdog(void) +{ + pretty_message("[+] Enabling watchdog timer..."); + + ioperm(0x443, 1, 1); + outb(14, 0x443); + + if (fork()) + return; + + setpriority(PRIO_PROCESS, 0, -20); + + for (;;) { + outb(14, 0x443); + sleep(1); + } + + _exit(0); +} + static void kmod_selftests(void) { FILE *file; @@ -191,6 +211,7 @@ int main(int argc, char *argv[]) if (uname(&utsname) < 0) panic("uname"); print_banner(&utsname); + watchdog(); mount_filesystems(); kmod_selftests(); if (!linux_4_8_or_higher(&utsname)) |