freebsd-dev/sys/libkern
Mark Johnston 3d69515cfe arc4random: Avoid KMSAN false positives from pre-seeding results
If code calls arc4random(), and our RNG is not yet seeded and
random_bypass_before_seeding is true, we'll compute a key using the
SHA256 hash of some hopefully hard-to-predict data, including the
contents of an uninitialized stack buffer (which is also the output
buffer).

When KMSAN is enabled, this use of uninitialized state propagtes through
to the arc4random() output, resulting in false positives.  To address
this, lie to KMSAN and explicitly mark the buffer as initialized.

Reviewed by:	cem (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31510
2021-08-13 09:58:42 -04:00
..
arm Remove obsolete code gated on _ARM_ARCH_* 2021-01-28 10:41:45 +00:00
arm64 Use '.arch_extension crc' in the arm64 crc32 code 2021-05-06 07:42:35 +00:00
x86 Separate kernel crc32() implementation to its own header (gsb_crc32.h) and 2019-06-17 19:49:08 +00:00
arc4random_uniform.c libkern: Add arc4random_uniform 2020-05-23 17:51:06 +00:00
arc4random.c arc4random: Avoid KMSAN false positives from pre-seeding results 2021-08-13 09:58:42 -04:00
ashldi3.c
ashrdi3.c
asprintf.c
bcd.c
bcmp.c Use __builtin for various mem* and b* (e.g. bzero) routines. 2018-06-02 18:03:35 +00:00
bcopy.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
bsearch.c
cmpdi2.c
divdi3.c
explicit_bzero.c
ffs.c
ffsl.c
ffsll.c
fls.c
flsl.c
flsll.c
fnmatch.c
gsb_crc32.c Switch to an ifunc in the kernel for crc32c 2021-07-22 20:54:21 +00:00
iconv_converter_if.m
iconv_ucs.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
iconv_xlat16.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
iconv_xlat.c
iconv.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
inet_aton.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
inet_ntoa.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
inet_ntop.c
inet_pton.c Remove pre-FreeBSD 7.0 compatibility. 2019-07-19 18:38:47 +00:00
jenkins_hash.c
lshrdi3.c
memcchr.c
memchr.c
memcmp.c Use __builtin for various mem* and b* (e.g. bzero) routines. 2018-06-02 18:03:35 +00:00
memmem.c
memset.c Use __builtin for various mem* and b* (e.g. bzero) routines. 2018-06-02 18:03:35 +00:00
moddi3.c
murmur3_32.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
qdivrem.c
qsort_r.c
qsort.c
quad.h
random.c random(9): Restore historical [0,2^31-1] output range and related man 2021-03-24 16:14:58 +11:00
scanc.c
strcasecmp.c
strcasestr.c libkern/strcasestr.c: Drop xlocale support and connect to build. 2021-01-08 02:18:42 +03:00
strcat.c
strchr.c str(r)chr: Replace union abuse with __DECONST 2018-06-04 18:47:14 +00:00
strchrnul.c libkern: Implement strchrnul(3) 2019-08-19 22:53:05 +00:00
strcmp.c Port the NetBSD KCSAN runtime to FreeBSD. 2019-11-21 11:22:08 +00:00
strcpy.c Port the NetBSD KCSAN runtime to FreeBSD. 2019-11-21 11:22:08 +00:00
strcspn.c Remove incorrect __restricted labels from strcspn 2021-07-14 16:11:38 -06:00
strdup.c Add non-sleepable strdup variant strdup_flags 2019-02-20 20:48:10 +00:00
strlcat.c
strlcpy.c Sync strlcpy with userland version, again 2018-06-21 17:35:13 +00:00
strlen.c Restore the augmented strlen commentary 2021-02-08 19:15:21 +00:00
strncat.c
strncmp.c
strncpy.c
strndup.c
strnlen.c
strnstr.c Add missing libkern/strnstr.c file 2021-07-14 17:56:03 -07:00
strrchr.c str(r)chr: Replace union abuse with __DECONST 2018-06-04 18:47:14 +00:00
strsep.c
strspn.c
strstr.c
strtol.c
strtoq.c
strtoul.c
strtouq.c
strvalid.c
timingsafe_bcmp.c
ucmpdi2.c libkern: clean up empty lines in .c and .h files 2020-09-01 21:25:23 +00:00
udivdi3.c
umoddi3.c