From nobody Fri May 29 16:01:28 2026 X-Original-To: dev-commits-src-main@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 4gRp4n13Qrz6flDh for ; Fri, 29 May 2026 16:01:29 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gRp4m6bfhz3GyF for ; Fri, 29 May 2026 16:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070489; 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=GHuNrB9IED8E69C7dO7dDnJGbN0Zved4vz95VVp+uZg=; b=J6y5wcBVZWK/Olx3OaJPFRq/L2DU0YatDeHQQ8EXED+bF85T04h5cQ3+g0WdbqQz0iE1DK d8MQJwGdP+KX/cO8h2BClhA2MbtZUP/UjN06ziAdlEVnEL4BxqNz8mZwb6VPG/ozLsGVip AzyUWWVahdEeDOtGeTpHPaGu+TZ4hhje8bkME6IK9LvKjseIcP3wz4pEx9hvm67Q4WGewm QgRMAVXzeIsO9es1Hvcs1eihOcxSWjtMIucdJ8LgajiodD5NiKuWQwbvV10Bjf+dKdPEDi LO++zIbfvYnJDk5ViqzR5rIStXo7eYfXSuSziDUzjm3+O+DqyppeiVz+CX1EhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070488; a=rsa-sha256; cv=none; b=ZT5SA1HJI/e4hv94qm4Pu+9/dcxP7M0xaGJkY9PYEcccRbuGSfEKPWLczDlFBkA3CuVcyj wUaqYVcfMjQ4HwI9C2rTUeVRJiv/kNSs0jyyvwl9egMYeCjqhm4cVL/MBiYIb56APN0wxF 1RPba/lPl7vFFhTrNzK2ndEGp4J3R6XWTc8OElyW5A/ZAOsPF/aZCMxPoJnoVV5F/rM85i +08hMVBQa4bmfLWn6kGZIHgOGt6ZwhYN/eRTWlXQq3Fb6YibJmz9dqCmjoKeKQ8cntNV+S FgiZxAd0/TW1dcxSF5BvntuEHo+eL7Tb//XUSeEZqAu/jmzJifR03wlFHeAG+w== 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=1780070488; 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=GHuNrB9IED8E69C7dO7dDnJGbN0Zved4vz95VVp+uZg=; b=o62nyLdaZU9DNkxcHyGopvmQ2RvYR69Z/4OgKy6HTt0bkgrM76VIj+B+eCpAH85dIyn7NU ntDQ1fPytNuFvD3Y3KfwsqnnfOYxvTWfZA82lBAkLE4J1tEPCei0zu7CLiPRUCMIcL7xU8 S5QO9/Y6oHcfHBXweTOaF6J1zht5bPeWWxygvalMvJsIed7Jnoo1hJaY/H7rxHOOFnQa6K TCmzMwSlPomcMch9VorXTWEfrEQwb7kz5c918ydgFlpLFgooBUjH6Ob50aNGYa+c37e1T9 PVnfadiUPyHR7T94n/1lW8CPLNHVs8aNC1d6hcjvSSXlrTRlGeyVXKr0Uky28g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4m5smtzg6Q for ; Fri, 29 May 2026 16:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35df2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 782533882441 - main - MAC/do: Fix recently-introduced comments List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 7825338824415153fe29bec30c1d5c1e5fcb638b Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:28 +0000 Message-Id: <6a19b858.35df2.54cb400e@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=7825338824415153fe29bec30c1d5c1e5fcb638b commit 7825338824415153fe29bec30c1d5c1e5fcb638b Author: Olivier Certner AuthorDate: 2026-03-23 13:13:22 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:15:23 +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 --- 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 c889b218cad3..2258c358ce92 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -344,7 +344,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) { @@ -1148,12 +1148,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) @@ -1272,6 +1273,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) { @@ -1290,7 +1294,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) @@ -1553,9 +1557,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) @@ -1566,12 +1573,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) @@ -1590,7 +1598,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) @@ -1611,7 +1619,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. */ @@ -1619,15 +1627,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: @@ -1651,7 +1663,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: