Skip to content

Commit

Permalink
wireguard: selftests: set panic_on_warn=1 from cmdline
Browse files Browse the repository at this point in the history
Rather than setting this once init is running, set panic_on_warn from
the kernel command line, so that it catches splats from WireGuard
initialization code and the various crypto selftests.

Signed-off-by: Jason A. Donenfeld <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
zx2c4 authored and kuba-moo committed May 5, 2022
1 parent a6b8ea9 commit 3fc1b11
Show file tree
Hide file tree
Showing 18 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/aarch64.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1"
CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1 panic_on_warn=1"
CONFIG_FRAME_WARN=1280
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1"
CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1 panic_on_warn=1"
CONFIG_FRAME_WARN=1280
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/arm.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1"
CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1 panic_on_warn=1"
CONFIG_FRAME_WARN=1024
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/armeb.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1"
CONFIG_CMDLINE="console=ttyAMA0 wg.success=vport0p1 panic_on_warn=1"
CONFIG_CPU_BIG_ENDIAN=y
CONFIG_FRAME_WARN=1024
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/i686.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ CONFIG_ACPI=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1"
CONFIG_FRAME_WARN=1024
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/m68k.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ CONFIG_MAC=y
CONFIG_SERIAL_PMACZILOG=y
CONFIG_SERIAL_PMACZILOG_TTYS=y
CONFIG_SERIAL_PMACZILOG_CONSOLE=y
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1"
CONFIG_FRAME_WARN=1024
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/mips.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ CONFIG_POWER_RESET_SYSCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1"
CONFIG_FRAME_WARN=1024
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/mips64.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ CONFIG_POWER_RESET_SYSCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1"
CONFIG_FRAME_WARN=1280
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ CONFIG_POWER_RESET_SYSCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1"
CONFIG_FRAME_WARN=1280
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/mipsel.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ CONFIG_POWER_RESET_SYSCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1"
CONFIG_FRAME_WARN=1024
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/powerpc.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_MATH_EMULATION=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1"
CONFIG_FRAME_WARN=1024
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CONFIG_PPC_RADIX_MMU=y
CONFIG_HVC_CONSOLE=y
CONFIG_CPU_BIG_ENDIAN=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=hvc0 wg.success=hvc1"
CONFIG_CMDLINE="console=hvc0 wg.success=hvc1 panic_on_warn=1"
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
CONFIG_FRAME_WARN=1280
CONFIG_THREAD_SHIFT=14
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CONFIG_PPC_RADIX_MMU=y
CONFIG_HVC_CONSOLE=y
CONFIG_CPU_LITTLE_ENDIAN=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=hvc0 wg.success=hvc1"
CONFIG_CMDLINE="console=hvc0 wg.success=hvc1 panic_on_warn=1"
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
CONFIG_FRAME_WARN=1280
CONFIG_THREAD_SHIFT=14
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/riscv32.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_CMDLINE="console=ttyS0 wg.success=vport0p1"
CONFIG_CMDLINE="console=ttyS0 wg.success=vport0p1 panic_on_warn=1"
CONFIG_CMDLINE_FORCE=y
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/riscv64.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_CMDLINE="console=ttyS0 wg.success=vport0p1"
CONFIG_CMDLINE="console=ttyS0 wg.success=vport0p1 panic_on_warn=1"
CONFIG_CMDLINE_FORCE=y
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/s390x.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ CONFIG_SCLP_VT220_CONSOLE=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_S390_GUEST=y
CONFIG_CMDLINE="console=ttysclp0 wg.success=vport0p1"
CONFIG_CMDLINE="console=ttysclp0 wg.success=vport0p1 panic_on_warn=1"
2 changes: 1 addition & 1 deletion tools/testing/selftests/wireguard/qemu/arch/x86_64.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ CONFIG_ACPI=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1"
CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1 panic_on_warn=1"
CONFIG_FRAME_WARN=1280
6 changes: 0 additions & 6 deletions tools/testing/selftests/wireguard/qemu/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ static void enable_logging(void)
panic("write(exception-trace)");
close(fd);
}
fd = open("/proc/sys/kernel/panic_on_warn", O_WRONLY);
if (fd >= 0) {
if (write(fd, "1\n", 2) != 2)
panic("write(panic_on_warn)");
close(fd);
}
}

static void kmod_selftests(void)
Expand Down

0 comments on commit 3fc1b11

Please sign in to comment.