Skip to content

Commit

Permalink
Add kern.arnd sysctl. SSP code uses it to initialize the stack guard
Browse files Browse the repository at this point in the history
magic value.

Submitted by: Jeremie Le Hen <jeremie@le-hen.org>
  • Loading branch information
akabaev committed May 19, 2007
1 parent 00c7c13 commit 3ef9d41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions sys/kern/kern_mib.c
Expand Up @@ -151,6 +151,18 @@ SYSCTL_INT(_hw, HW_BYTEORDER, byteorder, CTLFLAG_RD,
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)
{
Expand Down
3 changes: 2 additions & 1 deletion sys/sys/sysctl.h
Expand Up @@ -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 }, \
Expand Down

0 comments on commit 3ef9d41

Please sign in to comment.