First bug: unblocking random fix:
```
# Block (D17047):
$ sudo sysctl debug.fail_point.random_fortuna_pre_read='return(1)'
debug.fail_point.random_fortuna_pre_read: off -> return(1)
$ sudo sysctl debug.fail_point.random_fortuna_seeded='return(1)'
debug.fail_point.random_fortuna_seeded: off -> return(1)
# Start minimal test program that used arc4random(3) and printed result:
$ [truss] ./blocked_random_poc
...
# Unblock:
$ sudo sysctl debug.fail_point.random_fortuna_pre_read='off'
debug.fail_point.random_fortuna_pre_read: return(1) -> off
$ sudo sysctl debug.fail_point.random_fortuna_seeded=off
debug.fail_point.random_fortuna_seeded: return(1) -> off
# Correct
...
abcdef12
(exit 0)
# Incorrect
...
getrandom(0x7fffffffd340,40,0) ERR#35 'Resource temporarily unavailable'
thr_self(0x7fffffffd310) = 0 (0x0)
thr_kill(100609,SIGKILL) = 0 (0x0)
SIGNAL 9 (SIGKILL) code=SI_NOINFO
```
Second similar bug pointed out by Xin Li can be reproduced quite easily once you know to look for it:
```
$ cat ../large_devrandom_poc.c
#include <sys/random.h>
...
static char buf[16*1024*1024 + 1]; // SIGCHK_PERIOD + 1
int
main(int argc, char **argv)
{
uint64_t t;
int rc;
rc = getrandom(buf, sizeof(buf), 0);
if (rc < 0)
printf("getrandom: err %d\n", errno);
else {
memcpy(&t, buf, sizeof(t));
printf("%lx\n", t);
}
return (0);
}
$ cc ...
$ ../large_devrandom_poc
getrandom: err 35
```