mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 21:35:07 +00:00
wireguard: selftests: use maximum cpu features and allow rng seeding
By forcing the maximum CPU that QEMU has available, we expose additional capabilities, such as the RNDR instruction, which increases test coverage. This then allows the CI to skip the fake seeding step in some cases. Also enable STRICT_KERNEL_RWX to catch issues related to early jump labels when the RNG is initialized at boot. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
e052a478a7
commit
17b0128a13
@ -64,8 +64,8 @@ QEMU_VPORT_RESULT := virtio-serial-device
|
||||
ifeq ($(HOST_ARCH),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm
|
||||
else
|
||||
QEMU_MACHINE := -cpu cortex-a53 -machine virt
|
||||
CFLAGS += -march=armv8-a -mtune=cortex-a53
|
||||
QEMU_MACHINE := -cpu max -machine virt
|
||||
CFLAGS += -march=armv8-a
|
||||
endif
|
||||
else ifeq ($(ARCH),aarch64_be)
|
||||
CHOST := aarch64_be-linux-musl
|
||||
@ -76,8 +76,8 @@ QEMU_VPORT_RESULT := virtio-serial-device
|
||||
ifeq ($(HOST_ARCH),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm
|
||||
else
|
||||
QEMU_MACHINE := -cpu cortex-a53 -machine virt
|
||||
CFLAGS += -march=armv8-a -mtune=cortex-a53
|
||||
QEMU_MACHINE := -cpu max -machine virt
|
||||
CFLAGS += -march=armv8-a
|
||||
endif
|
||||
else ifeq ($(ARCH),arm)
|
||||
CHOST := arm-linux-musleabi
|
||||
@ -88,8 +88,8 @@ QEMU_VPORT_RESULT := virtio-serial-device
|
||||
ifeq ($(HOST_ARCH),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm
|
||||
else
|
||||
QEMU_MACHINE := -cpu cortex-a15 -machine virt
|
||||
CFLAGS += -march=armv7-a -mtune=cortex-a15 -mabi=aapcs-linux
|
||||
QEMU_MACHINE := -cpu max -machine virt
|
||||
CFLAGS += -march=armv7-a -mabi=aapcs-linux
|
||||
endif
|
||||
else ifeq ($(ARCH),armeb)
|
||||
CHOST := armeb-linux-musleabi
|
||||
@ -100,8 +100,8 @@ QEMU_VPORT_RESULT := virtio-serial-device
|
||||
ifeq ($(HOST_ARCH),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host -machine virt,gic_version=host,accel=kvm
|
||||
else
|
||||
QEMU_MACHINE := -cpu cortex-a15 -machine virt
|
||||
CFLAGS += -march=armv7-a -mabi=aapcs-linux # We don't pass -mtune=cortex-a15 due to a compiler bug on big endian.
|
||||
QEMU_MACHINE := -cpu max -machine virt
|
||||
CFLAGS += -march=armv7-a -mabi=aapcs-linux
|
||||
LDFLAGS += -Wl,--be8
|
||||
endif
|
||||
else ifeq ($(ARCH),x86_64)
|
||||
@ -112,8 +112,7 @@ KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/x86/boot/bzImage
|
||||
ifeq ($(HOST_ARCH),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host -machine q35,accel=kvm
|
||||
else
|
||||
QEMU_MACHINE := -cpu Skylake-Server -machine q35
|
||||
CFLAGS += -march=skylake-avx512
|
||||
QEMU_MACHINE := -cpu max -machine q35
|
||||
endif
|
||||
else ifeq ($(ARCH),i686)
|
||||
CHOST := i686-linux-musl
|
||||
@ -123,8 +122,7 @@ KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/arch/x86/boot/bzImage
|
||||
ifeq ($(subst x86_64,i686,$(HOST_ARCH)),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host -machine q35,accel=kvm
|
||||
else
|
||||
QEMU_MACHINE := -cpu coreduo -machine q35
|
||||
CFLAGS += -march=prescott
|
||||
QEMU_MACHINE := -cpu max -machine q35
|
||||
endif
|
||||
else ifeq ($(ARCH),mips64)
|
||||
CHOST := mips64-linux-musl
|
||||
@ -182,7 +180,7 @@ KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux
|
||||
ifeq ($(HOST_ARCH),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host,accel=kvm -machine pseries
|
||||
else
|
||||
QEMU_MACHINE := -machine pseries
|
||||
QEMU_MACHINE := -machine pseries -device spapr-rng,rng=rng -object rng-random,id=rng
|
||||
endif
|
||||
else ifeq ($(ARCH),powerpc64le)
|
||||
CHOST := powerpc64le-linux-musl
|
||||
@ -192,7 +190,7 @@ KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux
|
||||
ifeq ($(HOST_ARCH),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host,accel=kvm -machine pseries
|
||||
else
|
||||
QEMU_MACHINE := -machine pseries
|
||||
QEMU_MACHINE := -machine pseries -device spapr-rng,rng=rng -object rng-random,id=rng
|
||||
endif
|
||||
else ifeq ($(ARCH),powerpc)
|
||||
CHOST := powerpc-linux-musl
|
||||
@ -247,7 +245,7 @@ QEMU_VPORT_RESULT := virtio-serial-ccw
|
||||
ifeq ($(HOST_ARCH),$(ARCH))
|
||||
QEMU_MACHINE := -cpu host,accel=kvm -machine s390-ccw-virtio -append $(KERNEL_CMDLINE)
|
||||
else
|
||||
QEMU_MACHINE := -machine s390-ccw-virtio -append $(KERNEL_CMDLINE)
|
||||
QEMU_MACHINE := -cpu max -machine s390-ccw-virtio -append $(KERNEL_CMDLINE)
|
||||
endif
|
||||
else
|
||||
$(error I only build: x86_64, i686, arm, armeb, aarch64, aarch64_be, mips, mipsel, mips64, mips64el, powerpc64, powerpc64le, powerpc, m68k, riscv64, riscv32, s390x)
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/sendfile.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/random.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
@ -58,6 +59,8 @@ static void seed_rng(void)
|
||||
{
|
||||
int bits = 256, fd;
|
||||
|
||||
if (!getrandom(NULL, 0, GRND_NONBLOCK))
|
||||
return;
|
||||
pretty_message("[+] Fake seeding RNG...");
|
||||
fd = open("/dev/random", O_WRONLY);
|
||||
if (fd < 0)
|
||||
|
@ -31,6 +31,7 @@ CONFIG_TTY=y
|
||||
CONFIG_BINFMT_ELF=y
|
||||
CONFIG_BINFMT_SCRIPT=y
|
||||
CONFIG_VDSO=y
|
||||
CONFIG_STRICT_KERNEL_RWX=y
|
||||
CONFIG_VIRTUALIZATION=y
|
||||
CONFIG_HYPERVISOR_GUEST=y
|
||||
CONFIG_PARAVIRT=y
|
||||
@ -65,6 +66,8 @@ CONFIG_PROC_FS=y
|
||||
CONFIG_PROC_SYSCTL=y
|
||||
CONFIG_SYSFS=y
|
||||
CONFIG_TMPFS=y
|
||||
CONFIG_RANDOM_TRUST_CPU=y
|
||||
CONFIG_RANDOM_TRUST_BOOTLOADER=y
|
||||
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15
|
||||
CONFIG_LOG_BUF_SHIFT=18
|
||||
CONFIG_PRINTK_TIME=y
|
||||
|
Loading…
x
Reference in New Issue
Block a user