]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
random(4) FenestrasX: Push root seed version to arc4random(3)
authorcem <cem@FreeBSD.org>
Sat, 10 Oct 2020 21:52:00 +0000 (21:52 +0000)
committercem <cem@FreeBSD.org>
Sat, 10 Oct 2020 21:52:00 +0000 (21:52 +0000)
commitf18df350f1aafb3b85e31975e341d2fd292c6cac
treef64dd0b028128986eb53dcd7230c8d63015e38f9
parent0c0ad482a09a0d7d0bed8d58994255081ce6e8d0
random(4) FenestrasX: Push root seed version to arc4random(3)

Push the root seed version to userspace through the VDSO page, if
the RANDOM_FENESTRASX algorithm is enabled.  Otherwise, there is no
functional change.  The mechanism can be disabled with
debug.fxrng_vdso_enable=0.

arc4random(3) obtains a pointer to the root seed version published by
the kernel in the shared page at allocation time.  Like arc4random(9),
it maintains its own per-process copy of the seed version corresponding
to the root seed version at the time it last rekeyed.  On read requests,
the process seed version is compared with the version published in the
shared page; if they do not match, arc4random(3) reseeds from the
kernel before providing generated output.

This change does not implement the FenestrasX concept of PCPU userspace
generators seeded from a per-process base generator.  That change is
left for future discussion/work.

Reviewed by: kib (previous version)
Approved by: csprng (me -- only touching FXRNG here)
Differential Revision: https://reviews.freebsd.org/D22839
21 files changed:
lib/libc/gen/arc4random.c
lib/libc/gen/arc4random.h
lib/libc/gen/auxv.c
sys/amd64/amd64/elf_machdep.c
sys/arm/arm/elf_machdep.c
sys/arm64/arm64/elf32_machdep.c
sys/arm64/arm64/elf_machdep.c
sys/compat/ia32/ia32_sysvec.c
sys/dev/random/fenestrasX/fx_brng.c
sys/dev/random/fenestrasX/fx_main.c
sys/i386/i386/elf_machdep.c
sys/kern/imgact_elf.c
sys/kern/kern_sharedpage.c
sys/mips/mips/elf_machdep.c
sys/mips/mips/freebsd32_machdep.c
sys/powerpc/powerpc/elf32_machdep.c
sys/powerpc/powerpc/elf64_machdep.c
sys/riscv/riscv/elf_machdep.c
sys/sys/elf_common.h
sys/sys/sysent.h
sys/sys/vdso.h