From nobody Tue Nov 10 15:54:39 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jPB6l5Qc7z6yfsq for ; Tue, 10 Nov 2026 15:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jPB6l4s23z4WRJ for ; Tue, 10 Nov 2026 15:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794326079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=haBu87PSz9E+t+Q+5kCmVNHaDSSaZyFvN3wV0gKK7jM=; b=HeuiO1fZFVqgYvaOpQStkfySqTNtiPgb8rwYwGnHqLEslt1jHIIZV9IEFGP2RzNHL5mx9D 3hD1UfW7oFYR7EXjTw6gM105mY0J8g6VfDXdHAF0bu1qPklp/m0kprflelWA4mEanwNuYc sjUTrYHyl7PJ7uWLUIEUegU6XP5CjRFmhbFWT8NUKIevrSgh60X/q7F0qSNf0nxT7dMwW2 G4J/2yDCgFZR72KoWG02AF4C86xuWva0Sx3XYgwKbreyz8w6ng4jcky1RqRVCdhdo69i+a 9wH1j6qe9588dJNfuEROs87ayy11Qu5XTcBndPyvRIevGTKihcSR8GAD8FhjeQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794326079; b=dluyStBAB8EwX0N3a6YbsSGZKarJYXybxcOwqVi+SERO90ipo/bC6VEsPNYrQEUR1Q7Tcv IPXDvEOmeJboO7iaEH4mBYSzRogn5CjOHfMHsG7lya0JI+yWFldRS/UH0vzY/OIBh12i7n noxYJLYuSVfwqZ4mNZIz0PFtb4+MMbszcOS+cJtTCHjn0DjYwF8alVmkmFiuniAQcaqKqS wmYR2oWNRbLRK1OosEPidkdt3HmaFi5fplGr1shTZ9xb0WV8QserHQFvA9v++9gxRYKSfW UDGiljH3gxqC5ubKuOY71I344S1qOn1iG6MD5AozHrKv72CQQdvSFuw0J7hdcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794326079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=haBu87PSz9E+t+Q+5kCmVNHaDSSaZyFvN3wV0gKK7jM=; b=QfD8WzUBV79iLp6fj1uno6d4sDosIm96lGWq5C3YqDRldWNmHXPs52hsyh+9He4FvUa47C vur4HkJEb5jCgLb7+1zkaUvHlmkCShkuijIPswuchRBFQsOQh4OTl7HFV1EYvRRUEdwNHD LpaqTTSbST/b7mDw7eq/U3FZ88H1FXyPAG9qZFiHGPz20Cv8iKqP2OAOB/2ToTu5UVS83k 9qoUAzHKOgkq7VOoVFENyuv+aHFIW9Qkc1K0+QmVqPwKPC+aOCI1jeZU9Pg1JyOU8jGPJH Pcs0Wkk2vQLUZeRSLXhnjMDcsCwcukH995+jgV69wU/NIgblZbaureIC7Z2jNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jPB6l4WrrzbmY for ; Tue, 10 Nov 2026 15:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 97a4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 10 Nov 2026 15:54:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 698ba43e0ec7 - main - sig*(2): add kern_ and user_ implementations List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 698ba43e0ec7a3cb107a4b14be6f781965b1d3c4 Auto-Submitted: auto-generated Date: Tue, 10 Nov 2026 15:54:39 +0000 Message-Id: <6af33e3f.97a4.56f98786@gitrepo.freebsd.org> The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=698ba43e0ec7a3cb107a4b14be6f781965b1d3c4 commit 698ba43e0ec7a3cb107a4b14be6f781965b1d3c4 Author: Brooks Davis AuthorDate: 2025-11-24 15:33:34 +0000 Commit: Brooks Davis CommitDate: 2026-11-10 15:54:20 +0000 sig*(2): add kern_ and user_ implementations Effort: CHERI upstreaming Sponsored by: Innovate UK Pull Request: https://github.com/freebsd/freebsd-src/pull/2284 --- sys/kern/kern_sig.c | 92 ++++++++++++++++++++++++++++++++++++++++----------- sys/sys/signal.h | 4 +++ sys/sys/syscallsubr.h | 11 ++++++ 3 files changed, 87 insertions(+), 20 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 629ce1c3c40a..10ddc61ea184 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1194,21 +1194,28 @@ struct sigprocmask_args { #endif int sys_sigprocmask(struct thread *td, struct sigprocmask_args *uap) +{ + return (user_sigprocmask(td, uap->how, uap->set, uap->oset)); +} + +int +user_sigprocmask(struct thread *td, int how, const sigset_t *uset, + sigset_t *uoset) { sigset_t set, oset; sigset_t *setp, *osetp; int error; - setp = (uap->set != NULL) ? &set : NULL; - osetp = (uap->oset != NULL) ? &oset : NULL; + setp = (uset != NULL) ? &set : NULL; + osetp = (uoset != NULL) ? &oset : NULL; if (setp) { - error = copyin(uap->set, setp, sizeof(set)); + error = copyin(uset, setp, sizeof(set)); if (error) return (error); } - error = kern_sigprocmask(td, uap->how, setp, osetp, 0); + error = kern_sigprocmask(td, how, setp, osetp, 0); if (osetp && !error) { - error = copyout(osetp, uap->oset, sizeof(oset)); + error = copyout(osetp, uoset, sizeof(oset)); } return (error); } @@ -1235,12 +1242,18 @@ osigprocmask(struct thread *td, struct osigprocmask_args *uap) int sys_sigwait(struct thread *td, struct sigwait_args *uap) +{ + return (user_sigwait(td, uap->set, uap->sig)); +} + +int +user_sigwait(struct thread *td, const sigset_t *uset, int *usig) { ksiginfo_t ksi; sigset_t set; int error; - error = copyin(uap->set, &set, sizeof(set)); + error = copyin(uset, &set, sizeof(set)); if (error) { td->td_retval[0] = error; return (0); @@ -1261,13 +1274,27 @@ sys_sigwait(struct thread *td, struct sigwait_args *uap) return (0); } - error = copyout(&ksi.ksi_signo, uap->sig, sizeof(ksi.ksi_signo)); + error = copyout(&ksi.ksi_signo, usig, sizeof(ksi.ksi_signo)); td->td_retval[0] = error; return (0); } +static int +copyout_siginfo(const siginfo_t *si, void *info) +{ + return (copyout(si, info, sizeof(*si))); +} + int sys_sigtimedwait(struct thread *td, struct sigtimedwait_args *uap) +{ + return (user_sigtimedwait(td, uap->set, uap->info, uap->timeout, + copyout_siginfo)); +} + +int +user_sigtimedwait(struct thread *td, const sigset_t *uset, void *info, + const struct timespec *utimeout, copyout_siginfo_t *copyout_siginfop) { struct timespec ts; struct timespec *timeout; @@ -1275,8 +1302,8 @@ sys_sigtimedwait(struct thread *td, struct sigtimedwait_args *uap) ksiginfo_t ksi; int error; - if (uap->timeout) { - error = copyin(uap->timeout, &ts, sizeof(ts)); + if (utimeout) { + error = copyin(utimeout, &ts, sizeof(ts)); if (error) return (error); @@ -1284,7 +1311,7 @@ sys_sigtimedwait(struct thread *td, struct sigtimedwait_args *uap) } else timeout = NULL; - error = copyin(uap->set, &set, sizeof(set)); + error = copyin(uset, &set, sizeof(set)); if (error) return (error); @@ -1292,8 +1319,8 @@ sys_sigtimedwait(struct thread *td, struct sigtimedwait_args *uap) if (error) return (error); - if (uap->info) - error = copyout(&ksi.ksi_info, uap->info, sizeof(siginfo_t)); + if (info) + error = copyout_siginfop(&ksi.ksi_info, info); if (error == 0) td->td_retval[0] = ksi.ksi_signo; @@ -1302,12 +1329,19 @@ sys_sigtimedwait(struct thread *td, struct sigtimedwait_args *uap) int sys_sigwaitinfo(struct thread *td, struct sigwaitinfo_args *uap) +{ + return (user_sigwaitinfo(td, uap->set, uap->info, copyout_siginfo)); +} + +int +user_sigwaitinfo(struct thread *td, const sigset_t *uset, void *info, + copyout_siginfo_t *copyout_siginfop) { ksiginfo_t ksi; sigset_t set; int error; - error = copyin(uap->set, &set, sizeof(set)); + error = copyin(uset, &set, sizeof(set)); if (error) return (error); @@ -1315,8 +1349,8 @@ sys_sigwaitinfo(struct thread *td, struct sigwaitinfo_args *uap) if (error) return (error); - if (uap->info) - error = copyout(&ksi.ksi_info, uap->info, sizeof(siginfo_t)); + if (info) + error = copyout_siginfop(&ksi.ksi_info, info); if (error == 0) td->td_retval[0] = ksi.ksi_signo; @@ -1477,6 +1511,12 @@ struct sigpending_args { #endif int sys_sigpending(struct thread *td, struct sigpending_args *uap) +{ + return (kern_sigpending(td, uap->set)); +} + +int +kern_sigpending(struct thread *td, sigset_t *set) { struct proc *p = td->td_proc; sigset_t pending; @@ -1485,7 +1525,7 @@ sys_sigpending(struct thread *td, struct sigpending_args *uap) pending = p->p_sigqueue.sq_signals; SIGSETOR(pending, td->td_sigqueue.sq_signals); PROC_UNLOCK(p); - return (copyout(&pending, uap->set, sizeof(sigset_t))); + return (copyout(&pending, set, sizeof(sigset_t))); } #ifdef COMPAT_43 /* XXX - COMPAT_FBSD3 */ @@ -1599,11 +1639,17 @@ struct sigsuspend_args { /* ARGSUSED */ int sys_sigsuspend(struct thread *td, struct sigsuspend_args *uap) +{ + return (user_sigsuspend(td, uap->sigmask)); +} + +int +user_sigsuspend(struct thread *td, const sigset_t *sigmask) { sigset_t mask; int error; - error = copyin(uap->sigmask, &mask, sizeof(mask)); + error = copyin(sigmask, &mask, sizeof(mask)); if (error) return (error); return (kern_sigsuspend(td, mask)); @@ -3973,6 +4019,12 @@ sigfastblock_resched(struct thread *td, bool resched) int sys_sigfastblock(struct thread *td, struct sigfastblock_args *uap) +{ + return (kern_sigfastblock(td, uap->cmd, uap->ptr)); +} + +int +kern_sigfastblock(struct thread *td, int cmd, uint32_t *ptr) { struct proc *p; int error, res; @@ -3980,18 +4032,18 @@ sys_sigfastblock(struct thread *td, struct sigfastblock_args *uap) error = 0; p = td->td_proc; - switch (uap->cmd) { + switch (cmd) { case SIGFASTBLOCK_SETPTR: if ((td->td_pflags & TDP_SIGFASTBLOCK) != 0) { error = EBUSY; break; } - if (((uintptr_t)(uap->ptr) & (sizeof(uint32_t) - 1)) != 0) { + if (((uintptr_t)(ptr) & (sizeof(uint32_t) - 1)) != 0) { error = EINVAL; break; } td->td_pflags |= TDP_SIGFASTBLOCK; - td->td_sigblock_ptr = uap->ptr; + td->td_sigblock_ptr = ptr; break; case SIGFASTBLOCK_UNBLOCK: diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 792087f735a1..7f987969a847 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -246,6 +246,10 @@ typedef struct __siginfo { } _reason; } siginfo_t; +#ifdef _KERNEL +typedef int (copyout_siginfo_t)(const siginfo_t *si, void *info); +#endif + #define si_trapno _reason._fault._trapno #define si_timerid _reason._timer._timerid #define si_overrun _reason._timer._overrun diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 4ecdc70fd3ba..199c2039c7b3 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -467,6 +467,8 @@ int kern_shutdown(struct thread *td, int s, int how); int kern_sigaction(struct thread *td, int sig, const struct sigaction *act, struct sigaction *oact, int flags); int kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss); +int kern_sigfastblock(struct thread *td, int cmd, uint32_t *ptr); +int kern_sigpending(struct thread *td, sigset_t *set); int kern_sigprocmask(struct thread *td, int how, sigset_t *set, sigset_t *oset, int flags); int kern_sigsuspend(struct thread *td, sigset_t mask); @@ -538,6 +540,15 @@ int user_jail_set(struct thread *td, struct iovec *iovp, unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f); int user_kldload(struct thread *td, const char *file); int user_setgroups(struct thread *td, int gidsetsize, const gid_t *gidset); +int user_sigprocmask(struct thread *td, int how, const sigset_t *uset, + sigset_t *uoset); +int user_sigsuspend(struct thread *td, const sigset_t *sigmask); +int user_sigtimedwait(struct thread *td, const sigset_t *uset, void *info, + const struct timespec *utimeout, + copyout_siginfo_t *copyout_siginfop); +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_wait6(struct thread *td, enum idtype idtype, id_t id, int *statusp, int options, struct __wrusage *wrusage, siginfo_t *sip);