git: 3d101bbff45e - main - uuidgen(2): add user_ implementation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Nov 2026 15:54:43 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=3d101bbff45e53999418496807a51ee5da39d4f6
commit 3d101bbff45e53999418496807a51ee5da39d4f6
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-11-24 16:02:36 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-10 15:54:20 +0000
uuidgen(2): add user_ implementation
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Pull Request: https://github.com/freebsd/freebsd-src/pull/2284
---
sys/kern/kern_uuid.c | 13 +++++++++----
sys/sys/syscallsubr.h | 2 ++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/sys/kern/kern_uuid.c b/sys/kern/kern_uuid.c
index 136242ca2087..1eab13c23b9a 100644
--- a/sys/kern/kern_uuid.c
+++ b/sys/kern/kern_uuid.c
@@ -34,6 +34,7 @@
#include <sys/mutex.h>
#include <sys/sbuf.h>
#include <sys/socket.h>
+#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/systm.h>
#include <sys/jail.h>
@@ -175,9 +176,14 @@ struct uuidgen_args {
#endif
int
sys_uuidgen(struct thread *td, struct uuidgen_args *uap)
+{
+ return (user_uuidgen(td, uap->store, uap->count));
+}
+
+int
+user_uuidgen(struct thread *td, struct uuid *ustore, int count)
{
struct uuid *store;
- size_t count;
int error;
/*
@@ -186,13 +192,12 @@ sys_uuidgen(struct thread *td, struct uuidgen_args *uap)
* like to have some sort of upper-bound that's less than 2G :-)
* XXX probably needs to be tunable.
*/
- if (uap->count < 1 || uap->count > UUIDGEN_BATCH_MAX)
+ if (count < 1 || count > UUIDGEN_BATCH_MAX)
return (EINVAL);
- count = uap->count;
store = malloc(count * sizeof(struct uuid), M_TEMP, M_WAITOK);
kern_uuidgen(store, count);
- error = copyout(store, uap->store, count * sizeof(struct uuid));
+ error = copyout(store, ustore, count * sizeof(struct uuid));
free(store, M_TEMP);
return (error);
}
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 200ed205557c..4b9000c6d39a 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -71,6 +71,7 @@ struct stat;
struct thr_param;
struct timex;
struct uio;
+struct uuid;
struct vm_map;
struct vmspace;
@@ -560,6 +561,7 @@ int user_sigtimedwait(struct thread *td, const sigset_t *uset, void *info,
int user_sigwait(struct thread *td, const sigset_t *uset, int *usig);
int user_sigwaitinfo(struct thread *td, const sigset_t *uset, void *info,
copyout_siginfo_t *copyout_siginfop);
+int user_uuidgen(struct thread *td, struct uuid *ustore, int count);
int user_wait6(struct thread *td, enum idtype idtype, id_t id,
int *statusp, int options, struct __wrusage *wrusage,
siginfo_t *sip);