From nobody Sat Sep 13 23:44:57 2025 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 4cPSZd6Kk9z67jF8; Sat, 13 Sep 2025 23:44: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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cPSZd4mJgz3stX; Sat, 13 Sep 2025 23:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757807097; 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=uxIMRc95EaYFOLdX4Fi8OTynj6nVOi+SgMwLeap0ICU=; b=bCbCGo1m18NzP5p2Adwt8zN+MkqF+3D69xuvSgprTJzFPJU0PgG36mDFtIoppqg68J1HvG Ybz2f7/bAtTiY2JVNJ/Fg8O/b69Q82ECHdEJ3X7DCl2x9BcJ0QA71otnnW1Gb7Y+FH9d6V 1xXeoxi3cClO7QJ0QO0hViFwuUOpmPfuC0Oded+kHwbWKc5t3lzCVnSevP1wPLZ8VD7Rpt bC6gih4fuN5+7myR1d7tsv0xQTYQQE/DUMLykHACLsZCzqhj68E5E8oS27ktweWcyZbg19 USJ7cnCTjldViPU9CxpC09+v4s/u6x//b377siIlAAT/FND1TtsMQytpnTx+MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757807097; 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=uxIMRc95EaYFOLdX4Fi8OTynj6nVOi+SgMwLeap0ICU=; b=QEarrA+qTrH0qlorZ7RimNEcZnNQ7IAsfbZPDYp6pFIAlLfJADSm50IyobJjy3R5nD3n4i A1mOsvHNjtu97WC67BHjSD7Y6R+Jm51+y5MWjUgW/NEIXC8RsvBnXzmTycErL9lVdPISQf 6X8LvO8LlUhMvkAyAWBTQkAfJRolzS/IizfZ2gK0KvXNUtn91zzpo2Pf1ngcdnGodDT6jo xjZZA5XPkJ0elPK+vDwx+klFdeCgyuC5jl6CPksHksehU5vuRv344/pXYiTakt1u4X6N2Y 4AsqsVXPTmS5E9QkFvBTpwndbyzFUCfO3lqAUdVwVtgAwXQTCzyHfZdp+oTomw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757807097; a=rsa-sha256; cv=none; b=mAXr7ZOL3UUZSEmD+hEhDgcJ7ZCgUHqHHFefL85f8z3NZCWj5PP75I6+TQ0g7D/kJzI3GV Ta6lBnvuiiEkZ/CjIQyjKdGpoRmjtTRi3XezynwngL0YYjbygtfrgh82aQz9uyUKOzlf2L xKkVjiyIOF9BVFdFYuX0upFYpfCE+G/q+wMyn7q4HjflwOS1p4Y93DhAAuKjA5KKaQNlPv 7QSAgfkhBHt/RlLokGTU5vWmeoCDcmiVuKI5h8DFOt97UgfDONN6M7AEWWfcfaOo1FGHlL OVItmQOEEjf9QmQ6aXvd1qbveG6wq0gcOgdNZsR1v1JRSPT4C2LVcJ8McBC8ZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cPSZd1FwXz10qt; Sat, 13 Sep 2025 23:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58DNiv7n054608; Sat, 13 Sep 2025 23:44:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58DNivm1054605; Sat, 13 Sep 2025 23:44:57 GMT (envelope-from git) Date: Sat, 13 Sep 2025 23:44:57 GMT Message-Id: <202509132344.58DNivm1054605@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: 0c23ee96c6e5 - stable/15 - MFC jaildesc: fix typo and style(9) violations. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 0c23ee96c6e5f591182ad6bf314f59e7701c8f0a Auto-Submitted: auto-generated The branch stable/15 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=0c23ee96c6e5f591182ad6bf314f59e7701c8f0a commit 0c23ee96c6e5f591182ad6bf314f59e7701c8f0a Author: Jamie Gritton AuthorDate: 2025-09-09 18:46:45 +0000 Commit: Jamie Gritton CommitDate: 2025-09-13 22:37:56 +0000 MFC jaildesc: fix typo and style(9) violations. Reported by: kib MFC after: 3 days (cherry picked from commit d8d5324ef5335dd9404db7263be2271610245e10) --- lib/libjail/jail.c | 16 ++++++++-------- sys/kern/kern_jail.c | 36 ++++++++++++++++++------------------ sys/kern/kern_jaildesc.c | 26 +++++++++++++------------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/libjail/jail.c b/lib/libjail/jail.c index 931391055919..f761bc6993e5 100644 --- a/lib/libjail/jail.c +++ b/lib/libjail/jail.c @@ -95,8 +95,8 @@ jail_setv(int flags, ...) goto error; if (jailparam_import(jp + njp, value) < 0) goto error; - if (!strcmp(name, "desc") - && (flags & (JAIL_GET_DESC | JAIL_OWN_DESC))) { + if (!strcmp(name, "desc") && + (flags & (JAIL_GET_DESC | JAIL_OWN_DESC))) { jp_desc = jp + njp; desc_value = value; } @@ -145,8 +145,8 @@ jail_getv(int flags, ...) va_end(tap); goto error; } - if (!strcmp(jp[njp].jp_name, "desc") - && (flags & (JAIL_USE_DESC | JAIL_AT_DESC))) { + if (!strcmp(jp[njp].jp_name, "desc") && + (flags & (JAIL_USE_DESC | JAIL_AT_DESC))) { jp_desc = jp + njp; desc_value = value; } else if (!strcmp(jp[njp].jp_name, "lastjid")) { @@ -181,8 +181,8 @@ jail_getv(int flags, ...) } if (jailparam_import(jp_key, key_value) < 0) goto error; - if (jp_desc != NULL && jp_desc != jp_key - && jailparam_import(jp_desc, desc_value) < 0) + if (jp_desc != NULL && jp_desc != jp_key && + jailparam_import(jp_desc, desc_value) < 0) goto error; /* Get the jail and export the parameters. */ jid = jailparam_get(jp, njp, flags); @@ -604,8 +604,8 @@ jailparam_get(struct jailparam *jp, unsigned njp, int flags) jp_desc = jp_lastjid = jp_jid = jp_name = NULL; arrays = 0; for (ai = j = 0; j < njp; j++) { - if (!strcmp(jp[j].jp_name, "desc") - && (flags & (JAIL_USE_DESC | JAIL_AT_DESC))) + if (!strcmp(jp[j].jp_name, "desc") && + (flags & (JAIL_USE_DESC | JAIL_AT_DESC))) jp_desc = jp + j; else if (!strcmp(jp[j].jp_name, "lastjid")) jp_lastjid = jp + j; diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 5a1fbe23ddeb..51a8b5cc0465 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1033,13 +1033,13 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) char numbuf[12]; mypr = td->td_ucred->cr_prison; - if (((flags & (JAIL_CREATE | JAIL_AT_DESC)) == JAIL_CREATE) - && mypr->pr_childmax == 0) + if (((flags & (JAIL_CREATE | JAIL_AT_DESC)) == JAIL_CREATE) && + mypr->pr_childmax == 0) return (EPERM); if (flags & ~JAIL_SET_MASK) return (EINVAL); - if ((flags & (JAIL_USE_DESC | JAIL_AT_DESC)) - == (JAIL_USE_DESC | JAIL_AT_DESC)) + if ((flags & (JAIL_USE_DESC | JAIL_AT_DESC)) == + (JAIL_USE_DESC | JAIL_AT_DESC)) return (EINVAL); prison_hold(mypr); @@ -1098,9 +1098,9 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = jaildesc_find(td, jfd_in, &desc_in, &mypr, NULL); if (error != 0) { - vfs_opterror(opts, error == ENOENT - ? "descriptor to dead jail" - : "not a jail descriptor"); + vfs_opterror(opts, error == ENOENT ? + "descriptor to dead jail" : + "not a jail descriptor"); goto done_errmsg; } /* @@ -1518,9 +1518,9 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* Get the jail from its descriptor. */ error = jaildesc_find(td, jfd_in, &desc_in, &pr, &jdcred); if (error) { - vfs_opterror(opts, error == ENOENT - ? "descriptor to dead jail" - : "not a jail descriptor"); + vfs_opterror(opts, error == ENOENT ? + "descriptor to dead jail" : + "not a jail descriptor"); goto done_deref; } drflags |= PD_DEREF; @@ -2512,8 +2512,8 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) if (flags & ~JAIL_GET_MASK) return (EINVAL); - if ((flags & (JAIL_USE_DESC | JAIL_AT_DESC)) - == (JAIL_USE_DESC | JAIL_AT_DESC)) + if ((flags & (JAIL_USE_DESC | JAIL_AT_DESC)) == + (JAIL_USE_DESC | JAIL_AT_DESC)) return (EINVAL); /* Get the parameter list. */ @@ -2549,9 +2549,9 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) /* Get the jail from its descriptor. */ error = jaildesc_find(td, jfd_in, &desc_in, &pr, NULL); if (error) { - vfs_opterror(opts, error == ENOENT - ? "descriptor to dead jail" - : "not a jail descriptor"); + vfs_opterror(opts, error == ENOENT ? + "descriptor to dead jail" : + "not a jail descriptor"); goto done; } drflags |= PD_DEREF; @@ -2576,9 +2576,9 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) error = jaildesc_find(td, jfd_in, &desc_in, &mypr, NULL); if (error != 0) { - vfs_opterror(opts, error == ENOENT - ? "descriptor to dead jail" - : "not a jail descriptor"); + vfs_opterror(opts, error == ENOENT ? + "descriptor to dead jail" : + "not a jail descriptor"); goto done; } error = vaccess(VREG, desc_in->jd_mode, desc_in->jd_uid, diff --git a/sys/kern/kern_jaildesc.c b/sys/kern/kern_jaildesc.c index b4ffad4c88e8..72e2845aaf42 100644 --- a/sys/kern/kern_jaildesc.c +++ b/sys/kern/kern_jaildesc.c @@ -137,14 +137,14 @@ jaildesc_alloc(struct thread *td, struct file **fpp, int *fdp, int owning) free(jd, M_JAILDESC); return (error); } - finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0 - ? FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops); + finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0 ? + FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops); JAILDESC_LOCK_INIT(jd); jd->jd_uid = fp->f_cred->cr_uid; jd->jd_gid = fp->f_cred->cr_gid; - jd->jd_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | mode - | (priv_check(td, PRIV_JAIL_SET) == 0 ? S_IWUSR | S_IXUSR : 0) - | (priv_check(td, PRIV_JAIL_ATTACH) == 0 ? S_IXUSR : 0); + jd->jd_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | mode | + (priv_check(td, PRIV_JAIL_SET) == 0 ? S_IWUSR | S_IXUSR : 0) | + (priv_check(td, PRIV_JAIL_ATTACH) == 0 ? S_IXUSR : 0); *fpp = fp; return (0); } @@ -167,7 +167,7 @@ jaildesc_set_prison(struct file *fp, struct prison *pr) } /* - * Detach the all jail descriptors from a prison. + * Detach all the jail descriptors from a prison. */ void jaildesc_prison_cleanup(struct prison *pr) @@ -264,13 +264,13 @@ jaildesc_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, int error; /* Reject permissions that the creator doesn't have. */ - if (((mode & (S_IWUSR | S_IWGRP | S_IWOTH)) - && priv_check_cred(fp->f_cred, PRIV_JAIL_SET) != 0) - || ((mode & (S_IXUSR | S_IXGRP | S_IXOTH)) - && priv_check_cred(fp->f_cred, PRIV_JAIL_ATTACH) != 0 - && priv_check_cred(fp->f_cred, PRIV_JAIL_SET) != 0) - || ((mode & S_ISTXT) - && priv_check_cred(fp->f_cred, PRIV_JAIL_REMOVE) != 0)) + if (((mode & (S_IWUSR | S_IWGRP | S_IWOTH)) && + priv_check_cred(fp->f_cred, PRIV_JAIL_SET) != 0) || + ((mode & (S_IXUSR | S_IXGRP | S_IXOTH)) && + priv_check_cred(fp->f_cred, PRIV_JAIL_ATTACH) != 0 && + priv_check_cred(fp->f_cred, PRIV_JAIL_SET) != 0) || + ((mode & S_ISTXT) && + priv_check_cred(fp->f_cred, PRIV_JAIL_REMOVE) != 0)) return (EPERM); if (mode & (S_ISUID | S_ISGID)) return (EINVAL);