From nobody Mon Jun 29 19:25:35 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 4gpx801fVdz6jjQV for ; Mon, 29 Jun 2026 19:25:36 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gpx7z67Y0z3yv5 for ; Mon, 29 Jun 2026 19:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782761135; 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=ErgxTerFa3JI08EvH93uTvtaA3javZSA4Lae1t3u/mw=; b=D27+sFO+7otXJknfIN4s2Q+W/O2Ql/SHCdiKUaHqpSGSPb5UTPhZRwagli6NL9kIv/qVqG xWbbWUuUdqhNIbNr6qaDWVTz8aetgwGiEuZ6nZlwBAfP7I1rRioMfdtMSSYgVlfGQQE81F iYohyt2zEUiduE3A+5PkPpLUhW0FmfhyUivIpJPpvygpaAn1MPh2qlTwPTBy/LT7dQxZbW wicS0BOjjnyj4RbLFCJ/3ETG8bZeqSTdc8BUrhyqrdgMhA/E/D2ddiN5zPR9IRD/M8n0jT 1XoxyuHIK9O+IO0hvDSfJifQFvmYw0Fc0QsyJ2etr5+S8sy8C1XQkc0EWyvXmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782761135; a=rsa-sha256; cv=none; b=lFhsM+cQr8q1DG0yG7nmVx9o478E9CwKM7twUqZ5DJTjJVNbUb4lZWuy0IsSHRB5rIai+t Ax/ZbtSsAuB2eEOAoxGrWwgbfsMXpmWuTeyUPEkllMDCdCWZmQOltoJ3Hf2LSNw33bpkqw kcPb6M11MoUBhkYmtHXXTmDpULOie+J7QP5vf2clB/VB45Z90YF7K+7c4reAJpJqn/h1gV VGy//buvXXaVM50ngdsHM2x3QxHC8/4tYCyu04F7FITHhTH+XAu49JTVZstEQBd+BdN8St Vi5jBe+LhJ69SGLMC/WlXYRCe5TRM7xkaUlHqapyoaATWhQ9idabTh5AOCUCBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782761135; 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=ErgxTerFa3JI08EvH93uTvtaA3javZSA4Lae1t3u/mw=; b=pGuElnlUDOCT9kOMbGEb5SSUw48QNNGxK+c/eePYSeuOxWLhco/2i/QMhSHkGscY13Ndu9 bSF4AZWrRrx/zYYMGixKdU7XgVLeaYOmiEyhNPR3WLKyXMOT364UkLnKzsdXKoc/raNl03 gZ3fMOk1mBOEK7pX9gcWLfl/nCuDU9Y2g1WXI0BPS3m/6BsPp/asWZKpRIHFdGiYB+0se+ WC6ZafJFF1rn2Y6+aIw5qXdlo8ebLezHHsvgrR3IYJGHrsweLG/Jn9jWTeMGcieU4rnjRs 6qOS2Wf8dZzAzr0ly80qVkzbE1P3ZCKXqZpEuxxtnn0aWB6LD4ArO3vv/rV7Rg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpx7z5C6Bz19bL for ; Mon, 29 Jun 2026 19:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 21a21 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 29 Jun 2026 19:25:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: a946f6630b2c - stable/15 - MAC/do: Fix recently-introduced comments 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 List-Id: 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: a946f6630b2cbf6844476257539ed66e2cb24012 Auto-Submitted: auto-generated Date: Mon, 29 Jun 2026 19:25:35 +0000 Message-Id: <6a42c6af.21a21.2fb3a3ea@gitrepo.freebsd.org> The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=a946f6630b2cbf6844476257539ed66e2cb24012 commit a946f6630b2cbf6844476257539ed66e2cb24012 Author: Olivier Certner AuthorDate: 2026-03-23 13:13:22 +0000 Commit: Olivier Certner CommitDate: 2026-06-29 19:23:38 +0000 MAC/do: Fix recently-introduced comments Reviewed by: bapt Fixes: 9818224174c4 ("MAC/do: Executable paths feature (GSoC 2025's final state)") MFC after: 1 month Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 (cherry picked from commit 7825338824415153fe29bec30c1d5c1e5fcb638b) --- sys/security/mac_do/mac_do.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index c9fb7fc8774b..95c7007b6a8a 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -346,7 +346,7 @@ toast_rules(struct rules *const rules) } } -/* Assuming storage is zeroed already */ +/* Assumes storage has been zeroed. */ static void init_rules(struct rules *const rules) { @@ -1150,12 +1150,13 @@ out: } /* - * Find conf applicable to the passed prison. + * Find configuration applicable to the passed prison. * - * Returns the applicable conf (and never NULL). 'pr' must be unlocked. - * 'aprp' is set to the (ancestor) prison holding these, and it must be unlocked - * once the caller is done accessing the conf. '*aprp' is equal to 'pr' if and - * only if the current jail has its own set of conf. + * Returns the applicable configuration (and never NULL). 'pr' must be + * unlocked. 'aprp' is set to the (ancestor) prison holding these, and it must + * be unlocked once the caller is done accessing the configuration. '*aprp' is + * equal to 'pr' if and only if the current jail has its own specific + * configuration. */ static struct conf * find_conf(struct prison *const pr, struct prison **const aprp) @@ -1274,6 +1275,9 @@ remove_conf(struct prison *const pr) drop_conf(old_conf); } +/* + * Assign an already-built configuration to a jail. + */ static void set_conf(struct prison *const pr, struct conf *const conf) { @@ -1292,7 +1296,7 @@ set_conf(struct prison *const pr, struct conf *const conf) } /* - * Assigns default conf to a jail. + * Assigns the default configuration to a jail. */ static void set_default_conf(struct prison *const pr) @@ -1555,9 +1559,12 @@ mac_do_jail_check(void *obj, void *data) int error, jsys, rules_len = 0, exec_paths_len = 0; bool has_rules, has_exec_paths; - /* Mark unspecified */ error = vfs_copyopt(opts, "mac.do", &jsys, sizeof(jsys)); if (error == ENOENT) + /* + * Mark unspecified. Will fill it up below depending on the + * other options. + */ jsys = -1; else { if (error != 0) @@ -1568,12 +1575,13 @@ mac_do_jail_check(void *obj, void *data) } /* - * We use vfs_getopt() here instead of vfs_getopts() to get the length. + * We use vfs_getopt() below instead of vfs_getopts() to get the length. * We perform the additional checks done by the latter here, even if * jail_set() calls vfs_getopts() itself later (they becoming * inconsistent wouldn't cause any security problem). */ + /* Rules. */ error = vfs_getopt(opts, "mac.do.rules", (void **)&rules_string, &rules_len); if (error == ENOENT) @@ -1592,7 +1600,7 @@ mac_do_jail_check(void *obj, void *data) } } - /* Handle 'exec_paths' input */ + /* Executable paths. */ error = vfs_getopt(opts, "mac.do.exec_paths", (void **)&exec_paths_string, &exec_paths_len); if (error == ENOENT) @@ -1613,7 +1621,7 @@ mac_do_jail_check(void *obj, void *data) } /* - * Be liberal, considering that an empty rule or exec paths + * Be liberal, considering that an empty rule or execution paths * specification is equivalent to no specification. This affects the * JAIL_SYS_DISABLE and JAIL_SYS_INHERIT sanity checks below. */ @@ -1621,15 +1629,19 @@ mac_do_jail_check(void *obj, void *data) has_exec_paths = exec_paths_string != NULL && exec_paths_string[0] != '\0'; - /* Infer 'jsys' if needed */ + /* If not specified, infer 'jsys' from passed options. */ if (jsys == -1) { + /* + * Default in absence of "mac.do.rules" and "mac.do.exec_paths" + * is to disable (and, in particular, not inherit). + */ if (has_rules || has_exec_paths) jsys = JAIL_SYS_NEW; else jsys = JAIL_SYS_DISABLE; } - /* Final checks based on resolved 'jsys' */ + /* Final checks based on resolved 'jsys'. */ switch (jsys) { case JAIL_SYS_DISABLE: case JAIL_SYS_INHERIT: @@ -1653,7 +1665,6 @@ mac_do_jail_check(void *obj, void *data) "rules nor executable paths specified"); return (EINVAL); } - /* Allow: rules only, exec_paths only (though exec_paths only is discouraged), or both */ break; default: