lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240923141943.133551-8-vincenzo.frascino@arm.com>
Date: Mon, 23 Sep 2024 15:19:42 +0100
From: Vincenzo Frascino <vincenzo.frascino@....com>
To: linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org,
	linux-mm@...ck.org
Cc: Vincenzo Frascino <vincenzo.frascino@....com>,
	Andy Lutomirski <luto@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	"Jason A . Donenfeld" <Jason@...c4.com>,
	Christophe Leroy <christophe.leroy@...roup.eu>,
	Michael Ellerman <mpe@...erman.id.au>,
	Nicholas Piggin <npiggin@...il.com>,
	Naveen N Rao <naveen@...nel.org>,
	Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H . Peter Anvin" <hpa@...or.com>,
	Theodore Ts'o <tytso@....edu>,
	Arnd Bergmann <arnd@...db.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: [PATCH v2 7/8] vdso: Introduce uapi/vdso/random.h

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@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Jason A. Donenfeld <Jason@...c4.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@....com>
---
 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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ