From nobody Thu Nov 12 11:01:56 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 4jQHX502L8z70R3h for ; Thu, 12 Nov 2026 11:01:57 +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 4jQHX41Ggjz4M84 for ; Thu, 12 Nov 2026 11:01:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794481316; 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=rKwveJvVfPkA3TRgCuMSyGOPZ2A87ogvFV9GX4IT/l0=; b=F/Cu6t/XuVSbdF94b6Y2h8871eXtNE8jqOvR1M3brtsPDy0MueBw46dVfrTlz2lU3qVVuH egWhfkIgzx8yfHo85SRevK4Dl3y8ZYHO2yCh7VGsCyC8tbs+P9/+cWq5h73MdmAJwLINfo ESlfLr7SxsIxqUjhOfA8bOTJOQCGWfirWrV/j+wJxDhnD7Vjd2eBSMtk7QFqfk08n5jJnY gF1ouI4HcpwlzCWp6s0Z7Sruqgd41zoIFWKew8Q59tEF5ByyotCwtrQp/vy/UWB4XtvJza PlX/Km/++ATcchE2KR0hfiEiEkR2sQdbzEYCpEtYa4ZgMYM6G8w/vBTve4xDLw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794481316; b=q+keVBS+5//35B2avQstzf9v2w0iRAMPtC31ZQmc7YVhha+m4Am3mFGAwJtOwcq1hfxQJu qtKTvj4+2amU3Ip+XMtvI3l40CfEipf+6ie0b+aBC7M4/STtjdGJQYSJCDgMeiEtNWHQee JCBGi2IipQzZVkLyGlMbLwJ9xFmIHbBam3zyFI9UU7jESY4ZDKOb5uvIhAwnq2yqLtE8E0 VKImrdE1ONRbkdITi4LJWxXajmrw7sMjg+yft7N3pYZYiEuBELEptjgpjqTaeY6kBCk++G jq/V+KNrEsQRf9dGUUPV73fAt9x5sVGbPyqnn9EDRBsoTXnHolfY4lbmHdt+IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794481316; 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=rKwveJvVfPkA3TRgCuMSyGOPZ2A87ogvFV9GX4IT/l0=; b=kfHudN1phqbEgR8THXtz3Q/6dp2Qx5VLIfG0lTDMbQHXUZriKXaGN+EEIWF3DT0rZ3BDep eE1beoexcsgWoawOrN/9+Uc7zSd0NrpiVrCWRhKScgycrGa60fdYUVAPlImrRb7xYd5/uA 4611A7/z6ABgDTbrhJfIDwYjsLyFQ2jkf5PfH2HyPRnrhrvGb0/qIs9STf0CvGdXPKymAx PYNyNvff0wSCvWPczxCsioT8BPULlgbd7/raV2a/jOeGkCHOJlCutBIPTF9u7qCA9BW7en 5hoeP1DsVT7yo4AjyldcAJ4Z8rHWAc7exd1VDUUABJSZ5YX7rxDhgLCxrDw8CA== 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 4jQHX40xbjz10Zc for ; Thu, 12 Nov 2026 11:01:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 435 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 12 Nov 2026 11:01:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: d60162816083 - main - freebsd14_[gs]groups: 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: d60162816083c0dc54c1c6655bceb5f0257e40a7 Auto-Submitted: auto-generated Date: Thu, 12 Nov 2026 11:01:56 +0000 Message-Id: <6af59ca4.435.1df18dc7@gitrepo.freebsd.org> The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=d60162816083c0dc54c1c6655bceb5f0257e40a7 commit d60162816083c0dc54c1c6655bceb5f0257e40a7 Author: Brooks Davis AuthorDate: 2026-11-12 11:01:30 +0000 Commit: Brooks Davis CommitDate: 2026-11-12 11:01:30 +0000 freebsd14_[gs]groups: add kern_ and user_ implementations Effort: CHERI upstreaming Sponsored by: DARPA, AFRL Pull Request: https://github.com/freebsd/freebsd-src/pull/2284 --- sys/kern/kern_prot.c | 27 ++++++++++++++++++++------- sys/sys/syscallsubr.h | 4 ++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 58fef9769fca..8f4dc4f5ebdf 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -317,6 +317,12 @@ sys_getegid(struct thread *td, struct getegid_args *uap) #ifdef COMPAT_FREEBSD14 int freebsd14_getgroups(struct thread *td, struct freebsd14_getgroups_args *uap) +{ + return (kern_freebsd14_getgroups(td, uap->gidsetsize, uap->gidset)); +} + +int +kern_freebsd14_getgroups(struct thread *td, int gidsetsize, gid_t *gidset) { struct ucred *cred; int ngrp, error; @@ -328,16 +334,16 @@ freebsd14_getgroups(struct thread *td, struct freebsd14_getgroups_args *uap) * beginning of the group list prior to all supplementary groups. */ ngrp = cred->cr_ngroups + 1; - if (uap->gidsetsize == 0) { + if (gidsetsize == 0) { error = 0; goto out; - } else if (uap->gidsetsize < ngrp) { + } else if (gidsetsize < ngrp) { return (EINVAL); } - error = copyout(&cred->cr_gid, uap->gidset, sizeof(gid_t)); + error = copyout(&cred->cr_gid, gidset, sizeof(gid_t)); if (error == 0) - error = copyout(cred->cr_groups, uap->gidset + 1, + error = copyout(cred->cr_groups, gidset + 1, (ngrp - 1) * sizeof(gid_t)); out: @@ -1218,16 +1224,23 @@ fail: #ifdef COMPAT_FREEBSD14 int freebsd14_setgroups(struct thread *td, struct freebsd14_setgroups_args *uap) +{ + return (user_freebsd14_setgroups(td, uap->gidsetsize, + uap->gidset)); +} + +int +user_freebsd14_setgroups(struct thread *td, int gidsetsize, + const gid_t *gidset) { gid_t smallgroups[CRED_SMALLGROUPS_NB]; gid_t *groups; - int gidsetsize, error; + int error; /* * Before FreeBSD 15.0, we allow one more group to be supplied to * account for the egid appearing before the supplementary groups. */ - gidsetsize = uap->gidsetsize; if (gidsetsize > ngroups_max + 1 || gidsetsize < 0) return (EINVAL); @@ -1236,7 +1249,7 @@ freebsd14_setgroups(struct thread *td, struct freebsd14_setgroups_args *uap) else groups = smallgroups; - error = copyin(uap->gidset, groups, gidsetsize * sizeof(gid_t)); + error = copyin(gidset, groups, gidsetsize * sizeof(gid_t)); if (error == 0) error = kern_setgroups(td, &gidsetsize, groups, true); diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index f098ee5ed750..c65836b9104c 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -265,6 +265,8 @@ int kern_filewrite(struct thread *td, int fd, struct file *fp, int kern_fpathconf(struct thread *td, int fd, int name, long *valuep); int kern_freebsd11_getfsstat(struct thread *td, struct freebsd11_statfs *ubuf, long bufsize, int mode); +int kern_freebsd14_getgroups(struct thread *td, int gidsetsize, + gid_t *gidset); int kern_frmdirat(struct thread *td, int dfd, const char *path, int fd, enum uio_seg pathseg, int flag); int kern_fstat(struct thread *td, int fd, struct stat *sbp); @@ -631,6 +633,8 @@ int user_fhstat(struct thread *td, const struct fhandle *u_fhp, struct stat *usb); int user_fhstatfs(struct thread *td, const struct fhandle *u_fhp, struct statfs *buf); +int user_freebsd14_setgroups(struct thread *td, int gidsetsize, + const gid_t *gidset); int user_fspacectl(struct thread *td, int fd, int cmd, const struct spacectl_range *rqsrp, int flags, struct spacectl_range *rmsrp);