summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2014-12-26 02:46:52 +0000
committerRobert Mustacchi <rm@joyent.com>2015-02-15 00:36:58 +0000
commitf31c6fa33bcc9a608ce6f9ffd671ffc2b65a30ef (patch)
tree804c1aad78118d760e083f79a0f411894272488f /usr/src/uts/common/sys
parentd34c3434a6ead24ec3e41daebf60ff85376c9e47 (diff)
downloadillumos-joyent-f31c6fa33bcc9a608ce6f9ffd671ffc2b65a30ef.tar.gz
OS-3845 want arc4random(3C) suite
OS-3846 want getentropy(3C) OS-3847 want getrandom(2) OS-3848 want explicit_bzero(3C) OS-3843 want MC_INHERIT_ZERO OS-3844 uuid_generate can leak its cache in edge conditions Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
Diffstat (limited to 'usr/src/uts/common/sys')
-rw-r--r--usr/src/uts/common/sys/mman.h11
-rw-r--r--usr/src/uts/common/sys/random.h10
-rw-r--r--usr/src/uts/common/sys/syscall.h1
3 files changed, 20 insertions, 2 deletions
diff --git a/usr/src/uts/common/sys/mman.h b/usr/src/uts/common/sys/mman.h
index 8f4cd1639f..e9ac3a37cc 100644
--- a/usr/src/uts/common/sys/mman.h
+++ b/usr/src/uts/common/sys/mman.h
@@ -25,7 +25,7 @@
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2012 Joyent, Inc. All rights reserved.
+ * Copyright 2015 Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -303,7 +303,12 @@ struct memcntl_mha32 {
#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
#if (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) || defined(__EXTENSIONS__)
-/* advice to madvise */
+/*
+ * advice to madvise
+ *
+ * Note, if more than 4 bits worth of advice (eg. 16) are specified then
+ * changes will be necessary to the struct vpage.
+ */
#define MADV_NORMAL 0 /* no further special treatment */
#define MADV_RANDOM 1 /* expect random page references */
#define MADV_SEQUENTIAL 2 /* expect sequential page references */
@@ -313,6 +318,7 @@ struct memcntl_mha32 {
#define MADV_ACCESS_DEFAULT 6 /* default access */
#define MADV_ACCESS_LWP 7 /* next LWP to access heavily */
#define MADV_ACCESS_MANY 8 /* many processes to access heavily */
+
#endif /* (_POSIX_C_SOURCE <= 2) && !defined(_XPG4_2) ... */
#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
@@ -342,6 +348,7 @@ struct memcntl_mha32 {
#define MC_LOCKAS 5 /* lock address space in memory */
#define MC_UNLOCKAS 6 /* unlock address space from memory */
#define MC_HAT_ADVISE 7 /* advise hat map size */
+#define MC_INHERIT_ZERO 8 /* zero out regions on fork() */
/* sub-commands for MC_HAT_ADVISE */
#define MHA_MAPSIZE_VA 0x1 /* set preferred page size */
diff --git a/usr/src/uts/common/sys/random.h b/usr/src/uts/common/sys/random.h
index a38201456f..b835d2f5ac 100644
--- a/usr/src/uts/common/sys/random.h
+++ b/usr/src/uts/common/sys/random.h
@@ -24,6 +24,7 @@
*/
/*
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2015, Joyent, Inc.
*/
#ifndef _SYS_RANDOM_H
@@ -61,10 +62,19 @@ typedef struct swrand_stats {
extern int random_add_entropy(uint8_t *, size_t, uint_t);
extern int random_get_bytes(uint8_t *, size_t);
+extern int random_get_blocking_bytes(uint8_t *, size_t);
extern int random_get_pseudo_bytes(uint8_t *, size_t);
#endif /* _KERNEL */
+/*
+ * Flags for the getrandom system call. Note, we may want to move these
+ * definitions if we expose getrandom(2) into a public system call.
+ */
+#define GRND_NONBLOCK 0x0001 /* O_NONBLOCK equiv */
+#define GRND_RANDOM 0x0002 /* Use /dev/random, not /dev/urandom */
+extern int getrandom(void *, size_t, int);
+
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/uts/common/sys/syscall.h b/usr/src/uts/common/sys/syscall.h
index 5523f08552..7d86565564 100644
--- a/usr/src/uts/common/sys/syscall.h
+++ b/usr/src/uts/common/sys/syscall.h
@@ -296,6 +296,7 @@ extern "C" {
#define SYS_writev 122
#define SYS_preadv 123
#define SYS_pwritev 124
+#define SYS_getrandom 126
#define SYS_mmapobj 127
#define SYS_setrlimit 128
#define SYS_getrlimit 129