Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109963390
D17050.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D17050.diff
View Options
Index: head/lib/libc/gen/getentropy.c
===================================================================
--- head/lib/libc/gen/getentropy.c
+++ head/lib/libc/gen/getentropy.c
@@ -34,6 +34,7 @@
#include <sys/sysctl.h>
#include <errno.h>
+#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
@@ -44,6 +45,12 @@
extern int __sysctl(int *, u_int, void *, size_t *, void *, size_t);
+static inline void
+_getentropy_fail(void)
+{
+ raise(SIGKILL);
+}
+
static size_t
arnd_sysctl(u_char *buf, size_t size)
{
@@ -87,14 +94,14 @@
if (errno == EFAULT)
return (-1);
/*
- * This cannot happen. _arc4_sysctl() spins until the random
+ * This cannot happen. arnd_sysctl() spins until the random
* device is seeded and then repeatedly reads until the full
* request is satisfied. The only way for this to return a zero
* byte or short read is if sysctl(2) on the kern.arandom MIB
- * fails. In this case, exceping the user-provided-a-bogus-
+ * fails. In this case, excepting the user-provided-a-bogus-
* buffer EFAULT, give up (like for arc4random(3)'s arc4_stir).
*/
- abort();
+ _getentropy_fail();
}
return (0);
}
@@ -129,8 +136,10 @@
continue;
case EINTR:
continue;
- default:
+ case EFAULT:
return (-1);
+ default:
+ _getentropy_fail();
}
}
} else {
@@ -139,7 +148,7 @@
/* This cannot happen. */
if (rd == 0)
- abort();
+ _getentropy_fail();
buf = (char *)buf + rd;
buflen -= rd;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 12, 7:43 PM (19 h, 28 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16615321
Default Alt Text
D17050.diff (1 KB)
Attached To
Mode
D17050: getentropy(3): Trap non-API errnos from getrandom(2) and abort
Attached
Detach File
Event Timeline
Log In to Comment