[PATCH v2 7/8] vdso: Introduce uapi/vdso/random.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The VDSO implementation includes headers from outside of the
vdso/ namespace.

Introduce uapi/vdso/random.h to make sure that the generic
library uses only the allowed namespace.

Cc: Andy Lutomirski <luto@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Jason A. Donenfeld <Jason@xxxxxxxxx>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
---
 include/uapi/linux/random.h | 26 +------------------------
 include/uapi/vdso/random.h  | 38 +++++++++++++++++++++++++++++++++++++
 include/vdso/datapage.h     |  1 +
 3 files changed, 40 insertions(+), 25 deletions(-)
 create mode 100644 include/uapi/vdso/random.h

diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h
index 1dd047ec98a1..dc43ed800212 100644
--- a/include/uapi/linux/random.h
+++ b/include/uapi/linux/random.h
@@ -44,30 +44,6 @@ struct rand_pool_info {
 	__u32	buf[];
 };
 
-/*
- * Flags for getrandom(2)
- *
- * GRND_NONBLOCK	Don't block and return EAGAIN instead
- * GRND_RANDOM		No effect
- * GRND_INSECURE	Return non-cryptographic random bytes
- */
-#define GRND_NONBLOCK	0x0001
-#define GRND_RANDOM	0x0002
-#define GRND_INSECURE	0x0004
-
-/**
- * struct vgetrandom_opaque_params - arguments for allocating memory for vgetrandom
- *
- * @size_per_opaque_state:	Size of each state that is to be passed to vgetrandom().
- * @mmap_prot:			Value of the prot argument in mmap(2).
- * @mmap_flags:			Value of the flags argument in mmap(2).
- * @reserved:			Reserved for future use.
- */
-struct vgetrandom_opaque_params {
-	__u32 size_of_opaque_state;
-	__u32 mmap_prot;
-	__u32 mmap_flags;
-	__u32 reserved[13];
-};
+#include <vdso/random.h>
 
 #endif /* _UAPI_LINUX_RANDOM_H */
diff --git a/include/uapi/vdso/random.h b/include/uapi/vdso/random.h
new file mode 100644
index 000000000000..5c80995129c2
--- /dev/null
+++ b/include/uapi/vdso/random.h
@@ -0,0 +1,38 @@
+
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * include/vdso/random.h
+ *
+ * Include file for the random number generator.
+ */
+
+#ifndef _UAPI_VDSO_RANDOM_H
+#define _UAPI_VDSO_RANDOM_H
+
+/*
+ * Flags for getrandom(2)
+ *
+ * GRND_NONBLOCK	Don't block and return EAGAIN instead
+ * GRND_RANDOM		No effect
+ * GRND_INSECURE	Return non-cryptographic random bytes
+ */
+#define GRND_NONBLOCK	0x0001
+#define GRND_RANDOM	0x0002
+#define GRND_INSECURE	0x0004
+
+/**
+ * struct vgetrandom_opaque_params - arguments for allocating memory for vgetrandom
+ *
+ * @size_per_opaque_state:	Size of each state that is to be passed to vgetrandom().
+ * @mmap_prot:			Value of the prot argument in mmap(2).
+ * @mmap_flags:			Value of the flags argument in mmap(2).
+ * @reserved:			Reserved for future use.
+ */
+struct vgetrandom_opaque_params {
+	__u32 size_of_opaque_state;
+	__u32 mmap_prot;
+	__u32 mmap_flags;
+	__u32 reserved[13];
+};
+
+#endif /* _UAPI_VDSO_RANDOM_H */
diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index b85f24cac3f5..b7d6c71f20c1 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -8,6 +8,7 @@
 #include <uapi/linux/time.h>
 #include <uapi/linux/types.h>
 #include <uapi/asm-generic/errno-base.h>
+#include <uapi/vdso/random.h>
 
 #include <vdso/bits.h>
 #include <vdso/clocksource.h>
-- 
2.34.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux