Skip to content

Commit 4d456f0

Browse files
xry111zx2c4
authored andcommitted
random: vDSO: add a __vdso_getrandom prototype for all architectures
Without a prototype, we'll have to add a prototype for each architecture implementing vDSO getrandom. As most architectures will likely have the vDSO getrandom implemented in a near future, and we'd like to keep the declarations compatible everywhere (to ease the libc implementor work), we should really just have one copy of the prototype. This also is what's already done inside of include/vdso/gettime.h for those vDSO functions, so this continues that convention. Suggested-by: Huacai Chen <[email protected]> Signed-off-by: Xi Ruoyao <[email protected]> Acked-by: Huacai Chen <[email protected]> [Jason: rewrite docbook comment for prototype.] Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 67a121a commit 4d456f0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

arch/x86/entry/vdso/vgetrandom.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
#include "../../../../lib/vdso/getrandom.c"
88

9-
ssize_t __vdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len);
10-
119
ssize_t __vdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len)
1210
{
1311
return __cvdso_getrandom(buffer, len, flags, opaque_state, opaque_len);

include/vdso/getrandom.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,19 @@ struct vgetrandom_state {
5656
*/
5757
extern void __arch_chacha20_blocks_nostack(u8 *dst_bytes, const u32 *key, u32 *counter, size_t nblocks);
5858

59+
/**
60+
* __vdso_getrandom - Architecture-specific vDSO implementation of getrandom() syscall.
61+
* @buffer: Passed to __cvdso_getrandom().
62+
* @len: Passed to __cvdso_getrandom().
63+
* @flags: Passed to __cvdso_getrandom().
64+
* @opaque_state: Passed to __cvdso_getrandom().
65+
* @opaque_len: Passed to __cvdso_getrandom();
66+
*
67+
* This function is implemented by making a single call to to __cvdso_getrandom(), whose
68+
* documentation may be consulted for more information.
69+
*
70+
* Returns: The return value of __cvdso_getrandom().
71+
*/
72+
extern ssize_t __vdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len);
73+
5974
#endif /* _VDSO_GETRANDOM_H */

0 commit comments

Comments
 (0)