summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2007-05-19 04:53:14 +0000
committerkan <kan@FreeBSD.org>2007-05-19 04:53:14 +0000
commit3ef9d41401d2f9d9b32d2c476de4aee9b8049188 (patch)
treecdd8870b9c8f2a324e8212d4906223bc8c7df8a4 /sys
parent00c7c13171556c9188f645bba9fd6c8847797591 (diff)
downloadFreeBSD-src-3ef9d41401d2f9d9b32d2c476de4aee9b8049188.zip
FreeBSD-src-3ef9d41401d2f9d9b32d2c476de4aee9b8049188.tar.gz
Add kern.arnd sysctl. SSP code uses it to initialize the stack guard
magic value. Submitted by: Jeremie Le Hen <jeremie@le-hen.org>
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_mib.c12
-rw-r--r--sys/sys/sysctl.h3
2 files changed, 14 insertions, 1 deletions
diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c
index 707afd8..5d14529 100644
--- a/sys/kern/kern_mib.c
+++ b/sys/kern/kern_mib.c
@@ -152,6 +152,18 @@ SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
0, PAGE_SIZE, "System memory page size");
static int
+sysctl_kern_arnd(SYSCTL_HANDLER_ARGS)
+{
+ u_long val;
+
+ arc4rand(&val, sizeof(val), 0);
+ return (sysctl_handle_long(oidp, &val, 0, req));
+}
+
+SYSCTL_PROC(_kern, KERN_ARND, arandom, CTLFLAG_RD,
+ 0, 0, sysctl_kern_arnd, "L", "arc4rand");
+
+static int
sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
{
u_long val;
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index d56359b..87dad4e 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -390,7 +390,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
#define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */
#define KERN_HOSTUUID 36 /* string: host UUID identifier */
-#define KERN_MAXID 37 /* number of valid kern ids */
+#define KERN_ARND 37 /* int: from arc4rand() */
+#define KERN_MAXID 38 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
OpenPOWER on IntegriCloud