From nobody Mon May 25 01:33:08 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 4gNz0h6VVxz6fdjV for ; Mon, 25 May 2026 01:33:08 +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 4gNz0h5F3cz3SCk for ; Mon, 25 May 2026 01:33:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779672788; 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=TWky71U18rnuDeGfAQ8dvqNHgn0DaL2i1CBFNweFimg=; b=QM1gOauo112O/WOOq+7+kc+5IzVkruDuF+3F7WjMKntfR7F8xGE/wJl1eFgKGPmDg3osVU ttZ3TnaZu6P1DpEGXsDXh/Um8JoTfU4e0tBAAPR1U3WeEvI9/Ud24u62Xf7Bmy2Xq6NHt6 31XQ2u1YYJnoaZmwPYYLMuy4GaD7mcSyUv4hj4nsas0itksuDrICfDgbUkP/b0uBLT9pIA TGBuWsw9vuDe8t4vA1W3yhJAI2Yu+FxxR1OndKkj2Gk5e1Kp4f7bC3CFtQJO+PXuyd1udG ixoWq6Rj6SEDHwmdkXxX4Zphw5aWgb5vHsubCUYXKKukBXIiKphMWIZ5HXRMVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779672788; a=rsa-sha256; cv=none; b=NS0hVzTpvqZrfTmk7Li9qz46uazCAyNFlLWnO6NlM5gb5z/dASIJS0WLzmcUCKXJP2bFoe MWo+18Jmqr9AVIanN0hhpgr6S4yu0xY56+XIYZ7cmzyO7zAwMcbbusmFzgt6NVQbJD1qEh 1TKLm8H9JKRVmlmBuBKGeK1gVN5YClOzX2Ti+rIf/TScWN5GJ4rqUiZBJHDfqshEbJv+Zg uGbFiXR11fNF2//4vxQ09SVq6xUn7B/keosK1Y8E8s9walfe9KNXmoUMQ3ehyGas/g/rjC Crwu2Yq9GnQd29seaYwDpW+y3IQgtxvNrLkQ9TZQtmv1kIJnoU3BtqopzF5jpQ== 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=1779672788; 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=TWky71U18rnuDeGfAQ8dvqNHgn0DaL2i1CBFNweFimg=; b=tl9a4FsBf2AtCM41GTGnZB/FDTx4OZw26p1xfzT2G1tYnUrfmr4GRYqF/fnab+05dMSiB/ vrsVxKo8gfVjE2xiE3ghaokbfnZJDIfRXAUNOKgMe12DorQTJk/FWLE/KuzRhSHitb0ZFN WfdecmZQZK2iAvDMpDcoR1MTco6+XIukFmmuOUlMvTug5KKHnZDI1ZRyu5YbjWr7t+9pxI YbWAUz5qywqOFOUw+vAxpkMzzUt4WZGe5Fnfq2M9+ejmPwsip3jbsczoBO5oLtlbuyuivV ziEAXP76Cp1wxA3N/hFK/trpywiJ13YqUSRXYNy2H+Sb0duw3dX/wlhHUmTimg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gNz0h4lvKz43q for ; Mon, 25 May 2026 01:33:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 43f82 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 01:33:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: e3b4dbb80577 - main - net80211: create ieee80211_ht_check_bar_exceed_retry_count() 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3b4dbb80577fcecb74566d2c1a219dac146f541 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 01:33:08 +0000 Message-Id: <6a13a6d4.43f82.20743414@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=e3b4dbb80577fcecb74566d2c1a219dac146f541 commit e3b4dbb80577fcecb74566d2c1a219dac146f541 Author: Adrian Chadd AuthorDate: 2026-05-17 18:40:03 +0000 Commit: Adrian Chadd CommitDate: 2026-05-25 01:32:04 +0000 net80211: create ieee80211_ht_check_bar_exceed_retry_count() Create a function to check if the BAR retry limit has been reached. Use this in if_ath_tx instead of a hard-coded value. I've been meaning to do this for a long time. Differential Revision: https://reviews.freebsd.org/D57055 --- sys/dev/ath/if_ath_tx.c | 3 ++- sys/net80211/ieee80211_ht.c | 20 +++++++++++++++++++- sys/net80211/ieee80211_ht.h | 2 ++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c index 9ac591c14943..d37210723680 100644 --- a/sys/dev/ath/if_ath_tx.c +++ b/sys/dev/ath/if_ath_tx.c @@ -6225,7 +6225,8 @@ ath_bar_response(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap, * Also, don't call it if bar_tx/bar_wait are 0; something * has beaten us to the punch? (XXX figure out what?) */ - if (status == 0 || attempts == 50) { + if (status == 0 || + ieee80211_ht_check_bar_exceed_retry_count(ni, attempts)) { ATH_TX_LOCK(sc); if (atid->bar_tx == 0 || atid->bar_wait == 0) DPRINTF(sc, ATH_DEBUG_SW_TX_BAR, diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c index 9b2b0df33785..8ebfbbae6377 100644 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -2899,7 +2899,7 @@ bar_timeout(void *arg) if ((tap->txa_flags & IEEE80211_AGGR_BARPEND) == 0) return; /* XXX ? */ - if (tap->txa_attempts >= ieee80211_bar_maxtries) { + if (ieee80211_ht_check_bar_exceed_retry_count(ni, tap->txa_attempts)) { struct ieee80211com *ic = ni->ni_ic; ni->ni_vap->iv_stats.is_ampdu_bar_tx_fail++; @@ -3845,3 +3845,21 @@ ieee80211_ht_check_tx_ht40(const struct ieee80211_node *ni) IEEE80211_IS_CHAN_HT40(ni->ni_chan) && (ni->ni_chw == NET80211_STA_RX_BW_40)); } + +/** + * @brief Return whether the given BAR retry count exceeds the configured count + * + * @param ni ieee80211_node to check against + * @param count BAR retry count + * @returns true if the count has exceeded the configured count, false if not + */ +bool +ieee80211_ht_check_bar_exceed_retry_count(const struct ieee80211_node *ni __unused, + int count) +{ + /* + * Note: ni isn't used here because the BAR limit is currently + * global. It's here for future work. + */ + return (count >= ieee80211_bar_maxtries); +} diff --git a/sys/net80211/ieee80211_ht.h b/sys/net80211/ieee80211_ht.h index c31bb8700289..505b39628dcf 100644 --- a/sys/net80211/ieee80211_ht.h +++ b/sys/net80211/ieee80211_ht.h @@ -247,5 +247,7 @@ bool ieee80211_ht_check_tx_shortgi_20(const struct ieee80211_node *ni); bool ieee80211_ht_check_tx_shortgi_40(const struct ieee80211_node *ni); bool ieee80211_ht_check_tx_ht40(const struct ieee80211_node *ni); bool ieee80211_ht_check_tx_ht(const struct ieee80211_node *ht); +bool ieee80211_ht_check_bar_exceed_retry_count(const struct ieee80211_node *, + int); #endif /* _NET80211_IEEE80211_HT_H_ */ From nobody Mon May 25 01:33:09 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 4gNz0k0Cj7z6ff88 for ; Mon, 25 May 2026 01:33:10 +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 4gNz0j5Yrqz3S7M for ; Mon, 25 May 2026 01:33:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779672789; 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=+Oa0J8gLfAcTvK0i0Mo4WJJSQjAxBjls6qp95GodFY0=; b=L5KhP/fv/R/EFYnlU35UqAkj31e+wgE3dzQWL1A7jxg7VJM/HoJihAHTnXYysfFwPdCHqZ AEVkhNTektgkD2xGRub72qjP3pGhu0xkFFRihXO1mhBvM6nQJ+n87gVybe1XACNYZgK5wW pdxkzNwHSESr1suUZfBGNbz9sIJ305QkZN/oBCU+R5xgO3Pt8oDDs3bWTgHk2cqxWlpQWd 0SqzGZKND3MdQfkrUS1WT8MQbiLXFCLZqZWAwe1GoSfKM1yEhm4P9QC0C5cO37LN8PfHe9 0AUyyxjQmW3EYjVtUrBOUX5VZv/7x0WIW+UjC7Pxg3Vfn9WBkFUwKO45sr084w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779672789; a=rsa-sha256; cv=none; b=iCIL8+Rps8PiVe0/IHZeRfOPKpMwvW2NdB36Wlub5gL/HpvtzZ1KwlqHWr3PIaWKMbmhtX gzg0l66XReUUvT/eVPvSlA2XQFgjcRrL3Gbd8lI+QUl+m8+vX1RA2saSdpKwMNql0g6xDd YVAN3ORmXStss+WyRiKmIYsZ4W67dJ1UGlsraeG6GVwOkVkGgxnN+diLZ0idin9SL9JphP +6SnIS0xwk8rR9OV3mnn97BFlkTn75Bo+/PR+hWAmAoN5g4XffRkmYfcwHQWZzecKGMrUP R3q3DRqnWXYp/P97Lmft2wcfdQ7lZs7CiSnxaiDg6m2bV8Iun77t4vL6XKzB9A== 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=1779672789; 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=+Oa0J8gLfAcTvK0i0Mo4WJJSQjAxBjls6qp95GodFY0=; b=MuGYe8YYusQ4NgOYawwkFlPexvJsEoYUucPG847DNW6t05YyXywA5eK9V4itiYNJn/MVoz xW0f3DO6xcH2TYAMThtLzlfFgWu4/Fax5cAs0ecto3E2ZooF4imc0wE01NxPoH38p/D3ic 2DnOfgt7VtbstyF96PXZvxJcbyzafGnfiq1kMsQcn3xln7C+bnsO3ry0xCX7zr7QuWm2ig s54VK0AlundQetHZXKGi5sPUMTrsJLdRccmIuAvaZvOopPL62ygEr+pdV/neexhBRdEDea J+VOtiZr34AvcgBDEid2nVYgm3QgqtWzHLD9TDLYXi0gwwjSMoRktTpx9zHiJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gNz0j560gz4JG for ; Mon, 25 May 2026 01:33:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 429bd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 01:33:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 0c37c9928c68 - main - net80211: add some example doxygen inline documents 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c37c9928c68ca50b3d5a1282d0c756e71c2ef35 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 01:33:09 +0000 Message-Id: <6a13a6d5.429bd.4e7acf3f@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=0c37c9928c68ca50b3d5a1282d0c756e71c2ef35 commit 0c37c9928c68ca50b3d5a1282d0c756e71c2ef35 Author: Adrian Chadd AuthorDate: 2026-05-17 18:41:11 +0000 Commit: Adrian Chadd CommitDate: 2026-05-25 01:32:10 +0000 net80211: add some example doxygen inline documents This isn't supposed to be comprehensive, I want to have examples for the common doxygen comments: * describing a struct * inside a struct - single line before the item * inside a struct - same line after an item * inside a struct - multi-line before an item These build fine with the doxygen build in tools/kerneldoc/subsys/ . Differential Revision: https://reviews.freebsd.org/D57056 --- sys/net80211/ieee80211_var.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 2f11fa7c887f..f38489174986 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -134,8 +134,11 @@ struct ieee80211_frame; struct net80211dump_methods; +/** + * @brief ieee80211com - the top level driver / hardware instance. + */ struct ieee80211com { - void *ic_softc; /* driver softc */ + void *ic_softc; /**< pointer to driver softc */ const char *ic_name; /* usually device name */ ieee80211_com_lock_t ic_comlock; /* state update lock */ ieee80211_tx_lock_t ic_txlock; /* ic/vap TX lock */ @@ -176,7 +179,15 @@ struct ieee80211com { uint8_t ic_allmulti; /* vap's needing all multicast*/ uint8_t ic_nrunning; /* vap's marked running */ uint8_t ic_curmode; /* current mode */ + /** + * @brief Driver assigned MAC address. + * + * Drivers are required to populate ic_macaddr at attach time with + * the MAC address of the device. It is then used as the base for + * MAC addresses created for VAP interfaces. + */ uint8_t ic_macaddr[IEEE80211_ADDR_LEN]; + uint16_t ic_bintval; /* beacon interval */ uint16_t ic_lintval; /* listen interval */ uint16_t ic_holdover; /* PM hold over duration */ @@ -283,7 +294,19 @@ struct ieee80211com { struct ieee80211_regdomain *, int, struct ieee80211_channel []); - int (*ic_set_quiet)(struct ieee80211_node *, + /** + * @brief Handle the quiet time information element configuration. + * + * This allows drivers/modules to tie into the quiet time IE + * for controlling the transmit duty cycle. This may be required + * for more accurate radar detection. + * + * @param ni The ieee80211_node which transmitted the IE (eg in a scan) + * or if unknown, the BSSID node + * @param quiet_elm the quiet time element contents to parse/handle + * @returns 0 for OK, non-zero with errno (eg ENOSYS) + */ + int (*ic_set_quiet)(struct ieee80211_node *ni, u_int8_t *quiet_elm); /* regular transmit */ @@ -296,7 +319,7 @@ struct ieee80211com { int (*ic_raw_xmit)(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); - /* update device state for 802.11 slot time change */ + /** update device state for 802.11 slot time change */ void (*ic_updateslot)(struct ieee80211com *); /* handle multicast state changes */ void (*ic_update_mcast)(struct ieee80211com *); From nobody Mon May 25 01:33:10 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 4gNz0l1Jv7z6ff8B for ; Mon, 25 May 2026 01:33:11 +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 4gNz0k6T39z3S4f for ; Mon, 25 May 2026 01:33:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779672790; 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=heidOZs4wZcnU4pB7CNYQpb7w3keHzNVfThQv/vPkbw=; b=oHCTZeKRKmJ1eLwXrgTw17OJ58af73nHiErtrpajcMSFWSwOtFfAoFURs3tIcEpZdd9SMi cjY8LO0L6thuKrM0Q1yw0dud6Z4zWEPvn7y6X7vFmQBLCaJfzHmMrrR6GZciqd5TmZEXnA vT+Fu/Ac1xWYoAOVD0A4S/15tuMjmhqmOgOsT3KifSTRtTNKJ8WoJDB+CAb3dwdkg42eez TjWexoJFaHoxU/k1Hi+WjENBJnM6oChO3VNkWKgfo+Kc24invNgMy5Sa9UcP4YBkLv4hFO uSY2XQ219l5URybVMFIrREirWs4IWmVabJyxNtXeq2QjWumNqmh7yb8akXqJfw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779672790; a=rsa-sha256; cv=none; b=bfNgIx+gnwf7RWzC5xad5S2sv7TMMbXJu9EVAWkbppyn/812ubN3vhD2iaNnLipRINtX1K fz7gh6UUNkvdQUgSl4xBrpb5x3DA+cd27DFrHYKfGRIkvHjVrg6fKUQc0J2CT+q8T7EHl+ jTGPRp00MZmWnn9BXzA73DvxuXANmLd7goHps3b/oz52DiF8/oyyHj1e1Pf5lnH/ZF6BS5 BxHml9elhHE196ZeGN3LlvqJOUVu16MJSPuHaPJNdb+uphzl5m/hSD2TA9JIVSqDhZPKbg A9VoBiTEFwP5fSHpG2Fl9aW1UIuH75GM5R4CdivP286AZYSMFp0PXHW19B96kQ== 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=1779672790; 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=heidOZs4wZcnU4pB7CNYQpb7w3keHzNVfThQv/vPkbw=; b=Itq9/+NeTve9oX5FJ/lSnbODGe9jrt3hRHEQjS49VVhvOglXYgq04msWWEw3OYJes77B0u qRSe+yTv87gZt8o12/vokSWxJJtGHdALx648sgD5A4moqyokb+IcN8ovctf0l3PsjDdRCP VphQWijxXQMiGLfguFqPbAbUZwiYRP2xuRB/ZtxGV6Ec0XaSo4PbHeeOzETHtE8M+GsDg+ tkTmjnwc9+K8D7BNob17hkv9WqMybqhz1Xm3C8v3rMlVkQCWfxkvX/uqIQvFLdNBX4TtEE qEKBTnYUf70ZLUIAZG0zzU4BjcdUheijbrem31Rghs2fYAaf4qktnygKDRkNFg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gNz0k5xMDz4Fx for ; Mon, 25 May 2026 01:33:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 444e3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 01:33:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 1ccaef986746 - main - net80211: update/add some VHT doxygen documentation 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ccaef9867461c42251922e3fc4d4f85cec682b5 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 01:33:10 +0000 Message-Id: <6a13a6d6.444e3.772fec3e@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=1ccaef9867461c42251922e3fc4d4f85cec682b5 commit 1ccaef9867461c42251922e3fc4d4f85cec682b5 Author: Adrian Chadd AuthorDate: 2026-05-19 05:08:50 +0000 Commit: Adrian Chadd CommitDate: 2026-05-25 01:32:16 +0000 net80211: update/add some VHT doxygen documentation Add and update some documentation to be picked up by doxygen. Differential Revision: https://reviews.freebsd.org/D57079 --- sys/net80211/ieee80211_vht.c | 71 +++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 17 deletions(-) diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c index 095c4108c768..696e2e54f563 100644 --- a/sys/net80211/ieee80211_vht.c +++ b/sys/net80211/ieee80211_vht.c @@ -235,10 +235,16 @@ ieee80211_vht_node_cleanup(struct ieee80211_node *ni) bzero(&ni->ni_vht_mcsinfo, sizeof(struct ieee80211_vht_mcs_info)); } -/* - * Parse an 802.11ac VHT operation IE. +/** + * @brief Parse an 802.11ac VHT operation IE. + * + * This parses the VHT operation IE (channel width, basic MCS set) + * into the given ieee80211_node . * * 802.11-2020 9.4.2.158 (VHT Operation element) + * + * @param ni ieee80211_node to parse VHT operation IE into + * @param ie The VHT operation IE to parse, 802.11 endian */ void ieee80211_parse_vhtopmode(struct ieee80211_node *ni, const uint8_t *ie) @@ -257,10 +263,16 @@ ieee80211_parse_vhtopmode(struct ieee80211_node *ni, const uint8_t *ie) #endif } -/* - * Parse an 802.11ac VHT capability IE. +/** + * @brief Parse an 802.11ac VHT capability IE. + * + * Parse the VHT capability IE into the node vht fields + * (ni->ni_vht_mcsinfo, ni->ni_vhtcap). * * 802.11-2020 9.4.2.157 (VHT Capabilities element) + * + * @param ni ieee80211_node to parse VHT info into + * @param ie VHT capability IE to parse, 802.11 endian */ void ieee80211_parse_vhtcap(struct ieee80211_node *ni, const uint8_t *ie) @@ -371,8 +383,8 @@ ieee80211_vht_node_leave(struct ieee80211_node *ni) "%s: called", __func__); } -/* - * Calculate the VHTCAP IE for a given node. +/** + * @brief Calculate the VHTCAP IE for a given node. * * This includes calculating the capability intersection based on the * current operating mode and intersection of the TX/RX MCS maps. @@ -390,7 +402,9 @@ ieee80211_vht_node_leave(struct ieee80211_node *ni) * TODO: investigate what we should negotiate for MU-MIMO beamforming * options. * - * opmode is '1' for "vhtcap as if I'm a STA", 0 otherwise. + * @param ni ieee80211_node to check + * @param vhtcap ieee80211_vht_cap to populate (in host order). + * @param opmode is '1' for "vhtcap as if I'm a STA", 0 otherwise. */ void ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni, @@ -715,14 +729,22 @@ ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni, } } -/* - * Add a VHTCAP field. +/** + * @brief Add a VHTCAP field. * * If in station mode, we announce what we would like our * desired configuration to be. * * Else, we announce our capabilities based on our current * configuration. + * + * TODO: This assumes that the passed in buffer has enough space for + * the VHT capabilitity IE and that seems error prone. + * + * @param frm buffer to start populating the IE into + * @param ni ieee80211_node to fetch the VHT capability from + * @returns a pointer to the first byte in the buffer after the newly + * populated IE */ uint8_t * ieee80211_add_vhtcap(uint8_t *frm, struct ieee80211_node *ni) @@ -932,8 +954,14 @@ ieee80211_vht_get_vhtinfo_ie(struct ieee80211_node *ni, net80211_vap_printf(ni->ni_vap, "%s: called; TODO!\n", __func__); } -/* - * Return true if VHT rates can be used for the given node. +/** + * @brief Check if VHT rates can be used for the given node. + * + * This returns true if any VHT rates can be used to transmit + * to the given node. + * + * @param ni ieee80211_node to check + * @returns True if any VHT rates can be transmitted to the given node */ bool ieee80211_vht_check_tx_vht(const struct ieee80211_node *ni) @@ -954,11 +982,14 @@ ieee80211_vht_check_tx_vht(const struct ieee80211_node *ni) return (IEEE80211_IS_CHAN_VHT(ni->ni_chan)); } -/* - * Return true if VHT40 rates can be transmitted to the given node. +/** + * @brief Check if VHT40 rates can be transmitted to the given node. * * This verifies that the BSS is VHT40 capable and the current * node channel width is 40MHz. + * + * @param ni ieee80211_node to check + * @returns True if 40MHz VHT rates can be transmitted to the given node */ static bool ieee80211_vht_check_tx_vht40(const struct ieee80211_node *ni) @@ -977,11 +1008,14 @@ ieee80211_vht_check_tx_vht40(const struct ieee80211_node *ni) (ni->ni_chw == NET80211_STA_RX_BW_40)); } -/* - * Return true if VHT80 rates can be transmitted to the given node. +/** + * @brief Check if VHT80 rates can be transmitted to the given node. * * This verifies that the BSS is VHT80 capable and the current * node channel width is 80MHz. + * + * @param ni ieee80211_node to check + * @returns True if 80MHz VHT rates can be transmitted to the given node */ static bool ieee80211_vht_check_tx_vht80(const struct ieee80211_node *ni) @@ -1006,11 +1040,14 @@ ieee80211_vht_check_tx_vht80(const struct ieee80211_node *ni) (ni->ni_chw != NET80211_STA_RX_BW_20)); } -/* - * Return true if VHT 160 rates can be transmitted to the given node. +/** + * @brief Check if VHT 160 rates can be transmitted to the given node. * * This verifies that the BSS is VHT80+80 or VHT160 capable and the current * node channel width is 80+80MHz or 160MHz. + * + * @param ni ieee80211_node to check + * @returns True if 160MHz VHT rates can be transmitted to the given node */ static bool ieee80211_vht_check_tx_vht160(const struct ieee80211_node *ni) From nobody Mon May 25 01:33:11 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 4gNz0m3T5cz6ff8F for ; Mon, 25 May 2026 01:33:12 +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 4gNz0m0YG8z3RwS for ; Mon, 25 May 2026 01:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779672792; 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=O3Kcq5qlQEs24nyfumt+uAxGmC48/5wPOZcKgFUwFVU=; b=V2nd7A82a4QYhP0YRAGfhJZCaSCIsa7gpPtuOVhFwWFI105KsWsHVyxVHud6kIvSr9hZEx F5Uk1mVVZMYFamr/e/uneAzW6giEKYundaX+WxbWeitQnOQgsS1KwMhq586Hb8z5AExoO/ wWHQMZ5wO76UPAwTEIyQWOeM9MdY+qsf3EDHkUUahOFwkDHsB4ezkLBqn89KQroOYEGsqM pws8wNpQ8Q+3QpVl3+WkTKRJAoppsCyuWUNKoHtLdCjuSPdbRe6tlYCTwTj33d6q13dPuU xWEh3JMYhm5/MWiOhyCp8UGW+G+fIsnUgeXEC+uG8/XAO1ltqZOMhaOL6jI28A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779672792; a=rsa-sha256; cv=none; b=J3ytwQf15EKYX3o2u63I+kOa+WK/RS5Ijp06wyoRru6cuLg9PekZox6B4w59wN3g3ssGjH QatlzE2nRRYBvkzAjruLVVKvCE6Wk6+ZTk/wngNFlZmq2cCizVVscA7jtw0To1hKe+Ibu/ wr7Ow5EYRZaO5JHHRZOdWqlpQcefbkTqZ99QygmRtR7aDiyvCX4+H8RjdrFVFGmzRSl2Zy Fqm10FTQlSXK/nmo4yvD4D3BLubDf+C8AVc0VEoVlsK98pvrDoPlWAQk60PGT+raNj2PJP QlC+uWrnL+hZcc9XYSgeHsfWgK/8/awDxhdfIFtUlmQNXkYg+nsttg+eyzy9Qw== 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=1779672792; 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=O3Kcq5qlQEs24nyfumt+uAxGmC48/5wPOZcKgFUwFVU=; b=J/zBH2ducNksAIKMPs9J7TNiER3bjRG2l/Q5EVh20CzzCeuFJ5iIR+6vQhotVn9FQMBZfB jQAWf8H9nlIa1Dq0ColGid3bEzmZTRL2vkPm9CXMcs9aaBTiamoVuNWuJuCzGpGBNL/NpO TqLY6T7z5DwGZc+pYkKnBYRBMaFnSo/f22oIWje6yyFmlcESWJhE4ZK0KHbmGGpAXM9asG 3dfDKR4kGeamtvQiMV+6uFIPlXs+7q+n/3mLwxO2JUWsPkxXNoiC4uD4ZH2Jdt09VRsQ4p gaZBrIblo7n7jSS1H5AIgpH17Y2weg4BkPUTj6J5t7M8Gz1uiffvWvD2N9G9jQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gNz0l6rPLz4Wh for ; Mon, 25 May 2026 01:33:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4361b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 01:33:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 490c53e9353f - main - net80211: add initial README.md and PROTOCOL.md 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 490c53e9353feb129fe0acb8d9ba8fa52db24e2c Auto-Submitted: auto-generated Date: Mon, 25 May 2026 01:33:11 +0000 Message-Id: <6a13a6d7.4361b.5c217572@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=490c53e9353feb129fe0acb8d9ba8fa52db24e2c commit 490c53e9353feb129fe0acb8d9ba8fa52db24e2c Author: Adrian Chadd AuthorDate: 2026-04-26 23:32:35 +0000 Commit: Adrian Chadd CommitDate: 2026-05-25 01:32:33 +0000 net80211: add initial README.md and PROTOCOL.md * Add top level README.md, linking to in progress and todo items * Add an 802.11 protocol overview, with todo items - this is designed to provide a basic introduction to 802.11 for people wishing to work on net80211 and drivers. * DEBUG.md - cover the debug API * DATAPATH_TRANSMIT.md - transmit datapath * DATAPATH_RECEIVE.md - receive datapath * PROTOCOL.md - a high level (for values of "high") overview of the 802.11 protocol and where it intersects with net80211 Differential Revision: https://reviews.freebsd.org/D56760 --- sys/net80211/DATAPATH_RECEIVE.md | 160 +++++++++ sys/net80211/DATAPATH_TRANSMIT.md | 390 +++++++++++++++++++++ sys/net80211/DEBUG.md | 101 ++++++ sys/net80211/PROTOCOL.md | 563 +++++++++++++++++++++++++++++++ sys/net80211/README.md | 139 ++++++++ tools/kerneldoc/subsys/Doxyfile-net80211 | 3 +- 6 files changed, 1355 insertions(+), 1 deletion(-) diff --git a/sys/net80211/DATAPATH_RECEIVE.md b/sys/net80211/DATAPATH_RECEIVE.md new file mode 100644 index 000000000000..a930aba0c3da --- /dev/null +++ b/sys/net80211/DATAPATH_RECEIVE.md @@ -0,0 +1,160 @@ +# net80211 Datapath - Receive + +## Overview + +This document provides an overview for receive data paths in +net80211, between the interface to the operating system, through net80211 and +into the driver. + +The details about underlying implementations (eg how A-MPDU RX aggregation +is handled) will be covered in dedicated documents. + +## Concurrency Notes + +The transmit path(s), receive path and control / ioctl paths all run +in parallel and can be scheduled on multiple concurrently running +kernel threads. It's important to keep this in mind. + +## Receive Path + +### Concurrency + +There must only be one packet receive path into net80211. The net80211 stack +has not yet been fully validated to ensure that state changes all occur under +sufficient locking. + +### Data Path + +The receive path is split into three broad categories: + + * The normal 802.11/802.3 packet receive path from drivers; + * The input path for reinjected frames (eg WDS, 802.11s, BPF); + * Various side channels for offloaded non-data path (eg explicitly + scan results, management frames, etc.) + +#### Data Path - Initial Input + +The driver receive path begins in ieee80211_input.c . The four +entry points are: + + * ieee80211_input() / ieee80211_input_mimo() and + * ieee80211_input_all() / ieee80211_input_mimo_all(). + +The first two are called when the destination MAC address is a known +(struct ieee80211_node) node. These are passed up to the +VAP via a call to ni->ni_vap->iv_input(). + +The second two are called when the destination MAC address is NOT +a known node. In this instance, the frames are treated as broadcast +and routed to each VAP BSS node via a call to ieee80211_input_mimo(). + +Each VAP vap->iv_input() method handles the behavioural specific +needs of the interface. + +#### Data Path - VAP type / behaviour + +Each VAP type will do roughly the same thing - for example see +sta_input() in ieee80211_sta.c . + + * Check the frame size and protocol ID; + * Check if the frame has been decrypted in hardware; + * Grab A-MPDU session frames and put them in the reorder queue; + * Handle control frames sent to the node, or general scan frames; + * Get the frame QoS information / TID information if present; + * If appropriate, check the 802.11 receive sequence number; + * Break the handling up into data, management and control; + * Reinject into a radiotap/BPF session via a call to + ieee80211_radiotap_rx(). + +The data paths will typically do the following: + + * Do decryption if needed; + * Do 802.11 decap if needed; + * Enforce security requirements if needed; + * Eventually deliver the frame up to the higher level network + stack via a call to ieee80211_deliver_data() which will + strip away any last bits of 802.11 / net80211, + call ieee80211_vap_deliver_data(), which will call the + network stack input interface. + +The control and management paths will call vap->iv_recv_mgmt() +and vap->iv_recv_ctl() which implement the per VAP type behaviours. +These will include participating in driving the scan engine, +the per-node state machines and the VAP state machine. + +#### Reinjected Path + +#### Side Channels + +Drivers may need a specific side channel for management/control +frames, MAC layer events (eg A-MPDU aggregation session state); +some power state communication, scan information and other +things that would normally show up as 802.11 frames. + +These will be covered in more detail in other documents. + +### Receive Status and Parameters + +Received 802.11 / 802.3 frames can come with a variety of information +that isn't strictly the data payload. These include receive timestamps +(at beginning or end of frame), receive noise floor / signal strength, +channel / frequency, channel width, received rate, aggregation frame +boundaries, decryption state, etc. + +The original paths - ieee80211_input() and ieee80211_input_all() - +took a noise floor and rssi parameter. Later drivers provide +information about all of the above by attaching a (struct ieee80211_rx_stats) +to the receive mbuf via a call to ieee80211_add_rx_params() bafore +calling ieee80211_input_mimo() and ieee80211_input_mimo_all() . + +Existing drivers should be migrated to the mimo versions of these +APIs and the existing API should eventually be deprecated and +replace the mimo versions. + +All new drivers must use the ieee80211_input_mimo() and +ieee80211_input_mimo_all() API calls. + +### Driver Receive Path Requirements + +The driver receive path has a few top level requirements: + + * Driver / stack locks must not be held during receive. This means that + drivers should dequeue their frames first into a local list, release + whatever locks are needed and then pass the frames up to net80211. + + * Drivers are responsible for doing the node lookup before + calling ieee80211_input() / ieee80211_input_mimo() or + calling ieee80211_input_all() / ieee80211_input_mimo_all(). + + * Drivers are also responsible for creating and attaching the + ieee80211_rx_stats information via a call to ieee80211_add_rx_params(). + + * Drivers are responsible for tagging a frame as a potential + A_MPDU by tagging the received mbuf with the M_AMPDU flag. + They should do this by just tagging all mbufs to a node + with ni->ni_flags & IEEE80211_NODE_HT set w/ the M_AMPDU flag. + This is a holdover from the 802.11n code which enforces that + only potential AMPDU frames can be added to an A-MPDU receive + aggregation session and may be relaxed / removed in the future. + +### Driver Receive Path Methods + +Drivers can hook into the receive path processing in a variety of ways. +There are a number of vap methods that a driver can hook into +processing. The details will be covered in the driver document. + +These include: + + * vap->iv_input - the driver can replace the iv_input method + with its own method to first handle frames before they are passed + to the VAP type receive path. + * vap->iv_recv_mgmt - the driver can hook here to handle + management frames before the VAP type management receive path. + * vap->iv_recv_ctl - the driver can hook here to handle + control frames before the VAP type control receive path. + * vap->iv_bmiss - the driver can hook here to be informed of + beacon miss frames. + +These may be called at any time and overlapping with others (eg +the beacon miss event - which may be triggered by a timer - +can be called in parallel with the various receive path methods.) diff --git a/sys/net80211/DATAPATH_TRANSMIT.md b/sys/net80211/DATAPATH_TRANSMIT.md new file mode 100644 index 000000000000..b3122129d938 --- /dev/null +++ b/sys/net80211/DATAPATH_TRANSMIT.md @@ -0,0 +1,390 @@ +# net80211 Datapath - Transmit + +## Overview + +This document provides an overview for the transmit data path in +net80211, between the interface to the operating system, through net80211 and +into the driver. + +The details about underlying implementations (eg how A-MPDU RX aggregation +is handled) will be covered in dedicated documents. + +## Concurrency Notes + +The transmit path(s), receive path and control / ioctl paths all run +in parallel and can be scheduled on multiple concurrently running +kernel threads. It's important to keep this in mind. + +## Transmit Path + +There are two paths from the operating system layer into the net80211 transmit +path - the normal data path and the BPF / radiotap raw frame path. + +It is important to note that both paths have no serialisation between +them, and multiple sending paths in the OS can and will queue frames +simultaneously across multiple concurrently executing threads/CPUs. +Please keep this in mind when reading the transmit handling and +how it interacts with 802.11 sequence numbering and encryption IV. + +### Data Path - net80211 + +This is configured at the ifnet setup in ieee80211_vap_setup() - +the output path is ieee80211_vap_transmit(). This input path +takes 802.3 ethernet frames with no attached metadata (such as +rate control, transmit power, etc) - it is left up to the stack. + +This hands the packet off to ieee80211_start_pkt() which will +perform the initial 802.11 destination lookup, query the node +state (eg whether it's in power save) and the VAP state (eg +is the vap itself in power state, or in a non-RUN state) +and drop or queue the frame appropriately. + +It is then handed over to ieee80211_vap_pkt_send_dest() with +a destination ieee80211_node reference. + +ieee80211_vap_pkt_send_dest() performs the bulk of the +net80211 transmit handling. Packets will be queued here if the +destination node is in a power saving mode. + +This includes: + + * Firstly - checking if the packet needs to be queued for + power saving operation and will pass it via ieee80211_pwrsave() + if needed; + * QoS classification via a call to ieee80211_classify(); + * BPF TX tap via a call to BPF_MTAP(); + * handling 802.11 encapsulation via ieee80211_encap() if required; + * A-MPDU TX decisions, AMSDU and Atheros Fast-Frames decisions. + +At this point the packet has been 802.11 encapsulated if required, +marked as needing encryption if required, and has been optionally +fragmented into a list of 802.11 fragments. + +Finally, the packet / fragment packet chain is sent up to the driver via a call +to ieee80211_parent_xmitpkt(). The driver is expected to queue the +packet / fragment list or discard the packet / fragment list. The specific +format of the mbuf chain and how ieee80211_node references are kept +is documented in ieee80211_parent_xmitpkt(). + +#### Notes on transmit path serialisation + +Note that by default the IEEE80211_TX_LOCK() is held across the call to +ieee80211_encap() and ieee80211_parent_xmitpkt(). Drivers can register +that they properly handle 802.11 sequence number offloading via +IEEE80211_FEXT_SEQNO_OFFLOAD. The lock is to ensure that packets +queued to the driver layer are added to the driver transmit queue +in the same order that they are 802.11 encapsulated - which sets the +802.11 sequence number. Drivers which set IEEE80211_FEXT_SEQNO_OFFLOAD +indicate that they will assign the sequence number themselves - likely +at the same time that the transmit encryption IV number is assigned, +or simply offloaded in firmware - and thus this lock is not +required. + +### Data path - Driver + +The call ieee80211_parent_xmit() will call the driver ic->ic_transmit() +method. At this point the driver can choose to queue / send the frame +(and take ownership of it), or return an error, and return it back +to net80211. Currently net80211 will just free the mbuf and node reference +and return, but drivers should not assume that. + +The mbuf passed in will be either a single 802.11/802.3 frame in an mbuf, +or a list of 802.11 fragments chained by m->m_nextpkt. If the driver +has not set IEEE80211_FEXT_SEQNO_OFFLOAD then the packet will have +a sequence number assigned which the driver can fetch via M_SEQNO_GET(). +The mbuf also holds an ieee80211_node reference. + +(Note that fragments do not have sequence numbers assigned nor node +references.) + +The driver needs to do a few things with this frame. Notably if it's +an 802.3 offload device, it will be handed an 802.3 frame with no +802.11 information. In that case, the driver just needs to queue +it for send to the hardware/firmware. + +For devices which accept 802.11 frames, a few things are needed: + + * It needs to queue them for send, in the order they're given. + * If there are any reasons the frames need to be buffered in the + driver - eg node power state, asynchronous node/key/state updates - + then they'll be buffered here until needed. + * It needs to do any local hardware/firmware setup - rate control, + transmit configuration, destination queue decisions, etc. + * Hardware/firmware typically has some way to mark a frame as a type + (control, data, management), whether RTS/CTS is needed, + * If IEEE80211_FEXT_SEQNO_OFFLOAD is set in the driver, it may need to + allocate 802.11 sequence numbers via a call to ieee80211_output_seqno_assign(). + * If the frame is part of an MPDU (m->m_flags & M_AMPDU_MPDU) then + the frame may need to be handled differently. (For example rtwn(4) + leaves sequence number assignment up to the firmware when A-MPDU is + enabled.) + * If the mbuf is marked as needing encryption (IEEE80211_FC1_PROTECTED + is set in the 802.11 header) then the frame needs to be encrypted + with the current encryption state via a call to ieee80211_crypto_encap(). + * Finally, the frame is queued to the hardware/firmware. + +Again it is critical that the 802.11 sequence number and encryption be +called together in the same order. This is typically done by the TX work +being done in a lock, or all frames being pushed into a single software +TX queue. + +### Data path vs control path and the need to buffer frames + +net80211 currently treats encryption key programming, VAP state +and other updates as synchronous calls. For example, the +transmit path will call the driver to add a node, then +set the encryption keys and then queue a frame to be transmitted. + +For devices which are programmed directly with no queued operations +(such as the ath(4) devices) the encryption key and node programming +is immediate. However, for many other devices - firmware and +USB are two examples - these operations are asynchronous. +And these code paths tend to be in the transmit paths from +upper layers that may have locks held, so sleeping is not an option. + +So for now this needs to be implemented in the driver itself. +It will need to maintain a per-node queue of transmit frames; +it will need to track asynchronous node creation/updates and +encryption key updates and buffer transmit frames for a node +until the node add/update and encryption key add/update is +completed. + +### Transmit Completion Notifications + +The net80211 stack may request a completion notification +to be called when a transmit frame has completed. +This will be done via a call to ieee80211_add_callback(). +It is used in various parts of the net80211 stack to +drive the MAC state machines - for example, being notified +once an BAR (Block-ACK request) frame has completed so +the retry timer can be cancelled. + +This requires that mbufs that are transmitted with a requested +completion callback be checked and handled appropriately. +This is covered in the next section. + +### Completing and freeing transmit path mbufs + +There are two paths to freeing mbufs - ieee80211_free_mbuf() and +ieee80211_tx_complete(). + +#### Before transmit - ieee80211_free_mbuf() + +ieee80211_free_mbuf() is used in drivers and net80211 to free +a list of mbufs as part of the transmit path setup so it can +properly account for and free an 802.11 MPDU / 802.3 frame, +or a list of mbufs representing 802.11 fragments. It doesn't +handle the ieee80211_node reference as at the early stage +of transmit there is a single ieee80211_node reference +covering all of the fragments being passed to the driver +for transmit. + +If you're not supporting 802.11 fragment transmit (and you have +to register your driver with the IEEE80211_C_TXFRAG capability +to even support this) then you can ignore all of the above +and just not call ieee80211_free_mbuf() for now. + +This must not be used for receive mbufs. Yes, this is not +well named and should likely just be renamed. + +#### After transmit queueing / attempts - ieee80211_tx_complete(). + +In the general case of an transmit mbuf being completed (either +successfully or unsuccessfully) net80211 provides a call +to handle everything - ieee80211_tx_complete(). This takes +the relevant destination node (struct ieee80211_node), +the mbuf, and a status indiciating success or failure. + +A call to ieee80211_tx_complete() handles a variety of +common functions: + + * It increments the ifnet counters as appropriate; + * If the frame has a TX completion notification callback attached + it will process said callback; + * If a node is supplied then the node reference is freed + +In the past some drivers implemented the mbuf TX callback +handling themselves, resulting in some drivers supporting +callback and some drivers not supporting callbacks. The goal +here is to implement a single way for completions to be +handled. + +Note that some hardware / firmware do not support per-frame +completion / status notification. For example, USB devices +tend to not send individual notifications for frames - you +may be able to request it for specific frames, but the +status notifications are expensive. In these cases, drivers +may just call ieee80211_tx_complete() with a status based +on whether the frame was queued to the USB endpoint successfully +or not. + +#### Atheros Fast Frames / 802.11n A-MSDU transmit + +(Note this is purposely short - a larger write-up for this will be +done on a separate page.) + +The transmit path above will call ieee80211_ff_check() and +ieee80211_amsdu_check() to see if the given node/frame should be +queued for an Atheros Fast Frames MPDU or an A-MSDU. + +If the frame should be queued it will be queued locally and NULL +will be returned; if there's already a frame queued it may be +paired with a queued frame and both returned as a single mbuf / MPDU +to send. + +As far as the driver is concerned, it will be handed a single +802.11 MPDU to send. + +#### 802.11n A-MPDU transmit + +net80211 implements the A-MPDU negotiation and block-ack request/response +handling. However currently the driver must implement A-MPDU packet +queuing, buffering, submission and retransmission. + +There are some methods that the driver can override to control the +A-MPDU transmit negotiation flow (ic->ic_addba_request, ic->ic_addba_response, +ic->ic_addba_response_timeout, ic->ic_addba_stop) and the Block-Ack +response completion or error/timeout (ic->ic_bar_response). + +#### Driver queue completion + +Currently there are two things a driver should do when its own queues +are (mostly) empty: + + * When the transmit queue is empty or mostly empty, call ieee80211_ff_flush() + to flush out any pending A-MSDU / Atheros Fast Frames to be transmitted; + * When the receive queue is being handled, call ieee80211_ff_age_all() to + flush out any frames that are older than a provided time interval. + +These calls ensure that any queued frames in Fast Frames / A-MSDU queue +don't stay in there permanently. + +### Non data frame transmission (management, control, action, beacon, etc) + +Non data frames are sent via ieee80211_raw_output(). The main exception to +this is beacon frames, which are separately initialised and pulled from +net80211 into the driver by the driver specific beacon handling routines. + +Raw frames differ from data frames in a couple of ways: + + * Transmit parameters are typically sent from userland or the caller + (struct ieee80211_bpf_params \*), and + * The input path into the driver is via ic->ic_raw_xmit(), not ic->ic_transmit(). + +The driver can combine the data and non-data paths into a single path. +The main reason for keeping these separate is to cleanly support drivers +and firmware which allow 802.3 frames to be sent and received, but still +need a side channel to send and receive management frames for various other +functions. + +The raw frame output path is used by: + + * The BPF output path - ieee80211_output() ; + * The management frame output path - ieee80211_mgmt_output() ; + * The NULL data output path - ieee80211_send_nulldata() ; + * Sending probe requests - ieee80211_send_probereq() ; + * Sending probe responses - ieee80211_send_proberesp() ; + * Sending 802.11n BAR frames - ieee80211_send_bar() ; + * .. and anywhere where the individual protocol (eg 802.11s) wishes to send raw + non-data frames. + +This path is not REALLY designed for high speed data - for example, +it should work for basic packet injection, but it does not pass through +the normal functions for encryption, power save, TX aggregation and other +data specific operations. It expects to be handed a raw, already encapsulated +802.11 frame. + +Note this is not an 802.11 MPDU - this is an 802.11 frame. For example, +non-data frames may not have sequence numbers. NULL data frames have a sequence +number but that sequence number must be 0. + +Once the driver ic->ic_raw_xmit() call is made, the driver can handle the +802.11 frame in any way it sees fit. Again, it can't assume it's an 802.11 +data frame. + +### BPF path + +Control frames are injected from userland and net80211 via a raw transmit path, +separate from the data path. This dates back to the earliest Orinoco/WaveLAN +cards, where the earlier firmware only allowed 802.3 frames to be sent/received, +but later firmware introduced raw packet transmit to allow wpa_supplicant +operation. + +Packet injection begins via the BPF/radiotap input path. The code in +ieee80211_radiotap.c attaches a BPF operator to the VAP during the +call to ieee80211_radiotap_vattach(). + +Raw frames start in BPF and are queued via bpf_ieee80211_write(), which will +send the frame into the driver via a call to the VAP ifp->if_output() and then +if provided, a copy of the feedback mbuf via the VAP ifp->if_input(). + +The ifp->if_output() method by default is ieee80211_output(). The driver +can override this. This takes care of validating that it is an 802.11 +frame, extracts the (struct ieee80211_bpf_params \*) header from the +destination sockaddr passed in via BPF, finds the relevant +struct ieee80211_node \*) tx node, grabs a reference, some further sanity +checks and then calls ieee80211_raw_output(). The rest of the raw output +path is the same as net80211 sourced raw frames. + +### Power Save Management + +By default, net80211 will track legacy power-save state between IBSS nodes +and STA <-> AP nodes (ie, full node buffering via the power management bit +in the 802.11 header; TIM/ATIM bitmaps in beacons, NULL data frames to wake up) +and PS-POLL frames being sent by stations to request individual frames. + +The transmit path will pass frames destined to asleep stations to the power +save queue via a call to ieee80211_pwrsave(). + +There are a number of VAP methods for the driver to tie into if it needs to be +informed about this state (vap->iv_set_tim, vap->iv_recv_pspoll, vap->iv_node_ps). +These allow the driver to keep its own internal state in sync with net80211 +and allows it to better maintain its own transmit queue state. + +See the ath(4) driver for a comprehensive example of how these methods are used +to correctly transmit and buffer frames from an AP to STA device without packet +loss. + +### Transmit path encryption + +The net80211 stack needs to handle a variety of transmit encryption schemes +based on all the combinations that driver and firmware interfaces may require. + +In general, the transmit encryption is done in two phases: + + * In ieee80211_encap(), the transmit key is chosen via a call + to ieee80211_crypto_getucastkey() or ieee80211_crypto_getmcastkey() - the + key index is added to the 802.11 header and space is reserved between + the 802.11 header/payload and at the end for the encryption key data to be + added; + * Then when the driver transmits the frame, it calls ieee80211_crypto_encap() + to actually do the encryption. + +Some hardware will completely offload encryption, so although the key choice +is made, various driver configuration options are set to inform net80211 not +to add all the padding. Others will offload encryption but require the +space to be provided in the frame for the hardware/firmware to add the +encryption information into. + +### What is IEEE80211_F_DATAPAD ? + +This is actually to support hardware such as the Atheros 802.11abgn chips, +which have a 4 byte alignment requirement between the 802.11 header and +the data payload (including the encryption parts.) + +Yes, it likely should be a more generic option. + +### Future work + + * It would be nice to more formally define and enforce what drivers should be + doing with mbufs during the whole transmit lifecycle of an mbuf. + * Perhaps add a function or two for the drivers to use to + query whether a given mbuf has a TX notification attached (rather + than drivers querying M_TXCB) so they can individually + register for explicit notifications so they can provide more + accurate completion information. + * The fast frames age / flush routines should really be expanded to + be required functionality in net80211 drivers rather than optional + when IEEE80211_SUPPORT_SUPERG is enabled, so further software transmit + queue management is possible in net80211. + diff --git a/sys/net80211/DEBUG.md b/sys/net80211/DEBUG.md new file mode 100644 index 000000000000..2231a0992fe6 --- /dev/null +++ b/sys/net80211/DEBUG.md @@ -0,0 +1,101 @@ +# Debugging in net80211 + +This document describes how debugging is implemented in net80211. + +## Overview + +net80211 has run-time configurable debugging available. It is configured +per-VAP. It is implemented as a bitmask which can be controlled via a +sysctl at runtime. + +Debugging is compiled in when IEEE80211_DEBUG is defined. + +There is currently no global debugging API available; top-level net80211 +code is typically using printf() or some wrapper around it (eg +net80211_printf). + +The debug API is defined in (ieee80211_var.h). This includes the +debug field definitions and exported debugging API. The actual implementation +of the debugging routines is currently in (ieee80211_input.c) - see +(ieee80211_note) for an example. + +The bitmap of available debugging sections is in (ieee80211_var.h), prefixed +with IEEE80211_MSG . See (IEEE80211_MSG_DEBUG) for an example. + +## Usage + +Calls to the debugging APIs should not include a terminating '\n' character. +This will be added by the debug call. + +The simplest example is a call to IEEE80211_DPRINTF(). This takes a vap +pointer, which debug option to log to, then the format string and optional +arguments. For example: + +``` +IEEE80211_DPRINTF(vap, IEEE80211_MSG_11N, "%s: called!", __func__); +``` + +The debug flags can be combined together using bitwise OR so they are +emitted if one or more debug options are set, for example: + +``` +IEEE80211_DPRINTF(vap, IEEE80211_MSG_11N | IEEE80211_MSG_ASSOC, + "%s: called!", __func__); +``` + +There are a number of different debugging calls that are designed to be +used in different contexts. Although they all currently end up printing +to the same debug output, keeping them separate allows for future +behavioural changes whilst minimising rototilling the whole codebase (eg +allowing non-DPRINTF to turn into event tracing.) + + * Straight up debugging should be done through IEEE80211_DPRINTF() . + * Debugging that's related to a specific ieee80211_node (eg a state + change for a specific node) should be done via a call to IEEE80211_NOTE() . + * Debugging that's related to a specific ethernet MAC address (eg + scan results) should be done via a call to IEEE80211_NOTE_MAC() . + * Debugging that should include a frame header should be done via + a call to IEEE80211_NOTE_FRAME(). Note this takes a (struct ieee80211_frame \*) + pointer. + * Debugging involving discarding frames (eg invalid frames) should be + done via a call to IEEE80211_DISCARD() . + * Debugging involving discarding frames due to an invalid / bad IE should + be done via a call to IEEE80211_DISCARD_IE(). + * Debugging involving discarding frames due to a MAC address (eg ACL failure) + should be done via a call to IEEE80211_DISCARD_MAC(). + +## Usage Notes + + * It is required that the debugging be compiled in/out purely by defining or not + defining IEEE80211_DEBUG. This can often trip up unused variable warnings + when debugging is disabled, so just double-check both configurations. + + * It is important to ensure calls to the debugging (and any other logging API) + do not change any state/variables. For example, do not call a function that + updates some counter or some state variable inside a call to IEEE80211_DPRINTF(). + It won't be called at best and it will just be compiled out entirely at worst. + +## Configuration + + * The 'vap->iv_debug' field is controlled by the OS specific module. + * In FreeBSD (ieee80211_freebsd.c) it is assigned a sysctl (net.wlan.X.debug) + during (ieee80211_sysctl_vattach). + * FreeBSD ships the wlandebug(8) tool to query and set this at runtime. + +## Implementation Details + +* The debug API goes out of its way to do the debug flag check before evaluating + function parameters and potentially assembling the logging output. See + (IEEE80211_DPRINTF) for an example. + +## Future work + + * Top-level net80211 debugging APIs and control would be nice (for things + that are not specific to a VAP.) + * Drivers end up having to implement their own debugging API; it may be nice + to provide drivers a net80211 API to do their own driver specific logging. + * The debug macros should likely be refactored out to a new header file, + separate from ieee80211_var.h, so they can be more easily referenced. + * The debug fields should likely be refactored out into a new separate header + file that is designed to be consumed both by the kernel and by userland + utilities wishing to query/set the debug bitmask. diff --git a/sys/net80211/PROTOCOL.md b/sys/net80211/PROTOCOL.md new file mode 100644 index 000000000000..6d7c128bfc89 --- /dev/null +++ b/sys/net80211/PROTOCOL.md @@ -0,0 +1,563 @@ +# 802.11 protocol overview + +This is a quick overview of the 802.11 protocol and where it intersects with +net80211. It is not intended as a comprehensive deep dive into all of 802.11. + +TODO: link to appropriate sections in 802.11-2016 / 802.11-2020 depending upon +which PDF is freely available. + +## 802.11 overview + +The 802.11 protocol / specification is a very large document which covers +everything from the raw signals going out over the air up to how devices +need to behave in different operating modes. + +The IEEE specification documents and amendments describe what devices should +and must do in order to interoperate. It's important to note that the +intersection of "what the standard says" and "what devices do" is not always +fully aligned. The 802.11 specification has evolved over twenty-five years +and for the most part this allows interoperability between the original 802.11b +hardware and modern multi-band 802.11ax devices. + +It's also important to note that 802.11 is not just limited to the IEEE +specifications. 802.11 devices are almost exclusively RF devices (if you +read the specification you may find the old infrared / IR protocol definition!) +and so need to operate inside of the radio regulatory rules defined by each +country. These define a wide variety of RF environmental behaviours +including frequencies can be used, when devices can transmit, what transmit +power is allowed, interoperability with other devices (802.11 and non-802.11) +and radar interoperability. For the purposes of this document these will +be called "regulatory concerns" and will be covered elsewhere. + +The 802.11 specification breaks things up into a handful of top level areas: + + * the PHY layer - how the device interfaces with the RF environment and + encodes/decodes RF transmissions into data streams. + * the MAC layer - defines how data is packetized into individual data frames, + exchanged with the upper layer (ethernet/bridge), deciding when and what + to transmit via the PHY layer. + * MLME - (MAC layer management entities) - defines all of the state methods + and transitions that underpin the 802.11 MAC state machine. + * Security - the cipher and key management components. + * PHY specifications - the specific implementations of PHYs - 2GHz DSSS + (spread spectrum), 2GHZ CCK, OFDM, ERP, 802.11n / HT, 802.11ac / VHT, etc. + +Most 802.11 implementations do not implement a 1:1 definition of each of these +layers - notably implementing every single MLME state would be a huge amount +of work. + +## 802.11 revisions + +There have been many revisions of the 802.11 specification. The specifications +can be found online at https://www.ieee802.org/11/. + +The latest specification being implemented in net80211 is 802.11-2020, however +net80211 is far from completely compliant. Generally new code which implements +802.11 features / protocol handling should identify the specification and +section which it is referencing. + +## 802.11 protocol and frame definitions + +net80211 keeps most 802.11 frame and protocol definitions in a single location +(ieee80211.h). +This contains descriptions of the 802.11 frame and field definitions, ranging +from the lowest definition of the frame itself up through frame types/subtypes, +individual field definitions, information elements, action frames, and +anything else that can be found in the 802.11 specifications. + +The PHY definitions can be found in (ieee80211_phy.c) and (ieee80211_phy.h). +Notably those include the frame timing information useful for rate control +and frame duration calculations. + +## 802.11 Revisions + +(TBD) + +### Legacy 802.11 + +The earliest 802.11 devices implement 1Mbit/s and 2Mbit/s direct spread spectrum +frames. These include the earliest Wavelan devices. These are grandfathered +into 802.11b. The PHY specification can be found in 802.11-2020 Section 15.) + +### 802.11b + +802.11b devices implement Section 15 (1Mbit/2Mbit) PHYs as well as the high +rate DSSS specification (802.11-2020 Section 16) to provide 5.5Mbit and 11Mbit +CCK rates. They interoperate with legacy 802.11 devices by using compatible +PHY encodings and will limit their performance if said legacy devices are +detected. + +### 802.11a + +802.11a devices implement OFDM rates from 6Mbit/s to 54Mbit/s on the 5GHz +band. Among other features, it also defines 5MHz and 10MHz wide channel +behaviour. This is covered in the OFDM PHY specification (802.11-2020 +Section 17.) + +### 802.11g + +802.11g devices implement OFDM rates from 802.11a, the CCK rates from 802.11b +and the DSSS rates from legacy 802.11. These are covered in the ERP +specification (802.11-2020 Section 18.) There are some MAC extensions for +negotiating 802.11b / 802.11g interoperability and these are documented +throughout the MAC specification. This also specifies support for 5MHz and +10MHz wide channels. + +### 802.11n (HT) + +802.11n introduced a variety of high throughput rates and feature support +(hence why it's called HT - high throughput). It introduces higher density +OFDM rate encodings, 20 and 40MHz wide channels with interoperability for +earlier devices, packet aggregation via A-MPDU and A-MSDU, MIMO (multiple input, +multiple output spatial streams), some initial beamforming support, power +saving extensions and more. + +The physical layer support is covered in the HT PHY specification (802.11-2020 +Section 19.) The rest of the MAC extensions are documented throughout the +rest of the specification. + +### 802.11ac (VHT) + +802.11ac extends the 802.11n specification (hence why it's VHT - Very +High Throughput) and boosts performance by adding higher density OFDM QAM +encoding (256-QAM), wider channels (80MHz, 160MHz), split 80+80MHz channel +support, much larger A-MSDU / A-MPDU frame sizes, support for MU-MIMO +(multi-user MIMO) allowing APs to transmit to multiple STAs at the same time +and various other extensions. + +It builds on top of the 802.11n MAC and PHY specification, so a lot of +802.11n feature and MAC negotiation happens as part of 802.11ac negotiation. + +The PHY layer is covered in the VHT PHY Specification (802.11-2020 Section +21.) Again, the rest of the MAC extensions are documented throughout the +rest of the specification. + +### Greenfield versus backwards compatibility + +The various protocols supported by 802.11 build on top of earlier protocols. +So typically you're not building a single implementation for each protocol - +for example, you can't handle 802.11ac support without implementing a large +amount of 802.11n support. + +(As a side note, the 802.11 frame has a protocol version field, and +that actually changed in 802.11ah (900MHz and longer distance bands) - +which changes a lot of what the fields do. No, net80211 currently does not +support 802.11ah and will drop frames whose 802.11 protocol ID is not +supported.) + +At the PHY layer, later model hardware can transmit data encodings which +earlier model hardware just won't recognise. All they'll see is an increase +in RF power on the channel at best and signals that will confuse the +RX decoder / cause hardware issues at worst.) + +So each of the PHY specifications will lay out a few things: + + * How frames should be encoded in the air in a way that earlier + hardware can decode them enough to know it's not for them; + * How devices can identify that earlier protocol devices are around and + change the configuration (eg STA changing its own configuration, + AP changing the configuration of the network it controls, etc) + to provide backwards compatibility. + +These come at a performance cost. For example, an 802.11g AP which +supports 802.11b and 802.11 devices needs to notice that an 802.11b +device wishes to associate, and when it sees this, change some of +its configuration (notably "long preamble" so 802.11b devices can +decode frames that are being transmitted, whether destined to it or not.) + +Various devices allow backwards compatbility to be configured. +For example, an 802.11n AP may be configured to deny non-802.11n clients. +This may improve performance but then earlier clients can't connect. + +In 802.11n deployments this was known as a "greenfield deployment". +This typically disables any and all pre-11n interoperability at both +a MAC and PHY layer. net80211 has some flags for this to specifically +inform devices that they can configure the hardware for such a setup. +Not all drivers implement it however, and in a lot of cases they will +still handle pre-11n framing, even if the net80211 code will deny +association. + +There are other components to backwards compatibility which are worth +keeping in mind when reading through the 802.11 specification and +net80211 stack / driver code. These include: + + * short/long preamble - (vap_update_preamble) + * short/long slot time configuration - (vap_update_slot) + * 802.11g protection mode (vap_update_erp_protmode) - + whether to use CTS-to-self around each transmission + * 802.11n protection mode (vap_update_ht_protmode) - + whether to use RTS/CTS around each transmission + * 802.11n 20/40MHz BSS operation (whether an 802.11n AP sees other APs that + overlap its frequency range and need to reconfigure how to protect + transmissions) + +## How 802.11 (very briefly) works over the air + +This is a very brief and not at all comprehensive overview of how 802.11 +works over the air. The goal of this section is to provide enough background +information to help de-mystify reading the net80211 stack and wireless +driver source. + +### Why there's timing requirements in the first place + +Each of the PHY sections in the 802.11 specification describe what +the PHY needs to do in order to transmit and receive data. It's not +anywhere as easy as "toggle some bits on a wire". + +An important thing to understand is that hardware isn't immediate. +All the state machines in your 802.11 devices take non-zero time +to make decisions about when to transmit, when to receive, locking +onto a signal, deciding it can be decoded, getting reset for the next +frame, etc. + +So a lot of what you'll see in 802.11 negotiation and feature support +is linked to the underlying hardware implementations and limitations +of the time. For example the 802.11b specification defines the slot time +as 20uS, but the 802.11g specification lowers it to 9uS. The "slot time" +value defines the unit of time used for contention management / backoff, and +it's defined partly by what the speed of light dictates (ie how big +of a physical area you want to be able to "hear" in determining if the +area is busy) and how quickly the hardware can guarantee to respond. +It dropped to 9uS because hardware got better, but to interoperate +with older devices without starting to transmit before they're +ready to react, 802.11g devices will fall back to 20uS slot time when +they detect an 802.11b device. + +This carries through everywhere in odd places that you're not necessarily +aware of. For example, the 802.11n A-MPDU definition includes negotiated +padding between frames and limits encryption ciphers (typically CCMP or +GCMP.) This is due to hardware support - the MAC may be able to support +much less padding when no encryption is used, but setting up / resetting +the encryption / decryption blocks may take more time and thus larger +A-MPDU padding values are negotiated. + +### Wait, the speed of light? + +Yes. The speed of light is roughly 300 metres for each microsecond of +travel time. + +### Preambles, SIGs, PLCP, sending actual data and waiting / slot times + +There are a few things that are worth understanding at a high level. + + * The first thing that a device needs to do is determine + whether the air is busy or free. There'll be some hardware + to determine the signal level versus noise floor and provide + a signal to the transmit hardware that the air is free, + and to the receiver that it may want to try start decoding + something. + + * The receiver needs to get in synchronisation with the transmitter. + This is a one way operation - the transmitter needs to transmit + enough of a signal that the receiver can "lock onto" and get itself + ready for further data. This is called the "preamble" - it's + typically a low bitrate repeating pattern of data that gives + the receiver hardware time to lock onto, figure out the signal + level and be ready for the next phase. + + * Note that the receiver may pick up the preamble at any point in its + transmission so it can't guarantee it will see exactly "x" bits of some + repeating pattern. + + * Then there's other bits and pieces - eg look for L-SIG, HT-SIG + in the PHY documentation - which is used to further synchronise + what's about to happen. + + * Finally it will start transmitting the PHY framing bits needed to + identify what the upcoming transmit rate and configuration is + (all the stuff leading up to the PLCP header, then the PLCP header.) + +Things get more complicated with MIMO, MU-MIMO, 802.11ax OFDM-A, etc but +don't worry about those for now - they build on top of all of these +ideas. + +Once the data is transmitted, there's some quiet time between frames +before the receiver can ACK (and then a period of time where an ACK +is expected.) The transmitter needs to finish transmitting, then +reset its internal state back to idle to be ready to receive - and +there's the pesky speed of light speed of 300m per microsecond - +so there's some MAC (interframe spacing) and PHY (slot time) enforcing +quiet so everyone has a chance to receive the frame and the reciver *** 442 LINES SKIPPED *** From nobody Mon May 25 06:33:02 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 4gP5fm1LvBz6dj5f; Mon, 25 May 2026 06:33:04 +0000 (UTC) (envelope-from rm@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gP5fm0rSlz3X4j; Mon, 25 May 2026 06:33:04 +0000 (UTC) (envelope-from rm@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779690784; 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: in-reply-to:in-reply-to:references:references; bh=15PTMMQqPSlhHhhC+dCF1ze+7ZXUsFfYJKNxLqWHMNM=; b=i0JIhEV04XT2rZZCNXQSaf5M+CTv52koH++k8F6ckuscIoOEBbl/1toczSTPadfZvIATDv d2MmKYk1Os1cO4pUtvDkKyHWEZ9pabwBl55t1yOVmbQUwwcjvZfvNRXBFaQB6uKvVgfW0f XyR3cn5UPNkb/GMUqIDcvekxUdIioagiHJkRa6VmbdEZ2fLIQm6pHpGdex85xrU45A5Lth fItueCqhuQFnI9R0R/6IanbAy7dsW1IenUciUKZXzSFXsWi7Cra88y1yAD2pCTKAR5bHiL /0sLU/AtUXiz+k6t0zI+yc+oXgH9ExlMM67K2r8yhwrrOxpAo8aZdPDFBymcSg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779690784; a=rsa-sha256; cv=none; b=VtDgs/KpNUKTN93jtCQBqfU/bea3HUj0jR0u7fJmBoO6WyXKRGqtaQt5sgN33ZRAxegilQ psTFuuhxGT1fXP90II/ZIG2oDrkaRDNmh38RxGyTQ3igdh57lA7FGVtEvUvnG3rNuWJhcc OXIgtpCJRgxEnw3QxXCEKRUG0mWFHgjRCkbaEgAEZuZUWnZ8kSyNnG4Kq3ewYM+TwC0+xB YqvrCz5AfGSf51paiL0/Xs49H8TK7mRUHlYPUjuZjWitwtFqasgNAoFWClW+WZRvUE7NnS kJnfjqPSt7ihcgo7ZxV1cbkPW92nGBSjXo7VgYqzBv8EgublE0ROS1g1wiyZvw== 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=1779690784; 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: in-reply-to:in-reply-to:references:references; bh=15PTMMQqPSlhHhhC+dCF1ze+7ZXUsFfYJKNxLqWHMNM=; b=p9C5OqP3/JwaBE2HG2OiTtGHOhyoIY5Q0VZH6PEldiv9uDpe1AqjXG3DLeQh1Dpii8KaRR OAPGXJdHt4+ZaUcgmr0gnxZKyxn5rzO7i6CwcRr7e8a0w9gnsiOGQ4AWObs0Kmp8Z1pvj/ nOCITxIK5ZydzGfXNTiFxDvwGh7QidrUQU1mPVgk3ST2tNlKiPzg1OzaTJXfylv57PNY9P t2FbSiqnkdufTsmZO3l/9ijtLadhJzGBq2Diop95lkXahP+8yPwiDEzCOUELq0REzthf14 GxskEELZb+5Q15GqMJ2ZcOy/i9ijBRX//Ox411GaOO1owszsvOMFn6gdNvsueA== Received: from [127.0.0.1] (unknown [127.0.1.132]) by freefall.freebsd.org (Postfix) with ESMTP id 5CAF44712; Mon, 25 May 2026 06:33:03 +0000 (UTC) (envelope-from rm@FreeBSD.org) Message-ID: Date: Mon, 25 May 2026 09:33:02 +0300 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 User-Agent: Mozilla Thunderbird Subject: Re: git: 11d69a4558de - main - LinuxKPI: 802.11: add support for suspend/resume To: "Bjoern A. Zeeb" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <6a130a94.1c630.6dcfa76a@gitrepo.freebsd.org> Content-Language: en-US From: Ruslan Makhmatkhanov In-Reply-To: <6a130a94.1c630.6dcfa76a@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Bjoern A. Zeeb wrote on 5/24/26 5:26 PM: > The branch main has been updated by bz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=11d69a4558de2a5427d8191caed315c5f7e9a5d6 > > commit 11d69a4558de2a5427d8191caed315c5f7e9a5d6 > Author: Bjoern A. Zeeb > AuthorDate: 2025-04-09 18:00:20 +0000 > Commit: Bjoern A. Zeeb > CommitDate: 2026-05-24 01:15:02 +0000 > > LinuxKPI: 802.11: add support for suspend/resume > Thank you, thank you, thank you! Works fine there with iwlwifi on Thinkpad X13. [...] -- Regards, Ruslan T.O.S. Of Reality From nobody Mon May 25 07:30:36 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 4gP6xB6snnz6dps7; Mon, 25 May 2026 07:30:38 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gP6xB6J5vz3fTR; Mon, 25 May 2026 07:30:38 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779694238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DG/VzkxDQWFFHbdmYJ4LBkhQE3zCBH04rq0QB/CcYt4=; b=EAG71huU5QurK7+bTBViEU442P+YX1e1iJGaaMzBeUQvoAlVE2BdiUX+CpAFwXyCftdfV3 8Q1mwOIDiWMo5mm7aVEFIAv2RBehVmd06MgD734+J2GJ3McYg3ObRXoKxmTSqLX9DkjdR9 PB5Ei8yAq27gs0GhSLjiol8kxiPh+yswlk4OCZdSCHWsW+ukb3haoHDY9J7FrU5TZLj4Lx 8FpheJmBak7FAJfSH0WpknMu0hGNLK6WJF858XRgCZk9tGOCKb3L0ix96jyqMu5IWTiElp Mnd0wg8Kvwk2uO7XVc4s4uTf83bK4khS8fMn6LDPEuTVK0TRp7nsCXCg/zuREA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779694238; a=rsa-sha256; cv=none; b=Xbh6dqhshK0ayI/rBFFcA5MPZ8dLkkhFnAOOcKrjhLHajzsvUuxs2FIg4VdGYFY/bdgc+9 xWeYHGn9B6a1LFnu6fVJ9+SfNKA8yoO5C/qdm1VwCa1Z4PvCaBGlEYZmIjOzBxsmr820Nt 0A61I4B0XlcPqiF/zwYl+gTjW65qqxr0QajyI5+jYNHPvPl8OifEX94Ok+zt1WtSbcXPkp Y7at7RvdrX3Z1AEuGN0W5wk8YXHU26I8PocdGUCuDx+knw+lciY0/wBdkJcpWp/bvXw9Nj 4KOeM22B4f/nY2LQUucAi2ceJqd3IXM9iXQN3r7OF62e8FVwacLl62ELXYvEcw== 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=1779694238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DG/VzkxDQWFFHbdmYJ4LBkhQE3zCBH04rq0QB/CcYt4=; b=xmS2Z3iVzNmsDgzYZgB30ELaTz53ScvegxGZcOCXuiyQphP/cxgIBJBxmdTtu2j2zlUNAd QWY1q6ChSa+A4dJljhkucAn2ayQgvAwWULMBCJlQvy59UTO0+4D7wBzbnfNOt+G/7sLqJ3 cYcbp0DMLTmnExVhCTAzf0N/t0A4QS/OoI/5LxXdiujlCUFGxcgK/diMg+y2qeWDg0/yS5 72MtV2EM7R1FQK+OcriKG9sFrvbZ5G2mMky5R4WBtbjC7ZfZHM/W6mhNuhqeYzdHhr/Wcq KCE1Gx0Kqly4dciq/a3KrqfpLcMSXpYRj8wN47uHVgBVHo9fibMAczDF2aa6Jg== Received: from ltc.des.dev (2a01cb0585070b00922e16fffef1acef.ipv6.abo.wanadoo.fr [IPv6:2a01:cb05:8507:b00:922e:16ff:fef1:acef]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gP6xB5FJHzNbh; Mon, 25 May 2026 07:30:38 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id 0704268AAE; Mon, 25 May 2026 09:30:36 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Jilles Tjoelker Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 1df431576f99 - main - sh/tests: Cut down builtins/read12.0 by 2 seconds In-Reply-To: (Jilles Tjoelker's message of "Sun, 24 May 2026 21:41:01 +0200") References: <6a120625.45836.5e8588e2@gitrepo.freebsd.org> <86h5nx3e8b.fsf@ltc.des.dev> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Mon, 25 May 2026 09:30:36 +0200 Message-ID: <865x4c2bfn.fsf@ltc.des.dev> 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: quoted-printable Jilles Tjoelker writes: > Dag-Erling Sm=C3=B8rgrav writes: > > Please revert the non-functional parts of this change. > Please explain what you are worried about in the change. Is this about > false positives or false negatives? The purpose of a test is to reliably fail if the functionality it tests is broken. Your change turns my test from one that is fairly certain to fail if the timeout functionality is broken to one that has a reasonable chance of passing regardless. What's more, you justify the change with a logical argument so fallacious that you _still_ refuse to explain it. All that just to save yourself a couple of seconds once in a while, even after I showed you how to save much more than two seconds simply by enabling parallelism. Please revert, or I will. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Sat May 23 19:05:49 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 4gPCMy3tKMz6f8tQ; Mon, 25 May 2026 10:50:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gPCMy3D4Wz3Fby; Mon, 25 May 2026 10:50:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779706238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B8jNrfqciN0S49rRNT7tmRQYIxpRFxyIYn1u3XE7ZNM=; b=ctRD6M5ER8POdPlNoPSyznMqF2Ad6Ev9cBsi1Dpu2ai0Mnth6e/tviNI5L/B2uOf0KlMB3 ADh2OZE4x6hSA4PPgzOcGvtPhJ3zrzULR+Enqh2oGTKHk4J7mVatrc66wTCFVTxI2ssu/r qRLEJ+q5sqm6yyn8V6edMDCdHpuPmbqjdWp+iokPjMzpKlBG5lZ9AdAiOsjMaOy9qg/mTX tkb+vdYaetviA4w9rLkFIUmxbQtLG4PZsUW4NhBHz3xujYAyLCWNPIGjfIwNY9QdZvxBVr 3kzDieHyfTZyG7C9XvMSogRGp4JRaNA2+P1xfkwM1DEaxekTSyGZ4v+O7h8P6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779706238; a=rsa-sha256; cv=none; b=ZlAZjEMXRPuWLwz1wEJLyPfNe2ZnWUgYHkBblMn/icQsmiZ1B12RPnKmDJ5iCGco+5YAn7 5+PpuIg0YW8iMwtZJWESDrJsA+MCo+8AU6iW4EFZojz7ZAu8D3UVO+G3rYMVMObdFiQVA2 7p9bXTKzKQaP+GJEs2F/BNWsythdTCMN6cEtVgOLI6D2EzdTW9cY9E/lA5nahLsEoJeDM+ ZVynz+8P8e2yUIIVytgW3n420a2NFWxd3UB2MEgoqMluAK1Q2yjvkhWefZDE6pLYL72WuK L1KdFQI83Q+yAN1HDe/dDGU6EuC2LfraWVA3d2snA3NRiHclo6mmTIgNQyI/QQ== 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=1779706238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B8jNrfqciN0S49rRNT7tmRQYIxpRFxyIYn1u3XE7ZNM=; b=dq6BCMkoGnsS19vbJ5opma5sPpVwGSdEF/om4GmjZhhpBnYMwRf2/jzmGJD40aV8YxnCxj Z+iMvdmtegkt7rtMpwM7244kWvB2tZK4DaFMqQqdYXpmQvqw77GPJjgQU+9D4J5fYRnuvB UvsjRu5GNhMi1lKnFLmrG8PVjCMRdt4Hbl8SdcmXhxVvXFja0iYN1dPprqEm7W/huFLi7P QScCvYB0gKncNUaOXoKjgY//mzQHCRVGujzv5faSKkxqkbpZr3Uf6Vk794il/sZ/1H3Gy/ n/RbGgDhjIE6IHY1ZMfD13axiJ7QZ1JV3fAL3XI9j+d+KF41byu/uAbNC1veGQ== Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (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 ECDSA (prime256v1) client-digest SHA256) (Client CN "tensor.andric.com", Issuer "E7" (not verified)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gPCMy1mBtzjw5; Mon, 25 May 2026 10:50:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtpclient.apple (bladnoch-wifi.home.andric.com [192.168.0.21]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id A875C2EE88; Sat, 23 May 2026 21:05:49 +0200 (CEST) Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3826.700.81.1.8\)) Subject: Re: git: 700637cbb5e5 - main - Merge llvm-project main llvmorg-21-init-19288-gface93e724f4 From: Dimitry Andric In-Reply-To: <20260523142311.GA2758@zxy.spb.ru> Date: Sat, 23 May 2026 21:05:49 +0200 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <55025A7D-FB49-4E82-89C5-656598CBF71D@FreeBSD.org> References: <69eccd4e.36ab8.fd16100@gitrepo.freebsd.org> <20260522163423.GA39748@zxy.spb.ru> <4C91123F-5F4A-4ED0-B798-E474B8E219A2@FreeBSD.org> <20260523142311.GA2758@zxy.spb.ru> To: Slawa Olhovchenkov X-Mailer: Apple Mail (2.3826.700.81.1.8) On 23 May 2026, at 16:23, Slawa Olhovchenkov wrote: >=20 > On Fri, May 22, 2026 at 11:47:01PM +0200, Dimitry Andric wrote: >> On 22 May 2026, at 18:34, Slawa Olhovchenkov wrote: >>>=20 >>> On Sat, Apr 25, 2026 at 02:18:54PM +0000, Dimitry Andric wrote: >>>=20 >>>> The branch main has been updated by dim: >>>>=20 >>>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D700637cbb5e582861067a11aaca4d053= 546871d2 >>>>=20 >>>> commit 700637cbb5e582861067a11aaca4d053546871d2 >>>> Merge: 6243d755fb82 3f709e42e3be >>>> Author: Dimitry Andric >>>> AuthorDate: 2025-12-07 15:15:22 +0000 >>>> Commit: Dimitry Andric >>>> CommitDate: 2026-04-25 14:08:55 +0000 >>>>=20 >>>> Merge llvm-project main llvmorg-21-init-19288-gface93e724f4 >>>>=20 >>>> This updates llvm, clang, compiler-rt, libc++, libunwind, lld, = lldb and >>>> openmp to llvm-project main llvmorg-21-init-19288-gface93e724f4, = the >>>> last commit before the upstream release/21.x branch was created. >>>>=20 >>>> PR: 292067 >>>> MFC after: 1 month >>>=20 >>> This is broke at least graphics/krita >>> I mean __type_traits/is_integral.h is incorrect now: template >> _Tp> struct __libcpp_is_integral defined only for >>> !__has_builtin(__is_integral) >>=20 >> Please try the patch in . >=20 > Failed > % ls -l /poudriere/ports/default/graphics/krita/files/ > total 6 > -rw-r--r-- 1 root wheel 525 Mar 10 2025 = patch-cmake_modules_FindOpenJPEG.cmake > -rw-r--r-- 1 root wheel 384 Mar 10 2025 = patch-cmake_modules_pyproject.toml.in > -rw-r--r-- 1 root wheel 2842 May 23 17:13 = patch-libs_global_KisHalfTraits.h > -rw-r--r-- 1 root wheel 639 Mar 10 2025 = patch-plugins_impex_CMakeLists.txt >=20 >=20 > In file included from = /wrkdirs/usr/ports/graphics/krita/work/krita-5.2.14/libs/pigment/KoColor.c= pp:9: > In file included from = /wrkdirs/usr/ports/graphics/krita/work/krita-5.2.14/libs/pigment/KoColor.h= :16: > In file included from = /wrkdirs/usr/ports/graphics/krita/work/krita-5.2.14/libs/pigment/KoColorSp= aceTraits.h:14: > In file included from = /wrkdirs/usr/ports/graphics/krita/work/krita-5.2.14/libs/pigment/KoColorSp= aceMaths.h:109: > = /wrkdirs/usr/ports/graphics/krita/work/krita-5.2.14/libs/global/KisHalfTra= its.h:33:10: error: no template named '__libcpp_is_integral'; did you = mean '__libcpp_is_final'? > 33 | struct __libcpp_is_integral > | ^~~~~~~~~~~~~~~~~~~~ > | __libcpp_is_final Strange, it builds just fine for me. Can you post the = /wrkdirs/usr/ports/graphics/krita/work/krita-5.2.14/libs/global/KisHalfTra= its.h file? -Dimitry From nobody Mon May 25 13:47:36 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 4gPHJ86X0fz6dxTs for ; Mon, 25 May 2026 13:47: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gPHJ85wrmz3YZ1 for ; Mon, 25 May 2026 13:47:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779716856; 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=Cs2jzE/RIm0P/uDhQdhsB+w0KhF8mruSRlKAxiKf8ec=; b=rpJLaelDEH1w4S8o3jwZ1QJcpHa1Fgke9NORFJVOq3WV1GlLA6TeCo2ELful++FMae4yG6 y14ItNm1S5qQN2owwUf5l1/PX/bz0rq5RdUqHw5jSvTMtEKQ2KomBr4nD81uWJZ7m/e8oM XoCcPa5rXBJMVtCZFjepvNVkBvQG8EzfoZeLasbtu6ZS9W2NC+ucGhEdN/5Es5ENTsBrnw vzQpfrag1UgVlevwRMJDQfFapfunxts0iRzCLGcxfBjvX7rdI0V1NlmHQmqJbweY0ljx12 OQg+qBE+WbIs4/FsjD7R7Cc5/TYPqCl7sNMXOpQFV3BstFlRb2je09JsAhoIJQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779716856; a=rsa-sha256; cv=none; b=RH0Fz1PwT99ZNzT2y/bYHaNDXUZ8ee1EDN7FB8jrLzKB1ljSQwGa8KbnQhhO6u1QDFRUBA H0+KIJ7o9lkR91AAuB+gAWatZSW7FYqD/tdn3vIqvwXR+37zUuWhOv3W1uir2Ov3TG4ORz oWCeof9ULif7yIJ2IstbptB0+UAQ0jTtYN/TWZFSHCMzkkY8L0EkVqgmOwOddxrzFEFRnO zCZqw0CQ0edpA/sTLo2rgUFBI1flrfav5tGffM5UBU6AVsMpT6MMU5hUizxxs5fbtB1OYc L1+rZFVrtykl/1kLuiwFSjPiimWKFsHJfgQ++9+36lH19SSSL4KarZhCQ/1oKQ== 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=1779716856; 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=Cs2jzE/RIm0P/uDhQdhsB+w0KhF8mruSRlKAxiKf8ec=; b=WP+VOAXUk5bk/OryHhyovO0KaOJwaxHQx/YsTPm1QDafEuVD0eVRvK2Zc49HA7JWVD5BVX 0/YQhtmSobZIFCDzRv1xUQLwRo1NOmjtbaLJ+G/DNwFLjzcFjWW14mvCIEzyt4x5kOPeyU OJN9mK3+J3jo6NqpMPaxT4bTpilZYNOiwssB3Sk8jGrr/dAlFx/oXQ9nwjCq538A9jV8Ut qbMf1ubuRd7IeHrIWhYNui4TMb2H6UEVuJ3uIpZnvMRroBea4GnydZBi38Q2f3JTu9T9JI TWSm7MVVXMdUCDFPPa2VWJIh2FbVCuy6SerQwG9k9Tq+lNguyDDPAq3Nw5ipOw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPHJ85T6Xzl2y for ; Mon, 25 May 2026 13:47:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 471e6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 13:47:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: f05fb5157ba1 - main - vtfontcvt: Return error from write_fnt_source 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f05fb5157ba1291ee5019bacece8d1e98ea95b35 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 13:47:36 +0000 Message-Id: <6a1452f8.471e6.4fa5761a@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f05fb5157ba1291ee5019bacece8d1e98ea95b35 commit f05fb5157ba1291ee5019bacece8d1e98ea95b35 Author: Ed Maste AuthorDate: 2026-05-22 18:37:51 +0000 Commit: Ed Maste CommitDate: 2026-05-25 13:46:58 +0000 vtfontcvt: Return error from write_fnt_source Previously write_fnt_source always returned 0, silently discarding errors. Return rv so that errors set vtfontcvt's shell exit appropriately. Sponsored by: The FreeBSD Foundation --- usr.bin/vtfontcvt/vtfontcvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c index 1e388ef36276..f39076b09be6 100644 --- a/usr.bin/vtfontcvt/vtfontcvt.c +++ b/usr.bin/vtfontcvt/vtfontcvt.c @@ -987,7 +987,7 @@ done: if (rv != 0) perror(filename); fclose(fp); - return (0); + return (rv); } static void From nobody Mon May 25 13:56:21 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 4gPHVM1hjyz6dyl4; Mon, 25 May 2026 13:56:27 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gPHVL67kRz3Zdq; Mon, 25 May 2026 13:56:26 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779717386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=FJIOH5bMQFjIo9ch6A1QKIc6QH19CeKyuqRxA+bEx/Q=; b=ZIHx7mN7OcThsvu0H8WyH/VdRWbBaRu4Pyc4ZTIYiJx5mdpKeyKNioXaCqgeHdrhMBchva o0q48QZHbdrMGROZeool6HgL/8V/P0x3Xe9OFr+0dZYsdVAoGuyif+KgGk7kWqsyz871Ku BHiY4FaMkH5+Wa4j6lCXviJMx6Flzsx9Xh3dzxHdBH28sI6rzi+n+iLcQB1idaFOP/JE0h EUwxIYS6FPI6NDSLhdmktucuTMdRZwCEpGXJFjzXSR+IiRc8+I2zLNZbXbAr7vcs96KJ3s l6lHIXsbGSSXBs3n5Nw5eqSNgHJrgM7MDn/rKzoEytGZcJa5iZK3KLB2QillWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779717386; a=rsa-sha256; cv=none; b=tYhBecDsXeZZ9ulU301R9Ufg88ZAPz0v5eMi/Uu1WUussuLmuAib8xuDMtJKVtO9I3nctq DRnBMgnemWu0/asNsX3k56wunE6nKKdYliW6nCaATR/cQjDUKKYZkdNAlyoddu5rlZDIHh QEO3cxXtsaXX27NBNNgSVA3dhggC53krwxbqhDSB8/hu/7NjNnoj7xpSEqADm0n+aWJDlS xA230IFv3w13OhBhIUsyk/VFNkgUUk5PdPftYixuQWOke02u9MI7uVsbRDXVwBn/RZQhHN bMKIxbJxyDFS5TKncxsG8aLFpqdujjWGrcojuefoTWPmK4/3HXiY6r2kjOTZow== 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=1779717386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=FJIOH5bMQFjIo9ch6A1QKIc6QH19CeKyuqRxA+bEx/Q=; b=hz66V/DpQc5WdN4E6I+170hMlnzqfoer1fiz23SJpRLL+DnvA5qrg0xJ6eEwA06ZcGn/JY Aet0XeFwHlzc/qKT5agwZzCYe+tp0+YgPTZmPnS95g9gZj+OAbt5ss++s/tvdVTleq04YX SAvfKN6axco6f+qaxuJlvGkcIvUjXgM44vNl5v6A7dekH993E+g3I6Ze1w0Avte26Ascw7 gBKP0MoJGeBQu8/Cr32OnEhPiWLVh0KBbgnw7t26MVB48PGraAF5Ai4hHSXM9JcsvRispy GYZqduuwhACGxQACFb1Lg7rosNJlkyodU3Y+/WqeBxoQ/iWlVF9ugeXhhP0hjQ== Received: from [172.16.209.2] (unknown [188.243.165.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: fluffy) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gPHVL0XNJzn3X; Mon, 25 May 2026 13:56:25 +0000 (UTC) (envelope-from fluffy@FreeBSD.org) Message-ID: <0476b229-a515-4f5c-93e1-b796cc0a92e6@FreeBSD.org> Date: Mon, 25 May 2026 16:56:21 +0300 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 User-Agent: Mozilla Thunderbird Subject: Re: git: 700637cbb5e5 - main - Merge llvm-project main llvmorg-21-init-19288-gface93e724f4 To: Slawa Olhovchenkov , Dimitry Andric Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <69eccd4e.36ab8.fd16100@gitrepo.freebsd.org> <20260522163423.GA39748@zxy.spb.ru> <4C91123F-5F4A-4ED0-B798-E474B8E219A2@FreeBSD.org> <20260523142311.GA2758@zxy.spb.ru> <55025A7D-FB49-4E82-89C5-656598CBF71D@FreeBSD.org> <20260525123145.GB2758@zxy.spb.ru> Content-Language: ru, en-GB From: Dima Panov Autocrypt: addr=fluffy@FreeBSD.org; keydata= xsFNBEp+xiUBEAD01RkOYcyzU/Fnam2FI7PPwYqW00SwVmfUHihvVniiaMwzaYzchb+mzSha NsqRgjIN/i59OBpnS25OXMLEpQP7jDJnY2xKyJN2H4qn1HPHkF9cYuqvqkm+r5459g+2ZoGY 9Sr1PA0XSzXJMSQ1nRK3cFfqlN/L2//P36U5VuOWXGZUTwr/n2B/N0HAsYsqDOdjofLg7x9z 8p8elqwJbT/O4ltg8JBVAnof+FzqefYW4CzqkHRjq/9ORiGYh14ST9ECsCaVpfdDUTor0wgp JqzCN1HsQcHqgdMmOqigWIgN7Eg4MRQU3LDCISrNJ/45zvcKUXR0RHOjnSuflYba74q58XhZ 4eCTqHeMHjA8st4IWRzy9l0V4RunnZxjOTb806jyIhdxcb2m8o5tXwsqjf0TQ7vYowDHrQ6g XlhPg4Jvvwf+BwlB2p+w7Cs/Y9QA0YHnIOIVZAwU1wv66YSI9IDL2AbnY2gQGx+dkHiC3S5L G8HcPrMcjayyThKKIi5KQsWa3snFeK5ky+cRpVEOPQfUXFOas++91v90Xe9j+lsmRofsyvuy gzoaZE2fud0kCsOgYEg+kiLPlQicNAx5IToOs8BrVFLcxmbPKuVBfbLdWsYLjXGzbXEmzV9f NDZ1r1uNmVema8YYCiNjUDZhxIfKt8nbp6cx8UgVLGRVDEfXeQARAQABzTdEaW1hIFBhbm92 IChGcmVlQlNELk9SRyBDb21taXR0ZXIpIDxmbHVmZnlARnJlZUJTRC5PUkc+wsF2BBMBAgAg BQJKfsYlAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ+4ugndU5jyk6dhAArHclTYjw VRjDnoRfO3Zfj9Ssab9Vrbo7DNFWeAqPE3OTCmiq9Q0fzRHzmhVyedYMm9qNA3i0J1De3KTn LanXOrBIqsmmZpSqmrp/xXdZngDLW5H6hpE0f2PeAPwxrb9uBQax8WMR7Z4STSHAP4GRjve3 0wNNS0MlawGllcs9VKRxG5PsDA8k3ACTSjdpQ76RWldORN4LA8M40yHRX377SGMzO+XsCeOw ad65GKyLrx+6Gnd3PMOjVCJCrqd04Jgqg9G0xKNImchwIZ5ulx9jAt+ixfNbY6hwslleqimr 2t5+MMqo6dRrvJ+BsR8NHt9vGi2Jy4+4smg05fR18fck0Sk4vCYyVvtvnOk3qZf0F8zJu06G cjWWC2ZbDPbmksWXFIMxoJbyVxK55xOqcFs0t12sR6gbVJb8Nb88WrQub3MgePyMF6R3Tkfa OqkjvQur1xC2AXESTxtJw1FkdGSb3UopNKgvSPHSLFW8B0LbyDxdYRTRWPGGEUhFP6tdXi5R vb1210ks2EQAqF4Cm3iRIhYgtZvQqQgMSiO9fVyeJ0U6dYGDtg2Boi+NtXKRdmtL7pRSnI3n fAbVJ05Hhd7PBnJeob6R08nHRo9DdAG7o8ToM+egUAuEsEvoRV+v4f6k3mShdxE7gG/anwVy eh3n6LGwg9KHDr1X2FODsLLxgUjOwU0ESn7GJQEQAMBTMHQgb0vcPMAiRvb357ihlh/YYA22 FXj4p3XTrDlBlRL0QCRq1I8XDeQmL3mG3s3NBtDXSefnNM06jZ3XCAfHIDBdxJJvQZZCXfvL p/JK7nnEuqoeqT6/oKs1MeZVdUnvh1nZhphs+Z6dl01GIE8YDpzT1JMD2f3G9PHChGi3Ddzq m3VdXt/87khYJkPbaf6EN5+vDthKgMjba8jwbQ+7IUPqkfnNFIZS6irZ2LYb79BLNI5JSl9l ReSfEX2d8ByQlLzuf0TS4voy3nWGeCyj6BIOMiRSxg+hZmJLYxhNkyK4GQVCt/rLT7dIfBQM syBbX0Qw2NOcfba9VgdPZBgdrawwB4/xF9SA3NB0J0lUjhjpH9iG8NxlpleEg8OSUApyFZEJ q2A/flns4kKzNH7AGYDOFORytDzA3qkgCJrZ7nzQSsdtZ2qbyAoze0tl+YrShJhOcmQBtFem omhWVeJ8T/Bw1KH8M1ihrENBTSzYzLvN18YjNP6P0Dh/7Zda5yYI8fNqd84K3Uq5xBiI0S6+ qxViw84z2tJj8TxiNqFAk7Tbeo2Ximtq7uQ9UnFRSK3jw96yi19KU9rQQZs0xUjN5gn/tF5l BZWKjwuZCkcOiI0EWHAR+ATAEsFNXcuoC9CAGK5HFW4nI4WtE3pv1KYvivlGtF1wzf0Qrhye RrmxABEBAAHCwV8EGAECAAkFAkp+xiUCGwwACgkQ+4ugndU5jymgKg//RvnI7zEDKv6nQUqK RyLawPTrCKCtQ2vSoWyTNgRB6byNS1w5wNSAMnqaESx2bdhauaxe167VEJYqgQy241yFslpC 6v/xlH25Ppos+Jg6AKaQG/JABHO6Co4tHtBbNmM+14HESxAodA4NJuEU19iIPjRhUKC8F8R9 xBmW1uLpPiljU9Km0P3EIKjAdtdZNeMLhwsbSHBwJROFrxFGiTzWNREWZoZpQxgSbHYhwYbx HEbJi1cybl9IQvSGHrysctZsxD04Jxh6ogaziiT8aV6ear6BNh008yRf61FvrinfG3USLR3i JO8aHap4QGCPjZ3cyT+DEq8/zVfDdeidTeNEhSgRKk856RcA+yAE79KYdKkvmDUiC8poAJ7F GEYHMB+g/1+LczCr2g9GYkiB/53boYfU9esYYlarxCgedCrwXv6T48FZ3xxoH3XJ2KV8K6M8 CUb04jj3kEeCwq+R6Bk2ZXrnMzyQmmn223X+Zp89B/gchH32JY8y3j7BICcoZmgMu62XNMgW I/hRgfi3JlVCne6XPj3/w00JYG7vo+eTJOflqYr3WRTPYh7DxzYtshZswHmmkZtwizUQUZzF 9dX2CM8nY7cKucEmtcnUpjGwXMOufa/DmCTlk8ggRZ0ukCUZOlIA4ILxp95sS2oqyucARv+p wMWvrqJ/LfbZexSsIjI= Organization: FreeBSD.org In-Reply-To: <20260525123145.GB2758@zxy.spb.ru> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------b7s47nzANLJQrInBXE4Y1fRu" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------b7s47nzANLJQrInBXE4Y1fRu Content-Type: multipart/mixed; boundary="------------tItyLYUh4cde86ScWF4tnazj"; protected-headers="v1"; hp="clear" Message-ID: <0476b229-a515-4f5c-93e1-b796cc0a92e6@FreeBSD.org> Date: Mon, 25 May 2026 16:56:21 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 700637cbb5e5 - main - Merge llvm-project main llvmorg-21-init-19288-gface93e724f4 To: Slawa Olhovchenkov , Dimitry Andric Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <69eccd4e.36ab8.fd16100@gitrepo.freebsd.org> <20260522163423.GA39748@zxy.spb.ru> <4C91123F-5F4A-4ED0-B798-E474B8E219A2@FreeBSD.org> <20260523142311.GA2758@zxy.spb.ru> <55025A7D-FB49-4E82-89C5-656598CBF71D@FreeBSD.org> <20260525123145.GB2758@zxy.spb.ru> Content-Language: ru, en-GB From: Dima Panov Autocrypt: addr=fluffy@FreeBSD.org; keydata= xsFNBEp+xiUBEAD01RkOYcyzU/Fnam2FI7PPwYqW00SwVmfUHihvVniiaMwzaYzchb+mzSha NsqRgjIN/i59OBpnS25OXMLEpQP7jDJnY2xKyJN2H4qn1HPHkF9cYuqvqkm+r5459g+2ZoGY 9Sr1PA0XSzXJMSQ1nRK3cFfqlN/L2//P36U5VuOWXGZUTwr/n2B/N0HAsYsqDOdjofLg7x9z 8p8elqwJbT/O4ltg8JBVAnof+FzqefYW4CzqkHRjq/9ORiGYh14ST9ECsCaVpfdDUTor0wgp JqzCN1HsQcHqgdMmOqigWIgN7Eg4MRQU3LDCISrNJ/45zvcKUXR0RHOjnSuflYba74q58XhZ 4eCTqHeMHjA8st4IWRzy9l0V4RunnZxjOTb806jyIhdxcb2m8o5tXwsqjf0TQ7vYowDHrQ6g XlhPg4Jvvwf+BwlB2p+w7Cs/Y9QA0YHnIOIVZAwU1wv66YSI9IDL2AbnY2gQGx+dkHiC3S5L G8HcPrMcjayyThKKIi5KQsWa3snFeK5ky+cRpVEOPQfUXFOas++91v90Xe9j+lsmRofsyvuy gzoaZE2fud0kCsOgYEg+kiLPlQicNAx5IToOs8BrVFLcxmbPKuVBfbLdWsYLjXGzbXEmzV9f NDZ1r1uNmVema8YYCiNjUDZhxIfKt8nbp6cx8UgVLGRVDEfXeQARAQABzTdEaW1hIFBhbm92 IChGcmVlQlNELk9SRyBDb21taXR0ZXIpIDxmbHVmZnlARnJlZUJTRC5PUkc+wsF2BBMBAgAg BQJKfsYlAhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQ+4ugndU5jyk6dhAArHclTYjw VRjDnoRfO3Zfj9Ssab9Vrbo7DNFWeAqPE3OTCmiq9Q0fzRHzmhVyedYMm9qNA3i0J1De3KTn LanXOrBIqsmmZpSqmrp/xXdZngDLW5H6hpE0f2PeAPwxrb9uBQax8WMR7Z4STSHAP4GRjve3 0wNNS0MlawGllcs9VKRxG5PsDA8k3ACTSjdpQ76RWldORN4LA8M40yHRX377SGMzO+XsCeOw ad65GKyLrx+6Gnd3PMOjVCJCrqd04Jgqg9G0xKNImchwIZ5ulx9jAt+ixfNbY6hwslleqimr 2t5+MMqo6dRrvJ+BsR8NHt9vGi2Jy4+4smg05fR18fck0Sk4vCYyVvtvnOk3qZf0F8zJu06G cjWWC2ZbDPbmksWXFIMxoJbyVxK55xOqcFs0t12sR6gbVJb8Nb88WrQub3MgePyMF6R3Tkfa OqkjvQur1xC2AXESTxtJw1FkdGSb3UopNKgvSPHSLFW8B0LbyDxdYRTRWPGGEUhFP6tdXi5R vb1210ks2EQAqF4Cm3iRIhYgtZvQqQgMSiO9fVyeJ0U6dYGDtg2Boi+NtXKRdmtL7pRSnI3n fAbVJ05Hhd7PBnJeob6R08nHRo9DdAG7o8ToM+egUAuEsEvoRV+v4f6k3mShdxE7gG/anwVy eh3n6LGwg9KHDr1X2FODsLLxgUjOwU0ESn7GJQEQAMBTMHQgb0vcPMAiRvb357ihlh/YYA22 FXj4p3XTrDlBlRL0QCRq1I8XDeQmL3mG3s3NBtDXSefnNM06jZ3XCAfHIDBdxJJvQZZCXfvL p/JK7nnEuqoeqT6/oKs1MeZVdUnvh1nZhphs+Z6dl01GIE8YDpzT1JMD2f3G9PHChGi3Ddzq m3VdXt/87khYJkPbaf6EN5+vDthKgMjba8jwbQ+7IUPqkfnNFIZS6irZ2LYb79BLNI5JSl9l ReSfEX2d8ByQlLzuf0TS4voy3nWGeCyj6BIOMiRSxg+hZmJLYxhNkyK4GQVCt/rLT7dIfBQM syBbX0Qw2NOcfba9VgdPZBgdrawwB4/xF9SA3NB0J0lUjhjpH9iG8NxlpleEg8OSUApyFZEJ q2A/flns4kKzNH7AGYDOFORytDzA3qkgCJrZ7nzQSsdtZ2qbyAoze0tl+YrShJhOcmQBtFem omhWVeJ8T/Bw1KH8M1ihrENBTSzYzLvN18YjNP6P0Dh/7Zda5yYI8fNqd84K3Uq5xBiI0S6+ qxViw84z2tJj8TxiNqFAk7Tbeo2Ximtq7uQ9UnFRSK3jw96yi19KU9rQQZs0xUjN5gn/tF5l BZWKjwuZCkcOiI0EWHAR+ATAEsFNXcuoC9CAGK5HFW4nI4WtE3pv1KYvivlGtF1wzf0Qrhye RrmxABEBAAHCwV8EGAECAAkFAkp+xiUCGwwACgkQ+4ugndU5jymgKg//RvnI7zEDKv6nQUqK RyLawPTrCKCtQ2vSoWyTNgRB6byNS1w5wNSAMnqaESx2bdhauaxe167VEJYqgQy241yFslpC 6v/xlH25Ppos+Jg6AKaQG/JABHO6Co4tHtBbNmM+14HESxAodA4NJuEU19iIPjRhUKC8F8R9 xBmW1uLpPiljU9Km0P3EIKjAdtdZNeMLhwsbSHBwJROFrxFGiTzWNREWZoZpQxgSbHYhwYbx HEbJi1cybl9IQvSGHrysctZsxD04Jxh6ogaziiT8aV6ear6BNh008yRf61FvrinfG3USLR3i JO8aHap4QGCPjZ3cyT+DEq8/zVfDdeidTeNEhSgRKk856RcA+yAE79KYdKkvmDUiC8poAJ7F GEYHMB+g/1+LczCr2g9GYkiB/53boYfU9esYYlarxCgedCrwXv6T48FZ3xxoH3XJ2KV8K6M8 CUb04jj3kEeCwq+R6Bk2ZXrnMzyQmmn223X+Zp89B/gchH32JY8y3j7BICcoZmgMu62XNMgW I/hRgfi3JlVCne6XPj3/w00JYG7vo+eTJOflqYr3WRTPYh7DxzYtshZswHmmkZtwizUQUZzF 9dX2CM8nY7cKucEmtcnUpjGwXMOufa/DmCTlk8ggRZ0ukCUZOlIA4ILxp95sS2oqyucARv+p wMWvrqJ/LfbZexSsIjI= Organization: FreeBSD.org In-Reply-To: <20260525123145.GB2758@zxy.spb.ru> --------------tItyLYUh4cde86ScWF4tnazj Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 SGVsbG8hDQoNCk9uIDI1LjA1LjIwMjYgMTU6MzEsIFNsYXdhIE9saG92Y2hlbmtvdiB3cm90 ZToNCj4gT24gU2F0LCBNYXkgMjMsIDIwMjYgYXQgMDk6MDU6NDlQTSArMDIwMCwgRGltaXRy eSBBbmRyaWMgd3JvdGU6DQo+IA0KPj4gT24gMjMgTWF5IDIwMjYsIGF0IDE2OjIzLCBTbGF3 YSBPbGhvdmNoZW5rb3YgPHNsd0B6eHkuc3BiLnJ1PiB3cm90ZToNCj4+Pg0KPj4+IE9uIEZy aSwgTWF5IDIyLCAyMDI2IGF0IDExOjQ3OjAxUE0gKzAyMDAsIERpbWl0cnkgQW5kcmljIHdy b3RlOg0KPj4+PiBPbiAyMiBNYXkgMjAyNiwgYXQgMTg6MzQsIFNsYXdhIE9saG92Y2hlbmtv diA8c2x3QHp4eS5zcGIucnU+IHdyb3RlOg0KPj4+Pj4NCj4+Pj4+IE9uIFNhdCwgQXByIDI1 LCAyMDI2IGF0IDAyOjE4OjU0UE0gKzAwMDAsIERpbWl0cnkgQW5kcmljIHdyb3RlOg0KPj4+ Pj4NCj4+Pj4+PiBUaGUgYnJhbmNoIG1haW4gaGFzIGJlZW4gdXBkYXRlZCBieSBkaW06DQo+ Pj4+Pj4NCj4+Pj4+PiBVUkw6IGh0dHBzOi8vY2dpdC5GcmVlQlNELm9yZy9zcmMvY29tbWl0 Lz9pZD03MDA2MzdjYmI1ZTU4Mjg2MTA2N2ExMWFhY2E0ZDA1MzU0Njg3MWQyDQo+Pj4+Pj4N Cj4+Pj4+PiBjb21taXQgNzAwNjM3Y2JiNWU1ODI4NjEwNjdhMTFhYWNhNGQwNTM1NDY4NzFk Mg0KPj4+Pj4+IE1lcmdlOiA2MjQzZDc1NWZiODIgM2Y3MDllNDJlM2JlDQo+Pj4+Pj4gQXV0 aG9yOiAgICAgRGltaXRyeSBBbmRyaWMgPGRpbUBGcmVlQlNELm9yZz4NCj4+Pj4+PiBBdXRo b3JEYXRlOiAyMDI1LTEyLTA3IDE1OjE1OjIyICswMDAwDQo+Pj4+Pj4gQ29tbWl0OiAgICAg RGltaXRyeSBBbmRyaWMgPGRpbUBGcmVlQlNELm9yZz4NCj4+Pj4+PiBDb21taXREYXRlOiAy MDI2LTA0LTI1IDE0OjA4OjU1ICswMDAwDQo+Pj4+Pj4NCj4+Pj4+PiAgICBNZXJnZSBsbHZt LXByb2plY3QgbWFpbiBsbHZtb3JnLTIxLWluaXQtMTkyODgtZ2ZhY2U5M2U3MjRmNA0KPj4+ Pj4+DQo+Pj4+Pj4gICAgVGhpcyB1cGRhdGVzIGxsdm0sIGNsYW5nLCBjb21waWxlci1ydCwg bGliYysrLCBsaWJ1bndpbmQsIGxsZCwgbGxkYiBhbmQNCj4+Pj4+PiAgICBvcGVubXAgdG8g bGx2bS1wcm9qZWN0IG1haW4gbGx2bW9yZy0yMS1pbml0LTE5Mjg4LWdmYWNlOTNlNzI0ZjQs IHRoZQ0KPj4+Pj4+ICAgIGxhc3QgY29tbWl0IGJlZm9yZSB0aGUgdXBzdHJlYW0gcmVsZWFz ZS8yMS54IGJyYW5jaCB3YXMgY3JlYXRlZC4NCj4+Pj4+Pg0KPj4+Pj4+ICAgIFBSOiAgICAg ICAgICAgICAyOTIwNjcNCj4+Pj4+PiAgICBNRkMgYWZ0ZXI6ICAgICAgMSBtb250aA0KPj4+ Pj4NCj4+Pj4+IFRoaXMgaXMgYnJva2UgYXQgbGVhc3QgZ3JhcGhpY3Mva3JpdGENCj4+Pj4+ IEkgbWVhbiBfX3R5cGVfdHJhaXRzL2lzX2ludGVncmFsLmggaXMgaW5jb3JyZWN0IG5vdzog dGVtcGxhdGUgPGNsYXNzDQo+Pj4+PiBfVHA+IHN0cnVjdCBfX2xpYmNwcF9pc19pbnRlZ3Jh bCBkZWZpbmVkIG9ubHkgZm9yDQo+Pj4+PiAhX19oYXNfYnVpbHRpbihfX2lzX2ludGVncmFs KQ0KPj4+Pg0KPj4+PiBQbGVhc2UgdHJ5IHRoZSBwYXRjaCBpbiA8aHR0cHM6Ly9idWdzLmZy ZWVic2Qub3JnLzI5NTUwOT4uDQo+Pj4NCj4+PiBGYWlsZWQNCj4+PiAlIGxzIC1sIC9wb3Vk cmllcmUvcG9ydHMvZGVmYXVsdC9ncmFwaGljcy9rcml0YS9maWxlcy8NCj4+PiB0b3RhbCA2 DQo+Pj4gLXJ3LXItLXItLSAgMSByb290IHdoZWVsICA1MjUgTWFyIDEwICAyMDI1IHBhdGNo LWNtYWtlX21vZHVsZXNfRmluZE9wZW5KUEVHLmNtYWtlDQo+Pj4gLXJ3LXItLXItLSAgMSBy b290IHdoZWVsICAzODQgTWFyIDEwICAyMDI1IHBhdGNoLWNtYWtlX21vZHVsZXNfcHlwcm9q ZWN0LnRvbWwuaW4NCj4+PiAtcnctci0tci0tICAxIHJvb3Qgd2hlZWwgMjg0MiBNYXkgMjMg MTc6MTMgcGF0Y2gtbGlic19nbG9iYWxfS2lzSGFsZlRyYWl0cy5oDQo+Pj4gLXJ3LXItLXIt LSAgMSByb290IHdoZWVsICA2MzkgTWFyIDEwICAyMDI1IHBhdGNoLXBsdWdpbnNfaW1wZXhf Q01ha2VMaXN0cy50eHQNCj4+Pg0KPj4+DQo+Pj4gSW4gZmlsZSBpbmNsdWRlZCBmcm9tIC93 cmtkaXJzL3Vzci9wb3J0cy9ncmFwaGljcy9rcml0YS93b3JrL2tyaXRhLTUuMi4xNC9saWJz L3BpZ21lbnQvS29Db2xvci5jcHA6OToNCj4+PiBJbiBmaWxlIGluY2x1ZGVkIGZyb20gL3dy a2RpcnMvdXNyL3BvcnRzL2dyYXBoaWNzL2tyaXRhL3dvcmsva3JpdGEtNS4yLjE0L2xpYnMv cGlnbWVudC9Lb0NvbG9yLmg6MTY6DQo+Pj4gSW4gZmlsZSBpbmNsdWRlZCBmcm9tIC93cmtk aXJzL3Vzci9wb3J0cy9ncmFwaGljcy9rcml0YS93b3JrL2tyaXRhLTUuMi4xNC9saWJzL3Bp Z21lbnQvS29Db2xvclNwYWNlVHJhaXRzLmg6MTQ6DQo+Pj4gSW4gZmlsZSBpbmNsdWRlZCBm cm9tIC93cmtkaXJzL3Vzci9wb3J0cy9ncmFwaGljcy9rcml0YS93b3JrL2tyaXRhLTUuMi4x NC9saWJzL3BpZ21lbnQvS29Db2xvclNwYWNlTWF0aHMuaDoxMDk6DQo+Pj4gL3dya2RpcnMv dXNyL3BvcnRzL2dyYXBoaWNzL2tyaXRhL3dvcmsva3JpdGEtNS4yLjE0L2xpYnMvZ2xvYmFs L0tpc0hhbGZUcmFpdHMuaDozMzoxMDogZXJyb3I6IG5vIHRlbXBsYXRlIG5hbWVkICdfX2xp YmNwcF9pc19pbnRlZ3JhbCc7IGRpZCB5b3UgbWVhbiAnX19saWJjcHBfaXNfZmluYWwnPw0K Pj4+ICAgIDMzIHwgICBzdHJ1Y3QgX19saWJjcHBfaXNfaW50ZWdyYWw8aGFsZj4NCj4+PiAg ICAgICB8ICAgICAgICAgIF5+fn5+fn5+fn5+fn5+fn5+fn5+DQo+Pj4gICAgICAgfCAgICAg ICAgICBfX2xpYmNwcF9pc19maW5hbA0KPj4NCj4+IFN0cmFuZ2UsIGl0IGJ1aWxkcyBqdXN0 IGZpbmUgZm9yIG1lLiBDYW4geW91IHBvc3QgdGhlIC93cmtkaXJzL3Vzci9wb3J0cy9ncmFw aGljcy9rcml0YS93b3JrL2tyaXRhLTUuMi4xNC9saWJzL2dsb2JhbC9LaXNIYWxmVHJhaXRz LmggZmlsZT8NCj4+DQo+IA0KPiBJIG1lYW4gcGF0aCBwcm9ibGVtcyBpbiBwYXRjaCBmaWxl Og0KPiAjIGZpbmQgL3dya2RpcnMvdXNyL3BvcnRzL2dyYXBoaWNzL2tyaXRhL3dvcmsvIC1u YW1lICIqS2lzSGFsZlRyYWl0cy5oKiIgLWxzDQo+ICAgMzY1ODEgICAgICAgIDIgLXJ3LXIt LXItLSAgICAxIHJvb3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoZWVsICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgNDMwIE1heSAyNSAxMjoyMyAvd3JrZGlycy91 c3IvcG9ydHMvZ3JhcGhpY3Mva3JpdGEvd29yay9rcml0YS01LjIuMTQvYi9ncmFwaGljcy9r cml0YS9maWxlcy9wYXRjaC1saWJzX2dsb2JhbF9LaXNIYWxmVHJhaXRzLmgNCj4gICAzNjU4 OSAgICAgICAgMSAtcnctci0tci0tICAgIDEgcm9vdCAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgd2hlZWwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgTWF5IDI1 IDEyOjIzIC93cmtkaXJzL3Vzci9wb3J0cy9ncmFwaGljcy9rcml0YS93b3JrL2tyaXRhLTUu Mi4xNC9iL2dyYXBoaWNzL2tyaXRhL2ZpbGVzL3BhdGNoLWxpYnNfZ2xvYmFsX0tpc0hhbGZU cmFpdHMuaC5vcmlnDQo+ICAgMzc5MjQgICAgICAgIDMgLXJ3LXItLXItLSAgICAxIHJvb3Qg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoZWVsICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAxMjgzIERlYyAgOSAwOTo1NSAvd3JrZGlycy91c3IvcG9ydHMvZ3JhcGhp Y3Mva3JpdGEvd29yay9rcml0YS01LjIuMTQvbGlicy9nbG9iYWwvS2lzSGFsZlRyYWl0cy5o DQo+ICAgICANCj4gDQoNCkl0IGlzIGEgS3JpdGEgcHJvYmxlbSwgbm90IExMVk0NCg0KRml4 ZWQgaW4gaHR0cHM6Ly9jZ2l0LmZyZWVic2Qub3JnL3BvcnRzL2NvbW1pdC8/aWQ9NjJmZTlj MTI0NmU0YzdhNmFhODU2MjE5NDE5MDIyNzgyZmFiZGQ4YQ0KDQotLSANClNpbmNlcmVseSwN CkRpbWEgKGZsdWZmeUBGcmVlQlNELm9yZywgaHR0cHM6Ly90Lm1lL0ZsdWZmeUJTRCwgQGZs dWZmeTptYXRyaXgtZGV2LmZyZWVic2Qub3JnKQ0KKGRlc2t0b3AsIGtkZSwgeDExLCBvZmZp Y2UsIHBvcnRzLXNlY3RlYW0pQEZyZWVCU0QgdGVhbQ0KDQo= --------------tItyLYUh4cde86ScWF4tnazj-- --------------b7s47nzANLJQrInBXE4Y1fRu Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEELTAsy5mEEwxvh7r8+4ugndU5jykFAmoUVQYFAwAAAAAACgkQ+4ugndU5jynw kBAA3TKw7hD86gWnLJYGI/WwMkgRdYNmqEv6W9sJMYOzcHYE1AtFmuTIRm6BumHXFxQFP8/Iv3Ua nvPs/WWdennbIJIt7A8/h3CG8uBmWXpBiIgmIZ2b/XTupPHIDI+8MuXdEZB3FUKhCsGfZ/iJ4bzz 7KNiHvmrTtEQsiKLuWKHr7SX2RDvBEsLHymqMxra2aownFEqRX502raxOOgHjLYmgfJazahXjpAw nkfNA5Unr2B1+wyUBc8+YDKK2ipxnxQAVMbc0lyCMOPS278WwEaXuugsbGvTRhMUEgE23PtUpr6x qJHZCkXH/UAIUpqc1YtfXkcSgy2n0JuGw+3UZ+bT1JXF1WIamiD1VBvuJ3TYL25HA7wHKTlVTuEO 51Hx+kIT5Mm1cEqKUy77j04QtWbMSOYQ4mB7XU9XNaZ+qi2jIeQC5RvwchY8ureXnTK4g5rxQQLa +snfrlvoTySq9D2jGKi8NEwkEagj1s5+TNi4E+3gDw7KHu/gbYWTZSn8pyi6r419Z0ehUGkt5dm4 ncn7l16/5r6dOa1dIMiL9pSwRKUiRjcyyX3KeVjbahEbX/OAvyi/BWZJtmAC+Hb7vozb2lTiK6D+ /CnPueYaSIoB6i2KS8sjuA/tNT++49AU+MVSAAPiX0sdgQ5rFUx3vumfE1YNzTjCr1mKYtgxogoP KII= =wFOh -----END PGP SIGNATURE----- --------------b7s47nzANLJQrInBXE4Y1fRu-- From nobody Mon May 25 16:37:23 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 4gPM433d4gz6fVs0 for ; Mon, 25 May 2026 16:37:23 +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 4gPM432nVbz3xrY for ; Mon, 25 May 2026 16:37:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779727043; 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=9mshdmF0mnGRfYbiHCyiaE1FBJdrqfKzDE741JYVotY=; b=pc1oOG2I6W6lcm/JtzCP4R63jANuIW0KJBFr75b++tqbL74D1OYVkYccmSvkcvQduAeaqY W3ZGhJlZsU9qKf6hlyrP9v97ieCXlcCuz/CgGQa+iMshCXBujYPkKkupTLFuVbVw5T+buB l3xC56RyKJFiAiSGhQZrztnfz+q5XqDcKClnxWaAcsvSPgO7g2IEsh5/emvtYat5XghutI 72+r1wmp7sPDWBNH5Z/IwBtMwjaQgoM4CHDRI0FuHQ08XS0Bz+AWLrEy+pfbbCF9/aXEpb OykqaioE1KaBrBEOHz0CuWxxM/W1MjMrzv0S3ol8S5DTiEKhWOB/oCc3yIp9JA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779727043; a=rsa-sha256; cv=none; b=YRzpjTY/WL1s1XjJ8OyfGUBwxCbWRLgaYFjL7JYhbGoDHpMELqkT41+wf/04WYCXl7uGZY 8rc4Mru2MeBPuivDNm56RyMNM1oyWXFO/Zd7+hofUgJaKWtVg+cUWqAW7E1JEtGBbKVeyW 6U3vf5n2E1+X8ZRGmb8vtcEUCVmS2//Hs9II8DXhZSTnNxzj6QhlHwn10Qu+p9Mj9R9swf 8STAortXOoPGFezdF2+jeOqtW4wYllOzmkFjO0+9JKyP9GMr5hlg8o93bA+MgauaMbDn3Z GPr4zwrx2cz1QyzWdCwSRh+PxSzQMyzwJHG3DXaTYF7F3q7AFrsJb49sANMVTA== 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=1779727043; 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=9mshdmF0mnGRfYbiHCyiaE1FBJdrqfKzDE741JYVotY=; b=Wjj0NoK1jmy5vUdrg00glY0+/gp9r3haSg8emznFMBIUgzQ7ul9CWa5h84w+q1va8/n09b nX/+PAl9PpPvpEEJ7BEtnBwIrU2N5D6gzURrklWLpMxDoIQRIZVt+oEk7flcB10x/oC6yb DEi4ZvfPvO2U21qphWMSrhnJw4prgMluVdUYgj3b9eAcsbxS+XwmWS1eM25NSfFDDqojII DQAT92yWgrWUEZCTpQzBlQ4JgJoQ+T91ewrzHB9lpcIhJfwAz52DgzYGUdeXm4qumIfroL +42YvHDEyiGVIm1eQQRtyYt++z1h9Ryo7KnrNUgTM1CaNlbPGOjtjNJiGpmouA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPM4323gzzpVG for ; Mon, 25 May 2026 16:37:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33b96 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 16:37:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 33acf0f26b49 - main - netlink: Fix RTM_GETROUTE loop for RT_TABLE_UNSPEC 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33acf0f26b490ea4887d820a3f45c56e3913a17d Auto-Submitted: auto-generated Date: Mon, 25 May 2026 16:37:23 +0000 Message-Id: <6a147ac3.33b96.68516d26@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=33acf0f26b490ea4887d820a3f45c56e3913a17d commit 33acf0f26b490ea4887d820a3f45c56e3913a17d Author: Ed Maste AuthorDate: 2026-05-22 14:27:53 +0000 Commit: Ed Maste CommitDate: 2026-05-25 16:37:12 +0000 netlink: Fix RTM_GETROUTE loop for RT_TABLE_UNSPEC Reviewed by: bz, pouria Fixes: 7e5bf68495cc ("netlink: add netlink support") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57234 --- sys/netlink/route/rt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 8159409c9f67..ee17737426ed 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -726,7 +726,7 @@ handle_rtm_dump(struct nlpcb *nlp, uint32_t fibnum, int family, if (fibnum == RT_TABLE_UNSPEC) { for (int i = 0; i < V_rt_numfibs; i++) { - dump_rtable_fib(&wa, fibnum, family); + dump_rtable_fib(&wa, i, family); if (wa.error != 0) break; } From nobody Mon May 25 17:03:02 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 4gPMdf5rlnz6fXrP for ; Mon, 25 May 2026 17:03:02 +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 4gPMdf3qnwz43wr for ; Mon, 25 May 2026 17:03:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779728582; 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=XxCm2fwCMceJrHFxxL6NJOHvvZZ0CSmwIZ0WRaSH1jg=; b=TtJkFRBnOJqp8d5iK8vg03KaFFvhx/gXdGW2wpgZEC71fCSzByDsjI46ieGLcYqszYdFHg lZFojsLtu/e1Pox3dH35yVqLsNghOoM3awh58BvLYp/sxTL6mguhBEDXs0or0GOlWIHCcr R/+qmVGlKL57Berl2xh5Pg7/fj8FjC28RQF37SkqI3trin+cb2TSMVTNt+0x1RYXnBw08S l9CWRQHuSb0PzJApbk1JPxR5VnTAU/gAK6yyFAPIwkQp6YnqrjnMnpPLnuglIfHMeVzBuQ PcWX7BiwpKtSC8EmnLc/K6guvQF16+2sBo25UVty7So60ViOj/9XQhUwC1P+TQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779728582; a=rsa-sha256; cv=none; b=UVJ/N90lxNdxJ5fkgqy0k67D/+Nt4cCzH25W3q02TyI0vRsWa537AOXpj/VxyxfhU9VFjx LYkOH75/W7CjWxyl7+CaMV41nXGl/ZD9sd3Qokp/+cg19c5+9IXQprnn3ys+VLfU0I/coP xNPSa7qYoRIorW8/7d6jii2FyLUASFZyXejJ0aqkzdQbuGO39h+b9ZvHDiaIwRJAlsmilP XG7+Wn5H2zsrve5NYgWfjy3MMcWGA57rZfZBrYrrs52ZwwLT2uPwSlMflU+Rm/DIZohgC7 iehGd95TRpd30n3AdoC2DynChxDUtypG5hJuVyy4Z9jBCmrOHxA3ov6h+kd2BQ== 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=1779728582; 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=XxCm2fwCMceJrHFxxL6NJOHvvZZ0CSmwIZ0WRaSH1jg=; b=rMXExxW4xOM2muIGCFnlyyb4sEbmWePtBT1uR81QItjfGxseK2Cw9E35a0RM9h/MLnpvSs wTLVu6s48SVzyf37+39NctQ2IvkH4+vbxxHRvOa4yPBC3i6G6eaNOyhi4QjHdJiRSERSU8 bQWRUmZFIneRVRivJW7V0FXRTbUSJvOSHh8NFThVCz5hb4PsOCDrkTKVUb3/cWAsH8Jc3C Ugi/sFz0VqL3YdScqk8gj/kYtKtx+OQRH60a7KUcWaBYRtaTkc/NuZ/Vp8XpKs2TMQ6AEn bXn3NEbvqC4RfwbkCxm6EUufXRZKnzOsP9/S0wH6gmSRbCKYpT6aQdSVnYb/Kg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPMdf3GlVzr7S for ; Mon, 25 May 2026 17:03:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37b13 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 17:03:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 05e8f2bf0906 - main - ttymsg: Overhaul 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05e8f2bf0906875e666469e0338f922d1113d034 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 17:03:02 +0000 Message-Id: <6a1480c6.37b13.546d11ae@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=05e8f2bf0906875e666469e0338f922d1113d034 commit 05e8f2bf0906875e666469e0338f922d1113d034 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-25 16:51:23 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-25 16:52:15 +0000 ttymsg: Overhaul * Instead of an error string, return the usual 0 or -1 and let the caller figure out what, if anything, to tell the user. * Avoid string manipulations by opening /dev first and using openat() with O_RESOLVE_BENEATH. * Add a boolean argument which, if false, causes ttymsg() to return without sending the message if the tty's group-writable bit is not set. This saves programs that respect this setting (like syslogd(8)) from having to check before calling ttymsg(). * Update all callers. The observable effect of this change is minimal except for slightly different error messages when ttymsg() fails. However, syslogd(8) will no longer print spurious error messages on the console after trying and failing to write a log message to an X11 session. PR: 295171 MFC after: 1 week Reviewed by: jfree, markj Differential Revision: https://reviews.freebsd.org/D57018 --- libexec/talkd/announce.c | 3 +- usr.bin/wall/ttymsg.c | 120 ++++++++++++++++++++----------------- usr.bin/wall/ttymsg.h | 2 +- usr.bin/wall/wall.c | 6 +- usr.sbin/syslogd/syslogd.c | 47 ++++----------- usr.sbin/syslogd/syslogd_cap.c | 2 +- usr.sbin/syslogd/syslogd_cap.h | 8 +-- usr.sbin/syslogd/syslogd_cap_log.c | 58 +++++++----------- 8 files changed, 106 insertions(+), 140 deletions(-) diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c index 80c663ba48b4..cfe8b4eae65e 100644 --- a/libexec/talkd/announce.c +++ b/libexec/talkd/announce.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -152,7 +153,7 @@ print_mesg(const char *tty, CTL_MSG *request, * stack up processes trying to write messages to a tty * that is permanently blocked. */ - if (ttymsg(&iovec, 1, tty, RING_WAIT - 5) != NULL) + if (ttymsg(&iovec, 1, tty, RING_WAIT - 5, true) != 0) return (FAILED); return (SUCCESS); diff --git a/usr.bin/wall/ttymsg.c b/usr.bin/wall/ttymsg.c index 4f1c367c505f..3eee72d6805b 100644 --- a/usr.bin/wall/ttymsg.c +++ b/usr.bin/wall/ttymsg.c @@ -29,15 +29,16 @@ * SUCH DAMAGE. */ - - #include +#include #include + #include #include #include #include #include +#include #include #include #include @@ -46,65 +47,72 @@ #include "ttymsg.h" /* - * Display the contents of a uio structure on a terminal. Used by wall(1), - * syslogd(8), and talkd(8). Forks and finishes in child if write would block, - * waiting up to tmout seconds. Returns pointer to error string on unexpected - * error; string is not newline-terminated. Various "normal" errors are - * ignored (exclusive-use, lack of permission, etc.). + * Display the contents of a uio structure on a terminal. If shout is + * non-zero, do so even if the terminal has messages disabled. Used by + * wall(1), syslogd(8), and talkd(8). Forks and finishes in child if + * write would block, waiting up to timeout seconds. Various "normal" + * errors are ignored (exclusive-use, lack of permission, etc.). */ -const char * -ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout) +int +ttymsg(struct iovec *iov, int iovcnt, const char *tty, int timeout, + bool shout) { struct iovec localiov[TTYMSG_IOV_MAX]; - ssize_t left, wret; - int cnt, fd; - char device[MAXNAMLEN] = _PATH_DEV; - static char errbuf[1024]; - char *p; + struct stat sb; + ssize_t wret; + size_t resid; + int cnt, dd, fd, serrno; int forked; forked = 0; - if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) - return ("too many iov's (change code in wall/ttymsg.c)"); - - strlcat(device, line, sizeof(device)); - p = device + sizeof(_PATH_DEV) - 1; - if (strncmp(p, "pts/", 4) == 0) - p += 4; - if (strchr(p, '/') != NULL) { - /* A slash is an attempt to break security... */ - (void) snprintf(errbuf, sizeof(errbuf), - "Too many '/' in \"%s\"", device); - return (errbuf); + if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) { + errno = EFBIG; + return (-1); } - /* - * open will fail on slip lines or exclusive-use lines - * if not running as root; not an error. - */ - if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) < 0) { - if (errno == EBUSY || errno == EACCES) - return (NULL); - (void) snprintf(errbuf, sizeof(errbuf), "%s: %s", device, - strerror(errno)); - return (errbuf); + dd = open(_PATH_DEV, O_SEARCH | O_DIRECTORY); + if (dd < 0) + return (-1); + fd = openat(dd, tty, O_WRONLY | O_NONBLOCK | O_RESOLVE_BENEATH); + if (fd < 0) { + serrno = errno; + close(dd); + /* + * open will fail on slip lines or exclusive-use lines + * if not running as root; not an error. + */ + if (serrno == EBUSY || serrno == EACCES) + return (0); + errno = serrno; + return (-1); + } + close(dd); + if (!shout) { + if (fstat(fd, &sb) != 0) { + serrno = errno; + close(fd); + errno = serrno; + return (-1); + } + if ((sb.st_mode & S_IWGRP) == 0) { + close(fd); + return (0); + } } - for (cnt = 0, left = 0; cnt < iovcnt; ++cnt) - left += iov[cnt].iov_len; + for (cnt = 0, resid = 0; cnt < iovcnt; ++cnt) + resid += iov[cnt].iov_len; - for (;;) { + do { wret = writev(fd, iov, iovcnt); - if (wret >= left) - break; if (wret >= 0) { - left -= wret; + resid -= wret; if (iov != localiov) { - bcopy(iov, localiov, + bcopy(iov, localiov, iovcnt * sizeof(struct iovec)); iov = localiov; } - for (cnt = 0; (size_t)wret >= iov->iov_len; ++cnt) { + while ((size_t)wret >= iov->iov_len) { wret -= iov->iov_len; ++iov; --iovcnt; @@ -124,21 +132,21 @@ ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout) } cpid = fork(); if (cpid < 0) { - (void) snprintf(errbuf, sizeof(errbuf), - "fork: %s", strerror(errno)); + serrno = errno; (void) close(fd); - return (errbuf); + errno = serrno; + return (-1); } if (cpid) { /* parent */ (void) close(fd); - return (NULL); + return (0); } forked++; - /* wait at most tmout seconds */ + /* wait at most timeout seconds */ (void) signal(SIGALRM, SIG_DFL); (void) signal(SIGTERM, SIG_DFL); /* XXX */ (void) sigsetmask(0); - (void) alarm((u_int)tmout); + (void) alarm((u_int)timeout); (void) fcntl(fd, F_SETFL, 0); /* clear O_NONBLOCK */ continue; } @@ -146,18 +154,18 @@ ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout) * We get ENODEV on a slip line if we're running as root, * and EIO if the line just went away. */ - if (errno == ENODEV || errno == EIO) + serrno = errno; + if (serrno == ENODEV || serrno == EIO) break; (void) close(fd); if (forked) _exit(1); - (void) snprintf(errbuf, sizeof(errbuf), - "%s: %s", device, strerror(errno)); - return (errbuf); - } + errno = serrno; + return (-1); + } while (resid > 0); (void) close(fd); if (forked) _exit(0); - return (NULL); + return (0); } diff --git a/usr.bin/wall/ttymsg.h b/usr.bin/wall/ttymsg.h index be97592f5e1c..840a49875fbb 100644 --- a/usr.bin/wall/ttymsg.h +++ b/usr.bin/wall/ttymsg.h @@ -1,4 +1,4 @@ #define TTYMSG_IOV_MAX 32 -const char *ttymsg(struct iovec *, int, const char *, int); +int ttymsg(struct iovec *, int, const char *, int, bool); diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c index fcfcdcb3fbce..e29b896f838f 100644 --- a/usr.bin/wall/wall.c +++ b/usr.bin/wall/wall.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -90,7 +91,6 @@ main(int argc, char *argv[]) struct wallgroup *g; struct group *grp; char **np; - const char *p; struct passwd *pw; (void)setlocale(LC_CTYPE, ""); @@ -158,8 +158,8 @@ main(int argc, char *argv[]) if (ingroup == 0) continue; } - if ((p = ttymsg(&iov, 1, utmp->ut_line, 60*5)) != NULL) - warnx("%s", p); + if (ttymsg(&iov, 1, utmp->ut_line, 60 * 5, 1) != 0) + warn("%s", utmp->ut_line); } exit(0); } diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 59cb56fd5970..70cb705c0cb7 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -360,7 +360,6 @@ static int evaluate_prop_filter(const struct prop_filter *filter, static nvlist_t *prop_filter_compile(const char *); static void parsemsg(const char *, char *); static void printsys(char *); -static const char *ttymsg_check(struct iovec *, int, char *, int); static void usage(void); static bool validate(struct sockaddr *, const char *); static void unmapped(struct sockaddr *); @@ -1756,8 +1755,6 @@ iovlist_truncate(struct iovlist *il, size_t size) static void fprintlog_write(struct filed *f, struct iovlist *il, int flags) { - const char *msgret; - switch (f->f_type) { case F_FORW: { ssize_t lsent; @@ -1910,10 +1907,10 @@ fprintlog_write(struct filed *f, struct iovlist *il, int flags) dprintf(" %s%s\n", _PATH_DEV, f->f_fname); iovlist_append(il, "\r\n"); errno = 0; /* ttymsg() only sometimes returns an errno */ - if ((msgret = cap_ttymsg(cap_syslogd, il->iov, il->iovcnt, - f->f_fname, 10))) { + if (cap_ttymsg(cap_syslogd, il->iov, il->iovcnt, f->f_fname, 10, + true) != 0) { f->f_type = F_UNUSED; - logerror(msgret); + logerror(f->f_fname); } break; @@ -2143,7 +2140,6 @@ wallmsg(const struct filed *f, struct iovec *iov, const int iovlen) static int reenter; /* avoid calling ourselves */ struct utmpx *ut; int i; - const char *p; if (reenter++) return; @@ -2153,19 +2149,19 @@ wallmsg(const struct filed *f, struct iovec *iov, const int iovlen) if (ut->ut_type != USER_PROCESS) continue; if (f->f_type == F_WALL) { - if ((p = ttymsg(iov, iovlen, ut->ut_line, - TTYMSGTIME)) != NULL) - dprintf("%s\n", p); + if (ttymsg(iov, iovlen, ut->ut_line, TTYMSGTIME, + false) != 0 && errno != ENOENT) + dprintf("%s: %m\n", ut->ut_line); continue; } /* should we send the message to this user? */ for (i = 0; i < MAXUNAMES; i++) { if (!f->f_uname[i][0]) break; - if (!strcmp(f->f_uname[i], ut->ut_user)) { - if ((p = ttymsg_check(iov, iovlen, ut->ut_line, - TTYMSGTIME)) != NULL) - dprintf("%s\n", p); + if (strcmp(f->f_uname[i], ut->ut_user) == 0) { + if (ttymsg(iov, iovlen, ut->ut_line, TTYMSGTIME, + true) != 0 && errno != ENOENT) + dprintf("%s: %m\n", ut->ut_line); break; } } @@ -2174,29 +2170,6 @@ wallmsg(const struct filed *f, struct iovec *iov, const int iovlen) reenter = 0; } -/* - * Wrapper routine for ttymsg() that checks the terminal for messages enabled. - */ -static const char * -ttymsg_check(struct iovec *iov, int iovcnt, char *line, int tmout) -{ - static char device[1024]; - static char errbuf[1024]; - struct stat sb; - - (void) snprintf(device, sizeof(device), "%s%s", _PATH_DEV, line); - - if (stat(device, &sb) < 0) { - (void) snprintf(errbuf, sizeof(errbuf), - "%s: %s", device, strerror(errno)); - return (errbuf); - } - if ((sb.st_mode & S_IWGRP) == 0) - /* Messages disabled. */ - return (NULL); - return (ttymsg(iov, iovcnt, line, tmout)); -} - /* * Return a printable representation of a host address. */ diff --git a/usr.sbin/syslogd/syslogd_cap.c b/usr.sbin/syslogd/syslogd_cap.c index 7539e6b8661b..0149d09dab99 100644 --- a/usr.sbin/syslogd/syslogd_cap.c +++ b/usr.sbin/syslogd/syslogd_cap.c @@ -50,7 +50,7 @@ casper_command(const char *cmd, const nvlist_t *limits __unused, else if (strcmp(cmd, "readconfigfile") == 0) error = casper_readconfigfile(nvlin, nvlout); else if (strcmp(cmd, "ttymsg") == 0) - error = casper_ttymsg(nvlin, nvlout); + error = casper_ttymsg(nvlin); else if (strcmp(cmd, "wallmsg") == 0) error = casper_wallmsg(nvlin); diff --git a/usr.sbin/syslogd/syslogd_cap.h b/usr.sbin/syslogd/syslogd_cap.h index 2e52c57bcdf8..60106d7862bd 100644 --- a/usr.sbin/syslogd/syslogd_cap.h +++ b/usr.sbin/syslogd/syslogd_cap.h @@ -62,13 +62,13 @@ extern SLIST_HEAD(cfiled_list, cap_filed) cfiled_head; int cap_p_open(cap_channel_t *, size_t, const char *, int *); nvlist_t *cap_readconfigfile(cap_channel_t *, const char *); -const char *cap_ttymsg(cap_channel_t *, struct iovec *, int, const char *, int); +int cap_ttymsg(cap_channel_t *, struct iovec *, int, const char *, int, bool); void cap_wallmsg(cap_channel_t *, const struct filed *, struct iovec *, const int); int casper_p_open(nvlist_t *, nvlist_t *); int casper_readconfigfile(nvlist_t *, nvlist_t *); -int casper_ttymsg(nvlist_t *, nvlist_t *); +int casper_ttymsg(nvlist_t *); int casper_wallmsg(nvlist_t *); nvlist_t *filed_to_nvlist(const struct filed *); @@ -83,8 +83,8 @@ struct prop_filter *nvlist_to_prop_filter(const nvlist_t *nvl_prop_filter); p_open(prog, rpd) #define cap_readconfigfile(chan, cf) \ readconfigfile(cf) -#define cap_ttymsg(chan, iov, iovcnt, line, tmout) \ - ttymsg(iov, iovcnt, line, tmout) +#define cap_ttymsg(chan, iov, iovcnt, line, timeout) \ + ttymsg(iov, iovcnt, line, timeout) #define cap_wallmsg(chan, f, iov, iovcnt) \ wallmsg(f, iov, iovcnt) diff --git a/usr.sbin/syslogd/syslogd_cap_log.c b/usr.sbin/syslogd/syslogd_cap_log.c index 5e2034abd9eb..901349c4dc5a 100644 --- a/usr.sbin/syslogd/syslogd_cap_log.c +++ b/usr.sbin/syslogd/syslogd_cap_log.c @@ -52,14 +52,12 @@ cap_p_open(cap_channel_t *chan, size_t filed_idx, const char *prog, exit(1); } error = nvlist_get_number(nvl, "error"); - if (error != 0) { - errno = error; - logerror("Failed to open piped command"); - } pipedesc_w = dnvlist_take_descriptor(nvl, "pipedesc_w", -1); *procdesc = dnvlist_take_descriptor(nvl, "procdesc", -1); nvlist_destroy(nvl); + if (error != 0) + errno = error; return (pipedesc_w); } @@ -81,29 +79,27 @@ casper_p_open(nvlist_t *nvlin, nvlist_t *nvlout) pipedesc_w = p_open(prog, &procdesc); if (pipedesc_w == -1) - return (-1); + return (errno); nvlist_move_descriptor(nvlout, "pipedesc_w", pipedesc_w); nvlist_move_descriptor(nvlout, "procdesc", procdesc); return (0); } - - return (-1); + return (ECAPMODE); } -const char * +int cap_ttymsg(cap_channel_t *chan, struct iovec *iov, int iovcnt, - const char *line, int tmout) + const char *line, int timeout, bool shout) { nvlist_t *nvl = nvlist_create(0); - int error; - static char errbuf[1024]; - char *ret = NULL; + int error = 0; nvlist_add_string(nvl, "cmd", "ttymsg"); for (int i = 0; i < iovcnt; ++i) nvlist_append_string_array(nvl, "iov_strs", iov[i].iov_base); nvlist_add_string(nvl, "line", line); - nvlist_add_number(nvl, "tmout", tmout); + nvlist_add_number(nvl, "timeout", timeout); + nvlist_add_bool(nvl, "shout", shout); nvl = cap_xfer_nvlist(chan, nvl); if (nvl == NULL) { @@ -111,28 +107,23 @@ cap_ttymsg(cap_channel_t *chan, struct iovec *iov, int iovcnt, exit(1); } error = nvlist_get_number(nvl, "error"); + nvlist_destroy(nvl); if (error != 0) { errno = error; - logerror("Failed to ttymsg"); - } - if (nvlist_exists_string(nvl, "errstr")) { - const char *errstr = nvlist_get_string(nvl, "errstr"); - (void)strlcpy(errbuf, errstr, sizeof(errbuf)); - ret = errbuf; + return (-1); } - - nvlist_destroy(nvl); - return (ret); + return (0); } int -casper_ttymsg(nvlist_t *nvlin, nvlist_t *nvlout) +casper_ttymsg(nvlist_t *nvlin) { const char * const *nvlstrs; struct iovec *iov; - size_t iovcnt; - int tmout; const char *line; + size_t iovcnt; + int ret, timeout; + bool shout; nvlstrs = nvlist_get_string_array(nvlin, "iov_strs", &iovcnt); assert(iovcnt <= TTYMSG_IOV_MAX); @@ -144,13 +135,12 @@ casper_ttymsg(nvlist_t *nvlin, nvlist_t *nvlout) iov[i].iov_len = strlen(nvlstrs[i]); } line = nvlist_get_string(nvlin, "line"); - tmout = nvlist_get_number(nvlin, "tmout"); - line = ttymsg(iov, iovcnt, line, tmout); - if (line != NULL) - nvlist_add_string(nvlout, "errstr", line); - + timeout = nvlist_get_number(nvlin, "timeout"); + shout = nvlist_get_bool(nvlin, "shout"); + if ((ret = ttymsg(iov, iovcnt, line, timeout, shout)) != 0) + ret = errno; free(iov); - return (0); + return (ret); } void @@ -158,7 +148,6 @@ cap_wallmsg(cap_channel_t *chan, const struct filed *f, struct iovec *iov, int iovcnt) { nvlist_t *nvl = nvlist_create(0); - int error; nvlist_add_string(nvl, "cmd", "wallmsg"); /* @@ -175,11 +164,6 @@ cap_wallmsg(cap_channel_t *chan, const struct filed *f, struct iovec *iov, logerror("Failed to xfer wallmsg nvlist"); exit(1); } - error = nvlist_get_number(nvl, "error"); - if (error != 0) { - errno = error; - logerror("Failed to wallmsg"); - } nvlist_destroy(nvl); } From nobody Mon May 25 17:03:03 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 4gPMdg6KSXz6fYJQ for ; Mon, 25 May 2026 17:03:03 +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 4gPMdg4khcz442k for ; Mon, 25 May 2026 17:03:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779728583; 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=0kuHQw15/Zpa5Fn1WMHc7gL5bBSc16l4JXbt/FrI9LI=; b=Z1dje6TfC2XC7JRQ1DpEEHPP/635sZgszTaX370zj30MN6mfB/zoqvwdhOjeZ4xIfOszXx 4p71QXUBQMHmyIp4qAzLBr0yenlcVMFBzrUhivCH/F/mzLa1qRg4NOcpFSQdEwQJZWXDXn 7sh8wykJF2H3xDCIebZjhmnbMC1DaK0rv7M50ICwym9UHsmuZ7tC4sEXEJ+G3lmvzph8lY E65838SIbI7b6EXIKzAjL0YETcc4JC3Oe0/dAfzBasSDI2SAry6/52upp5s5jGRWYLRL7I I/8uGC74APLgOc3jBj2EoKP4iTphhIa99BFZH9KYwqD5U1owR/IjhXyEe4CMCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779728583; a=rsa-sha256; cv=none; b=UbJo1p4f3gCBW2d2JIG+oB2s9L/B9wduELzAQckUGu7heY1f8jAcA+T1kZHxZve855Rd6J 4A0MCw4qymXDrqHAmuzpHCF18tICX8Z921ruwzmnpnSv8VmS3NAO+rmv6qkcVAhP4cNV2N mSVvUX8hXL8YbCP+nOWfVU5tInEetxnsw9CGIOmCjuESWJnbd5TfMlnQuvJGX514rZFDSr mLuSJOfV1Ht/SO5rDw2NUSuEhXGNY+NCl/CEEazo6u1ndoNuz6PJaLVw6JOEPjg80EIqv1 f9LrzXjQ0CTFAlwlfMfhCKLTC2VVHJ5xX5sk/loVCuRnMg/IeaesyUIY1MlV2g== 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=1779728583; 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=0kuHQw15/Zpa5Fn1WMHc7gL5bBSc16l4JXbt/FrI9LI=; b=tMMuUqZPoHUrsLZtynE6jBh9IvtHGivweBZn0aMeNReJCUzy1TTj7ly+iJdA/VNTxshgek z+C4OAkTeKDkccPUpEiQIBn5VpdG2r3oPRJrZRz5Dv8cuPpcRD3joVxWHi+hSoShOq0gYz i7Ldylad/AkXG7SFc70cTOEFp/hpL0ggWrh7KWTWQq407VAxenrRgI8qrxbfOmgjlmO0hO HkonLL9i6vHWy/Sstap1UpoaO0Dcsavr6bHHD2JteQHdB6wuWWkmg5hIfADYh7zfGeoNyu Qni4UrAKOje9aUWqP8S3pJ8PlnxsefdiDECQHYwQXluUX5N7Dr4jZiwp3pnmFQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPMdg4BDXzqSn for ; Mon, 25 May 2026 17:03:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38327 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 17:03:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: c0cae7d8da50 - main - lpd: Restore ability to specify a port number 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0cae7d8da50daa87af4cd6d7c9a2043343b506f Auto-Submitted: auto-generated Date: Mon, 25 May 2026 17:03:03 +0000 Message-Id: <6a1480c7.38327.207c9055@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=c0cae7d8da50daa87af4cd6d7c9a2043343b506f commit c0cae7d8da50daa87af4cd6d7c9a2043343b506f Author: Dag-Erling Smørgrav AuthorDate: 2026-05-25 16:51:31 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-25 16:52:16 +0000 lpd: Restore ability to specify a port number This has been broken since IPv6 support was added in 2000. We would validate the port number (which had to be a port number, but can now also be a service name) and then ignore it. MFC after: 1 week Fixes: 08829865f659 ("IPv6 support for lpr.") Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57181 --- usr.sbin/lpr/lpd/lpd.8 | 19 ++++++++++--------- usr.sbin/lpr/lpd/lpd.c | 28 +++++++++------------------- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/usr.sbin/lpr/lpd/lpd.8 b/usr.sbin/lpr/lpd/lpd.8 index 9d24a450ba0e..269ef3580ce7 100644 --- a/usr.sbin/lpr/lpd/lpd.8 +++ b/usr.sbin/lpr/lpd/lpd.8 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 19, 2026 +.Dd May 25, 2026 .Dt LPD 8 .Os .Sh NAME @@ -35,7 +35,7 @@ .Nm .Op Fl cdlpsFW46 .Op Fl t Ar timeout -.Op Ar port# +.Op Ar port .Sh DEPRECATION NOTICE This facility is scheduled for removal prior to the release of .Fx 16.0 . @@ -143,13 +143,13 @@ Inet only. Inet6 only. .It Fl 46 Inet and inet6 (default). -.It Ar "port#" -The Internet port number used to rendezvous -with other processes is normally obtained with -.Xr getservbyname 3 -but can be changed with the -.Ar port# -argument. +.It Ar "port" +The Internet port number or service name used to rendezvous with other +processes. +Can be any number from 1 to 65,535 or any service name defined in +.Pa /etc/services . +Defaults to +.Li printer . .El .Pp Access control is provided by two means. @@ -346,6 +346,7 @@ but not under same administrative control. .Xr syslog 3 , .Xr hosts.lpd 5 , .Xr printcap 5 , +.Xr services 5 , .Xr chkprintcap 8 , .Xr lpc 8 , .Xr pac 8 diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c index d1dcd0766a77..5550846dca18 100644 --- a/usr.sbin/lpr/lpd/lpd.c +++ b/usr.sbin/lpr/lpd/lpd.c @@ -101,7 +101,7 @@ static void startup(void); static void chkhost(struct sockaddr *_f, int _ch_opts); static int ckqueue(struct printer *_pp); static void fhosterr(int _ch_opts, char *_sysmsg, char *_usermsg); -static int *socksetup(int _af, int _debuglvl); +static int *socksetup(int _af, const char *portstr, int _debuglvl); static void usage(void); /* XXX from libc/net/rcmd.c */ @@ -124,7 +124,7 @@ main(int argc, char **argv) struct sockaddr_storage frominet; socklen_t fromlen; sigset_t omask, nmask; - struct servent *sp, serv; + const char *portstr = "printer"; int inet_flag = 0, inet6_flag = 0; euid = geteuid(); /* these shouldn't be different */ @@ -215,19 +215,9 @@ main(int argc, char **argv) if (errs) usage(); - if (argc == 1) { - if ((i = atoi(argv[0])) == 0) - usage(); - if (i < 0 || i > USHRT_MAX) - errx(EX_USAGE, "port # %d is invalid", i); - - serv.s_port = htons(i); - sp = &serv; + if (argc > 0) { + portstr = *argv++; argc--; - } else { - sp = getservbyname("printer", "tcp"); - if (sp == NULL) - errx(EX_OSFILE, "printer/tcp: unknown service"); } if (argc != 0) @@ -339,7 +329,7 @@ main(int argc, char **argv) FD_SET(funix, &defreadfds); listen(funix, 5); if (sflag == 0) { - finet = socksetup(family, socket_debug); + finet = socksetup(family, portstr, socket_debug); } else finet = NULL; /* pretend we couldn't open TCP socket. */ if (finet) { @@ -855,7 +845,7 @@ fhosterr(int ch_opts, char *sysmsg, char *usermsg) /* if af is PF_UNSPEC more than one socket may be returned */ /* the returned list is dynamically allocated, so caller needs to free it */ static int * -socksetup(int af, int debuglvl) +socksetup(int af, const char *portstr, int debuglvl) { struct addrinfo hints, *res, *r; int error, maxs, *s, *socks; @@ -865,7 +855,7 @@ socksetup(int af, int debuglvl) hints.ai_flags = AI_PASSIVE; hints.ai_family = af; hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo(NULL, "printer", &hints, &res); + error = getaddrinfo(NULL, portstr, &hints, &res); if (error) { syslog(LOG_ERR, "%s", gai_strerror(error)); mcleanup(0); @@ -934,9 +924,9 @@ static void usage(void) { #ifdef INET6 - fprintf(stderr, "usage: lpd [-cdlsFW46] [port#]\n"); + fprintf(stderr, "usage: lpd [-cdlsFW46] [port]\n"); #else - fprintf(stderr, "usage: lpd [-cdlsFW] [port#]\n"); + fprintf(stderr, "usage: lpd [-cdlsFW] [port]\n"); #endif exit(EX_USAGE); } From nobody Mon May 25 17:03:04 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 4gPMdj1lH9z6fY21 for ; Mon, 25 May 2026 17:03:05 +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 4gPMdh60j1z43ws for ; Mon, 25 May 2026 17:03:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779728584; 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=Qog/tPD8Q/wg7f8mOwUnAJFgG8o6HaYi63Sbpx7j/p8=; b=VymlAxDWL85HSASraAiICnOPyjwAp7QnDmqqWEWscGxoaipDbH+eJRXE9sL486MUnvoIyY 9LkQ0F49k87I7fOPzrr2+88NkiLhzrNJaWGCU3YeOdBBNL3Nzjl9ukh3H1C2qheoz4qbxT MSikXh0YFMIWUBrNQIL2ZEkiyFjfOGjypnRczadMjvq3e2mknzx8LNme7m7NHNx947QE2y cmRU00UOfTCrcsbqy7cNS5/0GibUzPw0yk3Z4wEgN2r65ee0PBxKkX89A880Ysii2x9nfF Ym7//kAf0gxMtBRqaDetp6dOX/GJeOk5yWjNvSoyZ5SU7AlysgOfv0Iilqh5Uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779728584; a=rsa-sha256; cv=none; b=exLFbsuHOGLFfTGiveHy2BtKA4PF5rBk0n5PUyIZqOeiZcH6yOm7GhMZTyUx+6zTvVw2dW yB2Z/M5EGVaEAV+uGL0HpgHXBSUmw4v2BCwLhFPUZP1lJQFE33825xBHKGJfljJ/GTd69k Yk0RoUa4p+OYr3rSZodQi/yi6+/KywxZ5Quu5jol+ot0Uc77R4FEtmx4RJuAl5WVqrnA4D U6dSgFFFmHL+LLpXIPduo6jiRt9OS7Uyl7mQ/sC6UXi0k93/y8o4f9w4lQd0wep+c7mY4i 8x/opn3hUDv8yDoTUQEByC1eyGmIWjYAsJ1rPE9VbpdaeCU2hg7ipxAFM8CbLQ== 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=1779728584; 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=Qog/tPD8Q/wg7f8mOwUnAJFgG8o6HaYi63Sbpx7j/p8=; b=aU8Dz9Zg4wL2fO5uBzMoUwFG9YZpf+hN8lEXhphL1LwAzVVycVJqkHkBvq+UnYFDw9UVyt BM4OBK4XAgh5eODbXtI643fILpdM3/xuUdJrMsO6HJj2owLVvpW6/KjJyDuYQxQE6o8SCs 1qejzud+VbJDEzbPF/VZNA/ZTuB84a64AxjM6l7oUnewMPAoK54yUbXFGBKow0mh7VhpZB KkG7XpF7GfuiJfAo2/lDDCC9AAKZSGYVGvr3TGaf0Dkec1s5QITSwXr8VaqM+p5VTy6Xt8 J1OGR9GRVKvZ+0Sb1yiwP4LKePGPhGetRPnKXCKDv3Llau4HhirQmQTKOr1yMw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPMdh55GFzr7W for ; Mon, 25 May 2026 17:03:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 379a7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 17:03:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 8e917789732a - main - lpd: Reorder option list in manual page 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e917789732ae02a480e8756899d3bc6d99fe5d8 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 17:03:04 +0000 Message-Id: <6a1480c8.379a7.3f297fd8@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=8e917789732ae02a480e8756899d3bc6d99fe5d8 commit 8e917789732ae02a480e8756899d3bc6d99fe5d8 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-25 16:51:39 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-25 16:52:16 +0000 lpd: Reorder option list in manual page MFC after: 1 week Reviewed by: ziaee, markj Differential Revision: https://reviews.freebsd.org/D57182 --- usr.sbin/lpr/lpd/lpd.8 | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/usr.sbin/lpr/lpd/lpd.8 b/usr.sbin/lpr/lpd/lpd.8 index 269ef3580ce7..30c69555ca24 100644 --- a/usr.sbin/lpr/lpd/lpd.8 +++ b/usr.sbin/lpr/lpd/lpd.8 @@ -63,6 +63,12 @@ the request so the parent can continue to listen for more requests. .Pp Available options: .Bl -tag -width Ds +.It Fl 4 +Accept IPv4 connections. +The default is to accept both IPv4 and IPv6. +.It Fl 6 +Accept IPv6 connections. +The default is to accept both IPv4 and IPv6. .It Fl c By default, if some remote host has a connection error while trying to send a print request to @@ -81,11 +87,20 @@ Turn on .Dv SO_DEBUG on the Internet listening socket (see .Xr setsockopt 2 ) . -.It Fl l +.It Fl F +By default, +.Nm +will daemonize into the background. The -.Fl l +.Fl F flag causes .Nm +to remain in the foreground. +Logging is still performed with +.Xr syslog 3 . +.It Fl l +Causes +.Nm to log valid requests received from the network. This can be useful for debugging purposes. @@ -99,11 +114,7 @@ It is being deprecated, and may be removed in a future version of .Nm . .It Fl s -The -.Fl s -(secure) flag causes -.Nm -not to open an Internet listening socket. +Do not open an Internet listening socket. This means that .Nm will not accept any connections from any remote @@ -114,17 +125,6 @@ Set the network receive timeout for client connections to .Ar timeout seconds. The default is 120. -.It Fl F -By default, -.Nm -will daemonize into the background. -The -.Fl F -flag causes -.Nm -to remain in the foreground. -Logging is still performed with -.Xr syslog 3 . .It Fl W By default, the .Nm @@ -137,12 +137,6 @@ flag causes to accept connections coming from any port. This is can be useful when you want to accept print jobs from certain implementations of lpr written for Windows. -.It Fl 4 -Inet only. -.It Fl 6 -Inet6 only. -.It Fl 46 -Inet and inet6 (default). .It Ar "port" The Internet port number or service name used to rendezvous with other processes. From nobody Mon May 25 17:03:05 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 4gPMdk1GTbz6fXlQ for ; Mon, 25 May 2026 17:03:06 +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 4gPMdj6R73z43wv for ; Mon, 25 May 2026 17:03:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779728585; 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=ebigjxwhE5sFj6Kh9y5MObCcgBeitBvUh0BNq4QNtpE=; b=d80ij7577UJLKnW91yuIfO7vmvgutpewsbmQAvPK23PFbKRxCd6bYPFZiZx0hfryaUSanp eWcaUdF+DGqSSo1XFEvtxlbHxLS3hTHMa2mfQe0RUzt5Nt6jkZH0NMXWoW4uGwNTah7UkE 9nljbeju8NbAyzsR6V0dJ1lpuX/fcjcdMe4KWDfNftU6yTXW7EGe4+6pCnmw/W9v1nKKJ5 tChK5gjkwaIwZD+y+f5O3pzRdOkWmTD5FIj2afGB02URntIWQojObCDISWNdmpSVNZt9Yu 0IQeVMCRl7dqyLnoHz7kzHuZQsjJZ6hV9506S6GTrX0X1oPacShK7R8Ul79hpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779728585; a=rsa-sha256; cv=none; b=Ksnnv+uAEzrl2zGUJ1RK+kIIj5FjI63xhwdocF/95kRmBn1w4ILsVErbOXDywStA0b+8G7 tp/LfXNrh7I45Slo1SxDYj8RH6y1agDGOvsnPecLE4HOXYhI9Z5qoO7xg9lsccWAhKrnzT latF40PZs0Jja//i4rMgAqITpiuXeYLt4/oIQdnu2WMDdyzgN69DuUcr/9goPLQczxJSPu MQSt22AD6oEl2AvoRBPJfE5NQTt8aDMJUdoq83mrkNTG0eW3XLTeZEe0p0FqFvPO6q/O3m GeNZ1JGLz3SPCzNc/ER5eL+sAAmMEnAS/YnRTbxjAUBqXPHRIZmd/QoKnZT55w== 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=1779728585; 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=ebigjxwhE5sFj6Kh9y5MObCcgBeitBvUh0BNq4QNtpE=; b=IQ0mF4fQPZ+HhnejTrqDfz+4nNpKKmUGx7HBRWK0TWLnmKMemmYbDq85hlv10wCCq9Tj/Z zRhZGwEjLTtEBRcr/dN2+uhr8WLPsLd01+aLs9RNv8vmxie7gPJkrlub5Ne4PyibR1RCwO GD7tV1FNT0hI1OEC1jkqif/Cz3nvPhpzEDd6pYwLOvTb19G4HsO1xEsBZrO6rQp0rZnf7O 56GoWSX31UvA7StMAs8dofqQvPNpRHVXEGgnyUq4RbwhNOx+5+TWbB8EMlTDEb/EWWk2Yw RZ+7v+t/0gLFnqGto2df6zKA4nQ1cinh1KbpFd/sc1iRAomiNxNAE8/6kmADGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPMdj5y60zqSr for ; Mon, 25 May 2026 17:03:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3821d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 17:03:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 6047f6a21085 - main - lpd: Drop deprecated -p option 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6047f6a21085ae3877228f8df19a0d4bce45905f Auto-Submitted: auto-generated Date: Mon, 25 May 2026 17:03:05 +0000 Message-Id: <6a1480c9.3821d.6df76465@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=6047f6a21085ae3877228f8df19a0d4bce45905f commit 6047f6a21085ae3877228f8df19a0d4bce45905f Author: Dag-Erling Smørgrav AuthorDate: 2026-05-25 16:51:44 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-25 16:52:16 +0000 lpd: Drop deprecated -p option This alias for the -s option has been deprecated since 2002. Time to drop it from the documentation. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57183 --- usr.sbin/lpr/lpd/lpd.8 | 11 +---------- usr.sbin/lpr/lpd/lpd.c | 3 --- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/usr.sbin/lpr/lpd/lpd.8 b/usr.sbin/lpr/lpd/lpd.8 index 30c69555ca24..57331df02089 100644 --- a/usr.sbin/lpr/lpd/lpd.8 +++ b/usr.sbin/lpr/lpd/lpd.8 @@ -33,7 +33,7 @@ .Nd line printer spooler daemon .Sh SYNOPSIS .Nm -.Op Fl cdlpsFW46 +.Op Fl cdlsFW46 .Op Fl t Ar timeout .Op Ar port .Sh DEPRECATION NOTICE @@ -104,15 +104,6 @@ Causes to log valid requests received from the network. This can be useful for debugging purposes. -.It Fl p -The -.Fl p -flag is a synonym for the -.Fl s -flag. -It is being deprecated, and may be removed in a -future version of -.Nm . .It Fl s Do not open an Internet listening socket. This means that diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c index 5550846dca18..d01aac7a7a35 100644 --- a/usr.sbin/lpr/lpd/lpd.c +++ b/usr.sbin/lpr/lpd/lpd.c @@ -153,9 +153,6 @@ main(int argc, char **argv) lflag++; break; case 'p': /* letter initially used for -s */ - /* - * This will probably be removed with 5.0-release. - */ /* FALLTHROUGH */ case 's': /* secure (no inet) */ sflag++; From nobody Mon May 25 17:03:06 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 4gPMdl2xgqz6fXrZ for ; Mon, 25 May 2026 17:03:07 +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 4gPMdl09Knz442s for ; Mon, 25 May 2026 17:03:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779728587; 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=Mczp5n01XoC8le0kjPjFpd9X89HwxRvWG2xrsTc1tiE=; b=Kfu0z4oksvpWWp0DYur2qQK15Ad8c3DaBy697xnklekJfMpa4razG3IX6u1SIudHXCMx69 M9PykE3LXadTvEQfpwg+74HRBBRHIfqhqIka1aVPwOB00YJYg4d7lfjJ/zmyad1S9VDRHZ X/TGwP3YHyYjqFYkcBhq99H3kmHYzbes80inSuu+k6PQlfGPpU6MAFiQZ2FB8tmmncSSl2 eDjcmVsIM3YB34I/3ZGZ0aaHOQ9B8BWjYigrbeHrwFbEDDglk1ZYpZGhC4pLkEj7Rq1szH Ny9Grz+wbShoulV2Aw4Yp8NVH/4tsRNJG63Py2dBoblqhZ7tLoP4RHjIi4lS+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779728587; a=rsa-sha256; cv=none; b=eIx2S6A7PA+5W+md50O8A2TtlNNtMBKBwyAmQoWLquRkbuYtAWi1NEb4OQTN9/a5n2m5k1 CRd31bYQKl/BR6wRmFgUeLeqaRLbI25H/enf/42YYgF4nNwdZHJvSZiSsuzBvm2fKag0Y2 7xH1Ywnwm6kGE96Q6YJGivpL028Rwz+NL5D71rcp4p8AmhJChr3cILdV4HBPbKSDUfP+sD FKal2FHbduto2qUFM3nFNWo34L57BaT06uUZ5W1dYqTkAXrNEMxZ6c9M/YGiNA0BYNlLit B9/toCXWLZmpDZ1xyZtxlz+7ja+NCQfRlEl8pEwTJ7UNZMH3LtTvM90j+CRiTg== 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=1779728587; 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=Mczp5n01XoC8le0kjPjFpd9X89HwxRvWG2xrsTc1tiE=; b=QZ08s23vyaC1/ssFty18C+tLsUog0RFo/qdXdEFhxnj4jBJOZzuRMqvdeU++a0D6uMI44b hPalcFV7XdoQ4B7l971D8POr5ahQFIjNvTADUnkIcB7k0N2h/Ea4SfsA7QK08RJ7zg2thl /JDnhjDNH1xiGxSTJkxna6CZs7cJfn43m8VYzdWlwRrKusMyShCVkFUPz3hbr3lEwmxQuV VzKQLPJkG8mceg0pQkyDAQ2KuGcNJomVKtQHIWEXXIdDY68vcatzXxrSxKoX13+bo5unWV UvlBCCxs7GUtG1bQhja+yRedj+Gd8actt7XnHFscuGK2YsS0BDZ4BS4h81rkqQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPMdk6pnvzqND for ; Mon, 25 May 2026 17:03:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 382ec by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 17:03:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: f2c7c5f94803 - main - lpd: Avoid buffer overflow when sending a job 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2c7c5f94803b67a9a6af625d4fc8882d2afda6c Auto-Submitted: auto-generated Date: Mon, 25 May 2026 17:03:06 +0000 Message-Id: <6a1480ca.382ec.4d1bc28@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f2c7c5f94803b67a9a6af625d4fc8882d2afda6c commit f2c7c5f94803b67a9a6af625d4fc8882d2afda6c Author: Dag-Erling Smørgrav AuthorDate: 2026-05-25 16:51:48 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-25 16:52:16 +0000 lpd: Avoid buffer overflow when sending a job When forwarding a print job to a remote server, we could overflow the command buffer if a control or data file had a very long name. MFC after: 1 week Reported by: Joshua Rogers Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57184 --- usr.sbin/lpr/lpd/printjob.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 1c6736097492..0e86e8de8fb9 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -68,8 +68,12 @@ /* * The buffer size to use when reading/writing spool files. + * This is also used to compose commands for remote servers and therefore + * needs to be able to fit the longest command we could possibly send. */ -#define SPL_BUFSIZ BUFSIZ +#define SPL_BUFSIZ (BUFSIZ * 2) +_Static_assert(SPL_BUFSIZ > sizeof("x18446744073709551615 ") + PATH_MAX + + sizeof("_c2147483647 "), "SPL_BUFSIZ is too short"); /* * Error tokens @@ -640,7 +644,7 @@ print(struct printer *pp, int format, char *file) if (pp->filters[LPF_INPUT] == NULL && (format == 'f' || format == 'l' || format == 'o')) { pp->tof = 0; - while ((n = read(fi, buf, SPL_BUFSIZ)) > 0) + while ((n = read(fi, buf, sizeof(buf))) > 0) if (write(ofd, buf, n) != n) { (void) close(fi); return (REPRINT); @@ -1127,13 +1131,18 @@ sendfile(struct printer *pp, int type, char *file, char format, int copyreq) sendagain: copycnt++; - if (copycnt < 2) - (void) sprintf(buf, "%c%" PRId64 " %s\n", type, stb.st_size, - file); - else - (void) sprintf(buf, "%c%" PRId64 " %s_c%d\n", type, stb.st_size, - file, copycnt); - amt = strlen(buf); + if (copycnt < 2) { + amt = snprintf(buf, sizeof(buf), "%c%" PRId64 " %s\n", + type, stb.st_size, file); + } else { + amt = snprintf(buf, sizeof(buf), "%c%" PRId64 " %s_c%d\n", + type, stb.st_size, file, copycnt); + } + if (amt >= sizeof(buf)) { + syslog(LOG_ERR, "%s: file name too long", file); + sfres = ERROR; + goto return_sfres; + } for (i = 0; ; i++) { if (write(pfd, buf, amt) != amt || (resp = response(pp)) < 0 || resp == '\1') { @@ -1157,8 +1166,8 @@ sendagain: */ if (type == '\3') trstat_init(pp, file, job_dfcnt); - for (i = 0; i < stb.st_size; i += SPL_BUFSIZ) { - amt = SPL_BUFSIZ; + for (i = 0; i < stb.st_size; i += sizeof(buf)) { + amt = sizeof(buf); if (i + amt > stb.st_size) amt = stb.st_size - i; if (sizerr == 0 && read(sfd, buf, amt) != amt) From nobody Mon May 25 17:03:08 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 4gPMdm5QGDz6fY2B for ; Mon, 25 May 2026 17:03:08 +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 4gPMdm3GBZz44GQ for ; Mon, 25 May 2026 17:03:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779728588; 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=UlOg3G3QaBkJhDpOMQVMwiVgEZSRXFG+yMYQfQXC9iQ=; b=VpVdMl5EsOErnF/FSXGVUjJThiv7Q/EJQcm59awStnoOxfXPVCVR5JfKGsa+uJ3mw67nlK 4r7h08LhvnMo5jxJ7RqrINB06QODLKoTD3dbp6AqjUAgiKjo1tWRQM4fjqU+N3Jya80juR /9OdlcJjCASEwDDCAS2RTVmLCJlGpIsOR6V9hjcb01nrSVJNhc16x3Mdd7bdkUxudda3AW coCTe3XacWzmY6353+Xx/TREbZQS+C0jrJYWFo7KHJwmfsJFmzpiaxtSTEjCGrqVfB00aA UYGlJp1+f56quokA+9tdMQ4HgSJuZlM0loV8lqCQUS4WHpz5DmMr3vHNfeTkLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779728588; a=rsa-sha256; cv=none; b=OpBKv40DlwuMhHIJfgYtKFYX1GcTtj6QkqLN7jPj+fD/uG7AItxJ+UBNMzEhHndQnORlpp ERgphH4t5jnhV/xOIUE5e7mp/tIi/c1qwtY0KoBPRcxa1iALmXbLDYOvJJ3gx1+ggOuEsM O/OaPoLmMcjqOlnn4JXtsjmDL51AsiP/hsgyjhHDe8vEUBTksSPBXZe9nndsUWTTg/zs7P Bp1Fr7TMHmNS2XBvVX8if8vUNfZicq8SYCAjwuQrl4dxgqv6pGXpsXXGO4V6syEYhQIu6V cxMKMZqMOEl0kz+WI1G4aw27/6pJG9LzAzhQ8/tVfRxaY6rSFQEfvr+ZlvhDTg== 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=1779728588; 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=UlOg3G3QaBkJhDpOMQVMwiVgEZSRXFG+yMYQfQXC9iQ=; b=UABuFyyWJ23NpYfOagYnHg2XPNmWiY6g+z1rYI9Dvjyy8GWQxxhncgShpckFSvCvlT7/JO vY58m9NLa3orcZIwIUcBcO4hpGGlrC//iYZd9KR+CUgLF5K3yuI8lffPOPse9jrE+goHGc m8vL8bTCKG3eZ9sFtmsMIGPVFcu8f3NlyXZpxTdb99xB/tpSeL1sFiakmT5yv9ZVqbomPt NT83VUflkYpkBC6OOe1odR4X1ym5WtNi4WO1ftnwzyT+xr4OGQ5ZD18y+zBiSiuVQltpTg HoEWxsv9q+LT9D6DZ/22ePxmoW75QzIcYNvAH7YV6QZoQoR2VKPkLhPMXsC0kQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPMdm0cBkzqSs for ; Mon, 25 May 2026 17:03:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 388b5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 17:03:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 0f3e14870906 - main - lpd: Fix issues reported by clang-analyzer 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f3e14870906da22a7ca821fb2153d375157cac2 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 17:03:08 +0000 Message-Id: <6a1480cc.388b5.45c31314@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=0f3e14870906da22a7ca821fb2153d375157cac2 commit 0f3e14870906da22a7ca821fb2153d375157cac2 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-25 16:51:53 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-25 16:52:17 +0000 lpd: Fix issues reported by clang-analyzer Also, unlink our temporary file if we fail to chmod it. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57185 --- usr.sbin/lpr/lpd/printjob.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 0e86e8de8fb9..5ed7f0409679 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -155,7 +155,7 @@ printjob(struct printer *pp) register int i, nitems; off_t pidoff; pid_t printpid; - int errcnt, jobcount, statok, tempfd; + int errcnt, jobcount, tempfd; jobcount = 0; init(pp); /* set up capabilities */ @@ -190,9 +190,6 @@ printjob(struct printer *pp) pp->spool_dir); exit(1); } - statok = stat(pp->lock_file, &stb); - if (statok == 0 && (stb.st_mode & LFM_PRINT_DIS)) - exit(0); /* printing disabled */ umask(S_IWOTH); lfd = open(pp->lock_file, O_WRONLY|O_CREAT|O_EXLOCK|O_NONBLOCK, LOCK_FILE_MODE); @@ -203,12 +200,14 @@ printjob(struct printer *pp) pp->lock_file); exit(1); } - /* - * If the initial call to stat() failed, then lock_file will have - * been created by open(). Update &stb to match that new file. - */ - if (statok != 0) - statok = stat(pp->lock_file, &stb); + if (fstat(lfd, &stb) != 0) { + syslog(LOG_ERR, "%s: fstat(%s): %m", pp->printer, + pp->lock_file); + exit(1); + } + if ((stb.st_mode & LFM_PRINT_DIS) != 0) { + exit(0); /* printing disabled */ + } /* turn off non-blocking mode (was turned on for lock effects only) */ if (fcntl(lfd, F_SETFL, 0) < 0) { syslog(LOG_ERR, "%s: fcntl(%s): %m", pp->printer, @@ -219,8 +218,7 @@ printjob(struct printer *pp) /* * write process id for others to know */ - sprintf(line, "%u\n", printpid); - pidoff = i = strlen(line); + pidoff = i = snprintf(line, sizeof(line), "%u\n", printpid); if (write(lfd, line, i) != i) { syslog(LOG_ERR, "%s: write(%s): %m", pp->printer, pp->lock_file); @@ -248,9 +246,10 @@ printjob(struct printer *pp) tempstderr); exit(1); } - if ((i = fchmod(tempfd, 0664)) == -1) { + if (fchmod(tempfd, 0664) == -1) { syslog(LOG_ERR, "%s: fchmod(%s): %m", pp->printer, tempstderr); + (void) unlink(tempstderr); exit(1); } /* lpd doesn't need it to be open, it just needs it to exist */ @@ -362,15 +361,18 @@ again: goto again; } -char fonts[4][50]; /* fonts for troff */ +char fonts[4][64]; /* fonts for troff */ -char ifonts[4][40] = { +char ifonts[4][64] = { _PATH_VFONTR, _PATH_VFONTI, _PATH_VFONTB, _PATH_VFONTS, }; +_Static_assert(sizeof(fonts) == sizeof(ifonts), "fonts != ifonts"); +_Static_assert(sizeof(fonts[0]) == sizeof(ifonts[0]), "fonts[0] != ifonts[0]"); + /* * The remaining part is the reading of the control file (cf) * and performing the various actions. @@ -394,10 +396,9 @@ printit(struct printer *pp, char *file) /* * Reset troff fonts. */ - for (i = 0; i < 4; i++) - strcpy(fonts[i], ifonts[i]); + memcpy(fonts, ifonts, sizeof(fonts)); sprintf(&width[2], "%ld", pp->page_width); - strcpy(indent+2, "0"); + strcpy(indent, "-i0"); /* initialize job-specific count of datafiles processed */ job_dfcnt = 0; @@ -945,7 +946,7 @@ sendit(struct printer *pp, char *file) strlcpy(indent+2, line + 1, sizeof(indent) - 2); } else if (line[0] >= 'a' && line[0] <= 'z') { dfcopies = 1; - strcpy(last, line); + memcpy(last, line, sizeof(last)); while ((i = get_line(cfp)) != 0) { if (strcmp(last, line) != 0) break; From nobody Mon May 25 17:03:09 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 4gPMdp08Pfz6fXlW for ; Mon, 25 May 2026 17:03:10 +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 4gPMdn1p0cz44Gj for ; Mon, 25 May 2026 17:03:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779728589; 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=h2D16L/sW1QvAwJf/H421gXQkWmzvMBpJx246zeaWs4=; b=NG0bf1OZoVnoTa16dnBk9O55pdmvTZdk13xNirP0gn6H1o7l6Lcxl0DDPapyxCMfDMnuUD 9LGpSiZUIaqFznevlIWyxQGJvS0O77GzPdFyVTsTQj6zwgeKfjFiEF5vbwX57ECAhxvkOv LbYKMEZqT1tO6l1lqBS0+0hzJ4LotyxEuPbqr8r59dtPkR/ZIa/gdHm+P8kPSGP7ufnkZ6 /e0fFybaGru6rfwc11semjRzF1BSlSHM98Hg652vyUvkjvYu2k33Ri4+/NLZuebld7B2c0 NDER5iBnxaHgUKrAoNioURqxVEtogN7UDiSd5Jk12xaptC7atAolHjyUD7znTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779728589; a=rsa-sha256; cv=none; b=lQrnFVRdx/gFQ5fUaWlJfiWTEJGG+Ts2dELALBN347ZI6Z2nWQLnhWawd5+MoLEGsk0II1 Ka8y4QZvNPMrd+KHn6Ifn7XZxoZwDaFa+cXd1Oox94usZa9YoB2vfDCPUE7iCUc8Wcyu1u c/Y+dScutqpjPZ0Ywxrdx5pBR/Ez38elnu2KZCJ67yBShTuG5knDR2yRqUxIxS5hZJcrSz p50bXWBb9GfE2g9ND4sTeM2fdFtFeQwVQqWU3KYIoOAwrmIKNNr4Tiou5cUv+rqZosHbUc spkdPJOZp053LkeN+dmwHCGhEFgRz1RhFRi62F0xT9CK4GcM0MVi29FHXBBH2w== 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=1779728589; 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=h2D16L/sW1QvAwJf/H421gXQkWmzvMBpJx246zeaWs4=; b=V2tSv4FEHc0LNdMbPO9TjwXPEEGWU/YyyRLRvkOJFZzXJmqJU4cuMn9gBeehjvVMnPt/tN wSatv4H4jkiYqn6D8HB8xUmhfb0rTiC0nTVZENkIkX29RnkuMTk6hxRcjZ2MzEKNN73Atv jRJDV/NNoiYi1VwO5faQnbGXLCc/QP9M6cXE2TMEqe2O/hm17wzdy8/kbQ5cK700heB5qX GbAPcFnA79Z4B5o2Wej7emGSr6tDVzl9PEH9LXCd75x0A7lK5ABRJyjIdw63hMYEe8jiYH ZQ6sZopw1GNRNAu4RiFkf11UaUDsN7N58XHC417sOB4XbQRkRTsxkOBCbAvXTA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPMdn16kyzr9s for ; Mon, 25 May 2026 17:03:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38221 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 17:03:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 123591e41c55 - main - lpd: Style and whitespace cleanup 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 123591e41c559fc2ae0f179f1385df05132881da Auto-Submitted: auto-generated Date: Mon, 25 May 2026 17:03:09 +0000 Message-Id: <6a1480cd.38221.3663fb6f@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=123591e41c559fc2ae0f179f1385df05132881da commit 123591e41c559fc2ae0f179f1385df05132881da Author: Dag-Erling Smørgrav AuthorDate: 2026-05-25 16:51:58 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-25 16:52:17 +0000 lpd: Style and whitespace cleanup No functional change intended. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57186 --- usr.sbin/lpr/lpd/printjob.c | 189 +++++++++++++++++++++----------------------- 1 file changed, 91 insertions(+), 98 deletions(-) diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 5ed7f0409679..9173b69a36b9 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -136,10 +136,10 @@ static int printit(struct printer *_pp, char *_file); static void pstatus(const struct printer *_pp, const char *_msg, ...) __printflike(2, 3); static char response(const struct printer *_pp); -static void scan_out(struct printer *_pp, int _scfd, char *_scsp, +static void scan_out(struct printer *_pp, int _scfd, char *_scsp, int _dlm); static char *scnline(int _key, char *_p, int _c); -static int sendfile(struct printer *_pp, int _type, char *_file, +static int sendfile(struct printer *_pp, int _type, char *_file, char _format, int _copyreq); static int sendit(struct printer *_pp, char *_file); static void sendmail(struct printer *_pp, char *_userid, int _bombed); @@ -150,18 +150,17 @@ void printjob(struct printer *pp) { struct stat stb; - register struct jobqueue *q, **qp; + struct jobqueue *q, **qp; struct jobqueue **queue; - register int i, nitems; off_t pidoff; pid_t printpid; - int errcnt, jobcount, tempfd; + int i, errcnt, jobcount, nitems, tempfd; jobcount = 0; init(pp); /* set up capabilities */ (void) write(STDOUT_FILENO, "", 1); /* ack that daemon is started */ (void) close(STDERR_FILENO); /* set up log file */ - if (open(pp->log_file, O_WRONLY|O_APPEND, LOG_FILE_MODE) < 0) { + if (open(pp->log_file, O_WRONLY | O_APPEND, LOG_FILE_MODE) < 0) { syslog(LOG_ERR, "%s: open(%s): %m", pp->printer, pp->log_file); (void) open(_PATH_DEVNULL, O_WRONLY); @@ -191,8 +190,8 @@ printjob(struct printer *pp) exit(1); } umask(S_IWOTH); - lfd = open(pp->lock_file, O_WRONLY|O_CREAT|O_EXLOCK|O_NONBLOCK, - LOCK_FILE_MODE); + lfd = open(pp->lock_file, O_WRONLY | O_CREAT | O_EXLOCK | O_NONBLOCK, + LOCK_FILE_MODE); if (lfd < 0) { if (errno == EWOULDBLOCK) /* active daemon present */ exit(0); @@ -228,7 +227,7 @@ printjob(struct printer *pp) * search the spool directory for work and sort by queue order. */ if ((nitems = getq(pp, &queue)) < 0) { - syslog(LOG_ERR, "%s: can't scan %s", pp->printer, + syslog(LOG_ERR, "%s: can't scan %s", pp->printer, pp->spool_dir); exit(1); } @@ -262,7 +261,7 @@ again: * write the name of the current control file into the lock file * so the spool queue program can tell what we're working on */ - for (qp = queue; nitems--; free((char *) q)) { + for (qp = queue; nitems--; free(q)) { q = *qp++; if (stat(q->job_cfname, &stb) < 0) continue; @@ -315,12 +314,12 @@ again: } (void) close(pfd); /* close printer */ if (ftruncate(lfd, pidoff) < 0) - syslog(LOG_WARNING, "%s: ftruncate(%s): %m", + syslog(LOG_WARNING, "%s: ftruncate(%s): %m", pp->printer, pp->lock_file); openpr(pp); /* try to reopen printer */ goto restart; } else { - syslog(LOG_WARNING, "%s: job could not be %s (%s)", + syslog(LOG_WARNING, "%s: job could not be %s (%s)", pp->printer, pp->remote ? "sent to remote host" : "printed", q->job_cfname); @@ -380,9 +379,8 @@ _Static_assert(sizeof(fonts[0]) == sizeof(ifonts[0]), "fonts[0] != ifonts[0]"); static int printit(struct printer *pp, char *file) { - register int i; char *cp; - int bombed, didignorehdr; + int bombed, didignorehdr, i; bombed = OK; didignorehdr = 0; @@ -402,7 +400,7 @@ printit(struct printer *pp, char *file) /* initialize job-specific count of datafiles processed */ job_dfcnt = 0; - + /* * read the control file for work to do * @@ -450,7 +448,7 @@ printit(struct printer *pp, char *file) case 'H': strlcpy(origin_host, line + 1, sizeof(origin_host)); if (class[0] == '\0') { - strlcpy(class, line+1, sizeof(class)); + strlcpy(class, line + 1, sizeof(class)); } continue; @@ -459,14 +457,14 @@ printit(struct printer *pp, char *file) if (pp->restricted) { /* restricted */ if (getpwnam(logname) == NULL) { bombed = NOACCT; - sendmail(pp, line+1, bombed); + sendmail(pp, line + 1, bombed); goto pass2; } } continue; case 'S': - cp = line+1; + cp = line + 1; i = 0; while (*cp >= '0' && *cp <= '9') i = i * 10 + (*cp++ - '0'); @@ -502,7 +500,7 @@ printit(struct printer *pp, char *file) case 'L': /* identification line */ if (!pp->no_header && !pp->header_last) - banner(pp, line+1, jobname); + banner(pp, line + 1, jobname); continue; case '1': /* troff fonts */ @@ -516,11 +514,11 @@ printit(struct printer *pp, char *file) continue; case 'W': /* page width */ - strlcpy(width+2, line + 1, sizeof(width) - 2); + strlcpy(width + 2, line + 1, sizeof(width) - 2); continue; case 'I': /* indent amount */ - strlcpy(indent+2, line + 1, sizeof(indent) - 2); + strlcpy(indent + 2, line + 1, sizeof(indent) - 2); continue; case 'Z': /* locale for pr */ @@ -542,7 +540,7 @@ printit(struct printer *pp, char *file) pp->printer, line[0], &line[1]); continue; } - i = print(pp, line[0], line+1); + i = print(pp, line[0], line + 1); switch (i) { case ERROR: if (bombed == OK) @@ -574,18 +572,18 @@ pass2: switch (line[0]) { case 'L': /* identification line */ if (!pp->no_header && pp->header_last) - banner(pp, line+1, jobname); + banner(pp, line + 1, jobname); continue; case 'M': if (bombed < NOACCT) /* already sent if >= NOACCT */ - sendmail(pp, line+1, bombed); + sendmail(pp, line + 1, bombed); continue; case 'U': - if (strchr(line+1, '/')) + if (strchr(line + 1, '/')) continue; - (void) unlink(line+1); + (void) unlink(line + 1); } /* * clean-up in case another control file exists @@ -608,14 +606,13 @@ pass2: static int print(struct printer *pp, int format, char *file) { - register int n, i; - register char *prog; - int fi, fo; + char buf[SPL_BUFSIZ]; + struct stat stb; + char *av[15]; + char *prog; FILE *fp; - char *av[15], buf[SPL_BUFSIZ]; pid_t wpid; - int p[2], retcode, stopped, wstatus, wstatus_set; - struct stat stb; + int fi, fo, i, n, p[2], retcode, stopped, wstatus, wstatus_set; /* Make sure the entire data file has arrived. */ wait4data(pp, file); @@ -679,7 +676,7 @@ print(struct printer *pp, int format, char *file) execl(_PATH_PR, "pr", width, length, "-h", *title ? title : " ", "-L", *locale ? locale : "C", - "-F", (char *)0); + "-F", NULL); syslog(LOG_ERR, "cannot execl %s", _PATH_PR); exit(2); } @@ -728,7 +725,7 @@ print(struct printer *pp, int format, char *file) case 'd': /* print tex output */ (void) unlink(".railmag"); if ((fo = creat(".railmag", FILMOD)) < 0) { - syslog(LOG_ERR, "%s: cannot create .railmag", + syslog(LOG_ERR, "%s: cannot create .railmag", pp->printer); (void) unlink(".railmag"); } else { @@ -741,7 +738,7 @@ print(struct printer *pp, int format, char *file) } (void) close(fo); } - prog = (format == 't') ? pp->filters[LPF_TROFF] + prog = (format == 't') ? pp->filters[LPF_TROFF] : ((format == 'n') ? pp->filters[LPF_DITROFF] : pp->filters[LPF_DVI]); av[1] = pxwidth; @@ -815,7 +812,7 @@ start: dup2(fo, STDOUT_FILENO); /* setup stderr for the filter (child process) * so it goes to our temporary errors file */ - n = open(tempstderr, O_WRONLY|O_TRUNC, 0664); + n = open(tempstderr, O_WRONLY | O_TRUNC, 0664); if (n >= 0) dup2(n, STDERR_FILENO); closelog(); @@ -887,8 +884,9 @@ start: static int sendit(struct printer *pp, char *file) { + char last[sizeof(line)]; + char *cp; int dfcopies, err, i; - char *cp, last[sizeof(line)]; /* * open control file @@ -918,7 +916,7 @@ sendit(struct printer *pp, char *file) while (get_line(cfp)) { again: if (line[0] == 'S') { - cp = line+1; + cp = line + 1; i = 0; while (*cp >= '0' && *cp <= '9') i = i * 10 + (*cp++ - '0'); @@ -937,13 +935,13 @@ sendit(struct printer *pp, char *file) strlcpy(logname, line + 1, sizeof(logname)); if (pp->restricted) { /* restricted */ if (getpwnam(logname) == NULL) { - sendmail(pp, line+1, NOACCT); + sendmail(pp, line + 1, NOACCT); err = ERROR; break; } } } else if (line[0] == 'I') { - strlcpy(indent+2, line + 1, sizeof(indent) - 2); + strlcpy(indent + 2, line + 1, sizeof(indent) - 2); } else if (line[0] >= 'a' && line[0] <= 'z') { dfcopies = 1; memcpy(last, line, sizeof(last)); @@ -952,7 +950,7 @@ sendit(struct printer *pp, char *file) break; dfcopies++; } - switch (sendfile(pp, '\3', last+1, *last, dfcopies)) { + switch (sendfile(pp, '\3', last + 1, *last, dfcopies)) { case OK: if (i) goto again; @@ -977,8 +975,8 @@ sendit(struct printer *pp, char *file) */ fseek(cfp, 0L, 0); while (get_line(cfp)) - if (line[0] == 'U' && !strchr(line+1, '/')) - (void) unlink(line+1); + if (line[0] == 'U' && !strchr(line + 1, '/')) + (void) unlink(line + 1); /* * clean-up in case another control file exists */ @@ -994,11 +992,10 @@ sendit(struct printer *pp, char *file) static int sendfile(struct printer *pp, int type, char *file, char format, int copyreq) { - int i, amt; + char buf[SPL_BUFSIZ], opt_c[4], opt_h[4], opt_n[4]; struct stat stb; char *av[15], *filtcmd; - char buf[SPL_BUFSIZ], opt_c[4], opt_h[4], opt_n[4]; - int copycnt, filtstat, narg, resp, sfd, sfres, sizerr, statrc; + int amt, copycnt, filtstat, i, narg, resp, sfd, sfres, sizerr, statrc; /* Make sure the entire data file has arrived. */ wait4data(pp, file); @@ -1258,12 +1255,12 @@ return_sfres: static void wait4data(struct printer *pp, const char *dfile) { + struct stat statdf; const char *cp; - int statres; - u_int sleepreq; size_t dlen, hlen; time_t amtslept, cur_time, prev_mtime; - struct stat statdf; + unsigned int sleepreq; + int statres; /* Skip these checks if the print job is from the local host. */ dlen = strlen(dfile); @@ -1348,10 +1345,11 @@ wait4data(struct printer *pp, const char *dfile) static int execfilter(struct printer *pp, char *f_cmd, char *f_av[], int infd, int outfd) { + char buf[BUFSIZ]; + char *slash; + FILE *errfp; pid_t fpid, wpid; int errfd, retcode, wstatus; - FILE *errfp; - char buf[BUFSIZ], *slash; fpid = dofork(pp, DORETURN); if (fpid != 0) { @@ -1413,7 +1411,7 @@ execfilter(struct printer *pp, char *f_cmd, char *f_av[], int infd, int outfd) */ dup2(infd, STDIN_FILENO); dup2(outfd, STDOUT_FILENO); - errfd = open(tempstderr, O_WRONLY|O_TRUNC, 0664); + errfd = open(tempstderr, O_WRONLY | O_TRUNC, 0664); if (errfd >= 0) dup2(errfd, STDERR_FILENO); closelog(); @@ -1486,7 +1484,7 @@ banner(struct printer *pp, char *name1, char *name2) static char * scnline(int key, char *p, int c) { - register int scnwidth; + int scnwidth; for (scnwidth = WIDTH; --scnwidth;) { key <<= 1; @@ -1500,12 +1498,12 @@ scnline(int key, char *p, int c) static void scan_out(struct printer *pp, int scfd, char *scsp, int dlm) { - register char *strp; - register int nchrs, j; - char outbuf[LINELEN+1], *sp, c, cc; - int d, scnhgt; + char outbuf[LINELEN + 1]; + char *sp, *strp; + int d, j, nchrs, scnhgt; + char c, cc; - for (scnhgt = 0; scnhgt++ < HEIGHT+DROP; ) { + for (scnhgt = 0; scnhgt++ < HEIGHT + DROP; ) { strp = &outbuf[0]; sp = scsp; for (nchrs = 0; ; ) { @@ -1514,9 +1512,10 @@ scan_out(struct printer *pp, int scfd, char *scsp, int dlm) for (j = WIDTH; --j;) *strp++ = BACKGND; else - strp = scnline(scnkey[(int)c][scnhgt-1-d], strp, cc); - if (*sp == dlm || *sp == '\0' || - nchrs++ >= pp->page_width/(WIDTH+1)-1) + strp = scnline(scnkey[(int)c][scnhgt - 1 - d], + strp, cc); + if (*sp == dlm || *sp == '\0' || + nchrs++ >= pp->page_width / (WIDTH + 1) - 1) break; *strp++ = BACKGND; *strp++ = BACKGND; @@ -1532,8 +1531,7 @@ scan_out(struct printer *pp, int scfd, char *scsp, int dlm) static int dropit(int c) { - switch(c) { - + switch (c) { case TRC('_'): case TRC(';'): case TRC(','): @@ -1543,7 +1541,6 @@ dropit(int c) case TRC('q'): case TRC('y'): return (DROP); - default: return (0); } @@ -1556,11 +1553,10 @@ dropit(int c) static void sendmail(struct printer *pp, char *userid, int bombed) { - register int i; - int p[2], s; - register const char *cp; struct stat stb; FILE *fp; + const char *cp; + int i, p[2], s; pipe(p); if ((s = dofork(pp, DORETURN)) == 0) { /* child */ @@ -1571,7 +1567,7 @@ sendmail(struct printer *pp, char *userid, int bombed) cp++; else cp = _PATH_SENDMAIL; - execl(_PATH_SENDMAIL, cp, "-t", (char *)0); + execl(_PATH_SENDMAIL, cp, "-t", NULL); _exit(0); } else if (s > 0) { /* parent */ dup2(p[1], STDOUT_FILENO); @@ -1600,8 +1596,8 @@ sendmail(struct printer *pp, char *userid, int bombed) break; case FILTERERR: cp = "FILTERERR"; - if (stat(tempstderr, &stb) < 0 || stb.st_size == 0 - || (fp = fopen(tempstderr, "r")) == NULL) { + if (stat(tempstderr, &stb) < 0 || stb.st_size == 0 || + (fp = fopen(tempstderr, "r")) == NULL) { printf("\nhad some errors and may not have printed\n"); break; } @@ -1633,9 +1629,9 @@ sendmail(struct printer *pp, char *userid, int bombed) static int dofork(const struct printer *pp, int action) { + struct passwd *pwd; pid_t forkpid; int i, fail; - struct passwd *pwd; forkpid = -1; if (daemon_uname == NULL) { @@ -1714,7 +1710,6 @@ error_ret: static void abortpr(int signo __unused) { - (void) unlink(tempstderr); kill(0, SIGINT); if (of_pid > 0) @@ -1744,12 +1739,13 @@ init(struct printer *pp) void startprinting(const char *printer) { - struct printer myprinter, *pp = &myprinter; + struct printer myprinter; + struct printer *pp = &myprinter; int status; init_printer(pp); status = getprintcap(printer, pp); - switch(status) { + switch (status) { case PCAPERR_OSERR: syslog(LOG_ERR, "can't open printer description file: %m"); exit(1); @@ -1770,8 +1766,8 @@ startprinting(const char *printer) static void openpr(const struct printer *pp) { - int p[2]; char *cp; + int p[2]; if (pp->remote) { openrem(pp); @@ -1782,7 +1778,7 @@ openpr(const struct printer *pp) * local print queues. For remote machines, all 'of=' * filter processing is handled in sendfile(), and that * does not use these global "output filter" variables. - */ + */ ofd = -1; of_pid = 0; return; @@ -1816,8 +1812,7 @@ openpr(const struct printer *pp) cp = pp->filters[LPF_OUTPUT]; else cp++; - execl(pp->filters[LPF_OUTPUT], cp, width, length, - (char *)0); + execl(pp->filters[LPF_OUTPUT], cp, width, length, NULL); syslog(LOG_ERR, "%s: execl(%s): %m", pp->printer, pp->filters[LPF_OUTPUT]); exit(1); @@ -1837,11 +1832,10 @@ openpr(const struct printer *pp) static void opennet(const struct printer *pp) { - register int i; - int resp; - u_long port; - char *ep; void (*savealrm)(int); + char *ep; + unsigned long port; + int i, resp; port = strtoul(pp->lp, &ep, 0); if (*ep != '@' || port > 65535) { @@ -1874,7 +1868,7 @@ opennet(const struct printer *pp) pstatus(pp, "waiting for %s to come up", pp->lp); else - pstatus(pp, + pstatus(pp, "waiting for access to printer on %s", pp->lp); } @@ -1889,7 +1883,7 @@ opennet(const struct printer *pp) static void opentty(const struct printer *pp) { - register int i; + int i; for (i = 1; ; i = i < 32 ? i << 1 : i) { pfd = open(pp->lp, pp->rw ? O_RDWR : O_WRONLY); @@ -1902,7 +1896,7 @@ opentty(const struct printer *pp) exit(1); } if (i == 1) - pstatus(pp, + pstatus(pp, "waiting for %s to become ready (offline?)", pp->printer); sleep(i); @@ -1918,9 +1912,8 @@ opentty(const struct printer *pp) static void openrem(const struct printer *pp) { - register int i; - int resp; void (*savealrm)(int); + int i, resp; for (i = 1; ; i = i < 256 ? i << 1 : i) { resp = -1; @@ -1930,16 +1923,15 @@ openrem(const struct printer *pp) alarm(0); (void)signal(SIGALRM, savealrm); if (pfd >= 0) { - if ((writel(pfd, "\2", pp->remote_queue, "\n", - (char *)0) - == 2 + strlen(pp->remote_queue)) - && (resp = response(pp)) == 0) + if (writel(pfd, "\2", pp->remote_queue, "\n", NULL) == + 2 + strlen(pp->remote_queue) && + (resp = response(pp)) == 0) break; (void) close(pfd); } if (i == 1) { if (resp < 0) - pstatus(pp, "waiting for %s to come up", + pstatus(pp, "waiting for %s to come up", pp->remote_host); else { pstatus(pp, @@ -1961,7 +1953,7 @@ setty(const struct printer *pp) { struct termios ttybuf; - if (ioctl(pfd, TIOCEXCL, (char *)0) < 0) { + if (ioctl(pfd, TIOCEXCL, NULL) < 0) { syslog(LOG_ERR, "%s: ioctl(TIOCEXCL): %m", pp->printer); exit(1); } @@ -1990,22 +1982,23 @@ setty(const struct printer *pp) static void pstatus(const struct printer *pp, const char *msg, ...) { - int fd; - char *buf; va_list ap; - va_start(ap, msg); + char *buf; + int fd; umask(S_IWOTH); - fd = open(pp->status_file, O_WRONLY|O_CREAT|O_EXLOCK, STAT_FILE_MODE); + fd = open(pp->status_file, O_WRONLY | O_CREAT | O_EXLOCK, + STAT_FILE_MODE); if (fd < 0) { syslog(LOG_ERR, "%s: open(%s): %m", pp->printer, pp->status_file); exit(1); } ftruncate(fd, 0); + va_start(ap, msg); vasprintf(&buf, msg, ap); va_end(ap); - writel(fd, buf, "\n", (char *)0); + writel(fd, buf, "\n", NULL); close(fd); free(buf); } From nobody Mon May 25 19:10:47 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 4gPQT51TK6z6fmfW for ; Mon, 25 May 2026 19:10:49 +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 4gPQT43gM9z4NNZ for ; Mon, 25 May 2026 19:10:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779736248; 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=G7wEHgfCagMcOwNhB+iY81CC32utVWdFwt5NUk0vxvY=; b=QGmBHF1HK1ksepgwvXugj/Qq5TWxbP8RUsGOiXIVDvqm4rcfOCH/q2QExi/OU+coW+tAjF YIugvnHU48CuyrVmmzEbkWVyg4qNKWAMvgyjvUd7VglDUlFsLZzqHhtWDWzwl/sDTiVieT e5sBFHg4slMHPyM59yUKxOfBLpOSQktAEg6476OlhF3zJMe4Ef76ez/gOe809b4omH84Ot PXBnlXX/HccxMlIFx0P/UVdgsPZsraEsNFO9yhf+bta8viFmWXaBHQJQyF/zoiyz2rCB6Y CoN7LmXsuZ9pgy+dgq4lfCYBYImOKeJZVEjRRG5jfvY5Z6IJww/8EujlizpOag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779736248; a=rsa-sha256; cv=none; b=lSN7hA0PiIGCfwi1gslZX/nDgXap2oXvn3aBS1urowVDYFDflRFnlQz2uRtLe0knDk2Lfv W9LkajA3g2ZWRTocYwanb8oyA3G5H+1aDBr/WWyDHb/sztSgS/TvH3kSGTGowLi21ezu2T 2vY/iuSS0cFzgJVdpikyt43XkS15JpsFwW6qbxkmDpOXDbSjjtoa01hr1gvik01uDg9L9y EnluLXSTgDM86lMHnf+FxCIOjlr8YnkYAtRqfVa83V/mjBC8LIQ9CwKXcrF79bEVyGO3Ms E/zQDPcg1yNNRCCSN6Fs6ISaKk8CTMAd9BKKa7ZE9/P1II50NIzEC/gb/6xn+g== 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=1779736248; 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=G7wEHgfCagMcOwNhB+iY81CC32utVWdFwt5NUk0vxvY=; b=P7hm/9/0Bl2emF7FVZRg8tWRF2JfR8Sta0suVxctHCifuFrlo2knLH3oXFZ4DyQ24XHSzQ IIpgqFb8A/XTIYSpQCSCK/6AapuG8osw11/6okChftqEGhJOJ0Mg2JmagXoAYTONowxDHW WGdoKjn36qI192AqvKrdyhF79SLCeVIYQPobyk+B3nZi4egUcE29U6bR4VZZ8FGog5ilrh YO9Jt6GtWQkiEs/QHxEnKHvlITRETOjlcb+nvaHR0QVOk5ew4JSOboONH+hlTy4x+oHoXd FHIlQ71zKGH63yANHuAahegPZZ++tqUQ5LuvSIghL+JS8ko7KqROOxCvMCbcLw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPQT42rxmztpZ for ; Mon, 25 May 2026 19:10:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 44c66 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 19:10:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 5b8f59e64843 - main - sqlite3: Vendor import of sqlite3 3.53.1 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: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b8f59e648431715e8f5f60ef09c0be4508b3ae6 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 19:10:47 +0000 Message-Id: <6a149eb7.44c66.73d11f1c@gitrepo.freebsd.org> The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=5b8f59e648431715e8f5f60ef09c0be4508b3ae6 commit 5b8f59e648431715e8f5f60ef09c0be4508b3ae6 Merge: 123591e41c55 b00eb376e3fb Author: Cy Schubert AuthorDate: 2026-05-25 17:19:28 +0000 Commit: Cy Schubert CommitDate: 2026-05-25 17:19:28 +0000 sqlite3: Vendor import of sqlite3 3.53.1 Release notes at https://www.sqlite.org/releaselog/3_53_1.html. Obtained from: https://www.sqlite.org/2026/sqlite-autoconf-3530100.tar.g Merge commit 'b00eb376e3fb28e738f9370552dae9d92c1fdd76' into sqlite3 contrib/sqlite3/Makefile.in | 11 +- contrib/sqlite3/Makefile.msc | 107 +- contrib/sqlite3/VERSION | 2 +- contrib/sqlite3/autosetup/README.md | 19 +- contrib/sqlite3/autosetup/autosetup | 18 +- contrib/sqlite3/autosetup/cc-shared.tcl | 10 +- contrib/sqlite3/autosetup/jimsh0.c | 47 +- contrib/sqlite3/autosetup/proj.tcl | 579 +- contrib/sqlite3/autosetup/sqlite-config.tcl | 259 +- contrib/sqlite3/autosetup/teaish/core.tcl | 141 +- contrib/sqlite3/autosetup/teaish/tester.tcl | 71 +- contrib/sqlite3/make.bat | 2 + contrib/sqlite3/shell.c | 21437 +++++++++++++++----------- contrib/sqlite3/sqlite3.1 | 28 +- contrib/sqlite3/sqlite3.c | 16223 +++++++++++++------ contrib/sqlite3/sqlite3.h | 946 +- contrib/sqlite3/sqlite3ext.h | 16 + contrib/sqlite3/sqlite3rc.h | 2 +- contrib/sqlite3/tea/Makefile.in | 84 +- contrib/sqlite3/tea/README.txt | 18 +- contrib/sqlite3/tea/_teaish.tester.tcl.in | 3 +- contrib/sqlite3/tea/configure | 17 +- contrib/sqlite3/tea/doc/sqlite3.n | 15 - contrib/sqlite3/tea/generic/tclsqlite3.c | 562 +- contrib/sqlite3/tea/teaish.tcl | 10 +- 25 files changed, 25692 insertions(+), 14935 deletions(-) diff --cc contrib/sqlite3/make.bat index 000000000000,2dc9b61c0e18..2dc9b61c0e18 mode 000000,100644..100644 --- a/contrib/sqlite3/make.bat +++ b/contrib/sqlite3/make.bat From nobody Mon May 25 19:17:08 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 4gPQcN57Mdz6fn2W for ; Mon, 25 May 2026 19:17:08 +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 4gPQcN4bNBz4PLS for ; Mon, 25 May 2026 19:17:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779736628; 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=vuN+DtgiAMCkijhCLElpw0aHYnvgW1OSXOFp/ZPDRhg=; b=otvo2OUkEzmvVuYyy+nJfeIOajLxgioAWWOgVRXCsgNgMGQMjSJUbV495thCW6YtTFcYu/ xriihberCNrZuaO1XDFKT48iG6heVnCHjEmDLyY9qE4qWdVmuEryUPrxvL1qy/9oyiFc+/ VW/EIhYaRfYw6tS/h7aPw2bYJIdhfM2kPQamkzJ/eNioZcOfCeG5zlQe7YQ6t+wulgohrv G4gaNa8gDBJpP94Qizt+uDD4IRTcUVbyg8xUSEMLz/gosqCdtg3KWeAx7KjUTKBqsOzS3k SW81xhauDhZnlDF3g1LP20jtvJxw7IiDIYkC8UlFv48f59qRcwq6oszXegGb5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779736628; a=rsa-sha256; cv=none; b=ZazL1zjW1P0mRc8figIrgqMXJICoxpOGjhE01kE0cC3hkdYPX1t378huHUk71TThNXgNfX kjPsghk/PMMlNuS0zJ26vNyo3zzMoVKdHAsPRsh6qT+2DmC1maDtGb9lIdaGzviYu7lvJu DVClimd3q95VM19/9N9a35Y00DWS0kX0yRvdACtGPmiatNq3kUQufe8N03dUhhvDYfHVdI +toKZmMpAPOmwrb5b5b7dJGrVCqLIgEqUlqTBOPQcytoxT7YPEroBmvsAo22W7sBKAJQb8 sEAINJnav2e7t1dFMolVIisU6cX6ISIKLOu+Ed03UfZB3vTUH5DijrKNGYzUNw== 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=1779736628; 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=vuN+DtgiAMCkijhCLElpw0aHYnvgW1OSXOFp/ZPDRhg=; b=nEIAOykNIhoSnkijzwNbZxXehggliPhDM0qFL4JSjmIycQH6daIgRLAfCAYcKfuPIIxrpd wvupkZrPC1N0wjkZY8p7oP8CGrrwH2XnHH5N6WMMdpqyI/8pI0w+QHEOrzChXQAwN3Y3FC F3dzgjVJ+1mHykmN0EPAxsEQ0gzG11pIvEKe4e6/fc3VN68kudDsv+TjBW++E/iP+JXoKF /PSi+Kupn08AkDMGHt7HFfbofsmIBd8U4Rm6dtEoCwsyljuSAeJuyVw20PD7jAdEu9ojrF JVhWT+d/nWtEFcb/d2MnDDR5+S7rNbjyq2O3r44heIXEyh/iVqBsaQ4Z2FJ5lg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPQcN3zN7zv1p for ; Mon, 25 May 2026 19:17:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4547b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 19:17:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jilles Tjoelker Subject: git: be9f35396449 - main - Revert "sh/tests: Cut down builtins/read12.0 by 2 seconds" 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: jilles X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be9f35396449129ebe952fdd1c080f7856dee030 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 19:17:08 +0000 Message-Id: <6a14a034.4547b.382fad18@gitrepo.freebsd.org> The branch main has been updated by jilles: URL: https://cgit.FreeBSD.org/src/commit/?id=be9f35396449129ebe952fdd1c080f7856dee030 commit be9f35396449129ebe952fdd1c080f7856dee030 Author: Jilles Tjoelker AuthorDate: 2026-05-25 19:15:51 +0000 Commit: Jilles Tjoelker CommitDate: 2026-05-25 19:16:52 +0000 Revert "sh/tests: Cut down builtins/read12.0 by 2 seconds" Dag-Erling Smørgrav does not like this, but I do not understand why. This reverts commit 1df431576f99c3cc26dd4ceb1a6eda864cc9f196. --- bin/sh/tests/builtins/read11.0 | 3 +-- bin/sh/tests/builtins/read12.0 | 14 ++++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/bin/sh/tests/builtins/read11.0 b/bin/sh/tests/builtins/read11.0 index e57dfdbc0ea4..07bd3e70644c 100644 --- a/bin/sh/tests/builtins/read11.0 +++ b/bin/sh/tests/builtins/read11.0 @@ -27,7 +27,6 @@ ts=$(date +%s%3N) read -t 0 v <&3 || r=$? te=$(date +%s%3N) kill -TERM "$!" || : -[ "$r" -gt 128 ] -[ "$(kill -l "$r")" = ALRM ] +[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = ALRM ] [ $((te-ts)) -lt 250 ] [ -z "$v" ] diff --git a/bin/sh/tests/builtins/read12.0 b/bin/sh/tests/builtins/read12.0 index 3b501a56392b..4551555adfed 100644 --- a/bin/sh/tests/builtins/read12.0 +++ b/bin/sh/tests/builtins/read12.0 @@ -1,5 +1,5 @@ -# Verify that `read -t 1 v` succeeds immediately if input is available -# and times out after 1 s if not +# Verify that `read -t 3 v` succeeds immediately if input is available +# and times out after 3 s if not set -e @@ -15,7 +15,7 @@ exec 3 To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 1df431576f99 - main - sh/tests: Cut down builtins/read12.0 by 2 seconds Message-ID: References: <6a120625.45836.5e8588e2@gitrepo.freebsd.org> <86h5nx3e8b.fsf@ltc.des.dev> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86h5nx3e8b.fsf@ltc.des.dev> X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:60781, ipnet:85.17.0.0/16, country:NL] X-Rspamd-Queue-Id: 4gNqBZ1vKsz3pJ7 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Sun, May 24, 2026 at 01:20:20AM +0200, Dag-Erling Smørgrav wrote: > Please revert the non-functional parts of this change. Please explain what you are worried about in the change. Is this about false positives or false negatives? -- Jilles Tjoelker From nobody Mon May 25 19:22:18 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 4gPQkP2SCXz6fnrV; Mon, 25 May 2026 19:22:21 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mail03.stack.nl (lw02.stack.nl [85.17.116.62]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (prime256v1)) (Client CN "adm.stack.nl", Issuer "E8" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gPQkN70Bwz3Bns; Mon, 25 May 2026 19:22:20 +0000 (UTC) (envelope-from jilles@stack.nl) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=stack.nl; s=mail; t=1779736940; bh=goyPFQULQHDqFg/f3IB7JWEdtR+O/sNUZdImT3jID0k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SSvbEzhMyX6w8cW9JAaZfyvupKyCR5XXp4QlRBEKfbiYyT9+a9TZ7bP6wuF5hlYhg bEVAT3wu1wCkMgt35rFlfyrlrueQNsH2SdQgBOtXf4Hsygt5nAk+L7tllzFPj/hzYe f99KqriK0kfh3jBb2H4J5j6pvyGhwHC4V7NWPRACw4BNg2zOi6eJJGHAeFRgRC+gyy 9gxfTMoCTVjkqOMmlY4qE0O243HYlMBHHPUH+bnhBjSqn125Y+zzUwD1pzxcNw1rl4 aYKkkszN91Hv1COxTfvaSirgPDpj+mEUh5bRiUDZOxspa53mBAzU5bpGW/s6zZ7Zhu kTIliwR9Srt+Q== Received: from localhost (localhost.localdomain [127.0.0.1]) by mail03.stack.nl (Postfix) with ESMTP id 1A112A2510; Mon, 25 May 2026 21:22:20 +0200 (CEST) Received: from mail03.stack.nl ([127.0.0.1]) by localhost (mail03.stack.nl [127.0.0.1]) (amavis, port 10024) with ESMTP id jGWCx4ApwB4V; Mon, 25 May 2026 21:22:18 +0200 (CEST) Received: from blade.stack.nl (unknown [95.211.93.133]) by mail03.stack.nl (Postfix) with ESMTPS id 6A0CCA224D; Mon, 25 May 2026 21:22:18 +0200 (CEST) Received: by blade.stack.nl (Postfix, from userid 1677) id 5D47580513; Mon, 25 May 2026 21:22:18 +0200 (CEST) Date: Mon, 25 May 2026 21:22:18 +0200 From: Jilles Tjoelker To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 1df431576f99 - main - sh/tests: Cut down builtins/read12.0 by 2 seconds Message-ID: References: <6a120625.45836.5e8588e2@gitrepo.freebsd.org> <86h5nx3e8b.fsf@ltc.des.dev> <865x4c2bfn.fsf@ltc.des.dev> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <865x4c2bfn.fsf@ltc.des.dev> X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:60781, ipnet:85.17.0.0/16, country:NL] X-Rspamd-Queue-Id: 4gPQkN70Bwz3Bns X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Mon, May 25, 2026 at 09:30:36AM +0200, Dag-Erling Smørgrav wrote: > Jilles Tjoelker writes: > > Dag-Erling Smørgrav writes: > > > Please revert the non-functional parts of this change. > > Please explain what you are worried about in the change. Is this about > > false positives or false negatives? > The purpose of a test is to reliably fail if the functionality it tests > is broken. Your change turns my test from one that is fairly certain to > fail if the timeout functionality is broken to one that has a reasonable > chance of passing regardless. What's more, you justify the change with > a logical argument so fallacious that you _still_ refuse to explain it. > All that just to save yourself a couple of seconds once in a while, even > after I showed you how to save much more than two seconds simply by > enabling parallelism. Please revert, or I will. I have reverted the entire commit. Let's leave it as is until I understand what the problem is. -- Jilles Tjoelker From nobody Mon May 25 19:24:11 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 4gPQmW5RWmz6fndx for ; Mon, 25 May 2026 19:24:11 +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 4gPQmW4vp3z3CVl for ; Mon, 25 May 2026 19:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779737051; 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=hYTw3KEaPEJmatBtVlWF9DFktpFhfhaCO/kUfSwR3g4=; b=Dv1BMO1o3NpWVEBEkYckFmkYJ5Gih4FjOiBDSAfw3br3vOYUNgzIg9IqK5hdAyszqs9S9t D0mQ2nClIOb+D6vZwSn77Oq0IRRKZL6HapIJI8PzpRULvl7Pv4on0uspkbeBZkRa4QZ1nC bvXBnZuWWOImTlcWxStlkoNMu+XNi8tc+on8+6rXdkVDH97VoKOPO9/ASvKFbeBTrDsSIS SDfpeIZwEX16F66je6q2YrNm/QPZfEbQvj1z/WBnyxZh4qUWpP6Qy+tobRH5JUZPX6U5+q 7YRmGpkfXM7woLAxC8R3BghC1l0T8DeqnvLPqYQLUCBKc+DqwI6Yq3DNAx+dfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779737051; a=rsa-sha256; cv=none; b=VlKivzNeb2Fv6EBX38CR9k2wyWOvO3+ZSHWFihQ69A169SH0+AgznG/zF+PdRez1RpxguW HiK0KbRlAumgHUbCCWEJIGI9NFSH+5Yh6Cj3oP01NT7l3GimJuuywQV6yTnjVWzr0BAmbB N3LAnP1E4TooE5e9b3iD9CU6q/3zwc4+8IEZqbLL5gi3hgNu4OcEzsIhedXof2iZ3MUE9P mLisNIb0MKVBcJo5OuCykEZ3eecN+yHwtFXhFpS2eqCtE/gHgDR02NL8ZtHViRVpoq+pHM 1I9onTc5eqO3Ul240CppLcGJzuUcrB7dOnMl6muFgWLpaR4pLk2/qJjPrOmehA== 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=1779737051; 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=hYTw3KEaPEJmatBtVlWF9DFktpFhfhaCO/kUfSwR3g4=; b=i7R4pGtKJN6joHwTNASjMKVgaeqZgg+/q8XcOT07gpOTeVG2l4xkUbFsDYlsxBYR4GCDHv Hgn7BhJ3HfeSvxWuLVLDh766K3QckenJlpMV0SRsArMM7UejtxKFO5gVP19tAl8DaQO3g7 23DNjF9cwnsO5HPN8KSYG8vYsVqKyp5MnKjpD+iVHZOQzSqdwMQ0EzmStSVqxqCnkzAB3J bQ6Zrzi7pvfkkfwJS2ld0SdkmlN2vDgq/Vxo9BzB51+sA1GxJpS4BoRyePScGNRPzZ+V1B q+vkXRkzdHI9tRuPmEOkvZ4mUFuA654YOhg9YXfMcueu4i2ZNK93Az7L5NsI6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPQmW3tGZzvK0 for ; Mon, 25 May 2026 19:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4593c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 19:24:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 4d80d4913e79 - main - nfs: Fix argument typo to avoid a crash 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d80d4913e79c8b5918b1f04c1c7b38e6c76b9b4 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 19:24:11 +0000 Message-Id: <6a14a1db.4593c.687b0e74@gitrepo.freebsd.org> The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4d80d4913e79c8b5918b1f04c1c7b38e6c76b9b4 commit 4d80d4913e79c8b5918b1f04c1c7b38e6c76b9b4 Author: Rick Macklem AuthorDate: 2026-05-25 19:22:32 +0000 Commit: Rick Macklem CommitDate: 2026-05-25 19:22:32 +0000 nfs: Fix argument typo to avoid a crash A typo resulted in the wrong argument for a bytewise comparison that could result in a crash if the incorrect argument was not a valid pointer. This patch fixes the argument. While investigating this, I noticed that the correct argument was not being filled in as required, so this patch fixes that, as well. Somehow, recovery from a NFSv4.1/4.2 server crash worked during testing, so this was not detected. The bug/patch only affects NFS client mounts using NFSv4.1/4.2. PR: 294925 Reported by: Jov MFC after: 3 days --- sys/fs/nfs/nfs_commonkrpc.c | 5 +++-- sys/fs/nfs/nfs_commonsubs.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 9ea4e5f4c9df..2d4c41994c0e 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -1265,8 +1265,9 @@ tryagain: goto out; } sep = NFSMNT_MDSSESSION(nmp); - if (bcmp(sep->nfsess_sessionid, nd->nd_sequence, - NFSX_V4SESSIONID) == 0) { + if (bcmp(sep->nfsess_sessionid, + nd->nd_sessionid, NFSX_V4SESSIONID) == 0 && + sep->nfsess_defunct == 0) { printf("Initiate recovery. If server " "has not rebooted, " "check NFS clients for unique " diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index b5f83a98b307..a11b55b11c43 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -368,6 +368,7 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp, * First, fill in some of the fields of nd. */ nd->nd_slotseq = NULL; + NFSBZERO(nd->nd_sessionid, NFSX_V4SESSIONID); if (vers == NFS_VER4) { nd->nd_flag = ND_NFSV4 | ND_NFSCL; if (minorvers == NFSV41_MINORVERSION) @@ -5348,6 +5349,7 @@ nfsv4_setsequence(struct nfsmount *nmp, struct nfsrv_descript *nd, NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); nd->nd_sequence = tl; bcopy(sessionid, tl, NFSX_V4SESSIONID); + bcopy(sessionid, nd->nd_sessionid, NFSX_V4SESSIONID); tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; nd->nd_slotseq = tl; if (error == 0) { @@ -5593,6 +5595,7 @@ nfsrpc_destroysession(struct nfsmount *nmp, struct nfsclsession *tsep, 0, NULL); NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID); bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID); + bcopy(tsep->nfsess_sessionid, nd->nd_sessionid, NFSX_V4SESSIONID); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); From nobody Mon May 25 19:46:46 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 4gPRGh1SnBz6fqds for ; Mon, 25 May 2026 19:46:52 +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 4gPRGh0z6tz3FKd for ; Mon, 25 May 2026 19:46:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779738412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vgo97L2H3lbOG2iLJGLZhuneJ7iJEQS9R4OrIUQdA3E=; b=tyRt31U54OR58+Jc8IaIAHxtvgUHPiWT90NTL/2Y8P9qZNtQVQGl4ZUuDPn9fstpp7Xg6w FR3WSvhNnU2Fbwea1h/dtX/GN8O8FWt4i9FWeCmjzO+fdST4gKMIw3HK1skYUFrwY/aBb/ qQU20BDx4srBe4/TBPa4bJjZCXQvuw11OweAgCllRv6y132i+92jnsP6/sJ6wXmPjJlYpS SKdL4WEt7VGip30Cg0ZHIkvTmeiSnFijKf35iCPfN16DNNF4MPIfiq5lI9mRlKYFc1CA1S zrQx/ZK+fRKJy3xO5Hch/8vhGkHtpxlciU9woyiBGKcunffSCdO2MlKIDkYh8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779738412; a=rsa-sha256; cv=none; b=T4Xbe3VVZlDEc9tZbpcRlEAvLRjDCpSgBTyWpDNwyVhuZpYhkkm4A5kNNMqhUgnug//gX4 9Fb9V/1CnFBwUme6pMHVO2G+FfW0LG1lyIZ9eV/xgCvqwwzYcu6mEUcT+mn0ISfaqV4AIR zTKgUNqH6Fjlx+1AlEQ3BBAm1JmOgTI97KUAcDgPqt/rrwNINgYoi1cRGHhQy9ScMk6OZk 4HuiWU+bgukPkZ3YY0fa4vWwfActr/ICzgP1R1uMtnuVQ9gSQ4yqpEzqhVRSYjyvq0KEa/ 0jh/urChTsmQAOQXSjqNoYG9NgEI/MlKd4TEMhSlTPKGEvn4tfQPaicdnLRPTQ== 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=1779738412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vgo97L2H3lbOG2iLJGLZhuneJ7iJEQS9R4OrIUQdA3E=; b=asm+2YScZ8CZAI3JNPH2mhdE6Apd4hgxAA1Ba/KLO79ME8/cxrq1BfovAGc3/7y/zrcpEs z5G4lqHq9CTJJA0KhE5AbUxD1nEFT/z1wu4muBJGpdcw6z4NnHZhPoI/10BuvB+xirMyC7 7bHfHK2NjAPDOJyRxOnxd88URQyRTSQjg98yXyt5Dn4NXFkmYo0vxpgCqA/E0mmBihf+wA Pt6BIS2WWVxeP5zD37CRHHlap4un3kPiBvGNEA4xC5hYF3dBaZCO+iXqrwTaJa/zZLPRBr aFKeTr9J43hbWNxJp43rt5CAxI6xheO4Ki9G05UmlzY439ZPDZf195mpEi4Xzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPRGh09Ldzw8l for ; Mon, 25 May 2026 19:46:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 458d4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 19:46:46 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Peter Eriksson From: Rick Macklem Subject: git: 6e7c10c79dea - main - acl_id_to_name.c: Fix printing of uids and gids 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e7c10c79deac3c6bb6ad3bd12c8e0ad68bb59f0 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 19:46:46 +0000 Message-Id: <6a14a726.458d4.9729153@gitrepo.freebsd.org> The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=6e7c10c79deac3c6bb6ad3bd12c8e0ad68bb59f0 commit 6e7c10c79deac3c6bb6ad3bd12c8e0ad68bb59f0 Author: Peter Eriksson AuthorDate: 2026-05-25 19:44:41 +0000 Commit: Rick Macklem CommitDate: 2026-05-25 19:44:41 +0000 acl_id_to_name.c: Fix printing of uids and gids uid_t and gid_t are uint32_t (unsigned 32bit integers). They are printed as signed integers when calling getfacl (and other tools using the acl_to_text() libc function). This causes uid/gids larger than 2G (214783648) to print as negative numbers - which causes problem with setfacl since the acl_from_text() libc function fails on negative numbers. Reviewed by: rmacklem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57179 --- lib/libc/posix1e/acl_id_to_name.c | 4 ++-- lib/libc/posix1e/acl_to_text_nfs4.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/posix1e/acl_id_to_name.c b/lib/libc/posix1e/acl_id_to_name.c index 78e050a8648a..c90e6083cca1 100644 --- a/lib/libc/posix1e/acl_id_to_name.c +++ b/lib/libc/posix1e/acl_id_to_name.c @@ -67,7 +67,7 @@ _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf, else p = getpwuid(id); if (!p) - i = snprintf(buf, buf_len, "%d", id); + i = snprintf(buf, buf_len, "%ju", (uintmax_t)id); else i = snprintf(buf, buf_len, "%s", p->pw_name); @@ -83,7 +83,7 @@ _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf, else g = getgrgid(id); if (g == NULL) - i = snprintf(buf, buf_len, "%d", id); + i = snprintf(buf, buf_len, "%ju", (uintmax_t)id); else i = snprintf(buf, buf_len, "%s", g->gr_name); diff --git a/lib/libc/posix1e/acl_to_text_nfs4.c b/lib/libc/posix1e/acl_to_text_nfs4.c index 157215c9dd52..4f19f3a9a7b2 100644 --- a/lib/libc/posix1e/acl_to_text_nfs4.c +++ b/lib/libc/posix1e/acl_to_text_nfs4.c @@ -69,7 +69,7 @@ format_who(char *str, size_t size, const acl_entry_t entry, int numeric) else pwd = NULL; if (pwd == NULL) - snprintf(str, size, "user:%d", (unsigned int)*id); + snprintf(str, size, "user:%ju", (uintmax_t)*id); else snprintf(str, size, "user:%s", pwd->pw_name); acl_free(id); @@ -89,7 +89,7 @@ format_who(char *str, size_t size, const acl_entry_t entry, int numeric) else grp = NULL; if (grp == NULL) - snprintf(str, size, "group:%d", (unsigned int)*id); + snprintf(str, size, "group:%ju", (uintmax_t)*id); else snprintf(str, size, "group:%s", grp->gr_name); acl_free(id); From nobody Mon May 25 20:35:25 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 4gPSLk1YPLz6fwf0 for ; Mon, 25 May 2026 20:35:26 +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 4gPSLj67Czz3KVV for ; Mon, 25 May 2026 20:35:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779741325; 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=wVe2Yx3MQ7bOFlRIDN3T/NkNCIgipMPdBoM4m4ftGHs=; b=eNTd1gda5+48SJDdgPlrFuC/CyaGsTk6N4K+9qL6t3GcZTh4RrShu9wLgQzK3NyzE0HvaB p6DFp6OVDKQwm8aIxCjEIc+kYE0GoUMgU8QBIlct1PG59cRPsxHKs9HPMhRu5suPw3yfsg 35oxI8bhhZibVJfofEXF37Wvfn28zpPPkCzaIKluCHjPU36R1zTwYlkXF/Gyw5h8vV1Gba RFpnf29vV7vyZFO3mpxYG7IPNjwRq2MB5lrD6hf+FwHNisvkioG1tUV9/AJIWhpoB7BJCp mVY12SIXpzES/j5zpEMT8YbFg3eHnhSCgwq6lwz6NPep4QEn9ElqY1ZyJBog8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779741325; a=rsa-sha256; cv=none; b=A/c744PamaH9Bl/16lpKoFcw7r7hpZfOIUvFa00Xj7RgsR/BdkuIJQt1aipLQ7fokY2U6C bTSdJe1qs2fgyL3E551UpkxesEfTOVSWhNYgWaoGaPHfhVIvbipkU2FwTt84mGwYlbqiNH QgeLobFHZmOa2Qs328/j2hj8Y2H1TMeCSp5CxvxjssIikIn+2VZd/3wIkUBS7Y5tyUF2NJ Wu/aPbSA/cy/iCCGvKYe2BwiErEr6qWPGS/musoSP0eQbvuuYTUyvNS0vRH1dyPZbHG0ny 8C11mP+J3J7p2zHnBC/tz3WSmCIwSKwwCzjqAEc1tEdI5KWLAym1njesrQtmuA== 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=1779741325; 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=wVe2Yx3MQ7bOFlRIDN3T/NkNCIgipMPdBoM4m4ftGHs=; b=kvGv4ASIrexsrwtv9BOkIi5Pk+S34gtKg1+QWBVOG9AQPPgxfwyXXGOaX45gujkMrTpRjB qvI+ojs7TCZ4l0779ncgNpa7dWT20imFutvGKDg4smku2gNatCWYxFyFLTnY7tCtwnXPRH 1Mzu990NuWpXjPN9TdXe7OF/eFZzJ6G5ocT5NLEjksuOdw9L7A+s/wI6L1wcN5XCbaAEDU hjc2WVniBBum4pUuYB2y4029ojzEj8iChZfP2vbz36P0ZV8xoP3X4tpvL/id/usYNccSbc 6Pz13B3NVqw29jaG12TLZwwysDeb/4QRTG+BHV+zwMKlXx1VsgYSFN4nsmbZAQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPSLj5Wvnzxf6 for ; Mon, 25 May 2026 20:35:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1dbf1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 25 May 2026 20:35:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: b97ee5e9ce7b - main - hwpmc: Avoid panic on AMD cpus where IBS is not available 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: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b97ee5e9ce7b5598be596ef51872c1136b20cf88 Auto-Submitted: auto-generated Date: Mon, 25 May 2026 20:35:25 +0000 Message-Id: <6a14b28d.1dbf1.3ad6d51a@gitrepo.freebsd.org> The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=b97ee5e9ce7b5598be596ef51872c1136b20cf88 commit b97ee5e9ce7b5598be596ef51872c1136b20cf88 Author: Andrew Gallatin AuthorDate: 2026-05-25 20:33:52 +0000 Commit: Andrew Gallatin CommitDate: 2026-05-25 20:33:52 +0000 hwpmc: Avoid panic on AMD cpus where IBS is not available The recent IBS work intruduced a bug on older CPUs where the IBS handler will be called on NMIs even when IBS is not initialized. Work around this in the IBS handler by checking to see if ibs_pcpu is NULL before accessing it. --- sys/dev/hwpmc/hwpmc_ibs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/hwpmc/hwpmc_ibs.c b/sys/dev/hwpmc/hwpmc_ibs.c index 8cfe7b2df145..ae14f2ccb14c 100644 --- a/sys/dev/hwpmc/hwpmc_ibs.c +++ b/sys/dev/hwpmc/hwpmc_ibs.c @@ -510,6 +510,9 @@ pmc_ibs_intr(struct trapframe *tf) int retval, cpu; uint64_t config; + if (ibs_pcpu == NULL) + return (0); + cpu = curcpu; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[ibs,%d] out of range CPU %d", __LINE__, cpu)); From nobody Tue May 26 10:33:16 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 4gPpxS1pG5z6fnpG for ; Tue, 26 May 2026 10:33:16 +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 4gPpxS14hJz3Q4n for ; Tue, 26 May 2026 10:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779791596; 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=VNfBiQnIZIKNEFGxot+Sd1WGg5ZyvvyY3ge4hRlIcLE=; b=Z/9BwaVs1gUn2xRpIr/wNakcbQr4B/KBvBjhG932pwitoSVOWLwga5s0b5/Tu6lIg/R/3I kUN7SDkqo9MZuxI6rSv4Zma8/r3Vqt1yQVAUhmBHORYVelyxTe3x11uhRh3ru0m4JuoTah +ivrj6O1Y2eA06PUBdizceYD+X2aldRbsLf+acApBeaNikUz1mP+qF1yWwE5WMronOCA/m pyFWzO7gIymC/NvFZG90ilw+/M1wQVrK7ZsHdQ/wz5+qQ9zBHj6h17kEjLRpng++RE0Nnz +OuOvbzQqb+gwnAC4LpuBFOmOl5GVjgoMMj9lD5NGhlRbdk1hOTJDYuc4I+yYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779791596; a=rsa-sha256; cv=none; b=Y/D1/EPbfRXsy/pzhX+45gS+Xc8I3S0lR0P0IhhkcnZaEoIQCjwuCWaynBOH4+10TB0rz7 LVIx0v9z/lNcf8jQnEyp2Tk2nws72Y+Vv7OqUW5RPq03D7+lcyukHglwm51RgqSPgykoMC KOKWQ0KMmduPN+BDeOTGWpcvKC2NCplGqmfR/hho8QRVH+qp4QUasF4Jl33VAG7q+5+PoR gkjVlnztO9iTRm3/31yQeMviLnv691zAJPCwUaP/ZPQhlAAIt4JsglqXNwszgCEFjyPygy kJm73mSpVj08LFItvfNJm5GlCnt02BlMBFunRTrNeyF8q3vsd6ifwv2ar+kM/Q== 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=1779791596; 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=VNfBiQnIZIKNEFGxot+Sd1WGg5ZyvvyY3ge4hRlIcLE=; b=Ds+HQPB26/SFb/uCe1FoUH1rywKKa5zSqxoqSIAaaVBY5/1SelEkRfQaBfbaoqhVM+O6lt wWf1Z1U8RiKRqFW3aqlL2IKhhJA1LAysdqlQQBMFtV4E9ofNmlf/vhXZDLNCVUpLmUvjpv pX2IE//cMCnLPU5nXPfa3FlKclmPZp8VgwWtp89Ypwq9N2p/OVQYmiXo7X4vB0PT1a4kSg XHOt0ZE1HHpaNxjg9qOxcgaQD21Rq0+zfqWGQh/7Av8RgIrJpAf1f9D6QnowWHk/j4W59V dV6Lgg4GsjHfe0CXr1xVq7yj3G/97tu/6JJaZUqxTDOG7fovl58V/FuK4Lwq8Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPpxS0MpFz1N4f for ; Tue, 26 May 2026 10:33:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37e65 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 10:33:16 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: c6cefcbbbb3f - main - snd_hda: Patch Dell WYSE 7040 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6cefcbbbb3fd5bbe9e0c36c8c553364d444e2d8 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 10:33:16 +0000 Message-Id: <6a1576ec.37e65.53cb6f0d@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=c6cefcbbbb3fd5bbe9e0c36c8c553364d444e2d8 commit c6cefcbbbb3fd5bbe9e0c36c8c553364d444e2d8 Author: Christos Margiolis AuthorDate: 2026-05-25 11:40:05 +0000 Commit: Christos Margiolis CommitDate: 2026-05-26 10:32:56 +0000 snd_hda: Patch Dell WYSE 7040 https://forums.freebsd.org/threads/dell-wyse-7040-thin-client-intel-i5-6500te-built-in-sound-alc255-mini-how-to.102656/ Reported by: razif (on the forum) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/sound/pci/hda/hdaa_patches.c | 9 +++++++++ sys/dev/sound/pci/hda/hdac.h | 1 + 2 files changed, 10 insertions(+) diff --git a/sys/dev/sound/pci/hda/hdaa_patches.c b/sys/dev/sound/pci/hda/hdaa_patches.c index d4267aae80f8..2f3a044195c4 100644 --- a/sys/dev/sound/pci/hda/hdaa_patches.c +++ b/sys/dev/sound/pci/hda/hdaa_patches.c @@ -328,6 +328,15 @@ hdac_pin_patch(struct hdaa_widget *w) patch_str = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_ALC255 && subid == DELL_WYSE7040_SUBVENDOR) { + switch (nid) { + case 20: + patch_str = "as=1 seq=0 device=Speaker"; + break; + case 33: + patch_str = "as=1 seq=15 device=Headphones"; + break; + } } else if (id == HDA_CODEC_ALC256 && (subid == DELL_I7577_SUBVENDOR || subid == DELL_L7480_SUBVENDOR)) { switch (nid) { diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 27d592242578..36fd7b6a60ab 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -282,6 +282,7 @@ #define DELL_164AID_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x164a) #define DELL_164BID_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x164b) #define DELL_I7577_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x0802) +#define DELL_WYSE7040_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x0727) #define DELL_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0xffff) /* Clevo */ From nobody Tue May 26 12:34:14 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 4gPsd41NDjz6fkTP; Tue, 26 May 2026 12:34:16 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gPsd40jxjz3c6W; Tue, 26 May 2026 12:34:16 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779798856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dAl/hkNOxne+k20oZeP//PvX3J9neYjqSIPPyNct3pk=; b=k30bP4GPCva+6HZoCgr6NltLyr2ZSqhy92zohU/G8mLNbtwj0UgqCTa8df6gFdvMkA52Db 1uj8BHbMEBGPJPVPa+cMZM3y0IzkGcFrKNpjXLQGO6GvOvElF/xuiehJ58IyIXf0eYFq1x 2clc3y0JrYN65p8sZZ6yra+thkBS0RormG+iKaJc4TkvT37SK8JXeQcLKkFsrAKRfmCrSx jry3KK0MRzNrh24+Pw2LvQgHR5vt+cOXITtdZl25QmYll+0QPzHoN2I4E5m55RbTDCwhc2 pKpdfJ6CQqcxR0fv5qHclk2y3IKd2Isom8xKH5aWARXyeX4llURKiwmX8Azafg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779798856; a=rsa-sha256; cv=none; b=M7yTOEhHKdbgbbUwrcA0VW75X9nqeBjgLBNIdmSfCuqGFIWc8m/Nfv29IhCj/CO1NF1JN9 EhANw1b2iKj5JG/FtAEeFj8EJI42etYiu1GoUpDfveGbxWxQoq6dGSR21nHCTQh5qS8Qhc ymuq7ms7oMzheUjXWHg0PTeNrtnZ8QiC0TbeoaIRryUHAcxPEKIz08eEv8W3gCK1CSaYPm ziq3Q4Xohi240oVdq2KBXFqwNfCwZLLCMLjLPDNHyz+P7rVKK8ik1S7TcTSyvrpMvrtdOE QxKBzEgFvy1TeIWGl+OVWeDGVY8imeeK0I44DNDNG3OiGn8NJhdbrEoeeIaQGg== 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=1779798856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dAl/hkNOxne+k20oZeP//PvX3J9neYjqSIPPyNct3pk=; b=DKmAuZfu8Kxuet39nm2yiWVJYJwMjGijTBPJQzzyo9hCrRGwuzlS9mismBqCpL5Rl0BUtv eGWFhlzFGLIMg8IsVnVw4hb0Qd1+NVesa7Uncgb0WAY3G8zmYXt46AuoibLaZ329UlSoM9 ekwadxYVZSZvUG65WYmJ5wrTQE2CxDyrlJ2OyxICTpyTufPW23wyBxP6uarDwcYs71TcNP lKfga1HiH55BkZ88ChWMUanM0iSItqRyih0FWQTkAR6bYGCNBzmF3KqQzj3lTiI3row675 KkQK7KuPu/GybLLDX/U7047q7R44hoCO1rz/3T6//lrrWQ9iX7U7dEDT3rZz0A== Received: from ltc.des.dev (unknown [92.183.12.56]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gPsd36WVjz3nM; Tue, 26 May 2026 12:34:15 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id D9A1C6C758; Tue, 26 May 2026 14:34:14 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Jilles Tjoelker Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 1df431576f99 - main - sh/tests: Cut down builtins/read12.0 by 2 seconds In-Reply-To: (Jilles Tjoelker's message of "Mon, 25 May 2026 21:22:18 +0200") References: <6a120625.45836.5e8588e2@gitrepo.freebsd.org> <86h5nx3e8b.fsf@ltc.des.dev> <865x4c2bfn.fsf@ltc.des.dev> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Tue, 26 May 2026 14:34:14 +0200 Message-ID: <86ik8a1ha1.fsf@ltc.des.dev> 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: quoted-printable Jilles Tjoelker writes: > I have reverted the entire commit. Let's leave it as is until I > understand what the problem is. The problem is the ratio of error to measurement, which you reduced to virtually nothing. However, your commit also fixed a couple of bugs. I wish you hadn't reverted those parts. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Tue May 26 13:32:34 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 4gPtwM2gcYz6fpp2 for ; Tue, 26 May 2026 13:32:35 +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 4gPtwL6221z3jlV for ; Tue, 26 May 2026 13:32:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779802354; 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=bwIcW9tsFu9glyCfOQmFuYs/H6fTWPNVSsMT21ar7To=; b=XprCO3TLEVb+ut3zNJXSVrYpsQATFMdWJ2Xcchexg+dBkwYhNREu0Q9lo+pB3PXdaLIaBD tcUkGZVZ4WEjeBirrZEKkRBvl+g8qnh/oikaqO2712ms2oEaC4k3eH+QgIyuoi0Q7C/Asj KG4MpniGvSR5kiqy99Y6cAIS2YIeln4QX+do3SmWtNoVrea7ON7Uysb7PI+O6fVIAhcMeQ ug8gmuCqNjxBakWP9XBF9xwGcONYUesV+LPC5qJg6j8obEayFcmjhD1KlDihSHh0G5vVt3 Z2PLmOdsyUSWsbyndWL6h4g8uyfQ+L+ukUQlcKpTB5CASpYbCoRGgRuzH65REw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779802354; a=rsa-sha256; cv=none; b=D3WfGVm6NBZ2piUAh+7lyZ3XLSakBB27ZD/IwCDgWXjCgo0xcALSMZsajqk0ArKZl7ndeF cTTIGhn3AARNsOs+d30Z2ZXvjtw74dGctlBVTFJhEClCrxCcgD8VZrUQl3w+26YJxzSMOE 9V0zHQ5lSs19op7Styg6KlxWgCvi618fFmm8qnKp9IK2EqUkk22G/RDrU8Rhw17Dg4yyif 1P1NNhmku9edlAEFWo6dGVGaWQ82OaNdqk/fh+hPfbkOmMyKqzpHR/iVuIFi1LsWueKQN4 wCpWGgXlVDQnwka13RXXpxWx59wc28z29/3xTOSHth4b/HsacX08BwuImw/9nw== 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=1779802354; 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=bwIcW9tsFu9glyCfOQmFuYs/H6fTWPNVSsMT21ar7To=; b=IWJbOFHKLuP1RtiMlMf4KFwn0AqJMo5fZ6JfcOQRiOixnN1445O4uenRilYjuSPXUcnsXJ JatwW3fRWwbO2G16br/a16/NcDiyMSLvhl9v9Jn7YMbHu8OgfPFwCA4fmRCqpLmmvjmH3G VmFP1+xhGsOKBnteLj7klBdeCCr/BRpEYDo3tZlP6h5x9y2uczZG1rR2uyffraG8SYaT4n uk/D1ZQPX1BUxJXYQSI9FN0wZTbd0S3P4XX9OqfgHvwp4K3THPwzBf0r5+fCQjGRnJ8R0g Z3T49XlQHIFSXxHRKiWte3zADRmvnon6HF5Cl9JwS8SseMNHg4BDBYsR14HsTA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPtwL5d8vzL9 for ; Tue, 26 May 2026 13:32:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 47575 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 13:32:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 44eb2883134e - main - acpi: On /dev/power suspend, trigger userspace notifications 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: 44eb2883134e465c28468213f79567c64fe26de1 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 13:32:34 +0000 Message-Id: <6a15a0f2.47575.30956a8c@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=44eb2883134e465c28468213f79567c64fe26de1 commit 44eb2883134e465c28468213f79567c64fe26de1 Author: Olivier Certner AuthorDate: 2026-05-25 16:01:10 +0000 Commit: Olivier Certner CommitDate: 2026-05-26 13:32:04 +0000 acpi: On /dev/power suspend, trigger userspace notifications On a suspend request via ioctl(), /dev/acpi (and compatible /dev/apm) both call acpi_ReqSleepState() instead of directly calling acpi_EnterSleepState(). The former does more checks, returns success if the machine is already suspending, and notifies user space (via devd(8)) about the impending suspend. In other words, it seems to have been designed for user consumption more than the latter function. So, use acpi_ReqSleepState() in place of acpi_EnterSleepState() in acpi_pm_func(), which is ultimately called by power_pm_suspend(), itself called by power_ioctl(). Other callers of power_pm_suspend() (such as the console drivers) are also user-facing facilities, so should also benefit from this change. Reviewed by: mhorne, imp Tested by: mhorne MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57239 --- sys/dev/acpica/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 8be94db73729..4c6d0c3679c9 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -5064,7 +5064,7 @@ acpi_pm_func(u_long cmd, void *arg, enum power_stype stype) error = EINVAL; goto out; } - if (ACPI_FAILURE(acpi_EnterSleepState(sc, stype))) + if (ACPI_FAILURE(acpi_ReqSleepState(sc, stype))) error = ENXIO; break; default: From nobody Tue May 26 15:52:29 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 4gPy1p21jmz6g0nX for ; Tue, 26 May 2026 15:52:30 +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 4gPy1n59RJz434P for ; Tue, 26 May 2026 15:52:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779810749; 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=vd7ZNc+nzTrlhpA02sb13g84w+/+3Lc3m9NbTMyLbmk=; b=IMm4ChSokAOpNrmHpk1GGya49Ha7Dq0Sc+qtMot2I14ucQdXYSQnkh+yTxtoEqRCAi1eVJ CYBs+kNOB94jCtFLi8dL044q+caIEKxfliEQYYV2h874jM6NfNFshkSHlYLl2Df+XOK76P PcjCsgsPPBJhjZLdLvBDoGmT4i5FhxqaU+IKjddXsGypwVH44t9K+tYDWUyQ3vho4nyplq gdpXp4PFtLfHUTFYShfFmvSk0PI9EwgQSDU/sbzSYx32nz6+eexVgKyJPpA7v/Mck7vmOy EyruT4WoX1gOfGiuUv5yB0GiIcL943OK8F8+xbGVCKaI1MQI1/5iLZJwlXGNiQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779810749; a=rsa-sha256; cv=none; b=Wu8FdmBacvQ8N0vtpohdE08hQ5rTCbWWtpmk0xdYyUML1CI4pBuukch4InJYudTGm5VrMx Q1mXWR0ZjOPcLDw3AG6fUcYm79Yv6+PvIvH2YE8Jq80X86dKQNHVytKfeIy26m+0XNRFcz cU+JYGYrPRziBMQ5HbytjeqlbrYdbRSZR1EDHUySO1j0bt45dz89IqXW6pHX5ReQABp2SU imADCR8LecxG1TSj2Y+IRQDDoLYFkiDqQZl3jikNJHOAO15ziZGZI7R9LeBuJUPg4ecSUY BBHo98fMk2+gnzlDabzttavTk4JlmuEgV4kYyCmqrImWPms5k3AVmF0M0P1tKQ== 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=1779810749; 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=vd7ZNc+nzTrlhpA02sb13g84w+/+3Lc3m9NbTMyLbmk=; b=K6ogmqv9R7lWAggPIKTetxp2hB3Xt5UqLqPeh6+lcoekwmRZhhMMOj0NVC6wpWZifymNmI rkuK1okSMw8S+FpZv+f45xfnTq7Io+vdqP+SLT9lsmNJBtEH8sC3BPOSmBsh5H+nL1EY0u iZRy0xwzkPz2IPIJmkkP4yWZ4VUEn2uKeTs9/qBBfVRMrkRy0XbIwZh0XJrihWQ9b6HjXD FscmAYfDTqxFj8thMCTs5mrnAtr1w3OhlyvKtkSMwde7dqQfvOv/VsR+sPvYsJCj3SXDRe M6+KswuTwnqNjFOkGOmsD1LLVp8m7ifBxbUADCifJHDCe2Qk6xKWRryBRVUCqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPy1n4jp0z3Vm for ; Tue, 26 May 2026 15:52:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31588 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 15:52:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 9823698a48d3 - main - RELNOTES: Add entries for various commits through early March 2026 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9823698a48d33ba70323bb0448b5274d791e58f2 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 15:52:29 +0000 Message-Id: <6a15c1bd.31588.ec85c0e@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9823698a48d33ba70323bb0448b5274d791e58f2 commit 9823698a48d33ba70323bb0448b5274d791e58f2 Author: John Baldwin AuthorDate: 2026-05-26 15:52:18 +0000 Commit: John Baldwin CommitDate: 2026-05-26 15:52:18 +0000 RELNOTES: Add entries for various commits through early March 2026 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D56485 --- RELNOTES | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/RELNOTES b/RELNOTES index 0a25313d3f77..befc1e6556a6 100644 --- a/RELNOTES +++ b/RELNOTES @@ -21,6 +21,62 @@ b92b9da33006, 13d3bd165e22: table. One can run a multicast routing daemon within each FIB; the FIB of the routing socket determines the corresponding multicast routing table. +5c2186b99254,628d7a3270b6: + When the sector size for an NVMe namespace changes, nda(4) now + reports this as a media change rather than a disk resize + event. nda(4) also no longer reports a disk resize event in + some cases when the namespace's size had not changed. nda(4) + also reprobes NVMe namespaces each time they are opened to + check for a new sector size or namespace size. + +7a323f873662: + Remove the le(4) driver. This driver supported older 10Mbps + and 100Mbps Ethernet adapters. True hardware devices have not + been used in FreeBSD systems in many years, but the driver was + previously retained for use with MIPS QEMU virtual machines. + +e51ef8ae490f: + Add initial support for instruction-based sampling (IBS) + performance counters on AMD processors to hwpmc(4). + +d69fc3a9dc71: + The EFI boot loader now tries all ZFS pools found during + probing when looking for a boot pool. Previously it would try + only the first pool found. + +4d5c434ed16e: + Use the BSD-licensed implementation of diff3 instead of GNU diff3 + by default. + +7f54c65abc67: + Update the smartpqi(4) driver to vendor version 14.4690.0.2008 + - 15.2.0.2008. This includes support for new controllers and + renaming Microsemi to Microchip. + +350c1232a57a: + nvmecontrol(8)'s telemetry-log now works reliably. + +d14e018024bb,b125c4d13095,1322760fd127,0730a05cd383: + Permit both SCHED_ULE and SCHED_4BSD to be compiled into the + same kernel. The scheduler can be selected at boot time by + setting the kern.sched_name tunable to the scheduler name + ("4BSD" or "ULE"). The default scheduler is ULE. This is + currently enabled in amd64 kernels by default. + +90a7728cd890: + Update nuageinit to request configuration on all network + interfaces. nuageinit will now issue DHCP requests on all + network interfaces and request configuration data from the + first interface which successfully obtains a lease. + +92ba9b2fe589: + Add RoCE support for Broadcom BCM576xx controllers. + +fb4b0c911951: + Add a facility to witness(4) to provide more detailed information + about lock order reversals detailing when initial lock orders were + established. + 65f5dd42f11c: sh(1) add -l option which makes sh act as a login shell and read the profile. From nobody Tue May 26 16:07:16 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 4gPyLr1K1nz6g2K4 for ; Tue, 26 May 2026 16:07:16 +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 4gPyLr14fTz44kL for ; Tue, 26 May 2026 16:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779811636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0IoeVWTyU8PYfq1YepMLyWWDqfbfl8BafUXW5cmUtUY=; b=fnyInytfTF9sERv00N4GTICwWDZ6UdZDHjQhFGicbzIQtwRUEfexpSgW9X6ySWiEE4zqt3 HWfdGFof/rZdLMBOyCyZ3wH0oWHmqklFvPJSv91Jp8yhYGP3v8P/6BlCsTZfyfeIqeqtyy cfYAF07wxn78fq6t75XJfPFsJr1fhseUHQOv+s2ZUHnIbkI4EAgB7o0WluSF6BKYhPoRyJ FVbtu0VC4Yq+3tC73NTva2GXDfgWQJZS0f0uPrMSnjTQccn2aNSaCPdbfBqM9R1CzDTh/J VpmsknUTNJsfjj5+q8vvEXsxevnSiSd0qit/2c49708CUxvRR8g/ZqAgrYoMSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779811636; a=rsa-sha256; cv=none; b=puYASP+sMp/BieQmf7fAdHht7nNPUX5nVsCTc5Jpew9NxJn/h1B4g0ShIr1/jQOI2QBRlv YFwrFDX1YPNEzS51sGlZ+UXPXqBfskocni3t3VIh6WkaX4xVN1PQDJpanZqlUKnpzrj5Wx SjnfrpbxwTrhPAF2RCZ503WDzYxVlv94U0wXuHmYmGAas0P4mWD8O0x4sUT8NFSwLMtfBD OnYWwo0phPxYk8qADj91m9dJ6FJ5MAqR/LMQylB0ykHZgTS+Wwuep5hWlHPGydhQF8h/rc rXPY4LswlVVKBDS8C3Vshlv7V0kb38DwMx0g5TW5ZM9l3BNzbq06WwIjdhPBDg== 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=1779811636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0IoeVWTyU8PYfq1YepMLyWWDqfbfl8BafUXW5cmUtUY=; b=ZDAQ5EO7uXWRAku62MtDCjTlpQU0zwBWZvAdPRC2M0dF0HjrZnJGZtqJsR9R8XHdWQgh91 9wocQdtVp+V5nCAkdKTtVynnvaVKeU3FJkpUvN/iNsRdzZBb8co0EJwZ7ZmKpq3oeYS+qk Lr3Ps0QD2xg1aAlb1pQFIVJznDNjMpA1RtfHaGXlZvLJUSTEJ8HLqRYo5vZmymPqfe0Ozk qlz6Vs0usFwgZzHqy/IzFjnJSxhZ8wKDnyB2qZiWv9FUWArNE433CZ6Q+dEWXVOr8cAdj/ lEiZiT7KioKjFY2L+ofHvoh4+HObmRZF84GMvAjd3yZMiFiGSSOdt0GkKDSSzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPyLr0cSmz42R for ; Tue, 26 May 2026 16:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31f83 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 16:07:16 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Hans Rosenfeld From: Mark Johnston Subject: git: 19728f98cb5c - main - bhyve/virtio-scsi: Implement task management functions 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19728f98cb5c59f153de8df8b458c42e3e5168f6 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 16:07:16 +0000 Message-Id: <6a15c534.31f83.612a3474@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=19728f98cb5c59f153de8df8b458c42e3e5168f6 commit 19728f98cb5c59f153de8df8b458c42e3e5168f6 Author: Hans Rosenfeld AuthorDate: 2025-10-29 11:04:20 +0000 Commit: Mark Johnston CommitDate: 2026-05-26 16:03:12 +0000 bhyve/virtio-scsi: Implement task management functions Currently, all I/O requests are queued internally, and a number of threads will pick I/O requests of the queue and send them to CTL with a synchronous CTL_IO ioctl. On the other hand, TMF requests are sent to CTL immediately using the same synchronous ioctl. Besides being unworkable for non-CTL backends such as for SCSI passthrough, this simple approach may easily run into situations where a TMF request operating on a particular I/O request is sent to CTL while it is still on our queue and thus unknown to CTL. In addition, for target and/or LUN resets we should really clear our queue and return all outstanding I/O requests with a proper status. Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53222 --- usr.sbin/bhyve/pci_virtio_scsi.c | 452 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 421 insertions(+), 31 deletions(-) diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index d7fd30f55209..a77fadf71aff 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -202,6 +202,8 @@ struct pci_vtscsi_softc { #define VIRTIO_SCSI_T_TMF_QUERY_TASK 6 #define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7 +#define VIRTIO_SCSI_T_TMF_MAX_FUNC VIRTIO_SCSI_T_TMF_QUERY_TASK_SET + /* command-specific response values */ #define VIRTIO_SCSI_S_FUNCTION_COMPLETE 0 #define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10 @@ -274,6 +276,15 @@ struct pci_vtscsi_req_cmd_wr { uint8_t sense[]; } __attribute__((packed)); +enum pci_vtscsi_walk { + PCI_VTSCSI_WALK_CONTINUE = 0, + PCI_VTSCSI_WALK_STOP, +}; + +typedef enum pci_vtscsi_walk pci_vtscsi_walk_t; +typedef pci_vtscsi_walk_t pci_vtscsi_walk_request_queue_cb_t( + struct pci_vtscsi_queue *, struct pci_vtscsi_request *, void *); + static void *pci_vtscsi_proc(void *); static void pci_vtscsi_reset(void *); static void pci_vtscsi_neg_features(void *, uint64_t); @@ -287,11 +298,24 @@ static inline uint8_t pci_vtscsi_get_target(struct pci_vtscsi_softc *, static inline uint16_t pci_vtscsi_get_lun(struct pci_vtscsi_softc *, const uint8_t *); -static void pci_vtscsi_control_handle(struct pci_vtscsi_softc *, void *, size_t); +static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_abort_task; +static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_abort_task_set; +static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_clear_aca; +static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_clear_task_set; +static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_i_t_nexus_reset; +static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_lun_reset; +static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_query_task; +static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_query_task_set; + +static pci_vtscsi_walk_t pci_vtscsi_walk_request_queue( + struct pci_vtscsi_queue *, pci_vtscsi_walk_request_queue_cb_t *, void *); + static void pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *, struct pci_vtscsi_ctrl_tmf *); static void pci_vtscsi_an_handle(struct pci_vtscsi_softc *, struct pci_vtscsi_ctrl_an *); +static void pci_vtscsi_control_handle(struct pci_vtscsi_softc *, void *, + size_t); static struct pci_vtscsi_request *pci_vtscsi_alloc_request( struct pci_vtscsi_softc *); @@ -520,38 +544,270 @@ pci_vtscsi_get_lun(struct pci_vtscsi_softc *sc, const uint8_t *lun) return (((lun[2] << 8) | lun[3]) & 0x3fff); } -static void -pci_vtscsi_control_handle(struct pci_vtscsi_softc *sc, void *buf, - size_t bufsize) +/* + * ABORT TASK: Abort the specifed task queued for this LUN. + * + * We can stop once we have found the specified task queued for this LUN. + */ +static pci_vtscsi_walk_t +pci_vtscsi_tmf_handle_abort_task(struct pci_vtscsi_queue *q, + struct pci_vtscsi_request *req, void *arg) { - struct pci_vtscsi_ctrl_tmf *tmf; - struct pci_vtscsi_ctrl_an *an; - uint32_t type; + struct pci_vtscsi_ctrl_tmf *tmf = arg; - if (bufsize < sizeof(uint32_t)) { - WPRINTF("ignoring truncated control request"); - return; - } + assert(tmf->subtype == VIRTIO_SCSI_T_TMF_ABORT_TASK); - type = *(uint32_t *)buf; + if (pci_vtscsi_get_target(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_target(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); - if (type == VIRTIO_SCSI_T_TMF) { - if (bufsize != sizeof(*tmf)) { - WPRINTF("ignoring tmf request with size %zu", bufsize); - return; - } - tmf = (struct pci_vtscsi_ctrl_tmf *)buf; - pci_vtscsi_tmf_handle(sc, tmf); - } else if (type == VIRTIO_SCSI_T_AN_QUERY) { - if (bufsize != sizeof(*an)) { - WPRINTF("ignoring AN request with size %zu", bufsize); - return; - } - an = (struct pci_vtscsi_ctrl_an *)buf; - pci_vtscsi_an_handle(sc, an); + if (pci_vtscsi_get_lun(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_lun(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + if (tmf->id != req->vsr_cmd_rd->id) + return (PCI_VTSCSI_WALK_CONTINUE); + + req->vsr_cmd_wr->response = VIRTIO_SCSI_S_ABORTED; + STAILQ_REMOVE(&q->vsq_requests, req, pci_vtscsi_request, vsr_link); + pci_vtscsi_return_request(q, req, 0); + + return (PCI_VTSCSI_WALK_STOP); +} + +/* + * ABORT TASK SET: Abort all tasks queued for this LUN. + */ +static pci_vtscsi_walk_t +pci_vtscsi_tmf_handle_abort_task_set(struct pci_vtscsi_queue *q, + struct pci_vtscsi_request *req, void *arg) +{ + struct pci_vtscsi_ctrl_tmf *tmf = arg; + + assert(tmf->subtype == VIRTIO_SCSI_T_TMF_ABORT_TASK_SET); + + if (pci_vtscsi_get_target(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_target(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + if (pci_vtscsi_get_lun(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_lun(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + req->vsr_cmd_wr->response = VIRTIO_SCSI_S_ABORTED; + STAILQ_REMOVE(&q->vsq_requests, req, pci_vtscsi_request, vsr_link); + pci_vtscsi_return_request(q, req, 0); + + return (PCI_VTSCSI_WALK_CONTINUE); +} + +/* + * CLEAR ACA: Clear ACA (auto contingent allegiance) state. + */ +static pci_vtscsi_walk_t +pci_vtscsi_tmf_handle_clear_aca(struct pci_vtscsi_queue *q __unused, + struct pci_vtscsi_request *req __unused, void *arg) +{ + struct pci_vtscsi_ctrl_tmf *tmf = arg; + + assert(tmf->subtype == VIRTIO_SCSI_T_TMF_CLEAR_ACA); + + /* + * We don't implement handling of NACA=1 in the CONTROL byte at all. + * + * Thus, we probably should start filtering NORMACA in INQUIRY and + * reject any command that sets NACA=1. + * + * In any case, there isn't anything we need to do with our queued + * requests, so stop right here. + */ + + return (PCI_VTSCSI_WALK_STOP); +} + +/* + * CLEAR TASK SET: Clear all tasks queued for this LUN. + * + * All tasks in our queue were placed there by us, so there can be no other + * I_T nexus involved. Hence, this is handled the same as ABORT TASK SET. + */ +static pci_vtscsi_walk_t +pci_vtscsi_tmf_handle_clear_task_set(struct pci_vtscsi_queue *q, + struct pci_vtscsi_request *req, void *arg) +{ + struct pci_vtscsi_ctrl_tmf *tmf = arg; + + assert(tmf->subtype == VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET); + + if (pci_vtscsi_get_target(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_target(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + if (pci_vtscsi_get_lun(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_lun(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + req->vsr_cmd_wr->response = VIRTIO_SCSI_S_ABORTED; + STAILQ_REMOVE(&q->vsq_requests, req, pci_vtscsi_request, vsr_link); + pci_vtscsi_return_request(q, req, 0); + + return (PCI_VTSCSI_WALK_CONTINUE); +} + +/* + * I_T NEXUS RESET: Abort all tasks queued for any LUN of this target. + */ +static pci_vtscsi_walk_t +pci_vtscsi_tmf_handle_i_t_nexus_reset(struct pci_vtscsi_queue *q, + struct pci_vtscsi_request *req, void *arg) +{ + struct pci_vtscsi_ctrl_tmf *tmf = arg; + + assert(tmf->subtype == VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET); + + if (pci_vtscsi_get_target(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_target(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + /* + * T10 "06-026r4 SAM-4 TASK ABORTED status clarifications" indicates + * that we should actually return ABORTED here, but other documents + * such as the VirtIO spec suggest RESET. + */ + req->vsr_cmd_wr->response = VIRTIO_SCSI_S_RESET; + STAILQ_REMOVE(&q->vsq_requests, req, pci_vtscsi_request, vsr_link); + pci_vtscsi_return_request(q, req, 0); + + return (PCI_VTSCSI_WALK_CONTINUE); +} + +/* + * LOGICAL UNIT RESET: Abort all tasks queued for this LUN. + */ +static pci_vtscsi_walk_t +pci_vtscsi_tmf_handle_lun_reset(struct pci_vtscsi_queue *q, + struct pci_vtscsi_request *req, void *arg) +{ + struct pci_vtscsi_ctrl_tmf *tmf = arg; + + assert(tmf->subtype == VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET); + + if (pci_vtscsi_get_target(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_target(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + if (pci_vtscsi_get_lun(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_lun(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + /* + * T10 "06-026r4 SAM-4 TASK ABORTED status clarifications" indicates + * that we should actually return ABORTED here, but other documents + * such as the VirtIO spec suggest RESET. + */ + req->vsr_cmd_wr->response = VIRTIO_SCSI_S_RESET; + STAILQ_REMOVE(&q->vsq_requests, req, pci_vtscsi_request, vsr_link); + pci_vtscsi_return_request(q, req, 0); + + return (PCI_VTSCSI_WALK_CONTINUE); +} + +/* + * QUERY TASK: Is the specified task present in this LUN? + * + * We can stop once we have found the specified task queued for this LUN. + * + * Note that this function may cause false negatives under the following + * rare circumstances: + * (1) the specified task is still in the virtqueue, not yet having been + * processed by pci_vtscsi_requestq_notify() + * (2) the specified task was actively being processed by a worker thread + * but not yet processed by CTL by the time the QUERY TASK request was + * handled by CTL + * + * While a false negative may be confusing for a guest OS looking for the + * state of an I/O request it sent, it is not considered a fatal error of + * any kind and is easy to recover from. Also, in both of the above cases, + * the QUERY TASK TMF request would need to overtake the I/O request in + * question, which can only happen if the TMF request is sent immediately + * after the I/O request. While it is technically perfectly fine for a + * guest to do so, any normal use of QUERY TASK would involve a certain + * delay before the TMF request is sent, giving the I/O request time to + * be processed. + */ +static pci_vtscsi_walk_t +pci_vtscsi_tmf_handle_query_task(struct pci_vtscsi_queue *q, + struct pci_vtscsi_request *req, void *arg) +{ + struct pci_vtscsi_ctrl_tmf *tmf = arg; + + assert(tmf->subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK); + + if (pci_vtscsi_get_target(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_target(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + if (pci_vtscsi_get_lun(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_lun(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + if (tmf->id != req->vsr_cmd_rd->id) + return (PCI_VTSCSI_WALK_CONTINUE); + + tmf->response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; + return (PCI_VTSCSI_WALK_STOP); +} + +/* + * QUERY TASK SET: Are there any tasks present in this LUN? + * + * We can stop as soon as we've found at least one task queued for this LUN. + */ +static pci_vtscsi_walk_t +pci_vtscsi_tmf_handle_query_task_set(struct pci_vtscsi_queue *q, + struct pci_vtscsi_request *req, void *arg) +{ + struct pci_vtscsi_ctrl_tmf *tmf = arg; + + assert(tmf->subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK_SET); + + if (pci_vtscsi_get_target(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_target(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + if (pci_vtscsi_get_lun(q->vsq_sc, tmf->lun) != + pci_vtscsi_get_lun(q->vsq_sc, req->vsr_cmd_rd->lun)) + return (PCI_VTSCSI_WALK_CONTINUE); + + tmf->response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; + return (PCI_VTSCSI_WALK_STOP); +} + +static pci_vtscsi_walk_t +pci_vtscsi_walk_request_queue(struct pci_vtscsi_queue *q, + pci_vtscsi_walk_request_queue_cb_t cb, void *arg) +{ + struct pci_vtscsi_request *req, *tmp; + + STAILQ_FOREACH_SAFE(req, &q->vsq_requests, vsr_link, tmp) { + if (cb(q, req, arg) == PCI_VTSCSI_WALK_STOP) + return (PCI_VTSCSI_WALK_STOP); } + + return (PCI_VTSCSI_WALK_CONTINUE); } +static pci_vtscsi_walk_request_queue_cb_t *const pci_vtscsi_tmf_handler_cb[] = { + pci_vtscsi_tmf_handle_abort_task, + pci_vtscsi_tmf_handle_abort_task_set, + pci_vtscsi_tmf_handle_clear_aca, + pci_vtscsi_tmf_handle_clear_task_set, + pci_vtscsi_tmf_handle_i_t_nexus_reset, + pci_vtscsi_tmf_handle_lun_reset, + pci_vtscsi_tmf_handle_query_task, + pci_vtscsi_tmf_handle_query_task_set +}; + static void pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, struct pci_vtscsi_ctrl_tmf *tmf) @@ -561,6 +817,13 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, int err; int fd; + if (tmf->subtype > VIRTIO_SCSI_T_TMF_MAX_FUNC) { + WPRINTF("pci_vtscsi_tmf_handle: invalid subtype %u", + tmf->subtype); + tmf->response = VIRTIO_SCSI_S_FUNCTION_REJECTED; + return; + } + if (pci_vtscsi_check_lun(sc, tmf->lun) == false) { DPRINTF("TMF request to invalid LUN %.2hhx%.2hhx-%.2hhx%.2hhx-" "%.2hhx%.2hhx-%.2hhx%.2hhx", tmf->lun[0], tmf->lun[1], @@ -575,13 +838,49 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, fd = sc->vss_targets[target].vst_fd; + DPRINTF("TMF request tgt %d, lun %d, subtype %d, id %lu", + target, pci_vtscsi_get_lun(sc, tmf->lun), tmf->subtype, tmf->id); + + /* + * Lock out all the worker threads from processing any waiting requests + * while we're processing the TMF request. This also effectively blocks + * pci_vtscsi_requestq_notify() from adding any new requests to the + * request queue. This in turn means we will miss any I/O requests which + * may still be in the virtqueue. + * + * This does not prevent any requests currently being processed by CTL + * from being completed and returned, which we must guarantee to adhere + * to the ordering requirements for any TMF function which aborts tasks. + */ + for (int i = 0; i < VTSCSI_REQUESTQ; i++) { + struct pci_vtscsi_queue *q = &sc->vss_queues[i]; + + pthread_mutex_lock(&q->vsq_rmtx); + } + + /* + * CTL may set response to FAILURE for the TMF request. + * + * The default response of all TMF functions is FUNCTION COMPLETE if + * there was no error, regardless of whether it actually succeeded or + * not. The two notable exceptions are QUERY TASK and QUERY TASK SET, + * which will explicitly return FUNCTION SUCCEEDED if the specified + * task or any task was active in the target/LUN, respectively. + * + * Thus, we will call CTL first. Only if the response we get is + * FUNCTION COMPLETE we'll continue processing the TMF function + * on our queues. Note that there's a slim chance that we're racing + * against a worker thread that is actively processing an I/O request, + * which may lead to our TMF request being processed by CTL before the + * same I/O request, in which case it won't be on any queue either. + */ io = ctl_scsi_alloc_io(sc->vss_iid); if (io == NULL) { WPRINTF("failed to allocate ctl_io: err=%d (%s)", errno, strerror(errno)); tmf->response = VIRTIO_SCSI_S_FAILURE; - return; + goto out; } ctl_scsi_zero_io(io); @@ -636,17 +935,108 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, } err = ioctl(fd, CTL_IO, io); - if (err != 0) + if (err != 0) { WPRINTF("CTL_IO: err=%d (%s)", errno, strerror(errno)); + tmf->response = VIRTIO_SCSI_S_FAILURE; + } else { + tmf->response = io->taskio.task_status; + } - tmf->response = io->taskio.task_status; ctl_scsi_free_io(io); + + if (tmf->response != VIRTIO_SCSI_S_FUNCTION_COMPLETE) { + /* + * If this is either a FAILURE or FUNCTION REJECTED, we must + * not continue to process the TMF function on our queued + * requests. + * + * If it is FUNCTION SUCCEEDED, we do not need to process the + * TMF function on our queued requests. + * + * If it is anything else, log a warning, but handle it the + * same as above. + */ + if (tmf->response != VIRTIO_SCSI_S_FAILURE && + tmf->response != VIRTIO_SCSI_S_FUNCTION_REJECTED && + tmf->response != VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) { + WPRINTF("pci_vtscsi_tmf_hdl: unexpected response from " + "CTL: %d", tmf->response); + } + } else { + pci_vtscsi_walk_t ret = PCI_VTSCSI_WALK_CONTINUE; + int i; + + for (i = 0; + i < VTSCSI_REQUESTQ && ret != PCI_VTSCSI_WALK_STOP; + i++) { + struct pci_vtscsi_queue *q = &sc->vss_queues[i]; + + ret = pci_vtscsi_walk_request_queue(q, + pci_vtscsi_tmf_handler_cb[tmf->subtype], tmf); + } + } + +out: + /* Unlock the request queues before we return. */ + for (int i = 0; i < VTSCSI_REQUESTQ; i++) { + struct pci_vtscsi_queue *q = &sc->vss_queues[i]; + + pthread_mutex_unlock(&q->vsq_rmtx); + } +} + +static void +pci_vtscsi_an_handle(struct pci_vtscsi_softc *sc, struct pci_vtscsi_ctrl_an *an) +{ + int target; + + if (pci_vtscsi_check_lun(sc, an->lun) == false) { + DPRINTF("AN request to invalid LUN %.2hhx%.2hhx-%.2hhx%.2hhx-" + "%.2hhx%.2hhx-%.2hhx%.2hhx", an->lun[0], an->lun[1], + an->lun[2], an->lun[3], an->lun[4], an->lun[5], an->lun[6], + an->lun[7]); + an->response = VIRTIO_SCSI_S_BAD_TARGET; + return; + } + + target = pci_vtscsi_get_target(sc, an->lun); + + DPRINTF("AN request tgt %d, lun %d, event requested %x", + target, pci_vtscsi_get_lun(sc, an->lun), an->event_requested); + + an->response = VIRTIO_SCSI_S_FAILURE; } static void -pci_vtscsi_an_handle(struct pci_vtscsi_softc *sc __unused, - struct pci_vtscsi_ctrl_an *an __unused) +pci_vtscsi_control_handle(struct pci_vtscsi_softc *sc, void *buf, + size_t bufsize) { + uint32_t type; + + if (bufsize < sizeof(uint32_t)) { + WPRINTF("ignoring truncated control request"); + return; + } + + type = *(uint32_t *)buf; + + if (type == VIRTIO_SCSI_T_TMF) { + if (bufsize != sizeof(struct pci_vtscsi_ctrl_tmf)) { + WPRINTF("ignoring TMF request with size %zu", bufsize); + return; + } + + pci_vtscsi_tmf_handle(sc, buf); + } else if (type == VIRTIO_SCSI_T_AN_QUERY) { + if (bufsize != sizeof(struct pci_vtscsi_ctrl_an)) { + WPRINTF("ignoring AN request with size %zu", bufsize); + return; + } + + pci_vtscsi_an_handle(sc, buf); + } else { + WPRINTF("ignoring unknown control request type = %u", type); + } } static struct pci_vtscsi_request * From nobody Tue May 26 16:07:17 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 4gPyLs3Hw8z6g2DN for ; Tue, 26 May 2026 16:07:17 +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 4gPyLs1pdhz44mr for ; Tue, 26 May 2026 16:07:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779811637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9G77IxrDNZ7OVjZAsqHwnGvBNFv5LEW24j6iLtbtn9A=; b=Ljfc4mYBbTULsdOzgVvNSNQLzarKf46H6219xcBofSFjo1x8A+Hd5tKtmziuVwpKtGULth hfrlNnGaRslUgeSynpa7sLTxg+LVowUxxtcsa8aZp4FrGo+CSDarePYBJkHKa8HdFwLT4N G/yDJ7ChXzH56urKKFszNF4ky05DpOe+EEmT+a5TT2vmfJXREn7hXVpqCfLxQPSSj9ORf+ gqwPmZ6jrFQKRzKWZVUqjzl/giDRc6oqlBp7jgABkB5LEovIpVzoquTBjaQ1qKULZdnKhl X1R3BYVxyds63tbpN0HhWZfu+UrDrhmS9dzN+PGwSy+Ng0NSpbMt2srno2Wvyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779811637; a=rsa-sha256; cv=none; b=QB2uoepGd5EotaP9t+ctZbCXwI4IvKd680QaNbmT+judZ2vwj3C02P84GkKUsh8r2cOjI4 emSBlXzwiEpPYjmgP2Qjt6CYyesAUaf/CrU08x36uDk4lw3v6B9g0KAjj7/UQEkj89XvUt zyfTjEm4x+BBatYQGES0HGJLsxkhK4bgGtC47macmEjmvzmd4dhmq2NA7mPYpbGg9aUOtr /b1wWnMu9OJ446D2obj6vyjJX2sdk9OZFKBvtx5WkeEgk54c+7q/Gn8sjdata8FgJXN5WY YdmcDN5S/6f8jTGgF5oJQSLXverZFklDUxtqWv2hiGzj2h85hH+L3KTc9fQ7QQ== 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=1779811637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9G77IxrDNZ7OVjZAsqHwnGvBNFv5LEW24j6iLtbtn9A=; b=Di3jNv3PKXCXpCukyk8jsqwtIKWsZnjVIYeFMvcbMTqakG73ctGDY1aeyl09MsrwRntmwi XEO3kPYkKktp9AOIPT0WCOYWVROEjBUoBgFBZAZ5mwF7788vjxrkKqwpO1pNzJ+vpSrmOZ SYcoo4KYywIl9jgcPPNkehPNo3xe/MVq0vqjjYZ/n7ec6lnEoZAGUlRLydcz7eCdj1vqSo QfljpvnaQxfF4xmzn3ZxGpKxXX2gegtmaRXLpt9V08xPSnd4WuyjRyBCVmYSl8+KcHHwrR knwvtQLxLF1TvT2f0ch7wMxtFctrywl1UpDrE8J7O3Cs040gIj5Cp1lAKKNtdw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPyLs1M3Kz3pH for ; Tue, 26 May 2026 16:07:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30e3a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 16:07:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Hans Rosenfeld From: Mark Johnston Subject: git: 9542ddb21dc1 - main - bhyve/virtio-scsi: Support multiple backends 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9542ddb21dc15986843708d3f845eb23e7090107 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 16:07:17 +0000 Message-Id: <6a15c535.30e3a.7895c705@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9542ddb21dc15986843708d3f845eb23e7090107 commit 9542ddb21dc15986843708d3f845eb23e7090107 Author: Hans Rosenfeld AuthorDate: 2025-09-16 15:34:12 +0000 Commit: Mark Johnston CommitDate: 2026-05-26 16:03:12 +0000 bhyve/virtio-scsi: Support multiple backends In order to support multiple backends for virtio-scsi, we should isolate the core of virtio-scsi from the backend-specific code. The existing interface to CTL will become the new "CTL" backend for virtio-scsi. Care has been taken to keep compatibility with previous configurations: The first backend linked (CTL) will be the default backend if none is specified, and it does provide a default configuration if no further options such as targets are explicitly configured. Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53223 --- usr.sbin/bhyve/Makefile | 1 + usr.sbin/bhyve/bhyve.8 | 44 ++- usr.sbin/bhyve/bhyve_config.5 | 29 +- usr.sbin/bhyve/pci_virtio_scsi.c | 617 ++++++----------------------------- usr.sbin/bhyve/pci_virtio_scsi.h | 394 ++++++++++++++++++++++ usr.sbin/bhyve/pci_virtio_scsi_ctl.c | 377 +++++++++++++++++++++ 6 files changed, 927 insertions(+), 535 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 25fb71b5768f..b86c56991039 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -53,6 +53,7 @@ SRCS= \ pci_virtio_net.c \ pci_virtio_rnd.c \ pci_virtio_scsi.c \ + pci_virtio_scsi_ctl.c \ pci_xhci.c \ qemu_fwcfg.c \ qemu_loader.c \ diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index b5b03dd9c211..01b7dba941ac 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -681,8 +681,9 @@ In that case, this feature doesn't work as expected. .Bl -bullet .Sm off .It -.Oo Cm target Ns = Ns Oo ID : Oc Ar /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oc +.Oo Cm target Ns = Ns Oo ID : Oc Ar path Ns Oc .Oo Cm \&, Ar scsi-device-options Oc +.Oo Cm \&, Ar backend-specific-options Oc .Sm on .El .Pp @@ -708,25 +709,28 @@ All .Pa target .Ar ID Ns s must be unique per instance. -The +The meaning of the .Ar path -must point to a valid CAM target layer -.Po CTL -.Pc -device node. -If no -.Pa target -is configured, a single default target backed by -.Sy /dev/cam/ctl -will be created. +argument is specific to each backend: +.Bl -column "Backend" "/dev/cam/ctl[pp.vp]" +.It Sy Backend Ta Sy Path Ta Sy Description +.It ctl Ta Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc Ta +The path of a CAM target layer (CTL) device node. +If no target is configured, a single target backed by +.Qq /dev/cam/ctl +will be configured by default. +.El .Pp The .Ar scsi-device-options are: .Bl -tag -width 10n -.It Cm iid= Ns Ar IID -Initiator ID to use when sending requests to specified CTL port. -The default value is 0. +.It Cm backend= Ns Ar backend +The virtio-scsi backend to use. +The backend name is case-insensitive. +There is currently only one backend +.Qq ctl , +which is also the default backend. .It Li bootindex= Ns Ar index Add the device to the boot order at .Ar index . @@ -734,6 +738,18 @@ A fw_cfg file is used to specify the boot order. The guest firmware may ignore or not support this fw_cfg file. In that case, this feature doesn't work as expected. .El +.Pp +The +.Ar backend-specific-options +for the +.Sy CTL +backend are: +.Bl -tag -width 10n +.It Cm iid= Ns Ar IID +Initiator ID to use when sending requests to +.Sy CTL . +The default value is 0. +.El .Ss 9P device backends .Bl -bullet .Sm off diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index ea3157cb54d6..d4361468bc22 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -762,13 +762,14 @@ If specified, it must be a unicast MAC address. The largest supported MTU advertised to the guest. .El .Ss VirtIO SCSI Settings -.Bl -column "target" "integer" "/dev/cam/ctl" +.Bl -column "backend" "string" "/dev/cam/ctl" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description -.It Va iid Ta integer Ta 0 Ta -Initiator ID to use when sending requests to the CTL port. -.It Va target Ta Oo Va ID : Oc Ns path Ta Sy /dev/cam/ctl Ta -The path of a CAM target layer (CTL) device to use: -.Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc +.It Va backend Ta string Ta ctl Ta +The virtio-scsi backend to use (case-insensitive). +.It Va target Ta Oo Va ID : Oc Ns path Ta /dev/cam/ctl Ta +The backend +.Ar path +of a target to configure. Optionally, a numeric target .Ar ID in the range from 0 to 255 may be specified before the @@ -789,6 +790,22 @@ configured so far, or 0 for the first target configured. The target .Ar ID Ns s must be unique within each virtio-scsi instance. +.Pp +The meaning of the +.Ar path +argument is specific to each backend: +.Bl -column "Backend" "/dev/cam/ctl[pp.vp]" +.It Sy Backend Ta Sy Path Ta Sy Description +.It ctl Ta Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc Ta +The path of a CAM target layer (CTL) device to configure as a target. +.El +.Pp +The following backend-specific variables are supported for VirtIO SCSI: +.Bl -column "Backend" "Name" "integer" "Default" +.It Sy Backend Ta Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It ctl Ta Va iid Ta integer Ta 0 Ta +Initiator ID to use when sending requests to CTL. +.El .Sh SEE ALSO .Xr expand_number 3 , .Xr getaddrinfo 3 , diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index a77fadf71aff..47b90184fe08 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -48,16 +47,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "bhyverun.h" #include "config.h" #include "debug.h" @@ -65,216 +54,7 @@ #include "virtio.h" #include "iov.h" -#define VTSCSI_RINGSZ 64 -#define VTSCSI_REQUESTQ 1 -#define VTSCSI_THR_PER_Q 16 -#define VTSCSI_MAXQ (VTSCSI_REQUESTQ + 2) -#define VTSCSI_MAXSEG 64 - -#define VTSCSI_IN_HEADER_LEN(_sc) \ - (sizeof(struct pci_vtscsi_req_cmd_rd) + _sc->vss_config.cdb_size) - -#define VTSCSI_OUT_HEADER_LEN(_sc) \ - (sizeof(struct pci_vtscsi_req_cmd_wr) + _sc->vss_config.sense_size) - -#define VIRTIO_SCSI_MAX_CHANNEL 0 -#define VIRTIO_SCSI_MAX_TARGET 255 -#define VIRTIO_SCSI_MAX_LUN 16383 - -#define VIRTIO_SCSI_F_INOUT (1 << 0) -#define VIRTIO_SCSI_F_HOTPLUG (1 << 1) -#define VIRTIO_SCSI_F_CHANGE (1 << 2) - -static int pci_vtscsi_debug = 0; -#define WPRINTF(msg, params...) PRINTLN("virtio-scsi: " msg, ##params) -#define DPRINTF(msg, params...) if (pci_vtscsi_debug) WPRINTF(msg, ##params) - -struct pci_vtscsi_config { - uint32_t num_queues; - uint32_t seg_max; - uint32_t max_sectors; - uint32_t cmd_per_lun; - uint32_t event_info_size; - uint32_t sense_size; - uint32_t cdb_size; - uint16_t max_channel; - uint16_t max_target; - uint32_t max_lun; -} __attribute__((packed)); - -/* - * I/O request state and I/O request queues - * - * In addition to the control queue and notification queues, each virtio-scsi - * device instance has at least one I/O request queue, the state of which is - * is kept in an array of struct pci_vtscsi_queue in the device softc. - * - * Currently there is only one I/O request queue, but it's trivial to support - * more than one. - * - * Each pci_vtscsi_queue has VTSCSI_RINGSZ pci_vtscsi_request structures pre- - * allocated on vsq_free_requests. For each I/O request coming in on the I/O - * virtqueue, the request queue handler will take a pci_vtscsi_request off - * vsq_free_requests, fills in the data from the I/O virtqueue, puts it on - * vsq_requests, and signals vsq_cv. - * - * There are VTSCSI_THR_PER_Q worker threads for each pci_vtscsi_queue which - * wait on vsq_cv. When signalled, they repeatedly take one pci_vtscsi_request - * off vsq_requests, construct a ctl_io for it, and hand it off to the CTL ioctl - * Interface, which processes it synchronously. After completion of the request, - * the pci_vtscsi_request is re-initialized and put back onto vsq_free_requests. - * - * The worker threads exit when vsq_cv is signalled after vsw_exiting was set. - * - * There are three mutexes to coordinate the accesses to an I/O request queue: - * - vsq_rmtx protects vsq_requests and must be held when waiting on vsq_cv - * - vsq_fmtx protects vsq_free_requests - * - vsq_qmtx must be held when operating on the underlying virtqueue, vsq_vq - */ -STAILQ_HEAD(pci_vtscsi_req_queue, pci_vtscsi_request); - -struct pci_vtscsi_queue { - struct pci_vtscsi_softc * vsq_sc; - struct vqueue_info * vsq_vq; - pthread_mutex_t vsq_rmtx; - pthread_mutex_t vsq_fmtx; - pthread_mutex_t vsq_qmtx; - pthread_cond_t vsq_cv; - struct pci_vtscsi_req_queue vsq_requests; - struct pci_vtscsi_req_queue vsq_free_requests; - LIST_HEAD(, pci_vtscsi_worker) vsq_workers; -}; - -struct pci_vtscsi_worker { - struct pci_vtscsi_queue * vsw_queue; - pthread_t vsw_thread; - bool vsw_exiting; - LIST_ENTRY(pci_vtscsi_worker) vsw_link; -}; - -struct pci_vtscsi_request { - struct pci_vtscsi_queue * vsr_queue; - struct iovec vsr_iov[VTSCSI_MAXSEG + SPLIT_IOV_ADDL_IOV]; - struct iovec * vsr_iov_in; - struct iovec * vsr_iov_out; - struct iovec * vsr_data_iov_in; - struct iovec * vsr_data_iov_out; - struct pci_vtscsi_req_cmd_rd * vsr_cmd_rd; - struct pci_vtscsi_req_cmd_wr * vsr_cmd_wr; - union ctl_io * vsr_ctl_io; - size_t vsr_niov_in; - size_t vsr_niov_out; - size_t vsr_data_niov_in; - size_t vsr_data_niov_out; - uint32_t vsr_idx; - STAILQ_ENTRY(pci_vtscsi_request) vsr_link; -}; - -struct pci_vtscsi_target { - uint8_t vst_target; - int vst_fd; - int vst_max_sectors; -}; - -/* - * Per-device softc - */ -struct pci_vtscsi_softc { - struct virtio_softc vss_vs; - struct vqueue_info vss_vq[VTSCSI_MAXQ]; - struct pci_vtscsi_queue vss_queues[VTSCSI_REQUESTQ]; - pthread_mutex_t vss_mtx; - int vss_iid; - int vss_ctl_fd; - uint32_t vss_features; - size_t vss_num_target; - struct pci_vtscsi_config vss_config; - struct pci_vtscsi_target *vss_targets; -}; - -#define VIRTIO_SCSI_T_TMF 0 -#define VIRTIO_SCSI_T_TMF_ABORT_TASK 0 -#define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1 -#define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2 -#define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3 -#define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4 -#define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5 -#define VIRTIO_SCSI_T_TMF_QUERY_TASK 6 -#define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7 - -#define VIRTIO_SCSI_T_TMF_MAX_FUNC VIRTIO_SCSI_T_TMF_QUERY_TASK_SET - -/* command-specific response values */ -#define VIRTIO_SCSI_S_FUNCTION_COMPLETE 0 -#define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10 -#define VIRTIO_SCSI_S_FUNCTION_REJECTED 11 - -struct pci_vtscsi_ctrl_tmf { - const uint32_t type; - const uint32_t subtype; - const uint8_t lun[8]; - const uint64_t id; - uint8_t response; -} __attribute__((packed)); - -#define VIRTIO_SCSI_T_AN_QUERY 1 -#define VIRTIO_SCSI_EVT_ASYNC_OPERATIONAL_CHANGE 2 -#define VIRTIO_SCSI_EVT_ASYNC_POWER_MGMT 4 -#define VIRTIO_SCSI_EVT_ASYNC_EXTERNAL_REQUEST 8 -#define VIRTIO_SCSI_EVT_ASYNC_MEDIA_CHANGE 16 -#define VIRTIO_SCSI_EVT_ASYNC_MULTI_HOST 32 -#define VIRTIO_SCSI_EVT_ASYNC_DEVICE_BUSY 64 - -struct pci_vtscsi_ctrl_an { - const uint32_t type; - const uint8_t lun[8]; - const uint32_t event_requested; - uint32_t event_actual; - uint8_t response; -} __attribute__((packed)); - -/* command-specific response values */ -#define VIRTIO_SCSI_S_OK 0 -#define VIRTIO_SCSI_S_OVERRUN 1 -#define VIRTIO_SCSI_S_ABORTED 2 -#define VIRTIO_SCSI_S_BAD_TARGET 3 -#define VIRTIO_SCSI_S_RESET 4 -#define VIRTIO_SCSI_S_BUSY 5 -#define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6 -#define VIRTIO_SCSI_S_TARGET_FAILURE 7 -#define VIRTIO_SCSI_S_NEXUS_FAILURE 8 -#define VIRTIO_SCSI_S_FAILURE 9 -#define VIRTIO_SCSI_S_INCORRECT_LUN 12 - -/* task_attr */ -#define VIRTIO_SCSI_S_SIMPLE 0 -#define VIRTIO_SCSI_S_ORDERED 1 -#define VIRTIO_SCSI_S_HEAD 2 -#define VIRTIO_SCSI_S_ACA 3 - -struct pci_vtscsi_event { - uint32_t event; - uint8_t lun[8]; - uint32_t reason; -} __attribute__((packed)); - -struct pci_vtscsi_req_cmd_rd { - const uint8_t lun[8]; - const uint64_t id; - const uint8_t task_attr; - const uint8_t prio; - const uint8_t crn; - const uint8_t cdb[]; -} __attribute__((packed)); - -struct pci_vtscsi_req_cmd_wr { - uint32_t sense_len; - uint32_t residual; - uint16_t status_qualifier; - uint8_t status; - uint8_t response; - uint8_t sense[]; -} __attribute__((packed)); +#include "pci_virtio_scsi.h" enum pci_vtscsi_walk { PCI_VTSCSI_WALK_CONTINUE = 0, @@ -285,19 +65,14 @@ typedef enum pci_vtscsi_walk pci_vtscsi_walk_t; typedef pci_vtscsi_walk_t pci_vtscsi_walk_request_queue_cb_t( struct pci_vtscsi_queue *, struct pci_vtscsi_request *, void *); +static void pci_vtscsi_print_supported_backends(void); + static void *pci_vtscsi_proc(void *); static void pci_vtscsi_reset(void *); static void pci_vtscsi_neg_features(void *, uint64_t); static int pci_vtscsi_cfgread(void *, int, int, uint32_t *); static int pci_vtscsi_cfgwrite(void *, int, int, uint32_t); -static inline bool pci_vtscsi_check_lun(struct pci_vtscsi_softc *, - const uint8_t *); -static inline uint8_t pci_vtscsi_get_target(struct pci_vtscsi_softc *, - const uint8_t *); -static inline uint16_t pci_vtscsi_get_lun(struct pci_vtscsi_softc *, - const uint8_t *); - static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_abort_task; static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_abort_task_set; static pci_vtscsi_walk_request_queue_cb_t pci_vtscsi_tmf_handle_clear_aca; @@ -319,7 +94,8 @@ static void pci_vtscsi_control_handle(struct pci_vtscsi_softc *, void *, static struct pci_vtscsi_request *pci_vtscsi_alloc_request( struct pci_vtscsi_softc *); -static void pci_vtscsi_free_request(struct pci_vtscsi_request *); +static void pci_vtscsi_free_request(struct pci_vtscsi_softc *, + struct pci_vtscsi_request *); static struct pci_vtscsi_request *pci_vtscsi_get_request( struct pci_vtscsi_req_queue *); static void pci_vtscsi_put_request(struct pci_vtscsi_req_queue *, @@ -341,6 +117,8 @@ static int pci_vtscsi_init_queue(struct pci_vtscsi_softc *, static void pci_vtscsi_destroy_queue(struct pci_vtscsi_queue *); static int pci_vtscsi_init(struct pci_devinst *, nvlist_t *); +SET_DECLARE(pci_vtscsi_backend_set, struct pci_vtscsi_backend); + static struct virtio_consts vtscsi_vi_consts = { .vc_name = "vtscsi", .vc_nvq = VTSCSI_MAXQ, @@ -352,6 +130,25 @@ static struct virtio_consts vtscsi_vi_consts = { .vc_hv_caps = VIRTIO_RING_F_INDIRECT_DESC, }; +int pci_vtscsi_debug = 0; + + +static void +pci_vtscsi_print_supported_backends(void) +{ + struct pci_vtscsi_backend **vbpp; + + if (SET_COUNT(pci_vtscsi_backend_set) == 0) { + printf("No virtio-scsi backends available"); + return; + } + + SET_FOREACH(vbpp, pci_vtscsi_backend_set) { + struct pci_vtscsi_backend *vbp = *vbpp; + printf("%s\n", vbp->vsb_name); + } +} + static void * pci_vtscsi_proc(void *arg) { @@ -407,8 +204,7 @@ pci_vtscsi_reset(void *vsc) .num_queues = VTSCSI_REQUESTQ, /* Leave room for the request and the response. */ .seg_max = VTSCSI_MAXSEG - 2, - /* CTL apparently doesn't have a limit here */ - .max_sectors = INT32_MAX, + .max_sectors = 0, /* overridden by backend reset() */ .cmd_per_lun = 1, .event_info_size = sizeof(struct pci_vtscsi_event), .sense_size = 96, @@ -417,6 +213,8 @@ pci_vtscsi_reset(void *vsc) .max_target = MAX(1, sc->vss_num_target) - 1, .max_lun = VIRTIO_SCSI_MAX_LUN }; + + sc->vss_backend->vsb_reset(sc); } static void @@ -445,105 +243,6 @@ pci_vtscsi_cfgwrite(void *vsc __unused, int offset __unused, int size __unused, return (0); } -/* - * LUN address parsing - * - * The LUN address consists of 8 bytes. While the spec describes this as 0x01, - * followed by the target byte, followed by a "single-level LUN structure", - * this is actually the same as a hierarchical LUN address as defined by SAM-5, - * consisting of four levels of addressing, where in each level the two MSB of - * byte 0 select the address mode used in the remaining bits and bytes. - * - * - * Only the first two levels are acutally used by virtio-scsi: - * - * Level 1: 0x01, 0xTT: Peripheral Device Addressing: Bus 1, Target 0-255 - * Level 2: 0xLL, 0xLL: Peripheral Device Addressing: Bus MBZ, LUN 0-255 - * or: Flat Space Addressing: LUN (0-16383) - * Level 3 and 4: not used, MBZ - * - * - * Alternatively, the first level may contain an extended LUN address to select - * the REPORT_LUNS well-known logical unit: - * - * Level 1: 0xC1, 0x01: Extended LUN Adressing, Well-Known LUN 1 (REPORT_LUNS) - * Level 2, 3, and 4: not used, MBZ - * - * The virtio spec says that we SHOULD implement the REPORT_LUNS well-known - * logical unit but we currently don't. - * - * According to the virtio spec, these are the only LUNS address formats to be - * used with virtio-scsi. - */ - -/* - * Check that the given LUN address conforms to the virtio spec, does not - * address an unknown target, and especially does not address the REPORT_LUNS - * well-known logical unit. - */ -static inline bool -pci_vtscsi_check_lun(struct pci_vtscsi_softc *sc, const uint8_t *lun) -{ - if (lun[0] == 0xC1) - return (false); - - if (lun[0] != 0x01) - return (false); - - if (lun[1] >= sc->vss_num_target) - return (false); - - if (lun[1] != sc->vss_targets[lun[1]].vst_target) - return (false); - - if (sc->vss_targets[lun[1]].vst_fd < 0) - return (false); - - if (lun[2] != 0x00 && (lun[2] & 0xc0) != 0x40) - return (false); - - if (lun[4] != 0 || lun[5] != 0 || lun[6] != 0 || lun[7] != 0) - return (false); - - return (true); -} - -/* - * Get the target id from a LUN address. - * - * Every code path using this function must have called pci_vtscsi_check_lun() - * before to make sure the LUN address is valid. - */ -static inline uint8_t -pci_vtscsi_get_target(struct pci_vtscsi_softc *sc, const uint8_t *lun) -{ - assert(lun[0] == 0x01); - assert(lun[1] < sc->vss_num_target); - assert(lun[1] == sc->vss_targets[lun[1]].vst_target); - assert(sc->vss_targets[lun[1]].vst_fd >= 0); - assert(lun[2] == 0x00 || (lun[2] & 0xc0) == 0x40); - - return (lun[1]); -} - -/* - * Get the LUN id from a LUN address. - * - * Every code path using this function must have called pci_vtscsi_check_lun() - * before to make sure the LUN address is valid. - */ -static inline uint16_t -pci_vtscsi_get_lun(struct pci_vtscsi_softc *sc, const uint8_t *lun) -{ - assert(lun[0] == 0x01); - assert(lun[1] < sc->vss_num_target); - assert(lun[1] == sc->vss_targets[lun[1]].vst_target); - assert(sc->vss_targets[lun[1]].vst_fd >= 0); - assert(lun[2] == 0x00 || (lun[2] & 0xc0) == 0x40); - - return (((lun[2] << 8) | lun[3]) & 0x3fff); -} - /* * ABORT TASK: Abort the specifed task queued for this LUN. * @@ -722,8 +421,8 @@ pci_vtscsi_tmf_handle_lun_reset(struct pci_vtscsi_queue *q, * (1) the specified task is still in the virtqueue, not yet having been * processed by pci_vtscsi_requestq_notify() * (2) the specified task was actively being processed by a worker thread - * but not yet processed by CTL by the time the QUERY TASK request was - * handled by CTL + * but not yet processed by the backend by the time the QUERY TASK + * request was handled by the backend * * While a false negative may be confusing for a guest OS looking for the * state of an I/O request it sent, it is not considered a fatal error of @@ -812,9 +511,7 @@ static void pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, struct pci_vtscsi_ctrl_tmf *tmf) { - union ctl_io *io; uint8_t target; - int err; int fd; if (tmf->subtype > VIRTIO_SCSI_T_TMF_MAX_FUNC) { @@ -848,9 +545,10 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, * request queue. This in turn means we will miss any I/O requests which * may still be in the virtqueue. * - * This does not prevent any requests currently being processed by CTL - * from being completed and returned, which we must guarantee to adhere - * to the ordering requirements for any TMF function which aborts tasks. + * This does not prevent any requests currently being processed by the + * backend from being completed and returned, which we must guarantee to + * adhere to the ordering requirements for any TMF function which aborts + * tasks. */ for (int i = 0; i < VTSCSI_REQUESTQ; i++) { struct pci_vtscsi_queue *q = &sc->vss_queues[i]; @@ -859,7 +557,7 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, } /* - * CTL may set response to FAILURE for the TMF request. + * The backend may set response to FAILURE for the TMF request. * * The default response of all TMF functions is FUNCTION COMPLETE if * there was no error, regardless of whether it actually succeeded or @@ -867,82 +565,14 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, * which will explicitly return FUNCTION SUCCEEDED if the specified * task or any task was active in the target/LUN, respectively. * - * Thus, we will call CTL first. Only if the response we get is - * FUNCTION COMPLETE we'll continue processing the TMF function - * on our queues. Note that there's a slim chance that we're racing - * against a worker thread that is actively processing an I/O request, - * which may lead to our TMF request being processed by CTL before the + * Thus, we will call the backend first. Only if the response we get is + * FUNCTION COMPLETE we'll continue processing the TMF function on our + * queues. Note that there's a slim chance that we're racing against a + * worker thread that is actively processing an I/O request, which may + * lead to our TMF request being processed by the backend before the * same I/O request, in which case it won't be on any queue either. */ - io = ctl_scsi_alloc_io(sc->vss_iid); - if (io == NULL) { - WPRINTF("failed to allocate ctl_io: err=%d (%s)", - errno, strerror(errno)); - - tmf->response = VIRTIO_SCSI_S_FAILURE; - goto out; - } - - ctl_scsi_zero_io(io); - - io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.nexus.initid = sc->vss_iid; - io->io_hdr.nexus.targ_lun = pci_vtscsi_get_lun(sc, tmf->lun); - io->taskio.tag_type = CTL_TAG_SIMPLE; - io->taskio.tag_num = tmf->id; - io->io_hdr.flags |= CTL_FLAG_USER_TAG; - - switch (tmf->subtype) { - case VIRTIO_SCSI_T_TMF_ABORT_TASK: - io->taskio.task_action = CTL_TASK_ABORT_TASK; - break; - - case VIRTIO_SCSI_T_TMF_ABORT_TASK_SET: - io->taskio.task_action = CTL_TASK_ABORT_TASK_SET; - break; - - case VIRTIO_SCSI_T_TMF_CLEAR_ACA: - io->taskio.task_action = CTL_TASK_CLEAR_ACA; - break; - - case VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET: - io->taskio.task_action = CTL_TASK_CLEAR_TASK_SET; - break; - - case VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET: - io->taskio.task_action = CTL_TASK_I_T_NEXUS_RESET; - break; - - case VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET: - io->taskio.task_action = CTL_TASK_LUN_RESET; - break; - - case VIRTIO_SCSI_T_TMF_QUERY_TASK: - io->taskio.task_action = CTL_TASK_QUERY_TASK; - break; - - case VIRTIO_SCSI_T_TMF_QUERY_TASK_SET: - io->taskio.task_action = CTL_TASK_QUERY_TASK_SET; - break; - } - - if (pci_vtscsi_debug) { - struct sbuf *sb = sbuf_new_auto(); - ctl_io_sbuf(io, sb); - sbuf_finish(sb); - DPRINTF("%s", sbuf_data(sb)); - sbuf_delete(sb); - } - - err = ioctl(fd, CTL_IO, io); - if (err != 0) { - WPRINTF("CTL_IO: err=%d (%s)", errno, strerror(errno)); - tmf->response = VIRTIO_SCSI_S_FAILURE; - } else { - tmf->response = io->taskio.task_status; - } - - ctl_scsi_free_io(io); + sc->vss_backend->vsb_tmf_hdl(sc, fd, tmf); if (tmf->response != VIRTIO_SCSI_S_FUNCTION_COMPLETE) { /* @@ -960,7 +590,7 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, tmf->response != VIRTIO_SCSI_S_FUNCTION_REJECTED && tmf->response != VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) { WPRINTF("pci_vtscsi_tmf_hdl: unexpected response from " - "CTL: %d", tmf->response); + "backend: %d", tmf->response); } } else { pci_vtscsi_walk_t ret = PCI_VTSCSI_WALK_CONTINUE; @@ -976,7 +606,6 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, } } -out: /* Unlock the request queues before we return. */ for (int i = 0; i < VTSCSI_REQUESTQ; i++) { struct pci_vtscsi_queue *q = &sc->vss_queues[i]; @@ -989,6 +618,7 @@ static void pci_vtscsi_an_handle(struct pci_vtscsi_softc *sc, struct pci_vtscsi_ctrl_an *an) { int target; + int fd; if (pci_vtscsi_check_lun(sc, an->lun) == false) { DPRINTF("AN request to invalid LUN %.2hhx%.2hhx-%.2hhx%.2hhx-" @@ -1001,10 +631,12 @@ pci_vtscsi_an_handle(struct pci_vtscsi_softc *sc, struct pci_vtscsi_ctrl_an *an) target = pci_vtscsi_get_target(sc, an->lun); + fd = sc->vss_targets[target].vst_fd; + DPRINTF("AN request tgt %d, lun %d, event requested %x", target, pci_vtscsi_get_lun(sc, an->lun), an->event_requested); - an->response = VIRTIO_SCSI_S_FAILURE; + sc->vss_backend->vsb_an_hdl(sc, fd, an); } static void @@ -1055,10 +687,9 @@ pci_vtscsi_alloc_request(struct pci_vtscsi_softc *sc) if (req->vsr_cmd_wr == NULL) goto fail; - req->vsr_ctl_io = ctl_scsi_alloc_io(sc->vss_iid); - if (req->vsr_ctl_io == NULL) + req->vsr_backend = sc->vss_backend->vsb_req_alloc(sc); + if (req->vsr_backend == NULL) goto fail; - ctl_scsi_zero_io(req->vsr_ctl_io); return (req); @@ -1066,16 +697,17 @@ fail: EPRINTLN("failed to allocate request: %s", strerror(errno)); if (req != NULL) - pci_vtscsi_free_request(req); + pci_vtscsi_free_request(sc, req); return (NULL); } static void -pci_vtscsi_free_request(struct pci_vtscsi_request *req) +pci_vtscsi_free_request(struct pci_vtscsi_softc *sc, + struct pci_vtscsi_request *req) { - if (req->vsr_ctl_io != NULL) - ctl_scsi_free_io(req->vsr_ctl_io); + if (req->vsr_backend != NULL) + sc->vss_backend->vsb_req_free(req->vsr_backend); if (req->vsr_cmd_rd != NULL) free(req->vsr_cmd_rd); if (req->vsr_cmd_wr != NULL) @@ -1218,9 +850,10 @@ static void pci_vtscsi_return_request(struct pci_vtscsi_queue *q, struct pci_vtscsi_request *req, int iolen) { + struct pci_vtscsi_softc *sc = q->vsq_sc; void *cmd_rd = req->vsr_cmd_rd; void *cmd_wr = req->vsr_cmd_wr; - void *ctl_io = req->vsr_ctl_io; + void *backend = req->vsr_backend; int idx = req->vsr_idx; DPRINTF("request completed, response %d", idx, @@ -1229,7 +862,7 @@ pci_vtscsi_return_request(struct pci_vtscsi_queue *q, iolen += buf_to_iov(cmd_wr, VTSCSI_OUT_HEADER_LEN(q->vsq_sc), req->vsr_iov_out, req->vsr_niov_out); - ctl_scsi_zero_io(req->vsr_ctl_io); + sc->vss_backend->vsb_req_clear(backend); memset(cmd_rd, 0, VTSCSI_IN_HEADER_LEN(q->vsq_sc)); memset(cmd_wr, 0, VTSCSI_OUT_HEADER_LEN(q->vsq_sc)); @@ -1237,7 +870,7 @@ pci_vtscsi_return_request(struct pci_vtscsi_queue *q, req->vsr_cmd_rd = cmd_rd; req->vsr_cmd_wr = cmd_wr; - req->vsr_ctl_io = ctl_io; + req->vsr_backend = backend; pthread_mutex_lock(&q->vsq_fmtx); pci_vtscsi_put_request(&q->vsq_free_requests, req); @@ -1253,81 +886,7 @@ static int pci_vtscsi_request_handle(struct pci_vtscsi_softc *sc, int fd, struct pci_vtscsi_request *req) { - union ctl_io *io = req->vsr_ctl_io; - void *ext_data_ptr = NULL; - uint32_t ext_data_len = 0, ext_sg_entries = 0; - int err, nxferred; - - io->io_hdr.nexus.initid = sc->vss_iid; - io->io_hdr.nexus.targ_lun = - pci_vtscsi_get_lun(sc, req->vsr_cmd_rd->lun); - - io->io_hdr.io_type = CTL_IO_SCSI; - - if (req->vsr_data_niov_in > 0) { - ext_data_ptr = (void *)req->vsr_data_iov_in; - ext_sg_entries = req->vsr_data_niov_in; - ext_data_len = count_iov(req->vsr_data_iov_in, - req->vsr_data_niov_in); - io->io_hdr.flags |= CTL_FLAG_DATA_OUT; - } else if (req->vsr_data_niov_out > 0) { - ext_data_ptr = (void *)req->vsr_data_iov_out; - ext_sg_entries = req->vsr_data_niov_out; - ext_data_len = count_iov(req->vsr_data_iov_out, - req->vsr_data_niov_out); - io->io_hdr.flags |= CTL_FLAG_DATA_IN; - } - - io->scsiio.sense_len = sc->vss_config.sense_size; - io->scsiio.tag_num = req->vsr_cmd_rd->id; - io->io_hdr.flags |= CTL_FLAG_USER_TAG; - switch (req->vsr_cmd_rd->task_attr) { - case VIRTIO_SCSI_S_ORDERED: - io->scsiio.tag_type = CTL_TAG_ORDERED; - break; - case VIRTIO_SCSI_S_HEAD: - io->scsiio.tag_type = CTL_TAG_HEAD_OF_QUEUE; - break; - case VIRTIO_SCSI_S_ACA: - io->scsiio.tag_type = CTL_TAG_ACA; - break; - case VIRTIO_SCSI_S_SIMPLE: - default: - io->scsiio.tag_type = CTL_TAG_SIMPLE; - break; - } - io->scsiio.ext_sg_entries = ext_sg_entries; - io->scsiio.ext_data_ptr = ext_data_ptr; - io->scsiio.ext_data_len = ext_data_len; - io->scsiio.ext_data_filled = 0; - io->scsiio.cdb_len = sc->vss_config.cdb_size; - memcpy(io->scsiio.cdb, req->vsr_cmd_rd->cdb, sc->vss_config.cdb_size); - - if (pci_vtscsi_debug) { - struct sbuf *sb = sbuf_new_auto(); - ctl_io_sbuf(io, sb); - sbuf_finish(sb); - DPRINTF("%s", sbuf_data(sb)); - sbuf_delete(sb); - } - - err = ioctl(fd, CTL_IO, io); - if (err != 0) { - WPRINTF("CTL_IO: err=%d (%s)", errno, strerror(errno)); - req->vsr_cmd_wr->response = VIRTIO_SCSI_S_FAILURE; - } else { - req->vsr_cmd_wr->sense_len = - MIN(io->scsiio.sense_len, sc->vss_config.sense_size); - req->vsr_cmd_wr->residual = ext_data_len - - io->scsiio.ext_data_filled; - req->vsr_cmd_wr->status = io->scsiio.scsi_status; - req->vsr_cmd_wr->response = VIRTIO_SCSI_S_OK; - memcpy(&req->vsr_cmd_wr->sense, &io->scsiio.sense_data, - req->vsr_cmd_wr->sense_len); - } - - nxferred = io->scsiio.ext_data_filled; - return (nxferred); + return (sc->vss_backend->vsb_req_hdl(sc, fd, req)); } static void @@ -1439,7 +998,7 @@ pci_vtscsi_destroy_queue(struct pci_vtscsi_queue *queue) break; req = pci_vtscsi_get_request(&queue->vsq_free_requests); - pci_vtscsi_free_request(req); + pci_vtscsi_free_request(queue->vsq_sc, req); } pthread_cond_destroy(&queue->vsq_cv); @@ -1534,10 +1093,13 @@ pci_vtscsi_legacy_config(nvlist_t *nvl, const char *opts) targets = create_relative_config_node(nvl, "target"); - /* Handle legacy form (0). */ - if (opts == NULL) { - pci_vtscsi_add_target_config(targets, "/dev/cam/ctl", 0); + /* Legacy form (0) is handled in pci_vtscsi_init(). */ + if (opts == NULL) return (0); + + if (strcmp("help", opts) == 0) { + pci_vtscsi_print_supported_backends(); + exit(0); } n = strcspn(opts, ",="); @@ -1633,6 +1195,7 @@ pci_vtscsi_init_target(const char *prefix __unused, const nvlist_t *parent, const char *value; const char *errstr; uint64_t target; + int ret; assert(type == NV_TYPE_STRING); @@ -1644,23 +1207,21 @@ pci_vtscsi_init_target(const char *prefix __unused, const nvlist_t *parent, sc->vss_targets[target].vst_target = target; /* - * 'value' contains the CTL device node path of this target. + * 'value' contains the backend path. Call the backend to open it. */ value = nvlist_get_string(parent, name); - sc->vss_targets[target].vst_fd = open(value, O_RDWR); - if (sc->vss_targets[target].vst_fd < 0) { + ret = sc->vss_backend->vsb_open(sc, value, target); + if (ret != 0) EPRINTLN("cannot open target %lu at %s: %s", target, value, strerror(errno)); - return (-1); - } - - return (0); + return (ret); } static int pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) { *** 843 LINES SKIPPED *** From nobody Tue May 26 16:07:18 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 4gPyLt5Psgz6g2Gr for ; Tue, 26 May 2026 16:07:18 +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 4gPyLt2jyCz44sR for ; Tue, 26 May 2026 16:07:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779811638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qw5Xq8c38GfOfeo04Bo8weWE/SQc65Bwm7nE3dJT7/Q=; b=B8vqv4k1u97Mw9Msz6GLw/h0gzbz9yig1/r8jZHm/dPltvoYNICVQcFizCREZT7s/NRpgE 6pS33MfhsPQvSRWeHT0xq2LcEhFuDhIctIuuv3rFpSey00ujYKrd9OUoiuMVLHNAMosprI BRokmPWhtiX1az+iNwWXnil9keUWBdBwVdkGmqLM5yFjSRFjCZ6Ayv0QmIw7Jin9hpXdp6 0YBoRDL2CIvCqJWYYLDS93CO0UC2zrmdPUt25QdVihIy3F7xa1+ww6OIScEbc07anyfq+Q R/Xjj7xQAxEFiPwogKszTmcBCTG2j0cA4Tk7v+AbWE08ekiMXKxoaFllN0tXoQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779811638; a=rsa-sha256; cv=none; b=ZSa0PE4dhZ2t3lrM9iStjHkOJVZiQObUkGJLRXuGTuGZjqIlihysaFEDyKaiuGuh4c0oCM H+43+53UARut+91+GVFzjo+VGQMnjGbx2bcVhwL8GzG69u22u52QT9tUG4rDLrnjkh5KsC T7wtHWtnowWJYm7GuBLM2bk8z+R/8ZkZZ4CYMggK87JGhNSsaJGXmfjHsR/ESxuOnM/6Fo vgkXG5tjZoz1dwa0giNMFIc1Q6/Ubiw+/C0+7gw8m4nV90IuVIO7apdQFSPNJA+whz36k0 kWhrq38LrvvGeT1ZFVutO6uykunmQ3QW3D/xO/6OMaW0DAUvq66lFfJV213X9w== 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=1779811638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qw5Xq8c38GfOfeo04Bo8weWE/SQc65Bwm7nE3dJT7/Q=; b=nZjfKIH5I5axzb79PSkaeurFuQI1w5vdtbYD0nbtBM/BGXt+NgXA0FI/ikV79o18jNeuSK TRdrW7C2R0aXx1TzoOvl9gTq/UgfuVuGzkk67mHQ/tQBgZqb115uPdrjDXlA820mII8GVa f5amCmyn8m2yknNJdfwCkipTHGmQc2RbgIYWVx3nuushakYoOOgGFIAIWDQYKWJ8AQU06r ROgO94l4FDSSaw7diLESiofp2gDInqP4/5SN3PZYdf5HpZVGIMx/sHCD9TqdPzNlSFnbOK UqwL4fDyIWYF/iCJmfZM2LvD6AqyOae38iHFJljNuOIyegY+YEOlpzyR88DsIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPyLt2D01z4DV for ; Tue, 26 May 2026 16:07:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 310f2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 16:07:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Hans Rosenfeld From: Mark Johnston Subject: git: ccb14be785f7 - main - bhyve/virtio-scsi: Make all I/O processing parameters configurable 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccb14be785f79583a6a0622a89489c8d681f2bf8 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 16:07:18 +0000 Message-Id: <6a15c536.310f2.415e655f@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ccb14be785f79583a6a0622a89489c8d681f2bf8 commit ccb14be785f79583a6a0622a89489c8d681f2bf8 Author: Hans Rosenfeld AuthorDate: 2025-11-10 17:08:31 +0000 Commit: Mark Johnston CommitDate: 2026-05-26 16:03:12 +0000 bhyve/virtio-scsi: Make all I/O processing parameters configurable This includes: - seg_max, the number of segments allowed in a single command - {ctl,evt,req}_ringsz, the number of descriptors in a queue - thr_per_q, the number of processing threads per request queue - num_queues, the number of request queues Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D54073 --- usr.sbin/bhyve/bhyve.8 | 12 +++ usr.sbin/bhyve/bhyve_config.5 | 16 ++- usr.sbin/bhyve/pci_virtio_scsi.c | 222 +++++++++++++++++++++++++++++---------- usr.sbin/bhyve/pci_virtio_scsi.h | 80 ++++++++++---- 4 files changed, 252 insertions(+), 78 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 01b7dba941ac..ec8c880b0243 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -737,6 +737,18 @@ Add the device to the boot order at A fw_cfg file is used to specify the boot order. The guest firmware may ignore or not support this fw_cfg file. In that case, this feature doesn't work as expected. +.It Li ctl_ringsz= Ns Ar ringsz +The ring size to use for the control queue. +.It Li evt_ringsz= Ns Ar ringsz +The ring size to use for the event queue. +.It Li req_ringsz= Ns Ar ringsz +The ring size to use for each I/O request queue. +.It Li num_queues= Ns Ar num +The number of I/O request queues to use. +.It Li seg_max= Ns Ar num +The maximum number of segments allowed in a single command. +.It Li thr_per_q= Ns Ar num +The number of parallel request processing threads per I/O request queue. .El .Pp The diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index d4361468bc22..8bfe9afd0b24 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -1,7 +1,7 @@ .\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2021 John H. Baldwin -.\" Copyright 2025 Hans Rosenfeld +.\" Copyright (c) 2026 Hans Rosenfeld .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -762,10 +762,22 @@ If specified, it must be a unicast MAC address. The largest supported MTU advertised to the guest. .El .Ss VirtIO SCSI Settings -.Bl -column "backend" "string" "/dev/cam/ctl" +.Bl -column "num_queues" "Format" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va backend Ta string Ta ctl Ta The virtio-scsi backend to use (case-insensitive). +.It Va ctl_ringsz Ta integer Ta 64 Ta +The ring size of the control queue. +.It Va evt_ringsz Ta integer Ta 64 Ta +The ring size of the event queue. +.It Va req_ringsz Ta integer Ta 64 Ta +The ring size of each I/O request queue. +.It Va num_queues Ta integer Ta 1 Ta +The number of I/O request queues. +.It Va seg_max Ta integer Ta 64 Ta +The maximum number of segments allowed in a single command. +.It Va thr_per_q Ta integer Ta 16 Ta +The number of parallel request processing threads per I/O request queue. .It Va target Ta Oo Va ID : Oc Ns path Ta /dev/cam/ctl Ta The backend .Ar path diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index 47b90184fe08..97f1ff3c65d8 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -114,14 +114,15 @@ static void pci_vtscsi_requestq_notify(void *, struct vqueue_info *); static int pci_vtscsi_add_target_config(nvlist_t *, const char *, int); static int pci_vtscsi_init_queue(struct pci_vtscsi_softc *, struct pci_vtscsi_queue *, int); -static void pci_vtscsi_destroy_queue(struct pci_vtscsi_queue *); +static void pci_vtscsi_destroy_queue(struct pci_vtscsi_softc *, + struct pci_vtscsi_queue *); static int pci_vtscsi_init(struct pci_devinst *, nvlist_t *); SET_DECLARE(pci_vtscsi_backend_set, struct pci_vtscsi_backend); static struct virtio_consts vtscsi_vi_consts = { .vc_name = "vtscsi", - .vc_nvq = VTSCSI_MAXQ, + .vc_nvq = VTSCSI_DEF_REQUESTQ + VIRTIO_SCSI_ADDL_Q, .vc_cfgsize = sizeof(struct pci_vtscsi_config), .vc_reset = pci_vtscsi_reset, .vc_cfgread = pci_vtscsi_cfgread, @@ -130,6 +131,20 @@ static struct virtio_consts vtscsi_vi_consts = { .vc_hv_caps = VIRTIO_RING_F_INDIRECT_DESC, }; +static const struct pci_vtscsi_config vtscsi_config = { + .num_queues = VTSCSI_DEF_REQUESTQ, + /* Leave room for the request and the response. */ + .seg_max = VTSCSI_DEF_MAXSEG - VIRTIO_SCSI_HDR_SEG, + .max_sectors = 0, + .cmd_per_lun = 1, + .event_info_size = sizeof(struct pci_vtscsi_event), + .sense_size = 96, + .cdb_size = 32, + .max_channel = VIRTIO_SCSI_MAX_CHANNEL, + .max_target = VIRTIO_SCSI_MAX_TARGET, + .max_lun = VIRTIO_SCSI_MAX_LUN +}; + int pci_vtscsi_debug = 0; @@ -200,19 +215,9 @@ pci_vtscsi_reset(void *vsc) vi_reset_dev(&sc->vss_vs); /* initialize config structure */ - sc->vss_config = (struct pci_vtscsi_config){ - .num_queues = VTSCSI_REQUESTQ, - /* Leave room for the request and the response. */ - .seg_max = VTSCSI_MAXSEG - 2, - .max_sectors = 0, /* overridden by backend reset() */ - .cmd_per_lun = 1, - .event_info_size = sizeof(struct pci_vtscsi_event), - .sense_size = 96, - .cdb_size = 32, - .max_channel = VIRTIO_SCSI_MAX_CHANNEL, - .max_target = MAX(1, sc->vss_num_target) - 1, - .max_lun = VIRTIO_SCSI_MAX_LUN - }; + sc->vss_config = sc->vss_default_config; + + sc->vss_config.max_target = MAX(1, sc->vss_num_target) - 1; sc->vss_backend->vsb_reset(sc); } @@ -550,7 +555,7 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, * adhere to the ordering requirements for any TMF function which aborts * tasks. */ - for (int i = 0; i < VTSCSI_REQUESTQ; i++) { + for (uint32_t i = 0; i < sc->vss_config.num_queues; i++) { struct pci_vtscsi_queue *q = &sc->vss_queues[i]; pthread_mutex_lock(&q->vsq_rmtx); @@ -594,20 +599,21 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, } } else { pci_vtscsi_walk_t ret = PCI_VTSCSI_WALK_CONTINUE; - int i; + uint32_t i; - for (i = 0; - i < VTSCSI_REQUESTQ && ret != PCI_VTSCSI_WALK_STOP; - i++) { + for (i = 0; i < sc->vss_config.num_queues; i++) { struct pci_vtscsi_queue *q = &sc->vss_queues[i]; ret = pci_vtscsi_walk_request_queue(q, pci_vtscsi_tmf_handler_cb[tmf->subtype], tmf); + + if (ret == PCI_VTSCSI_WALK_STOP) + break; } } /* Unlock the request queues before we return. */ - for (int i = 0; i < VTSCSI_REQUESTQ; i++) { + for (uint32_t i = 0; i < sc->vss_config.num_queues; i++) { struct pci_vtscsi_queue *q = &sc->vss_queues[i]; pthread_mutex_unlock(&q->vsq_rmtx); @@ -680,6 +686,11 @@ pci_vtscsi_alloc_request(struct pci_vtscsi_softc *sc) if (req == NULL) goto fail; + req->vsr_iov = calloc(sc->vss_config.seg_max + VIRTIO_SCSI_HDR_SEG + + SPLIT_IOV_ADDL_IOV, sizeof(struct iovec)); + if (req->vsr_iov == NULL) + goto fail; + req->vsr_cmd_rd = calloc(1, VTSCSI_IN_HEADER_LEN(sc)); if (req->vsr_cmd_rd == NULL) goto fail; @@ -712,6 +723,8 @@ pci_vtscsi_free_request(struct pci_vtscsi_softc *sc, free(req->vsr_cmd_rd); if (req->vsr_cmd_wr != NULL) free(req->vsr_cmd_wr); + if (req->vsr_iov != NULL) + free(req->vsr_iov); free(req); } @@ -739,19 +752,23 @@ pci_vtscsi_put_request(struct pci_vtscsi_req_queue *req_queue, static void pci_vtscsi_queue_request(struct pci_vtscsi_softc *sc, struct vqueue_info *vq) { - struct pci_vtscsi_queue *q = &sc->vss_queues[vq->vq_num - 2]; + struct pci_vtscsi_queue *q; struct pci_vtscsi_request *req; struct vi_req vireq; size_t res __maybe_unused; - int n; + int n, numseg; + + q = &sc->vss_queues[vq->vq_num - VIRTIO_SCSI_ADDL_Q]; pthread_mutex_lock(&q->vsq_fmtx); req = pci_vtscsi_get_request(&q->vsq_free_requests); assert(req != NULL); pthread_mutex_unlock(&q->vsq_fmtx); - n = vq_getchain(vq, req->vsr_iov, VTSCSI_MAXSEG, &vireq); - assert(n >= 1 && n <= VTSCSI_MAXSEG); + numseg = (int)(sc->vss_config.seg_max + VIRTIO_SCSI_HDR_SEG); + + n = vq_getchain(vq, req->vsr_iov, numseg, &vireq); + assert(n >= 1 && n <= numseg); req->vsr_idx = vireq.idx; req->vsr_queue = q; @@ -851,6 +868,7 @@ pci_vtscsi_return_request(struct pci_vtscsi_queue *q, struct pci_vtscsi_request *req, int iolen) { struct pci_vtscsi_softc *sc = q->vsq_sc; + void *iov = req->vsr_iov; void *cmd_rd = req->vsr_cmd_rd; void *cmd_wr = req->vsr_cmd_wr; void *backend = req->vsr_backend; @@ -864,10 +882,13 @@ pci_vtscsi_return_request(struct pci_vtscsi_queue *q, sc->vss_backend->vsb_req_clear(backend); + memset(iov, 0, sizeof(struct iovec) * (sc->vss_config.seg_max + + VIRTIO_SCSI_HDR_SEG + SPLIT_IOV_ADDL_IOV)); memset(cmd_rd, 0, VTSCSI_IN_HEADER_LEN(q->vsq_sc)); memset(cmd_wr, 0, VTSCSI_OUT_HEADER_LEN(q->vsq_sc)); memset(req, 0, sizeof(struct pci_vtscsi_request)); + req->vsr_iov = iov; req->vsr_cmd_rd = cmd_rd; req->vsr_cmd_wr = cmd_wr; req->vsr_backend = backend; @@ -892,18 +913,17 @@ pci_vtscsi_request_handle(struct pci_vtscsi_softc *sc, int fd, static void pci_vtscsi_controlq_notify(void *vsc, struct vqueue_info *vq) { - struct pci_vtscsi_softc *sc; - struct iovec iov[VTSCSI_MAXSEG]; + struct pci_vtscsi_softc *sc = vsc; + int numseg = (int)(sc->vss_config.seg_max + VIRTIO_SCSI_HDR_SEG); + struct iovec *iov = calloc(numseg, sizeof (struct iovec)); struct vi_req req; void *buf = NULL; size_t bufsize; int n; - sc = vsc; - while (vq_has_descs(vq)) { - n = vq_getchain(vq, iov, VTSCSI_MAXSEG, &req); - assert(n >= 1 && n <= VTSCSI_MAXSEG); + n = vq_getchain(vq, iov, numseg, &req); + assert(n >= 1 && n <= numseg); bufsize = iov_to_buf(iov, n, &buf); pci_vtscsi_control_handle(sc, buf, bufsize); @@ -916,6 +936,7 @@ pci_vtscsi_controlq_notify(void *vsc, struct vqueue_info *vq) } vq_endchains(vq, 1); /* Generate interrupt if appropriate. */ free(buf); + free(iov); } static void @@ -938,10 +959,10 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc, { struct pci_vtscsi_worker *workers; char tname[MAXCOMLEN + 1]; - int i; + uint32_t i; queue->vsq_sc = sc; - queue->vsq_vq = &sc->vss_vq[num + 2]; + queue->vsq_vq = &sc->vss_vq[num]; pthread_mutex_init(&queue->vsq_rmtx, NULL); pthread_mutex_init(&queue->vsq_fmtx, NULL); @@ -951,7 +972,7 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc, STAILQ_INIT(&queue->vsq_free_requests); LIST_INIT(&queue->vsq_workers); - for (i = 0; i < VTSCSI_RINGSZ; i++) { + for (i = 0; i < sc->vss_req_ringsz; i++) { struct pci_vtscsi_request *req; req = pci_vtscsi_alloc_request(sc); @@ -961,11 +982,11 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc, pci_vtscsi_put_request(&queue->vsq_free_requests, req); } - workers = calloc(VTSCSI_THR_PER_Q, sizeof(struct pci_vtscsi_worker)); + workers = calloc(sc->vss_thr_per_q, sizeof(struct pci_vtscsi_worker)); if (workers == NULL) goto fail; - for (i = 0; i < VTSCSI_THR_PER_Q; i++) { + for (i = 0; i < sc->vss_thr_per_q; i++) { workers[i].vsw_queue = queue; pthread_create(&workers[i].vsw_thread, NULL, &pci_vtscsi_proc, @@ -979,19 +1000,19 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc, return (0); fail: - pci_vtscsi_destroy_queue(queue); + pci_vtscsi_destroy_queue(sc, queue); return (-1); - } static void -pci_vtscsi_destroy_queue(struct pci_vtscsi_queue *queue) +pci_vtscsi_destroy_queue(struct pci_vtscsi_softc *sc, + struct pci_vtscsi_queue *queue) { if (queue->vsq_sc == NULL) return; - for (int i = VTSCSI_RINGSZ; i > 0; i--) { + for (int i = sc->vss_req_ringsz; i > 0; i--) { struct pci_vtscsi_request *req; if (STAILQ_EMPTY(&queue->vsq_free_requests)) @@ -1217,19 +1238,49 @@ pci_vtscsi_init_target(const char *prefix __unused, const nvlist_t *parent, return (ret); } +static int +pci_vtscsi_get_config_num(nvlist_t *nvl, const char *name, uint32_t lim_lo, + uint32_t lim_hi, uint32_t *res) +{ + const char *value; + const char *errstr; + long long val; + + value = get_config_value_node(nvl, name); + if (value == NULL) + return (0); + + val = strtonumx(value, lim_lo, lim_hi, &errstr, 0); + if (errstr != NULL) { + EPRINTLN("Invalid value for %s: %s", name, value); + return (-1); + } + + *res = (uint32_t)val; + return (0); +} + static int pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) { struct pci_vtscsi_softc *sc; struct pci_vtscsi_backend *backend, **vbpp; const char *value; + uint32_t val; size_t i; - int err; + int q, err; sc = calloc(1, sizeof(struct pci_vtscsi_softc)); if (sc == NULL) return (-1); + sc->vss_vi_consts = vtscsi_vi_consts; + sc->vss_ctl_ringsz = VTSCSI_DEF_RINGSZ; + sc->vss_evt_ringsz = VTSCSI_DEF_RINGSZ; + sc->vss_req_ringsz = VTSCSI_DEF_RINGSZ; + sc->vss_thr_per_q = VTSCSI_DEF_THR_PER_Q; + sc->vss_default_config = vtscsi_config; + value = get_config_value_node(nvl, "bootindex"); if (value != NULL) { if (pci_emul_add_boot_device(pi, atoi(value))) { @@ -1239,6 +1290,60 @@ pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) } } + val = vtscsi_config.seg_max; + if (pci_vtscsi_get_config_num(nvl, "seg_max", VTSCSI_MIN_MAXSEG, + VTSCSI_MAX_MAXSEG, &val) != 0) + goto fail; + sc->vss_default_config.seg_max = val; + + val = vtscsi_config.num_queues; + if (pci_vtscsi_get_config_num(nvl, "num_queues", VTSCSI_MIN_REQUESTQ, + VTSCSI_MAX_REQUESTQ, &val) != 0) + goto fail; + sc->vss_default_config.num_queues = val; + + /* + * num_queues is only the number of request queues, but nvq must + * account for the control and event queues. + */ + sc->vss_vi_consts.vc_nvq = val + VIRTIO_SCSI_ADDL_Q; + + /* + * Allocate queues early, so that they're there for the call to + * vi_softc_linkup(). + */ + sc->vss_vq = calloc(sc->vss_vi_consts.vc_nvq, + sizeof(struct vqueue_info)); + if (sc->vss_vq == NULL) { + EPRINTLN("can't allocate space for %d virtqueues", + sc->vss_vi_consts.vc_nvq); + goto fail; + } + + sc->vss_queues = calloc(sc->vss_default_config.num_queues, + sizeof(struct pci_vtscsi_queue)); + if (sc->vss_queues == NULL) { + EPRINTLN("can't allocate space for %d request queues", + sc->vss_config.num_queues); + goto fail; + } + + if (pci_vtscsi_get_config_num(nvl, "ctl_ringsz", VTSCSI_MIN_RINGSZ, + VTSCSI_MAX_RINGSZ, &sc->vss_ctl_ringsz) != 0) + goto fail; + + if (pci_vtscsi_get_config_num(nvl, "evt_ringsz", VTSCSI_MIN_RINGSZ, + VTSCSI_MAX_RINGSZ, &sc->vss_evt_ringsz) != 0) + goto fail; + + if (pci_vtscsi_get_config_num(nvl, "req_ringsz", VTSCSI_MIN_RINGSZ, + VTSCSI_MAX_RINGSZ, &sc->vss_req_ringsz) != 0) + goto fail; + + if (pci_vtscsi_get_config_num(nvl, "thr_per_q", VTSCSI_MIN_THR_PER_Q, + VTSCSI_MAX_THR_PER_Q, &sc->vss_thr_per_q) != 0) + goto fail; + value = get_config_value_node(nvl, "backend"); if (value == NULL) { if (SET_COUNT(pci_vtscsi_backend_set) == 0) { @@ -1301,7 +1406,7 @@ pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) pthread_mutex_init(&sc->vss_mtx, NULL); - vi_softc_linkup(&sc->vss_vs, &vtscsi_vi_consts, sc, pi, sc->vss_vq); + vi_softc_linkup(&sc->vss_vs, &sc->vss_vi_consts, sc, pi, sc->vss_vq); sc->vss_vs.vs_mtx = &sc->vss_mtx; /* @@ -1317,20 +1422,22 @@ pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) pci_vtscsi_reset(sc); pthread_mutex_unlock(&sc->vss_mtx); - /* controlq */ - sc->vss_vq[0].vq_qsize = VTSCSI_RINGSZ; + /* virtqueue 0: control queue */ + sc->vss_vq[0].vq_qsize = sc->vss_ctl_ringsz; sc->vss_vq[0].vq_notify = pci_vtscsi_controlq_notify; - /* eventq */ - sc->vss_vq[1].vq_qsize = VTSCSI_RINGSZ; + /* virtqueue 1: event queue */ + sc->vss_vq[1].vq_qsize = sc->vss_evt_ringsz; sc->vss_vq[1].vq_notify = pci_vtscsi_eventq_notify; - /* request queues */ - for (i = 2; i < VTSCSI_MAXQ; i++) { - sc->vss_vq[i].vq_qsize = VTSCSI_RINGSZ; - sc->vss_vq[i].vq_notify = pci_vtscsi_requestq_notify; + /* virtqueue 2-n: request queues */ + for (q = VIRTIO_SCSI_ADDL_Q; q < sc->vss_vi_consts.vc_nvq; q++) { + int rq = q - VIRTIO_SCSI_ADDL_Q; + + sc->vss_vq[q].vq_qsize = sc->vss_req_ringsz; + sc->vss_vq[q].vq_notify = pci_vtscsi_requestq_notify; - err = pci_vtscsi_init_queue(sc, &sc->vss_queues[i - 2], i - 2); + err = pci_vtscsi_init_queue(sc, &sc->vss_queues[rq], q); if (err != 0) goto fail; } @@ -1351,8 +1458,15 @@ pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) return (0); fail: - for (i = 2; i < VTSCSI_MAXQ; i++) - pci_vtscsi_destroy_queue(&sc->vss_queues[i - 2]); + if (sc->vss_queues != NULL) { + for (q = VIRTIO_SCSI_ADDL_Q; + q < sc->vss_vi_consts.vc_nvq; + q++) { + int rq = q - VIRTIO_SCSI_ADDL_Q; + + pci_vtscsi_destroy_queue(sc, &sc->vss_queues[rq]); + } + } pthread_mutex_destroy(&sc->vss_mtx); @@ -1365,6 +1479,8 @@ fail: free(sc->vss_targets); free(sc->vss_backend); + free(sc->vss_queues); + free(sc->vss_vq); free(sc); return (-1); } diff --git a/usr.sbin/bhyve/pci_virtio_scsi.h b/usr.sbin/bhyve/pci_virtio_scsi.h index 5a8bb7a47d40..b0f41bbdd8c3 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.h +++ b/usr.sbin/bhyve/pci_virtio_scsi.h @@ -32,6 +32,8 @@ #ifndef _PCI_VIRTIO_SCSI_H_ #define _PCI_VIRTIO_SCSI_H_ +#include "iov.h" + extern int pci_vtscsi_debug; #define WPRINTF(msg, params...) PRINTLN("virtio-scsi: " msg, ##params) @@ -41,18 +43,31 @@ extern int pci_vtscsi_debug; #define VIRTIO_SCSI_MAX_CHANNEL 0 #define VIRTIO_SCSI_MAX_TARGET 255 #define VIRTIO_SCSI_MAX_LUN 16383 +#define VIRTIO_SCSI_HDR_SEG 2 +#define VIRTIO_SCSI_ADDL_Q 2 /* Features specific to VirtIO SCSI, none of which we currently support */ #define VIRTIO_SCSI_F_INOUT (1 << 0) #define VIRTIO_SCSI_F_HOTPLUG (1 << 1) #define VIRTIO_SCSI_F_CHANGE (1 << 2) -/* Limits which we set. These should really be configurable. */ -#define VTSCSI_RINGSZ 64 -#define VTSCSI_REQUESTQ 1 -#define VTSCSI_THR_PER_Q 16 -#define VTSCSI_MAXQ (VTSCSI_REQUESTQ + 2) -#define VTSCSI_MAXSEG 64 +/* Default limits which we set. All of these are configurable. */ +#define VTSCSI_DEF_RINGSZ 64 +#define VTSCSI_MIN_RINGSZ 4 +#define VTSCSI_MAX_RINGSZ 4096 + +#define VTSCSI_DEF_THR_PER_Q 16 +#define VTSCSI_MIN_THR_PER_Q 1 +#define VTSCSI_MAX_THR_PER_Q 256 + +#define VTSCSI_DEF_MAXSEG 64 +#define VTSCSI_MIN_MAXSEG (VIRTIO_SCSI_HDR_SEG + 1) +#define VTSCSI_MAX_MAXSEG \ + (4096 - VIRTIO_SCSI_HDR_SEG - SPLIT_IOV_ADDL_IOV) + +#define VTSCSI_DEF_REQUESTQ 1 +#define VTSCSI_MIN_REQUESTQ 1 +#define VTSCSI_MAX_REQUESTQ (32 - VIRTIO_SCSI_ADDL_Q) /* * Device-specific config space registers @@ -88,20 +103,17 @@ struct pci_vtscsi_config { * device instance has at least one I/O request queue, the state of which is * is kept in an array of struct pci_vtscsi_queue in the device softc. * - * Currently there is only one I/O request queue, but it's trivial to support - * more than one. + * Each pci_vtscsi_queue has configurable number of pci_vtscsi_request + * structures pre-allocated on vsq_free_requests. For each I/O request + * coming in on the I/O virtqueue, the request queue handler will take a + * pci_vtscsi_request off vsq_free_requests, fills in the data from the + * I/O virtqueue, puts it on vsq_requests, and signals vsq_cv. * - * Each pci_vtscsi_queue has VTSCSI_RINGSZ pci_vtscsi_request structures pre- - * allocated on vsq_free_requests. For each I/O request coming in on the I/O - * virtqueue, the request queue handler will take a pci_vtscsi_request off - * vsq_free_requests, fills in the data from the I/O virtqueue, puts it on - * vsq_requests, and signals vsq_cv. - * - * There are VTSCSI_THR_PER_Q worker threads for each pci_vtscsi_queue which - * wait on vsq_cv. When signalled, they repeatedly take one pci_vtscsi_request - * off vsq_requests, construct a ctl_io for it, and hand it off to the CTL ioctl - * Interface, which processes it synchronously. After completion of the request, - * the pci_vtscsi_request is re-initialized and put back onto vsq_free_requests. + * Each pci_vtscsi_queue will have a configurable number of worker threads, + * which wait on vsq_cv. When signalled, they repeatedly take a single + * pci_vtscsi_request off vsq_requests and hand it to the backend, which + * processes it synchronously. After completion, the pci_vtscsi_request + * is re-initialized and put back onto vsq_free_requests. * * The worker threads exit when vsq_cv is signalled after vsw_exiting was set. * @@ -109,6 +121,23 @@ struct pci_vtscsi_config { * - vsq_rmtx protects vsq_requests and must be held when waiting on vsq_cv * - vsq_fmtx protects vsq_free_requests * - vsq_qmtx must be held when operating on the underlying virtqueue, vsq_vq + * + * The I/O vectors for each request are kept in the preallocated iovec array + * vsr_iov, and pointers to the respective header/data in/out portions are set + * up to point into the array when the request is queued for processing. + * + * The number of iovecs preallocated for vsr_iov is derived from the configured + * 'seg_max' parameter defined by the virtio spec: + * - 'seg_max' parameter specifies the maximum number of I/O data vectors + * we support in any request + * - we need 2 additional iovecs for the I/O headers (VIRTIO_SCSI_HDR_SEG) + * - we need another 2 additional iovecs for split_iov() (SPLIT_IOV_ADDL_IOV) + * + * The only time we explicitly need the full size of vsr_iov after preallocation + * is during re-initialization after completing a request, and implicitly in the + * calls to split_iov() the set up the pointers. In all other cases, we use only + * 'seg_max' + VIRTIO_SCSI_HDR_SEG, and we advertise only 'seg_max' to the guest + * in accordance to the virtio spec. */ STAILQ_HEAD(pci_vtscsi_req_queue, pci_vtscsi_request); @@ -133,8 +162,7 @@ struct pci_vtscsi_worker { struct pci_vtscsi_request { struct pci_vtscsi_queue *vsr_queue; - struct iovec vsr_iov[VTSCSI_MAXSEG + - SPLIT_IOV_ADDL_IOV]; + struct iovec *vsr_iov; struct iovec *vsr_iov_in; struct iovec *vsr_iov_out; struct iovec *vsr_data_iov_in; @@ -164,11 +192,17 @@ struct pci_vtscsi_target { */ struct pci_vtscsi_softc { struct virtio_softc vss_vs; - struct vqueue_info vss_vq[VTSCSI_MAXQ]; - struct pci_vtscsi_queue vss_queues[VTSCSI_REQUESTQ]; + struct virtio_consts vss_vi_consts; + struct vqueue_info *vss_vq; + struct pci_vtscsi_queue *vss_queues; pthread_mutex_t vss_mtx; uint32_t vss_features; size_t vss_num_target; + uint32_t vss_ctl_ringsz; + uint32_t vss_evt_ringsz; + uint32_t vss_req_ringsz; + uint32_t vss_thr_per_q; + struct pci_vtscsi_config vss_default_config; struct pci_vtscsi_config vss_config; struct pci_vtscsi_target *vss_targets; struct pci_vtscsi_backend *vss_backend; From nobody Tue May 26 16:07:19 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 4gPyLw02XKz6g2KD for ; Tue, 26 May 2026 16:07:20 +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 4gPyLv482mz45BJ for ; Tue, 26 May 2026 16:07:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779811639; 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=wPMNvqggVoTHCRsJoGTjRCsO/cdml0Gx/qGTPLEnr+k=; b=vxXdFgCQGPPa5ZFRhlA6JBfS3t1F7ue1WPZgAAe8Hc9l0gfqqWqY9UNuqfuJ8sBF3CTBDl UdeNHMCqZZr8T7vqgp1jGlxuaLy2buOFWDTVqOCYL+scy1WQn7e0B8kNtxgSQw1+4jTy0O 5vTF54YTSbKLPn+tQZS+4Fic6eSJ81s5mot1M8rwQPzG1KrOssFtqghWoMMagW2uQutWCl evGSWb3IUdspgdDRJ8S0Cmn8a6sO/vlWUpc9dkFqznQA2uRO4+Ttwot56fiEQNTjO2oVrv kXyGi/W7m4PIiSjMPJHHLU/KletaqaXIju/x/YDqJu0r5u6Q+fTbp51pgMC+Iw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779811639; a=rsa-sha256; cv=none; b=dzL+SQs8LAAorv+G8NHYmRB2jPOH1L2e+4vXPWbScUUuKM7a0KBKWW+XSh4YZALTrMIYv6 ReWBNmfWfH8UNpdg+NflzQd9RRUWoE2KMAsb2l+eUDV9JpIVFW9KLpd+JtnNzmwG08ycTB YQ1W8heG1SD5RoZWzFvgYX/O7yE6FlKohLq/v0GiqF17rgIaUTYzdi37H/hIbPX0qQHqKR 5TVTsdJT5U+BGbLdaINv49gMbRYosT5n5AWlSDHovqdEh/ojpl9o1kLWsOx4ORmEokVzZn VEGR8wjAbsdPMCKvtd8RR06zRr+xMik1WIw46RA73XJV9Aq8e6hrUm3M+JiZDg== 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=1779811639; 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=wPMNvqggVoTHCRsJoGTjRCsO/cdml0Gx/qGTPLEnr+k=; b=EkHLq5mvub6r75kWa4D8rYeRNxzGXavSXfTqCRSElZaca0MsTvk/ke5/Oi2emEUHR8qAA8 eUqwqJbIJ5Lwfh69eBcLjfA9Sn8FZ9BBZMU65OaPPJzhVvxHCv+ulxccAcjNfnmyBhVMe6 3qXMyJHmRcivgek1cPSjbND8PQwEGMzFBAiyp+advs8061xBQn7feDRd0QtUSPy9ZOWKXK Trp6nU4Tbq5RXm7f4pTojisxvU4WiZK+FeoBKDLQ9w0iV0qQn4qgFGrLju3tl8lY27AxYQ dSTmIxtPfE382gM8iBEF2tVlaHBdhWp/ISJ9/HkYDQSyBSkP845jpc/DMEQd7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPyLv38S9z41L for ; Tue, 26 May 2026 16:07:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31f79 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 16:07:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 895a0ae67fe2 - main - divert: Define semantics for SO_REUSEPORT_LB on divert sockets 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 895a0ae67fe2c0c45b68991f1bba0c62f4d00ad5 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 16:07:19 +0000 Message-Id: <6a15c537.31f79.2fbdade@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=895a0ae67fe2c0c45b68991f1bba0c62f4d00ad5 commit 895a0ae67fe2c0c45b68991f1bba0c62f4d00ad5 Author: Mark Johnston AuthorDate: 2026-05-26 12:43:51 +0000 Commit: Mark Johnston CommitDate: 2026-05-26 16:04:54 +0000 divert: Define semantics for SO_REUSEPORT_LB on divert sockets Allow SO_REUSEPORT_LB to be set on divert sockets. If set, then bind() will add the socket to a "load-balancing group". When a divert-to rule matches a port with an associated group, the corresponding state ID is used to select a specific socket from the group. Packets without an associated state are simply forwarded to the first socket in the group. For now I only pass a state ID from pf, as I couldn't see a useful identifier on the ipfw side. This implementation is simple but has a caveat, that being that if sockets are added to the group while flows are being processed, the size of the group will change and this changes the mapping of state IDs to sockets. So, to get a consistent mapping, the divert socket application must bind all of its sockets before any traffic is diverted by the firewall. Reviewed by: glebius MFC after: 1 month Sponsored by: OPNsense Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D56563 --- lib/libsys/getsockopt.2 | 6 +- share/man/man4/divert.4 | 24 ++++++- sys/netinet/ip_divert.c | 158 +++++++++++++++++++++++++++++++++++++----- sys/netinet/ip_var.h | 2 +- sys/netinet/raw_ip.c | 2 +- sys/netpfil/ipfw/ip_fw_pfil.c | 2 +- sys/netpfil/pf/pf.c | 2 +- 7 files changed, 172 insertions(+), 24 deletions(-) diff --git a/lib/libsys/getsockopt.2 b/lib/libsys/getsockopt.2 index 3867824681d7..85d94e014631 100644 --- a/lib/libsys/getsockopt.2 +++ b/lib/libsys/getsockopt.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd November 25, 2024 +.Dd April 21, 2026 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -220,6 +220,10 @@ Incoming TCP and UDP connections are distributed among the participating listening sockets based on a hash function of local port number, and foreign IP address and port number. A maximum of 256 sockets can be bound to the same load-balancing group. +.Dv PF_DIVERT +sockets may also be bound to a group, see the +.Xr divert 4 +manual page for details. .Pp .Dv SO_KEEPALIVE enables the diff --git a/share/man/man4/divert.4 b/share/man/man4/divert.4 index 647bb72ab49b..6292df190eb1 100644 --- a/share/man/man4/divert.4 +++ b/share/man/man4/divert.4 @@ -1,5 +1,4 @@ -.\" -.Dd January 23, 2026 +.Dd April 21, 2026 .Dt DIVERT 4 .Os .Sh NAME @@ -57,7 +56,26 @@ firewall processing at the next rule. .Pp By reading from and writing to a divert socket, matching packets can be passed through an arbitrary ``filter'' as they travel through -the host machine, special routing tricks can be done, etc. +the host machine, special routing tricks can be done, etc.. +.Pp +Multiple divert sockets may be bound to the same port if the +.Dv SO_REUSEPORT_LB +socket option is set on all of them. +In this case, the kernel will attempt to load-balance packets among +the sockets. +The implementation ensures that packets from the same flow are delivered +to the same socket. +To this end it relies on the firewall to provide a flow identifier with +each diverted packet. +When using the +.Xr pf 4 +firewall, this is the associated state ID, if one exists, otherwise all +packets are diverted to the first socket in the group. +Currently the +.Xr ipfw 4 +firewall does not provide a flow identifier, so all packets are diverted +to the first socket in the group. +At most 32 sockets can be bound to the same port. .Sh READING PACKETS Packets are diverted either as they are ``incoming'' or ``outgoing.'' Incoming packets are diverted after reception on an IP interface, diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 39bc9de6ec9f..839048908f9f 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -88,7 +89,7 @@ */ #define DIVHASHSIZE (1 << 3) /* 8 entries, one cache line. */ #define DIVHASH(port) (port % DIVHASHSIZE) -#define DCBHASH(dcb) ((dcb)->dcb_port % DIVHASHSIZE) +#define DCBHASH(dcb) (DIVHASH((dcb)->dcb_port)) /* * Divert sockets work in conjunction with ipfw or other packet filters, @@ -147,10 +148,22 @@ struct divcb { struct epoch_context dcb_epochctx; }; +struct divcblbgroup { + CK_SLIST_ENTRY(divcblbgroup) dl_next; + struct epoch_context dl_epochctx; + uint16_t dl_port; + uint16_t dl_count; +#define DIVCBLBGROUP_SIZE 32 + struct divcb *dl_dcb[DIVCBLBGROUP_SIZE]; +}; + CK_SLIST_HEAD(divhashhead, divcb); +CK_SLIST_HEAD(divlbgrouphashhead, divcblbgroup); -VNET_DEFINE_STATIC(struct divhashhead, divhash[DIVHASHSIZE]) = {}; +VNET_DEFINE_STATIC(struct divhashhead, divhash[DIVHASHSIZE]); #define V_divhash VNET(divhash) +VNET_DEFINE_STATIC(struct divlbgrouphashhead, divlbhash[DIVHASHSIZE]); +#define V_divlbhash VNET(divlbhash) VNET_DEFINE_STATIC(uint64_t, dcb_count) = 0; #define V_dcb_count VNET(dcb_count) VNET_DEFINE_STATIC(uint64_t, dcb_gencnt) = 0; @@ -163,10 +176,15 @@ MTX_SYSINIT(divert, &divert_mtx, "divert(4) socket pcb lists", MTX_DEF); /* * Divert a packet by passing it up to the divert socket at port 'port'. + * + * 'id' is an opaque identifier for the flow and is used to load-balance packets + * across multiple divert sockets bound to the same port. Packets with the same + * identifier will be delivered to the same socket. */ static void -divert_packet(struct mbuf *m, bool incoming) +divert_packet(struct mbuf *m, uint64_t id, bool incoming) { + struct divcblbgroup *dlb; struct divcb *dcb; u_int16_t nport; struct sockaddr_in divsrc; @@ -272,10 +290,27 @@ divert_packet(struct mbuf *m, bool incoming) sizeof(divsrc.sin_zero)); } - /* Put packet on socket queue, if any */ - CK_SLIST_FOREACH(dcb, &V_divhash[DIVHASH(nport)], dcb_next) - if (dcb->dcb_port == nport) + /* + * Look for a matching divert socket or socket group, and enqueue the + * packet. + */ + CK_SLIST_FOREACH(dlb, &V_divlbhash[DIVHASH(nport)], dl_next) { + uint16_t count; + + count = atomic_load_acq_16(&dlb->dl_count); + if (dlb->dl_port == nport && count > 0) { + uint32_t hash; + + hash = jenkins_hash(&id, sizeof(uint64_t), 0); + dcb = dlb->dl_dcb[hash % count]; break; + } + } + if (dlb == NULL) { + CK_SLIST_FOREACH(dcb, &V_divhash[DIVHASH(nport)], dcb_next) + if (dcb->dcb_port == nport) + break; + } if (dcb != NULL) { struct socket *sa = dcb->dcb_socket; @@ -596,6 +631,53 @@ div_free(epoch_context_t ctx) free(dcb, M_PCB); } +static void +divlbgroup_free(epoch_context_t ctx) +{ + struct divcblbgroup *dlb = __containerof(ctx, struct divcblbgroup, + dl_epochctx); + + free(dlb, M_PCB); +} + +static void +div_lbgroup_detach(struct divcb *dcb) +{ + struct divcblbgroup *dlb; + + CK_SLIST_FOREACH(dlb, &V_divlbhash[DCBHASH(dcb)], dl_next) { + if (dlb->dl_port != dcb->dcb_port) + continue; + + /* + * Delicately remove the socket from its group, taking + * care to synchronize with lookups, which do not handle + * NULL slots in the group table. + * + * Note that the hash is not stable across different + * group sizes. + */ + for (int i = 0; i < dlb->dl_count; i++) { + unsigned int count; + + if (dlb->dl_dcb[i] != dcb) + continue; + + count = dlb->dl_count; + if (i != count - 1) + dlb->dl_dcb[i] = dlb->dl_dcb[count - 1]; + atomic_store_rel_16(&dlb->dl_count, count - 1); + if (count == 1) { + CK_SLIST_REMOVE(&V_divlbhash[DCBHASH(dcb)], dlb, + divcblbgroup, dl_next); + NET_EPOCH_CALL(divlbgroup_free, + &dlb->dl_epochctx); + } + return; + } + } +} + static void div_detach(struct socket *so) { @@ -603,8 +685,10 @@ div_detach(struct socket *so) so->so_pcb = NULL; DIVERT_LOCK(); - if (dcb->dcb_bound != DCB_UNBOUND) + if (dcb->dcb_bound != DCB_UNBOUND) { CK_SLIST_REMOVE(&V_divhash[DCBHASH(dcb)], dcb, divcb, dcb_next); + div_lbgroup_detach(dcb); + } V_dcb_count--; V_dcb_gencnt++; DIVERT_UNLOCK(); @@ -614,28 +698,70 @@ div_detach(struct socket *so) static int div_bind(struct socket *so, struct sockaddr *nam, struct thread *td) { + struct divcblbgroup *dlb; struct divcb *dcb; + int error; uint16_t port; if (nam->sa_family != AF_INET) return EAFNOSUPPORT; if (nam->sa_len != sizeof(struct sockaddr_in)) return EINVAL; + + error = 0; + if ((so->so_options & SO_REUSEPORT_LB) != 0) + dlb = malloc(sizeof(*dlb), M_PCB, M_WAITOK | M_ZERO); + else + dlb = NULL; + port = ((struct sockaddr_in *)nam)->sin_port; DIVERT_LOCK(); - CK_SLIST_FOREACH(dcb, &V_divhash[DIVHASH(port)], dcb_next) - if (dcb->dcb_port == port) { - DIVERT_UNLOCK(); - return (EADDRINUSE); + if (dlb == NULL) { + CK_SLIST_FOREACH(dcb, &V_divhash[DIVHASH(port)], dcb_next) { + if (dcb->dcb_port == port) { + DIVERT_UNLOCK(); + return (EADDRINUSE); + } } + } dcb = so->so_pcb; - if (dcb->dcb_bound != DCB_UNBOUND) - CK_SLIST_REMOVE(&V_divhash[DCBHASH(dcb)], dcb, divcb, dcb_next); - dcb->dcb_port = port; - CK_SLIST_INSERT_HEAD(&V_divhash[DIVHASH(port)], dcb, dcb_next); + if (dlb != NULL) { + struct divcblbgroup *tmp; + + CK_SLIST_FOREACH(tmp, &V_divlbhash[DIVHASH(port)], dl_next) { + if (tmp->dl_port == port) + break; + } + if (tmp == NULL) { + dlb->dl_port = port; + dlb->dl_count = 1; + dlb->dl_dcb[0] = dcb; + CK_SLIST_INSERT_HEAD(&V_divlbhash[DIVHASH(port)], dlb, + dl_next); + } else if (tmp->dl_count < DIVCBLBGROUP_SIZE) { + KASSERT(tmp->dl_count > 0, + ("div_bind: lbgroup %p has count 0", tmp)); + + tmp->dl_dcb[tmp->dl_count] = dcb; + atomic_store_rel_16(&tmp->dl_count, tmp->dl_count + 1); + free(dlb, M_PCB); + } else { + error = ENOSPC; + free(dlb, M_PCB); + } + } + if (error == 0) { + if (dcb->dcb_bound != DCB_UNBOUND) { + CK_SLIST_REMOVE(&V_divhash[DCBHASH(dcb)], dcb, divcb, + dcb_next); + div_lbgroup_detach(dcb); + } + dcb->dcb_port = port; + CK_SLIST_INSERT_HEAD(&V_divhash[DIVHASH(port)], dcb, dcb_next); + } DIVERT_UNLOCK(); - return (0); + return (error); } static int diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index 934ca80a083d..081938ec7ae4 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -324,7 +324,7 @@ VNET_DECLARE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr); #define V_ip_fw_ctl_ptr VNET(ip_fw_ctl_ptr) /* Divert hooks. */ -extern void (*ip_divert_ptr)(struct mbuf *m, bool incoming); +extern void (*ip_divert_ptr)(struct mbuf *m, uint64_t id, bool incoming); /* ng_ipfw hooks -- XXX make it the same as divert and dummynet */ extern int (*ng_ipfw_input_p)(struct mbuf **, struct ip_fw_args *, bool); extern int (*ip_dn_ctl_ptr)(struct sockopt *); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 48e20df3ef9a..851f70cbb0ad 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -96,7 +96,7 @@ VNET_DEFINE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr) = NULL; int (*ip_dn_ctl_ptr)(struct sockopt *); int (*ip_dn_io_ptr)(struct mbuf **, struct ip_fw_args *); -void (*ip_divert_ptr)(struct mbuf *, bool); +void (*ip_divert_ptr)(struct mbuf *, uint64_t, bool); int (*ng_ipfw_input_p)(struct mbuf **, struct ip_fw_args *, bool); #ifdef INET diff --git a/sys/netpfil/ipfw/ip_fw_pfil.c b/sys/netpfil/ipfw/ip_fw_pfil.c index ddd8e00316b8..7e1c24a89edd 100644 --- a/sys/netpfil/ipfw/ip_fw_pfil.c +++ b/sys/netpfil/ipfw/ip_fw_pfil.c @@ -563,7 +563,7 @@ ipfw_divert(struct mbuf **m0, struct ip_fw_args *args, bool tee) m_tag_prepend(clone, tag); /* Do the dirty job... */ - ip_divert_ptr(clone, args->flags & IPFW_ARGS_IN); + ip_divert_ptr(clone, 0, args->flags & IPFW_ARGS_IN); return 0; } diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 27d03b688937..98b5657f7285 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -11966,7 +11966,7 @@ done: pd.m->m_flags &= ~M_FASTFWD_OURS; } } - ip_divert_ptr(*m0, dir == PF_IN); + ip_divert_ptr(*m0, s != NULL ? s->id : 0, dir == PF_IN); *m0 = NULL; return (action); } else if (mtag == NULL) { From nobody Tue May 26 16:07:14 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 4gPyLw2yGhz6g23f for ; Tue, 26 May 2026 16:07:20 +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 4gPyLw0g54z44wD for ; Tue, 26 May 2026 16:07:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779811640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xxYTqboDFQXj1Ak2gtJQdoUnZREky0UO3BlNBNNQ6ro=; b=Evnxmph5iuY0Ics8MFLj0rIA6/6OqtkKSlj9ZDZM6RFid8w5grXL++oku2MkS2Fu0xLGkt odZM4tC1twaMJzC2okXQglTtP04/gQXrvHWbeUHpIxLgLc6+2/fH8yHPUnP4frumtX9DTx X9aqryYgAMrfkcU+b8bUzMovtj1cCqT+xawRg4Eq7LpG/ldQ8pViw6UwVcJbAkVSw5bQmR BNrk+CU+fphMLrzogD5lZ7D8zriNvkFN+Lukrv2OffBBu8yknk9fiAWTKBosOQ0VxbRoJ1 tc8WmfB7t1jp0ewrXUAouSwXund24IuXqyXZqNZTaRB2rjU+01PGxIf/Sz6hqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779811640; a=rsa-sha256; cv=none; b=Jsb8IVqGFnZsl1ywyzkbRtYiGB4pEaggY/DA8TjQ/4iPCiYfKlTdjXDM/d2QkKnUtsZWjU RC4h6h23IgXxHVKotHGNIIHmH9FoYnW/JrYvNap/g88O1DxIPPAwhDMHJ/JO8pgRDcWSiV MHaYIqDA9seFpuXXkudXdQxyyKm5s9i4gJl0GJEPDhu9bwgTn2bKNiHy4WMAbI41T0fkWo WGs7NoW5vnIh2ECTxaVsrzelE1ezvxjLCsZ7vBlIdkqLv0WGjus7jHJecd63veqs56qqHl zHW8lMKu2OmRNWmbbflzQ8DtCxtVASXyM79TJOopvssOdIGnEcSB11YsxoVv9A== 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=1779811640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xxYTqboDFQXj1Ak2gtJQdoUnZREky0UO3BlNBNNQ6ro=; b=cTndyjMygBrmBWVaE0lU4Ws15Hq7LqSxJgOresYM34vmvw7mX294xd8C+ezdaihji8L7HF U8GBoZ5/u+W/UmwinHjoQrJXQHvfOpxLJvVKkeWzYAvjHT9zQvPwjbue2Yy794DMTEyBAz 6aylVf6+w5dMUKxVlLAUkZcd94nVWR76rLyzC2R1T1lfrbVrxikS6GfQdXLo8d2gD7wYZm AEorxD0pGH5zJIVpnNlMBwldhTzMyy4XI5O8xywo7UeDQJjPv+32jwuOnVjf/AXUG0SpAF PRMs0WVedWOwMfHJs09awILXisOzT6ErrCfYrLxnCXIwnhtklqp2rgCEmugZIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gPyLw04cpz41M for ; Tue, 26 May 2026 16:07:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 320fa by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 16:07:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Hans Rosenfeld From: Mark Johnston Subject: git: 4151296fdcba - main - bhyve/virtio-scsi: Support for multiple targets 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4151296fdcbad2706936ffa7d428d8621ad11823 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 16:07:14 +0000 Message-Id: <6a15c532.320fa.65b8671f@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4151296fdcbad2706936ffa7d428d8621ad11823 commit 4151296fdcbad2706936ffa7d428d8621ad11823 Author: Hans Rosenfeld AuthorDate: 2025-10-29 11:12:09 +0000 Commit: Mark Johnston CommitDate: 2026-05-26 16:03:12 +0000 bhyve/virtio-scsi: Support for multiple targets Currently, virtio-scsi supports only one target with 16383 LUNs, which fits nicely with what CTL provides. It would be useful to support more than that, multiple targets each with 16383 LUNs. While this can be useful with CTL by attaching each target to another CTL target port, this will be necessary to support SCSI passthrough. The new syntax for configuring targets will look like this: -s X,virtio-scsi,target=/dev/foo,target=/dev/bar,target=4:/dev/baz This will create the following configuration nodes: pci.0.X.0.device=virtio-scsi pci.0.X.0.target.0=/dev/foo pci.0.X.0.target.1=/dev/bar pci.0.X.0.target.4=/dev/baz The existing configuration syntax is still understood for compatibility: (1) -s X,virtio-scsi (2) -s X,virtio-scsi,/dev/foo (3) -s X,virtio-scsi,dev=/dev/foo This will create the following configuration nodes: pci.0.X.0.device=virtio-scsi (1, 2, 3) pci.0.X.0.target.0=/dev/cam/ctl (1) pci.0.X.0.target.0=/dev/foo (2, 3) Reviewed by: markj MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53221 --- usr.sbin/bhyve/bhyve.8 | 38 ++++- usr.sbin/bhyve/bhyve_config.5 | 28 ++- usr.sbin/bhyve/pci_virtio_scsi.c | 361 ++++++++++++++++++++++++++++++++++----- 3 files changed, 378 insertions(+), 49 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 5118974baace..b5b03dd9c211 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -2,6 +2,7 @@ .\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2013 Peter Grehan +.\" Copyright (c) 2026 Hans Rosenfeld .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -680,10 +681,45 @@ In that case, this feature doesn't work as expected. .Bl -bullet .Sm off .It -.Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc +.Oo Cm target Ns = Ns Oo ID : Oc Ar /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oc +.Oo Cm \&, Ar scsi-device-options Oc .Sm on .El .Pp +Multiple +.Pa target +parameters may be specified, each configuring a different +.Ar path +as a distinct SCSI target. +If the +.Pa target +.Ar ID +is not explicitly configured for a +.Pa target , +the +.Pa target +will be assigned the next sequential +.Ar ID +following the highest +.Pa target +.Ar ID +used at that point, or 0 if it is the first target configured. +All +.Pa target +.Ar ID Ns s +must be unique per instance. +The +.Ar path +must point to a valid CAM target layer +.Po CTL +.Pc +device node. +If no +.Pa target +is configured, a single default target backed by +.Sy /dev/cam/ctl +will be created. +.Pp The .Ar scsi-device-options are: diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index 429ce3e38138..ea3157cb54d6 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -1,6 +1,7 @@ .\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2021 John H. Baldwin +.\" Copyright 2025 Hans Rosenfeld .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -761,14 +762,33 @@ If specified, it must be a unicast MAC address. The largest supported MTU advertised to the guest. .El .Ss VirtIO SCSI Settings -.Bl -column "Name" "integer" "Default" +.Bl -column "target" "integer" "/dev/cam/ctl" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description -.It Va dev Ta path Ta Ta -The path of a CAM target layer (CTL) device to export: -.Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc . .It Va iid Ta integer Ta 0 Ta Initiator ID to use when sending requests to the CTL port. +.It Va target Ta Oo Va ID : Oc Ns path Ta Sy /dev/cam/ctl Ta +The path of a CAM target layer (CTL) device to use: +.Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc +Optionally, a numeric target +.Ar ID +in the range from 0 to 255 may be specified before the +.Ar path , +separated by a colon. .El +.Pp +The +.Va target +variable may be specified multiple times with different +.Ar path +arguments to configure multiple distinct SCSI targets. +If not explicitly configured, the target +.Ar ID Ns s +will be assigned sequentially beginning with the highest target +.Ar ID +configured so far, or 0 for the first target configured. +The target +.Ar ID Ns s +must be unique within each virtio-scsi instance. .Sh SEE ALSO .Xr expand_number 3 , .Xr getaddrinfo 3 , diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index 5fb867e5eae7..d7fd30f55209 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -78,7 +78,7 @@ (sizeof(struct pci_vtscsi_req_cmd_wr) + _sc->vss_config.sense_size) #define VIRTIO_SCSI_MAX_CHANNEL 0 -#define VIRTIO_SCSI_MAX_TARGET 0 +#define VIRTIO_SCSI_MAX_TARGET 255 #define VIRTIO_SCSI_MAX_LUN 16383 #define VIRTIO_SCSI_F_INOUT (1 << 0) @@ -170,6 +170,12 @@ struct pci_vtscsi_request { STAILQ_ENTRY(pci_vtscsi_request) vsr_link; }; +struct pci_vtscsi_target { + uint8_t vst_target; + int vst_fd; + int vst_max_sectors; +}; + /* * Per-device softc */ @@ -181,7 +187,9 @@ struct pci_vtscsi_softc { int vss_iid; int vss_ctl_fd; uint32_t vss_features; + size_t vss_num_target; struct pci_vtscsi_config vss_config; + struct pci_vtscsi_target *vss_targets; }; #define VIRTIO_SCSI_T_TMF 0 @@ -272,8 +280,12 @@ static void pci_vtscsi_neg_features(void *, uint64_t); static int pci_vtscsi_cfgread(void *, int, int, uint32_t *); static int pci_vtscsi_cfgwrite(void *, int, int, uint32_t); -static inline bool pci_vtscsi_check_lun(const uint8_t *); -static inline int pci_vtscsi_get_lun(const uint8_t *); +static inline bool pci_vtscsi_check_lun(struct pci_vtscsi_softc *, + const uint8_t *); +static inline uint8_t pci_vtscsi_get_target(struct pci_vtscsi_softc *, + const uint8_t *); +static inline uint16_t pci_vtscsi_get_lun(struct pci_vtscsi_softc *, + const uint8_t *); static void pci_vtscsi_control_handle(struct pci_vtscsi_softc *, void *, size_t); static void pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *, @@ -292,13 +304,15 @@ static void pci_vtscsi_queue_request(struct pci_vtscsi_softc *, struct vqueue_info *); static void pci_vtscsi_return_request(struct pci_vtscsi_queue *, struct pci_vtscsi_request *, int); -static int pci_vtscsi_request_handle(struct pci_vtscsi_softc *, +static int pci_vtscsi_request_handle(struct pci_vtscsi_softc *, int, struct pci_vtscsi_request *); static void pci_vtscsi_controlq_notify(void *, struct vqueue_info *); static void pci_vtscsi_eventq_notify(void *, struct vqueue_info *); static void pci_vtscsi_requestq_notify(void *, struct vqueue_info *); -static int pci_vtscsi_init_queue(struct pci_vtscsi_softc *, + +static int pci_vtscsi_add_target_config(nvlist_t *, const char *, int); +static int pci_vtscsi_init_queue(struct pci_vtscsi_softc *, struct pci_vtscsi_queue *, int); static void pci_vtscsi_destroy_queue(struct pci_vtscsi_queue *); static int pci_vtscsi_init(struct pci_devinst *, nvlist_t *); @@ -320,10 +334,12 @@ pci_vtscsi_proc(void *arg) struct pci_vtscsi_worker *worker = (struct pci_vtscsi_worker *)arg; struct pci_vtscsi_queue *q = worker->vsw_queue; struct pci_vtscsi_softc *sc = q->vsq_sc; - int iolen; for (;;) { struct pci_vtscsi_request *req; + uint8_t target; + int iolen; + int fd; pthread_mutex_lock(&q->vsq_rmtx); @@ -338,11 +354,15 @@ pci_vtscsi_proc(void *arg) req = pci_vtscsi_get_request(&q->vsq_requests); pthread_mutex_unlock(&q->vsq_rmtx); - DPRINTF("I/O request lun %d, data_niov_in %zu, data_niov_out " - "%zu", pci_vtscsi_get_lun(req->vsr_cmd_rd->lun), + target = pci_vtscsi_get_target(sc, req->vsr_cmd_rd->lun); + fd = sc->vss_targets[target].vst_fd; + + DPRINTF("I/O request tgt %u, lun %d, data_niov_in %zu, " + "data_niov_out %zu", target, + pci_vtscsi_get_lun(sc, req->vsr_cmd_rd->lun), req->vsr_data_niov_in, req->vsr_data_niov_out); - iolen = pci_vtscsi_request_handle(sc, req); + iolen = pci_vtscsi_request_handle(sc, fd, req); pci_vtscsi_return_request(q, req, iolen); } @@ -370,7 +390,7 @@ pci_vtscsi_reset(void *vsc) .sense_size = 96, .cdb_size = 32, .max_channel = VIRTIO_SCSI_MAX_CHANNEL, - .max_target = VIRTIO_SCSI_MAX_TARGET, + .max_target = MAX(1, sc->vss_num_target) - 1, .max_lun = VIRTIO_SCSI_MAX_LUN }; } @@ -418,7 +438,6 @@ pci_vtscsi_cfgwrite(void *vsc __unused, int offset __unused, int size __unused, * or: Flat Space Addressing: LUN (0-16383) * Level 3 and 4: not used, MBZ * - * Currently, we only support Target 0. * * Alternatively, the first level may contain an extended LUN address to select * the REPORT_LUNS well-known logical unit: @@ -439,7 +458,7 @@ pci_vtscsi_cfgwrite(void *vsc __unused, int offset __unused, int size __unused, * well-known logical unit. */ static inline bool -pci_vtscsi_check_lun(const uint8_t *lun) +pci_vtscsi_check_lun(struct pci_vtscsi_softc *sc, const uint8_t *lun) { if (lun[0] == 0xC1) return (false); @@ -447,7 +466,13 @@ pci_vtscsi_check_lun(const uint8_t *lun) if (lun[0] != 0x01) return (false); - if (lun[1] != 0x00) + if (lun[1] >= sc->vss_num_target) + return (false); + + if (lun[1] != sc->vss_targets[lun[1]].vst_target) + return (false); + + if (sc->vss_targets[lun[1]].vst_fd < 0) return (false); if (lun[2] != 0x00 && (lun[2] & 0xc0) != 0x40) @@ -459,17 +484,37 @@ pci_vtscsi_check_lun(const uint8_t *lun) return (true); } +/* + * Get the target id from a LUN address. + * + * Every code path using this function must have called pci_vtscsi_check_lun() + * before to make sure the LUN address is valid. + */ +static inline uint8_t +pci_vtscsi_get_target(struct pci_vtscsi_softc *sc, const uint8_t *lun) +{ + assert(lun[0] == 0x01); + assert(lun[1] < sc->vss_num_target); + assert(lun[1] == sc->vss_targets[lun[1]].vst_target); + assert(sc->vss_targets[lun[1]].vst_fd >= 0); + assert(lun[2] == 0x00 || (lun[2] & 0xc0) == 0x40); + + return (lun[1]); +} + /* * Get the LUN id from a LUN address. * * Every code path using this function must have called pci_vtscsi_check_lun() * before to make sure the LUN address is valid. */ -static inline int -pci_vtscsi_get_lun(const uint8_t *lun) +static inline uint16_t +pci_vtscsi_get_lun(struct pci_vtscsi_softc *sc, const uint8_t *lun) { assert(lun[0] == 0x01); - assert(lun[1] == 0x00); + assert(lun[1] < sc->vss_num_target); + assert(lun[1] == sc->vss_targets[lun[1]].vst_target); + assert(sc->vss_targets[lun[1]].vst_fd >= 0); assert(lun[2] == 0x00 || (lun[2] & 0xc0) == 0x40); return (((lun[2] << 8) | lun[3]) & 0x3fff); @@ -512,9 +557,11 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, struct pci_vtscsi_ctrl_tmf *tmf) { union ctl_io *io; + uint8_t target; int err; + int fd; - if (pci_vtscsi_check_lun(tmf->lun) == false) { + if (pci_vtscsi_check_lun(sc, tmf->lun) == false) { DPRINTF("TMF request to invalid LUN %.2hhx%.2hhx-%.2hhx%.2hhx-" "%.2hhx%.2hhx-%.2hhx%.2hhx", tmf->lun[0], tmf->lun[1], tmf->lun[2], tmf->lun[3], tmf->lun[4], tmf->lun[5], @@ -524,6 +571,10 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, return; } + target = pci_vtscsi_get_target(sc, tmf->lun); + + fd = sc->vss_targets[target].vst_fd; + io = ctl_scsi_alloc_io(sc->vss_iid); if (io == NULL) { WPRINTF("failed to allocate ctl_io: err=%d (%s)", @@ -537,7 +588,7 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, io->io_hdr.io_type = CTL_IO_TASK; io->io_hdr.nexus.initid = sc->vss_iid; - io->io_hdr.nexus.targ_lun = pci_vtscsi_get_lun(tmf->lun); + io->io_hdr.nexus.targ_lun = pci_vtscsi_get_lun(sc, tmf->lun); io->taskio.tag_type = CTL_TAG_SIMPLE; io->taskio.tag_num = tmf->id; io->io_hdr.flags |= CTL_FLAG_USER_TAG; @@ -584,7 +635,7 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc, sbuf_delete(sb); } - err = ioctl(sc->vss_ctl_fd, CTL_IO, io); + err = ioctl(fd, CTL_IO, io); if (err != 0) WPRINTF("CTL_IO: err=%d (%s)", errno, strerror(errno)); @@ -753,7 +804,7 @@ pci_vtscsi_queue_request(struct pci_vtscsi_softc *sc, struct vqueue_info *vq) assert(res == VTSCSI_IN_HEADER_LEN(q->vsq_sc)); /* Make sure this request addresses a valid LUN. */ - if (pci_vtscsi_check_lun(req->vsr_cmd_rd->lun) == false) { + if (pci_vtscsi_check_lun(sc, req->vsr_cmd_rd->lun) == false) { DPRINTF("I/O request to invalid LUN " "%.2hhx%.2hhx-%.2hhx%.2hhx-%.2hhx%.2hhx-%.2hhx%.2hhx", req->vsr_cmd_rd->lun[0], req->vsr_cmd_rd->lun[1], @@ -809,7 +860,7 @@ pci_vtscsi_return_request(struct pci_vtscsi_queue *q, } static int -pci_vtscsi_request_handle(struct pci_vtscsi_softc *sc, +pci_vtscsi_request_handle(struct pci_vtscsi_softc *sc, int fd, struct pci_vtscsi_request *req) { union ctl_io *io = req->vsr_ctl_io; @@ -818,7 +869,8 @@ pci_vtscsi_request_handle(struct pci_vtscsi_softc *sc, int err, nxferred; io->io_hdr.nexus.initid = sc->vss_iid; - io->io_hdr.nexus.targ_lun = pci_vtscsi_get_lun(req->vsr_cmd_rd->lun); + io->io_hdr.nexus.targ_lun = + pci_vtscsi_get_lun(sc, req->vsr_cmd_rd->lun); io->io_hdr.io_type = CTL_IO_SCSI; @@ -869,7 +921,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_softc *sc, sbuf_delete(sb); } - err = ioctl(sc->vss_ctl_fd, CTL_IO, io); + err = ioctl(fd, CTL_IO, io); if (err != 0) { WPRINTF("CTL_IO: err=%d (%s)", errno, strerror(errno)); req->vsr_cmd_wr->response = VIRTIO_SCSI_S_FAILURE; @@ -1006,32 +1058,222 @@ pci_vtscsi_destroy_queue(struct pci_vtscsi_queue *queue) pthread_mutex_destroy(&queue->vsq_rmtx); } +/* + * Create a target config node, return target id. If the target number isn't + * given as part of the path argument, use last_id + 1. + */ +static int +pci_vtscsi_add_target_config(nvlist_t *nvl, const char *path, int last_id) +{ + uint64_t target; + char *id; + char tmp[4]; + + if (path == NULL) { + EPRINTLN("target path must be specified"); + return (-1); + } + + if (path[0] != '/' && (id = strchr(path, ':')) != NULL) { + const char *errstr; + int len = id - path; + + id = strndup(path, len); + if (id == NULL) { + EPRINTLN("failed to get id string: %s", + strerror(errno)); + return (-1); + } + + target = strtonumx(id, 0, VIRTIO_SCSI_MAX_TARGET, &errstr, 0); + if (errstr != NULL) { + EPRINTLN("invalid target %s: target ID is %s", id, + errstr); + free(id); + return (-1); + } + + free(id); + path += len + 1; + } else { + target = last_id + 1; + + if (target > VIRTIO_SCSI_MAX_TARGET) { + EPRINTLN("max target (%d) reached, can't add another", + VIRTIO_SCSI_MAX_TARGET); + return (-1); + } + } + + snprintf(tmp, sizeof(tmp), "%lu", target); + + if (get_config_value_node(nvl, tmp) != NULL) { + EPRINTLN("cannot add '%s' as target %s: already exits as '%s'", + path, tmp, get_config_value_node(nvl, tmp)); + return (-1); + } + + set_config_value_node(nvl, tmp, path); + + return (target); +} + +/* + * The following forms are accepted for legacy config options to configure a + * single target: + * + * (0) -s B:D:F,virtio-scsi + * (1) -s B:D:F,virtio-scsi, + * (2) -s B:D:F,virtio-scsi,,,... + * (3) -s B:D:F,virtio-scsi,,... + * (4) -s B:D:F,virtio-scsi, + * + * To configure multiple targets, the following form is accepted: + * (5) -s B:D:F,virtio-scsi,[target=[id:],...] + */ static int pci_vtscsi_legacy_config(nvlist_t *nvl, const char *opts) { - char *cp, *devname; + int last_id = -1; + char *config, *tofree, *name, *value; + nvlist_t *targets; + size_t n; - if (opts == NULL) + /* Make sure no one accidentally sets "dev" anymore. */ + (void) create_relative_config_node(nvl, "dev"); + + targets = create_relative_config_node(nvl, "target"); + + /* Handle legacy form (0). */ + if (opts == NULL) { + pci_vtscsi_add_target_config(targets, "/dev/cam/ctl", 0); return (0); + } + + n = strcspn(opts, ",="); + + /* Handle legacy form (1) and (2). */ + if (opts[n] == ',' || opts[n] == '\0') { + char *tmp = strndup(opts, n); + + last_id = pci_vtscsi_add_target_config(targets, tmp, last_id); + free(tmp); + + if (last_id < 0) + return (-1); - cp = strchr(opts, ','); - if (cp == NULL) { - set_config_value_node(nvl, "dev", opts); + opts += n; + if (opts[0] == ',' && opts[1] != '\0') + opts++; + } + + /* If this was form (1), we're done. */ + if (opts[0] == '\0') return (0); + + /* + * For form (2), (3), (4), and (5), parse the remaining options. + * + * Contrary to other options, multiple target= options create a new + * target for each such option. + * + * For compatibility reasons we also accept dev= options for + * targets. + */ + config = tofree = strdup(opts); + while ((name = strsep(&config, ",")) != NULL) { + value = strchr(name, '='); + if (value != NULL) + *value++ = '\0'; + + if (strcmp(name, "dev") == 0 || strcmp(name, "target") == 0) { + int new_id = pci_vtscsi_add_target_config(targets, + value, last_id); + + if (new_id < 0) { + free(tofree); + return (-1); + } + + if (new_id > last_id) + last_id = new_id; + + } else if (value != NULL) { + set_config_value_node(nvl, name, value); + } else { + set_config_bool_node(nvl, name, true); + } } - devname = strndup(opts, cp - opts); - set_config_value_node(nvl, "dev", devname); - free(devname); - return (pci_parse_legacy_config(nvl, cp + 1)); + + free(tofree); + return (0); +} + +static int +pci_vtscsi_count_targets(const char *prefix __unused, + const nvlist_t *parent __unused, const char *name, int type, void *arg) +{ + struct pci_vtscsi_softc *sc = arg; + const char *errstr; + uint64_t target; + + if (type != NV_TYPE_STRING) { + EPRINTLN("invalid target \"%s\" type: not a string", name); + errno = EINVAL; + return (-1); + } + + target = strtonumx(name, 0, VIRTIO_SCSI_MAX_TARGET, &errstr, 0); + if (errstr != NULL) { + EPRINTLN("invalid target %s: target ID is %s", name, errstr); + return (-1); + } + + if (target >= sc->vss_num_target) + sc->vss_num_target = target + 1; + + return (0); +} + +static int +pci_vtscsi_init_target(const char *prefix __unused, const nvlist_t *parent, + const char *name, int type, void *arg) +{ + struct pci_vtscsi_softc *sc = arg; + const char *value; + const char *errstr; + uint64_t target; + + assert(type == NV_TYPE_STRING); + + /* + * Get the numeric value of the target id from 'name'. + */ + target = strtonumx(name, 0, sc->vss_num_target - 1, &errstr, 0); + assert(errstr == NULL); + sc->vss_targets[target].vst_target = target; + + /* + * 'value' contains the CTL device node path of this target. + */ + value = nvlist_get_string(parent, name); + sc->vss_targets[target].vst_fd = open(value, O_RDWR); + if (sc->vss_targets[target].vst_fd < 0) { + EPRINTLN("cannot open target %lu at %s: %s", target, value, + strerror(errno)); + return (-1); + } + + return (0); } static int pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) { struct pci_vtscsi_softc *sc; - const char *devname, *value; + const char *value; + size_t i; int err; - int i; sc = calloc(1, sizeof(struct pci_vtscsi_softc)); if (sc == NULL) @@ -1045,19 +1287,42 @@ pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) if (value != NULL) { if (pci_emul_add_boot_device(pi, atoi(value))) { EPRINTLN("Invalid bootindex %d", atoi(value)); + errno = EINVAL; goto fail; } } - devname = get_config_value_node(nvl, "dev"); - if (devname == NULL) - devname = "/dev/cam/ctl"; - sc->vss_ctl_fd = open(devname, O_RDWR); - if (sc->vss_ctl_fd < 0) { - WPRINTF("cannot open %s: %s", devname, strerror(errno)); - goto fail; + nvl = find_relative_config_node(nvl, "target"); + if (nvl != NULL) { + err = walk_config_nodes("", nvl, sc, pci_vtscsi_count_targets); + if (err != 0) + goto fail; + } + + if (sc->vss_num_target > 0) { + sc->vss_targets = malloc(sc->vss_num_target * + sizeof(struct pci_vtscsi_target)); + if (sc->vss_targets == NULL) { + EPRINTLN("can't allocate space for %lu targets", + sc->vss_num_target); + goto fail; + } + + memset(sc->vss_targets, -1, sc->vss_num_target * + sizeof(struct pci_vtscsi_target)); + + err = walk_config_nodes("", nvl, sc, pci_vtscsi_init_target); + if (err != 0) + goto fail; } + /* + * All targets should be open now and have a valid fd. + */ + for (i = 0; i < sc->vss_num_target; i++) + if (sc->vss_targets[i].vst_target == i) + assert(sc->vss_targets[i].vst_fd > 0); + pthread_mutex_init(&sc->vss_mtx, NULL); vi_softc_linkup(&sc->vss_vs, &vtscsi_vi_consts, sc, pi, sc->vss_vq); @@ -1101,7 +1366,8 @@ pci_vtscsi_init(struct pci_devinst *pi, nvlist_t *nvl) pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_SCSI); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); - if (vi_intr_init(&sc->vss_vs, 1, fbsdrun_virtio_msix())) + err = vi_intr_init(&sc->vss_vs, 1, fbsdrun_virtio_msix()); + if (err != 0) goto fail; vi_set_io_bar(&sc->vss_vs, 0); @@ -1112,9 +1378,16 @@ fail: for (i = 2; i < VTSCSI_MAXQ; i++) pci_vtscsi_destroy_queue(&sc->vss_queues[i - 2]); - if (sc->vss_ctl_fd > 0) - close(sc->vss_ctl_fd); + pthread_mutex_destroy(&sc->vss_mtx); + + for (i = 0; i < sc->vss_num_target; i++) { + if (sc->vss_targets[i].vst_target == i && + sc->vss_targets[i].vst_fd >= 0) { + close(sc->vss_targets[i].vst_fd); + } + } + free(sc->vss_targets); free(sc); return (-1); } From nobody Tue May 26 17:24:09 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 4gQ03Y2qqHz6gBFR for ; Tue, 26 May 2026 17:24:09 +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 4gQ03Y26fCz3FwL for ; Tue, 26 May 2026 17:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779816249; 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=CgWW2LRq8w1VX8ERyLktWr5pM0F9goX8TPhF9OYRPqQ=; b=OkG7bxgxItpsyVQ22FLny273EIMKsKJLTsehcQEBfNa0U20MTgMkMXN/ycTLbEZtoN9QRT oKdxWPqRiJNG8cvrVhU6Lk0FEhOS7HZE2RznnyDhMYYOdcIe0EXoZ7IZZX2EPaVx2/tbHD oMmIOa/3AbwXeacp6UDfgeVvxG3iEIbgM3iF4p0WLU2hDk5CzMevA7zxf9lB7//nRzw4yO kmk5vxvMMKr8D3+H51Mg7GhPnME0Kl5OJcdRocM8aP0xSNQgWTfOXnQdyfqdiWegXk6vR2 H+phFjAHfijwqz3PUQshYauxEDCnlrUPH0j84UfP4A7TFr3DGT8kPhiZC+sbPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779816249; a=rsa-sha256; cv=none; b=ikJIlo9dW2WpFIMOXN+tXz+V7wuNGGT/TOzJSjtT9UCNyO8jQKHLs7k1LWbz8yOd/najg3 MdJZ90/fJj4s4W8U7A2Q8qCOKPu9G/s+Z7MxaYmDMMewhS6B9ygdw9f0vmCjDH1IwTE9bg CUvaAt3RNKX0B0HmPs+YH5oOu9AYNaTmK0WSMA2/TAe4rTcBNw5pCsYThiCVPhOuIJSh3r zxQbN0A6LhrvN6ueEOlBdu6GOqMnnCUtfYvPtmNkaYzu5ShN9MQ1WOicRo1qCQMS7C/zhB wv32UeLHVxIonXEtIApXzOridGCCwnYPyzWagV3T0sZx1plZFjesxSlXyAbASQ== 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=1779816249; 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=CgWW2LRq8w1VX8ERyLktWr5pM0F9goX8TPhF9OYRPqQ=; b=Jds78IwUuFhOD1EEQ0PSx5ZTviSBMqOfeG+wdFuSuXvX9uJZ7y8Vxi3Etwl0YdLvxzduTF PXg/WEBiqz4JrDv1Vug8Sj8ZSL1eCnLseNrRdcntlxWWcmTePDkTIw+CkO+V12J9W53Kej j39k6DD5dwafVgqwLN2lrmyBjnlD+mE8PRttpjKwtmX3mNBDjQFpjHyFDbUtZBnyS7Qq+w a8ed5Cqx5obGLUzFKj+2E8L6NHV79qgc7azyrtQ77yAHN1mZqeVyZ7JteYOsmf6RZbRA2i iRCnhyEYnSkdpkqvSmb3Q/zXRj5b2eN1OONYIO1s/lh7mKYi8jIFgEvK+KUJKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ03Y1gbzz69P for ; Tue, 26 May 2026 17:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b1c9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 17:24:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 2750d957870a - main - tcp: fix TCP_ACCOUNTING build 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2750d957870aa45661e94cb6f7c5f1bfea52bf41 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 17:24:09 +0000 Message-Id: <6a15d739.3b1c9.7a9206d2@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=2750d957870aa45661e94cb6f7c5f1bfea52bf41 commit 2750d957870aa45661e94cb6f7c5f1bfea52bf41 Author: Gleb Smirnoff AuthorDate: 2026-05-26 17:23:32 +0000 Commit: Gleb Smirnoff CommitDate: 2026-05-26 17:23:32 +0000 tcp: fix TCP_ACCOUNTING build The uninitialized timeval was discovered by the new clang. --- sys/netinet/tcp_log_buf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netinet/tcp_log_buf.c b/sys/netinet/tcp_log_buf.c index 3e5955e5db4e..35fa0b56a9c7 100644 --- a/sys/netinet/tcp_log_buf.c +++ b/sys/netinet/tcp_log_buf.c @@ -1449,6 +1449,7 @@ tcp_log_tcpcbfini(struct tcpcb *tp) int i; memset(&log, 0, sizeof(log)); + microuptime(&tv); if (tp->t_flags2 & TF2_TCP_ACCOUNTING) { for (i = 0; i < TCP_NUM_CNT_COUNTERS; i++) { log.u_raw.u64_flex[i] = tp->tcp_cnt_counters[i]; From nobody Tue May 26 17:27:56 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 4gQ07x0pPvz6gBRT for ; Tue, 26 May 2026 17:27: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQ07w72wpz3GHc for ; Tue, 26 May 2026 17:27:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779816477; 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=vw/G58lCugXOBZkRoAJlPjswH+BWuYqRSf5yn3SipeE=; b=kWCiBkB7SzAWzr02uCK4b0cuECPHCS1VKVU94vyFkW5VLXpoCvOUbOy10AJSrWixRiCbGX a9jrMpq/7gZ726RKw+Co3LHmeezKofkl/5jC1FGTqTu/E4U2JCjur3FL4vbOsCJEB/Fx3I gypTZUpOTgu5Nnlh1qAFrSvzrG7Pr2wHn2vwqkpJ3AhByOSHfpt2WqmCpw6hRMvjMQMfXv WGm7YY5skYP3P97m2J/EDIC8XmVZ7wKsLeXA4Vj9+BsyQkV+axYWp9jgCiOmPUNEelVV4g D78nl49GX0gbsWOz4so/QMdLCTo4gXJ+9lY2QmCGJvVun7w8qYzYNt/DGSrVYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779816477; a=rsa-sha256; cv=none; b=jW6YCKZk2UBWNNCSdhzmptlzEQmfHPRqRV0LpBghlqoZqyGYRKtB26AdAe12Uybzl2jzhd mhOm2cMQhCslS0BSUzR7Q+0fdGvchG97q/RQ46Npt5DJHc7CACABGZxb7I+cgW092MsHfZ 7/4XORKOwJ6HGSMj8ewnLl1oVouPWN2Ty8CRqpCTmuVQ6kyPdIbgjbAIYXcdSOZbgLFQbr y+fb1XoKKzNxD7TK9cwdZZHPILv3hcyFUYTpfwV0O/J29unhHLHoIalahaRx8/cbpSigk/ 4XYvw9Gmjwk2pqtanDEa1RD27vIgp77UVkZupIwOwJl7l8AOKLiP2g+gj1XCLA== 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=1779816477; 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=vw/G58lCugXOBZkRoAJlPjswH+BWuYqRSf5yn3SipeE=; b=RF6XFA9nJWbf58J7elZv0MyYRO8AakD5NDDYSuAywIHoKaN3eVsoK+aIepUxfr+t5vYjoL 3mS7HdfEE8FPLYeXSoNhQfwRq2hDN1r6irQmkXiTiap95ynUUPEW1KEjMECMGvm77rx4M1 NF0KjWGjbXrmknoAQKqx/+4PC8L0Bm0hjrLmVTeoykI1Fbs/7n52YAOzM64SIc2xLqCB0M 5i8fPuGopK/R+i4wfW2YQj9suckrfIBcbY8vxW02SgQps+b/tsQpEmTjWY1fbhwi+rTi33 daFly9W5BTLkrFW3MsTJIypDjCTmACeGR0PBAgvv0aDu2HNqyssjLY8Tb/5zrw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ07w5xR2z6Np for ; Tue, 26 May 2026 17:27:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ba8b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 17:27:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 00b96a777845 - main - amd64: Drop segment descriptor details from trap messsages 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00b96a777845d9b558b2303cbef03ba5197b593a Auto-Submitted: auto-generated Date: Tue, 26 May 2026 17:27:56 +0000 Message-Id: <6a15d81c.3ba8b.19c785f8@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=00b96a777845d9b558b2303cbef03ba5197b593a commit 00b96a777845d9b558b2303cbef03ba5197b593a Author: John Baldwin AuthorDate: 2026-05-26 17:27:40 +0000 Commit: John Baldwin CommitDate: 2026-05-26 17:27:40 +0000 amd64: Drop segment descriptor details from trap messsages Segment descriptor contents are fixed on amd64 and not very interesting compared to the other values that are displayed. While here, include both the thread and process details of the current thread and drop redundant output of the trap number. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D56989 --- sys/amd64/amd64/trap.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index fb18b7d06f9e..df9cc44bcbb2 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -944,13 +944,9 @@ trap_diag(struct trapframe *frame, vm_offset_t eva, const char *type_str) { int code; u_int type; - struct soft_segment_descriptor softseg; - struct user_segment_descriptor *gdt; code = frame->tf_err; type = frame->tf_trapno; - gdt = *PCPU_PTR(gdt); - sdtossd(&gdt[IDXSEL(frame->tf_cs)], &softseg); printf("\n%s trap %d: %s while in %s mode\n", type_str, type, type < nitems(trap_msg) ? trap_msg[type] : UNKNOWN, @@ -975,11 +971,6 @@ trap_diag(struct trapframe *frame, vm_offset_t eva, const char *type_str) frame->tf_rsp); printf("frame pointer = %#hx:%#lx\n", frame->tf_ss, frame->tf_rbp); - printf("code segment = base 0x%lx, limit 0x%lx, type 0x%x\n", - softseg.ssd_base, softseg.ssd_limit, softseg.ssd_type); - printf(" = DPL %d, pres %d, long %d, def32 %d, gran %d\n", - softseg.ssd_dpl, softseg.ssd_p, softseg.ssd_long, softseg.ssd_def32, - softseg.ssd_gran); printf("processor eflags = "); if (frame->tf_rflags & PSL_T) printf("trace trap, "); @@ -990,8 +981,9 @@ trap_diag(struct trapframe *frame, vm_offset_t eva, const char *type_str) if (frame->tf_rflags & PSL_RF) printf("resume, "); printf("IOPL = %ld\n", (frame->tf_rflags & PSL_IOPL) >> 12); - printf("current process = %d (%s)\n", - curproc->p_pid, curthread->td_name); + printf("current thread = %d/%d (%s/%s)\n", + curproc->p_pid, curthread->td_tid, curproc->p_comm, + curthread->td_name); printf("rdi: %016lx rsi: %016lx rdx: %016lx\n", frame->tf_rdi, frame->tf_rsi, frame->tf_rdx); @@ -1003,8 +995,6 @@ trap_diag(struct trapframe *frame, vm_offset_t eva, const char *type_str) frame->tf_r11, frame->tf_r12); printf("r13: %016lx r14: %016lx r15: %016lx\n", frame->tf_r13, frame->tf_r14, frame->tf_r15); - - printf("trap number = %d\n", type); } static void From nobody Tue May 26 18:27:44 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 4gQ1Sw6PSsz6gGH2 for ; Tue, 26 May 2026 18:27:44 +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 4gQ1Sw4mqXz3R1k for ; Tue, 26 May 2026 18:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779820064; 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=gzjiswqOfTbDqSfVsC2yoEVOYBlxw0XKsBJrUfyBsn0=; b=olZVaGfhfkvVYoTgIwBWBQKIJw2dVtihSE3RPJoTwv6xcMSOVGGq5U0Y8KS+v2sC2Xc6DE BFsrSyfig6Bplg3G5sPnyo7e2ThhxYRLRwQDeCKyF/j4EBvIluIIA0OAbnzbo9Nim84nxg s0UWJ8/ofHxc36ggyYYodC15Hz5v/OrZ0Nz6/MihbNyl4HoCiMSikzi8CaMrdkStvuJ9uo ZJWNyRcwio3hWkEd52EYxNuZswbeKoQr1GiA7ULfraeTRTEn6pW7eGoULmY2QRmmNKnque jN2s+YdBToKTwD1nd97MRgRpwpPw/RlJChEPEkHwV/xwPTjCIr7jfMRj+12oyA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779820064; a=rsa-sha256; cv=none; b=VRlx7XdQXfiknwGc9LujUIcysSMzfNvh8RqcPcZiTVft5O8+aG9Uem46Uv2uqZOihJtRa3 t/UtIbIs5u3JKZpclIxhK95s9Xq7dGKFo8+Bw7yA9NKLbh2SQ/IW39LYTfNkCQstlmJe2O zHZEpQP3qqK7XIBmqsRKrdvZNFmVBcWRH0ri6KLkroL1NfHnnU0EDLmZcoT1SG3WqKtw3U eroCVhQ2Y7am3IsYTsoQvrRhivoybITSYKU5ZQkmVG/5+cR/Ys065PDSeVZJxqrFR0eRiX xuARsZ82cSfxuDQBW3KRAx5RFsPYINJ0R3lhVoztdGuF2ZxD4/I/RWB2hdFNJw== 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=1779820064; 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=gzjiswqOfTbDqSfVsC2yoEVOYBlxw0XKsBJrUfyBsn0=; b=M0BPJjm9nORYqkba2nI2OOdWr8wL/tWLyD82Bh4Exochm9uirxV7hEFglr8GY7174Vuyv+ o/tin6wHBInuiXla589fucmky5aMdzQTAhFBtaAu25UirWcOGvtILZLjEkg+e3F35lf7VN guDKlHQdtxG77tQmXQgnF9lj9X57Xjp1dsXc58MND/tf9jSjunMuUtfZNqXwM79lqW8JZX UfGqWVgxad6qlT60s0gMwMRKpfNVasz8qeVC8dO7SF+XsxJG17lFADGXHVcYD7XZyLzRRF yoLtJxhX0T7TWRROgbhVKcPUVRVEM4OT8y5xWOVhzNoBA5TVU7Y30x+07kC2cg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ1Sw4NXJz8GQ for ; Tue, 26 May 2026 18:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 41304 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 18:27:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c564074c9aaa - main - divert: Avoid using atomic_(load|store)_(acq|rel)_16 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c564074c9aaa8a3f9273de3cb802edcb3e2e2a40 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 18:27:44 +0000 Message-Id: <6a15e620.41304.be8363a@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c564074c9aaa8a3f9273de3cb802edcb3e2e2a40 commit c564074c9aaa8a3f9273de3cb802edcb3e2e2a40 Author: Mark Johnston AuthorDate: 2026-05-26 18:21:27 +0000 Commit: Mark Johnston CommitDate: 2026-05-26 18:26:43 +0000 divert: Avoid using atomic_(load|store)_(acq|rel)_16 It's not implemented on some arches. Use a plain int to count the number of sockets in a divert lbgroup. Reported by: Jenkins Fixes: 895a0ae67fe2 ("divert: Define semantics for SO_REUSEPORT_LB on divert sockets") --- sys/netinet/ip_divert.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 839048908f9f..390fdd9368b6 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -50,12 +50,14 @@ #include #include #include -#include + +#include #include #include #include #include +#include #include #include @@ -152,7 +154,7 @@ struct divcblbgroup { CK_SLIST_ENTRY(divcblbgroup) dl_next; struct epoch_context dl_epochctx; uint16_t dl_port; - uint16_t dl_count; + int dl_count; #define DIVCBLBGROUP_SIZE 32 struct divcb *dl_dcb[DIVCBLBGROUP_SIZE]; }; @@ -297,7 +299,7 @@ divert_packet(struct mbuf *m, uint64_t id, bool incoming) CK_SLIST_FOREACH(dlb, &V_divlbhash[DIVHASH(nport)], dl_next) { uint16_t count; - count = atomic_load_acq_16(&dlb->dl_count); + count = atomic_load_acq_int(&dlb->dl_count); if (dlb->dl_port == nport && count > 0) { uint32_t hash; @@ -666,7 +668,7 @@ div_lbgroup_detach(struct divcb *dcb) count = dlb->dl_count; if (i != count - 1) dlb->dl_dcb[i] = dlb->dl_dcb[count - 1]; - atomic_store_rel_16(&dlb->dl_count, count - 1); + atomic_store_rel_int(&dlb->dl_count, count - 1); if (count == 1) { CK_SLIST_REMOVE(&V_divlbhash[DCBHASH(dcb)], dlb, divcblbgroup, dl_next); @@ -743,7 +745,7 @@ div_bind(struct socket *so, struct sockaddr *nam, struct thread *td) ("div_bind: lbgroup %p has count 0", tmp)); tmp->dl_dcb[tmp->dl_count] = dcb; - atomic_store_rel_16(&tmp->dl_count, tmp->dl_count + 1); + atomic_store_rel_int(&tmp->dl_count, tmp->dl_count + 1); free(dlb, M_PCB); } else { error = ENOSPC; From nobody Tue May 26 19:19:06 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 4gQ2cB6vBCz6gKLV for ; Tue, 26 May 2026 19:19:06 +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 4gQ2cB40WGz3YlG for ; Tue, 26 May 2026 19:19:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779823146; 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=3I0oEor6UbiymaFBrvscJeACuyOex3PhUjKwmGqtxR8=; b=T6aVJKASwMjZcps1prgZcDjHJlDGFIK18kh2zqFjIKxU9Hl77vBSXZczk68EphG+9fyHTm wLW64LHc4eca2f80G5Tl06th4ZJCiJuBWGF0wHzTmdv8gafFukvd9izclyaZ2jxhnIFVQZ OxCZxRr2JP02CUFsHwpsoG6d8WGGaoIzocGUgVN5oINWqKqmWUkNFbVe7bDvMeO9EBRkM3 5fAtDEHoM+s1uhGozNZLAQ1hfP0WKVQH6Tk/ylgYMCikzTlHaGkOOOMKwtYMQqq5ZuOlkR v0yoCfLhjGmpxlAk/2QrVhSqc6LcfhKRcSE8w3z+u2XzCsiwzwLaRvoCHugNHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779823146; a=rsa-sha256; cv=none; b=FCkaSY5bylCt7XvknwtxrIIas8Zb4gQ9fISIgopX+tIYKwKQotHUQV0Z982VukZIzTfFpB TgE4+OR7gPnGFK5oRt4QPSMPlpAvrLpZtlZL3FFbc/E1NaLq4g7vSMbo65RZNDsjiepr0g JXAKHVNyJhubSuMr5ziNTRkoEVb5n6H/uCR3tePyxIiAuO4CJSrLmGF1sontZXVY6dU937 m2P4+/ixyxWRVz77TUBVakZyJVzlvnEKDo3z0pHGCfzYtw5BtIWL/8w8MZ3q+k7y2Lg8Em hBtUuRAHJxC1Dr/MRGg9tmy39D4VXqSHLUI6+blz7rnKhft8v8EAbXX2YtMAng== 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=1779823146; 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=3I0oEor6UbiymaFBrvscJeACuyOex3PhUjKwmGqtxR8=; b=Q5uF2FmylyqeUBqFt2YOGYRmir/rGXp2Kz2qRJeCewYLqLda98cH2lBhGvyQVhSd6nB3A0 Y3tkQgTqXnUvi+rxcgAyAH4NKvu8CWaeDwEz/koBjWFmYIxSku0m9qWd1Fj5E9hXPgYr8G /fIsEIRu4WsG2yg+bpo5BwJF7O2gkhcBQyMLGjB18EiDoCF0m/+hwLCMgJOkHDBy5wUu/I j/7aVkHTxwenCV6Oz7eKGtq2n6qhnDSUM1Xumy6LeEq+o9w/p5r2e8NdfSoeYhF7nmLtwq LLmipbfmnRNh7ZQONhzPdBrAd31AGNHsRvk9rPI9+VMpFvq4C5FWHCwZ+xWu9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ2cB3btNz8sM for ; Tue, 26 May 2026 19:19:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 45a03 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 19:19:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b9d16b7fd2fa - main - sigqueue: In capability mode, only allow signalling self 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9d16b7fd2fa6bc4b3e8364804cbdc1b76ebe8a5 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 19:19:06 +0000 Message-Id: <6a15f22a.45a03.9367978@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b9d16b7fd2fa6bc4b3e8364804cbdc1b76ebe8a5 commit b9d16b7fd2fa6bc4b3e8364804cbdc1b76ebe8a5 Author: Ed Maste AuthorDate: 2026-05-26 13:24:36 +0000 Commit: Ed Maste CommitDate: 2026-05-26 19:18:56 +0000 sigqueue: In capability mode, only allow signalling self This is copied from the check in kern_kill. Reviewed by: markj, oshogbo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57244 --- sys/kern/kern_sig.c | 10 ++++++++++ tests/sys/capsicum/capmode.cc | 12 +++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 9be7c82ee98b..e48997ed966a 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2038,6 +2038,16 @@ kern_sigqueue(struct thread *td, pid_t pid, int signumf, union sigval *value) if (pid <= 0) return (EINVAL); + /* + * A process in capability mode can send signals only to itself. + */ + if (pid != td->td_proc->p_pid) { + if (CAP_TRACING(td)) + ktrcapfail(CAPFAIL_SIGNAL, &signum); + if (IN_CAPABILITY_MODE(td)) + return (ECAPMODE); + } + if ((signumf & __SIGQUEUE_TID) == 0) { if ((p = pfind_any(pid)) == NULL) return (ESRCH); diff --git a/tests/sys/capsicum/capmode.cc b/tests/sys/capsicum/capmode.cc index c6eef19b350f..fdc572f11b5b 100644 --- a/tests/sys/capsicum/capmode.cc +++ b/tests/sys/capsicum/capmode.cc @@ -703,8 +703,8 @@ FORK_TEST(Capmode, NewThread) { close(thread_pipe[1]); } -static volatile sig_atomic_t had_signal = 0; -static void handle_signal(int) { had_signal = 1; } +static volatile sig_atomic_t signal_cnt = 0; +static void handle_signal(int) { signal_cnt++; } FORK_TEST(Capmode, SelfKill) { pid_t me = getpid(); @@ -722,7 +722,13 @@ FORK_TEST(Capmode, SelfKill) { // Can only kill(2) to own pid. EXPECT_CAPMODE(kill(child, SIGUSR1)); EXPECT_OK(kill(me, SIGUSR1)); - EXPECT_EQ(1, had_signal); + EXPECT_EQ(1, signal_cnt); + + union sigval sv; + sv.sival_int = 0x1234; + EXPECT_CAPMODE(sigqueue(child, SIGUSR1, sv)); + EXPECT_OK(sigqueue(me, SIGUSR1, sv)); + EXPECT_EQ(2, signal_cnt); signal(SIGUSR1, original); } From nobody Tue May 26 19:28:04 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 4gQ2pd5x53z6gKqm for ; Tue, 26 May 2026 19:28:09 +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 4gQ2pd482vz3bjp for ; Tue, 26 May 2026 19:28:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779823689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bFdeiqU9Tnt45F9jBtvjvmb28axYKHPqj5ZishGbHAA=; b=q7cBHyX/C0m5azMLZCdvRF/otoRXYgXZbIG9ZSVDc5FBLq3JIJ16w/jkSSpUreJwTIq583 i42O4YHgXpxHVHO7H57V5N68cJ+Hm2kl5JXbhWoJyii2PP/mQsDsm9E3ChmBNECHbx+U5+ 3U4B87B4F0lZiNqj1IJqadTO50ib3Lpjp9M8Gh4+gnLP+sxFZpquCqBxbuVxq50+P9BkAQ WFYYUgSUdWXAGAibEdCrxiMbgB2vKGoLqP03tTGwBmI/5y3k+vfCsdtDjFyl5T+vGemvsj 86VG23eMaZPNHnkEhiC3znXRPjsfZ240h0LggEq1Cddv3KFJJQHwwjQGjr062Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779823689; a=rsa-sha256; cv=none; b=r83YU2UkqBDm4hpHhn6AyU0ly4lxyoeAwzHLr6fgjEokY09y1DvA5BWGbm4GrXf9wY51ks FpEftBZQyGluwSsVNUltNdEgRtihohSs/iwCkvwUXLCo2xljymgIijFDcqo2mYIlDDRK0m SuYg7n8YcXCvEWuDNAwk3MgyifgJ40RmxOWCR4iblR2vgNeAgtDPXMquOdavibtCRzV6BP B5kB2LURN7V1k/FfnIt9Cj6k0V/jzy8VZ1jiQbblaL8jqR15K0Yn5fP0fP14of9h9KEMHi hCO9ipjRL/wpIMxUqlvADAsfyIEY0w6cOhTixs9o87Tas8YlbEfcZ1unS9pO3w== 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=1779823689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bFdeiqU9Tnt45F9jBtvjvmb28axYKHPqj5ZishGbHAA=; b=eI6u4D3niwz7ojtH0kvNhA1NubRZX2iw2FCY0L77Rs2BP1Z5ApFKkcpRuADUzffUlU67OQ jiI/AS2z9/tfUnhXqypMEzZ9PF17fZ+0U9jw8FPkNYlRQPqKaY+RurRepeFat9KqKjpb4M Gnr9jspWGm4Y4pQ08q+90QnX0Te3A5ulQQdgVnIaWZJG3Ba7YDZHG9rwXQP2+VOqOgJ1dl g+e2R0ddqwdyM0Cve4N0oPzCQr3mR3AGKP8X6PUEhUj8UYUeaW0h8NR7R1nzSMgBSLOde6 PhXDw/VrKIp+lvUVDOGujk/BIAuSXSSc0mx5f4IQs4rz5skYxnySnEFkreFxSg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ2pd3BVfz9br for ; Tue, 26 May 2026 19:28:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 46db1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 19:28:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: djm@openbsd.org From: Gleb Smirnoff Subject: git: 77fd9e0ceabc - main - upstream: fix hard-to-reach NULL deref during pubkey auth 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77fd9e0ceabcfa99894b3e70f60013c157115ca0 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 19:28:04 +0000 Message-Id: <6a15f444.46db1.3233e9a6@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=77fd9e0ceabcfa99894b3e70f60013c157115ca0 commit 77fd9e0ceabcfa99894b3e70f60013c157115ca0 Author: djm@openbsd.org AuthorDate: 2026-05-13 05:11:02 +0000 Commit: Gleb Smirnoff CommitDate: 2026-05-26 19:27:45 +0000 upstream: fix hard-to-reach NULL deref during pubkey auth To hit this, the user must be using a PEM style private key with no corresponding .pub key adjacent to it. OpenBSD-Commit-ID: b7150acc5322fa33f21491834d9471fbe3d30f20 (cherry picked from commit cf6c0b3b94cdc223f1b8be1ef2d93e993af5d976) Reviewed by: emaste --- crypto/openssh/sshconnect2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/openssh/sshconnect2.c b/crypto/openssh/sshconnect2.c index 478a9a52fd38..5a48c73edbef 100644 --- a/crypto/openssh/sshconnect2.c +++ b/crypto/openssh/sshconnect2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect2.c,v 1.385 2026/04/02 07:48:13 djm Exp $ */ +/* $OpenBSD: sshconnect2.c,v 1.386 2026/05/13 05:11:02 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2008 Damien Miller. All rights reserved. @@ -1277,7 +1277,7 @@ identity_sign(struct identity *id, u_char **sigp, size_t *lenp, * PKCS#11 tokens may not support all signature algorithms, * so check what we get back. */ - if ((id->key->flags & SSHKEY_FLAG_EXT) != 0 && + if (id->key != NULL && (id->key->flags & SSHKEY_FLAG_EXT) != 0 && (r = sshkey_check_sigtype(*sigp, *lenp, alg)) != 0) { debug_fr(r, "sshkey_check_sigtype"); goto out; From nobody Tue May 26 21:23:00 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 4gQ5M86V1dz6gT5y for ; Tue, 26 May 2026 21:23:00 +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 4gQ5M85r5tz3x3P for ; Tue, 26 May 2026 21:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779830580; 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=7l/aljITUvB3hT9rSc6/73G3Ac3NHm54c2rI6dsd5lE=; b=W+kT4MXhywY3J5gG6n8OMWEtjWpjXsAtlXgsrS4XAzNss98kZcZeeTG5lOMhKjjG0YFFBo SXDsTooChJjtPP/4A7I9nmd20GFvjyp0awDBqqydxO+x3wnKPXFlCGfmoxBi65raf6mwEA LQf/aqh5VSw9YAJ3WW36tfbnoiyi8wS2whwMXD6me/Ba4d+4/U8ndMkDOeUMAC7f30s88t v5QoXSf03uoYCxIZH721OAB75/io0kLwOJhcbutVr+rlqEqSM0coX7D2vLvy9Q+MOj7hbd /Z8GwI7vwy1F+Z5M/jE3oyIzaU9V9hNWC0oPBs/gqc1Z0vKrYvTHOtOp0evoWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779830580; a=rsa-sha256; cv=none; b=wqXbLvkg1DrpXJ/MedwbFvVP6jOd9F+tWVYukxbp/cArGNgSJN9uGgMULt4RLa/kfw/uOY QYpmp6C2WuisCvk+w9mUCla3G5cXXWL6ZIwYi3MLN1ibIczKugDI55vQbdWL79vrg25kMj x8xyXflYAkiNDO/tIgVmlkJm6843jHOQqxs0QOgyJffpInY8V0zsMGC+uk1oD0cvOWtnTI 05lEdryfYipk0mfSq/JyOUQ+lmtlR1luB0dKeMg8I8K1qqdR1WqqFmNnA3EXW0MgkzLAhS App96sMRjC93vxblOBj6n2vqSG28+cRCThoTsHdy+JNz5NuiPEYJ51CMvDD2lQ== 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=1779830580; 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=7l/aljITUvB3hT9rSc6/73G3Ac3NHm54c2rI6dsd5lE=; b=vlbAqn8u6yw9Hkp+zg4Oq4AOXELqAChJ848eICuQdJOlHA5UsmJbrwtM61VHhVyiZ+CdOg f9zMyTPgSSEmlu/rZMYOgK4E8wXrpGqBPqqFs/ougB3lKKiRHBfQVJzmDf0vdVsytBN7f2 huU99vfTXM7weA0BLtY+OV0bq+8p9AMWeTyc+qthDu7N4nwsQCLG8hxIEdKl0BS+IbeYos dBVvckK+1aks1N6vs+ptBhWfVS4ORaO5dR6Wi0taQ5WrEJfwR9M8FenkK66luHkop+Dbwn 1O/bFrCC42KN9gu32JEohHRiBj4pTAjsIYcYcbtubuTbAGUTOj4dXaWm1NV3hw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ5M85NgHzDSK for ; Tue, 26 May 2026 21:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 24112 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 21:23:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 004b5935a6e6 - main - bsd.sys.mk: suppress some clang warnings for C++ for >= 19 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: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 004b5935a6e643033526cab623c6005b69ab11aa Auto-Submitted: auto-generated Date: Tue, 26 May 2026 21:23:00 +0000 Message-Id: <6a160f34.24112.675a05e0@gitrepo.freebsd.org> The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=004b5935a6e643033526cab623c6005b69ab11aa commit 004b5935a6e643033526cab623c6005b69ab11aa Author: Alex Richardson AuthorDate: 2026-05-26 19:37:06 +0000 Commit: Alex Richardson CommitDate: 2026-05-26 19:37:06 +0000 bsd.sys.mk: suppress some clang warnings for C++ for >= 19 I just tried building with system clang on one of my Linux systems which happens to be version 19, and these warning suppressions are needed for that version too: same errors as in the original commit. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56874 --- share/mk/bsd.sys.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 93e7c8572310..4ffac401eb4c 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -92,8 +92,6 @@ CWARNFLAGS.clang+= -Wno-error=unused-but-set-parameter .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 190000 # Similar to gcc >= 8.1 -Wno-error=cast-function-type below CWARNFLAGS.clang+= -Wno-error=cast-function-type-mismatch -.endif -.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 210000 CXXWARNFLAGS.clang+= -Wno-c++20-extensions CXXWARNFLAGS.clang+= -Wno-c++23-lambda-attributes CXXWARNFLAGS.clang+= -Wno-nullability-completeness From nobody Tue May 26 21:23:01 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 4gQ5MB0PjNz6gSl2 for ; Tue, 26 May 2026 21:23:02 +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 4gQ5M96gcPz3wb6 for ; Tue, 26 May 2026 21:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779830582; 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=DHGU7LZBlbJyV8PKpB73vkdwvbs1P33ZasMBaNCZsDY=; b=KCf0TcjmtdZosT00w+97VSmbkVDP52EndUkykV1WnblvTLzWNueZLAmHjslUzWX2chB0mJ 5RxK1TtzGxiXLPzeQT3Ztrf1uWChDsFL9xJ+JfhpcGLAw/6MZeCAq+WvwX35ANbTwuRZ5I bk0aEWHv+oIKutbPyrwnB7AUFCKlPWrbZ+OzRaLylWCgbwfkN8dhQv/Ryad1+1igRfxbGr rofeezhB4vS+iy4pflA3z1GhYJMfrF4zrZrCrGiNVnywkr/MziSJerNZDVpQQ64fWjSj6N 5E4GMaL5ve/wvtsdI19qGuYpG60dSKlkGUiNYYau6A6tYk2nAv+OHHX0Rev0Vw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779830581; a=rsa-sha256; cv=none; b=nqAjiWXbNFoHqhJ7r1G5EpFS6k2gIen82tZ9s/6VuVABmeppm0CPTat8WNJFqd1mn1Kt4a g4+17G55Re9NN+OA2304B0jYDt6zeZ3jb0MCIaG+jin5ZtV4bIAegMEIDAsUdSmL03n2Zf K1aCkkpCYwSbfPSHuUd+AJZqPMjUd6f6+/jG5uterqc8vdc7Gr/OZcLhZeChio7SszJ7ur W+DJ5oatIiwxW69zMi2maO6mHd14cVl2PhHemKzzqDLvDGDBlvu/pmufPDy/HDcwYsPzuf 6zLMkXYaeh08Lr6APUWf//kJ0kcWuC84cFgzGnb6z3Ah1S4nnecxO5j5k74UCw== 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=1779830581; 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=DHGU7LZBlbJyV8PKpB73vkdwvbs1P33ZasMBaNCZsDY=; b=vYjDapP3DvqQGtMUym/o8SDITzz5QRr37+6BHtCZzYF48OrOZEA49eHdk0kNr/F0Jd6Of8 Wl06AW9Hsp7HS6EoUmxow8Mg4v3N1XVw00qT/X2r2VuXrQH4dBCG20YPdOUmhoIfn3B4sE 0zkWZVKlGUC9ze+AOPHlRm+rGwOMWoDROLFTFHQJXLSZt488pfnfAzV90l+t6FKfjRAvZ/ gy+jlnPn4cxMvWOl8VArARp0C1oJTL8a6WR/tLQspBqVvIkbyZ+2BUSQRIXnppaiKB5HIG R1jAGy1/EMMAmR03gpvIaC4s6lH/Yeq8hGDu7WypfYcjdMhyzF9HWgkF9zuSJg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ5M96GsdzTvy for ; Tue, 26 May 2026 21:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 227fd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 21:23:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 675382f12b67 - main - p9fs: Refactor buffer allocations to avoid zeroing large payloads 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: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 675382f12b67e8b7b2f35bd1f8dfd96b8d8e4aae Auto-Submitted: auto-generated Date: Tue, 26 May 2026 21:23:01 +0000 Message-Id: <6a160f35.227fd.152a77c4@gitrepo.freebsd.org> The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=675382f12b67e8b7b2f35bd1f8dfd96b8d8e4aae commit 675382f12b67e8b7b2f35bd1f8dfd96b8d8e4aae Author: Alex Richardson AuthorDate: 2026-05-26 19:37:39 +0000 Commit: Alex Richardson CommitDate: 2026-05-26 19:37:39 +0000 p9fs: Refactor buffer allocations to avoid zeroing large payloads Allocating large buffers with M_ZERO adds unnecessary overhead since the data is immediately overwritten. This change embeds the tc and rc p9_buffer structs directly into p9_req_t so we only zero the small metadata headers. The actual data payload is allocated with M_NOWAIT. Embedding the metadata headers by value also allows the p9fs_buf_zone UMA items to be sized exactly to P9FS_MTU, ensuring they are nicely aligned. This also adds proper error handling to p9_get_request() to handle UMA allocation failures. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56495 --- sys/dev/virtio/p9fs/virtio_p9fs.c | 10 ++--- sys/fs/p9fs/p9_client.c | 95 +++++++++++++++++---------------------- sys/fs/p9fs/p9_client.h | 4 +- 3 files changed, 49 insertions(+), 60 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 19a32fea458e..c347458b4f8e 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -112,7 +112,7 @@ SYSCTL_UINT(_vfs_9p, OID_AUTO, ackmaxidle, CTLFLAG_RW, &vt9p_ackmaxidle, 0, static int vt9p_req_wait(struct vt9p_softc *chan, struct p9_req_t *req) { - KASSERT(req->tc->tag != req->rc->tag, + KASSERT(req->tc.tag != req->rc.tag, ("%s: request %p already completed", __func__, req)); if (msleep(req, VT9P_MTX(chan), 0, "chan lock", vt9p_ackmaxidle * hz)) { @@ -124,7 +124,7 @@ vt9p_req_wait(struct vt9p_softc *chan, struct p9_req_t *req) "for an ack from host\n", vt9p_ackmaxidle); return (EIO); } - KASSERT(req->tc->tag == req->rc->tag, + KASSERT(req->tc.tag == req->rc.tag, ("%s spurious event on request %p", __func__, req)); return (0); } @@ -157,7 +157,7 @@ vt9p_request(void *handle, struct p9_req_t *req) req_retry: sglist_reset(sg); /* Handle out VirtIO ring buffers */ - error = sglist_append(sg, req->tc->sdata, req->tc->size); + error = sglist_append(sg, req->tc.sdata, req->tc.size); if (error != 0) { P9_DEBUG(ERROR, "%s: sglist append failed\n", __func__); VT9P_UNLOCK(chan); @@ -165,7 +165,7 @@ req_retry: } readable = sg->sg_nseg; - error = sglist_append(sg, req->rc->sdata, req->rc->capacity); + error = sglist_append(sg, req->rc.sdata, req->rc.capacity); if (error != 0) { P9_DEBUG(ERROR, "%s: sglist append failed\n", __func__); VT9P_UNLOCK(chan); @@ -226,7 +226,7 @@ vt9p_intr_complete(void *xsc) VT9P_LOCK(chan); again: while ((curreq = virtqueue_dequeue(vq, NULL)) != NULL) { - curreq->rc->tag = curreq->tc->tag; + curreq->rc.tag = curreq->tc.tag; wakeup_one(curreq); } if (virtqueue_enable_intr(vq) != 0) { diff --git a/sys/fs/p9fs/p9_client.c b/sys/fs/p9fs/p9_client.c index 547de98c4c03..27a6c1eb366d 100644 --- a/sys/fs/p9fs/p9_client.c +++ b/sys/fs/p9fs/p9_client.c @@ -104,43 +104,33 @@ p9_parse_opts(struct mount *mp, struct p9_client *clnt) } /* Allocate buffer for sending request and getting responses */ -static struct p9_buffer * -p9_buffer_alloc(int alloc_msize) +static void +p9_buffer_alloc(struct p9_buffer *fc, int alloc_msize) { - struct p9_buffer *fc; - - fc = uma_zalloc(p9fs_buf_zone, M_WAITOK | M_ZERO); + bzero(fc, sizeof(*fc)); fc->capacity = alloc_msize; - fc->offset = 0; - fc->size = 0; - fc->sdata = (char *)fc + sizeof(struct p9_buffer); - - return (fc); + fc->sdata = uma_zalloc(p9fs_buf_zone, M_WAITOK); } /* Free memory used by request and response buffers */ static void -p9_buffer_free(struct p9_buffer **buf) +p9_buffer_free(struct p9_buffer *buf) { - - /* Free the sdata buffers first, then the whole structure*/ - uma_zfree(p9fs_buf_zone, *buf); - *buf = NULL; + uma_zfree(p9fs_buf_zone, buf->sdata); + buf->sdata = NULL; } /* Free the request */ static void p9_free_req(struct p9_client *clnt, struct p9_req_t *req) { + if (req == NULL) + return; - if (req->tc != NULL) { - if (req->tc->tag != P9_NOTAG) - p9_tag_destroy(clnt, req->tc->tag); - p9_buffer_free(&req->tc); - } - - if (req->rc != NULL) - p9_buffer_free(&req->rc); + if (req->tc.tag != P9_NOTAG) + p9_tag_destroy(clnt, req->tc.tag); + p9_buffer_free(&req->tc); + p9_buffer_free(&req->rc); uma_zfree(p9fs_req_zone, req); } @@ -156,17 +146,17 @@ p9_get_request(struct p9_client *clnt, int *error) alloc_msize = P9FS_MTU; req = uma_zalloc(p9fs_req_zone, M_WAITOK | M_ZERO); - req->tc = p9_buffer_alloc(alloc_msize); - req->rc = p9_buffer_alloc(alloc_msize); + p9_buffer_alloc(&req->tc, alloc_msize); + p9_buffer_alloc(&req->rc, alloc_msize); tag = p9_tag_create(clnt); if (tag == P9_NOTAG) { *error = EAGAIN; - req->tc->tag = P9_NOTAG; + req->tc.tag = P9_NOTAG; p9_free_req(clnt, req); return (NULL); } - req->tc->tag = tag; + req->tc.tag = tag; return (req); } @@ -208,7 +198,7 @@ p9_client_check_return(struct p9_client *c, struct p9_req_t *req) char *ename; /* Check what we have in the receive bufer .*/ - error = p9_parse_receive(req->rc, c); + error = p9_parse_receive(&req->rc, c); if (error != 0) goto out; @@ -216,17 +206,17 @@ p9_client_check_return(struct p9_client *c, struct p9_req_t *req) * No error, We are done with the preprocessing. Return to the caller * and process the actual data. */ - if (req->rc->id != P9PROTO_RERROR && req->rc->id != P9PROTO_RLERROR) + if (req->rc.id != P9PROTO_RERROR && req->rc.id != P9PROTO_RLERROR) return (0); /* * Interpreting the error is done in different ways for Linux and * Unix version. Make sure you interpret it right. */ - if (req->rc->id == P9PROTO_RERROR) { - error = p9_buf_readf(req->rc, c->proto_version, "s?d", &ename, &ecode); - } else if (req->rc->id == P9PROTO_RLERROR) { - error = p9_buf_readf(req->rc, c->proto_version, "d", &ecode); + if (req->rc.id == P9PROTO_RERROR) { + error = p9_buf_readf(&req->rc, c->proto_version, "s?d", &ename, &ecode); + } else if (req->rc.id == P9PROTO_RLERROR) { + error = p9_buf_readf(&req->rc, c->proto_version, "d", &ecode); } else { goto out; } @@ -241,15 +231,15 @@ p9_client_check_return(struct p9_client *c, struct p9_req_t *req) * not present can hit this and return. Hence it is made a debug print. */ if (error != 0) { - if (req->rc->id == P9PROTO_RERROR) { + if (req->rc.id == P9PROTO_RERROR) { P9_DEBUG(PROTO, "RERROR error %d ename %s\n", error, ename); - } else if (req->rc->id == P9PROTO_RLERROR) { + } else if (req->rc.id == P9PROTO_RLERROR) { P9_DEBUG(PROTO, "RLERROR error %d\n", error); } } - if (req->rc->id == P9PROTO_RERROR) { + if (req->rc.id == P9PROTO_RERROR) { free(ename, M_TEMP); } return (error); @@ -308,21 +298,21 @@ p9_client_prepare_req(struct p9_client *c, int8_t type, } /* Marshall the data according to QEMU standards */ - *error = p9_buf_prepare(req->tc, type); + *error = p9_buf_prepare(&req->tc, type); if (*error != 0) { P9_DEBUG(ERROR, "%s: p9_buf_prepare failed: %d\n", __func__, *error); goto out; } - *error = p9_buf_vwritef(req->tc, c->proto_version, fmt, ap); + *error = p9_buf_vwritef(&req->tc, c->proto_version, fmt, ap); if (*error != 0) { P9_DEBUG(ERROR, "%s: p9_buf_vwrite failed: %d\n", __func__, *error); goto out; } - *error = p9_buf_finalize(c, req->tc); + *error = p9_buf_finalize(c, &req->tc); if (*error != 0) { P9_DEBUG(ERROR, "%s: p9_buf_finalize failed: %d \n", __func__, *error); @@ -474,7 +464,7 @@ p9_client_version(struct p9_client *c) if (error != 0) return (error); - error = p9_buf_readf(req->rc, c->proto_version, "ds", &msize, &version); + error = p9_buf_readf(&req->rc, c->proto_version, "ds", &msize, &version); if (error != 0) { P9_DEBUG(ERROR, "%s: version error: %d\n", __func__, error); goto out; @@ -519,8 +509,7 @@ p9_init_zones(void) /* Create the buffer zone */ p9fs_buf_zone = uma_zcreate("p9fs buf zone", - sizeof(struct p9_buffer) + P9FS_MTU, NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, 0); + P9FS_MTU, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); } void @@ -623,7 +612,7 @@ p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, if (*error != 0) goto out; - *error = p9_buf_readf(req->rc, clnt->proto_version, "Q", &qid); + *error = p9_buf_readf(&req->rc, clnt->proto_version, "Q", &qid); if (*error != 0) { P9_DEBUG(ERROR, "%s: p9_buf_readf failed: %d \n", __func__, *error); @@ -777,7 +766,7 @@ p9_client_walk(struct p9_fid *oldfid, uint16_t nwnames, char **wnames, return (NULL); } - *error = p9_buf_readf(req->rc, clnt->proto_version, "R", &nwqids, + *error = p9_buf_readf(&req->rc, clnt->proto_version, "R", &nwqids, &wqids); if (*error != 0) goto out; @@ -842,7 +831,7 @@ p9_client_open(struct p9_fid *fid, int mode) if (error != 0) return (error); - error = p9_buf_readf(req->rc, clnt->proto_version, "Qd", &fid->qid, + error = p9_buf_readf(&req->rc, clnt->proto_version, "Qd", &fid->qid, &mtu); if (error != 0) goto out; @@ -892,7 +881,7 @@ p9_client_readdir(struct p9_fid *fid, char *data, uint64_t offset, return (-error); } - error = p9_buf_readf(req->rc, clnt->proto_version, "D", &count, + error = p9_buf_readf(&req->rc, clnt->proto_version, "D", &count, &dataptr); if (error != 0) { P9_DEBUG(ERROR, "%s: p0_buf_readf failed: %d\n", @@ -945,7 +934,7 @@ p9_client_read(struct p9_fid *fid, uint64_t offset, uint32_t count, char *data) return (-error); } - error = p9_buf_readf(req->rc, clnt->proto_version, "D", &count, + error = p9_buf_readf(&req->rc, clnt->proto_version, "D", &count, &dataptr); if (error != 0) { P9_DEBUG(ERROR, "%s: p9_buf_readf failed: %d\n", @@ -1017,7 +1006,7 @@ p9_client_write(struct p9_fid *fid, uint64_t offset, uint32_t count, char *data) return (-error); } - error = p9_buf_readf(req->rc, clnt->proto_version, "d", &ret); + error = p9_buf_readf(&req->rc, clnt->proto_version, "d", &ret); if (error != 0) { P9_DEBUG(ERROR, "%s: p9_buf_readf error: %d\n", __func__, error); @@ -1069,7 +1058,7 @@ p9_client_file_create(struct p9_fid *fid, char *name, uint32_t perm, int mode, if (error != 0) return (error); - error = p9_buf_readf(req->rc, clnt->proto_version, "Qd", &qid, &mtu); + error = p9_buf_readf(&req->rc, clnt->proto_version, "Qd", &qid, &mtu); if (error != 0) goto out; @@ -1101,7 +1090,7 @@ p9_client_statfs(struct p9_fid *fid, struct p9_statfs *stat) return (error); } - error = p9_buf_readf(req->rc, clnt->proto_version, "ddqqqqqqd", + error = p9_buf_readf(&req->rc, clnt->proto_version, "ddqqqqqqd", &stat->type, &stat->bsize, &stat->blocks, &stat->bfree, &stat->bavail, &stat->files, &stat->ffree, &stat->fsid, &stat->namelen); @@ -1173,7 +1162,7 @@ p9_create_symlink(struct p9_fid *fid, char *name, char *symtgt, gid_t gid) if (error != 0) return (error); - error = p9_buf_readf(req->rc, clnt->proto_version, "Q", &qid); + error = p9_buf_readf(&req->rc, clnt->proto_version, "Q", &qid); if (error != 0) { P9_DEBUG(ERROR, "%s: buf_readf failed %d\n", __func__, error); return (error); @@ -1226,7 +1215,7 @@ p9_readlink(struct p9_fid *fid, char **target) if (error != 0) return (error); - error = p9_buf_readf(req->rc, clnt->proto_version, "s", target); + error = p9_buf_readf(&req->rc, clnt->proto_version, "s", target); if (error != 0) { P9_DEBUG(ERROR, "%s: buf_readf failed %d\n", __func__, error); return (error); @@ -1260,7 +1249,7 @@ p9_client_getattr(struct p9_fid *fid, struct p9_stat_dotl *stat_dotl, goto error; } - err = p9_buf_readf(req->rc, clnt->proto_version, "A", stat_dotl); + err = p9_buf_readf(&req->rc, clnt->proto_version, "A", stat_dotl); if (err != 0) { P9_DEBUG(ERROR, "%s: buf_readf failed %d\n", __func__, err); goto error; diff --git a/sys/fs/p9fs/p9_client.h b/sys/fs/p9fs/p9_client.h index 4eb82c0232f4..5db46d97c704 100644 --- a/sys/fs/p9fs/p9_client.h +++ b/sys/fs/p9fs/p9_client.h @@ -54,8 +54,8 @@ enum p9_proto_versions { /* P9 Request exchanged between Host and Guest */ struct p9_req_t { - struct p9_buffer *tc; /* request buffer */ - struct p9_buffer *rc; /* response buffer */ + struct p9_buffer tc; /* request buffer */ + struct p9_buffer rc; /* response buffer */ }; /* 9P transport status */ From nobody Tue May 26 21:23:02 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 4gQ5MC1KDYz6gSnN for ; Tue, 26 May 2026 21:23:03 +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 4gQ5MC0QDfz3wb8 for ; Tue, 26 May 2026 21:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779830583; 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=MTdl8FX1W1Wi2T87M1JVYbg4/Ht7xL8UGALAB6GKgqQ=; b=CP3F2e8LQKcW6/ymWd+15mwjzpBI0Du2A4cHOmeBo1QuhUmykPCN6DgqyvonhbawXdpOTY 7wuIGD/Ce2u15gENzyfbU+dpFx0w7X4ScJ3JzsPpgUbyj+QmdnPdn7gaGoICCrpLvkl52V IPVuYgW0o97laFEXHIb5spD/oMi1tgNal1H9xKWu3oYAi21m8syV9r4NbRhuTYvsy96+us GFxmzseYUnxibkzAHg1b1zpRanvC/iw6Z1hWpt9RkBX6/5rBS+g+PDAOBZmXUIoBM0/JPR PsFKyB3Sw42V4Gx6xcsaEZTm+MhuuPBEy74HldonlwbjhZmXNEXonRJPCa7muA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779830583; a=rsa-sha256; cv=none; b=vQG2zjJqkuLGe5yM4cu+PlqccLvhKVvWioyJFSGpkSNiJsDfvuhisTIGBn+9DM9y93BgCo MDGl9ELfkr+KBSm4A7Sev2J8lm6l8tMrA1Vh4II5p5Fjm4F63q/IwwqDQE7q9O9urHrI8J tdUU5UZfDhXARPpdtGivFLWOnOD0g44jKUy1IJZuAHT9MArrc+v6mrORucrPHc767I9aO0 AP0bsOLdVegWjT+nSQ9WPshG/YcnSvlbFeT0M+CirTSv2xpEYCmTUSnK/gphaluuzmP6ks 4C0s/H2UAxfYIVaFeux0twWG2tfCbVXF6+AyEhl6DiLnjQYRXBeODx6rLCsIfw== 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=1779830583; 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=MTdl8FX1W1Wi2T87M1JVYbg4/Ht7xL8UGALAB6GKgqQ=; b=xc6JUMFY0rwWiJee7EPIcyHKyRCgxMC65a0kvR2VdpFRVJaTviK4lwv7qNafsRQJFD+fx1 mTy0LF6qEBsUcysm4BXmz7+TJhsjUd6UYg8b8w3WrGwJ1KJ6Zd1gjzCehBeIK+qgiVEXnt ofXBlWAEXEVVnZ6bsVM7k0ymMRFEjf2Pp2eZrz/QfTLGEWoRxczrtvjrF2PnLZlxFl7/El hsXiQWn0xGu6zBVjZhpUSDyTGQs679lkwWAV4z69NyIwLIYelWJy8m+Q2BzDbCoEiW1PWT iej+iausEs59eI0iVoe1wseJulAaqJvVsFuNDRPQ7dx3NcPxZmNjp1QNbwTq6A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ5MC01STzTkB for ; Tue, 26 May 2026 21:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22e4e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 21:23:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 882181b1ae4c - main - p9fs: Implement msize mount option and bump default to 128 KiB 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: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 882181b1ae4c78b4f191fdb7cf6fe1b6ff83c9ff Auto-Submitted: auto-generated Date: Tue, 26 May 2026 21:23:02 +0000 Message-Id: <6a160f36.22e4e.1d353044@gitrepo.freebsd.org> The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=882181b1ae4c78b4f191fdb7cf6fe1b6ff83c9ff commit 882181b1ae4c78b4f191fdb7cf6fe1b6ff83c9ff Author: Alex Richardson AuthorDate: 2026-05-26 19:38:18 +0000 Commit: Alex Richardson CommitDate: 2026-05-26 19:38:18 +0000 p9fs: Implement msize mount option and bump default to 128 KiB QEMU warns when msize is <= 8192 due to degraded performance. This change bumps our default msize to 128 KiB, matching the Linux Kernel v5.15 and newer default. Linux supports even larger values, but 128 KiB is a sensible default. We also add a new 'msize' mount option to allow users to override this value, and we validate it against our maximum supported MTU (currently fixed by the UMA zone size). Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56496 --- sys/fs/p9fs/p9_client.c | 9 ++++++++- sys/fs/p9fs/p9_client.h | 7 +++++-- sys/fs/p9fs/p9fs_vfsops.c | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/fs/p9fs/p9_client.c b/sys/fs/p9fs/p9_client.c index 27a6c1eb366d..d3be87ee1645 100644 --- a/sys/fs/p9fs/p9_client.c +++ b/sys/fs/p9fs/p9_client.c @@ -95,7 +95,14 @@ p9_parse_opts(struct mount *mp, struct p9_client *clnt) /* These are defaults for now */ clnt->proto_version = p9_proto_2000L; - clnt->msize = 8192; + clnt->msize = P9FS_MTU; + + vfs_scanopt(mp->mnt_optnew, "msize", "%u", &clnt->msize); + if (clnt->msize > P9FS_MTU) { + vfs_mount_error(mp, "msize %u is greater than max allowed %u", + clnt->msize, P9FS_MTU); + return (EINVAL); + } /* Get the default trans callback */ clnt->ops = p9_get_trans_by_name(trans); diff --git a/sys/fs/p9fs/p9_client.h b/sys/fs/p9fs/p9_client.h index 5db46d97c704..e5167f9a0f58 100644 --- a/sys/fs/p9fs/p9_client.h +++ b/sys/fs/p9fs/p9_client.h @@ -65,8 +65,11 @@ enum transport_status { P9FS_DISCONNECT, /* transport has been dosconnected */ }; -/* This is set by QEMU so we will oblige */ -#define P9FS_MTU 8192 +/* + * This matches the Linux 5.15 and newer default. + * Note: Linux allows larger msize values than this. + */ +#define P9FS_MTU 131072 /* * Even though we have a 8k buffer, Qemu is typically doing 8168 diff --git a/sys/fs/p9fs/p9fs_vfsops.c b/sys/fs/p9fs/p9fs_vfsops.c index a0f0a5a4e494..fe8c1b5ded31 100644 --- a/sys/fs/p9fs/p9fs_vfsops.c +++ b/sys/fs/p9fs/p9fs_vfsops.c @@ -59,7 +59,7 @@ extern struct vop_vector p9fs_vnops; /* option parsing */ static const char *p9fs_opts[] = { - "from", "trans", "access", NULL + "from", "trans", "access", "msize", NULL }; /* Dispose p9fs node, freeing it to the UMA zone */ From nobody Tue May 26 21:23:04 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 4gQ5MD5Q03z6gT8r for ; Tue, 26 May 2026 21:23:04 +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 4gQ5MD1Vz8z3wgk for ; Tue, 26 May 2026 21:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779830584; 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=F69pcMzXh48PkqBnRhy/tDvL8i5E4OKCgmoHbSVT0tY=; b=flfRE9b3UyZTmNgFmQruH2DssHxD/wvde4KHv8L+Eq5tJx0TScGDUV+aKXMHTzyNriIBb/ tGkzgJpU7DwFtlprPNc6iBNzmY7EJOoGsllyXbRWSOu9+TcmBVkRBfWXUN4dF5n0hXXWnR VQkw3iZcEHfU3TmPDP+gUN/Pl5s5Tqad2boBwfT2oOuEa4c9toSCTsjFZuQiG8zq5A8VAQ MNTvPo7BcLYcyLcslEII+LfcEKmcKepwS9ovp3PbuEb7HdJ5ZkjM3MlUKOgAFoRS1agJA3 DCSerwYGkJIiPPQq5zbcv8bVfjH7QqL8PPP0M8GPSR1RWEzDIzrsJsZr+lSdKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779830584; a=rsa-sha256; cv=none; b=Y2gvTGAMU+x4y1l4SUNhL1Do7hpRPhbZgvnKDdoeD84pF99jrJ4d3gJJBFQ6is0/ZAFHGN zoBk1JwU9Ub6FxjKTKzZzvQ32hQvROtuCrrm59eEXRNiQC+C6Lfgzu5JBpFNAnKkmyPmYu XbYobUtsZbHy27f3Q90oifLzxLfD46UtM6daYGSDFGEowzFRlrrQUbpzn1gqA287EImWsR x0jvWW59CGSgDOz6enKKVzCJZ6Qfy2XpkrT/2OroZKxao14vg1DxUnxdmvQ0iAe/7+APhg NXKLJ3jFjFqDtuU9Kk775f/HkA5UKKowG18feglhmYdEs8p6oTKVqVdJFIJA4g== 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=1779830584; 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=F69pcMzXh48PkqBnRhy/tDvL8i5E4OKCgmoHbSVT0tY=; b=xKe8GFig7pLfp938Y7KWart1JYIAYg0cSrNFOOA+bfygSrVt6D5APB/4JuhtJz6xca5Tfk EIo0ent8zh5PU+lhQSFwZD8V4sIwnD4Vu1lXNmr74QVrbmajAL5jGAHEmKg+q80qmasfLy 48smRRGF/L+P0tvjFVfLV6CwUboI9r/ZlxRwa4j7b7Tn8YYvLJOwOnffB+xqqCPHajuYf8 UaYHkLYDZ5K11EejSvSNVdMXDTrc/kJFXtfPshFAKNshKGcTlmQ9bp5mA8VMKPi9cD7mNF dcNm7CNA1Plo+rQf9HKdqmza3ilWCyi1wv1B5Z1W2/lE48CYKZOZKDBHPaEpbw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ5MD0sGVzTw2 for ; Tue, 26 May 2026 21:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 237dc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 21:23:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 3525c619abdb - main - Fix building with LLVM_BINUTILS_BOOSTRAP but without CLANG_BOOTSTRAP 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: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3525c619abdb646601e74194a6e15e8407a677da Auto-Submitted: auto-generated Date: Tue, 26 May 2026 21:23:04 +0000 Message-Id: <6a160f38.237dc.2129f4c3@gitrepo.freebsd.org> The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=3525c619abdb646601e74194a6e15e8407a677da commit 3525c619abdb646601e74194a6e15e8407a677da Author: Alex Richardson AuthorDate: 2026-05-26 19:38:58 +0000 Commit: Alex Richardson CommitDate: 2026-05-26 19:38:59 +0000 Fix building with LLVM_BINUTILS_BOOSTRAP but without CLANG_BOOTSTRAP Without this change I get various undefined symbol errors when trying to link llvm-nm and llvm-objcopy during the cross-tools stage. Test Plan: builds now Reviewed by: dim, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56873 --- lib/clang/libllvm/Makefile | 70 +++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index 327724bcb52e..ea90b37f8cbd 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -562,8 +562,8 @@ SRCS_EXT+= DWARFLinker/Parallel/SyntheticTypeNameBuilder.cpp SRCS_EXT+= DWARFLinker/Utils.cpp SRCS_EXT+= DWP/DWP.cpp SRCS_EXT+= DWP/DWPError.cpp -SRCS_MIW+= DebugInfo/BTF/BTFContext.cpp -SRCS_MIW+= DebugInfo/BTF/BTFParser.cpp +SRCS_MIN+= DebugInfo/BTF/BTFContext.cpp +SRCS_MIN+= DebugInfo/BTF/BTFParser.cpp SRCS_MIN+= DebugInfo/CodeView/AppendingTypeTableBuilder.cpp SRCS_MIN+= DebugInfo/CodeView/CVSymbolVisitor.cpp SRCS_MIN+= DebugInfo/CodeView/CVTypeVisitor.cpp @@ -607,7 +607,7 @@ SRCS_MIN+= DebugInfo/CodeView/TypeTableCollection.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFAcceleratorTable.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFAddressRange.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFCFIPrinter.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFCFIPrinter.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFCompileUnit.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFContext.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFDebugAbbrev.cpp @@ -630,11 +630,11 @@ SRCS_MIN+= DebugInfo/DWARF/DWARFListTable.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFTypeUnit.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFUnit.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFUnitIndex.cpp -SRCS_MIW+= DebugInfo/DWARF/DWARFUnwindTablePrinter.cpp +SRCS_MIN+= DebugInfo/DWARF/DWARFUnwindTablePrinter.cpp SRCS_MIN+= DebugInfo/DWARF/DWARFVerifier.cpp -SRCS_MIW+= DebugInfo/DWARF/LowLevel/DWARFCFIProgram.cpp +SRCS_MIN+= DebugInfo/DWARF/LowLevel/DWARFCFIProgram.cpp SRCS_MIN+= DebugInfo/DWARF/LowLevel/DWARFExpression.cpp -SRCS_MIW+= DebugInfo/DWARF/LowLevel/DWARFUnwindTable.cpp +SRCS_MIN+= DebugInfo/DWARF/LowLevel/DWARFUnwindTable.cpp SRCS_MIW+= DebugInfo/GSYM/CallSiteInfo.cpp SRCS_MIW+= DebugInfo/GSYM/DwarfTransformer.cpp SRCS_MIW+= DebugInfo/GSYM/ExtractRanges.cpp @@ -748,8 +748,8 @@ SRCS_EXT+= DebugInfo/PDB/UDTLayout.cpp SRCS_MIW+= DebugInfo/Symbolize/DIPrinter.cpp SRCS_MIW+= DebugInfo/Symbolize/Markup.cpp SRCS_MIW+= DebugInfo/Symbolize/MarkupFilter.cpp -SRCS_MIW+= DebugInfo/Symbolize/SymbolizableObjectFile.cpp -SRCS_MIW+= DebugInfo/Symbolize/Symbolize.cpp +SRCS_MIN+= DebugInfo/Symbolize/SymbolizableObjectFile.cpp +SRCS_MIN+= DebugInfo/Symbolize/Symbolize.cpp SRCS_MIW+= Debuginfod/BuildIDFetcher.cpp SRCS_MIW+= Debuginfod/Debuginfod.cpp SRCS_MIW+= Debuginfod/HTTPClient.cpp @@ -1077,28 +1077,28 @@ SRCS_EXT+= MCA/Stages/RetireStage.cpp SRCS_EXT+= MCA/Stages/Stage.cpp SRCS_EXT+= MCA/Support.cpp SRCS_EXT+= MCA/View.cpp -SRCS_MIW+= ObjCopy/Archive.cpp -SRCS_MIW+= ObjCopy/COFF/COFFObjcopy.cpp -SRCS_MIW+= ObjCopy/COFF/COFFObject.cpp -SRCS_MIW+= ObjCopy/COFF/COFFReader.cpp -SRCS_MIW+= ObjCopy/COFF/COFFWriter.cpp -SRCS_MIW+= ObjCopy/CommonConfig.cpp -SRCS_MIW+= ObjCopy/ConfigManager.cpp -SRCS_MIW+= ObjCopy/ELF/ELFObjcopy.cpp -SRCS_MIW+= ObjCopy/ELF/ELFObject.cpp -SRCS_MIW+= ObjCopy/MachO/MachOLayoutBuilder.cpp -SRCS_MIW+= ObjCopy/MachO/MachOObjcopy.cpp -SRCS_MIW+= ObjCopy/MachO/MachOObject.cpp -SRCS_MIW+= ObjCopy/MachO/MachOReader.cpp -SRCS_MIW+= ObjCopy/MachO/MachOWriter.cpp -SRCS_MIW+= ObjCopy/ObjCopy.cpp -SRCS_MIW+= ObjCopy/XCOFF/XCOFFObjcopy.cpp -SRCS_MIW+= ObjCopy/XCOFF/XCOFFReader.cpp -SRCS_MIW+= ObjCopy/XCOFF/XCOFFWriter.cpp -SRCS_MIW+= ObjCopy/wasm/WasmObjcopy.cpp -SRCS_MIW+= ObjCopy/wasm/WasmObject.cpp -SRCS_MIW+= ObjCopy/wasm/WasmReader.cpp -SRCS_MIW+= ObjCopy/wasm/WasmWriter.cpp +SRCS_MIN+= ObjCopy/Archive.cpp +SRCS_MIN+= ObjCopy/COFF/COFFObjcopy.cpp +SRCS_MIN+= ObjCopy/COFF/COFFObject.cpp +SRCS_MIN+= ObjCopy/COFF/COFFReader.cpp +SRCS_MIN+= ObjCopy/COFF/COFFWriter.cpp +SRCS_MIN+= ObjCopy/CommonConfig.cpp +SRCS_MIN+= ObjCopy/ConfigManager.cpp +SRCS_MIN+= ObjCopy/ELF/ELFObjcopy.cpp +SRCS_MIN+= ObjCopy/ELF/ELFObject.cpp +SRCS_MIN+= ObjCopy/MachO/MachOLayoutBuilder.cpp +SRCS_MIN+= ObjCopy/MachO/MachOObjcopy.cpp +SRCS_MIN+= ObjCopy/MachO/MachOObject.cpp +SRCS_MIN+= ObjCopy/MachO/MachOReader.cpp +SRCS_MIN+= ObjCopy/MachO/MachOWriter.cpp +SRCS_MIN+= ObjCopy/ObjCopy.cpp +SRCS_MIN+= ObjCopy/XCOFF/XCOFFObjcopy.cpp +SRCS_MIN+= ObjCopy/XCOFF/XCOFFReader.cpp +SRCS_MIN+= ObjCopy/XCOFF/XCOFFWriter.cpp +SRCS_MIN+= ObjCopy/wasm/WasmObjcopy.cpp +SRCS_MIN+= ObjCopy/wasm/WasmObject.cpp +SRCS_MIN+= ObjCopy/wasm/WasmReader.cpp +SRCS_MIN+= ObjCopy/wasm/WasmWriter.cpp SRCS_MIN+= Object/Archive.cpp SRCS_MIN+= Object/ArchiveWriter.cpp SRCS_MIN+= Object/Binary.cpp @@ -1115,7 +1115,7 @@ SRCS_MIN+= Object/IRObjectFile.cpp SRCS_MIN+= Object/IRSymtab.cpp SRCS_MIN+= Object/MachOObjectFile.cpp SRCS_MIN+= Object/MachOUniversal.cpp -SRCS_MIW+= Object/MachOUniversalWriter.cpp +SRCS_MIN+= Object/MachOUniversalWriter.cpp SRCS_MIN+= Object/Minidump.cpp SRCS_MIN+= Object/ModuleSymbolTable.cpp SRCS_EXT+= Object/Object.cpp @@ -1124,12 +1124,12 @@ SRCS_MIN+= Object/OffloadBinary.cpp SRCS_MIW+= Object/OffloadBundle.cpp SRCS_MIN+= Object/RecordStreamer.cpp SRCS_MIN+= Object/RelocationResolver.cpp -SRCS_MIW+= Object/SymbolSize.cpp +SRCS_MIN+= Object/SymbolSize.cpp SRCS_MIN+= Object/SymbolicFile.cpp SRCS_MIN+= Object/TapiFile.cpp SRCS_MIN+= Object/TapiUniversal.cpp SRCS_MIN+= Object/WasmObjectFile.cpp -SRCS_MIW+= Object/WindowsMachineFlag.cpp +SRCS_MIN+= Object/WindowsMachineFlag.cpp SRCS_MIN+= Object/WindowsResource.cpp SRCS_MIN+= Object/XCOFFObjectFile.cpp SRCS_MIN+= ObjectYAML/COFFYAML.cpp @@ -1298,7 +1298,7 @@ SRCS_MIN+= Support/OptimizedStructLayout.cpp SRCS_MIN+= Support/OptionStrCmp.cpp SRCS_MIN+= Support/Optional.cpp SRCS_MIN+= Support/PGOOptions.cpp -SRCS_MIW+= Support/Parallel.cpp +SRCS_MIN+= Support/Parallel.cpp SRCS_MIN+= Support/Path.cpp SRCS_MIN+= Support/PluginLoader.cpp SRCS_MIN+= Support/PrettyStackTrace.cpp @@ -1849,7 +1849,7 @@ SRCS_MIN+= TextAPI/TextStubCommon.cpp SRCS_MIN+= TextAPI/TextStubV5.cpp SRCS_MIN+= TextAPI/Utils.cpp SRCS_MIN+= ToolDrivers/llvm-dlltool/DlltoolDriver.cpp -SRCS_MIW+= ToolDrivers/llvm-lib/LibDriver.cpp +SRCS_MIN+= ToolDrivers/llvm-lib/LibDriver.cpp SRCS_MIN+= Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp SRCS_MIN+= Transforms/AggressiveInstCombine/TruncInstCombine.cpp SRCS_MIN+= Transforms/CFGuard/CFGuard.cpp From nobody Tue May 26 21:48:53 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 4gQ5x21T8Zz6gVVr for ; Tue, 26 May 2026 21:48:54 +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 4gQ5x16fBYz43M3 for ; Tue, 26 May 2026 21:48:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779832133; 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=lzvD1ZwDtR3wlAaOiEwBWWXG4UxneRIFMK18Up9g5lI=; b=re6NQGJX2wsK1e0dMr5N2MFik5UC8Dx+Yd2+HiCm9tfWiMFRHJnkoTB+HkunvFhFqrWn8j lrXlshqs+8arixdznhlrbivqsAx8Hh+CubuxmqJuO7y79RS+xPfP+lDnA7HmC6hJSxV+ZS mtLfcpxp5wD8kDzgBII/kqNwzrt84HM31QkfSQBPhknmrKxrCASe3whhAS0S/4f0lgzEqV aEx8juYRRl3Qz7/mj02ifo3PyjRGMSYdGNIcpCF1UnrNxW921kn4ph7mURF+R8uPgE7xzS 8nskKo/Ul4lvXVtOPY3ouwomWuyUgevjuqJYQtWfEpckUu1R0U1q91uEUzsCiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779832133; a=rsa-sha256; cv=none; b=Sn81RjDtpzSxW27N9GSdYUSTO6i0F1iPLX39BP4ba4+TxIygG+CPFdDfBGDjmHfhB34vRa zSQyhjzFL+l2VGIOCZ69w888r84GerQPr/xXnqnVuC15JX6gNWDhRBPX8cFRE4rFHswMt0 Dxxtu3m8skQW0zSDRutN8HJn1rumLgJXZEmE044ZruvoZA2TGzdfs6aENipDIHF4Z3EAnK 1LTiyPMglDY1VpcmMRfi3Mnx3SpX3skHPdolBEaeeZluHw6eOsoib16frHw4kmrq3bZXtV L+lxgKLjzKWgcX/I3AYrcpDIK+4wcjKU3D6HIYeNR+GJ6c8DvywXjjpmybVKzw== 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=1779832133; 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=lzvD1ZwDtR3wlAaOiEwBWWXG4UxneRIFMK18Up9g5lI=; b=qv+4u910gR/iurXpo7if1olJwe9v1PSa//tDVIkN629ocaVWebgb0yOqTdIg9SeYnxC3cx 2kD08xSIod1fcFfbMTCI+5slxDIpduGgkIk0FkwDsbnHYhlgi1UlMWPzwZ5oG/2GFGfKOp GZZA9XBLurB9qLy3ez30VHA9qyXS37r+XaDSoIR1jfdtI1xhHYFiBACLW03wBvYQ6+gpxv At20wSaRo10D47ovjAHQSoBmnr4uWvTJkFX08/YcqxNQdkXVUzzsNUuA2WumgCeolPgIQ9 xXsS/e9rbDhQEiUJImSU/q4I+RskUomuVjZzGujuuXYYARcPwDFibRIejQqAQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ5x164CbzVpn for ; Tue, 26 May 2026 21:48:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26de0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 21:48:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 14b8531c4ccb - main - padlock: Restore padlock_rng to the amd64 build 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: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 14b8531c4ccb836d755ce8a4f1b384164b5d9d94 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 21:48:53 +0000 Message-Id: <6a161545.26de0.7c9648fe@gitrepo.freebsd.org> The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=14b8531c4ccb836d755ce8a4f1b384164b5d9d94 commit 14b8531c4ccb836d755ce8a4f1b384164b5d9d94 Author: Alan Somers AuthorDate: 2026-05-24 00:19:13 +0000 Commit: Alan Somers CommitDate: 2026-05-26 21:43:57 +0000 padlock: Restore padlock_rng to the amd64 build Revert 88a53301e19 and d1ca01059d5 . They removed padlock_rng from the amd64 build under the mistaken belief that this device was available on 32-bit processors only. But it's also available on the 64-bit Via Nano, Nano X2, and some Zhaoxin CPUs. PR: 295517 Fixes: 88a53301e19 ("padlock.4: only install on i386") Fixes: d1ca01059d5 ("padlock(4)/nehemiah: move i386-only entropy") MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D57215 --- share/man/man4/Makefile | 5 +---- sys/amd64/conf/GENERIC | 1 + sys/amd64/conf/MINIMAL | 1 + sys/conf/files.i386 | 1 - sys/conf/files.x86 | 1 + sys/i386/conf/NOTES | 7 ------- sys/modules/Makefile | 4 +--- sys/x86/conf/NOTES | 1 + 8 files changed, 6 insertions(+), 15 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 0b94158659fb..4b9740e12081 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -903,6 +903,7 @@ _ntb_hw_intel.4= ntb_hw_intel.4 _ntb_hw_plx.4= ntb_hw_plx.4 _ntb_transport.4=ntb_transport.4 _nvram.4= nvram.4 +_padlock.4= padlock.4 _pchtherm.4= pchtherm.4 _qat.4= qat.4 _qat_c2xxx.4= qat_c2xxx.4 @@ -949,10 +950,6 @@ _vmm.4= vmm.4 .endif .endif -.if ${MACHINE_CPUARCH} == "i386" -_padlock.4= padlock.4 -.endif - .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "aarch64" _hwt.4= hwt.4 .if ${MACHINE_CPUARCH} == "amd64" diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index c6a095f2d98a..9d76736cc46b 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -329,6 +329,7 @@ device xz # lzma decompression device bpf # Berkeley packet filter # random(4) +device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG # Disabled for now since tpm(4) breaks suspend/resume. #device tpm # Trusted Platform Module diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index d67ae8189a9e..ba64c39bc6b9 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -125,6 +125,7 @@ device ether # Ethernet support device bpf # Berkeley packet filter # random(4) +device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG # Disabled for now since tpm(4) breaks suspend/resume. #device tpm # Trusted Platform Module diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 0e7a1f24be7e..b65d78d1ea3c 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -33,7 +33,6 @@ dev/hyperv/vmbus/i386/hyperv_machdep.c optional hyperv dev/le/if_le_isa.c optional le isa dev/ofw/ofw_pcib.c optional fdt pci dev/pcf/pcf_isa.c optional pcf -dev/random/nehemiah.c optional padlock_rng !random_loadable dev/sbni/if_sbni.c optional sbni dev/sbni/if_sbni_isa.c optional sbni isa dev/sbni/if_sbni_pci.c optional sbni pci diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index 8a7e0b78feb4..a9b9d8875ad1 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -310,6 +310,7 @@ dev/ntb/ntb_hw/ntb_hw_plx.c optional ntb_hw_plx | ntb_hw dev/ntb/test/ntb_tool.c optional ntb_tool dev/nvram/nvram.c optional nvram isa dev/random/ivy.c optional rdrand_rng !random_loadable +dev/random/nehemiah.c optional padlock_rng !random_loadable dev/random/rdseed.c optional rdrand_rng !random_loadable dev/qat_c2xxx/qat.c optional qat_c2xxx dev/qat_c2xxx/qat_ae.c optional qat_c2xxx diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 25bfb99c1fef..b21f05b685b5 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -296,13 +296,6 @@ envvar hint.pcf.0.irq="5" # device glxsb # AMD Geode LX Security Block -# -# padlock is a driver for the cryptographic functions and RNG in -# VIA C3, C7, and Eden processors. -# Requires 'device crypto'. -# -device padlock_rng # VIA Padlock RNG - ##################################################################### # ABI Emulation diff --git a/sys/modules/Makefile b/sys/modules/Makefile index faedb856977c..f21f22c174cd 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -838,6 +838,7 @@ _nfe= nfe _nvram= nvram .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) _padlock= padlock +_padlock_rng= padlock_rng _rdrand_rng= rdrand_rng _rdseed_rng= rdseed_rng .endif @@ -911,9 +912,6 @@ _glxsb= glxsb _pcfclock= pcfclock _pst= pst _sbni= sbni -.if ${MK_CRYPT} != "no" || defined(ALL_MODULES) -_padlock_rng= padlock_rng -.endif .endif .if ${MACHINE_ARCH} == "armv7" diff --git a/sys/x86/conf/NOTES b/sys/x86/conf/NOTES index 3ae80fbe45c5..ebe272769818 100644 --- a/sys/x86/conf/NOTES +++ b/sys/x86/conf/NOTES @@ -549,6 +549,7 @@ envvar hint.pbio.0.port="0x360" device smbios device vpd device tpm +device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device aesni # AES-NI OpenCrypto module device ossl # OpenSSL OpenCrypto module From nobody Tue May 26 23:06:07 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 4gQ7f726Z5z6gbnv for ; Tue, 26 May 2026 23:06:07 +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 4gQ7f71PDVz3D82 for ; Tue, 26 May 2026 23:06:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779836767; 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=B/cjfoULFGOjJPHzrFuPpu5OlUAOy+Zh8rtHmb91JS0=; b=BGFJG/gWm7Wbv7id++TK4QDEiFBmLDtFUmRqqlf5a0ds9gdHcJ2rrqwa/V2/bmeb7o2VBX 0mBlE2qhmK67Fd85ZTC9TOziW2wLe9PORks7/F6utNH4i/qld9GedJjMVX9k9hMz/oueQA PuJbt8iH3rT5GoRsvIjihucXHDv5oMDxwRGPLvuYJ0kHePFVIEFC6yQ7z3ZXEC+XwK46vh yQ0b+61p16nTkDzQpOONEd0fMyU9b/Wsimx0GTer/ltFwY0MoUgqggt4jprO+4SK1qImtj NpB3hQ5aIOrsDDBrEkWQiCfAAHFbbuheSWRUYLqGO0PZ3JMc7bdSWBJoUN2fkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779836767; a=rsa-sha256; cv=none; b=PAE8rxxSefQHHzYn4Ru3ODzM2G9SjwXeWNr+zDBlC4QBaYPcmDskcOwPa+mMIBaaJWIL4b V/gaE61QGNrE1qGeYcgqZ4VMqATif8R8TfFTVHNmb3KcRRPENCt1moaLTLJPJ8X1yTdBhm +RT93rl6U3EEX9cKgcyTvB9Bm0ussNudzu9yqlm+YtkdR9TqU8QQFfRuMJB1ThJSz4lWYM 6uibiEzhkoiwMgyo5xtoDxNdXuBuzdrhW0doJhFVblhOkcgYOJy4r154tpqyYl9r/EA9Yu vDX0EzgqH4cxXAE0JxHgnRJy3J+q4GIE5nHNuaKrj9m7Q3QmGQU7Hqemgl6qQg== 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=1779836767; 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=B/cjfoULFGOjJPHzrFuPpu5OlUAOy+Zh8rtHmb91JS0=; b=RRHH5j5WEVaL8uAdNGcnCrYynPvQBTA1y/Y3j7hF2nafSGFXXR2pP7piqMHbDdzu6a5uxa kRpidENgD/p57dhpbkeZgK1gbglfEXozNH4IM/8h8UDzk87jOC+iykHtqtVFymOMNrpwkC WZ377qGBPt3rv+aMBvTWoEQStZi20k8wLy2OHLo3Z8zt7lENv+FC8zdEQrlg2ayEBFBcT0 YGAuOwHADDpa7ntj1elgUm82gYyGXySFv8QKMpwH7nN+dpQrCLW+zQ48vr2uEjFdllxsaQ r5eZGvq5v/LKJsxT8NEkI54qn/2gJS/jZiEH+yafMo4OFL3nTq6dUHTzM/h71A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ7f70kDGzYkZ for ; Tue, 26 May 2026 23:06:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3718f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 26 May 2026 23:06:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aymeric Wibo Subject: git: aba599a6cc55 - main - zzz: Rewrite to use new power device 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: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aba599a6cc550bf209b42a81a3cdb3f6e94d0613 Auto-Submitted: auto-generated Date: Tue, 26 May 2026 23:06:07 +0000 Message-Id: <6a16275f.3718f.cf1cf42@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=aba599a6cc550bf209b42a81a3cdb3f6e94d0613 commit aba599a6cc550bf209b42a81a3cdb3f6e94d0613 Author: Aymeric Wibo AuthorDate: 2026-05-10 08:48:03 +0000 Commit: Aymeric Wibo CommitDate: 2026-05-26 23:05:45 +0000 zzz: Rewrite to use new power device Previous script called acpiconf(8) (or apm(8) if ACPI wasn't supported, although this was anyway redundant because APMIO just uses ACPI now). Since a new generic power management interface was introduced, this isn't sufficient, as this would only work for ACPI systems and for ACPI S3 suspend (so no way to select suspend-to-idle). Rewrite in C to take advantage of the new power interface. We may want to add a switch to manually override the kern.power.suspend sysctl, which is otherwise what the power device uses to decide which suspend type to switch to (suspend-to-idle or firmware suspend), but this will require us to amend the power interface. Reviewed by: olce, imp, mhorne, ziaee Tested by: mhorne Approved by: olce, imp, mhorne, ziaee Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56918 --- include/paths.h | 1 + usr.sbin/zzz/Makefile | 4 ++- usr.sbin/zzz/zzz.8 | 86 ++++++++++++++++++++++++--------------------------- usr.sbin/zzz/zzz.c | 47 ++++++++++++++++++++++++++++ usr.sbin/zzz/zzz.sh | 41 ------------------------ 5 files changed, 92 insertions(+), 87 deletions(-) diff --git a/include/paths.h b/include/paths.h index 26924bcdba91..9157c17524c7 100644 --- a/include/paths.h +++ b/include/paths.h @@ -54,6 +54,7 @@ #define _PATH_DEFTAPE "/dev/sa0" #define _PATH_DEVGPIOC "/dev/gpioc" #define _PATH_DEVNULL "/dev/null" +#define _PATH_DEVPOWER "/dev/power" #define _PATH_DEVZERO "/dev/zero" #define _PATH_DRUM "/dev/drum" #define _PATH_ESDB "/usr/share/i18n/esdb" diff --git a/usr.sbin/zzz/Makefile b/usr.sbin/zzz/Makefile index 4d1a2dd9dc34..6ce3e03fa6cf 100644 --- a/usr.sbin/zzz/Makefile +++ b/usr.sbin/zzz/Makefile @@ -1,4 +1,6 @@ -SCRIPTS=zzz.sh +.include + +PROG= zzz MAN= zzz.8 .include diff --git a/usr.sbin/zzz/zzz.8 b/usr.sbin/zzz/zzz.8 index c2799c28e177..e7df72c1e830 100644 --- a/usr.sbin/zzz/zzz.8 +++ b/usr.sbin/zzz/zzz.8 @@ -1,63 +1,59 @@ -.\" Copyright (c) 2003 Nate Lawson -.\" All rights reserved. +.\"- +.\" SPDX-License-Identifier: BSD-2-Clause .\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. +.\" Copyright (c) 2026 The FreeBSD Foundation .\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. +.\" This documentation was written by Aymeric Wibo under +.\" sponsorship from the FreeBSD Foundation. .\" -.Dd July 13, 2003 +.Dd May 26, 2026 .Dt ZZZ 8 .Os .Sh NAME .Nm zzz -.Nd suspend an ACPI or APM system +.Nd suspend the system .Sh SYNOPSIS .Nm .Sh DESCRIPTION The .Nm -utility -checks for -.Tn ACPI -or -.Tn APM -support and then suspends the system appropriately. -For -.Tn APM , -.Pp -.Dl apm -z -.Pp -will be issued. -For -.Tn ACPI, -the configured suspend state will be looked up, checked to see -if it is supported and, +utility suspends the system by writing a suspend transition request to +.Pa /dev/power . .Pp -.Dl acpiconf -s -.Pp -will be issued. +The specific sleep method used +.Pq e.g.\& suspend-to-idle or firmware suspend +is determined by the +.Va kern.power.suspend +sysctl. .Sh SEE ALSO .Xr acpi 4 , -.Xr apm 4 , -.Xr acpiconf 8 , +.Xr acpiconf 8 +.Sh HISTORY +The +.Nm +utility first appeared as a shell script in +.Fx 5.1 . +It suspended the system by invoking +.Xr acpiconf 8 +with the suspend state configured via +.Va hw.acpi.suspend_state , +or .Xr apm 8 +on systems without ACPI support. +.Pp +It was rewritten in C in +.Fx 16.0 +to use the generic power management interface provided by +.Pa /dev/power . .Sh AUTHORS -This manual page was written by +The original +.Nm +script was written by +.An Mark Santcroos Aq Mt marks@ripe.net . +This manual page was originally written by .An Nate Lawson Aq Mt njl@FreeBSD.org . +Both the current program and manual page were written by +.An Aymeric Wibo Aq Mt obiwac@FreeBSD.org , +under sponsorship from the +.Fx +Foundation. diff --git a/usr.sbin/zzz/zzz.c b/usr.sbin/zzz/zzz.c new file mode 100644 index 000000000000..a014537720cf --- /dev/null +++ b/usr.sbin/zzz/zzz.c @@ -0,0 +1,47 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2026 The FreeBSD Foundation + * + * This software was developed by Aymeric Wibo + * under sponsorship from the FreeBSD Foundation. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static void +usage(void) +{ + (void)fprintf(stderr, "usage: zzz\n"); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + int powerfd; + enum power_transition trans; + + (void)argv; + if (argc > 1) + usage(); + + powerfd = open(_PATH_DEVPOWER, O_RDWR); + if (powerfd < 0) + err(EX_OSFILE, "could not open power device"); + + trans = POWER_TRANSITION_SUSPEND; + if (ioctl(powerfd, PIOTRANSITION, &trans) != 0) + err(EX_IOERR, "could not request suspend transition"); + + return (EXIT_SUCCESS); +} diff --git a/usr.sbin/zzz/zzz.sh b/usr.sbin/zzz/zzz.sh deleted file mode 100644 index dde36e7984c6..000000000000 --- a/usr.sbin/zzz/zzz.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# -# Suspend the system using either ACPI or APM. -# For APM, "apm -z" will be issued. -# For ACPI, the configured suspend state will be looked up, checked to see -# if it is supported, and "acpiconf -s " will be issued. -# -# Mark Santcroos -# - -PATH=/sbin:/usr/sbin:/usr/bin:/bin - -ACPI_SUSPEND_STATE=hw.acpi.suspend_state -ACPI_SUPPORTED_STATES=hw.acpi.supported_sleep_state -APM_SUSPEND_DELAY=machdep.apm_suspend_delay - -# Check for ACPI support -if sysctl $ACPI_SUSPEND_STATE >/dev/null 2>&1; then - # Get configured suspend state - SUSPEND_STATE=$(sysctl -n $ACPI_SUSPEND_STATE) - - # Get list of supported suspend states - SUPPORTED_STATES=$(sysctl -n $ACPI_SUPPORTED_STATES) - - # Check if the configured suspend state is supported by the system - if echo "$SUPPORTED_STATES" | grep "$SUSPEND_STATE" >/dev/null; then - # execute ACPI style suspend command - exec acpiconf -s "$SUSPEND_STATE" - else - echo "Requested suspend state $SUSPEND_STATE is not supported." - echo "Supported states: $SUPPORTED_STATES" - fi -# Check for APM support -elif sysctl $APM_SUSPEND_DELAY >/dev/null 2>&1; then - # Execute APM style suspend command - exec apm -z -else - echo "Error: no ACPI or APM suspend support found." -fi - -exit 1 From nobody Wed May 27 00:36:56 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 4gQ9fx0Sygz6f0mZ for ; Wed, 27 May 2026 00:36: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQ9fw5vqMz3Lsy for ; Wed, 27 May 2026 00:36:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842216; 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=Ghwd0KN8xBHXlWzV83znHJJUd1+ZuuXPlV1Kw2Rz14Q=; b=FYRk73eP7Ma+zmc4BKOOzA8R+zGjaDJ0R7KRtcZZ8xHs/UWVIv0dqcGpPkDOYZasQSmQHS gMip9tB5WNS2ocLPjICaZNQHWtYKToAOgm7ppVd7oFCNwc8QH/jwDNuSdRsPh5AAkJyHbi Znpreu8UtrrD2LucDJgnbc7ehq32CkTIsyuQvw9qdsK9wgu0U2xdb4Yr3BQ4ug1mrJWDwz 6y92rgO1R1Y+aRbU8q/GZcYNZty2LOT6cApklw0yO1D0GigyG6L6lWzHELzl8dPUMP+knt +XmsJIpZ99IrG37/JRPt9dr9bfXOW3kksM3AZ32FSXS53Kh49ihxvrKHogKgLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842216; a=rsa-sha256; cv=none; b=sArpq+jsVK6sWFjFFLHVm+Ap764o3MjRvjjN9aAx7znI0T1ZIFkTE1SQ7vt/31ZQNXFGGT RnOLaONnLrzsty+ztGIhIbvZquPFURXtiXee+2y2QFwHmeURAnmwQll6L5J8MedENBKb5G zim41hgNCUFHUJFDqAQX/U8muhwz8k/8xTPiC82Q6qfHHLAjcMY/gCv2AzHAYTS8tJrrQS 5ykRFfuviZDiIVGI8eINiqlIHIBufTQ9rNWJeggJYDD9U6l117lz2AdYWacxAjEhie2B2Z 9ArTizQ51FiYkO10mW5G29zk8y1Pha9oeeki8p1/NIJqeL+XZpnTQyxQmqXrqA== 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=1779842216; 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=Ghwd0KN8xBHXlWzV83znHJJUd1+ZuuXPlV1Kw2Rz14Q=; b=qgcNkZCfSoCRuI3F2+a0Og7KW/Rsu1P3kzVOC2rIxzYcU5igXIHM6iOiB7eA7y8AngAR9t xsjSAZQhBQwxplF9y4pl1AzHWOUU2mfiypvhveYvY9WXKMVj2DIjnxbxOIUdBGxDtdrvrq 31xvJj0U2OsvmXgws6hQt7dFQpnJPwwtirPIzKIALLrHHCG+Ao4iJUxdGUmDro4RPeb7gt ESM11+KwW2JSuaF9L0O0/bqxOl+zBUXlV5gdczJ82bw8HIkoqvqG5MyRo2HaV/SYHcuoc+ RC2lwBW9QTL9mBZ2pO7ce6sL4WIW4j8qV4Iv/2NZZmPhObTeYWkkZqNsu6AQpg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9fw5Q0szclZ for ; Wed, 27 May 2026 00:36:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18617 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:36:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 1dac971fbdfb - main - nanobsd: Minor style fixes 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1dac971fbdfbe0acc8289eceddc383172a9aac44 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:36:56 +0000 Message-Id: <6a163ca8.18617.45310add@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=1dac971fbdfbe0acc8289eceddc383172a9aac44 commit 1dac971fbdfbe0acc8289eceddc383172a9aac44 Author: Jose Luis Duran AuthorDate: 2026-05-27 00:12:07 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:12:07 +0000 nanobsd: Minor style fixes - Use $(...) notation instead of legacy backticked `...` - Use tabs for indentation - Indent continuation lines with 4 spaces Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57039 --- tools/tools/nanobsd/legacy.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index 06dce15ffa0a..fde4be9c7d5b 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -111,17 +111,17 @@ create_code_slice() { IMG=${NANO_DISKIMGDIR}/_.disk.image MNT=${NANO_OBJ}/_.mnt mkdir -p ${MNT} - CODE_SIZE=`head -n 1 ${NANO_LOG}/_.partitioning | awk '{ print $2 }'` + CODE_SIZE=$(head -n 1 ${NANO_LOG}/_.partitioning | awk '{ print $2 }') if [ "${NANO_MD_BACKING}" = "swap" ] ; then - MD=`mdconfig -a -t swap -s ${CODE_SIZE} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` + MD=$(mdconfig -a -t swap -s ${CODE_SIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}) else echo "Creating md backing file..." rm -f ${IMG} dd if=/dev/zero of=${IMG} seek=${CODE_SIZE} count=0 - MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` + MD=$(mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}) fi trap "echo 'Running exit trap code' ; df -i ${MNT} ; nano_umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT @@ -129,10 +129,10 @@ create_code_slice() { gpart create -s bsd "${MD}" gpart add -t freebsd-ufs -b 16 "${MD}" if [ -f ${NANO_WORLDDIR}/boot/boot ]; then - echo "Making bootable partition" - gpart bootcode -b ${NANO_WORLDDIR}/boot/boot ${MD} + echo "Making bootable partition" + gpart bootcode -b ${NANO_WORLDDIR}/boot/boot ${MD} else - echo "Partition will not be bootable" + echo "Partition will not be bootable" fi gpart list ${MD} @@ -194,14 +194,14 @@ create_diskimage() { mkdir -p ${MNT} if [ "${NANO_MD_BACKING}" = "swap" ] ; then - MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` + MD=$(mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}) else echo "Creating md backing file..." rm -f ${IMG} dd if=/dev/zero of=${IMG} seek=${NANO_MEDIASIZE} count=0 - MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` + MD=$(mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}) fi awk ' From nobody Wed May 27 00:36:57 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 4gQ9fy1X5jz6f0V9 for ; Wed, 27 May 2026 00:36:58 +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 4gQ9fx6hmfz3Lfl for ; Wed, 27 May 2026 00:36:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842218; 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=x9uvXhPTAn96YXVQu8qPRkkQ00bUrqwJ5D3tZ658Sbs=; b=gK6lxjno6UszKO0QRlWIhNq78JJxotw8YTwhXdGH+rWpmP5dQKetak31cHcSVlQszvltdp L1jGvnJVWyKl4MZfi9SCxuVJVRspHE1vP4orMRlhRm7afVltomIX/JYsGOK8KU4dpgjuoG 0Agz6LJ72gD6sZgwxLFDVjfIwvSolNMuPfzQJBpwCmER7FlhD3oDyEbbb5AXt8EdTO5b/L XNRkR1a4x0p27VEmFiJXu55Cf2r2giU8JDxPnNIso88TgbuwtVD5T0JWQuMSXIPGVQPL+r Zcibd64k9BBv3qHdBXH1muV7ZYVpHHtoae4lpKWpZNw3q07UICurt3LGQhkwPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842218; a=rsa-sha256; cv=none; b=HqyHNGF9gP0WHR8c2FHKy8q1AuoU5jvkOS/pF7f6u8AtwETKdsGvrw9r5rFzQ+kQZ4OcJj Uj5Dx8u0mtzRUltbLWGjSF181/D3dgCR0EUdoSV1SHRri0iW6VpcwyMMYCxMmX4mbrPCpY 0xgJlwnuheMSfS8CsunpptThskl/13JGba6IcyEPBzW4LjIKiifvEZToNB0GJWYfJTuTiJ HFajTgnyMpRABm/492hjuAGk8Q2SgAwr6KBlDHiMpNT4+ocw9zokvTJl1t/opqIrZKnnpP xPIOfjVk7r2I55Lp7dQQ8klJTQAxyhTNTiUUQQ058NwO6sqKGj/B4iO1RfqOGQ== 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=1779842218; 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=x9uvXhPTAn96YXVQu8qPRkkQ00bUrqwJ5D3tZ658Sbs=; b=ojY9loX5GNJ+rMc5+tOcFoHbH/LTUmTFA7Iwg3RuiQ5rzPnxc5j+et/FooZjXLT92iHwMg 0aeNQoFlvum5/R7d+0PTChdWr6ImKe8YrL9zphwIJ0P3mkCgFGOHFRqFBn2LRtoli7QQfD dpJlHFZTisuZVUEW8gEQJ4eMwZYFPGxScpRI+RNQjoLdEgfWc4q58gQE1PluJrBMcky/GF 0yohQPySuxZl0yjuZk8sHqU0hqNg8a9zPb+g0zb2in1kJ6dgz8U/ow2hpwWJeSdCO57Va9 QG6Kh6hq64bhPfpSVqclSX3fRZChDWoM9JbWGsrBlllNKeAxm9E48NBZqLqLZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9fx696kzcCW for ; Wed, 27 May 2026 00:36:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3de69 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:36:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 689f7466c1ae - main - nanobsd: Use NANO_IMG1NAME 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 689f7466c1aee7810e6a965e82338c765105a1cf Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:36:57 +0000 Message-Id: <6a163ca9.3de69.53228e7a@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=689f7466c1aee7810e6a965e82338c765105a1cf commit 689f7466c1aee7810e6a965e82338c765105a1cf Author: Jose Luis Duran AuthorDate: 2026-05-27 00:12:48 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:12:48 +0000 nanobsd: Use NANO_IMG1NAME Do not hard-code _.disk.image, use NANO_IMG1NAME instead. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57040 --- tools/tools/nanobsd/legacy.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index fde4be9c7d5b..6ce477ea0c88 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -108,7 +108,7 @@ create_code_slice() { pprint 3 "log: ${NANO_OBJ}/_.cs" ( - IMG=${NANO_DISKIMGDIR}/_.disk.image + IMG=${NANO_DISKIMGDIR}/${NANO_IMG1NAME} MNT=${NANO_OBJ}/_.mnt mkdir -p ${MNT} CODE_SIZE=$(head -n 1 ${NANO_LOG}/_.partitioning | awk '{ print $2 }') @@ -145,8 +145,8 @@ create_code_slice() { nano_umount ${MNT} if [ "${NANO_MD_BACKING}" = "swap" ] ; then - echo "Writing out _.disk.image..." - dd conv=sparse if=/dev/${MD} of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + echo "Writing out ${NANO_IMG1NAME}..." + dd conv=sparse if=/dev/${MD} of=${IMG} bs=64k fi mdconfig -d -u $MD @@ -160,7 +160,7 @@ _create_code_slice() { pprint 3 "log: ${NANO_OBJ}/_.cs" ( - IMG=${NANO_DISKIMGDIR}/_.disk.image + IMG=${NANO_DISKIMGDIR}/${NANO_IMG1NAME} CODE_SIZE=$(head -n 1 "${NANO_LOG}/_.partitioning" | awk '{ print $2 }') CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE") @@ -177,7 +177,7 @@ _create_code_slice() { mkimg -s bsd \ ${bootcode} \ -p freebsd-ufs:="${NANO_OBJ}/_.disk.part" \ - -o "${NANO_DISKIMGDIR}/_.disk.image" + -o "${IMG}" rm -f "${NANO_OBJ}/_.disk.part" ) > ${NANO_OBJ}/_.cs 2>&1 @@ -231,7 +231,7 @@ create_diskimage() { fi echo "Writing code image..." - dd conv=sparse if=${NANO_DISKIMGDIR}/_.disk.image of=/dev/${MD}${NANO_SLICE_ROOT} bs=64k + dd conv=sparse if=${NANO_DISKIMGDIR}/${NANO_IMG1NAME} of=/dev/${MD}${NANO_SLICE_ROOT} bs=64k if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then # Duplicate to second image (if present) @@ -300,7 +300,7 @@ _create_diskimage() { echo "Image will not be bootable" fi - diskimage="-p freebsd:=${NANO_DISKIMGDIR}/_.disk.image" + diskimage="-p freebsd:=${NANO_DISKIMGDIR}/${NANO_IMG1NAME}" if [ "$NANO_IMAGES" -gt 1 ] && [ "$NANO_INIT_IMG2" -gt 0 ] ; then echo "Duplicating to second image..." From nobody Wed May 27 00:36:58 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 4gQ9fz3KlCz6f0lC for ; Wed, 27 May 2026 00:36:59 +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 4gQ9fz0MD9z3Lmw for ; Wed, 27 May 2026 00:36:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842219; 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=ZIO3i6r/iA288KSnv7VXpwFZQ/iTFO/LnUn4LKgDep8=; b=LlRtbqnjPP16wMkTnR0jtCc5YJOF4SPIzCfPedoK2sRbR964nMX5c3K8xngPrzNiiRYAjR ZDXGxZreC1qnychiRFq1Kls83g+BhpOXZzXJtYFjm6/laIi2vFY2sswCILcz8TETSVzx6D UZqF+NTesxGhgXNTfSd+8iQDI5GWD1qjgFoYGH+ooC5U+neZ41KHJ4+xi4DdDx3xsJuQup dSrvN6c2hXmczTZKy/lKUAgbkGXHU6NWeooGEYVfHYSZjbdGJ7H6ODqkPL7vw5WQrnjKxc QLWros75oktiEgZxAOBfMibeWaRKqgeLoaAjA/c5DnOU+DDDkJahIThEVildxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842219; a=rsa-sha256; cv=none; b=GxBBTiMunnBc5y8bdmbt0U2wRC5EjnXaGwXRfiTibdvgdNrab06wfAWqpC9m/+hjK7IVrr nxHRK9a5U0njyngDcuXO9PBhjN8GhCQFfQrXYxIb2dT+nYAFT8xjNeGQJYZdc1wrnoEu4V amqmWuQ1ElHi1e7lpHJ1zLXMLQhzPe1xFRkmPyj57hKuVT0d18/9e03Go7mqtY31v+E167 klL0BvsayP4l5bz+LGFuaqe8lDt1Tytr3z/jDvdTm195pahQvOQVJ1oLjSHPVv+d8seAh1 tytL2xYgcLgQVo+vylDbpkzkmgBXebK4E1p/cfknlvlsddMyfbR5JD1YdaPShg== 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=1779842219; 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=ZIO3i6r/iA288KSnv7VXpwFZQ/iTFO/LnUn4LKgDep8=; b=R568XRJiDcam2W5i00jB4hJCjdoS5z6KlkrC5DX0au3ySiKkkJpk7LR6ZHWiViFlfVsySL TCe4SqRCjWz+mRxL2xibL6SMCwL1QVtXO6K2+9qjziSR/sS8z0mwQANmuDpANJp3+agKAT S1dSjEdXCyN9qfshrIgs0fwn7c9ru5SOlKxhOyzSaV5/iXNsEsvk1929C+5teJJi0in24o E4Ytp4K1KA2niOrdh3EgYfrhH6rIDWcyvb3C2Q6aV0U5HWUHHX+2Z/J2q1G9Ax8kWEpddx nyHLL0X50s9brP6Z02l5/B+KSCN41PPB6Atph8UIotNE9rZOdeVE2Dswx4uLpQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9fy6zsWzcQZ for ; Wed, 27 May 2026 00:36:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ffb2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:36:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 9d133c76402e - main - nanobsd: Get the code size by its partition index 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d133c76402e769fd63ed838ad641572439cd126 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:36:58 +0000 Message-Id: <6a163caa.3ffb2.269c78a7@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=9d133c76402e769fd63ed838ad641572439cd126 commit 9d133c76402e769fd63ed838ad641572439cd126 Author: Jose Luis Duran AuthorDate: 2026-05-27 00:13:15 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:13:15 +0000 nanobsd: Get the code size by its partition index Previously the code was assumed to be on the on the first line of the _.partitioning file. Instead, explicitly look up the size by its partition index to make the parsing order-independent. The _.partitioning file: 1. First column: starting sector. 2. Second column: size in 512-byte sectors. 3. Third column: partition index. Get the code size by explicitly selecting when the partition index is 1. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57216 --- tools/tools/nanobsd/legacy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index 6ce477ea0c88..efe49bbf692c 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -111,7 +111,7 @@ create_code_slice() { IMG=${NANO_DISKIMGDIR}/${NANO_IMG1NAME} MNT=${NANO_OBJ}/_.mnt mkdir -p ${MNT} - CODE_SIZE=$(head -n 1 ${NANO_LOG}/_.partitioning | awk '{ print $2 }') + CODE_SIZE=$(awk '$3 == 1 {print $2}' "${NANO_LOG}/_.partitioning") if [ "${NANO_MD_BACKING}" = "swap" ] ; then MD=$(mdconfig -a -t swap -s ${CODE_SIZE} -x ${NANO_SECTS} \ @@ -161,7 +161,7 @@ _create_code_slice() { ( IMG=${NANO_DISKIMGDIR}/${NANO_IMG1NAME} - CODE_SIZE=$(head -n 1 "${NANO_LOG}/_.partitioning" | awk '{ print $2 }') + CODE_SIZE=$(awk '$3 == 1 {print $2}' "${NANO_LOG}/_.partitioning") CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE") echo "Writing code image..." @@ -290,7 +290,7 @@ _create_diskimage() { ( local altroot bootloader cfgimage dataimage diskimage - CODE_SIZE=$(head -n 1 "${NANO_LOG}/_.partitioning" | awk '{ print $2 }') + CODE_SIZE=$(awk '$3 == 1 {print $2}' "${NANO_LOG}/_.partitioning") CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE") IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} From nobody Wed May 27 00:37:00 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 4gQ9g02qwjz6f0SC for ; Wed, 27 May 2026 00:37:00 +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 4gQ9g011Stz3Lfm for ; Wed, 27 May 2026 00:37:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842220; 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=VwQ9ek7D2tgIbXRiuAL2pR+sMfgsFrzDC52oyRqszWw=; b=rLwI1vqJkyoA8nl0MOmRP/E0YAOxo0YIGtij5Ol7cQcwak5T69lhRuq5ZbG/iz5/Crr1dq 5UxxmbX9DmXHh9aLLQCFYm/pxVRALOVsBcZPbrrJau0cQv0c3my9K7Ypzly7BRa1G/aGFK lW+VWqVQiLCLQiNKSafrqUf2cMgy1hGDmtfufB/sNZaeN3K2ZduNngJlZhLVDZCh7UL3sn Iz0QhADnlWmmXGIvk7iedC7s/JfnKfGEcc+zKW668jyPgxOUTF8+HTJMiln4fkp20ifL/o D4hPtLQRZP7iAOGKcOa2wqWbi8mftNy27pMApobcDOeMh/HcKTecSFrQvuly3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842220; a=rsa-sha256; cv=none; b=t7MK58OjkxxD6kwQubLkxplxN7FVgBFnXi35Ay1oVTAP2LvJnmA/awiutb7vhgP+Wwc/De VPEHA8ff6hr4zZw6ePaLG8jDo0wb0SXcqxRNvBrAVT05T2ap2H+sHgcM2qlanUEpdJqY4s vCHa49HebSfjs/gcywfyYZxCbRrQJpZMh7MKGPawu95m0LjfoJK0f4ElxH+Z2vROBefGEt 1alH137Dg2wlgE/MqVLNJoO/iU0BkuXwgTQdYiIyqzPiITr40bUNGG4VatFQqk1eYktBzJ qPDbD8oZTrUtyZq7TbOay+ZbgBumE3ymZlXkQpuOOvgu67n1AF7ArGqPmgspig== 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=1779842220; 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=VwQ9ek7D2tgIbXRiuAL2pR+sMfgsFrzDC52oyRqszWw=; b=F/vliPEZQnV1p065jgzf+s4TludAx9Voyj3YDKEej3vGislDXAV5r8vwY32eJRjYBgbm0n SeN2ea+Hpk4DLjKCWDdVgezClZiHXDmrBNsaK3tCc0INjw7qjNJI4FqMFQSkU8fN7uicj2 +Ev5IQqIq6OCvHenlMw/vFc0Q9+tXjku9DRTDwnYslyq1zXbT3DMsmxMAp9P+pZC5x4RBd 4U7YKHkB02jNmdiaKVUJDgiOs0EIDkbsoP2PyenjvkSyF4kY+2W9A6rm7oiuiHP3y48M1Z IYkiWH5ugx6O/Qy60e0ZBRaNk50fsQ8kEKyjy7YtJ051/u7Jhsr1MLWtv3FqZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g00JHgzcCY for ; Wed, 27 May 2026 00:37:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fd16 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: d2a9ad033c3c - main - nanobsd: Remove spurious exit call 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2a9ad033c3cb42b3b2a888baf63374b613df03e Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:00 +0000 Message-Id: <6a163cac.3fd16.4b945b71@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=d2a9ad033c3cb42b3b2a888baf63374b613df03e commit d2a9ad033c3cb42b3b2a888baf63374b613df03e Author: Jose Luis Duran AuthorDate: 2026-05-27 00:13:47 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:13:47 +0000 nanobsd: Remove spurious exit call Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57217 --- tools/tools/nanobsd/legacy.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index efe49bbf692c..ac9cf4a3abe9 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -351,7 +351,6 @@ _create_diskimage() { ${cfgimage} \ ${dataimage} \ -o ${IMG} - exit ) > ${NANO_LOG}/_.di 2>&1 } From nobody Wed May 27 00:37:01 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 4gQ9g15rVpz6f0t6 for ; Wed, 27 May 2026 00:37:01 +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 4gQ9g133Zvz3Lqk for ; Wed, 27 May 2026 00:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842221; 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=B0WCjbN9FExl27S5Dg3M9gA8h4TfMDqEqL7ksfLSVPA=; b=pjq/QDBhlw1MF9QzOD3+Mo1hU0oF/njiEXNEh/1qYmK66F6NuMMcIrx17ulMhAn/kuCP8G aAakXHcDMnXtiN65yp+XN3eT1RN6uUZnyNpzel9NcT5nKOF1a0PbYIhk6PrSCwUer6T2xD Pun/84f54TsWkfzv9jjS9NSHhRpckqVTDNUHBeKMahc1Wt+SfPfXbmop85A4zEwhKqMGgz j3CzbbK/30FoIaRiRPlHPuW+u1LYgEfvk1WZ+LwY85eErwmV/9BxDeEzhzzUE1EDqkkUWu kg0t47GTGIOMCiKY4WNSHlOjZzvVMs5BgRTDot7UiFLYVMnQjWazJoQWljCO/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842221; a=rsa-sha256; cv=none; b=VxwlOGwp5xUW7ic8t/mOgz3NMjJGWd1YGmZrU2r8FX/a7zDocmXnTUSk6lqapF5miPMmVN T/omxqqk8ahyKxARTDoryguphrDcI84jYBiTURNRw/xZx2J3tZdMK6ezcIPo00eq6PH1U2 FjSLIcRv7wpdRFvrKRUHXD0GjrvI8iLw73tLRCOicXweFKpVVD0EgA/+qXtv1eN20Ngov+ 4KNs5shfCGGajC70yx3jT8kUK1wdVtgV1HO2AHLPWtE1sLUvsFUFMOE8f6O98Ktctrplmu gy1IoIgA+BNt+w/ozLRfZ9XXhFqW+ZaQnBdCbItfgrksUQhEp/ybABvptGcM5A== 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=1779842221; 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=B0WCjbN9FExl27S5Dg3M9gA8h4TfMDqEqL7ksfLSVPA=; b=r8n7NBMY/pyZctPl3fVY0xUKtZ90xF6DEemBaCx+wbc2Yf47/4vWV1ddBDEvIfKirKjDd7 rYb1zm3GYuhjRjIniEE3QO+Ib2GDKqx7R2IbEPdV9kRjOuOAXyNsfxXAX2cI48TIzizLOG Y16XqxRfOVXczENog3Q8PdLd9R5dq40/dIsalslFpxN71fAMo3R01RQEGNgMbQfPE7dCK2 cFjvUCPG+nPHLJ9OgTwnbNNtLhHbD3oVio56a/welOvvUZDlcVeRYguKTm0A/MgNRrsSJV k6C4eariRTOyO4K9SCCjBSNjF+7uZ+s6RYN2diubhe7rvaAhsmNUFozia2qEDw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g116HCzcgn for ; Wed, 27 May 2026 00:37:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ef3a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: beddf2c59173 - main - nanobsd: Use rounded sizes for cfg and data slices 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: beddf2c591739a43e36c339b393e0beb3878d01a Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:01 +0000 Message-Id: <6a163cad.3ef3a.260a82f5@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=beddf2c591739a43e36c339b393e0beb3878d01a commit beddf2c591739a43e36c339b393e0beb3878d01a Author: Jose Luis Duran AuthorDate: 2026-05-27 00:14:09 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:14:09 +0000 nanobsd: Use rounded sizes for cfg and data slices Use the calculated (rounded up) cfg and data sizes from the _.partitioning file, instead of consuming them directly from the global variables. We obtain the size of the cfg and data slices by explicitly searching for index 3 and 4 respectively in the _.partitioning file. This ensures that the final image has the rounded-up sizes, and not the raw sizes. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57219 --- tools/tools/nanobsd/legacy.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index ac9cf4a3abe9..670a2f5ca968 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -292,6 +292,8 @@ _create_diskimage() { CODE_SIZE=$(awk '$3 == 1 {print $2}' "${NANO_LOG}/_.partitioning") CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE") + CONF_SIZE=$(awk '$3 == 3 {print $2}' "${NANO_LOG}/_.partitioning") + DATA_SIZE=$(awk '$3 == 4 {print $2}' "${NANO_LOG}/_.partitioning") IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} if [ -f "${NANO_WORLDDIR}/${NANO_BOOTLOADER}" ]; then @@ -327,7 +329,7 @@ _create_diskimage() { # Create Config slice _populate_cfg_part "${NANO_OBJ}/_.cfg.part" "${NANO_CFGDIR}" \ - "${NANO_SLICE_CFG}" "${NANO_CONFSIZE}" "${NANO_METALOG_CFG}" + "${NANO_SLICE_CFG}" "${CONF_SIZE}" "${NANO_METALOG_CFG}" cfgimage="-p freebsd:=${NANO_OBJ}/_.cfg.part" # Create Data slice, if any. @@ -339,7 +341,7 @@ _create_diskimage() { fi if [ "${NANO_DATASIZE}" -ne 0 ] && [ -n "${NANO_SLICE_DATA}" ] ; then _populate_data_part "${NANO_OBJ}/_.data.part" "${NANO_DATADIR}" \ - "${NANO_SLICE_DATA}" "${NANO_DATASIZE}" "${NANO_METALOG_DATA}" + "${NANO_SLICE_DATA}" "${DATA_SIZE}" "${NANO_METALOG_DATA}" dataimage="-p freebsd:=${NANO_OBJ}/_.data.part" fi From nobody Wed May 27 00:37:02 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 4gQ9g24b8hz6f0lG for ; Wed, 27 May 2026 00:37:02 +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 4gQ9g2260Wz3Ltd for ; Wed, 27 May 2026 00:37:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842222; 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=wXaFe3dXTR6XLIB+ELjx9lrFacjRAlrXcL02rnjoMQA=; b=xX8+fl10mt7rhdExR6WmROHprnQH1iD1Pz5Oikv11GBpdrEqUo4/Le2BlwMfRJBcJV2Tz1 spYueSNo9/J1A6XnxdaWfQqcJY9dcjxSJtJJZ/r3k6dWnurpW1rL2phrpxTbpVBFfGZD7S oJGSxUJY4iVNHL8pipMWm/2EoC2i9naiOgKPV1Tdr7qf4RV9+iikCfYobHgt6mcwiExg2W ALbzIMsI7X+ofNjwth8DtUmsDef8i70fbWtRlL41VSpXpXgnWfXWzPm5R1AdmaFKyyIEYY 1z9C/k5j2VCh99Hkq+qK9iHz4Q+XnlBuStIcsrDlSat0a0wJ5wz5lpbzowq32w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842222; a=rsa-sha256; cv=none; b=G3/FveiiPBkvL57fc0s0VbVZB1fWaWukyvCz9u0rB/hjw5w2iTUnm422je6DI3lqayhSqn x+61BhGZHYEpcPT3YrhAeCSnnhFCMMYZDHak5Jihw/U/9Tz3FP33mxuaLIp1j2QqulkGIF MtK4ZWKrYP1TTF+20sOt5gTo+OE3F/TLa5uj6JDK5C8zyaoTx/sippCmXJzH/85n0QSZCd ig2iJTm9JVKAtCheTzipg1UQYGe03VGjhsyNh8rE3kE3bpmDS3TUK2yOiTDR0xjnnsMCS1 2f8S3c8rJqGC0cFaxfNPPO8rJln11KRAM3qVsyd1eT3t4uRce+mZsD5cT/iTgg== 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=1779842222; 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=wXaFe3dXTR6XLIB+ELjx9lrFacjRAlrXcL02rnjoMQA=; b=ABDzeT72i+nAGRBCbhLIhs3uPGfPzrlFGq4yBFAJV1lXyuxZhnHci2KjJHaba+zSUGMLfK BjSUQYP8L64lC6raDpAJ9zt2acC8mPxjYSlIAe3il1glBeoroz2mDUpwTfZjJIsOyloZRP uwz8+ihvvSeU6sbOLo8tzM1gCjIWlTq0/N1AxLCnOB42yUMDhKsqKQMjvfIjxQQu5vL0lt zbgnO8+b443Xz8zeCzjCnj0ArROZ8vLuF7CkH+cgSiMcClS7WB0i90MtG4EUTkQIEFk3qr y7VF+fd2khRU2wLzRaJRBrZDmL5tQY2fZa3KBLOY69iiX/rtONUem2Wm3owlpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g21dMnzcWY for ; Wed, 27 May 2026 00:37:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fc9c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: dadbbccd8049 - main - nanobsd: Account for metadata overhead in code slice 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dadbbccd804980895a098b01f553b5f7193daa81 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:02 +0000 Message-Id: <6a163cae.3fc9c.3976a787@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=dadbbccd804980895a098b01f553b5f7193daa81 commit dadbbccd804980895a098b01f553b5f7193daa81 Author: Jose Luis Duran AuthorDate: 2026-05-27 00:14:56 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:14:56 +0000 nanobsd: Account for metadata overhead in code slice The code slice size (CODE_SIZE) includes 16 sectors reserved for disk metadata (see bsdlabel(8) offset). Subtract these 16 sectors from the total size passed to nano_makefs. This prevents the generated filesystem from consuming the entire slice allocation, ensuring there is enough space for the metadata without overflowing the partition boundary. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57220 --- tools/tools/nanobsd/legacy.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index 670a2f5ca968..8e57163c030d 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -31,6 +31,10 @@ [ -n "$NANO_SECTS" ] || NANO_SECTS=63 [ -n "$NANO_HEADS" ] || NANO_HEADS=16 +# The first partition should start at offset 16, +# because the first 16 sectors are reserved for metadata. +METADATA_SECTS=16 + # Functions and variable definitions used by the legacy nanobsd # image building system. @@ -127,7 +131,7 @@ create_code_slice() { trap "echo 'Running exit trap code' ; df -i ${MNT} ; nano_umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT gpart create -s bsd "${MD}" - gpart add -t freebsd-ufs -b 16 "${MD}" + gpart add -t freebsd-ufs -b "${METADATA_SECTS}" "${MD}" if [ -f ${NANO_WORLDDIR}/boot/boot ]; then echo "Making bootable partition" gpart bootcode -b ${NANO_WORLDDIR}/boot/boot ${MD} @@ -172,8 +176,8 @@ _create_code_slice() { echo "Partition will not be bootable" fi nano_makefs "-DxZ ${NANO_MAKEFS} -o minfree=0,optimization=space" \ - "${NANO_METALOG}" "${CODE_SIZE}" "${NANO_OBJ}/_.disk.part" \ - "${NANO_WORLDDIR}" + "${NANO_METALOG}" "$(( CODE_SIZE - METADATA_SECTS ))" \ + "${NANO_OBJ}/_.disk.part" "${NANO_WORLDDIR}" mkimg -s bsd \ ${bootcode} \ -p freebsd-ufs:="${NANO_OBJ}/_.disk.part" \ @@ -308,8 +312,8 @@ _create_diskimage() { echo "Duplicating to second image..." tgt_switch_root_fstab "${NANO_SLICE_ROOT}" "${NANO_SLICE_ALTROOT}" nano_makefs "-DxZ ${NANO_MAKEFS} -o minfree=0,optimization=space" \ - "${NANO_METALOG}" "${CODE_SIZE}" "${NANO_OBJ}/_.altroot.part" \ - "${NANO_WORLDDIR}" + "${NANO_METALOG}" "$(( CODE_SIZE - METADATA_SECTS ))" \ + "${NANO_OBJ}/_.altroot.part" "${NANO_WORLDDIR}" tgt_switch_root_fstab "${NANO_SLICE_ALTROOT}" "${NANO_SLICE_ROOT}" if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then bootcode="-b ${NANO_WORLDDIR}/boot/boot" From nobody Wed May 27 00:37:03 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 4gQ9g419Dnz6f0mt for ; Wed, 27 May 2026 00:37:04 +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 4gQ9g333J2z3Lr3 for ; Wed, 27 May 2026 00:37:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842223; 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=u8AfzvQ3HG40YVVi3kBonRe/x2kIkenwvovDdPzwQcs=; b=CQ0f8UoJf6PqeoeKAQRCTGJ1m8zb8a4AIGlk8kldw8SUmQgSPEgNo4lVBQt2V/EUqRgckW 69fxP2xLFoLV/nlYfjUbg3qBiosh8v2cLiX/gbTH37nqXNjfbnI1aMCrfSCQf5LjDOWnLK 4OGXIOmtpuANI22fx53VG6XSbdzEmmzGLzinVLat/6xuwpb8esgDPzf/iBU4RE66codX5R gXW2VUEQNp6m0i81/72NYEhBnbPwkfb2pIqaylGx6361/anCda5CWub2LIwSLR6LZevXdv PWCWxyzW73il+Ii3WpDWmOEEvcyTnu8G/IQkUdfqi8OOh2Ahlh9HmWZUtkJaqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842223; a=rsa-sha256; cv=none; b=O+P0ghOTogGYu3bpp5Vs7NevwfvS4A7mOL1XMzZJpMmORM168WmxOBoEjevcwfLI5m+PL7 vWX/bE8qpcrj9KVTbjdSFw2M8HUVzppaOUAFkF2gsWYMYAMaElEY86XBrzsOmfdvCY8Pp1 HPh4jXHybSIl+XixKUO0B8sXCQ2QTwDg9uqi1Glq++Xicik2pPC1gltsMkDtNA0DnH3xZP S/QRHaUk4reEx5HZO80K9NIp5iS6YuGnzkTLFbLBKjUAeBiYX7VAQwyNFQH3uwxr7CeyIj 14kPbJBFfLTyZaUIR0OdMNhDttnLNh6wditLHcXMuPnvleGqgLVTKbw0o9KK9g== 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=1779842223; 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=u8AfzvQ3HG40YVVi3kBonRe/x2kIkenwvovDdPzwQcs=; b=KvEP712hRNbKje2TPTzyOgQpCYXOXEMWU9uNxioLP6mY/LdzH8ogBtRmR4OR7K1XvS16/X xkIytDRB+E2OiQnvEzCbwlWo6u0FC84CBX6U6RE7qVg6JrcE3Ma06k2RvS6Rw4MtCJ8Brp 69nDX0HQ8zTjXiKeltmppgR28ZeOeRmmJo6060cA1IeAGGo77B1zI5Ng+ehraKqL0WxEry dFbGlKuDZKI/E9ooOsBCRVbheV120BFSK1cLYdlRB8Fvku3zhfOC3zdBS7fi8DcAHKUwRi S4NW0t6XkiCPViBRcJTUT3v183kAXFTXhMYfbld2s0WNIsZZe6zmsXLRuEoc1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g32Rx3zcQc for ; Wed, 27 May 2026 00:37:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fdb6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: f1de49f50871 - main - nanobsd: Offset code partition to a track boundary 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f1de49f508714b024ac6f3a60845108f81c7aee7 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:03 +0000 Message-Id: <6a163caf.3fdb6.283217ed@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=f1de49f508714b024ac6f3a60845108f81c7aee7 commit f1de49f508714b024ac6f3a60845108f81c7aee7 Author: Jose Luis Duran AuthorDate: 2026-05-27 00:15:39 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:15:39 +0000 nanobsd: Offset code partition to a track boundary Ensure the primary and secondary code partitions start at a proper track boundary by applying a NANO_SECTS offset in bytes. While track-boundary alignment is largely obsolete on modern storage, this change maintains compatibility with current images (legacy). A future commit will transition to 1 MiB alignment boundaries. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57221 --- tools/tools/nanobsd/legacy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index 8e57163c030d..763f65c4dbdc 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -306,7 +306,7 @@ _create_diskimage() { echo "Image will not be bootable" fi - diskimage="-p freebsd:=${NANO_DISKIMGDIR}/${NANO_IMG1NAME}" + diskimage="-p freebsd:=${NANO_DISKIMGDIR}/${NANO_IMG1NAME}:$(( NANO_SECTS * 512 ))" if [ "$NANO_IMAGES" -gt 1 ] && [ "$NANO_INIT_IMG2" -gt 0 ] ; then echo "Duplicating to second image..." @@ -322,13 +322,13 @@ _create_diskimage() { ${bootcode} \ -p freebsd-ufs:="${NANO_OBJ}/_.altroot.part" \ -o "${NANO_OBJ}/_.altroot.image" - altroot="-p freebsd:=${NANO_OBJ}/_.altroot.image" + altroot="-p freebsd:=${NANO_OBJ}/_.altroot.image:+$(( NANO_SECTS * 512 ))" rm -f "${NANO_OBJ}/_.altroot.part" else altroot="-p-" fi if [ "${NANO_INIT_IMG2}" -eq 0 ]; then - altroot="-p freebsd::${CODE_SIZE}b" + altroot="-p freebsd::${CODE_SIZE}b:+$(( NANO_SECTS * 512 ))" fi # Create Config slice From nobody Wed May 27 00:37:04 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 4gQ9g471tNz6f0n1 for ; Wed, 27 May 2026 00:37:04 +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 4gQ9g442jZz3Lv0 for ; Wed, 27 May 2026 00:37:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842224; 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=WP05kPHp1J6tUqPZACqUYdZVmj1AbOwqmCVBcQre9RI=; b=Qi4ak6LlXayXsUK1hQAtBCqR1rNR4smBaSbhC5wCpxLOHvxccNz9qRxBc5m2kSmo3DP1J/ OSujO2xEZheX7CNBQkYnDfXyiMJuIzo+KgjJuID4eBjkUqXnPuJPcRlKJ3BA7O9YNj2KFi 1u9m70encDVgAJpElNKLcpar9dABovgoIMl7xChPLB9NffgowvlUglMMf9+DgMxfa9A9NR VVGLXYrvnVo7Ss6221SSze9eO57mH/+J9rfjeQvpaca4t5hviEQL/Y7GtOzAh0/OQ757zf yL3d2XL7pfgRha13AYv5nNzzQWoFewWwvJupBcITjkLhsNy8Cz52gA2SEqNIMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842224; a=rsa-sha256; cv=none; b=Uabs4ihrKxAdbrXH7WlT3E3p3U3VyRfFw/g1uVugvxiN97wmZhxGlP5y6luQPcNJDJqS1M SEOWZcjLX7rBfHTJZyWZbNSrT3OGwoBC37QEhDbaobeUSgiwlUScT6gf+yuS83Go+2vYe7 TcSOemaRMIADTImXohlvag1OFVl1NBOVD+nS0zJNd4kgdZ7RwKYkucPhswpbB/uWvnM4DF WaS7gN5Crf7bD4+883FIjaUPVDuh5pxh5pwUHEvkr8Tj+GIxN9fYQWsOmvQW+719FP4Zbi ib803lcOzGlgF06gw++pFnwFnn4ZeMQCCbqyTO2zDqOkkXF+mBrDnCyeSQEtfA== 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=1779842224; 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=WP05kPHp1J6tUqPZACqUYdZVmj1AbOwqmCVBcQre9RI=; b=ExWy40sEXNZUggW2ta0FjkCexqLxAxM9EyIXO5sJULTBRvpLZNV23QszbXApgNtHFyQE6K 7nMXNT2PsIsTwxzRVS9Ez18YWZSY0iet5E0yXgmCL7rSoYdM5Y6a2phzXBs0hn7gGUk2k7 +C2qCo8mZNOJPDeeHceGsMKQh8td6eVLsGDG8KX+Eo6OztPoeet+DdGGIgy9GvqnELz8zv OAfZQMN1KVgRGMi78+R90SRoGFIibRQW+fUgP10pvhfQNREB9WNbS5xgA0tWW5wN9Y3DxQ L8boNrq06B/GePe78xh2lWSwFI8KXmI89qFTvsV9G7wA2vc+DgKeqPH4NE1Dnw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g43NBQzclg for ; Wed, 27 May 2026 00:37:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fca0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 318a85d4b201 - main - nanobsd: Explicitly set image size and secsz in mkimg 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 318a85d4b201b1cb77f25c8a98d2b0687e8259e5 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:04 +0000 Message-Id: <6a163cb0.3fca0.379fe6f2@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=318a85d4b201b1cb77f25c8a98d2b0687e8259e5 commit 318a85d4b201b1cb77f25c8a98d2b0687e8259e5 Author: Jose Luis Duran AuthorDate: 2026-05-27 00:21:57 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:21:57 +0000 nanobsd: Explicitly set image size and secsz in mkimg When building an unprivileged NanoBSD image, explicitly set the desired image size, by passing --capacity to mkimg in bytes, and the logical sector size (-S) to 512 bytes. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57222 --- tools/tools/nanobsd/legacy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index 763f65c4dbdc..1d7a0cef2fed 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -178,7 +178,7 @@ _create_code_slice() { nano_makefs "-DxZ ${NANO_MAKEFS} -o minfree=0,optimization=space" \ "${NANO_METALOG}" "$(( CODE_SIZE - METADATA_SECTS ))" \ "${NANO_OBJ}/_.disk.part" "${NANO_WORLDDIR}" - mkimg -s bsd \ + mkimg -s bsd -S 512 --capacity $(( CODE_SIZE * 512 )) \ ${bootcode} \ -p freebsd-ufs:="${NANO_OBJ}/_.disk.part" \ -o "${IMG}" @@ -318,7 +318,7 @@ _create_diskimage() { if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then bootcode="-b ${NANO_WORLDDIR}/boot/boot" fi - mkimg -s bsd \ + mkimg -s bsd -S 512 --capacity $(( CODE_SIZE * 512 )) \ ${bootcode} \ -p freebsd-ufs:="${NANO_OBJ}/_.altroot.part" \ -o "${NANO_OBJ}/_.altroot.image" @@ -350,7 +350,7 @@ _create_diskimage() { fi echo "Writing out ${NANO_IMGNAME}..." - mkimg -s mbr \ + mkimg -s mbr -S 512 --capacity $(( NANO_MEDIASIZE * 512 )) \ ${bootloader} \ ${diskimage} \ ${altroot} \ From nobody Wed May 27 00:37:05 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 4gQ9g64f1cz6f0SM for ; Wed, 27 May 2026 00:37:06 +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 4gQ9g54hKTz3Lv5 for ; Wed, 27 May 2026 00:37:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842225; 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=Nj+KOpCbASDAr3a2dTs4w2HOxxSqbA/H2u+hyD99LMA=; b=sSbGmtcT3toyWT4h/iOTcrCO+eQ9IxHtKxkx3NePKxuTe3h7fCs2hUEcyYOt+lnA0HrrrC C98Ukabwiv4B8dh2WlsQVEohWEJV/EPn4feTkZhjGMxL3/11cU7sNMYnw2720x0998FQOy N8k4unAxOrYFe8SgkOcV99FGOe1ExtveRmMPAV/fww+g1mbX7z6M+wIQby+tL718+1fIiO VdvZTZ42De3M4ikImBPangDWeSN5rWoMWRRPjxN4eg9X4X3mFie0+xJj6BUPC58rJDPvqV gFUNssRt1yKWxEB2h84rCbFTTZYhKf3myzIZ9xuvTPXSD/fWmHw6w3E0i8vxPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842225; a=rsa-sha256; cv=none; b=QQhO3vuqJlkeRyBjxnRwGzUTe3OoWQKjgE4pnEYJe9Uop2N18DC/sNqzYEDz3LDl/SfJUV Y5X5ebBwTvqQ/CIu4OXIfOqPhgUbO3PcijIqLL4AL8I9wYTRSo6VZM60ym37L9aXeaLgEA D4HBMUvQLKnnqq2c/64nat5dFgmB94N4QpFOgVf6g4decVc/3Wlm7IeMFGAS/QFllysQw8 IBMS12kEstnpVzb+AIVua7s1Z/GmEDX68x+FsEeNDEQUyEKtArzZKeM7+IdFZzE0hM+nrs Ipa4QFS6R16e+50JSLkcjc9lNu8Mq+4w4oeFiioYnWRne//UIw6TX/phIf88gw== 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=1779842225; 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=Nj+KOpCbASDAr3a2dTs4w2HOxxSqbA/H2u+hyD99LMA=; b=vrewAlQQh0OubQ5aSxj4ThJCI4l7EmE+YkGtdcJnG+KNXU+wzXthU5iJ2Sd+JvB9tDBooL NfR0wTxy+r+k1Ot9KrHpRT54pVSAHVzhuLdM2sJI894G5lPS8uRRC64+5boAgvaKulx6f+ 9Fk2mUlhwv/p6/XTidJFtBodVry2PSpUFGo1roZ2Jo2RiAd3mPhUjUHw8c1W7RGKr/VNee dFawQtMUtjaKzdMamLnTrMAKPsoSzUrE8396ueJn45qd8wxN+bpbB5pipa7Tv0YaF9XvKb Gom4dISRX7YDYsnskhnjtQwt/2cFHjB07+RxitRhWBt+pnxwS2sofjCXrtEuVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g545vkzcWZ for ; Wed, 27 May 2026 00:37:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fb23 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 87150a2ed140 - main - nanobsd: Refactor secondary code partition logic 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87150a2ed140d5a3c1272ce9cfe815f19282840b Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:05 +0000 Message-Id: <6a163cb1.3fb23.3680830c@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=87150a2ed140d5a3c1272ce9cfe815f19282840b commit 87150a2ed140d5a3c1272ce9cfe815f19282840b Author: Jose Luis Duran AuthorDate: 2026-05-27 00:22:39 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:22:39 +0000 nanobsd: Refactor secondary code partition logic Rearrange the conditional logic for building the secondary code slice (altroot). Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57223 --- tools/tools/nanobsd/legacy.sh | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index 1d7a0cef2fed..52d60b4fda8c 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -308,28 +308,29 @@ _create_diskimage() { diskimage="-p freebsd:=${NANO_DISKIMGDIR}/${NANO_IMG1NAME}:$(( NANO_SECTS * 512 ))" - if [ "$NANO_IMAGES" -gt 1 ] && [ "$NANO_INIT_IMG2" -gt 0 ] ; then - echo "Duplicating to second image..." - tgt_switch_root_fstab "${NANO_SLICE_ROOT}" "${NANO_SLICE_ALTROOT}" - nano_makefs "-DxZ ${NANO_MAKEFS} -o minfree=0,optimization=space" \ - "${NANO_METALOG}" "$(( CODE_SIZE - METADATA_SECTS ))" \ - "${NANO_OBJ}/_.altroot.part" "${NANO_WORLDDIR}" - tgt_switch_root_fstab "${NANO_SLICE_ALTROOT}" "${NANO_SLICE_ROOT}" - if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then - bootcode="-b ${NANO_WORLDDIR}/boot/boot" + if [ "$NANO_IMAGES" -gt 1 ] ; then + if [ "$NANO_INIT_IMG2" -gt 0 ] ; then + echo "Duplicating to second image..." + tgt_switch_root_fstab "${NANO_SLICE_ROOT}" "${NANO_SLICE_ALTROOT}" + nano_makefs "-DxZ ${NANO_MAKEFS} -o minfree=0,optimization=space" \ + "${NANO_METALOG}" "$(( CODE_SIZE - METADATA_SECTS ))" \ + "${NANO_OBJ}/_.altroot.part" "${NANO_WORLDDIR}" + tgt_switch_root_fstab "${NANO_SLICE_ALTROOT}" "${NANO_SLICE_ROOT}" + if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then + bootcode="-b ${NANO_WORLDDIR}/boot/boot" + fi + mkimg -s bsd -S 512 --capacity $(( CODE_SIZE * 512 )) \ + ${bootcode} \ + -p freebsd-ufs:="${NANO_OBJ}/_.altroot.part" \ + -o "${NANO_OBJ}/_.altroot.image" + altroot="-p freebsd:=${NANO_OBJ}/_.altroot.image:+$(( NANO_SECTS * 512 ))" + rm -f "${NANO_OBJ}/_.altroot.part" + else + altroot="-p freebsd::${CODE_SIZE}b:+$(( NANO_SECTS * 512 ))" fi - mkimg -s bsd -S 512 --capacity $(( CODE_SIZE * 512 )) \ - ${bootcode} \ - -p freebsd-ufs:="${NANO_OBJ}/_.altroot.part" \ - -o "${NANO_OBJ}/_.altroot.image" - altroot="-p freebsd:=${NANO_OBJ}/_.altroot.image:+$(( NANO_SECTS * 512 ))" - rm -f "${NANO_OBJ}/_.altroot.part" else altroot="-p-" fi - if [ "${NANO_INIT_IMG2}" -eq 0 ]; then - altroot="-p freebsd::${CODE_SIZE}b:+$(( NANO_SECTS * 512 ))" - fi # Create Config slice _populate_cfg_part "${NANO_OBJ}/_.cfg.part" "${NANO_CFGDIR}" \ From nobody Wed May 27 00:37:06 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 4gQ9g70Fh4z6f0nD for ; Wed, 27 May 2026 00:37:07 +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 4gQ9g65dlkz3Lp1 for ; Wed, 27 May 2026 00:37:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842226; 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=V1Q29aN92vGHhlobk7a0wfSIL0yxs4rqvgJ/M1DFhCs=; b=WFe3PXSWVU8SkBSrrWmwOJV0X0jmx3+ClMoxFwpgyEO8kl0V1viJSUsX2CHb7ICcWNvdn1 TS3dc3YgQsxUTQse4TRcYcmkORqIFeYoVY9L47+sG9k04JBsk9Rl/mdsdN+GQk8m0XAVoE pI+8ktnZyRgDXIMAfKCWbsm1DNnwkrCmnmKOpq6OUbiPBX/AjtXaAv9d/Gv/noV22mMSOk LhPtkQ3z4xeJ8J/IYaf09aC+ySh2cNdseZIfRLInC6FaIF6Lu/e1KEaR55LKT+auoC0e2n daXSzIQ0liJmr45KMcsriJYgDJYyikmP7G31rQwE53IWEHv2fTihvASbtuV36A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842226; a=rsa-sha256; cv=none; b=e59mfdnbou/BocPfPoOZzq063CwYR41gxVT+k1CzQrs2HRw0fePj2ogkAitE8w96b6I6pE 0kxOON7JQfhdI7LkNNiBZgOp8Y+PPh10zAKlDEkDsPMb1/EedWbO8aR0eg/N2NA3rdrPQH W5OuNQpPU782+UUt4MEpPXSk9bIk4byz0Uoee/Q+2Th49a1gAUslSB/1mOtC3QtHMlSJ8F Pf0cNQTAbGlTz7NiI2fjnptC/evQGX/jdQhviHHLHgB9X62JDIk/Y0sUVuWM6augJBuRSq tQ9iKteSwPzpIgcEjEGxmx7x8IUuwYPKK1kRCtuXZdeD8tkqdyU/JY7FRQjHWg== 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=1779842226; 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=V1Q29aN92vGHhlobk7a0wfSIL0yxs4rqvgJ/M1DFhCs=; b=We/R6fD7CS4JB7O90C7XPXhtJfwqDv2rjEg/ZZSMSDXMJU2Bal+35SFlcbAS+GP+wZ3z+i kr53gz8zEMgnZoecNZ+kj+1sNCp0oy0mpE++WLrHy5VvpOtYAxiNdQKjsPZLaDW11WjTky 1JqPYsriF2kCHpaL5ivmVERdLxLT5DPNHy7UPe0uJPKciEmWenvPC2RNmuEdEuKzcsxj8A MnZcwcD/P9O/U3Ej6Gg63FbS8Gw1RQZibk685X7XTCd5Wy5a7Hs2/qoBEbhD3LNWBT+i5E 016QiV4BL2DNpPj92HEn6IxU2DkoWFLVudrJnvDRD+Q7503MUDB39PRrgtJ0TA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g655F0zcj7 for ; Wed, 27 May 2026 00:37:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3de6d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: ca2d4026c3f2 - main - nanobsd: Fix code image size formatting 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca2d4026c3f2bb8eeab888cf50f2c2e3914ab3e5 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:06 +0000 Message-Id: <6a163cb2.3de6d.651e5a77@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=ca2d4026c3f2bb8eeab888cf50f2c2e3914ab3e5 commit ca2d4026c3f2bb8eeab888cf50f2c2e3914ab3e5 Author: Jose Luis Duran AuthorDate: 2026-05-27 00:23:05 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:23:05 +0000 nanobsd: Fix code image size formatting mkimg(8) parses sizes using expand_number(3). It is an error to use "b" as a suffix. This is the result of a confusion with makefs(8), which uses NetBSD's strsuftoll(3). Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57224 --- tools/tools/nanobsd/legacy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index 52d60b4fda8c..ed4bd493c8d7 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -326,7 +326,7 @@ _create_diskimage() { altroot="-p freebsd:=${NANO_OBJ}/_.altroot.image:+$(( NANO_SECTS * 512 ))" rm -f "${NANO_OBJ}/_.altroot.part" else - altroot="-p freebsd::${CODE_SIZE}b:+$(( NANO_SECTS * 512 ))" + altroot="-p freebsd::$(( CODE_SIZE * 512 )):+$(( NANO_SECTS * 512 ))" fi else altroot="-p-" From nobody Wed May 27 00:37:08 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 4gQ9g92PK9z6f0vs for ; Wed, 27 May 2026 00:37:09 +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 4gQ9g8758Tz3LpQ for ; Wed, 27 May 2026 00:37:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842229; 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=OLiFquDZvwP6UV/LpH3r8zzn2ig8PN3agORi91UofII=; b=sFfZmJqLLaqIUOZvGcebVhsK4R+iS993do2tEO/J5vNhjTXq/k4rufkySKeraL0cJQx1Fs GwME4soZgLkxs4+OfDz9KahIu8vtUiJP/beb9icEg8U70Na9FURvrWIlM3pK7S8aRguEfg bT0xj6WNmzhH3F4WrgfvFjAPOMGmuxvVwr44iL3QUcpn3soL6BM2tg9yJP0wnWA8kq3t++ YNQpbgUhcm8BFBaN3FSbkSJh/t9VnfIhB1zBmsza/6Kh7aw5bnt8yGvFgSXeVGoHDWeakd YFmxS21mbdMMUIItr4hi6c3V2OIsXTxNZl5IcxIk5cwskiAaoDEiMFLjDfXprg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842229; a=rsa-sha256; cv=none; b=AAGlC65dQxYSUVcGUw3qynIQBdk5jHBvV8bfocAGNXGq5RkmYfLJYkgziIC172oE9CRUDQ FQRyRiuIeFb296ZAUvvHPShVIS15BbL0xkkhVupE0n4cmnc6TTFK3MH7pAw+ajg4vvC4jR W3+C4cxY+rjW1KkI8Gxk8Q1f/XTPF2JxQyT1jPGAgjYA30Vaujq3mZlocyh4LwFIMsh3K3 qG7K974TroxuNsep2no15whWEo0a3eiRNsC7xvejZhR2gOrsR3GesiMQQGEq91XsE37dXk sf11t1eGziR5Q+x4rPg9e3XweeOXsIFpHKuPv6C1KhIKv67t/LVDSKv9SRVzXQ== 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=1779842229; 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=OLiFquDZvwP6UV/LpH3r8zzn2ig8PN3agORi91UofII=; b=KCQ9SzXWPulYhwDI5mm1SfVEtQpAoDOZtqVJWFYZeiMlzQN+Tut0LHq/pc7YQwbJvseRkl PmOmoNTe14irko4DinI8wWxR6Ju49vJhdf2S1OunXsBt+v3nhD+OLnHGQgcQYkJwHpAWSF H7YJVjwJneOiasCT3PVFDBbQKjKHo0KlpacA/162dsUrS3Zs0gCKZYK9x8R8p2fwxBJr8B TPi5vdHevNQrGg10Ry2utnSB4kGztJCrZjiXD8kFNvNZ7slrLXFPFWxD3KQxKI9GSB+f7+ /ADGKKJbiBQFg0aw/yIBtohosFKL9ISrWsKnsaOu0PtSokfaLkMuNQS3HnrsFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g86dHZzcgr for ; Wed, 27 May 2026 00:37:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3de71 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 54359982309e - main - nanobsd: Adjust the order of the flags in makefs 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 54359982309e63254424eea1f981215c84d2b9c6 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:08 +0000 Message-Id: <6a163cb4.3de71.78e8d8f2@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=54359982309e63254424eea1f981215c84d2b9c6 commit 54359982309e63254424eea1f981215c84d2b9c6 Author: Jose Luis Duran AuthorDate: 2026-05-27 00:24:26 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:24:26 +0000 nanobsd: Adjust the order of the flags in makefs The order of the flags matter in makefs(8). The -t (type) flag must come before the -o (options) flag; otherwise, the options are reset. Move the -t flag before the -o flag and remove the shim function _xxx_adjust_code_size() that was created to align to the default makefs FFS values. It effectively prevented us from generating NanoBSD images using unprivileged builds with the partitions internally aligned as intended. Reviewed by: senguptaangshuman17_gmail.com, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57226 --- tools/tools/nanobsd/defaults.sh | 4 ++-- tools/tools/nanobsd/legacy.sh | 13 ------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 6f55b28eb77f..4997812cb15f 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -718,8 +718,8 @@ nano_makefs() { image=$4 dir=$5 - makefs ${options} -F "${metalog}" -N "${NANO_WORLDDIR}/etc" \ - -R "${size}b" -T "${NANO_TIMESTAMP}" -t ffs "${image}" "${dir}" + makefs -t ffs ${options} -F "${metalog}" -N "${NANO_WORLDDIR}/etc" \ + -R "${size}b" -T "${NANO_TIMESTAMP}" "${image}" "${dir}" } # Convenient spot to work around any umount issues that your build environment diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh index ed4bd493c8d7..467c7b845672 100644 --- a/tools/tools/nanobsd/legacy.sh +++ b/tools/tools/nanobsd/legacy.sh @@ -96,17 +96,6 @@ calculate_partitioning() { ' > ${NANO_LOG}/_.partitioning } -_xxx_adjust_code_size() -{ - # XXX adjust the CODE_SIZE value by rounding it up to - # a bsize of 32768 (DFL_BLKSIZE). - # Otherwise makefs -s will fail because of the guard - # introduced in 5ad283b3c60d. - codesize=$1 - bsize=32768 - echo $(( ((codesize + (bsize - 1)) / bsize) * bsize )) -} - create_code_slice() { pprint 2 "build code slice" pprint 3 "log: ${NANO_OBJ}/_.cs" @@ -166,7 +155,6 @@ _create_code_slice() { ( IMG=${NANO_DISKIMGDIR}/${NANO_IMG1NAME} CODE_SIZE=$(awk '$3 == 1 {print $2}' "${NANO_LOG}/_.partitioning") - CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE") echo "Writing code image..." if [ -f "${NANO_WORLDDIR}/boot/boot" ]; then @@ -295,7 +283,6 @@ _create_diskimage() { local altroot bootloader cfgimage dataimage diskimage CODE_SIZE=$(awk '$3 == 1 {print $2}' "${NANO_LOG}/_.partitioning") - CODE_SIZE=$(_xxx_adjust_code_size "$CODE_SIZE") CONF_SIZE=$(awk '$3 == 3 {print $2}' "${NANO_LOG}/_.partitioning") DATA_SIZE=$(awk '$3 == 4 {print $2}' "${NANO_LOG}/_.partitioning") IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} From nobody Wed May 27 00:37:07 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 4gQ9g81gHQz6f0nH for ; Wed, 27 May 2026 00:37:08 +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 4gQ9g76XSPz3M08 for ; Wed, 27 May 2026 00:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842227; 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=PtOqdp0JE8qyANOlSplk7QzHUNH787XK6KHWe4yWwGs=; b=cBfi7YgF0R3DuhgrJ0g9gssLlBNOnlG7++9peDDyp7xLvrriUfYQ39t782Meii92taKPg8 z1kR7qUNCWrJ3PsLPKMXkpEM5/fzejDzyn/hU+gochz/HvUBX59dspiqvks7NqP9Df4GUI AJFF9RMZzLHO2upz7Q5nCMF658b4Y9y7Rgw/83hCjkpCzb2XkAfpFOoJQexRojQkhaZPs3 bmRpmCDDTVXIbVFrf9zKeB2JimOKMQVbWGNU/BraPR5+PxbuAMHFufsapjRVKZpTpktFU1 jVhoOvW2cAQfCm1S8/+RHJqPFGBGN0z0EY4KBqOvdvA6jVG1SSZaSTrn4mx3Ug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842227; a=rsa-sha256; cv=none; b=ULWGFNEmCeBzezXripBoh2rCvhsjfaG6sESRMPABpLw9pPKwegoBxp2cQQYyiq9fCu4GJA zywVkMSPbQn8QILCJ5Npzo1O0F6Eug82rMpI0xmzPrbMid89xIOF3XaAhPMS1d4E/jecHb Q/iPCif3IfiHdfU3stF+JAYNF+1rr+iSBRVzG4wLJX9axgNZ2+2/EKiQsbSLLW624FO1do CpsmEHl74N42LLH3UO5v09hGBnM5iGykfzmi6mgB3NAezv1a3nyk2aY3yKGTv16LZv0sdV uuz4GIOFjwIzrVNvqcDKHZNhmeXldCe74n+kxW4CaOzxwtvloG6Acm63oOFbCg== 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=1779842227; 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=PtOqdp0JE8qyANOlSplk7QzHUNH787XK6KHWe4yWwGs=; b=RDi1E8iOU73QqY0lWBPQqXqWujOg3P9RceiWXtaeCH9ksLCtTl7znmPIjF1hAnRHzpcItd xlRfpjZMCJGEwqBqq+LD1wkZC+WZzJBF+1hcfcjmQ2xGFh2SKZ3Egbbojz1WTUIC/Mv6lR rpCxnmbQardF2REzdFESzWlZw+ed9DvjAf7+wL3zD2vNMkXDWgp9mTC9lqLwCt6p+6oXZG T0fZhKH6TlU06+htp7rNFX42NjgArLW/yQFJKbIAegm5S+VZgRRjTRf5K7O/SQAKMe+LIt yCaL3GJ2c3Pi0RxfYqG51M1HZDviZ/TgCbnrKpUaR07f+9IJbY9/LeKN/1wPVw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9g7613Jzclj for ; Wed, 27 May 2026 00:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fbb4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: c579927ac591 - main - nanobsd: Use makefs -R flag to honor rounded sizes 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c579927ac591ffcf36f4cd06444d167ba467ec8d Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:07 +0000 Message-Id: <6a163cb3.3fbb4.6c410483@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=c579927ac591ffcf36f4cd06444d167ba467ec8d commit c579927ac591ffcf36f4cd06444d167ba467ec8d Author: Jose Luis Duran AuthorDate: 2026-05-27 00:23:46 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:23:46 +0000 nanobsd: Use makefs -R flag to honor rounded sizes Switch from the min/max size flag (-s) to the round-up flag (-R) when invoking makefs(8). Because the partition sizes passed to nano_makefs have already been rounded up by calculate_partitioning(), using -s can cause makefs to try to perform sizing adjustments that usually result in failures. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D57225 --- tools/tools/nanobsd/defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index adeb83365050..6f55b28eb77f 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -719,7 +719,7 @@ nano_makefs() { dir=$5 makefs ${options} -F "${metalog}" -N "${NANO_WORLDDIR}/etc" \ - -s "${size}b" -T "${NANO_TIMESTAMP}" -t ffs "${image}" "${dir}" + -R "${size}b" -T "${NANO_TIMESTAMP}" -t ffs "${image}" "${dir}" } # Convenient spot to work around any umount issues that your build environment From nobody Wed May 27 00:37:10 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 4gQ9gB5fdxz6f0xd for ; Wed, 27 May 2026 00:37:10 +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 4gQ9gB11V4z3M0m for ; Wed, 27 May 2026 00:37:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779842230; 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=X+L0LShblSA2Qg9pSjVljWhbIntVXG8FuaGmhYyeICI=; b=hTBv8uQyX5nFbBNO/s0VTTlBfRJ3N2Adqxrw6Pm8BikrIZYnrKgXr2PTMMGOrqeCxWeZMp DCH5G4rCWfmDLJO4mGH6bXTDk/O+Kvt94lPN9vnW44y8L2VcOh8VaOoiodrz2KippcF8Qm vwtW6rHNZoGWmZvJORY50vU8GnHl7AG7tIMayjbW7NH590VYzBuJFo3mSwt1114iKGOtWy LSgFTe7zIf93pcA+oD1UATTqVABYMT88y5q/NkomULs/dBtM0E6POlr5ZMIXHivqPn9C3q rgyfv8cDJcESS4Fhz9m7A0MJWyyT/colI+vuSwpZKBMOpeB7RN3uMpQd9K2KMA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779842230; a=rsa-sha256; cv=none; b=D7l9EvtaRkSUj33eXuseoX3nFD5RTrG8f66n/M/Ec13ghGDG3pfRovFrPzGj/g6SvYhajk th5EkCX7YJ9gjUcNbMMmGvI09JFz0pGUZTxE5psBryIDLYe5xdt7OB9HxQnw9wpOEwcrT0 mRDAuV0d0LXWfUvNUkDdwanNKXjW+aHGdIyqpchJVtVp1Nr7w5ket1gu15cjSZZP7Aoaqp Ww1oP9M3wYdP8zNVIY5C/a9LdxhpduonEIABMYxZEUBpBLBL+Vh7RKOBsFNo+RL9OGhYuG 6mlh7ToLVCte2uqYOiCwk4Hbku5Z6yIJ+aG+ojn+3ZbWBpxXYbNc6eOIFfLlCA== 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=1779842230; 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=X+L0LShblSA2Qg9pSjVljWhbIntVXG8FuaGmhYyeICI=; b=uqPkqjWP2OfCIEbKB+dvCTvAk4yfb5Av38kAW1/izUEUnwfb6yX0E5I000XAjw0H/TS3E9 n3ZxRCx2IGvg5WgafKwuIby+2PoBKGVNgn+vDiMvakYI3hKrCnCx8OByma0iDxSJ2sqPwO c1AHuYDCMEDjTN4YvBywBnovji+fuQdVsqkg1EbJZ8YX+vNwnRptED9rOs9LY2VpMbHe/P PMJIeg/TfgoGfyKWhqLccCir2K/3RiAACyfrdn+sQ4Kkh29X0xbNP9/r4QO8BoU9i255j/ 6aZzhXG40ZzZ5Ckr8F3UZ7N95sT52clz1y/xb8Wb6OzFAL+DrHerto5Z8Yv+Pw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQ9gB0b2Yzcgs for ; Wed, 27 May 2026 00:37:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3eda4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 00:37:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: f1de8e3511d0 - main - nanobsd: Register the boot.config file in the metalog 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f1de8e3511d043e707cf4a63ea76a15a42f81ab0 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 00:37:10 +0000 Message-Id: <6a163cb6.3eda4.470a47e3@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=f1de8e3511d043e707cf4a63ea76a15a42f81ab0 commit f1de8e3511d043e707cf4a63ea76a15a42f81ab0 Author: Jose Luis Duran AuthorDate: 2026-05-27 00:25:10 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-27 00:25:10 +0000 nanobsd: Register the boot.config file in the metalog Ensure that the boot.config file gets an entry in the metalog by tgt_touch()ing it. If a file is not present in the metalog, it gets excluded from the final image when using "-U" (unprivileged builds). MFC after: 2 weeks --- tools/tools/nanobsd/defaults.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh index 4997812cb15f..3bbbcf472ae7 100755 --- a/tools/tools/nanobsd/defaults.sh +++ b/tools/tools/nanobsd/defaults.sh @@ -883,6 +883,7 @@ cust_comconsole() { # Tell loader to use serial console early. echo "${NANO_BOOT2CFG}" > ${NANO_WORLDDIR}/boot.config + tgt_touch boot.config } ####################################################################### From nobody Wed May 27 08:10:05 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 4gQMjv2nnZz6fcbg for ; Wed, 27 May 2026 08:10:11 +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 4gQMjt3Bq6z3Pdc for ; Wed, 27 May 2026 08:10:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779869410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ye2tiscLWMUVIx36dgU28S9iyDpFDC7ThUIRVxiq2rE=; b=jGEODMNbJefFd/3NvZbi14s+T6wM60wAB0to5cBnHygNOrkUEwV0a+FOLkyHciJFKYtLJQ F5BP61MvZMoQYjQ2Fci+WL4WG2EHvCitaTSedwZivWsHA/PSmuojxdAwA/gnZCHOjNjrWe IOo3BV0p1+JVBOza4+78BcsYoe4PTuMj9JmZR2aw58MyFqotVg2G761J6WYuwv37XHZjBV vvoJWXDweIHAr9GLvVPazbzOZUvcohwuslOoIu5vO575gra5mw36iKA3sos0I7c1uqzeOC GZyWjhxtJ+gp4TvHscXY6b6+yM8vXXlPKfJpES/lqHgFae8FSmlQjn2AYSMX/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779869410; a=rsa-sha256; cv=none; b=fO+ATt92MVGAch+E+J8PInItlKuR4fVFfvhscVoUZvLJd6eQTgZhaHrPdSI0z787Ef7XZQ R8jYnh283TpypPRx3HQ711z9cdKWnCyqEXlSqfYYA0OjP6RoGIA1qGBjYxxoAhgPeJ36hC qxO26zWXExtWJl76TVE8WRKr+QWFyFkCWBomVApdXrsXtqHeYAjpyEe4H6ynExmBjHM1sk RIncNl2vxqC+KznxsgFv9Mve2c/cWQWwTJMj/SLYbRUdq4ZQ++gGhc/0pJuh4WkPzndy5V nDrWB25oQuVg9KGVGRNwHOTLwHrbnrFlv84ERQwgyD7ZCgINfX5zGE7kW2fA0w== 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=1779869410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ye2tiscLWMUVIx36dgU28S9iyDpFDC7ThUIRVxiq2rE=; b=o5f8rIv3/sTZvVhxtcXn7Q3s26E8p0lr1Xq1oV94jX5JIbC4nAVWLy7XUML72d08XOoqr7 6/HuW74CrzF1dg9ihsqOx4lgyb/cDSmDpibFqdma+AMDSbWBf6pjxoYtTn+CJ3ZnL+5ZB/ 7cRVf+4wp8khTJLcB1xIRQDsTs3UIudvkqR6qobYPNvBWEVudOVmNwM56FQ7NRsvW68uU6 f3mx3+iWA43EKLQ1PYakJUvLdzV2N9mC9XVRW/mJTzWWEBSHuIpG+jJUyeqKA2rVfbHJ+5 vWN5zUQlc4YNsB4xhNRWAuyPcAgY6y0SqFu+CJPVHghw7uF4s5FKxVZeY+UP6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQMjt2Lp7zrDX for ; Wed, 27 May 2026 08:10:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 20730 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 08:10:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Haoxiang Li From: Konstantin Belousov Subject: git: f0e702a7a289 - main - smbfs: plug smbfs_node_alloc() leak of name buffers when insmntque() fails 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0e702a7a289f0f350bdaeb943805d6d17f9e403 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 08:10:05 +0000 Message-Id: <6a16a6dd.20730.617c5cab@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f0e702a7a289f0f350bdaeb943805d6d17f9e403 commit f0e702a7a289f0f350bdaeb943805d6d17f9e403 Author: Haoxiang Li AuthorDate: 2026-05-26 13:21:39 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-27 08:09:31 +0000 smbfs: plug smbfs_node_alloc() leak of name buffers when insmntque() fails PR: 295577 MFC after: 2 weeks --- sys/fs/smbfs/smbfs_node.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c index 9893987f7ccd..b2b5d63e2eaf 100644 --- a/sys/fs/smbfs/smbfs_node.c +++ b/sys/fs/smbfs/smbfs_node.c @@ -212,6 +212,10 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp, const char *dirnm, SMBERROR("new vnode '%s' born without parent ?\n", np->n_name); error = insmntque(vp, mp); if (error) { + smbfs_name_free(np->n_name); + free(np->n_rpath, M_SMBNODENAME); + if (np->n_parent != NULL && (np->n_flag & NREFPARENT) != 0) + vrele(np->n_parent); free(np, M_SMBNODE); return (error); } From nobody Wed May 27 08:17:56 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 4gQMtr2Lnbz6fchw for ; Wed, 27 May 2026 08:17:56 +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 4gQMtr1sJkz3Qgk for ; Wed, 27 May 2026 08:17:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779869876; 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=D5NnEdmFlO1EubbHge46t5fl7bjrrTObXk/6SCeYEjY=; b=ZRd8xfezzwPKonuSeuTfqHZqC1PmzUNoczDjr7bUXfRIgyD1hGNj/H1m08d44CVmbDcdz/ MuBedjkBDEovCgGYC8lXM/xl+ICNpyi53FoQVcryqTnoh38eWKBjpBZ98bnYHNaleMIPf2 NgS5UXcqMGAvwlzuhnrr4VYxcCIa/fWNKjvXzYCc4T/2IGbR9hpgCBeEVshlt6YvYCqaiF W8XuEgLItO7VyhTSVirK1/V/mqTtxPog7HaA+2jqLoMcROCoPORM8cVtNsnSOLKXR/CIZ4 28NICjHjfCv7olELMZ45UtZk2C5ZJFTdK012mPhBedqrdu0PfozkKko1eTHqIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779869876; a=rsa-sha256; cv=none; b=Eco9DWTRIcnO3zatk8uTmjdSZB+dQpN5ip8VgBaSzUX4FxigCTu4+OE0tTX5rhHwXI46CB zyZ3JckCBV8FTmt35rrnSdCbyM9phDFzKJkYVUYmjzbilEpryajygfIHkUvrdbFwecHuxs jo0NBom+KM31MK2SaYixrL44+Q8xsixgTsBxk/O9S7BPtG3T3vtnQZiksdN2k2cQ1KPBpb zeXyZA3OM7yF+4Ic0xUdA33F0elACgL62jxQYEhrqtuGHCJ3eHj8ItCXn8046DcfjuFTL6 /r8qaH5lFYs94fMTAqfNolF8KedJ93c06I9QaRwbSjiOgCqRfb9YCRXYmLBUqQ== 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=1779869876; 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=D5NnEdmFlO1EubbHge46t5fl7bjrrTObXk/6SCeYEjY=; b=Q5TNdryaR3niVf/uqJxpHAHSjfmsuhxG2LLcyKWl6Mf4M5GgPfaoCCKtc1I9FdhiKs7jqX D8DRIfS3gTJUg8ggq7coFm66aB6MNMAttfRoZHs/XaTOVsRC1DLmh3l52uXxJROEEpKo3B qabJwmeeG4dYxgTP8IwyIZhAxH9MhjFYSTObiT1tbntbDdEoNmSuHbCafcCbXP15Gd7vBH xt5tHw99AmnaZNGao4aLdgc31HZUlvP6g+o0MHl1Z5hp2/M2MLQMzExRfy8xYxoDvU+g3g ZmqnJ6elMcfGacwNfjkerpgVz9Qc36jHTYhr5x9zjRwOMunLWGZwnU5O68AMNw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQMtr13j2zrX9 for ; Wed, 27 May 2026 08:17:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22767 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 08:17:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tom Jones Subject: git: e4328c1398e5 - main - acpi: Update s2idle strings to new name 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: thj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4328c1398e5ea47d039fbcffffe1a64ed92b981 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 08:17:56 +0000 Message-Id: <6a16a8b4.22767.4b401681@gitrepo.freebsd.org> The branch main has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=e4328c1398e5ea47d039fbcffffe1a64ed92b981 commit e4328c1398e5ea47d039fbcffffe1a64ed92b981 Author: Tom Jones AuthorDate: 2026-05-27 08:16:49 +0000 Commit: Tom Jones CommitDate: 2026-05-27 08:16:49 +0000 acpi: Update s2idle strings to new name Reviewed by: obiwac, emaste, olce Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57232 --- sys/dev/acpica/acpi.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 4c6d0c3679c9..5cb0afa581ca 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -666,10 +666,11 @@ acpi_attach(device_t dev) /* * Pick the first valid sleep type for the sleep button default. If that - * type was hibernate and we support s2idle, set it to that. The sleep - * button prefers s2mem instead of s2idle at the moment as s2idle may not - * yet work reliably on all machines. In the future, we should set this to - * s2idle when ACPI_FADT_LOW_POWER_S0 is set. + * type was hibernate and we support suspend_to_idle , set it to that. The + * sleep button prefers fw_suspend instead of suspend_to_idle at the moment + * as suspend_to_idle may not yet work reliably on all machines. In the + * future, we should set this to suspend_to_idle when + * ACPI_FADT_LOW_POWER_S0 is set. */ sc->acpi_sleep_button_stype = POWER_STYPE_UNKNOWN; for (stype = POWER_STYPE_STANDBY; stype <= POWER_STYPE_FW_HIBERNATE; stype++) @@ -743,7 +744,7 @@ acpi_attach(device_t dev) OID_AUTO, "lid_switch_state", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, &sc->acpi_lid_switch_stype, 0, acpi_stype_sysctl, "A", - "Lid ACPI sleep state. Set to s2idle or s2mem if you want to suspend " + "Lid ACPI sleep state. Set to suspend_to_idle or fw_suspend if you want to suspend " "your laptop when you close the lid."); SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "suspend_state", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, @@ -2154,9 +2155,9 @@ acpi_device_pwr_for_sleep_sxd(device_t dev, ACPI_HANDLE handle, int state, * we are currently entering (sc->acpi_stype is set in acpi_EnterSleepState * before the ACPI bus gets suspended, and thus before this function is called). * - * If entering s2idle, we will try to enter whichever D-state we would've been - * transitioning to in S3. If we are entering an ACPI S-state, we evaluate the - * relevant _SxD state instead (ACPI 7.3.16 - 7.3.19). + * If entering suspend_to_idle, we will try to enter whichever D-state we + * would've been transitioning to in S3. If we are entering an ACPI S-state, we + * evaluate the relevant _SxD state instead (ACPI 7.3.16 - 7.3.19). */ int acpi_device_pwr_for_sleep(device_t bus, device_t dev, int *dstate) From nobody Wed May 27 08:48:05 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 4gQNYd4NDVz6fgQt for ; Wed, 27 May 2026 08:48:05 +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 4gQNYd2xBJz3TVS for ; Wed, 27 May 2026 08:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779871685; 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=0Omkq/LKdrmikIBWcNPvGhi54grY1SHa/Zx6JlB/0mU=; b=DwOwvtBvNlU9I3gM50axgZYd/jlGbK6GBIe0WgzB8cV5DKzZWOpClgpbw2ByTUbRkz9Aar 6yQ5Q+3t9Jr3QB7RMmrG2/HxgZfPTAfbR8RXYrcO5KVxyKLY4P4M6ahPqZFC/tGjzoeHkD s//Zep7NM5hW3v9xPOVMfb90OBdqe17nx7y+h/CHvhbk9nIJi8b0LU9q2/EhCqirYOk5qO SoIYH5gFrETtnQbUsAQrIOo2tT+yTkbsBuJIBPecaqvg0wUFJQ0r+bEc4RH63CXOTL5QRI Go/Rj2OofLx+4hi7EGxtVfLD9zOKionYE3fD9Pfl6vqCsZCI810LPGSHwJWhQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779871685; a=rsa-sha256; cv=none; b=qwF+KonsLanHTqCugz+zZ7MCuK3uBs1qNvJ26puIcPVIoz04G4CPZZqxVpfWt9wX1P7Bt+ doyLCQ6EgM7eYZ++3cbVt2GuNyukYyQZe1rFq7AG65H23nsBaJjvk+K2TiqwBLumomOKQu avodHHjWv0YP1kbDN3mXv5CsHOimPATzjaW0pHZbUVJSVB5GBNEmqTnmSYx83i0vqGensX 4+IVwuIyvh/gtN7zCN1m/5/wRkVzaEVqoFWoZfdVzXr0iLvAAbLjzqYoDD03HP4z/wOa9G 5bgQ2Hf3WhpJ477eZDQrRSbEXC2IwwLSX06vUv1Q8ocKfFhnMTeoibBxnaGlcg== 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=1779871685; 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=0Omkq/LKdrmikIBWcNPvGhi54grY1SHa/Zx6JlB/0mU=; b=mIbxVfI6Vzw8zg5E+UjIIYeGtuA1sodr5W52mjBuRSvZb2zY9dQ63cli3RjVH0QOnSCpLG FhmoATta45OhPhaZeNtSGMlLh12Y/ZWfTu2niOMqpFn46G12YTbwVNF7CfdWKkLmOjo0bd X0XkvIAi63jzRxVj6SQf7lyHZvc0u/X8Tl2luhs0Swrb/gThV2eu+PTKjst76mZvALqgY5 hw/IEHCDTu1H+BvqtMNR5jhdr0lp7b0RfJr8Jro8qx/pGmTQvojIJGGGjmEMm/i8ah6rMU CCzuRLbSNbZLVkeY72ssowgxUBg2wn2bc27rzG+JA4fQBUjM7uZFcIX5WYjdmg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQNYd2H54zsSg for ; Wed, 27 May 2026 08:48:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 24b0e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 08:48:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aymeric Wibo Subject: git: 071d82d99736 - main - acpi.4: Update sysctl descriptions with new stype names 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: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 071d82d9973660742e771b23365a82eb8dd2dd0f Auto-Submitted: auto-generated Date: Wed, 27 May 2026 08:48:05 +0000 Message-Id: <6a16afc5.24b0e.73bb50ed@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=071d82d9973660742e771b23365a82eb8dd2dd0f commit 071d82d9973660742e771b23365a82eb8dd2dd0f Author: Aymeric Wibo AuthorDate: 2026-05-27 08:44:12 +0000 Commit: Aymeric Wibo CommitDate: 2026-05-27 08:44:44 +0000 acpi.4: Update sysctl descriptions with new stype names Sponsored by: The FreeBSD Foundation --- share/man/man4/acpi.4 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index 91193d899200..27e7d7ba414d 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 21, 2026 +.Dd May 27, 2026 .Dt ACPI 4 .Os .Sh NAME @@ -123,7 +123,8 @@ Some newer systems require use of this register, while some only work with legacy rebooting support. .It Va hw.acpi.lid_switch_state Sleep type -.Pq Li awake , Li standby , Li s2mem , Li s2idle , Li hibernate , Li poweroff +.Pq Li awake , Li standby , Li fw_suspend , Li suspend_to_idle , \ +Li fw_hibernate , Li poweroff to enter when the lid switch (i.e., a notebook screen) is closed, or .Dq Li NONE .Pq do nothing . @@ -131,7 +132,8 @@ Default is .Dq Li NONE . .It Va hw.acpi.power_button_state Sleep type -.Pq Li awake , Li standby , Li s2mem , Li s2idle , Li hibernate , Li poweroff +.Pq Li awake , Li standby , Li fw_suspend , Li suspend_to_idle , \ +Li fw_hibernate , Li poweroff to enter when the power button is pressed, or .Dq Li NONE .Pq do nothing . @@ -152,13 +154,14 @@ Most current systems do not support .Li S4BIOS . .It Va hw.acpi.sleep_button_state Sleep type -.Pq Li awake , Li standby , Li s2mem , Li s2idle , Li hibernate , Li poweroff +.Pq Li awake , Li standby , Li fw_suspend , Li suspend_to_idle , \ +Li fw_hibernate , Li poweroff to enter when the sleep button is pressed. This is usually a special function button on the keyboard. Default is usually -.Li s2mem +.Li fw_suspend if supported, and -.Li s2idle +.Li suspend_to_idle if not. .It Va hw.acpi.sleep_delay Wait this number of seconds between preparing the system to suspend and From nobody Wed May 27 08:48:06 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 4gQNYg0v2Gz6ffZm for ; Wed, 27 May 2026 08:48:07 +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 4gQNYf3K6pz3TY5 for ; Wed, 27 May 2026 08:48:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779871686; 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=5Bn/IYHDVnxVsJ8Elbxv/0M8l8BD0+B0LBLrGYeuPgk=; b=LNkvUYXA5ggIiLTlwndt5DowfAWdi9Q/0JHSi2U2cfdCW/o9KGLBsPNCStNESI6fSkW38K SD+koZJD0GXhIjQjVfanSzPfGdaT8fpivJSLSNW4oIL8PtUk91QIz9pA969LZ/7acIcIB3 yIg8tPbcIFpbwNFJyjVKhFq3TtETeJvVURe1mx+3vb2SIqo3Mp8AbfcmtOWj4MuvTD9AS7 Rn/wTTyLvbWgQ+qnt6eVo9747vdDFKsEsowycIIn4g5dq4uCX3RMFSq3Ourw8TcX16ICiq 5J39A1RLBkoX2y3gx0gRI6Gc8x08xzA8ALmgQDuDx4FdsTnxd0tQw0mhA8aSJw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779871686; a=rsa-sha256; cv=none; b=fHiC24FwI+DRsRdJKMLovFI60cB6XdG2RHGRwh2/+bkKcM+FL5BsQk0qcYMP02ygUFUknt b55Wbu0t4hrGjBAKSkCkZdXnDmxe7/3tBBRtkBZMKIWIEtspJucLyAL9r03JBJ43L7nGlH fbX2zQgurhwVReeNPox8mI6oJaejZpdSZawgEet74N5OhsRCjazJfFZ+dhQwrli1Pr30xX T187Xpxkdzf7HJd2KzA0W8Uyz8a6VPbAucEv7MraL6G07kIR6dqOlbV+x9fT8gwhCPF+iI OKGm9Q6qy0xhcbhdcdjt0hRpx2vXzAwdf21rRQYM+TaHuFBh+WcLCoxehOjlFw== 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=1779871686; 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=5Bn/IYHDVnxVsJ8Elbxv/0M8l8BD0+B0LBLrGYeuPgk=; b=jJvbgZC5WPDXfTdodn14XHNXA89eRW5H8MLvTkaz0Epdi8N1IuotHhGZ+GFQz2TZj6CANk Asm1M1+sgDyYMw0sA9PY6qWiHcG5ZBJ8a7hrjh863iUElavVM1bv/DpCXzbzRGKGC/BTvz RTDH1NnZGGlzDEit9NyKphfwnVk1JWvi4UWh3CghrvcAzB1CHayPjRGVWUQ06G53YlQc4n KbahAQOguhLdDqdFqZaUovoVwOWuuXgGwBVnMZWe7Ybrlxzc04FnpqMTLKeQ1mUmMnl2A6 0RWZLbxpMhm07+79uanUTMYtCYx3SHQ2HCe23eX/hvpcxrWZJTXt0OMyzAqWBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQNYf2ZYRzrGK for ; Wed, 27 May 2026 08:48:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23ab2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 08:48:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aymeric Wibo Subject: git: 7a11a6c64d4f - main - acpi: Update mentions of s2idle in 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: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a11a6c64d4f52f41e63e535605d4187650c3651 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 08:48:06 +0000 Message-Id: <6a16afc6.23ab2.79e4ade0@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=7a11a6c64d4f52f41e63e535605d4187650c3651 commit 7a11a6c64d4f52f41e63e535605d4187650c3651 Author: Aymeric Wibo AuthorDate: 2026-05-27 08:47:12 +0000 Commit: Aymeric Wibo CommitDate: 2026-05-27 08:47:14 +0000 acpi: Update mentions of s2idle in comments We use the explicit "suspend-to-idle" name now. Sponsored by: The FreeBSD Foundation --- sys/compat/linuxkpi/common/src/linux_acpi.c | 2 +- sys/dev/acpi_support/acpi_ibm.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_acpi.c b/sys/compat/linuxkpi/common/src/linux_acpi.c index 85a3afe5d01d..680d111d0194 100644 --- a/sys/compat/linuxkpi/common/src/linux_acpi.c +++ b/sys/compat/linuxkpi/common/src/linux_acpi.c @@ -126,7 +126,7 @@ linux_handle_power_suspend_event(void *arg __unused, enum power_stype stype) /* * XXX: obiwac Not 100% sure this is correct, but * acpi_target_sleep_state does seem to be set to - * ACPI_STATE_S3 during s2idle on Linux. + * ACPI_STATE_S3 during suspend-to-idle (aka s2idle) on Linux. */ linux_acpi_target_sleep_state = ACPI_STATE_S3; pm_suspend_target_state = PM_SUSPEND_TO_IDLE; diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index 693d793532c1..a5c44b1f81b9 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -1449,8 +1449,8 @@ acpi_ibm_eventhandler(struct acpi_ibm_softc *sc, int arg) switch (arg) { /* * XXX "Suspend-to-RAM" here is as opposed to suspend-to-disk, but it is - * fine if our suspend sleep state transition request puts us in s2idle - * instead of suspend-to-RAM. + * fine if our suspend sleep state transition request puts us in + * suspend-to-idle instead of actual suspend-to-RAM. */ case IBM_EVENT_SUSPEND_TO_RAM: (void)power_pm_suspend(POWER_TRANSITION_SUSPEND); From nobody Wed May 27 13:10:45 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 4gQVNj2gT8z6f1RH for ; Wed, 27 May 2026 13:10:45 +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 4gQVNj1Tpbz4Bps for ; Wed, 27 May 2026 13:10:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779887445; 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=TTcovKmYntAG+iHrXSuA8ijAJSC58ZAT5tWxCtbtusM=; b=iLiZUQJeVEqmDm8oHr7wqS9VJVhzeTStyueO2QnGYmVDVRhRiUY/RX0Ses8Pr2VCbXBaXK tiB5I5+L0KyD8DraIa37TfflOFqHF6R7zFV9kRvjzrQGb5UZ1RtCOCp5QwV0IkYbQZS9yP 0/faPkYma8pLAop44vcVHtfU7fcC87X5VtO5zon3zEhRca0SUcdtml07E31vgjAMf8VD4c mAyvFn9GUamWwnLojO7VDywyIi70dBmQJoIQTbSy/82QHzdM2xTbe2CIE2Gyt50cmSk/Lh JmaZa1hayR9jBhaIK3zyVhVi1kU4LrO7k5lVeQE7sKLsX3r0P8fif54sbRv+EA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779887445; a=rsa-sha256; cv=none; b=nQjcaw1nGBpa0PLvZ4U7A8oz9MFcYmAdq/HJmCzpw/6X34x5igbivmh2+jG8EGK6hkTFmS ZSE5KqmipgUtGq0p3i9TOIPpPJyIuMbhpN9xu2ytl2jEaJdhDW67j+PAO1zxhaxHDSlTF7 hm89a1vGYxaRq4Eq7seXWNT0UxWtXXEVw+KgfKOj22qkfd2ehUr9UBL//2FTdE8GDc5aRy rIASxxrVBaRCkvXzjnxRIhXvoLNUfcItmbV8k9+yrNOzKHQ9MvaR1hkqbboeGAhAwWlpvs ss/bDt2cPlb7EXPkZ/QRvTl+zNr/YYRyFSnIuK6Iz5xsv8v9rBLQul3r+ubySg== 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=1779887445; 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=TTcovKmYntAG+iHrXSuA8ijAJSC58ZAT5tWxCtbtusM=; b=wJfiuhzcnQ8YgzULI6sIvUgRe4fI+MEFex/2moThd2Xy18ljf2h7PXTyoxW6pnVEYRR9yd kfVu7+VjkANHQ3yjfmocWWrkHrRg1BrkDXeKHixyOTePoY9BoN0OgdA//fGjQOO/aKNHZi Aw8Lm4E2mo2DBrW/y2hjCZ8g2pACSRFeVzW2g2CcrSAKVQ2mYCYDDocx42dEk1upuTnLfo 15fcxG38DHnuzyKhd47wpMeogqE/0GNiLetuhasfVHrRr6YMnRufDFakae+raKURQ3x50K uUQDUb/VmrV4ZVQbZkD6jbYFOVSO/OCM7sznCC6v/oRFr7z9jq6djKCt7DcTTA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQVNj0zHNz11V1 for ; Wed, 27 May 2026 13:10:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18510 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 13:10:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: e9346d1d1383 - main - login.conf(5): Add missing resource limits 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9346d1d1383e8c1dced50a3aceb28edd5a4a5e2 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 13:10:45 +0000 Message-Id: <6a16ed55.18510.4befb2c8@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=e9346d1d1383e8c1dced50a3aceb28edd5a4a5e2 commit e9346d1d1383e8c1dced50a3aceb28edd5a4a5e2 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-27 13:10:35 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-27 13:10:35 +0000 login.conf(5): Add missing resource limits While here, reorder the table. PR: 295618 MFC after: 1 week Reviewed by: olce Differential Revision: https://reviews.freebsd.org/D57258 --- lib/libutil/login.conf.5 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/libutil/login.conf.5 b/lib/libutil/login.conf.5 index d4bbc1d67780..9b136291dc1e 100644 --- a/lib/libutil/login.conf.5 +++ b/lib/libutil/login.conf.5 @@ -17,7 +17,7 @@ .\" 5. Modifications may be freely made to this file providing the above .\" conditions are met. .\" -.Dd December 15, 2025 +.Dd May 27, 2026 .Dt LOGIN.CONF 5 .Os .Sh NAME @@ -194,17 +194,18 @@ login environment. .It "cputime time CPU usage limit." .It "datasize size Maximum data size limit." .It "filesize size Maximum file size limit." +.It "kqueues number Maximum number of kernel event queues." .It "maxproc number Maximum number of processes." .It "memorylocked size Maximum locked in core memory size limit." .It "memoryuse size Maximum of core memory use size limit." .It "openfiles number Maximum number of open files per process." +.It "pipebuf size Maximum size of pipe buffers." +.It "pseudoterminals number Maximum number of pseudo-terminals." .It "sbsize size Maximum permitted socketbuffer size." -.It "vmemoryuse size Maximum permitted total VM usage per process." .It "stacksize size Maximum stack size limit." -.It "pseudoterminals number Maximum number of pseudo-terminals." .It "swapuse size Maximum swap space size limit." .It "umtxp number Maximum number of process-shared pthread locks." -.It "pipebuf size Maximum size of pipe buffers." +.It "vmemoryuse size Maximum permitted total VM usage per process." .El .Pp These resource limit entries actually specify both the maximum From nobody Wed May 27 13:17:35 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 4gQVXj6TvCz6f2Nl for ; Wed, 27 May 2026 13:17:41 +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 4gQVXj0L9Gz4G3n for ; Wed, 27 May 2026 13:17:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779887861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5qXWO/o1DFOwn6sP9KTIf9AKTiWILjfvsvStw3xB/eI=; b=g/h9vjfHSFowBmSA0/6vO5hCrBo4gq0Zfmll0A/BUlRTP+dy0NGu+M4JsHAFVAKLGAVVMI 1jsrG0UwPU9xwjwFOXEyyBCnVVOWk6+FD/XwOrAGYyrlGjnW9njakkv4za2sxYaZdZUV1R 00oFigqxqGoiC6oAF022mZUk9MzBpLJGHVmgKcJ7Ch/lGv8m3x8VrX8QWD+alOkpLC6tcS 4uAKvDoLP80kBRTZCxQHh1zDu5TJW33PnmJ17c9G+yt9cbV+Nvy2WDt5hgcT1V39lnmh2A xu+D+I0ZvsyM/0nldu9UhjerUmxHi8OCiC4QHoepHtTp1I4zV/evcbm+mrHRHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779887861; a=rsa-sha256; cv=none; b=azFAuQNiQy/YpazFjHy1/cHrVjJFVaraKPweND1VsZVaRRizjn0MTBB/8wDNfTUdS7Wys0 TTHuIpPg8Pr3mPo1oFzW8BavuJj8mg5ZwvApRrAXDavKktcMhL4NmtO5BxQWRu9vzqT16u xglDVgXLRvCdlR1jgW9l3JmctjKtLaevJGknRbTCOqaUFi4vB2g2feAp0+nkIkTbRm4qVz N6g93zzRWhurGa222ZUNCgSzTVfLArbPGthI5VC0qi8cWIMsTMlUbuX7S+XHWyRREiFJ14 slWvR6NyUxoY9Rss+Hr3L+rUtTlqUCXVUWKrvCc9OpXChdd1pSsv7Pr7LiJsbA== 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=1779887861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5qXWO/o1DFOwn6sP9KTIf9AKTiWILjfvsvStw3xB/eI=; b=PrnqgBHpb24OmaxfWFWR2Jn7ysmFtWUrCkSHJdKpeG78GDIhwoXi0Qc+jtYSnLZyWy5b3t 9NHVegGmwSb8Po1652m2LN9Ok5eax5cJ/KyZnzHUrPbTN/tfXKOdvL3bN8xqMIknWxHATd gfYQsgXjdC5T4jcRdqX2Eho4LWnHXbS1G4Iznh58R1a6kcaZb1dlWeCEMXm5tYmvBpX4rb Kw9qTMy4/lZApT1FZzDh3M4FnPMRJ1XlODe16epmhkWZp1zW6LLee2om4TK/Vgnc7ujrKt SKU7jNhA9VVVRHdsxbiT2durvEKe61AyeSIR45UekHuKrrrE6mqlz+BgIRmaqQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQVXh73sZz11Xw for ; Wed, 27 May 2026 13:17:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 475db by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 13:17:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Mark Johnston From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: bd15d6ef126e - main - libarchive: Force GNU iconv compatibility on FreeBSD 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd15d6ef126ee4c0eac931117f6bbbf6f9a3fc72 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 13:17:35 +0000 Message-Id: <6a16eeef.475db.2283bfa4@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=bd15d6ef126ee4c0eac931117f6bbbf6f9a3fc72 commit bd15d6ef126ee4c0eac931117f6bbbf6f9a3fc72 Author: Mark Johnston AuthorDate: 2026-05-20 16:39:40 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-27 13:10:57 +0000 libarchive: Force GNU iconv compatibility on FreeBSD When libarchive is compiled with FreeBSD's native iconv instead of libiconv, as happens with libarchive in the base system, we need to configure iconv(3) to handle invalid sequences by returning -1, as iconv_strncat_in_locale() assumes GNU iconv semantics. This corresponds to upstream PR 3056. PR: 294577 MFC after: 1 week --- contrib/libarchive/libarchive/archive_string.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/contrib/libarchive/libarchive/archive_string.c b/contrib/libarchive/libarchive/archive_string.c index c6ae8968d54f..4fb96a9fa178 100644 --- a/contrib/libarchive/libarchive/archive_string.c +++ b/contrib/libarchive/libarchive/archive_string.c @@ -1314,7 +1314,17 @@ create_sconv_object(const char *fc, const char *tc, else if (strcmp(fc, "CP932") == 0) sc->cd = iconv_open(tc, "SJIS"); } -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(__FreeBSD__) && !defined(HAVE_LIBICONV) + /* + * FreeBSD's native iconv() by default returns the number of + * invalid characters in the input string, as specified by + * POSIX, but iconv_strncat_in_locale() assumes GNU iconv + * semantics. + */ + int v = 1; + + (void)iconvctl(sc->cd, ICONV_SET_ILSEQ_INVALID, &v); +#elif defined(_WIN32) && !defined(__CYGWIN__) /* * archive_mstring on Windows directly convert multi-bytes * into archive_wstring in order not to depend on locale From nobody Wed May 27 14:59:19 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 4gQXnz73cjz6f911 for ; Wed, 27 May 2026 14:59:19 +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 4gQXnz6Gk9z3HHw for ; Wed, 27 May 2026 14:59:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893959; 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=RH5qab0ck7c3/bHCr3jlzmBEML+pr2jms9cAh5NPwXc=; b=MXhn2Lv5feNMknDCVmBLHUOzDyWRrs7bfyFtVj35yPQrv/Tm5c0A12KEipyNVPfPUMaxot NFM0u/PVjC3Uk0HcOguH2lZ/Z6RLz6dp21CGa1ptomuAjHnItfKDuVx8amg91ZOyRDGsEr dKUw9DzMVCrBWe3k8dP4PADW8zeZNtWsZoWDgX6k3bkbw94XRmWmSi9i7S6nY5dkPdLj2t u0KUoY+A+iCw0Zw2t+p3EIQOvGovkzQNMX6IkAw17mDadxR/t9ApVewu40+jCINOI3neCr T3weRjPfZV4ef7OQrzq8iNgxh4cOBt9C47ETZ1P22mXtjfhOixldjRu1KBfZvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893959; a=rsa-sha256; cv=none; b=Z3h6H5aCyXpm31mTsNJO6sBO65gMP1gr0DpFdV1MauiwBJCULISi3aVAzheOxneIHTW0Av nEk+hFPhruuRU1+6oysKbS/yoJHAaUBUOBY/O9HJnH2m+rwVWQXXEkwzde7mElWzRb8RDx vMEpRlob8rGFTMwp+fqUj8MvymfUGZCKPee0xYKpQ5wP6N6jvkJlYdIZc4gP1hXXIRd4VT JiPngTLVQ/v8aNmYONX/ZccPF0LzaEzUo8uvCVR3CYicUQT0HRLPgLOr6OOt/9FXpYmYSl dZVjTh6JCM4c3pmrV/rIVDe8VMQiUsT100DTlnOfQsp4mNhw98HNPPrD4JNkqQ== 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=1779893959; 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=RH5qab0ck7c3/bHCr3jlzmBEML+pr2jms9cAh5NPwXc=; b=aWtm6AYSHI9y+L7zF+IKKRUr2AI0TyDce8v2/GoXj3KM6jBd+7QB70MBTsEcVnSo+nN+U8 ArA3iI3+4e0aRjv3G9DkNI5NxRWjvSQlHRTVx6aR5jsuw7dz3j+O3sjolOt+95FH7qqmrB rKN8Gq7cRALdECn/uEMRVYKpu9dFYWtdUDVTDMDKK3bPHTf76B23YLMCJ6ry092Ppycugs lHJ4XnKZMzu8o5ZvAoMVK0bUNzampyODZ9d3YykJzBfMVUdnjGBjLdWeM1LFVKhnCPu+S8 Ax69WyGSd3EYLQ9AYO2TVIbSLXpuZtR4viFZVTGrAv7fDRVFLS9gFXnU6kvq8A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXnz5cn8z131d for ; Wed, 27 May 2026 14:59:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 224dc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d01e5afbbf9b - main - arm64: Remove unneeded declaration from 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d01e5afbbf9bc879e570f59dddc147c0efa8b990 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:19 +0000 Message-Id: <6a1706c7.224dc.5da5bcb1@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d01e5afbbf9bc879e570f59dddc147c0efa8b990 commit d01e5afbbf9bc879e570f59dddc147c0efa8b990 Author: John Baldwin AuthorDate: 2026-03-25 15:17:27 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:43:37 +0000 arm64: Remove unneeded declaration from Reviewed by: kib, andrew Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/arm64/include/pcpu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/arm64/include/pcpu.h b/sys/arm64/include/pcpu.h index 286a40e7de3d..d04f975350d8 100644 --- a/sys/arm64/include/pcpu.h +++ b/sys/arm64/include/pcpu.h @@ -55,7 +55,6 @@ struct debug_monitor_state; #ifdef _KERNEL -struct pcb; struct pcpu; static inline struct pcpu * From nobody Wed May 27 14:59:20 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 4gQXp11PSyz6f95W for ; Wed, 27 May 2026 14:59:21 +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 4gQXp06v81z3HD3 for ; Wed, 27 May 2026 14:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893961; 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=/iJ6GqwjfI4Nu8xo6w33yjIVYsmQy1OhwKvI5UTVyx8=; b=KAdhs1zuEpfLGXnqLRtJTEcylrLPFh1NybLTroeRGiaAOaqvu2zKwDYDQHJ/yFBcCNTlPZ SJuF9w8USdeMJISlchJmcJufZoA3opbTM0axTAe2jr5Rff1CGvMIfiSRps2a3PINX1T4a/ OkUV/JOOxAa7Y8QqG0+6Kyw1VvFodHh1MQK58X48LyhFuVD0lWK44xz8x4cXzwI2JRkYar GcGsrsxweS2Xp69hokEliv7/kDwvUtfjLfn4f8ODGaaoh4Qeco2iglOrsC7nSsSlAQ1U88 qqOTZBGPT/+mYA0qsmqQwqEZbuccrHNE+7x7rbpxlmqEWS2j47lIUkl4K105zw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893961; a=rsa-sha256; cv=none; b=gB/3+4MtdBHvNHTvIxPxtZYnYhFbk5OcN6WGgHT1VqY+Czo3UMkl1HOnW3eV9SKM4LImZn g6rx2oDsChtlvLtoTjj2Tcu3+D0l6K8crly5vdC4RrgQVeTjxvFuG2iLsWp6x5zdD4t0dn oTfQpNnvFR6rSHTsg/GsHedOH/Z6d0Gop1HCVNy0wbdlNUWrmRYnFb0IqxX7HF7rd8PGBz /domnt3DVfoAtzfEiATxzzB241j96t+mjKACxk4GCqJzrrADMgBCQc2Uupqr3Yb61sPXf9 Wm+BqLEcqw5FyWs6iDk5f+xGyuJL7e/FsTXLNDBN0LL3ELXUqEKab8NmwT8aZQ== 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=1779893961; 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=/iJ6GqwjfI4Nu8xo6w33yjIVYsmQy1OhwKvI5UTVyx8=; b=JJ8S1RTmBTwVNvVFwiUeA60SWMVPHV7roJ6YnDsdp+18p6nZKpf0z1M6aaSr++KlFzH1Dm 3DPeFX+t2CaCzDoI7LEfKMuWVGYjKgT04wOFzDhsw2A5fbCjva9QJ9lmZSjPCg9aHtLW2c GtWnkGib8hfHloz+P+2kaZdGiOmq0nwu48n1cNFEXj9v5qFx0YVMjTxP4GKCN0OVQIxDfQ GCaoD9jfcegyPlasiHK4qIvAd2fBHSdTG15YwekwI9HIqgzVKdxLYCVKC8mvMyAe05mseV 1JmQX2j9kYmSON15dhY69KI7SJopHxRw4Oj+vaqOW/pqNU6yNhZVy6cHmQz+Hg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp06RLPz131f for ; Wed, 27 May 2026 14:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22d47 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 860aaecf1bb6 - main - amd64: Don't set an initial FPU state save size 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 860aaecf1bb659d8cc6023aaa2d27273823faa75 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:20 +0000 Message-Id: <6a1706c8.22d47.4501a199@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=860aaecf1bb659d8cc6023aaa2d27273823faa75 commit 860aaecf1bb659d8cc6023aaa2d27273823faa75 Author: John Baldwin AuthorDate: 2026-03-26 17:09:59 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:43:40 +0000 amd64: Don't set an initial FPU state save size This used to be needed to initialize the pcb pointer when the pcb was allocated on the kstack. Reviewed by: kib Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/amd64/amd64/machdep.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index e338db372df3..20c4be7880ff 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1521,7 +1521,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) * We initialize the PCB pointer early so that exception * handlers will work. */ - cpu_max_ext_state_size = sizeof(struct savefpu); set_top_of_stack_td(&thread0); thread0.td_pcb = get_pcb_td(&thread0); From nobody Wed May 27 14:59:22 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 4gQXp237dwz6f92n for ; Wed, 27 May 2026 14:59:22 +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 4gQXp2101sz3HG3 for ; Wed, 27 May 2026 14:59:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893962; 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=g2cLyjr1rYw65CG1lPqWAUIFi1xaCdw5uzOXXRHU1nY=; b=ksYUq55Ii8tcGQqTVbMinPIKJWAKU7x6H/197aXvG+mpI+/+3ZCD/5LcqCvalwPsiP2hgA FsCyjje08Qseb33/l/H3Sy1P9L6ke0/kuWvIsu6UPlZAqKWxFAj/HAuKvRCoypUqDsN7Tb wxXQDrEoY3k/uSyvZDYWDXlFjf1qCN4RG1Z/yn620NquSxYDmCnnW0CWV1HmStAQfMv+Fs tHSkWGvlcgy3Uufk6p5VX5SzRFd1wqYbJa08OI5Mxqoq5c9Zx6ccbUJL3rkRSfn12sgvh+ zrb9F4y3HKA4dk2lUHKQgeyWYEFcGKeuR+XyBC3eC6i75igXfYFEMQ6vXAQBbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893962; a=rsa-sha256; cv=none; b=D9G9Oi/ZHW9gquxLiqtBWorgCUIxAdFCGxj4IgJS9PtB/+TQwP6ndQLmbZCRwshKFtvnj6 oKFVcRaIPS21S+FyukbDi7ZwjQVMQfEgHj87UVpoZk6CGG+nZk5BZDpOHgOfKW8qi0RgQl up/iy+RDN7LgCPD1Wqm6q35NyWqdcKZKOWOB+DhEahqVHOWxAg69PTxgl0u1n4N3J4ufWh bpwJIQbDBZBNyZRzmzuFl19rzQ5MJvNtjvEdqAdrAkK+HVVIs/1qdkUoCEFE418B+uhsfL 7b4NEE8tagrqe0z12fw4aOLkHcpEvy+nmqFh339JpfmIIGwFbk3vOjNTpt7vqQ== 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=1779893962; 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=g2cLyjr1rYw65CG1lPqWAUIFi1xaCdw5uzOXXRHU1nY=; b=fUpMu4X2nShLnmGG4VaQTOE0K15mVuIWq8LF5Z86cPk5uD/fkqnMaoezN7IED59FgrNSKn 5cdPEpz9ud/7nGvgXAnZgjC8xCHERYQwxaLgStl1+R9MoXovxYhTiwdEqizg8dCkFteuqP YYWpDsmFtRrxhyYxxqZdKvOcSqNb+yBS+1kRq7/3NxrGW1jyapPuI0RCWh+rZrSwonwPcp 47dFUq88zGk4TCOfZeDpi48IEGY5s0t2yhLfl7e5GaFLHIUDuoDWMv+Y4Ks5LL6kntjADs FWB+ghg9ZGow7FbJDWSmeL7L0XEfo/0Fy9ZYZzlZ32JxNktp1tKjNdtZuzh0sQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp20G9lz148T for ; Wed, 27 May 2026 14:59:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23e13 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 187b46e1c4d7 - main - cpu_fork: Remove redundant assignments to td_pcb and td_frame 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 187b46e1c4d761efe2e92f662d68c0f49cd04b44 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:22 +0000 Message-Id: <6a1706ca.23e13.4f26e07f@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=187b46e1c4d761efe2e92f662d68c0f49cd04b44 commit 187b46e1c4d761efe2e92f662d68c0f49cd04b44 Author: John Baldwin AuthorDate: 2026-03-26 17:39:52 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:43:43 +0000 cpu_fork: Remove redundant assignments to td_pcb and td_frame cpu_thread_alloc() already sets these fields anytime td_kstack changes. Reviewed by: kib, andrew (arm changes) Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/amd64/amd64/vm_machdep.c | 6 +----- sys/arm/arm/vm_machdep.c | 8 ++------ sys/arm64/arm64/vm_machdep.c | 9 ++------- sys/i386/i386/vm_machdep.c | 12 +++++------- sys/powerpc/powerpc/vm_machdep.c | 8 ++------ sys/riscv/riscv/vm_machdep.c | 2 -- 6 files changed, 12 insertions(+), 33 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 2e180003e93d..e37f122dffa3 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -167,8 +167,6 @@ copy_thread(struct thread *td1, struct thread *td2) clear_pcb_flags(pcb2, PCB_TLSBASE); } - td2->td_frame = (struct trapframe *)td2->td_md.md_stack_base - 1; - /* * Set registers for trampoline to user mode. Leave space for the * return address on stack. These are the kernel mode register values. @@ -240,9 +238,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Point the stack and pcb to the actual location */ - set_top_of_stack_td(td2); - td2->td_pcb = pcb2 = get_pcb_td(td2); + pcb2 = td2->td_pcb; copy_thread(td1, td2); diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index bee1c705fbbd..b1197255c281 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -97,9 +97,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) if ((flags & RFPROC) == 0) return; - /* Point the pcb to the top of the stack */ - pcb2 = (struct pcb *) - (td2->td_kstack + td2->td_kstack_pages * PAGE_SIZE) - 1; #ifdef VFP /* Store actual state of VFP */ if (curthread == td1) { @@ -107,7 +104,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) vfp_save_state(td1, td1->td_pcb); } #endif - td2->td_pcb = pcb2; + pcb2 = td2->td_pcb; /* Clone td1's pcb */ bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); @@ -116,8 +113,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) mdp2 = &p2->p_md; bcopy(&td1->td_proc->p_md, mdp2, sizeof(*mdp2)); - /* Point the frame to the stack in front of pcb and copy td1's frame */ - td2->td_frame = (struct trapframe *)pcb2 - 1; + /* Copy td1's frame */ *td2->td_frame = *td1->td_frame; /* diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 4cb87ca9856e..01542848ab56 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -89,10 +89,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) #endif } - pcb2 = (struct pcb *)(td2->td_kstack + - td2->td_kstack_pages * PAGE_SIZE) - 1; - - td2->td_pcb = pcb2; + pcb2 = td2->td_pcb; bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); /* Clear the debug register state. */ @@ -100,14 +97,12 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) ptrauth_fork(td2, td1); - tf = STACKALIGN((struct trapframe *)pcb2 - 1); + tf = td2->td_frame; bcopy(td1->td_frame, tf, sizeof(*tf)); tf->tf_x[0] = 0; tf->tf_x[1] = 0; tf->tf_spsr = td1->td_frame->tf_spsr & (PSR_M_32 | PSR_DAIF); - td2->td_frame = tf; - /* Set the return value registers for fork() */ td2->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return; td2->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td2; diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 672ec9360c35..003f00070bff 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -232,9 +232,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Point the pcb to the top of the stack */ - pcb2 = get_pcb_td(td2); - td2->td_pcb = pcb2; + pcb2 = td2->td_pcb; copy_thread(td1, td2); @@ -248,11 +246,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. - * The -VM86_STACK_SPACE (-16) is so we can expand the trapframe - * if we go to vm86. */ - td2->td_frame = (struct trapframe *)((caddr_t)td2->td_pcb - - VM86_STACK_SPACE) - 1; bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); /* Set child return values. */ @@ -381,6 +375,10 @@ cpu_thread_alloc(struct thread *td) struct pcb *pcb; struct xstate_hdr *xhdr; + /* + * The -VM86_STACK_SPACE (-16) is so we can expand the trapframe + * if we go to vm86. + */ td->td_pcb = pcb = get_pcb_td(td); td->td_frame = (struct trapframe *)((caddr_t)pcb - VM86_STACK_SPACE) - 1; diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c index 00fdc301a7e7..1dc28739ad7c 100644 --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -123,9 +123,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) if (td1 == curthread) cpu_update_pcb(td1); - pcb = (struct pcb *)__align_down(td2->td_kstack + - td2->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb), 0x40); - td2->td_pcb = pcb; + pcb = td2->td_pcb; /* Copy the pcb */ bcopy(td1->td_pcb, pcb, sizeof(struct pcb)); @@ -135,7 +133,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ - tf = (struct trapframe *)pcb - 1; + tf = td2->td_frame; bcopy(td1->td_frame, tf, sizeof(*tf)); /* Set up trap frame. */ @@ -143,8 +141,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) tf->fixreg[FIRSTARG + 1] = 0; tf->cr &= ~0x10000000; - td2->td_frame = tf; - cf = (struct callframe *)tf - 1; memset(cf, 0, sizeof(struct callframe)); #if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) diff --git a/sys/riscv/riscv/vm_machdep.c b/sys/riscv/riscv/vm_machdep.c index 206110157233..e718d522e572 100644 --- a/sys/riscv/riscv/vm_machdep.c +++ b/sys/riscv/riscv/vm_machdep.c @@ -100,8 +100,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) critical_exit(); } - cpu_set_pcb_frame(td2); - pcb2 = td2->td_pcb; bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); From nobody Wed May 27 14:59:23 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 4gQXp35SJPz6f8v8 for ; Wed, 27 May 2026 14:59:23 +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 4gQXp31Y1cz3HNm for ; Wed, 27 May 2026 14:59:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893963; 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=NXKmDfJUBgz5dDEuZCOTmeTpM2CDy6WHGP3pe9gWxm0=; b=pVT2pm5aBDB0nvFoQx/HoQNdnZTIRxf9CkAM/bA18H3+GCauaCSB4jo2GRu/qyv+ZVVXN/ G+t9i5djoQau+9Q8nRoSqJ3AkOu8VtjpyLyVvwsPOfYhHAav3M9aj63Tf94qbt44CHLKJU vM4khdOJo6X7xe3NGeBJ0tqheOyUEiFflDES+TbMJ3dwxnB1CijfsnpqlUa1/YItF/3iE4 +Ib98W+k6YDNUW4mGAm/SXrAjo4pBkeY9wX3Z7PpUw3uwr6DuVseP+jGlxSAExOB/PXVzg zKfnkBqg8ivrkEOjENizy/JXBScLff6DBk1NFKjhZC7C4pKQCixPEDs5AHLgzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893963; a=rsa-sha256; cv=none; b=oiUx9iC0P9Vn4O77T5Csg/jeBW2hI+lIc3bYg91eKOoiyxo3HZnDCDFZimMW2cJfZcBgQO /oJUfG6F0M2NtXHw0VyMGt2Tl+DA3Il5MQt49XZ3bQ9XbebuqbVIG7z5S0IcM/RGMjny4q wv6qhLxVPr/Lzm+c8l21X/iIlx8PrOtm2EucaaypUtmF7zSAksMfh8i/2+WydXv5dbikZE 1WBKkMtBnQzHLsvy1cKDxfXCR+o/2KCIAfqwfEEiVAdXJ5FI6pogMudnVkIHL6Ami+j1Ow lsrG+lP2ys0tsFAzXqzIzxEPHsEQ0Haa/WoeTrJyH6xUAr6A+P+bnNDQuu64PA== 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=1779893963; 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=NXKmDfJUBgz5dDEuZCOTmeTpM2CDy6WHGP3pe9gWxm0=; b=kKayM7WUAtMp4jkuOJmdLrushyC0bnuRzftEJvsZDJBfb+jpOmHnmMuF7b7o/X3F5PUrMs LS4Aihm5/qtgMWJjc2J6UKz+05ozsOfnJD30bdtl5RXLwGstsqUPHKaWlFKI6vVDTh9WT+ dKNFGCh8AnqtBJR+IyRrNZLKVbwN7/z7MmVkOx8+HFgcyrTSWKPr3bCnZaxNo2tv1MhF5x aOhW7i4V4C8Nc9Ynswy7wBASRwudJczJyzbgH1xyR05HCdF3ljU7RY18u0VY++byOvukXJ FsE2coGck1MN3OxeZvGh1sHwkzCq9vwfMx+Rjf/FLFahp3GqmTPrKnJNw1o1rQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp30wZKz13Pb for ; Wed, 27 May 2026 14:59:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 21e60 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 59d67f2868b1 - main - amd64/i386: Remove dead code to clear XSAVE header 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 59d67f2868b17dc6ae897a3afd3ec4d96301e160 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:23 +0000 Message-Id: <6a1706cb.21e60.4bcaaba0@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=59d67f2868b17dc6ae897a3afd3ec4d96301e160 commit 59d67f2868b17dc6ae897a3afd3ec4d96301e160 Author: John Baldwin AuthorDate: 2026-03-28 11:19:10 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:43:46 +0000 amd64/i386: Remove dead code to clear XSAVE header If XSAVE is being used, the XSAVE header will be overwritten either by copying it from the parent thread in copy_thread for user threads, or by a fresh copy from fpu/npx_initialstate on the first use of the FPU for kernel threads. Reviewed by: kib Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/amd64/amd64/vm_machdep.c | 6 ------ sys/i386/i386/vm_machdep.c | 6 ------ 2 files changed, 12 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index e37f122dffa3..8121a17d885a 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -375,18 +375,12 @@ void cpu_thread_alloc(struct thread *td) { struct pcb *pcb; - struct xstate_hdr *xhdr; set_top_of_stack_td(td); td->td_pcb = pcb = get_pcb_td(td); td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); pcb->pcb_save = get_pcb_user_save_pcb(pcb); - if (use_xsave) { - xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); - bzero(xhdr, sizeof(*xhdr)); - xhdr->xstate_bv = xsave_mask; - } } void diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 003f00070bff..bf08f7dd3882 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -373,7 +373,6 @@ void cpu_thread_alloc(struct thread *td) { struct pcb *pcb; - struct xstate_hdr *xhdr; /* * The -VM86_STACK_SPACE (-16) is so we can expand the trapframe @@ -384,11 +383,6 @@ cpu_thread_alloc(struct thread *td) VM86_STACK_SPACE) - 1; pcb->pcb_ext = NULL; pcb->pcb_save = get_pcb_user_save_pcb(pcb); - if (use_xsave) { - xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); - bzero(xhdr, sizeof(*xhdr)); - xhdr->xstate_bv = xsave_mask; - } } void From nobody Wed May 27 14:59:24 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 4gQXp445gvz6f8rT for ; Wed, 27 May 2026 14:59:24 +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 4gQXp41wPvz3HLv for ; Wed, 27 May 2026 14:59:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893964; 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=69FZKbZLdKwYCqq29GhMU0dAzKpztr/M2IRtxMJ4fpU=; b=nBN0sm5dOVPaer9N38nFdoCwMpiZ2VcoOfVtittDtiv8C6cytt/fSzDQST5n23bmy97Hoq gtPBg6pi87oXE848lb674IveLw3/3M/UdhzjzS6xJh/9O4LhywzZQtaINbDuBZFVmueWH4 ++5vEiEOtcNmyTw4JSsg+vcz+wxuCcxNscU1p8jpEpqafOsl+0s7Pmk5O+piV0C7tcLkKB fdeTkzwxAfcfTqcUoiKzWIUmVWJF8yetwvSk2QHo8nzVhyJ4tbTifvGAI0cxOM6Qnm9TnC g/PdqERBq3xwH3facNBfUIIGBVh+HMkyXrcAQTXimrUdgSOylTMooQvMS+J06g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893964; a=rsa-sha256; cv=none; b=dD+q1XIAl22PFZVpqjDOJm8+MFzhMqpQ19IsFvyJ7WSwsn96Fgi+qPIA66FBG9NFKVQggx Oo2YAgx9I3sYMaBlI+J/CxllykWyHwhA4sc7e1n9FGuMRtJyDRjwTYySgSBDxp5u2OUBsE 7Q6znQfkqk9BBjYvmeTpj+WMaPOZBkHJysHyV5Lkug0WVAbuRCFL7b9pH2mhKi+x5oyzxs uKNbP8OmOInDwCRIY+guIwasbBoQti6uB0v0RdWYH2FTfv4cTT9pgC8iLDlXUcHknY6gcc 75L3UqVaEfME5HSXFF63tBttChO3vyYjdWoaAhxkhSzP+JlnJlJpNWj1hF2E1g== 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=1779893964; 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=69FZKbZLdKwYCqq29GhMU0dAzKpztr/M2IRtxMJ4fpU=; b=xC4A2y2Y1yAZ8eShE9GAZdKxkc8zWc+CZB3+QF69+3xCrVfANhldWSCEwN4s9zGxHgsj0+ Bn3acHvP0Twl77XBmcraoUhiW8cmG202C78jg/o6xL+W0Ha4VhdChGzaxcxfaFoajYBVxc vXVhKi9F9HmB/9bK/RsLiRCpI8j3n4beaKzptD2wg4D/pomYUe2JyWOa5y+Gt5Q60r7uEi 2jkbMUq+TJXhuwMtcvIO+DicKvl301TRSE8kgz2kprw1O4GKffYBzgCYAS/oiiYQ8Crr82 DASrvoelxTdEHXQUriZLsTNf/Na0X28UmNAY8JEazRh3E85o3TXdlBojnMgMCA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp41TcWz131h for ; Wed, 27 May 2026 14:59:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23664 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 2893bb741b4b - main - cpu_thread_new_kstack: Introduce new MD callback 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2893bb741b4bb67bde9ee27e5f18ea5715e3f0e9 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:24 +0000 Message-Id: <6a1706cc.23664.1f39b403@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2893bb741b4bb67bde9ee27e5f18ea5715e3f0e9 commit 2893bb741b4bb67bde9ee27e5f18ea5715e3f0e9 Author: John Baldwin AuthorDate: 2026-03-28 13:56:24 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:45:22 +0000 cpu_thread_new_kstack: Introduce new MD callback Previously, the cpu_thread_alloc callback was invoked each time a kernel stack was allocated for a thread. This included thread creation, but it was also invoked if a recycled thread had to allocate a new kstack. This means that cpu_thread_alloc could be called multiple times for a single thread, but cpu_thread_free is only called once. Not only that, but the cpu_thread_alloc callback can't tell if it is being invoked on a new thread object, or a recycled thread. Calling *_alloc multiple times on an object is also atypical for kernel APIs. As a result of this confusion, amd64 was potentially leaking an XSAVE buffer each time a new kstack was allocated for an existing thread, since cpu_thread_alloc for amd64 always allocated a new XSAVE buffer. In practice, this edge case is probably rare. A process object needs to be recycled where either the new or old process is a kernel process with a non-default kernel stack size. Nevertheless, to ease the confusion, redefine cpu_thread_alloc to only be called once when a new thread is allocated. The new callback, cpu_thread_new_kstack is invoked each time a kstack is allocated for a thread, including both at thread creation time and if a recycled thread allocates a new kstack. The new callback should set any fields whose value is dependent on td_kstack (e.g. the user frame in td_frame, or td_pcb if the PCB is allocated on the kstack). Reviewed by: kib, andrew (arm changes) Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- share/man/man9/Makefile | 1 + share/man/man9/cpu_machdep.9 | 28 ++++++++++++++++++++++------ sys/amd64/amd64/vm_machdep.c | 9 +++++++-- sys/arm/arm/vm_machdep.c | 5 +++++ sys/arm64/arm64/vm_machdep.c | 6 +++++- sys/i386/i386/vm_machdep.c | 5 +++++ sys/kern/kern_thread.c | 3 ++- sys/powerpc/powerpc/exec_machdep.c | 5 +++++ sys/riscv/riscv/vm_machdep.c | 5 ++--- sys/sys/proc.h | 1 + 10 files changed, 55 insertions(+), 13 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 7044b6f1bb68..894a9971295c 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -943,6 +943,7 @@ MLINKS+=cpu_machdep.9 cpu_copy_thread.9 \ cpu_machdep.9 cpu_thread_clean.9 \ cpu_machdep.9 cpu_thread_exit.9 \ cpu_machdep.9 cpu_thread_free.9 \ + cpu_machdep.9 cpu_thread_new_kstack.9 \ cpu_machdep.9 cpu_throw.9 \ cpu_machdep.9 cpu_update_pcb.9 MLINKS+=cpuset.9 CPUSET_T_INITIALIZER.9 \ diff --git a/share/man/man9/cpu_machdep.9 b/share/man/man9/cpu_machdep.9 index 415d86a8b766..514f3f0104cc 100644 --- a/share/man/man9/cpu_machdep.9 +++ b/share/man/man9/cpu_machdep.9 @@ -8,7 +8,7 @@ .\" Technology), and Capabilities Limited under Defense Advanced Research .\" Projects Agency (DARPA) Contract No. FA8750-24-C-B047 ("DEC"). .\" -.Dd January 31, 2025 +.Dd May 27, 2026 .Dt cpu_machdep 9 .Os .Sh NAME @@ -31,6 +31,7 @@ .Nm cpu_thread_clean , .Nm cpu_thread_exit , .Nm cpu_thread_free , +.Nm cpu_thread_new_kstack , .Nm cpu_throw , .Nm cpu_update_pcb .Nd machine-dependent interfaces to handle CPU and thread state @@ -84,6 +85,8 @@ .Ft void .Fn cpu_thread_free "struct thread *td" .Ft void +.Fn cpu_thread_new_kstack "struct thread *td" +.Ft void .Fn cpu_throw "struct thread *old" "struct thread *new" .Ft void .Fn cpu_update_pcb "struct thread *td" @@ -366,19 +369,25 @@ When the process object is later reused for a new process in .Xr fork 2 , the kernel recycles that last thread object and uses it as the initial thread in the new process. -When a thread is recycled, some of the steps in the thread allocation -and free cycle are skipped as an optimization. +When a thread is recycled, a new kernel stack may be allocated if +the existing kernel stack is not suitable for the new process. .Pp .Fn cpu_thread_alloc initializes machine-dependent fields in .Fa td +when allocating a new thread object. +.Pp +.Fn cpu_thread_new_kstack +initializes kernel stack-related machine-dependent fields in +.Fa td after allocating a new kernel stack. This function typically sets the .Fa td_pcb +.Pq on architectures which store the pcb in the kernel stack and initial .Fa td_frame pointers. -.Fn cpu_thread_alloc +.Fn cpu_thread_new_kstack is called both when allocating a new thread object and when a recycled thread allocates a new kernel stack. Note that this function is @@ -386,12 +395,19 @@ Note that this function is called if a recycled thread reuses its existing kernel stack. .Pp .Fn cpu_thread_clean -releases any machine-dependent resources for the last thread in a +releases machine-dependent resources for the last thread in a process during .Xr wait 2 . -The thread is a candidate for recycling so should be reset to run as a +Since the thread is a candidate for recycling, +machine-dependent fields should be reset to run as a new thread in case it is recycled by a future .Xr fork 2 . +In particular, +if the thread reuses its existing kernel stack, +no other +.Fn cpu_thread_* +function will be invoked before the thread is reused as the main +thread of a new process. .Pp .Fn cpu_thread_exit cleans any machine-dependent state in diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 8121a17d885a..2df53285d71d 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -376,13 +376,18 @@ cpu_thread_alloc(struct thread *td) { struct pcb *pcb; - set_top_of_stack_td(td); td->td_pcb = pcb = get_pcb_td(td); - td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; td->td_md.md_usr_fpu_save = fpu_save_area_alloc(); pcb->pcb_save = get_pcb_user_save_pcb(pcb); } +void +cpu_thread_new_kstack(struct thread *td) +{ + set_top_of_stack_td(td); + td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; +} + void cpu_thread_free(struct thread *td) { diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index b1197255c281..559c90509f11 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -240,6 +240,11 @@ cpu_thread_exit(struct thread *td) void cpu_thread_alloc(struct thread *td) +{ +} + +void +cpu_thread_new_kstack(struct thread *td) { td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE) - 1; diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 01542848ab56..4fe7c76d473d 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -260,12 +260,16 @@ cpu_thread_exit(struct thread *td) void cpu_thread_alloc(struct thread *td) { + ptrauth_thread_alloc(td); +} +void +cpu_thread_new_kstack(struct thread *td) +{ td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE) - 1; td->td_frame = (struct trapframe *)STACKALIGN( (struct trapframe *)td->td_pcb - 1); - ptrauth_thread_alloc(td); } void diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index bf08f7dd3882..d59d98542241 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -371,6 +371,11 @@ cpu_thread_clean(struct thread *td) void cpu_thread_alloc(struct thread *td) +{ +} + +void +cpu_thread_new_kstack(struct thread *td) { struct pcb *pcb; diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index ec65bd16dd50..15a327e66c7d 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -803,6 +803,7 @@ thread_alloc(int pages) kasan_thread_alloc(td); kmsan_thread_alloc(td); cpu_thread_alloc(td); + cpu_thread_new_kstack(td); EVENTHANDLER_DIRECT_INVOKE(thread_ctor, td); return (td); } @@ -815,7 +816,7 @@ thread_recycle(struct thread *td, int pages) vm_thread_dispose(td); if (!vm_thread_new(td, pages)) return (ENOMEM); - cpu_thread_alloc(td); + cpu_thread_new_kstack(td); } kasan_thread_alloc(td); kmsan_thread_alloc(td); diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index 00c04b4ddbaa..1778737be610 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -1079,6 +1079,11 @@ cpu_thread_clean(struct thread *td) void cpu_thread_alloc(struct thread *td) +{ +} + +void +cpu_thread_new_kstack(struct thread *td) { struct pcb *pcb; diff --git a/sys/riscv/riscv/vm_machdep.c b/sys/riscv/riscv/vm_machdep.c index e718d522e572..b078695ae718 100644 --- a/sys/riscv/riscv/vm_machdep.c +++ b/sys/riscv/riscv/vm_machdep.c @@ -58,8 +58,8 @@ #define TP_OFFSET 16 /* sizeof(struct tcb) */ #endif -static void -cpu_set_pcb_frame(struct thread *td) +void +cpu_thread_new_kstack(struct thread *td) { td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE) - 1; @@ -228,7 +228,6 @@ cpu_thread_exit(struct thread *td) void cpu_thread_alloc(struct thread *td) { - cpu_set_pcb_frame(td); } void diff --git a/sys/sys/proc.h b/sys/sys/proc.h index b560ea2e8020..3f2af5583a19 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1246,6 +1246,7 @@ void cpu_thread_alloc(struct thread *); void cpu_thread_clean(struct thread *); void cpu_thread_exit(struct thread *); void cpu_thread_free(struct thread *); +void cpu_thread_new_kstack(struct thread *); struct thread *thread_alloc(int pages); int thread_check_susp(struct thread *td, bool sleep); void thread_cow_get_proc(struct thread *newtd, struct proc *p); From nobody Wed May 27 14:59:18 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 4gQXp40s2qz6f8rQ for ; Wed, 27 May 2026 14:59:24 +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 4gQXp36l7nz3HLq for ; Wed, 27 May 2026 14:59:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dq2g9OVzes1aELdiSOfdn/f30/0W5C6JQ+FlsxnTigU=; b=aoGN1RYrrfSrzKq+3JnuIdYDKF72bhYWBYv3Vv6oK99toZCcAYTxCHQsEb4xnWZe1gicil x/pUZitoL0glTi9CS4v+gr8g2zRyhkxmfUE6QMsDWpNkp8bss80VE0QBC/RGROP0l0THIw NNMD+3w2OJ8D89P6C7WQl98FthINL7iEuJ+BTPCVW0R/FVG43PuztQcK7NoguGUcWUMtTq xn5dp4osbcmY5bQpRu4bHRkh9ZCX18jYZm/GLjmyifbTLmQ2XtDVP8kd6/WRetjZrnp4cM OQUFGfizN8Z486XvsvuhoC4wK2DxgUsqJfqMnXblPu2WgcydQ39AM2zFyZxZQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893963; a=rsa-sha256; cv=none; b=H3JkLT80Jhf5EoeyrYZNu9USP0CYEJeHwKsmjpt5FmJbtVx7TVgyE4CFJOf3ynsc/1Nuig ZcpC5PC1bVGjfidTUeF8scss/jsDnQbFYN731c0CFWaalSZJD0YPxyCr2++rrCW5+UcitZ qMHFfSt8bCG45xBsqvS6COrG+jmtwtu/geThpBCWXuRdFC+25Bzw3DqU8pu76mw3n3qcJ/ KThbr9uFaw7wgLU1vRzH/nWALuw9pxrujXeQ0CbE9gYQDzXDn8/DxrPyMx6YXglJVAGGbI o+A9tzW3F4KrkV845TfV9Eo9xVTSUrPXZIND6e6WdPP9QlVupWX8ZfekHGfuvQ== 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=1779893963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dq2g9OVzes1aELdiSOfdn/f30/0W5C6JQ+FlsxnTigU=; b=ZcsVHENsPyfecullFSLeKMrQrcs0A4LmTrHSpi06A7P1bctAGFXR5qy32TdW7it69wdTQ2 ys69duiK5M91OPm1zJQjlCtDrfmqcqEOz0RMZUHc06QzT5JO9ESLNBsB4Ld0cGpUEZgnj3 SLMiQFjykzjzYhwIXEFszWYnTvNHxPEP0z7Q0y+iIZcZrmVL7uXwPS2FHh/oWX+gM4U+75 /ZB0jpQZYwR/cJJgNok9+CdP0+bljn1WOqEXG1qbIlEIdV3ckebx0Of9SzJog1qpSY0vqj M+g0kkGcGs79DuFkI9TKEXr62FWQFGn0hm7CatO4BrNCrhbpODSD/jYkC0UKQw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp368JPz1460 for ; Wed, 27 May 2026 14:59:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22d42 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Alfredo Mazzinghi From: John Baldwin Subject: git: a1e07f21dc74 - main - arm64: Adjust the kernel stack pointer at the end of fork_trampoline 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1e07f21dc7458d85bd0d04c294f0389d4591666 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:18 +0000 Message-Id: <6a1706c6.22d42.2f82f92c@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a1e07f21dc7458d85bd0d04c294f0389d4591666 commit a1e07f21dc7458d85bd0d04c294f0389d4591666 Author: Alfredo Mazzinghi AuthorDate: 2026-04-22 23:46:14 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:43:09 +0000 arm64: Adjust the kernel stack pointer at the end of fork_trampoline All other paths that return from the kernel to userspace pop the user trapframe off of the kernel stack pointer before returning to userspace in restore_registers. fork_trampoline was missing this, so all of the user faults after fork pushed another trapframe leaving a trapframe's worth of wasted space on the kstack. This would be fatal after a future change to remove duplicate initialization of td_frame in cpu_fork() as without this fix each time a thread was recycled it would "lose" another trapframe's worth of space. Reviewed by: kib, andrew Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/arm64/arm64/swtch.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index b3bf88135e57..0cc0d7462ae6 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -276,6 +276,8 @@ ENTRY(fork_trampoline) ldp x26, x27, [sp, #TF_X + 26 * 8] ldp x28, x29, [sp, #TF_X + 28 * 8] + add sp, sp, #(TF_SIZE) + /* * No need for interrupts reenabling since PSR * will be set to the desired value anyway. From nobody Wed May 27 14:59:25 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 4gQXp60wfZz6f8pf for ; Wed, 27 May 2026 14:59:26 +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 4gQXp52lZNz3HX7 for ; Wed, 27 May 2026 14:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893965; 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=P9lDJELIgFGVdpqTnQK2oCoK+ByZxzMEbvRmpp3wSVg=; b=fwLaPBoCKOghxcqNscIICKaJGq8waywHC9JtGUgsnnm6HsN20Rv5TsoSw0rg0X+d+OMCjZ 4RpomHSceeSgOhr98SWtqILtol+pxZToL20RD+a3qv3CUD5hRjYHe7slfVxDOutPm3aScM 7SKMmvKRPKIk506AcKmrJ0W7IKmwjv12rp5uGe6idUvs5orgFtUE2HL6tgsgZaftPuc399 RyJa7kr37MCYMIs9zH3fUO001lao6X05sFX4KrTx+NwrhMUcPBl3EmVvoyWLYp0mUg1xGG N03XMa/6ty3koT0S/37kHv5AQ3BHMWMXsNLeScc7y7bNc4PBzadUyb8+HfGgvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893965; a=rsa-sha256; cv=none; b=VkCFIocA8sthHoH+gDAJuS6YdqZ1nMy/lPnqnHzZvK1tmnADbIwtcAfh02CeG86MxqIOHi GNTyv696Plp9GmzRsj6sfWU8erJWsgIufyKbcvVbyNGwThTRuRsX5tsCiZQFp5laXMTgVc Zhx+U17gmkpcaq/eM3J2zjTzG3dzeuSzTyfPcrOYk5QrTSKCeZeGY+Hm/VOhwHKvknqOTv +cFIF7hpTaj/nv6Qc1UTk1RHrd3kAlJC/DSSFNNiQuqjidFDmO8LtQL6WjulRG3nMjlvzQ nUeMNMVWc36MzNviu8v6CsCDrM1mSvGDGagJDC42iABAR2CfYD2+E1YRYwGGFQ== 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=1779893965; 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=P9lDJELIgFGVdpqTnQK2oCoK+ByZxzMEbvRmpp3wSVg=; b=ypTq4OCYOBIc5uvsJMj5YRr9Eso/YXaC0I5QKx3jWBltcxlevxFG9MUv1coLzHFGwIAISk 40Ai8d2Uw6SKcQn0qTrNZw1RU99ym0mb88yH/8tTZarrdJpU1LWrCuQDBFKFAbqI96wd9H weEkn9HKgTEb3RIsRjh1Y1c9Mh9pyfKHPin0bX4Bsv0BAT2HCqQLNHCRCUiatVnBBHowLD vAArfubTbxHIE1kkAPJQWNcNbROtE8rNCwtnylFz5dw/i+CiSEYka0bDKJXbyw6QSAp2tr 8kFIa+dsaLIEjxt8/VEpE67Hwzvw+kcF3cPzYtF9ud5DtusYKGht+n8DpOy0dw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp522Fbz1462 for ; Wed, 27 May 2026 14:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 246ad by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: f7524d8fcbd7 - main - amd64: Inline set_top_of_stack_td into cpu_thread_new_kstack 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7524d8fcbd76a432c163200a7c77ce964805beb Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:25 +0000 Message-Id: <6a1706cd.246ad.1498e044@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=f7524d8fcbd76a432c163200a7c77ce964805beb commit f7524d8fcbd76a432c163200a7c77ce964805beb Author: John Baldwin AuthorDate: 2026-05-05 14:43:10 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:45:25 +0000 amd64: Inline set_top_of_stack_td into cpu_thread_new_kstack Reviewed by: kib Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/amd64/amd64/machdep.c | 2 +- sys/amd64/amd64/vm_machdep.c | 10 ++-------- sys/amd64/include/md_var.h | 1 - 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 20c4be7880ff..510c6d375a2d 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1369,6 +1369,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) thread0.td_kstack_pages = kstack_pages; kstack0_sz = thread0.td_kstack_pages * PAGE_SIZE; bzero(thread0.td_kstack, kstack0_sz); + cpu_thread_new_kstack(&thread0); physfree += kstack0_sz; /* @@ -1521,7 +1522,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) * We initialize the PCB pointer early so that exception * handlers will work. */ - set_top_of_stack_td(&thread0); thread0.td_pcb = get_pcb_td(&thread0); /* diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 2df53285d71d..244d82ee8ebb 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -83,13 +83,6 @@ _Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); -void -set_top_of_stack_td(struct thread *td) -{ - td->td_md.md_stack_base = td->td_kstack + - td->td_kstack_pages * PAGE_SIZE; -} - struct savefpu * get_pcb_user_save_td(struct thread *td) { @@ -384,7 +377,8 @@ cpu_thread_alloc(struct thread *td) void cpu_thread_new_kstack(struct thread *td) { - set_top_of_stack_td(td); + td->td_md.md_stack_base = td->td_kstack + + td->td_kstack_pages * PAGE_SIZE; td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; } diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 46a30518b212..4b98c5d8c418 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -94,7 +94,6 @@ void gsbase_load_fault(void) __asm(__STRING(gsbase_load_fault)); void fpstate_drop(struct thread *td); void pagezero(void *addr); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); -void set_top_of_stack_td(struct thread *td); struct savefpu *get_pcb_user_save_td(struct thread *td); struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); void pci_early_quirks(void); From nobody Wed May 27 14:59:26 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 4gQXp7137Cz6f930 for ; Wed, 27 May 2026 14:59:27 +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 4gQXp63S4Rz3HDl for ; Wed, 27 May 2026 14:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893966; 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=q3j3tQGQRZ1+7PpivKbIlzfTjXYWhAWnRjNcpN14pMA=; b=iBLR1d38E+e71CLqYQ+OhauDC459SU/Ul8AKWInJbvmQ2u3otHiSfZQa4oxOfA0qVT4a/s sQx7QxLDSTkTsi7OXFw14G9xtd11CjcUAVflBeAtsrMn7dB2ggiTmgnghr2PnK0Z2/5fCf koCHzy52W7JTblYxdhzAMvKCL+Mcu7xoQ/8hX6dzcKGuWzvUON4ipnxILCDjvbU8jASL9z 6JjXut6AkHgagHPYlPrtQndQy/vw7f4I5xiScFFqeo8qrsVesioU+CxuxfX8yMDcFoZjUF oOpAA9/Nwq7xqrtiK4arAEUJNOKITb45npScLacFTsHcYyQYJnZvmFcpWpiF4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893966; a=rsa-sha256; cv=none; b=P9aIuCKY/Q4PBE3gQ6gDAhtmEz+KVTLRETLqCqAhofkOTgD5yw50i/la43t4P7/At3mpUF B8u0TlRl/jbjpTVO8SjLyFYPeQ4Dc13szntw35Xb/ZSX6vq8hbcTpVzUprCrG8EDxDPbDt zH5tCE5I0+IRfuDCyjItDXSY6z11SZPcqB/Ej22w+w5HeRyuxzO6WA9Nd6uB1ypCPdG0Ni pFEfkXgaNySU71z7bWyTHnWiDYkKkHX6QqydfZuQ8SQ8EZOjoG+jvzd61YLo8u8hedGjL0 F1Y7oFqAR+5m02HG/5Se+HkBcoYnf8DMj9f5UYb2Fy1h3KHeYW9qOfE5HAdd6A== 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=1779893966; 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=q3j3tQGQRZ1+7PpivKbIlzfTjXYWhAWnRjNcpN14pMA=; b=kfomSSug2MVKpBufBUQRDdTaJowmyzL/20si8gWPSpdLhioeTtdUFmEmFg5wH108Jky8mY bUH7jJTiSeXay3Wk0DH42+bax3Wuuh8AgR9ae5gBwhYO9SB+Y5xz7ZnEUTtqzdMlCgKQ5U kAsuw1gkCw10AygZ1vPydxmLkq5MiJrRxi9QfbPJ5ZF9GY99YCxJCmUD70y35bJrCfP9Wn QWD3Z0e/3Z5ArJQGebvb8jJEPrEoty5c7ivFcEcj28aT5A7eReCwPpiSgI6j/Y8WEIuvVM ZYmTLDq/jjnBkPQEnTjMGOO5i+A01BQCTAd9tRrpn9I7qC0d/JY+P7evZ6B/QA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp62q5Hz14C5 for ; Wed, 27 May 2026 14:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2247f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: fce595344c51 - main - arm64 locore: Fix a comment typo: Of -> If 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fce595344c51850a7113430c77e70c8777383a98 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:26 +0000 Message-Id: <6a1706ce.2247f.79a08f14@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fce595344c51850a7113430c77e70c8777383a98 commit fce595344c51850a7113430c77e70c8777383a98 Author: John Baldwin AuthorDate: 2026-03-26 13:03:51 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:45:26 +0000 arm64 locore: Fix a comment typo: Of -> If Reviewed by: kib, andrew Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/arm64/arm64/swtch.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index 0cc0d7462ae6..af2c278baecf 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -75,7 +75,7 @@ * void cpu_throw(struct thread *old, struct thread *new) */ ENTRY(cpu_throw) - /* Of old == NULL skip disabling stepping */ + /* If old == NULL skip disabling stepping */ cbz x0, 1f /* If we were single stepping, disable it */ From nobody Wed May 27 14:59:27 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 4gQXp8023Zz6f98L for ; Wed, 27 May 2026 14:59:28 +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 4gQXp745kHz3HVj for ; Wed, 27 May 2026 14:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893967; 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=eJNByQKZcvPUVvzbD+ejh0q5TLtwEoRnVlyYUsz1V/4=; b=rKBmy51q0MGfKqHJj5MhOehlSVjNrRfoSBtQfUchk4G+8Jb5jy0A/OPiBy8Xo2zUCCM2c2 R4dhR84JbFrnVJcCN72ZtM20cpVLhU1IVTxcdWfHz/pN6DA2ZXBO92m1vARRCDwtfW32WE 8MCOshm4F0wlWefsth+M/JGz/FoBb8Lz7YE/OFI76p3uSXEwzGjD3hlBon6pdO9frovDoa /xBQSvvs1idlndeUIgYQJGEAgyPcHb8p3PvNPup1hBQAx1/e67AVtAsI/WbjlBcG5blN4u 0WqLIWrG4cZABcl3YCgkxoyNiOGichmQuwTCeF54vN0f2I3UTpNeD5ebGph31Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893967; a=rsa-sha256; cv=none; b=dBkk0tYSJsUwCDO7dmQzcWn/p1fNSrI31LyoyaNj82bSRUyb4GiEGFksCn4EutY2ddXKGp VqHKLOZ39D6mfYmONdqJ5iRKjMNSW5rMiq/9JobnEeI3o2zV0qkWlFzaEXm/PW0vV3Ni/e /Ri5OJTIInxnbCX0GAdWI5VQEfW+2tGUhWBRKoiIjAVtsQzpLMEssg4O35KHlE+l/JDrC2 oeBHoV7H0OULfMD+WEsDaoxE3fY/UZmBhGIKLilPol8pnSs9IOr0noMhKN+HMtufx9AQ/z /T4et30ZRHGlc/nXQYWutvjob4GiyFfXrAU/7fEBxLydvH0EcWY1U3gLpnpyzg== 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=1779893967; 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=eJNByQKZcvPUVvzbD+ejh0q5TLtwEoRnVlyYUsz1V/4=; b=dsMQpK6A4bhUDchaxN5XPaYK/lAAlYermYdMD13fB3cyMbKA7GyRRi2evqiyjJ935XAl/f aC3h4qmCcFQfnRmS/UH4cUMt05LihFWJidToz3NenFpGAMp5kb+ho1bx0+gL27ygCGJ3vG HNR9MWaefrypGI7CnIe74eMEYUdIdh3jYUoTIgkBlZzCciRCYohSszWh8aYYUkGmPx9bsu OxgMZVAYunBchIwWiQllTdndWFHulktQNQXGUqnTrP01x9B8HUyc1E8NDYWAbIAKZO9wWY 65cNR8KCfRSMpNvmO8XLiIaqC7AIWUf5ss+DHJVj2yho+7HvK0/ZjfyhLNnyDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp73dTjz13Pd for ; Wed, 27 May 2026 14:59:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 246b1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 8b9023cfc185 - main - sys: Add td_kstack_top inline helper function 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b9023cfc1851a18518111d286ebd59b573008c1 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:27 +0000 Message-Id: <6a1706cf.246b1.211fb9ff@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8b9023cfc1851a18518111d286ebd59b573008c1 commit 8b9023cfc1851a18518111d286ebd59b573008c1 Author: John Baldwin AuthorDate: 2026-04-27 19:04:22 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:45:26 +0000 sys: Add td_kstack_top inline helper function This function returns a pointer to the top of the kstack. Reviewed by: kib, andrew (arm changes) Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/amd64/amd64/vm_machdep.c | 3 +-- sys/amd64/include/stack.h | 6 ++---- sys/arm/arm/machdep.c | 3 +-- sys/arm/arm/vm_machdep.c | 3 +-- sys/arm/include/stack.h | 3 +-- sys/arm64/arm64/machdep.c | 3 +-- sys/arm64/arm64/vm_machdep.c | 3 +-- sys/arm64/include/stack.h | 3 +-- sys/ddb/db_ps.c | 3 +-- sys/i386/i386/machdep.c | 4 ++-- sys/i386/i386/vm_machdep.c | 4 ++-- sys/powerpc/include/stack.h | 3 +-- sys/powerpc/powerpc/exec_machdep.c | 4 ++-- sys/powerpc/powerpc/machdep.c | 4 ++-- sys/riscv/include/stack.h | 3 +-- sys/riscv/riscv/machdep.c | 3 +-- sys/riscv/riscv/vm_machdep.c | 3 +-- sys/sys/proc.h | 6 ++++++ sys/vm/vm_glue.c | 2 +- 19 files changed, 29 insertions(+), 37 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 244d82ee8ebb..1de891680f94 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -377,8 +377,7 @@ cpu_thread_alloc(struct thread *td) void cpu_thread_new_kstack(struct thread *td) { - td->td_md.md_stack_base = td->td_kstack + - td->td_kstack_pages * PAGE_SIZE; + td->td_md.md_stack_base = td_kstack_top(td); td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; } diff --git a/sys/amd64/include/stack.h b/sys/amd64/include/stack.h index 3c27266b775b..765a8e78daed 100644 --- a/sys/amd64/include/stack.h +++ b/sys/amd64/include/stack.h @@ -13,16 +13,14 @@ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ (total) = td->td_kstack_pages * PAGE_SIZE; \ - (used) = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - \ - (char *)&td; \ + (used) = td_kstack_top(td) - (char *)&td; \ } while (0) static __inline bool kstack_contains(struct thread *td, vm_offset_t va, size_t len) { return (va >= (vm_offset_t)td->td_kstack && va + len >= va && - va + len <= (vm_offset_t)td->td_kstack + td->td_kstack_pages * - PAGE_SIZE); + va + len <= (vm_offset_t)td_kstack_top(td)); } #endif /* _SYS_PROC_H_ */ diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index a06e6773cd49..989adef3478d 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -378,8 +378,7 @@ init_proc0(void *kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; thread0.td_kstack_pages = kstack_pages; - thread0.td_pcb = (struct pcb *)(thread0.td_kstack + - thread0.td_kstack_pages * PAGE_SIZE) - 1; + thread0.td_pcb = (struct pcb *)td_kstack_top(&thread0) - 1; thread0.td_pcb->pcb_flags = 0; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_vfpcpu = -1; diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 559c90509f11..a8a4b6b8c7be 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -246,8 +246,7 @@ cpu_thread_alloc(struct thread *td) void cpu_thread_new_kstack(struct thread *td) { - td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * - PAGE_SIZE) - 1; + td->td_pcb = (struct pcb *)td_kstack_top(td) - 1; /* * Ensure td_frame is aligned to an 8 byte boundary as it will be * placed into the stack pointer which must be 8 byte aligned in diff --git a/sys/arm/include/stack.h b/sys/arm/include/stack.h index e80d3dc060fd..6af9418aba42 100644 --- a/sys/arm/include/stack.h +++ b/sys/arm/include/stack.h @@ -76,8 +76,7 @@ static __inline bool kstack_contains(struct thread *td, vm_offset_t va, size_t len) { return (va >= (vm_offset_t)td->td_kstack && va + len >= va && - va + len <= (vm_offset_t)td->td_kstack + td->td_kstack_pages * - PAGE_SIZE - sizeof(struct pcb)); + va + len <= (vm_offset_t)td_kstack_top(td) - sizeof(struct pcb)); } #endif /* _SYS_PROC_H_ */ diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index d219c737c215..6b6dd2c510a2 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -443,8 +443,7 @@ init_proc0(void *kstack) #if defined(PERTHREAD_SSP) thread0.td_md.md_canary = boot_canary; #endif - thread0.td_pcb = (struct pcb *)(thread0.td_kstack + - thread0.td_kstack_pages * PAGE_SIZE) - 1; + thread0.td_pcb = (struct pcb *)td_kstack_top(&thread0) - 1; thread0.td_pcb->pcb_flags = 0; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 4fe7c76d473d..29a1c8667e7d 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -266,8 +266,7 @@ cpu_thread_alloc(struct thread *td) void cpu_thread_new_kstack(struct thread *td) { - td->td_pcb = (struct pcb *)(td->td_kstack + - td->td_kstack_pages * PAGE_SIZE) - 1; + td->td_pcb = (struct pcb *)td_kstack_top(td) - 1; td->td_frame = (struct trapframe *)STACKALIGN( (struct trapframe *)td->td_pcb - 1); } diff --git a/sys/arm64/include/stack.h b/sys/arm64/include/stack.h index 19e9e837e3ee..b89019fbbec6 100644 --- a/sys/arm64/include/stack.h +++ b/sys/arm64/include/stack.h @@ -51,8 +51,7 @@ static __inline bool kstack_contains(struct thread *td, vm_offset_t va, size_t len) { return (va >= (vm_offset_t)td->td_kstack && va + len >= va && - va + len <= (vm_offset_t)td->td_kstack + td->td_kstack_pages * - PAGE_SIZE - sizeof(struct pcb)); + va + len <= (vm_offset_t)td_kstack_top(td) - sizeof(struct pcb)); } #endif /* _SYS_PROC_H_ */ diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c index 8e027997ea75..59dcde453b93 100644 --- a/sys/ddb/db_ps.c +++ b/sys/ddb/db_ps.c @@ -358,8 +358,7 @@ DB_SHOW_COMMAND(thread, db_show_thread) if (td->td_name[0] != '\0') db_printf(" name: %s\n", td->td_name); db_printf(" pcb: %p\n", td->td_pcb); - db_printf(" stack: %p-%p\n", td->td_kstack, - td->td_kstack + td->td_kstack_pages * PAGE_SIZE - 1); + db_printf(" stack: %p-%p\n", td->td_kstack, td_kstack_top(td) - 1); db_printf(" flags: %#x ", td->td_flags); db_printf(" pflags: %#x\n", td->td_pflags); db_printf(" state: "); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index f9afb9afe45f..71992f18e8fb 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1492,8 +1492,8 @@ init386(int first) PCPU_SET(fsgs_gdt, &gdt[GUFS_SEL].sd); /* Initialize the tss (except for the final esp0) early for vm86. */ - common_tss0.tss_esp0 = (vm_offset_t)thread0.td_kstack + - thread0.td_kstack_pages * PAGE_SIZE - VM86_STACK_SPACE; + common_tss0.tss_esp0 = (vm_offset_t)td_kstack_top(&thread0) - + VM86_STACK_SPACE; common_tss0.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL); common_tss0.tss_ioopt = sizeof(struct i386tss) << 16; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index d59d98542241..72fe83d3fdd4 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -89,7 +89,7 @@ get_pcb_user_save_td(struct thread *td) { char *p; - p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - + p = td_kstack_top(td) - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); KASSERT(__is_aligned(p, XSAVE_AREA_ALIGN), ("Unaligned pcb_user_save area")); @@ -110,7 +110,7 @@ get_pcb_td(struct thread *td) { char *p; - p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - + p = td_kstack_top(td) - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) - sizeof(struct pcb); return ((struct pcb *)p); diff --git a/sys/powerpc/include/stack.h b/sys/powerpc/include/stack.h index 928256b26468..0fb9a929128b 100644 --- a/sys/powerpc/include/stack.h +++ b/sys/powerpc/include/stack.h @@ -46,8 +46,7 @@ static __inline bool kstack_contains(struct thread *td, vm_offset_t va, size_t len) { return (va >= (vm_offset_t)td->td_kstack && va + len >= va && - va + len <= (vm_offset_t)td->td_kstack + td->td_kstack_pages * - PAGE_SIZE - sizeof(struct pcb)); + va + len <= (vm_offset_t)td_kstack_top(td) - sizeof(struct pcb)); } #endif /* _SYS_PROC_H_ */ diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index 1778737be610..18e0ba004a13 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -1087,8 +1087,8 @@ cpu_thread_new_kstack(struct thread *td) { struct pcb *pcb; - pcb = (struct pcb *)__align_down(td->td_kstack + td->td_kstack_pages * - PAGE_SIZE - sizeof(struct pcb), 0x40); + pcb = (struct pcb *)__align_down(td_kstack_top(td) - sizeof(struct pcb), + 0x40); td->td_pcb = pcb; td->td_frame = (struct trapframe *)pcb - 1; } diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index a975bebebaad..e1e0885e3ecf 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -487,8 +487,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, /* * Finish setting up thread0. */ - thread0.td_pcb = (struct pcb *)__align_down(thread0.td_kstack + - thread0.td_kstack_pages * PAGE_SIZE - sizeof(struct pcb), 16); + thread0.td_pcb = (struct pcb *)__align_down(td_kstack_top(&thread0) - + sizeof(struct pcb), 16); bzero((void *)thread0.td_pcb, sizeof(struct pcb)); pc->pc_curpcb = thread0.td_pcb; diff --git a/sys/riscv/include/stack.h b/sys/riscv/include/stack.h index 03b5794c2b13..7de9f05b567b 100644 --- a/sys/riscv/include/stack.h +++ b/sys/riscv/include/stack.h @@ -61,8 +61,7 @@ static __inline bool kstack_contains(struct thread *td, vm_offset_t va, size_t len) { return (va >= (vm_offset_t)td->td_kstack && va + len >= va && - va + len <= (vm_offset_t)td->td_kstack + td->td_kstack_pages * - PAGE_SIZE - sizeof(struct pcb)); + va + len <= (vm_offset_t)td_kstack_top(td) - sizeof(struct pcb)); } #endif /* _SYS_PROC_H_ */ diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index 91219676454b..47d9636492db 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -296,8 +296,7 @@ init_proc0(void *kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; thread0.td_kstack_pages = KSTACK_PAGES; - thread0.td_pcb = (struct pcb *)(thread0.td_kstack + - thread0.td_kstack_pages * PAGE_SIZE) - 1; + thread0.td_pcb = (struct pcb *)td_kstack_top(&thread0) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; diff --git a/sys/riscv/riscv/vm_machdep.c b/sys/riscv/riscv/vm_machdep.c index b078695ae718..1810fe88283c 100644 --- a/sys/riscv/riscv/vm_machdep.c +++ b/sys/riscv/riscv/vm_machdep.c @@ -61,8 +61,7 @@ void cpu_thread_new_kstack(struct thread *td) { - td->td_pcb = (struct pcb *)(td->td_kstack + - td->td_kstack_pages * PAGE_SIZE) - 1; + td->td_pcb = (struct pcb *)td_kstack_top(td) - 1; /* * td->td_frame + TF_SIZE will be the saved kernel stack pointer whilst diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 3f2af5583a19..ed69a09422e2 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1327,6 +1327,12 @@ td_get_sched(struct thread *td) return ((struct td_sched *)&td[1]); } +static __inline char * +td_kstack_top(struct thread *td) +{ + return (td->td_kstack + ptoa(td->td_kstack_pages)); +} + static __inline void ruxreset(struct rusage_ext *rux) { diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 191711ec7765..02e1c993529e 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -739,7 +739,7 @@ intr_prof_stack_use(struct thread *td, struct trapframe *frame) if (TRAPF_USERMODE(frame)) return; - stack_top = td->td_kstack + td->td_kstack_pages * PAGE_SIZE; + stack_top = td_kstack_top(td); current = (char *)&stack_top; /* From nobody Wed May 27 14:59: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 4gQXp91QTJz6f8rd for ; Wed, 27 May 2026 14:59: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 4gQXp85Jjcz3HXp for ; Wed, 27 May 2026 14:59:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893968; 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=TpkKZgG85rbESN8DodtmD38JchDtUhqqdxV+eOgE/w4=; b=PJqcfaqb8vGi1a496WuTqIBIa2YNnbQiBSU5hL91+dlv9JN3kV+ywUkUblFMmnFONN+XRm 8HoUClJ6VUp3AlpSI1JfBD6pWo/+VMNVkPprS/4ZZX2OmEVEgk3n9HVgEtK94TMkzCO1RP QQwYI9RzOhGPRMMow33ri09HEKIPmbhW3jhi6GzdvOfXmHLel309NuuoR/MJC8MzyvA7uI Xk8B010OKaAI56vE/TFmsWX3KOaWLj997mtrGLAyXnTEnOcqY/ShMo6KJboaNZbf+dpt4u jLB5kHayXq7miKdCl49QyQ04Yc9Ma+jd5kC3b3gF/H/mIbAX9CRvcCW8GZ+GLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893968; a=rsa-sha256; cv=none; b=cfMJW2+5no2023cDf7WNof65tDENGdsNpoZqmm8h9umtEWP9Kd187TrBHD4iecwn6aMrqQ HNpcAeabhBRxoIXVlEJ1LW4Pu2MgRVxuCZBuEg39nZPr/K126iPpT3OHmFM2JO4ZbzRlTG AFgLo1PiVZtta+T6ve/BlcJ/0YU7V8kB91Qudub+KNozvltfy6p+S3wgC7Y3zDj/g4ZvdU L2jQ5GHwPv2o5GWyWOU8bx4o/khyy/ydStzcYbdTVsGuA9yDKogokc6iaOhQlLIKbgMEjA ypH2XPlGz5WD8KhIoW3X2C8aPdOymKDkXksGuF1Pi/p506zcmWnAoZFD34Taqw== 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=1779893968; 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=TpkKZgG85rbESN8DodtmD38JchDtUhqqdxV+eOgE/w4=; b=g6SIyfhHnQBymfJWc/Q54dX3yagwJcHUUmAQ8V/B1II4wh7aH4UJ9m+ZKzLugMhBqVhVmT NlnII3D/e+mQWAy1RarI/FIz0jTscIsMlS/VXwo6pSP5f7WEnfiWqLLIet2V/xAzQGfGZg XFwEbsigttZx2Gv18F0H8+rdMNrwN7jKZaVYH+TJcgJy6bR4ACq56aQ8+bT7u1iDWUwXEV VT02PL1zjsp0ynd1QwKvJB6wFOtFB2TwHeh8fwmtov32xgRGJHHC2Y1D6xjTFILMKmin6r gs0XCBOIsqQa5TiH4BgNMvtcrCi+kL5nQnTp5+mjerFmgksjXtBgzrMQKvTV8A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp84R63z13gh for ; Wed, 27 May 2026 14:59:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23e92 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: dcae0f7d7aa6 - main - sys: Consistently use ptoa() with td_kstack_pages 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dcae0f7d7aa67ed6ec6b8da5e1b444a828898595 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:28 +0000 Message-Id: <6a1706d0.23e92.788bff0a@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dcae0f7d7aa67ed6ec6b8da5e1b444a828898595 commit dcae0f7d7aa67ed6ec6b8da5e1b444a828898595 Author: John Baldwin AuthorDate: 2026-04-27 19:05:54 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:45:26 +0000 sys: Consistently use ptoa() with td_kstack_pages Suggested by: kib Reviewed by: kib, andrew (arm changes) Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/amd64/amd64/machdep.c | 2 +- sys/amd64/include/stack.h | 2 +- sys/arm/include/stack.h | 2 +- sys/arm64/include/stack.h | 2 +- sys/powerpc/include/stack.h | 2 +- sys/riscv/include/stack.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 510c6d375a2d..dbad85096a1d 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1367,7 +1367,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) thread0.td_kstack = (char *)physfree - kernphys + KERNSTART; thread0.td_kstack_pages = kstack_pages; - kstack0_sz = thread0.td_kstack_pages * PAGE_SIZE; + kstack0_sz = ptoa(kstack_pages); bzero(thread0.td_kstack, kstack0_sz); cpu_thread_new_kstack(&thread0); physfree += kstack0_sz; diff --git a/sys/amd64/include/stack.h b/sys/amd64/include/stack.h index 765a8e78daed..7d821348be0e 100644 --- a/sys/amd64/include/stack.h +++ b/sys/amd64/include/stack.h @@ -12,7 +12,7 @@ /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE; \ + (total) = ptoa(td->td_kstack_pages); \ (used) = td_kstack_top(td) - (char *)&td; \ } while (0) diff --git a/sys/arm/include/stack.h b/sys/arm/include/stack.h index 6af9418aba42..f6bc67dbe771 100644 --- a/sys/arm/include/stack.h +++ b/sys/arm/include/stack.h @@ -68,7 +68,7 @@ void unwind_module_unloaded(struct linker_file *); /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) diff --git a/sys/arm64/include/stack.h b/sys/arm64/include/stack.h index b89019fbbec6..0aa483e15e64 100644 --- a/sys/arm64/include/stack.h +++ b/sys/arm64/include/stack.h @@ -43,7 +43,7 @@ bool unwind_frame(struct thread *, struct unwind_state *); #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) diff --git a/sys/powerpc/include/stack.h b/sys/powerpc/include/stack.h index 0fb9a929128b..533ff0fa2056 100644 --- a/sys/powerpc/include/stack.h +++ b/sys/powerpc/include/stack.h @@ -38,7 +38,7 @@ extern int end[]; /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) diff --git a/sys/riscv/include/stack.h b/sys/riscv/include/stack.h index 7de9f05b567b..5669dcda6c67 100644 --- a/sys/riscv/include/stack.h +++ b/sys/riscv/include/stack.h @@ -53,7 +53,7 @@ bool unwind_frame(struct thread *, struct unwind_state *); /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) From nobody Wed May 27 14:59:29 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 4gQXpB03Fwz6f98R for ; Wed, 27 May 2026 14:59:30 +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 4gQXp95pVxz3HXx for ; Wed, 27 May 2026 14:59:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893969; 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=tGvuZf+1OiCGxuaAli6qHIKfTWq4rrcr/BIeTo8/5j8=; b=Z4QGOcITtu5bEzxd6c5Z/L6p9kvrylrMgEqLk5FxxxLP8UGadesVpnp4FYr+dashDQx3ZX xn6EATKThaVOiXPliASwoGDXlJug4VzqzwVUwRdkUXjONv/usYJIeQzxz49vCVqlGRfyXh 2tnejZm71fqpGDKm0WY4gSqW6sS3fSU1t3C4DaqVqT9ybYp1RzqmEFjnZae+5eknGRZB8P 9EWTTPAyqiCByx+NzhFW3fClQgX0N5hSfkdgHx14CrqyOlkCrNJL/xG0n2vODtCwfUVaTV oWnC8KkkNn4OAM+OuUzMuQztj3BD0y5/VqTxrbdCEOajPoS8AlEBWgSLMgH5jQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893969; a=rsa-sha256; cv=none; b=VcbnsHYxRu8MbUs0nyWnmt5W3dzu3pHDQyMrXb+1qHz56Xx0APKHCu22ZBatVQxQzknPkB eYg0VLLU1cLhkZpr76jlmZyJcWXIi08F8/vjtgV45B9HXl3KjblFGRl3j/dFtcrP5I/4zB cYTMblrg7iN0nzb4v8+mjfcnUjD6C5pqaILizqixzxPgmVR6OarMfp+F5igqkiWcvCQliM nSs4wXf4KCo5tDdVToM8xFbp/TMqHaQFMVzULTvNhKaVi8qdYVvzGwUYfJ+L6bOWcR+ylq imbL4ehdEE0ebyveu9CJvY7QkhiDAq3a92Nopw0SnqPoScgHL5EjjKdkjhp3aA== 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=1779893969; 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=tGvuZf+1OiCGxuaAli6qHIKfTWq4rrcr/BIeTo8/5j8=; b=LG89pkCTm5f9PcbQOHlKwl9GDhim43NjqkOK1WhxjITQ/7XGRXFo+p44ffTUy6+ZwwJmzi I2qos6OCaJ2v0S7dPHokfM/2RFNYeJ/xGiy43JCslz/yiyoOJxug2bBdeZELy49WjkxUtz nYFJXN/105CWryycuNkpOv379ajC/iMRhpa5Yu+B/pHP2iArRTupOhfqZKJ5tqiM1yJDjC eE7hmBLNe7a26eE3l0FBOvo4ZEjqPk62rILI2AyMIB5Dn9NbLXIEiXjgenCinyjZIz789w pX3htF7+5thaOq21nJqJdjE4fMqRQ8cJ812J0srrkLnpnxsHFljuSBkRNnb01A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXp958fvz14C7 for ; Wed, 27 May 2026 14:59:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22d4f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d0b10df718e3 - main - arm64: Move pcb out of kstack into a new UMA zone 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d0b10df718e3560cd041ba9ddb157591ac7fa886 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:29 +0000 Message-Id: <6a1706d1.22d4f.1910a0d4@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d0b10df718e3560cd041ba9ddb157591ac7fa886 commit d0b10df718e3560cd041ba9ddb157591ac7fa886 Author: John Baldwin AuthorDate: 2026-03-25 15:18:05 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:45:26 +0000 arm64: Move pcb out of kstack into a new UMA zone This is similar to commit 5e921ff49ea8bb70506248a4675894729cdad8c2 which moved the pcb for amd64, but a bit different. arm64's pcb is much larger (over 1KB!) than amd64's since it still embeds FP registers. Moving the pcb out of the kstack frees up that much additional kstack space. Unlike amd64 however, embedding the pcb in struct mdthread is not practical as the resulting struct thread would grow such that UMA would now store 1 thread per 4k page instead of 2 threads per page. By using a separate UMA zone for pcbs, 2 struct threads can continue to fit in a single 4k page, and 3 pcbs can fit in another 4k page. Reviewed by: kib, jrtc27, andrew Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/arm64/arm64/genassym.c | 2 -- sys/arm64/arm64/locore.S | 3 +-- sys/arm64/arm64/machdep.c | 3 ++- sys/arm64/arm64/vm_machdep.c | 18 ++++++++++++++---- sys/arm64/include/stack.h | 6 ++---- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index 22696796e69d..b54f446e83bd 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -53,8 +53,6 @@ ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_SSBD, offsetof(struct pcpu, pc_ssbd)); -/* Size of pcb, rounded to keep stack alignment */ -ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIGNBYTES + 1)); ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT); ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x)); ASSYM(PCB_X19, PCB_X19); diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index b200aa93c281..bd61b485edf7 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -128,8 +128,7 @@ virtdone: /* Set up the stack */ adrp x25, initstack_end - add x25, x25, :lo12:initstack_end - sub sp, x25, #PCB_SIZE + add sp, x25, :lo12:initstack_end /* Zero the BSS */ ldr x15, .Lbss diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 6b6dd2c510a2..d33208a0819d 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -131,6 +131,7 @@ uintptr_t boot_canary = 0x49a2d892bc05a0b1ul; #endif static struct trapframe proc0_tf; +static struct pcb pcb0; int early_boot = 1; int cold = 1; @@ -443,7 +444,7 @@ init_proc0(void *kstack) #if defined(PERTHREAD_SSP) thread0.td_md.md_canary = boot_canary; #endif - thread0.td_pcb = (struct pcb *)td_kstack_top(&thread0) - 1; + thread0.td_pcb = &pcb0; thread0.td_pcb->pcb_flags = 0; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 29a1c8667e7d..3789dd318c49 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -27,8 +27,8 @@ #include "opt_platform.h" -#include #include +#include #include #include #include @@ -61,6 +61,8 @@ */ cpu_reset_hook_t cpu_reset_hook = psci_reset; +static uma_zone_t pcb_zone; + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -260,20 +262,20 @@ cpu_thread_exit(struct thread *td) void cpu_thread_alloc(struct thread *td) { + td->td_pcb = uma_zalloc(pcb_zone, M_WAITOK); ptrauth_thread_alloc(td); } void cpu_thread_new_kstack(struct thread *td) { - td->td_pcb = (struct pcb *)td_kstack_top(td) - 1; - td->td_frame = (struct trapframe *)STACKALIGN( - (struct trapframe *)td->td_pcb - 1); + td->td_frame = (struct trapframe *)td_kstack_top(td) - 1; } void cpu_thread_free(struct thread *td) { + uma_zfree(pcb_zone, td->td_pcb); } void @@ -333,3 +335,11 @@ cpu_sync_core(void) * return from ELx is a context synchronization event. */ } + +static void +pcbinit(void *dummy __unused) +{ + pcb_zone = uma_zcreate("pcb", sizeof(struct pcb), NULL, NULL, NULL, + NULL, UMA_ALIGNOF(struct pcb), 0); +} +SYSINIT(pcbinit, SI_SUB_INTRINSIC, SI_ORDER_ANY, pcbinit, NULL); diff --git a/sys/arm64/include/stack.h b/sys/arm64/include/stack.h index 0aa483e15e64..23e7a5af27de 100644 --- a/sys/arm64/include/stack.h +++ b/sys/arm64/include/stack.h @@ -39,11 +39,9 @@ bool unwind_frame(struct thread *, struct unwind_state *); #ifdef _SYS_PROC_H_ -#include - #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) @@ -51,7 +49,7 @@ static __inline bool kstack_contains(struct thread *td, vm_offset_t va, size_t len) { return (va >= (vm_offset_t)td->td_kstack && va + len >= va && - va + len <= (vm_offset_t)td_kstack_top(td) - sizeof(struct pcb)); + va + len <= (vm_offset_t)td_kstack_top(td)); } #endif /* _SYS_PROC_H_ */ From nobody Wed May 27 14:59:30 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 4gQXpC1WK5z6f98T for ; Wed, 27 May 2026 14:59:31 +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 4gQXpC03ngz3HYD for ; Wed, 27 May 2026 14:59:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779893971; 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=CbtDeE5XlzLnVJ3wVM3Oxr+MztxJu0WkCBJPV3Ex3mI=; b=DyLWi/zqYhnNUyztYP/Gyp6+5vHsPu/Ug8V6B4aXLw/ooSs063Jrjt4SAy8udNCFKQ7WwM kwNx19YEgVi609y77dTtPaAbMCkf708gxQNPhvw43RYrTNmy66QJsOjx+UDE84dlywjkF0 oLi+uwrvnhxGgHfxlPH//X5HSLgEXSxPC9CaKOii9so3hb6yRqAs38buHDhfFjB+sj1U1G lvTthcbrMYi9v2cH4sS0szamcn4GOpP+lIYPqmO2UBKkW1TlS917oPKQAI4tO6XVEj9wVM WH/+BBWwreL5BwmxD9xj/b2bsr/livu8mnrYCz1DQTSGok1vz0sRNJBI8SJl1w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779893971; a=rsa-sha256; cv=none; b=P/ET3HiWJdkeHT09n9l88byCYaOPC4PamCzcIn3pZVV/STxxeaPf5c+GqnlFfpuhR7K6xS W1nq2bHQ/4Xzx+99+nKHIseDYWwdA8EPzwLd5K8iOY3mflzTeZJl9UAYp9EIpfMHEnDBbQ x5m496fZffOvqBpNQxjQ5vK6QSl1tFw1xxVEAz4cTaPEoQbpZIiGRXa8ehsGD2Q9v/q5mk b0BpufNtWNiLVSA2t+5KgkMMmecBny2b2eNAv9cH+wLML/2sGg9FxiLUyK/OXKQvxHp9eq OJrO6lBmrcCV6Xpo0519eICfMnJ0lytud2yMS2NQ0UbvTmpBj9InKiV11EEmWg== 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=1779893971; 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=CbtDeE5XlzLnVJ3wVM3Oxr+MztxJu0WkCBJPV3Ex3mI=; b=RtkvkKBfYKXnMF6XmRm8xAH/kNvmKj74ea0wsIecalV92nf1j2WbUfhWEQ5L9bZXQq1t+O +fJtM/9a4PgXDa78+444on9T9SXte5qCqBFChh5+54lTztm94Mbw1TWh6srxTDHWDDUBG+ RXpAXkPktKKbgGWFrvf10kJgEHefpOirHygrxAJyg9LhrEbH0xtu6qVkOU8Rg2VPljPr+g xumDhOg9Uia2yUDQHgSS7Y2Y04oDwVCZPhiSqUftQGQTg1gVg7q95qwyVezrIpAs+L9apK 4NxXy5NmVY+ElEklmem0HDPVN+5E2DTIeV9+7CEE5WJJ2/m6cVq+gpARK3WN2A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQXpB63wbz13d9 for ; Wed, 27 May 2026 14:59:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22b35 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 14:59:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4f876cec30af - main - riscv64: Move pcb out of kstack into a new UMA zone 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f876cec30afca1a32d0187fc81d6c3ffd1abc30 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 14:59:30 +0000 Message-Id: <6a1706d2.22b35.2d945453@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4f876cec30afca1a32d0187fc81d6c3ffd1abc30 commit 4f876cec30afca1a32d0187fc81d6c3ffd1abc30 Author: John Baldwin AuthorDate: 2026-03-28 15:19:53 +0000 Commit: John Baldwin CommitDate: 2026-05-27 13:45:26 +0000 riscv64: Move pcb out of kstack into a new UMA zone Similar to arm64, riscv's pcb embeds a copy of the floating point registers and is too large to store directly in struct mdthread as is done on amd64. Instead, use a separate UMA zone for pcbs. riscv's floating point state is not as large as arm64's, so its pcb is also somewhat smaller and a single 4k page can hold 6 pcbs. Reviewed by: kib, jrtc27 Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/riscv/include/stack.h | 6 ++---- sys/riscv/riscv/genassym.c | 1 - sys/riscv/riscv/locore.S | 4 ++-- sys/riscv/riscv/machdep.c | 3 ++- sys/riscv/riscv/vm_machdep.c | 20 +++++++++++++++----- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/sys/riscv/include/stack.h b/sys/riscv/include/stack.h index 5669dcda6c67..fac8d4f317b6 100644 --- a/sys/riscv/include/stack.h +++ b/sys/riscv/include/stack.h @@ -48,12 +48,10 @@ bool unwind_frame(struct thread *, struct unwind_state *); #ifdef _SYS_PROC_H_ -#include - /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = ptoa(td->td_kstack_pages) - sizeof(struct pcb); \ + (total) = ptoa(td->td_kstack_pages); \ (used) = td->td_kstack + (total) - (char *)&td; \ } while (0) @@ -61,7 +59,7 @@ static __inline bool kstack_contains(struct thread *td, vm_offset_t va, size_t len) { return (va >= (vm_offset_t)td->td_kstack && va + len >= va && - va + len <= (vm_offset_t)td_kstack_top(td) - sizeof(struct pcb)); + va + len <= (vm_offset_t)td_kstack_top(td)); } #endif /* _SYS_PROC_H_ */ diff --git a/sys/riscv/riscv/genassym.c b/sys/riscv/riscv/genassym.c index c216c686db9a..998183e92db6 100644 --- a/sys/riscv/riscv/genassym.c +++ b/sys/riscv/riscv/genassym.c @@ -63,7 +63,6 @@ ASSYM(PMAP_MAPDEV_EARLY_SIZE, PMAP_MAPDEV_EARLY_SIZE); ASSYM(PM_SATP, offsetof(struct pmap, pm_satp)); ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); -ASSYM(PCB_SIZE, sizeof(struct pcb)); ASSYM(PCB_RA, offsetof(struct pcb, pcb_ra)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_GP, offsetof(struct pcb, pcb_gp)); diff --git a/sys/riscv/riscv/locore.S b/sys/riscv/riscv/locore.S index 305ed8d79f10..e2126af5cad2 100644 --- a/sys/riscv/riscv/locore.S +++ b/sys/riscv/riscv/locore.S @@ -241,8 +241,8 @@ va: /* Clear frame pointer */ mv s0, zero - /* Allocate space for thread0 PCB and riscv_bootparams */ - addi sp, sp, -(PCB_SIZE + RISCV_BOOTPARAMS_SIZE) & ~STACKALIGNBYTES + /* Allocate space for riscv_bootparams */ + addi sp, sp, -RISCV_BOOTPARAMS_SIZE & ~STACKALIGNBYTES /* Clear BSS */ la t0, _C_LABEL(__bss_start) diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index 47d9636492db..f5479c479109 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -105,6 +105,7 @@ struct pcpu __pcpu[MAXCPU]; static struct trapframe proc0_tf; +static struct pcb pcb0; int early_boot = 1; int cold = 1; @@ -296,7 +297,7 @@ init_proc0(void *kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; thread0.td_kstack_pages = KSTACK_PAGES; - thread0.td_pcb = (struct pcb *)td_kstack_top(&thread0) - 1; + thread0.td_pcb = &pcb0; thread0.td_pcb->pcb_fpflags = 0; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; diff --git a/sys/riscv/riscv/vm_machdep.c b/sys/riscv/riscv/vm_machdep.c index 1810fe88283c..e538921c9f60 100644 --- a/sys/riscv/riscv/vm_machdep.c +++ b/sys/riscv/riscv/vm_machdep.c @@ -32,8 +32,8 @@ * SUCH DAMAGE. */ -#include #include +#include #include #include #include @@ -58,23 +58,23 @@ #define TP_OFFSET 16 /* sizeof(struct tcb) */ #endif +static uma_zone_t pcb_zone; + void cpu_thread_new_kstack(struct thread *td) { - td->td_pcb = (struct pcb *)td_kstack_top(td) - 1; - /* * td->td_frame + TF_SIZE will be the saved kernel stack pointer whilst * in userspace, so keep it aligned so it's also aligned when we * subtract TF_SIZE in the trap handler (and here for the initial stack * pointer). This also keeps the struct kernframe just afterwards - * aligned no matter what's in it or struct pcb. + * aligned no matter what's in it. * * NB: TF_SIZE not sizeof(struct trapframe) as we need the rounded * value to match the trap handler. */ td->td_frame = (struct trapframe *)(STACKALIGN( - (char *)td->td_pcb - sizeof(struct kernframe)) - TF_SIZE); + td_kstack_top(td) - sizeof(struct kernframe)) - TF_SIZE); } /* @@ -227,11 +227,13 @@ cpu_thread_exit(struct thread *td) void cpu_thread_alloc(struct thread *td) { + td->td_pcb = uma_zalloc(pcb_zone, M_WAITOK); } void cpu_thread_free(struct thread *td) { + uma_zfree(pcb_zone, td->td_pcb); } void @@ -285,3 +287,11 @@ cpu_sync_core(void) { fence_i(); } + +static void +pcbinit(void *dummy __unused) +{ + pcb_zone = uma_zcreate("pcb", sizeof(struct pcb), NULL, NULL, NULL, + NULL, UMA_ALIGNOF(struct pcb), 0); +} +SYSINIT(pcbinit, SI_SUB_INTRINSIC, SI_ORDER_ANY, pcbinit, NULL); From nobody Wed May 27 15:24:08 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 4gQYLc5pwZz6fBqq for ; Wed, 27 May 2026 15:24:08 +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 4gQYLc2m91z3PdB for ; Wed, 27 May 2026 15:24:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895448; 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=n6bJY6dgrNPH4Iy0mq4d6Vs3mNsgDejZ4L0qtBEs0aE=; b=VTIhxTSgMA7zJpVGBMYSZEhfjLAGS3aApZCgL/Fkml0riHyz3zI8vhykObpxCYyD2wvz79 RqKNnXppb8Ffbaoaa9HdUvHtjPk8nGBEAMnFIF6eqGgHECyydOqurv+a6jTDq2Acg13L88 QpXh5KD7PHZTQNVzh0so5udOUUFTtE3hVoF286ZFajMp4kZLlOT+sBfV3SEJTW42mZW4cR qdjYS449zSYCE1F25y5idCD5JcvTue1cuaGwYpJzLYX0ndaNPzs36lAzvvH26ADFKt23Rz 4cyO+6XC4FffN9nJkXOE8Lf5ZwkYdikiNkl02CNyksrYmG4UcI6c5UoXcKGCFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895448; a=rsa-sha256; cv=none; b=FueMWV5U1ugfz/mp5dj2kk9pcggV/HoigI/ZBkwo3r5u5hHm+K4XW2pXQIevyHFix2u2Ua 2Et4XD6XE0ez5xNE22SjHcEbQTOAS3lVSBp8SORcug1+yFZ7ROMO286VJzSqIo6y4KFSsq uQj+B9RetPGDkHsfUqEXiAj1+014+QYzFrjOHKJNMLmKdXaai1zOzukYZFtEUZCfo5W7P6 Q9dbNyvYXWjqlBKTdzqLX0qJuIxCp/DhtUKG1zkKk2RmQpj+QijLrPX0Q74R46ISemiQxp 7KKMtiQRNW4sIpHsPduKhxZLQev8DgA3fP61mNQWcvry7miuH9H8YbTwYWf3AA== 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=1779895448; 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=n6bJY6dgrNPH4Iy0mq4d6Vs3mNsgDejZ4L0qtBEs0aE=; b=QyeE0FCNz6w7oeIAYEWQUrzUTWrOg+K21B5i03iI3Qb9mwrtxX6fkQELMedKlneIqNddJ3 jjpco4nJ/3hHWeQYMHEi8+g21xqmrmbdsY7dCDTtnXbuEOCfo0tCy6mVDnz6ozFNxP2zmL eVKA7ApJYNvD1f//LRAoyZs4rYwkmRSGSxVLqucPere7ko8Hn9dpeWuSkPRVSchgyyHKi1 gR3MEi/u6jtYqQOf+AKN9ZjkztJwJaTFk6MSK0zMnBBkzjbnkcstu+k4yjS6CD7SXd5Ddr u9P+9DnGdgR3u3d5zA1YeEt2ThdVnJP4kwa2mE79EpEDGMws+/nd9Wl9pXXrNg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYLc2Lx9z14xm for ; Wed, 27 May 2026 15:24:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2793d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:24:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 48da01ad0b16 - main - arm64: Add a comment about HWCAP values 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48da01ad0b165b4dd38a4c22449216c1babc068b Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:24:08 +0000 Message-Id: <6a170c98.2793d.d955f47@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=48da01ad0b165b4dd38a4c22449216c1babc068b commit 48da01ad0b165b4dd38a4c22449216c1babc068b Author: Andrew Turner AuthorDate: 2026-05-14 15:04:32 +0000 Commit: Andrew Turner CommitDate: 2026-05-27 15:22:25 +0000 arm64: Add a comment about HWCAP values They must be identical to Linux. Document this requirement to allow userspace to depend on this. Sponsored by: Arm Ltd --- sys/arm64/include/elf.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/arm64/include/elf.h b/sys/arm64/include/elf.h index a5a90f8c7712..7940bb259256 100644 --- a/sys/arm64/include/elf.h +++ b/sys/arm64/include/elf.h @@ -96,6 +96,12 @@ __ElfType(Auxinfo); /* First __FreeBSD_version that supports Top Byte Ignore (TBI) */ #define TBI_VERSION 1500058 +/* + * The HWCAP values must be identical to Linux. Many userspace programs + * will define missing HWCAP values to the Linux version. To keep these + * working when we add the HWCAP it must be the same. + */ + /* HWCAP */ #define HWCAP_FP (1 << 0) #define HWCAP_ASIMD (1 << 1) From nobody Wed May 27 15:24:09 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 4gQYLd63Fzz6fBXR for ; Wed, 27 May 2026 15:24:09 +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 4gQYLd3c2Mz3PjD for ; Wed, 27 May 2026 15:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895449; 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=iJRTnMA2mTmAstppENquvlHtN8EYRbJ6FbrgHnsFjZ8=; b=qp8gWMTDwsZ7ubeIVZwKfVs853A/1k5xzts57REK5fMkh/uMsVcPVtdDpK13Bl75xENj8r bgZOlq3NLHYUewxQscOoxL+78QLFUwqdX/w0WGHlpKHhBJvLlHgfIBWwMFZRQKwXcm67F7 OGHYE7kkcVPcRvqFR5cmRgQE0aDm1gItHbE59yj9EFUXP8FtxHGQbqUz4bA9nE6b8Nye3M I/pnYm0Zmp1kI3clzzzyn/xn//yOPt/sdp62PGNC6VH9MaU5ZDq1RlBJXlKtW7kXqaCw4B /wwDeKOMY/qRAeutAgGoNTVrEea3afnVyu3VKUbm+rgVR8y8f1sDIqyPqAnLuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895449; a=rsa-sha256; cv=none; b=NLF2aQvZXINNMFiw0U+3vnbHnbYNb2yLQFZ6JDUnofYIGTMJf+LhTHWDGIVsQ+67cUbcMr b9MN7vvwDXMwQdUGH+qJ5bMuGq1pK8CGlJAhWHkZpGSzxs+mMd2QPQ9ruKKLCfhD7RPwvB 0rOgY5YC5LWPnGL3gJkv6kaIL6H8oGbplXYPxxVqgByNTteptLPouyycSpjVrGo4W7phg+ PiARYzTS8hz+hnPpkR8LnfKUffSWGjB8cQFJKwPuFwNb5sOFD0un8KNp+duMjcmdb21j2c q0m36t2hZ0paG+n0sG+Rf3c1J/69W1HRJgx0sP9UAas0JIDBUyVLha85kurT+Q== 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=1779895449; 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=iJRTnMA2mTmAstppENquvlHtN8EYRbJ6FbrgHnsFjZ8=; b=xHP2zBHLqLjkPY14CHKbja24+Xzeu1n8z2R/baZJ/ZOLI8GX6MObeP5M9wzZRCb6qGVOxN +dhd3aH5lzvmyf101RcN4wmEUISTFeg3M22OC3621v4RCcGSGKPRKuflhH9gKi43cGmy9R Rv4P7+4nJRtdQKxJpUKqF98Z3PR39XiuqBiptp5oQZSPps6Ov8KjbbvTQUwlyVMvgWXf7Y NPggUZcKaG4JOwIeCsXBLDlkpNTbLcWEDRwhxUSxg4injJJXg4/ImOMUDY5e+5YE0Cxn5G pSBwzytyavmU67oua1UyFuuro0ve1KYt2XjtEKVux//jKkuk53CqTxqlqTQMEA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYLd3C6qz14WJ for ; Wed, 27 May 2026 15:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27186 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:24:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: a780d21eab97 - main - arm64: Support changing the DMAP memory type 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a780d21eab9724b0667df84b02074994595d51c7 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:24:09 +0000 Message-Id: <6a170c99.27186.58925c24@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=a780d21eab9724b0667df84b02074994595d51c7 commit a780d21eab9724b0667df84b02074994595d51c7 Author: Andrew Turner AuthorDate: 2026-05-15 15:16:57 +0000 Commit: Andrew Turner CommitDate: 2026-05-27 15:22:25 +0000 arm64: Support changing the DMAP memory type When MTE is enabled we will use the DMAP to manage tags. To be able to read/write them we need to change the memory attribute to VM_MEMATTR_TAGGED. Support changing the DMAP memory type to values known to have equivalent cache properties. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D55949 --- sys/arm64/arm64/pmap.c | 64 ++++++++++++++++++++++++++++++++++++++---------- sys/arm64/include/pmap.h | 1 + 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index adc583812e5b..fd4232711697 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -358,6 +358,7 @@ struct pv_chunks_list __exclusive_cache_line pv_chunks[PMAP_MEMDOM]; vm_paddr_t dmap_phys_base; /* The start of the dmap region */ vm_paddr_t dmap_phys_max; /* The limit of the dmap region */ vm_offset_t dmap_max_addr; /* The virtual address limit of the dmap */ +static int dmap_attr = VM_MEMATTR_WRITE_BACK; extern pt_entry_t pagetable_l0_ttbr1[]; @@ -483,7 +484,7 @@ static void pmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t mpte); static bool pmap_activate_int(struct thread *td, pmap_t pmap); static void pmap_alloc_asid(pmap_t pmap); static int pmap_change_props_locked(void *addr, vm_size_t size, - vm_prot_t prot, int mode, bool skip_unmapped); + vm_prot_t prot, int mode, int old_mode, bool skip_unmapped); static bool pmap_copy_l3c(pmap_t pmap, pt_entry_t *l3p, vm_offset_t va, pt_entry_t l3e, vm_page_t ml3, struct rwlock **lockp); static pt_entry_t *pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va); @@ -8161,7 +8162,7 @@ pmap_unmapbios(void *p, vm_size_t size) /* Ensure the attributes are as expected for the DMAP region */ PMAP_LOCK(kernel_pmap); error = pmap_change_props_locked(va, size, - PROT_READ | PROT_WRITE, VM_MEMATTR_DEFAULT, false); + PROT_READ | PROT_WRITE, VM_MEMATTR_DEFAULT, -1, false); PMAP_UNLOCK(kernel_pmap); KASSERT(error == 0, ("%s: Failed to reset DMAP attributes: %d", __func__, error)); @@ -8267,7 +8268,25 @@ pmap_change_attr(void *va, vm_size_t size, int mode) int error; PMAP_LOCK(kernel_pmap); - error = pmap_change_props_locked(va, size, PROT_NONE, mode, false); + error = pmap_change_props_locked(va, size, PROT_NONE, mode, -1, false); + PMAP_UNLOCK(kernel_pmap); + return (error); +} + +int +pmap_change_dmap_attr(int mode) +{ + int error; + + KASSERT(mode == VM_MEMATTR_WRITE_BACK || + mode == VM_MEMATTR_TAGGED, + ("%s: mode %d must be compatible with write-back", __func__, mode)); + + PMAP_LOCK(kernel_pmap); + error = pmap_change_props_locked((void *)DMAP_MIN_ADDRESS, + dmap_max_addr - DMAP_MIN_ADDRESS, PROT_NONE, mode, dmap_attr, true); + if (error == 0) + dmap_attr = mode; PMAP_UNLOCK(kernel_pmap); return (error); } @@ -8289,20 +8308,20 @@ pmap_change_prot(void *va, vm_size_t size, vm_prot_t prot) return (EINVAL); PMAP_LOCK(kernel_pmap); - error = pmap_change_props_locked(va, size, prot, -1, false); + error = pmap_change_props_locked(va, size, prot, -1, -1, false); PMAP_UNLOCK(kernel_pmap); return (error); } static int pmap_change_props_locked(void *addr, vm_size_t size, vm_prot_t prot, - int mode, bool skip_unmapped) + int mode, int old_mode, bool skip_unmapped) { vm_offset_t base, offset, tmpva, va; vm_size_t pte_size; vm_paddr_t pa; pt_entry_t pte, *ptep, *newpte; - pt_entry_t bits, mask; + pt_entry_t bits, mask, old_mode_bits, old_mode_mask; char *tmpptep; int lvl, rv; @@ -8316,8 +8335,8 @@ pmap_change_props_locked(void *addr, vm_size_t size, vm_prot_t prot, !(base >= VM_MIN_KERNEL_ADDRESS && base < VM_MAX_KERNEL_ADDRESS)) return (EINVAL); - bits = 0; - mask = 0; + bits = old_mode_bits = 0; + mask = old_mode_mask = 0; if (mode != -1) { bits = ATTR_S1_IDX(mode); mask = ATTR_S1_IDX_MASK; @@ -8326,6 +8345,10 @@ pmap_change_props_locked(void *addr, vm_size_t size, vm_prot_t prot, bits |= ATTR_S1_XN; } } + if (old_mode != -1) { + old_mode_bits = ATTR_S1_IDX(old_mode); + old_mode_mask = ATTR_S1_IDX_MASK; + } if (prot != VM_PROT_NONE) { /* Don't mark the DMAP as executable. It never is on arm64. */ if (VIRT_IN_DMAP(base)) { @@ -8353,11 +8376,14 @@ pmap_change_props_locked(void *addr, vm_size_t size, vm_prot_t prot, if (ptep == NULL && !skip_unmapped) { return (EINVAL); } else if ((ptep == NULL && skip_unmapped) || - (pmap_load(ptep) & mask) == bits) { + (pmap_load(ptep) & mask) == bits || + (pmap_load(ptep) & old_mode_mask) != old_mode_bits) { /* - * We already have the correct attribute or there - * is no memory mapped at this address and we are - * skipping unmapped memory. + * We already have one of the following meaning + * we can skip this memory region:: + * - No memory mapped at this address + * - The new attributes are already set + * - The expected attributes are incorrect */ switch (lvl) { default: @@ -8487,12 +8513,24 @@ pmap_change_props_locked(void *addr, vm_size_t size, vm_prot_t prot, pa = PTE_TO_PHYS(pte); if (!VIRT_IN_DMAP(tmpva) && PHYS_IN_DMAP(pa)) { + int dmap_mode; + + /* + * When booting on HW with MTE enabled we may + * need to swap to a tagged type for the DMAP + * to allow tags to be set through it. + */ + if (mode == VM_MEMATTR_WRITE_BACK) + dmap_mode = dmap_attr; + else + dmap_mode = mode; + /* * Keep the DMAP memory in sync. */ rv = pmap_change_props_locked( PHYS_TO_DMAP(pa), pte_size, - prot, mode, true); + prot, dmap_mode, old_mode, true); if (rv != 0) return (rv); } diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index 00b54a874e12..1d90e8d472f2 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -148,6 +148,7 @@ void pmap_activate_vm(pmap_t); void pmap_bootstrap_dmap(vm_size_t); void pmap_bootstrap(void); int pmap_change_attr(void *va, vm_size_t size, int mode); +int pmap_change_dmap_attr(int); int pmap_change_prot(void *va, vm_size_t size, vm_prot_t prot); void pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode); void pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); From nobody Wed May 27 15:24:10 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 4gQYLf6nVcz6fBXX for ; Wed, 27 May 2026 15:24:10 +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 4gQYLf4Q69z3Pl6 for ; Wed, 27 May 2026 15:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895450; 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=lfWD9yqqUC0rZYEJMmGyf1+Jj6scJ7+9GlFcXn3B7TI=; b=GD6DwudmRuGfGCmLm99SZUZLTkhWUoDsf4htHZ/roEkAbmpLhcBPFJ68p2VqnDEfZsPBjP 0LfMtfN92GdrbLabg5BWEqQ/DAB8HLqjX8RIBVWf9YkC4JayBLkjfY+1A4KN77BTz27WJR ttOMVa32emTgk5prt4eCn4Uf+mMacHQraNFw+zysERYk9EgEkatp/b1w6m4BInMCOIuhRl DRInM8FMiAvWP5KbNvbipolYtltPkwlJBd1rukwdW+iOUX0gZN5giNR/OYXwCylXoHf40a xU2kqTxssPLY3y2acnn46IEIz76mtc7ZHo8Ci5ztLvjLXTtuecSyiTNN2UAJPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895450; a=rsa-sha256; cv=none; b=eMvxl/Rh5pSZGAugrXiKMRYuwXxhZIMHBfAh2vtwl+h6oax+xEodwwbVhTEOooyUDTea7x BkOyeBHRsJG8LBLH99HXyHZWGL7nUs2/Yft4aI0mFMT6ONhHybDuoIUXHJGbfGA+Mt2Cj6 4GwwFVPCkSK3qQrDMYCoeWMZa0DmaCqr3n93osCrDxJZbOnlparcU/7I+frBwx1VuRnsyH 0gAqpX08QGSZpcoVNz3ZBaTjcQqC4orEw/QRz4k3tRi7qiyHrvLZUZxwSG5CHKbAtIOhtc g0Urb6lPoDM1z4m/PJHYInUrtDqrgbQTlyMdJNDM/hiCK6YIHBbopLSi9vepnQ== 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=1779895450; 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=lfWD9yqqUC0rZYEJMmGyf1+Jj6scJ7+9GlFcXn3B7TI=; b=PmAh2vJ2puuz2rfsxiExIATd6kAC4mC7aUSplD0bYhXSI6Z5AiOpLDkz8rZJtYGzluIBrM jU6zFB0MMkAC7nyfoOFVZEnbVxodT11Qzeh0+moyRs+oodLeDCGOM65FgXvAu3EmoLt2XY KfFuvO23L+BtcsPCQKmGfG0h9GBEADlibXkMNOpehXTwkFDV7dmogiW8c/RI1YSjHkvoDS ResoOJumZFoutPDITNUobgabyGMhJQwYSEK4IBcom6I5/tLDM5vvZgvr8/42n6Isr4r0/l SP1bWXkU6AZBG0Ttp+WU2RdO64zWaDvo9lobG01ZENvGV8EUZsGecAM5ViDQ5w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYLf41bhz14j9 for ; Wed, 27 May 2026 15:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26de4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:24:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 5a6ae4230b04 - main - arm64: Manage the MTE state like pointer auth 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a6ae4230b046854641b8f80bff0f77fc0e5caae Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:24:10 +0000 Message-Id: <6a170c9a.26de4.67262417@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5a6ae4230b046854641b8f80bff0f77fc0e5caae commit 5a6ae4230b046854641b8f80bff0f77fc0e5caae Author: Andrew Turner AuthorDate: 2026-05-15 15:27:53 +0000 Commit: Andrew Turner CommitDate: 2026-05-27 15:22:25 +0000 arm64: Manage the MTE state like pointer auth Add the same group of functions we use to manage pointer authentication in userspace threads. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D55951 --- sys/arm64/arm64/exec_machdep.c | 1 + sys/arm64/arm64/machdep.c | 1 + sys/arm64/arm64/mte.c | 112 +++++++++++++++++++++++++++++++++++++++++ sys/arm64/arm64/swtch.S | 6 ++- sys/arm64/arm64/vm_machdep.c | 3 ++ sys/arm64/include/cpu.h | 7 +++ sys/arm64/include/proc.h | 2 +- sys/conf/files.arm64 | 1 + 8 files changed, 130 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/exec_machdep.c b/sys/arm64/arm64/exec_machdep.c index a2e1e42249b4..d0a7302e2f7d 100644 --- a/sys/arm64/arm64/exec_machdep.c +++ b/sys/arm64/arm64/exec_machdep.c @@ -471,6 +471,7 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) /* Generate new pointer authentication keys */ ptrauth_exec(td); + mte_exec(td); } /* Sanity check these are the same size, they will be memcpy'd to and from */ diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index d33208a0819d..f35ec7ab2e2e 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -451,6 +451,7 @@ init_proc0(void *kstack) thread0.td_pcb->pcb_vfpcpu = UINT_MAX; thread0.td_frame = &proc0_tf; ptrauth_thread0(&thread0); + mte_thread0(&thread0); pcpup->pc_curpcb = thread0.td_pcb; /* diff --git a/sys/arm64/arm64/mte.c b/sys/arm64/arm64/mte.c new file mode 100644 index 000000000000..88f394dc72c3 --- /dev/null +++ b/sys/arm64/arm64/mte.c @@ -0,0 +1,112 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024-2026 Arm Ltd + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* Version of MTE implemented. 0 == unimplemented */ +static u_int __read_mostly mte_version = 0; + +/* + * FEAT_MTE (mte_version == 1) has userspace instructions, but no tag + * checking. May of the registers/fields need FEAT_MTE2 to be implemented + * before we can access them. + */ +#define MTE_HAS_TAG_CHECK (mte_version >= 2) + +struct thread *mte_switch(struct thread *); + +static void +mte_update_sctlr(struct thread *td, uint64_t sctlr) +{ + MPASS((sctlr & ~(SCTLR_ATA0 | SCTLR_TCF0_MASK)) == 0); + td->td_md.md_sctlr &= ~(SCTLR_ATA0 | SCTLR_TCF0_MASK); + td->td_md.md_sctlr |= sctlr; +} + +void +mte_fork(struct thread *new_td, struct thread *orig_td) +{ + if (!MTE_HAS_TAG_CHECK) + return; + + mte_update_sctlr(new_td, + orig_td->td_md.md_sctlr & SCTLR_TCF0_MASK); + new_td->td_md.md_gcr = orig_td->td_md.md_gcr; +} + +void +mte_exec(struct thread *td) +{ + if (!MTE_HAS_TAG_CHECK) + return; + + mte_update_sctlr(td, SCTLR_TCF0_NONE); + td->td_md.md_gcr = GCR_RRND; +} + +void +mte_copy_thread(struct thread *new_td, struct thread *orig_td) +{ + if (!MTE_HAS_TAG_CHECK) + return; + + mte_update_sctlr(new_td, + orig_td->td_md.md_sctlr & SCTLR_TCF0_MASK); + new_td->td_md.md_gcr = orig_td->td_md.md_gcr; +} + +/* Only for kernel threads */ +void +mte_thread_alloc(struct thread *td) +{ +} + +/* Only for a kernel thread */ +void +mte_thread0(struct thread *td) +{ +} + + +struct thread * +mte_switch(struct thread *td) +{ + if (MTE_HAS_TAG_CHECK) { + WRITE_SPECIALREG(GCR_EL1_REG, td->td_md.md_gcr); + } + return (td); +} diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index af2c278baecf..b349072c06f4 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -96,8 +96,9 @@ ENTRY(cpu_throw) mov x0, x1 #endif - /* This returns the thread pointer so no need to save it */ + /* These return the thread pointer so no need to save it */ bl ptrauth_switch + bl mte_switch #ifdef PERTHREAD_SSP mov x19, x0 #endif @@ -176,8 +177,9 @@ ENTRY(cpu_switch) mov x0, x1 #endif - /* This returns the thread pointer so no need to save it */ + /* These return the thread pointer so no need to save it */ bl ptrauth_switch + bl mte_switch /* This returns the thread pcb */ bl pmap_switch /* Move the new pcb out of the way */ diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 3789dd318c49..635bdcef7025 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -98,6 +98,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) bzero(&pcb2->pcb_dbg_regs, sizeof(pcb2->pcb_dbg_regs)); ptrauth_fork(td2, td1); + mte_fork(td2, td1); tf = td2->td_frame; bcopy(td1->td_frame, tf, sizeof(*tf)); @@ -200,6 +201,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Generate new pointer authentication keys. */ ptrauth_copy_thread(td, td0); + mte_copy_thread(td, td0); } /* @@ -264,6 +266,7 @@ cpu_thread_alloc(struct thread *td) { td->td_pcb = uma_zalloc(pcb_zone, M_WAITOK); ptrauth_thread_alloc(td); + mte_thread_alloc(td); } void diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h index 05844ad63036..8d8a80a8d02a 100644 --- a/sys/arm64/include/cpu.h +++ b/sys/arm64/include/cpu.h @@ -277,6 +277,13 @@ void ptrauth_thread0(struct thread *); void ptrauth_mp_start(uint64_t); #endif +/* Memory Tagging Extension (MTE) support */ +void mte_fork(struct thread *, struct thread *); +void mte_exec(struct thread *); +void mte_copy_thread(struct thread *, struct thread *); +void mte_thread_alloc(struct thread *); +void mte_thread0(struct thread *); + /* Functions to read the sanitised view of the special registers */ void update_special_regs(u_int); void update_special_reg_iss(u_int, uint64_t, uint64_t); diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index d5879a794269..a455ab098ee9 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -71,7 +71,7 @@ struct mdthread { int md_reserved0; uint64_t md_sctlr; - uint64_t md_reserved1; + uint64_t md_gcr; /* FEAT_MTE: Tag Control Register */ }; struct mdproc { diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 172f79cc5773..2f6052da7e51 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -76,6 +76,7 @@ arm64/arm64/ofw_machdep.c optional fdt arm64/arm64/pl031_rtc.c optional fdt pl031 arm64/arm64/ptrauth.c standard \ compile-with "${NORMAL_C:N-mbranch-protection*} -mbranch-protection=bti" +arm64/arm64/mte.c standard arm64/arm64/pmap.c standard arm64/arm64/ptrace_machdep.c standard arm64/arm64/rsi.c standard From nobody Wed May 27 15:24:11 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 4gQYLg710cz6fBtm for ; Wed, 27 May 2026 15:24:11 +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 4gQYLg51tHz3PdC for ; Wed, 27 May 2026 15:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895451; 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=jXsfCtHjNTI4priY++dJBL6nUZP8gDPr4TOHoQGfah8=; b=uX0YjXyg4X+1RdeFm+RooOywuD5CfE7Gmrb+yCI37X7JJ//Apm8PkjcsSEZlYB0hhd1P9b 4hHsEt0zBeM9if9apEadQo1EMkWG5TwL+Caf+PXyvJ0FrY4NTYyKZiEx70wW4g8U5fHIgc 2B2IP+rinvhTJRlGTYy55bSG+63UhfxS7cQpIpXsaTIO8nnLC+VCJfPosVQ7uarKOdXuJq 7SyD0BqbwyuMVZJTuq3y0qMb4ffumh2KURvQlQGZDKTEvxMYhbRFoCf92fnUju3JFrc5gp +QSaYxqp+RIF+XzoV4NQk97hdGGp7Mm0tle2z95DTy2SU19b08PvHx29bmgnQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895451; a=rsa-sha256; cv=none; b=gJmngwjrhYQMD53SBZVBHE9B1dxrWIDktNkxewVuIbfaIKoIuOm0VMRxZvvf/LTzV195KR kSr7v0fUDtcBkPB8U2QZ3TBQCW0jKkmm2cID/BTLU33yavUgbsWHIUW/ZELX1EXi/E+da7 j/kplOkDpcPNAB/qwN5Q8Q6taPXAMpxtbgM05WO5nC/GykAWjEBnwnIHkf58eD70Bp8FtJ 0kugQf5Z1Akp1j2dqNi13YnNxbmp8WVf0UxSP3Yc3wRHcw89me9V5iUC6gMRsIG7xnOXPG jv9mmNCHlLInQc82X2TkPx7HgqIx0U9fzIWeUe3cgBV7jKbK3pMXlaW0lUivsg== 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=1779895451; 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=jXsfCtHjNTI4priY++dJBL6nUZP8gDPr4TOHoQGfah8=; b=ZiOuhQGOQB1hd98+BlvcjZF0VRXHY/alirvodrOFyIoJc16tT+VnHAUDhRUQi50B4TUF5K ZdDOqGqCakXEaYn4cleFMg/8y7EEauYADU5e0EUZaGxs7NZZDCedI2YsMky5jpmRhrhEZZ B8t8zmbm77NcLxkirb9o424zm0xL8du9exMJEwOH5A9OE37HIc29Qd/cZmxvynPmV+VX73 1DEPjYrbMI9bkvyuJc1dVm4bhIv+Ua5PGc/n5OHgndO6g1nJKutg8nEr0kxYbmurRBYn1b juz+FnMHeUfRevgRGzpwXDVW45c51gsYi7MDZVJHA3wlNddeEOVMz/jSxXQn9A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYLg4Zh6z14nq for ; Wed, 27 May 2026 15:24:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 272a9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:24:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 5cb511e62763 - main - arm64: Check for MTE tag failures on kernel entry 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5cb511e62763621cf7672db4294002411c3e897d Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:24:11 +0000 Message-Id: <6a170c9b.272a9.68b4c51d@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5cb511e62763621cf7672db4294002411c3e897d commit 5cb511e62763621cf7672db4294002411c3e897d Author: Andrew Turner AuthorDate: 2026-05-15 16:13:33 +0000 Commit: Andrew Turner CommitDate: 2026-05-27 15:22:25 +0000 arm64: Check for MTE tag failures on kernel entry When entering the kernel from userspace we need to check for MTE tag failures when using asynchronous MTE. This is done by checking if either tag fault check types that have asynchronous checks are enabled, and if so check the register the result is stored. It then sets a flag the kernel can later use to raise a signal. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D55952 --- sys/arm64/arm64/exception.S | 36 ++++++++++++++++++++++++++++++++++-- sys/arm64/arm64/genassym.c | 3 +++ sys/arm64/include/proc.h | 4 +++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index 5a4181348a54..5efbc4b36710 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -92,10 +92,34 @@ blr x1 1: - ldr x0, [x18, #PC_CURTHREAD] + ldr x19, [x18, #PC_CURTHREAD] + + ldr x1, [x19, #TD_MD_SCTLR] + /* + * If the upper bit in SCTLR_EL1.TCF0 is set we are either in async + * or asym modes. Either of which could set TFSRE0_EL1. + */ + tbz x1, #(SCTLR_TCF0_SHIFT + 1), 2f + /* Check for a tag fault */ + mrs x1, TFSRE0_EL1_REG + tbz x1, #TFSRE0_TF0_SHIFT, 2f + + /* + * A fault has happened, set MD_FLAG_MTE_ASYNC_FAULT. As FEAT_LSE + * is a required feature where FEAT_MTE_ASYNC could be implemented + * we can depend on it being present to set the flag. + */ + ldr w1, =MD_FLAG_MTE_ASYNC_FAULT + add x2, x19, #TD_MD_FLAGS +.arch_extension lse + stset w1, [x2] +.arch_extension nolse + +2: + mov x0, x19 bl ptrauth_exit_el0 - ldr x0, [x18, #(PC_CURTHREAD)] + mov x0, x19 bl dbg_monitor_enter /* Unmask debug and SError exceptions */ @@ -118,6 +142,14 @@ msr daifset, #(DAIF_ALL) .if \el == 0 ldr x0, [x18, #PC_CURTHREAD] + + ldr x1, [x0, #TD_MD_SCTLR] + /* See above for why we check this field */ + tbz x1, #(SCTLR_TCF0_SHIFT + 1), 1f + dsb ish + msr TFSRE0_EL1_REG, xzr +1: + mov x1, sp bl dbg_monitor_exit diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index b54f446e83bd..6c86f190282d 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -74,6 +74,9 @@ ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); ASSYM(TD_MD_CANARY, offsetof(struct thread, td_md.md_canary)); ASSYM(TD_MD_EFIRT_TMP, offsetof(struct thread, td_md.md_efirt_tmp)); +ASSYM(TD_MD_FLAGS, offsetof(struct thread, td_md.md_flags)); +ASSYM(MD_FLAG_MTE_ASYNC_FAULT, MD_FLAG_MTE_ASYNC_FAULT); +ASSYM(TD_MD_SCTLR, offsetof(struct thread, td_md.md_sctlr)); ASSYM(TF_SIZE, sizeof(struct trapframe)); ASSYM(TF_SP, offsetof(struct trapframe, tf_sp)); diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index a455ab098ee9..22ceb614413d 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -69,7 +69,9 @@ struct mdthread { uint64_t md_efirt_tmp; int md_efirt_dis_pf; - int md_reserved0; + u_int md_flags; +#define MD_FLAG_MTE_ASYNC_FAULT_SHIFT 0 +#define MD_FLAG_MTE_ASYNC_FAULT (1u << 0) uint64_t md_sctlr; uint64_t md_gcr; /* FEAT_MTE: Tag Control Register */ }; From nobody Wed May 27 15:24:12 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 4gQYLj1H5mz6fBR9 for ; Wed, 27 May 2026 15:24:13 +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 4gQYLh66Rgz3PjH for ; Wed, 27 May 2026 15:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895452; 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=W8ONOWUf7RuBEodzSxUn8Q8NBCrQXOXpjnBV8ehy8EI=; b=uejQcv2aNSodPsO7ffyK9cA6BPRL1T+oxNrY6nFMIM4nLec3/GzoGX/k9T0L5Xbk5Zayhf eoJGTSHAI7j9viNgEHhDRt17jt8Ys0T0/G2ZMgD+mevgBtHlvmfNIilnR2HPSYJNGEqv+s YvnsmYNBJMl3EyBKG77U49YF5HFtJJ4RHT6I1sc+Bg8hzhIhPDssss3+Fk38AzM2fu6lR8 l8XpRC78TeuhqZSiKpjKwGdXSnsNVUMP5QnDkSyBbvE5oyQP1BygTC6U42b3GM9f9xiSvg sZEya0WZ8qor66obseDJ0crIWf8FkfC7ulwG0T1sIMi7FzHU+Dr/WUHhls9YUw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895452; a=rsa-sha256; cv=none; b=LW2MiEkB4JibqR3JqwmFr3Zwa1THGAC1CR3LyCE9MVhAbLm2nlGmta1MI+FUlldlHR4L0g 7qmplILkSJbT9FDJ/D7lg9lApwSd2gG+jcw1sLEUwXBDZ1xY55r+b3arBZxugxpJi1cUDk fBB2mVrgg8tX7jUZKta1fC86AJuRtsZY9ihzi6c4smlmccQyD9y5dj/hqjy/rlBroUCw9w oN3Sz+3ddVBAjxdw1WH7QTkpVmv0M0JGQJWjsJ8mtP2lSMgIE/0rqbFTgJBikYu+PccnZ2 Ze7+chAY+TFWBev1a5Hfz7NbdELnjGSQ6DZbcrWyeSGmAGvNA9KjBz3xvFSzLA== 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=1779895452; 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=W8ONOWUf7RuBEodzSxUn8Q8NBCrQXOXpjnBV8ehy8EI=; b=nDSv7VrVBBKR05nR7G458FheBypWL/7mV29v8o3m9OBAFudfaNWwdewAgL8Hxr/x2gCRaY 0p/uUgvocr2si1fH/ZGBC1gaZjW9/eWobBwLgqUCpPwlN3botRGbt+RANA5zvfxdbeea2W S2bOYP1HaCUmNJLAL8i7pXwzfGBK2SeqSKmoyy3XqDXXIi8o0Vzyd0Vge8ONkTEfGQvj15 5Vsz3p9QENs9bBZU4mc5XYT9T1cPfRGpb8ibv1Umf0riVArS3NWjlsJwGDBkXvrEuHSA+u ilQj8S9W2EfHG0bDKvF9tXqU64O61v66LtJ8l0nruanqsrYgOsik7b3hitkKjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYLh5Q0Bz14g3 for ; Wed, 27 May 2026 15:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27108 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:24:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: d63a62fb3504 - main - arm64: Add support for per-page flags 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d63a62fb3504df36457cac5718073a12d10e6cdc Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:24:12 +0000 Message-Id: <6a170c9c.27108.4d2abced@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=d63a62fb3504df36457cac5718073a12d10e6cdc commit d63a62fb3504df36457cac5718073a12d10e6cdc Author: Andrew Turner AuthorDate: 2026-05-18 09:01:19 +0000 Commit: Andrew Turner CommitDate: 2026-05-27 15:22:25 +0000 arm64: Add support for per-page flags We need to store some extra information about a page, e.g. the state of the MTE tags. Add a MD flags field to each page. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D55953 --- sys/arm64/arm64/pmap.c | 1 + sys/arm64/include/pmap.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index fd4232711697..0aa1ee8d5801 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1587,6 +1587,7 @@ pmap_page_init(vm_page_t m) TAILQ_INIT(&m->md.pv_list); m->md.pv_memattr = VM_MEMATTR_WRITE_BACK; + m->md.pv_flags = 0; } static void diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index 1d90e8d472f2..69ae8e5c80b7 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -70,7 +70,8 @@ struct md_page { TAILQ_HEAD(,pv_entry) pv_list; int pv_gen; vm_memattr_t pv_memattr; - uint8_t pv_reserve[3]; + uint8_t pv_flags; + uint8_t pv_reserve[2]; }; enum pmap_stage { From nobody Wed May 27 15:24:13 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 4gQYLl2S3cz6fBTt for ; Wed, 27 May 2026 15:24:15 +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 4gQYLk1SqZz3PgK for ; Wed, 27 May 2026 15:24:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vd2JjRe5KTIQ6HSW5URwUQIDEQzbcW7LuETprhxZ/nc=; b=d0SnM1dQXw7bnMQEO5+D/QUG6/jbmJKzvZGHEC1UeP/FJ42D2L7r78Uuo9zlBgvbw2oKAi H7MZ5Fg4UvvFfoEq7wZ9jSpn545iGisfsEpqZAVezbsF31fsqC5sYm+S6izpKzUL+6v9r4 lOrpLrufhejsZQP/7Mhgs5xl38nsaD8N8saKT3UQPqhk0dWXMIE6vCbWXH6Bx8MD2q17C+ KWpo4cGvvhaP4xmH5tR/mCNCqeUFnMi98blbsJ/ihXr9jyXz5FU/jKbsQ5XaZq/Y9m/eRM J5zVQ2oyanxVSxNdQqXHh9qlew1QE6Lz/sCrwjkmGA5n8ZIIn6hnb3H0AZIcHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895454; a=rsa-sha256; cv=none; b=cifQv3IcokmHGn3vWdX/jqj1I15NsAO4B5surDSzmOtv8hohrTmnUzJh90YLiXcC1QZ5nF utmX7iDaCX2aAQqhnfM1xfba8y8MMyrE3qI/XtMjQbkAhMI/P77jVltlS6ZrQgRFG7GqEn lvpfKo2HiTszd1kFvb5mOadh3mV/3Aduxy9NvOFZNeFVdstZljMGdhKNts641187R0Cdw7 Rje8NxmMHFVmoXMii+Bk8A6jKfgoJVxOhQpnIda7pJJreQsQ2D5j4ctjojWEK2kabHIqSe HytmZZjtWQ5usJaEf7cEDoRQQvfEyHhizyn0RvUxVxlrqh9FG6pmptdgShYRig== 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=1779895454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vd2JjRe5KTIQ6HSW5URwUQIDEQzbcW7LuETprhxZ/nc=; b=FPp6yQKxB7siF5B3P8jXo86gScNTOxAReXP5Z4JaIYCseGv/YXHkqw+CBtlwmap/r6xXij vN1FO+BlCY8sg8+dxJU+Bx3sMs9nje111QoC8Qc+WHuJkFmacLq3hhs4xW+lFfHvG2Bx91 Ytv5viBvOKHv6K1q1f+1ShKn+V1vcTbZ0HnKy0BYego7Z+5ihhtPwI2nZ0toHj6YDbGCpy JizqA03e4Op5TaxIRsNOOoYYq1SL0+UhQfUyuKQv5vI8OskBsRR2H2ijNQin24/aN/eMad zpl7MRPfkuRQLhzWxuPSKR8S5xOH6A8OYSysjiSuvPCA4IlH4WjfTNSbNACLHA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYLj6Fkhz14g5 for ; Wed, 27 May 2026 15:24:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26e27 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:24:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Harry Moulton From: Andrew Turner Subject: git: bb9497a2d462 - main - arm64: Add vm_page_t MTE flags 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb9497a2d462e668455d0a561bd5677f447b4acf Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:24:13 +0000 Message-Id: <6a170c9d.26e27.6932ecae@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=bb9497a2d462e668455d0a561bd5677f447b4acf commit bb9497a2d462e668455d0a561bd5677f447b4acf Author: Harry Moulton AuthorDate: 2026-05-18 09:09:23 +0000 Commit: Andrew Turner CommitDate: 2026-05-27 15:22:26 +0000 arm64: Add vm_page_t MTE flags To track which pages have MTE tags. Add a flag field to md_page. We can then use this in MD code to mark which pages have MTE tags. Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D55954 --- sys/arm64/arm64/mte.c | 38 ++++++++++++++++++++++++++++++++++++++ sys/arm64/arm64/pmap.c | 1 + sys/arm64/include/cpu.h | 2 ++ sys/arm64/include/pmap.h | 3 +++ 4 files changed, 44 insertions(+) diff --git a/sys/arm64/arm64/mte.c b/sys/arm64/arm64/mte.c index 88f394dc72c3..ba5d9df3b01c 100644 --- a/sys/arm64/arm64/mte.c +++ b/sys/arm64/arm64/mte.c @@ -49,6 +49,13 @@ static u_int __read_mostly mte_version = 0; struct thread *mte_switch(struct thread *); +/* Fetch the block size used by tag load and store instructions */ +static inline size_t +mte_block_size(void) +{ + return (sizeof(int) << GMID_BS_SIZE(READ_SPECIALREG(GMID_EL1_REG))); +} + static void mte_update_sctlr(struct thread *td, uint64_t sctlr) { @@ -57,6 +64,37 @@ mte_update_sctlr(struct thread *td, uint64_t sctlr) td->td_md.md_sctlr |= sctlr; } +/** + * Clear/sync the allocation tags for a given page. This should be done on + * allocation of a page to ensure a tag check fault does not occur immediately + * after accessing newly tagged memory. + */ +void +mte_sync_tags(vm_page_t page) +{ + char *addr; + size_t block_size; + + if (!MTE_HAS_TAG_CHECK) + return; + + /* don't clear the tags on a page that's already setup for mte */ + if ((page->md.pv_flags & PV_MTE_TAGGED) != 0) + return; + + block_size = mte_block_size(); + addr = PHYS_TO_DMAP(page->phys_addr); + + for (size_t count = 0; count < PAGE_SIZE; + count += block_size, addr += block_size) + asm volatile( + ".arch_extension memtag \n" + "stgm xzr, [%0] \n" + ".arch_extension nomemtag" : : "r" (addr)); + + page->md.pv_flags |= PV_MTE_TAGGED; +} + void mte_fork(struct thread *new_td, struct thread *orig_td) { diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 0aa1ee8d5801..6914fc13b065 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -6922,6 +6922,7 @@ pmap_zero_page(vm_page_t m) void *va = VM_PAGE_TO_DMAP(m); pagezero(va); + m->md.pv_flags &= ~PV_MTE_TAGGED; } /* diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h index 8d8a80a8d02a..d36e1e56c91c 100644 --- a/sys/arm64/include/cpu.h +++ b/sys/arm64/include/cpu.h @@ -284,6 +284,8 @@ void mte_copy_thread(struct thread *, struct thread *); void mte_thread_alloc(struct thread *); void mte_thread0(struct thread *); +void mte_sync_tags(vm_page_t page); + /* Functions to read the sanitised view of the special registers */ void update_special_regs(u_int); void update_special_reg_iss(u_int, uint64_t, uint64_t); diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index 69ae8e5c80b7..cf20827fa666 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -74,6 +74,9 @@ struct md_page { uint8_t pv_reserve[2]; }; +/* machine page flags */ +#define PV_MTE_TAGGED 0x01 /* page is tagged with MTE */ + enum pmap_stage { PM_INVALID, PM_STAGE1, From nobody Wed May 27 15:24:14 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 4gQYLl4vJrz6fBTv for ; Wed, 27 May 2026 15:24:15 +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 4gQYLl0bPnz3PgR for ; Wed, 27 May 2026 15:24:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OhyeRMfGtInq0oXB73yioXSxorLwzCrrkRN/6HaqZFs=; b=Y9wNOYNuR5gl3Zv+5FGlRmMNPm1oECdQLyQ+oS8ScEjZSCRJLhwL0ki8UAP7x4Mw7/iqL8 lJIbzVRWZnXZvJxogGZnr8DaYJxSp1g+hy+B/T6a9CtsFvMYOt+JUX+Phiu0D6YPG8t/E1 hRAAWlAu3P6LKeMkDf5hehy/0RmEmYpw5I9JqZuf4u5ou6Wp1ubhAXUp+Ic5SEUd2UO5h6 ybOFd3p9My58gY9ZLtIYYF9rJtx8d5xqCa+BamS3dHqjPgPwYphin0P1JD8zSHLWjNEMUn IjyhXmn/J4LaV0N0G5qCYK3+7EpDQ6dtAUPjGgeGbXRqiTzVJHFj/bkO9jjGmQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895455; a=rsa-sha256; cv=none; b=Ut/BrjwN2olR8T/+ICdTHGagk2CEx4YKQbOBaU7MwMcdDibQdqpE3T01JxHIRqlE/c3+x/ BqGVmr6RKAjZfaY9FflxchTfNOM+vA5fJ5TeD8X/vrPi0iHcS/rkDRu8aJJRmm4rjzjeE2 hU63Vg3ohePLyA10OC68D1yFW2NKRo7LhAVBf9bzwvcqUHEm1a00cQLtnRJOWv7c5rsxa8 NR2Q1h3zPYtIYBkMvj4CTrxAnCM9OICWJyam6omWrGl17DDRSfBZ+fZO7juIvw9pAkhRT9 4b2NRe6zhKMAvA+xRMCRdsQNZ3h1s5X5QsWM6z37vWNLPL91Jzgb8UivNROd8w== 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=1779895455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OhyeRMfGtInq0oXB73yioXSxorLwzCrrkRN/6HaqZFs=; b=P7DlrJ+KZhrCtDQsu5N73QTj0BP6JIkZpTpmDbrrxUTuho+b8oEgMbq0iYTlyUM5hum4Ne F5+y34XT7kcrvrOYBhdifStfmE06vmEVdaIz19apLmgodbU+yIOV5gpqntjG46qfNeqUg7 I/qw+Rj14feLlUJU6hmGSpvYRh0RHUr57AAQ5GrxJQgVdfF4D86kpT3l9os6BD4jvzUMqG JNFsXrHsbXZHe6Bu3dWaenr+mzGPh2byd1jhERTdq9mqIEDm20WLqt2xKoR70E29GwgjVI TKucz+BzP5uyDUHsvjLITF7lT26NwhoTKnyR0Ht2ofZaR5YnglIk72GD7GJV1A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYLk713Nz14ns for ; Wed, 27 May 2026 15:24:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 277fc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:24:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Harry Moulton From: Andrew Turner Subject: git: 7bb6b62394d3 - main - arm64: mte: copy/save tags on copy-on-write 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7bb6b62394d3036567cf1453395d9e8b63d3dda1 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:24:14 +0000 Message-Id: <6a170c9e.277fc.6fdde7de@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=7bb6b62394d3036567cf1453395d9e8b63d3dda1 commit 7bb6b62394d3036567cf1453395d9e8b63d3dda1 Author: Harry Moulton AuthorDate: 2026-05-18 09:29:03 +0000 Commit: Andrew Turner CommitDate: 2026-05-27 15:22:26 +0000 arm64: mte: copy/save tags on copy-on-write On a copy-on-write, copy the memory tags from the source pages to the destination pages so the forked process can continue to use MTE. Reviewed by: andrew Sponsored by: Arm Ltd Signed-off-by: Harry Moulton Differential Revision: https://reviews.freebsd.org/D55955 --- sys/arm64/arm64/mte.c | 41 +++++++++++++++++++++++++++++++++++++++++ sys/arm64/arm64/pmap.c | 13 +++++++++++++ sys/arm64/include/cpu.h | 1 + 3 files changed, 55 insertions(+) diff --git a/sys/arm64/arm64/mte.c b/sys/arm64/arm64/mte.c index ba5d9df3b01c..6e902858a8b9 100644 --- a/sys/arm64/arm64/mte.c +++ b/sys/arm64/arm64/mte.c @@ -49,6 +49,22 @@ static u_int __read_mostly mte_version = 0; struct thread *mte_switch(struct thread *); +#define load_tags(addr) ({ \ + uint64_t __val; \ + asm volatile( \ + ".arch_extension memtag \n" \ + "ldgm %0, [%1] \n" \ + ".arch_extension nomemtag" : "=r" (__val) : "r" (addr)); \ + __val; \ +}) + +#define set_tags(tags, addr) do { \ + asm volatile( \ + ".arch_extension memtag \n" \ + "stgm %0, [%1] \n" \ + ".arch_extension nomemtag" : "=r" (tags) : "r" (addr)); \ +} while (0) + /* Fetch the block size used by tag load and store instructions */ static inline size_t mte_block_size(void) @@ -95,6 +111,31 @@ mte_sync_tags(vm_page_t page) page->md.pv_flags |= PV_MTE_TAGGED; } +/** + * Copy the allocation tags from given target to destination page. This is called + * on a copy-on-write and anything that causes a pmap_copy_page call. + */ +void +mte_copy_tags(vm_page_t srcpage, vm_page_t dstpage, char *src, char *dst) +{ + size_t block_size; + uint64_t tags; + + MPASS((srcpage->md.pv_flags & PV_MTE_TAGGED) != 0); + + /* + * Copy the tags from the source page to the destination page, + * incrementing by the block count read from GMID_EL1 + */ + block_size = mte_block_size(); + for (size_t count = 0; count < PAGE_SIZE; + count += block_size, src += block_size, dst += block_size) { + tags = load_tags(src); + set_tags(tags, dst); + } + dstpage->md.pv_flags |= PV_MTE_TAGGED; +} + void mte_fork(struct thread *new_td, struct thread *orig_td) { diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 6914fc13b065..1fb9ac2011aa 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -146,6 +146,7 @@ #include #include +#include #include #include #include @@ -6954,6 +6955,15 @@ pmap_copy_page(vm_page_t msrc, vm_page_t mdst) void *src = VM_PAGE_TO_DMAP(msrc); void *dst = VM_PAGE_TO_DMAP(mdst); + /* + * On a page copy, check whether the src page is tagged. If it is, + * we must copy the tags before copying the contents of the page. + */ + if ((msrc->md.pv_flags & PV_MTE_TAGGED) != 0) + mte_copy_tags(msrc, mdst, src, dst); + else + mdst->md.pv_flags &= ~PV_MTE_TAGGED; + pagecopy(src, dst); } @@ -6970,6 +6980,9 @@ pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], int cnt; while (xfersize > 0) { + KASSERT(ADDR_IS_CANONICAL(a_offset), + ("%s: Address not in canonical form: %lx", __func__, a_offset)); + a_pg_offset = a_offset & PAGE_MASK; m_a = ma[a_offset >> PAGE_SHIFT]; p_a = m_a->phys_addr; diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h index d36e1e56c91c..bdbc601edd26 100644 --- a/sys/arm64/include/cpu.h +++ b/sys/arm64/include/cpu.h @@ -285,6 +285,7 @@ void mte_thread_alloc(struct thread *); void mte_thread0(struct thread *); void mte_sync_tags(vm_page_t page); +void mte_copy_tags(vm_page_t, vm_page_t, char *, char *); /* Functions to read the sanitised view of the special registers */ void update_special_regs(u_int); From nobody Wed May 27 15:30:06 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 4gQYTV22pNz6fC9l for ; Wed, 27 May 2026 15:30:06 +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 4gQYTV1SvQz3Slm for ; Wed, 27 May 2026 15:30:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895806; 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=usi8pCtGqixIXIn60vFwuORgaHLODQfMJ5v5Yi2/9fA=; b=i0LSJHfFMbGw3IaOcEYLiLv7AdCSW+G8L8WUbDgJTLZIbd3dmIXEWVjYL6rstByOIWOUyR RLa4LBlFaLOXDEBo1I4byqpTXe7GFJNpxaCGuc1hkPlwXMVDBeoY4gGnb7r3W7a7m7yzqT +U3bpgKpbNU1A5BfiNiuW5krPbQT3hrHW5ErcNN5uyzsk/owUIxMWcoCOXMgsdJdvMZjaN 7epxv97LPjmHhj7Gix4r2fwi9LrO7pNzQsTCBscZKknvtaQlsaYbdDGL4CTKruZrwHb+B3 KQfFEGn7rCrp+pEoxZv8b91KeWZfHV9Tv5kpkm0GiLajYCLSeG0EGGntOpEooQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895806; a=rsa-sha256; cv=none; b=oOQxxaKBKWCBAruTZsC2AIkwIPiO+1Mg1+FINb/FQHuxQqZXefgLjsOKv5OoC12gbfwRfY WyK+GjN8usFf5ji2rB1psk0B2eahumLhQocfAFdvHB3c0VXf6OnYfye+xa6SfyqXBwWImr 3fOCeBH/c5F9FVmu6L2DIJEE4lDD2T0nqXOp0CFB5sMB8Jd/N07wfKpy4+8zJob1Sk806n YPFNogL230+Q+05dLBwHKtPaMW9UZyvo7Lh3BDxcLka4BrtR2qQ51q8u6BcgKlOKdHBZH9 YjwmE2EuPtffp3LT+7ZG5koC8buucUiL19W79SFqKyPHOwQdgi9T0L0dauVMrA== 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=1779895806; 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=usi8pCtGqixIXIn60vFwuORgaHLODQfMJ5v5Yi2/9fA=; b=Vnyxas5dIbVY1ExpNYr4EfbAax+Mmbqiw7hDXAIyIPkC050mFukg7raHNWcMQCpu6rt4xu twWo0F4J3me3vjcPCjQiCJ7Ki6jfuSZ9QrKT/Lqfd6xa1H55U4rzrfPxrrrOFU8yPTXjY0 lIFwHaRebPJQ+ddXDDWgQmqEIQeT5dMfMar3TNL/73DBb2KFWfvyfWzkNXnzIymtgD/dVN VtjFmRw9ChFPN7mRnI2GiN8CjefynHfaN20GalNfixtl7xOxftrW/BbaNcZMhTIx4SLgDF C2nv1i4kWgdHnzDiQe/qaHwZNYonXUlKcL0NHje7cIy5OkKteK27/uiL4a43Ew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTV0qTZz14QB for ; Wed, 27 May 2026 15:30:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26d5f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: a0011c74f8f0 - main - sound: Expose EQ by default 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a0011c74f8f026e04803b9815198a56f50c247e6 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:06 +0000 Message-Id: <6a170dfe.26d5f.25d39963@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=a0011c74f8f026e04803b9815198a56f50c247e6 commit a0011c74f8f026e04803b9815198a56f50c247e6 Author: Christos Margiolis AuthorDate: 2026-04-16 14:26:25 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 sound: Expose EQ by default The dev.pcm.%d.eq* sysctls and mixer "bass" and "treble" controls are exposed only if hint.pcm.%d.eq is set. However, there is no good reason why we shouldn't at least expose the controls, and let the user enable/disable/bypass equalization through the sysctl. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- share/man/man4/pcm.4 | 9 --------- sys/dev/sound/pcm/feeder_chain.c | 2 +- sys/dev/sound/pcm/mixer.c | 17 +++-------------- sys/dev/sound/pcm/sound.c | 3 +-- sys/dev/sound/pcm/sound.h | 8 ++------ 5 files changed, 7 insertions(+), 32 deletions(-) diff --git a/share/man/man4/pcm.4 b/share/man/man4/pcm.4 index 4e70d95d5441..3f228d703b1a 100644 --- a/share/man/man4/pcm.4 +++ b/share/man/man4/pcm.4 @@ -197,9 +197,6 @@ The Parametric Software Equalizer (EQ) enables the use of controls (bass and treble). Commonly used for ear-candy or frequency compensation due to the vast difference in hardware quality. -EQ is disabled by default, but can be enabled with the -.Va hint.pcm.%d.eq -tunable. .Ss VCHANs Each device can optionally support more playback and recording channels than physical hardware provides by using @@ -230,12 +227,6 @@ driver. The following tunables can not be changed during runtime using .Xr sysctl 8 . .Bl -tag -width indent -.It Va hint.pcm.%d.eq -Set to 1 or 0 to explicitly enable (1) or disable (0) the equalizer. -Requires a driver reload if changed. -Enabling this will make bass and treble controls appear in mixer applications. -This tunable is undefined by default. -Equalizing is disabled by default. .It Va hint.pcm.%d.vpc Set to 1 or 0 to explicitly enable (1) or disable (0) the VPC feature. This tunable is undefined by default. diff --git a/sys/dev/sound/pcm/feeder_chain.c b/sys/dev/sound/pcm/feeder_chain.c index 4fc846f77496..35bb12a062ec 100644 --- a/sys/dev/sound/pcm/feeder_chain.c +++ b/sys/dev/sound/pcm/feeder_chain.c @@ -725,7 +725,7 @@ feeder_chain(struct pcm_channel *c) /* Soft EQ only applicable for PLAY. */ if (cdesc.dummy == 0 && - c->direction == PCMDIR_PLAY && (d->flags & SD_F_EQ) && + c->direction == PCMDIR_PLAY && (d->flags & SD_F_EQ_ENABLED) && (((d->flags & SD_F_EQ_PC) && !(c->flags & CHN_F_HAS_VCHAN)) || (!(d->flags & SD_F_EQ_PC) && !(c->flags & CHN_F_VIRTUAL)))) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 6ed2d0c3ce5c..8015c8fc0c32 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -304,7 +304,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int32_t muted, u_int lev) if (dev == SOUND_MIXER_PCM && (d->flags & SD_F_SOFTPCMVOL)) (void)mixer_set_softpcmvol(m, d, l, r); else if ((dev == SOUND_MIXER_TREBLE || - dev == SOUND_MIXER_BASS) && (d->flags & SD_F_EQ)) + dev == SOUND_MIXER_BASS) && (d->flags & SD_F_EQ_ENABLED)) (void)mixer_set_eq(m, d, dev, (l + r) >> 1); else if (realdev != SOUND_MIXER_NONE && MIXER_SET(m, realdev, l, r) < 0) { @@ -484,8 +484,7 @@ mix_setdevs(struct snd_mixer *m, u_int32_t v) d = device_get_softc(m->dev); if (d != NULL && (d->flags & SD_F_SOFTPCMVOL)) v |= SOUND_MASK_PCM; - if (d != NULL && (d->flags & SD_F_EQ)) - v |= SOUND_MASK_TREBLE | SOUND_MASK_BASS; + v |= SOUND_MASK_TREBLE | SOUND_MASK_BASS; for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { if (m->parent[i] < SOUND_MIXER_NRDEVICES) v |= 1 << m->parent[i]; @@ -706,15 +705,6 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) name = device_get_name(dev); unit = device_get_unit(dev); - if (resource_int_value(name, unit, "eq", &val) == 0 && - val != 0) { - snddev->flags |= SD_F_EQ; - if ((val & SD_F_EQ_MASK) == val) - snddev->flags |= val; - else - snddev->flags |= SD_F_EQ_DEFAULT; - snddev->eqpreamp = 0; - } m = mixer_obj_create(dev, cls, devinfo, MIXER_TYPE_PRIMARY, NULL); if (m == NULL) @@ -762,8 +752,7 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) } if (snddev->flags & SD_F_SOFTPCMVOL) device_printf(dev, "Soft PCM mixer ENABLED\n"); - if (snddev->flags & SD_F_EQ) - device_printf(dev, "EQ Treble/Bass ENABLED\n"); + device_printf(dev, "EQ Treble/Bass ENABLED\n"); } return (0); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 9eb2dffeb908..d98952d7a984 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -415,8 +415,7 @@ pcm_register(device_t dev, char *str) "mode (1=mixer, 2=play, 4=rec. The values are OR'ed if more than " "one mode is supported)"); vchan_initsys(dev); - if (d->flags & SD_F_EQ) - feeder_eq_initsys(dev); + feeder_eq_initsys(dev); if (snd_unit_auto < 0) snd_unit_auto = (snd_unit < 0) ? 1 : 0; diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 4795eb7585c5..7a05cb373054 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -105,17 +105,13 @@ struct snd_mixer; #define SD_F_REGISTERED 0x00000020 #define SD_F_BITPERFECT 0x00000040 #define SD_F_VPC 0x00000080 /* volume-per-channel */ -#define SD_F_EQ 0x00000100 /* EQ */ +/* unused 0x00000100 */ #define SD_F_EQ_ENABLED 0x00000200 /* EQ enabled */ #define SD_F_EQ_BYPASSED 0x00000400 /* EQ bypassed */ #define SD_F_EQ_PC 0x00000800 /* EQ per-channel */ #define SD_F_PVCHANS 0x00001000 /* Playback vchans enabled */ #define SD_F_RVCHANS 0x00002000 /* Recording vchans enabled */ -#define SD_F_EQ_DEFAULT (SD_F_EQ | SD_F_EQ_ENABLED) -#define SD_F_EQ_MASK (SD_F_EQ | SD_F_EQ_ENABLED | \ - SD_F_EQ_BYPASSED | SD_F_EQ_PC) - #define SD_F_BITS "\020" \ "\001SIMPLEX" \ /* "\002 */ \ @@ -125,7 +121,7 @@ struct snd_mixer; "\006REGISTERED" \ "\007BITPERFECT" \ "\010VPC" \ - "\011EQ" \ + /* "\011 */ \ "\012EQ_ENABLED" \ "\013EQ_BYPASSED" \ "\014EQ_PC" \ From nobody Wed May 27 15:30:07 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 4gQYTW4KKZz6fCJK for ; Wed, 27 May 2026 15:30:07 +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 4gQYTW1PP0z3Sln for ; Wed, 27 May 2026 15:30:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895807; 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=T1af2xo5tFvxNaQMukkkjFJQBQ6WYCy0CJYBZSEqWaM=; b=G3oCnj+KefZCqhce+ek1O3BX5lmPIFTBVD/vj9+SlNabibzhTNLYbG4NB21OKAdjE3l9Rp S5cvCYT1cMkVOjcL8JQIKK+PJS511Fu4Cgbz3+oG6fpsdo4ndoF/HCd4vjRoGhhxjXprTU nrY1g44v0HLpTsR+KY+WojteN1+E+12T2HFxqZiGugyVtxvrJiw4aFYgkqPcT1sbsMWGAR 4pTCkb0knK3eJmqmRqtL4qXsn/2+/bTIafQLDdYvkhvZJGfrGoTTeTyvGZiLq5G7QA2+OU G/JxKiO3LvxyOnncUGqdjp0oa9+pinfF5/0SBrnKUFszCahLuQl0lHsdq4M2vA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895807; a=rsa-sha256; cv=none; b=jq9pJpSL70Y0xdOd2U13vvd3ISSKRXaQLBh7wBgY9rbQgPwkcLLADfVFMicMSJZwlMhcNp n774K6RXW/CewTkbIO2U2SIWG37+SQvPephzn6gvcH9EY4vWuUNJdzCT0bvOqGnv7wd9UB VzKuOGrYezL7MJyZOcdS8A14LnA0vv709ovcBSdGQQJmC3agsqnDa74GZMR05Jv0Pk4F2M e+GyJY71QvVE+ouVXzKD2egSsObPmSp08bhIlz9wVzfMej7AMM+u/CvVYNnTWh7LO4b0eI tLOG6zzs1rSmLiJe7V1Co2BlHIf9FwvZbUTD23AfBH5vID+QhRQO4mq3sxUdMw== 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=1779895807; 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=T1af2xo5tFvxNaQMukkkjFJQBQ6WYCy0CJYBZSEqWaM=; b=pGyh2gG3FKXmKnCzm/bsyiwct3Y5VIsWmfQfGNUgvV57XNYy65FuJuBp65DUwXrjhmkJiM 5SpUbnliogR+Llx4IBvqhsLYGiLyT5XUrS50/ztC1QOr3R6exRP2RH2K+6zv+vddnIeedn Nz8jL+HVzDn7owWxcE33gR6oIj5EoillHxpnn+5x2BIKJWToYwWJFWZgxohBQ3tvlsSZnt V1WMVW/c1SU8aEmnRk8ahK6ifuDGVnh+3pDtzv5+I77xL2iz52QLILHyNKsCTnWPsbQUTI jp+utIevxmf+E0/RwuAed92vfCEmqmkiPOLmXliFZEhP0cJyRmGXmn3Wen4WfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTW0kBbz14WM for ; Wed, 27 May 2026 15:30:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25fe1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 54a03b44ae38 - main - sound: Retire FEEDEQ_BYPASS 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 54a03b44ae386e26d29df6eece3fadb5c0d1105a Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:07 +0000 Message-Id: <6a170dff.25fe1.484f2a0a@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=54a03b44ae386e26d29df6eece3fadb5c0d1105a commit 54a03b44ae386e26d29df6eece3fadb5c0d1105a Author: Christos Margiolis AuthorDate: 2026-04-17 14:45:40 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 sound: Retire FEEDEQ_BYPASS In effect, this is the same as the disable state. There is a comment that says the bypass state skips EQ altogether, which is what the disable should be. The disable state according to the comment disables EQ but keeps the EQ preamp (dev.pcm.%d.eq_preamp), however after testing it seems that the preamp does not really take effect, because with EQ disabled, feeder_eq is non existent, so we never execute any EQ code in the first place. Make things simpler and clearer and have 2 states; enable and disable, and do what they should do intuitively. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- sys/dev/sound/pcm/channel.c | 4 +--- sys/dev/sound/pcm/feeder.h | 1 - sys/dev/sound/pcm/feeder_eq.c | 26 +++++++------------------- sys/dev/sound/pcm/sound.h | 4 ++-- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index c1e0d8d3bc52..be6d7f82f502 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2209,9 +2209,7 @@ chn_syncstate(struct pcm_channel *c) device_printf(c->dev, "EQ: Failed to set preamp -- %d\n", d->eqpreamp); - if (d->flags & SD_F_EQ_BYPASSED) - state = FEEDEQ_BYPASS; - else if (d->flags & SD_F_EQ_ENABLED) + if (d->flags & SD_F_EQ_ENABLED) state = FEEDEQ_ENABLE; else state = FEEDEQ_DISABLE; diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index e1e91d468455..7d14022c6849 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -122,7 +122,6 @@ enum { FEEDEQ_STATE, FEEDEQ_DISABLE, FEEDEQ_ENABLE, - FEEDEQ_BYPASS, FEEDEQ_UNKNOWN }; diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c index 4cf9d4f6695f..8f3acbf4e156 100644 --- a/sys/dev/sound/pcm/feeder_eq.c +++ b/sys/dev/sound/pcm/feeder_eq.c @@ -334,8 +334,7 @@ feed_eq_set(struct pcm_feeder *f, int what, int value) info->preamp = FEEDEQ_PREAMP2IDX(value); break; case FEEDEQ_STATE: - if (!(value == FEEDEQ_BYPASS || value == FEEDEQ_ENABLE || - value == FEEDEQ_DISABLE)) + if (!(value == FEEDEQ_ENABLE || value == FEEDEQ_DISABLE)) return (EINVAL); info->state = value; feed_eq_reset(info); @@ -370,13 +369,7 @@ feed_eq_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, info = f->data; - /* - * 3 major states: - * FEEDEQ_BYPASS - Bypass entirely, nothing happened. - * FEEDEQ_ENABLE - Preamp+biquad filtering. - * FEEDEQ_DISABLE - Preamp only. - */ - if (info->state == FEEDEQ_BYPASS) + if (info->state == FEEDEQ_DISABLE) return (FEEDER_FEED(f->source, c, b, count, source)); dst = b; @@ -482,9 +475,7 @@ sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS) PCM_LOCK(d); PCM_WAIT(d); - if (d->flags & SD_F_EQ_BYPASSED) - val = 2; - else if (d->flags & SD_F_EQ_ENABLED) + if (d->flags & SD_F_EQ_ENABLED) val = 1; else val = 0; @@ -495,18 +486,15 @@ sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS) err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val != oval) { - if (!(val == 0 || val == 1 || val == 2)) { + if (!(val == 0 || val == 1)) { PCM_RELEASE_QUICK(d); return (EINVAL); } PCM_LOCK(d); - d->flags &= ~(SD_F_EQ_ENABLED | SD_F_EQ_BYPASSED); - if (val == 2) { - val = FEEDEQ_BYPASS; - d->flags |= SD_F_EQ_BYPASSED; - } else if (val == 1) { + d->flags &= ~(SD_F_EQ_ENABLED); + if (val == 1) { val = FEEDEQ_ENABLE; d->flags |= SD_F_EQ_ENABLED; } else @@ -612,7 +600,7 @@ feeder_eq_initsys(device_t dev) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "eq", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, d, sizeof(d), sysctl_dev_pcm_eq, "I", - "Bass/Treble Equalizer (0=disable, 1=enable, 2=bypass)"); + "Bass/Treble Equalizer (0=disable, 1=enable)"); (void)snprintf(buf, sizeof(buf), "Bass/Treble Equalizer Preamp " "(-/+ %d.0dB , %d.%ddB step)", diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 7a05cb373054..4d527d69086a 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -107,7 +107,7 @@ struct snd_mixer; #define SD_F_VPC 0x00000080 /* volume-per-channel */ /* unused 0x00000100 */ #define SD_F_EQ_ENABLED 0x00000200 /* EQ enabled */ -#define SD_F_EQ_BYPASSED 0x00000400 /* EQ bypassed */ +/* unused 0x00000400 */ #define SD_F_EQ_PC 0x00000800 /* EQ per-channel */ #define SD_F_PVCHANS 0x00001000 /* Playback vchans enabled */ #define SD_F_RVCHANS 0x00002000 /* Recording vchans enabled */ @@ -123,7 +123,7 @@ struct snd_mixer; "\010VPC" \ /* "\011 */ \ "\012EQ_ENABLED" \ - "\013EQ_BYPASSED" \ + /* "\013 */ \ "\014EQ_PC" \ "\015PVCHANS" \ "\016RVCHANS" From nobody Wed May 27 15:30:08 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 4gQYTX3XCCz6fC6q for ; Wed, 27 May 2026 15:30:08 +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 4gQYTX1X1lz3Sxq for ; Wed, 27 May 2026 15:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895808; 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=hjfDuZe2q84+/YUkcdxG98p4aVypiS3nzPVIZs3DMsM=; b=Oho5nXaOXCf+BbPzEH7vpx7sBb4lQXkc2035TtqPw4GrAe85ldpYb6xLS9py/agdPQpnp9 KyydS0BRIEXnhAYUP9qs90FcY9VyTNRp9akNvTLn3XIHmgK9Xd7vXTul0dqmHxZsu0YRNU S4HMXVyFLsVHaseKImxaG0Ju5m3/yQ0ZDAlags9nhzS8ea7wtbRTJu4nCmcm5eC9nPBUzB HSO7idEFGpaSi937W7mYLwTerPGYHvQKVW94CyKZINoSkUv0RW7WtX2zt5wkvQXfnnK9/v sG5f+A1BG0zT6H7kMqpx2zvzAKbQcutca+sm7Mrxo7tOnwYM+xzQqQ0O+AvUDw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895808; a=rsa-sha256; cv=none; b=Q5jm38Fo12qBqCEbz8orlWrFduLGadQSFV1mdAI2vgyZuVmItc9CxGecDnv7cYRTC7WOHO mYntgibZPYvyk3B0GmYyXth04t4iIgpSJZuW8cwnlFJvSXmi9cXygELLej3olRGSNRVgl8 GwSfUUWAiH7wHwufWaVxNcRvadDgXHrVOcjd/XmoAdkZi+CJ7bDWF4eHT2bo8j1gtAtsE5 wVGRYn/lVTC6fTEXCpCauhfBnIX3oV9Lyel2Ku1c8jPS7qgRM+xV0ArEKn3DcYytvxrEjd XsOe48nVWyUkdDLPp5wGKHsiokxIffDCmFzea/YNddnwOPerJEIvczKYfDCxpg== 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=1779895808; 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=hjfDuZe2q84+/YUkcdxG98p4aVypiS3nzPVIZs3DMsM=; b=WwmvqN0A/858IpvLWu2QmDDjDFPT/P0eI2O4utsTSiyMa2/LXf0sq4AUEyEz4nkjl+XcbT 0lpYEqN1ULT5r9cuTD+Cp0+fJYKGn6jI1urRTx0bviuc11w5AJILf6npyvKfpdmEXavXL0 InIkAGZLVPv4YruDfIiLptitwGSn+StXapteU0aXdtSQbBd9ljjhZ6OMKmCV88qwXsJ8Os 1oQ0YAzR7JfqXUPt2iSST8porMWgqPWqTtpuyfzXg/LwWzqo+1jNI8GwovtipiL2Iupc7P eizlrsUSAUqwUZlBTZlQ/sI7ejXQ95p+GobsTf5BOIObaucgisZQHqASfq0Isw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTX14FSz14QD for ; Wed, 27 May 2026 15:30:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27f29 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 6f130b220d7c - main - sound: Remove dead EQ FEEDEQ_DISABLE code 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f130b220d7ce64ce65f076a21edea034d14482b Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:08 +0000 Message-Id: <6a170e00.27f29.454c1d56@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6f130b220d7ce64ce65f076a21edea034d14482b commit 6f130b220d7ce64ce65f076a21edea034d14482b Author: Christos Margiolis AuthorDate: 2026-04-17 15:05:33 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 sound: Remove dead EQ FEEDEQ_DISABLE code If EQ is disabled, we never reach those code paths in the first place. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- sys/dev/sound/pcm/feeder_eq.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c index 8f3acbf4e156..fe47a9d7e434 100644 --- a/sys/dev/sound/pcm/feeder_eq.c +++ b/sys/dev/sound/pcm/feeder_eq.c @@ -148,19 +148,6 @@ feed_eq_biquad(struct feed_eq_info *info, uint8_t *dst, uint32_t count, pmul = feed_eq_preamp[info->preamp].mul; pshift = feed_eq_preamp[info->preamp].shift; - if (info->state == FEEDEQ_DISABLE) { - j = count * info->channels; - dst += j * AFMT_BPS(fmt); - do { - dst -= AFMT_BPS(fmt); - v = pcm_sample_read(dst, fmt); - v = ((intpcm64_t)pmul * v) >> pshift; - pcm_sample_write(dst, v, fmt); - } while (--j != 0); - - return; - } - treble = &(info->coeff[info->treble.gain].treble); bass = &(info->coeff[info->bass.gain].bass); @@ -369,9 +356,6 @@ feed_eq_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, info = f->data; - if (info->state == FEEDEQ_DISABLE) - return (FEEDER_FEED(f->source, c, b, count, source)); - dst = b; count = SND_FXROUND(count, info->align); From nobody Wed May 27 15:30:09 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 4gQYTY5YSyz6fC9n for ; Wed, 27 May 2026 15:30:09 +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 4gQYTY26Ktz3Sjb for ; Wed, 27 May 2026 15:30:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895809; 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=N5h0Oh8/f3vgP7Zjh/Gj2a3MNJOrLbRlZfa3ZWtc0sM=; b=Eo1HiNTFwIQjazTVvOXB9nrWVPvoubZ7XdBiag7mv5EzWy/mtCh6RrW16rEgjskCiD5Qce IjQo5UiHMIQ2T3tMFmGKK51eTJ8OIEIt2N2pkf6EYnACJO5JWh9cCI/YuQeBlFcsBEP7ou +HvKTCECCrteMPmvy/VQuNtClpeXUCI0BTcXm9oEUOFLr9U/ejVMMtL8HiY7ChbQp0SHEM PGKaagGhrNxDd4ZkhTcPOxf25vnXYt/UQJNCgs1Kf/jazghs0u/Mmca2b74b3iQmLXFHq5 BB3ZWS9orCr5lpnP3DMfDj9H1uR+mdDPruFs00hDK2s01aVgMLPTXYyPtxUitw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895809; a=rsa-sha256; cv=none; b=Qs+R1LJIARSjNmhW4/17QAwoVc66MsimDqVVpbyqv8v9ohWNm/5c3lbHXm4M3aBPFL/3w8 EJ7bQizYGQxiQ1BAUIvJTUvj9J8vcnTGaGGrVxmmLtC//XcOh73UIZMLntLT7y+KuwnIV5 3SkJ3faBLhTEiBZFnJVW08SmTdJ68apEWgkKAKPaL/WoLBcijGMB3JBUdTQhi2kmpLAd3J qBBvPm9GMfnk8dVK8APaVqXDkUsvGCiTBMqzTqFI5ISqLIsmLA4uU828KQVZOCRlbQHU3P q8RSjsQE8eOLEoS44ME9+j/+nj5N1EuuEqlalpzd6pB41qFvokOZtsp/b7HlOQ== 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=1779895809; 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=N5h0Oh8/f3vgP7Zjh/Gj2a3MNJOrLbRlZfa3ZWtc0sM=; b=uxEOu0osEoiXQY8YlIpOCekaAeGPGSNunGNRLjx1IuOdXOXmEV00N9jVTLN5TCe7dDT3f3 +h9OBPn1xbv2IoGNo3NtSXR4le4u4Q75QdqPL82OusYyVyl6r8dtFK2LVvHoeyB4h3r1Me Ma4K+PPcaEn+A8B4E/ncmjjXAAiMfPXEMx2TvIWP3ISWmlUKOk6pywTl+GsN9nmGDYM0Aq oNp4u17hIXYUYnyBOUcKcX3n8+waSagKbrdnwl8+MpQMFCYeQb1z1IzU0KImUTTbYE2Qej uxKtiI3PaCxG9nfFQGokM29bb1Tu4882LrqD64Xgch4/9Yzy3+LWlSCqziAUvg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTY1PnGz14nw for ; Wed, 27 May 2026 15:30:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27f94 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: f5d6e5cb5c3e - main - sound: Retire FEEDEQ_DISABLE 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5d6e5cb5c3e0593d24c90671d72654aa59cdd1a Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:09 +0000 Message-Id: <6a170e01.27f94.274215ca@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=f5d6e5cb5c3e0593d24c90671d72654aa59cdd1a commit f5d6e5cb5c3e0593d24c90671d72654aa59cdd1a Author: Christos Margiolis AuthorDate: 2026-04-17 15:14:46 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 sound: Retire FEEDEQ_DISABLE We can do this more efficiently by just using the SD_F_EQ* flags. In fact, the dev.pcm.%d.eq handler will (un)set SD_F_EQ_ENABLED and this is what we actually test with when choosing to creating the EQ feeder or not, so setting the state to FEEDEQ_DISABLE does not really an effect in the first place. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- sys/dev/sound/pcm/channel.c | 12 ++++-------- sys/dev/sound/pcm/feeder.h | 1 - sys/dev/sound/pcm/feeder_eq.c | 5 ++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index be6d7f82f502..c97a3158dbd9 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2177,7 +2177,7 @@ chn_syncstate(struct pcm_channel *c) if (c->feederflags & (1 << FEEDER_EQ)) { struct pcm_feeder *f; - int treble, bass, state; + int treble, bass; /* CHN_UNLOCK(c); */ treble = mix_get(m, SOUND_MIXER_TREBLE); @@ -2209,13 +2209,9 @@ chn_syncstate(struct pcm_channel *c) device_printf(c->dev, "EQ: Failed to set preamp -- %d\n", d->eqpreamp); - if (d->flags & SD_F_EQ_ENABLED) - state = FEEDEQ_ENABLE; - else - state = FEEDEQ_DISABLE; - if (FEEDER_SET(f, FEEDEQ_STATE, state) != 0) - device_printf(c->dev, - "EQ: Failed to set state -- %d\n", state); + if (d->flags & SD_F_EQ_ENABLED && + FEEDER_SET(f, FEEDEQ_STATE, FEEDEQ_ENABLE) != 0) + device_printf(c->dev, "EQ: Failed to enable\n"); } } } diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index 7d14022c6849..10bfe9dca8f3 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -120,7 +120,6 @@ enum { FEEDEQ_BASS, FEEDEQ_PREAMP, FEEDEQ_STATE, - FEEDEQ_DISABLE, FEEDEQ_ENABLE, FEEDEQ_UNKNOWN }; diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c index fe47a9d7e434..6fd7d7f2bfff 100644 --- a/sys/dev/sound/pcm/feeder_eq.c +++ b/sys/dev/sound/pcm/feeder_eq.c @@ -321,7 +321,7 @@ feed_eq_set(struct pcm_feeder *f, int what, int value) info->preamp = FEEDEQ_PREAMP2IDX(value); break; case FEEDEQ_STATE: - if (!(value == FEEDEQ_ENABLE || value == FEEDEQ_DISABLE)) + if (value != FEEDEQ_ENABLE) return (EINVAL); info->state = value; feed_eq_reset(info); @@ -477,12 +477,11 @@ sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS) PCM_LOCK(d); - d->flags &= ~(SD_F_EQ_ENABLED); if (val == 1) { val = FEEDEQ_ENABLE; d->flags |= SD_F_EQ_ENABLED; } else - val = FEEDEQ_DISABLE; + d->flags &= ~SD_F_EQ_ENABLED; CHN_FOREACH(c, d, channels.pcm.busy) { CHN_LOCK(c); From nobody Wed May 27 15:30:10 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 4gQYTZ5vR1z6fCJM for ; Wed, 27 May 2026 15:30:10 +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 4gQYTZ36Bvz3SmR for ; Wed, 27 May 2026 15:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895810; 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=wkbhoSYiVG7FBDpASfC8QQxjAKJiPqWc+3Elo7XKpos=; b=vftzmUWz3WlO8WQq44ReHfhss2YTMRyofbfSUatzcAwydB1Q6I/ffUYatuWzJeFw+BVVMO s7icFcEkV8/g4QUrmzwXZzRnbBv9cMuSwmcH2irNnPhHS1I5StvimqpWN/tjfJrRf7mj7n gMG6AWmVJBBk4rBn1lPySbxyWZYjESagDfPANcLIfzEohDkew3k9D7VJxtFan3OFuZzj2S Lz7SlVy0ZGutPCHDPdyyMVBQiE49wCyI+Y/4C9PDqrVu/c/6i+lgnbXmsOx+gvBChWXbCt R8ltkcP57uuq3E8oyMg+0Ri8qhbu9t4yUng5P61UJFvYGd/u6NdPewiwBESlUw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895810; a=rsa-sha256; cv=none; b=JAqBUhLT+IIkqjtzcpUovns12CbQ/eGcRdOJUy+B/zrBZf7+9mIJmOA8h88RXs2Jx8RyIp Q9oRKFQ7Jhi5EbBv3nenWem4OBqBpi/Ur61bGDJKmHyVx3RBf0rNtz5/6+N/08Tn93ZNDT omK13C0k1mdvnGBj2s6ZidfWA8eA0mkjn30mSJI4FUyBvHC8giQ+/hfh97u1anebKXzveP SjA1NaoVnkCsGIueyS2CG7ptj3Lu+TvBgatbJdraOKpQEAT8yAeKKHhJLttAfNx0F+gIMM 1i2R7cl1UWWMSp43Piz+HQPZbrZGuSiGIevmio50gYgP16SeG6liOHF45DUb3A== 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=1779895810; 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=wkbhoSYiVG7FBDpASfC8QQxjAKJiPqWc+3Elo7XKpos=; b=iazxV0Ht3tGv6bq5KWXP/KPht19lotjWOPcc0bnZlvbxKOPpi2BYDnVAY4pU1zObbbZsd6 fCfGo66xf8kfNbNTfe6Fo5ZUIEKj3/W8UwKWzIWxna9VLJi9NdGidcTdRHE0/qM/l1UeXX 0tEfMUJ/XYlKDxDAsjjobmwQE6tEPJ2ZCAEIGRcpBhLc/Gv6wwo7JRgb3OnkZG+LOOcf+2 A0Tm/D6XwuuxKAIRfixgla0HXD2EAY5nZowGVSaRmsEn1aDFWWwwdR+BRL3vcJ2zsZKfM1 u82A+0mvFYIUHpVeHyB7CVYdAok91jg+hOF+YggPyZ/0S53n58d1hPiSvoO75w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTZ1mVbz14QH for ; Wed, 27 May 2026 15:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3000d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 88bc1d7325aa - main - sound: Retire EQ states 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88bc1d7325aa97520f7a308d70a5fcb39acdc5d2 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:10 +0000 Message-Id: <6a170e02.3000d.7bf78db0@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=88bc1d7325aa97520f7a308d70a5fcb39acdc5d2 commit 88bc1d7325aa97520f7a308d70a5fcb39acdc5d2 Author: Christos Margiolis AuthorDate: 2026-04-17 15:23:38 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 sound: Retire EQ states The SD_F_EQ_ENABLED does the same thing, and is actually what we test against in order to create the EQ feeder. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- sys/dev/sound/pcm/channel.c | 3 --- sys/dev/sound/pcm/feeder.h | 3 --- sys/dev/sound/pcm/feeder_eq.c | 25 ++----------------------- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index c97a3158dbd9..a0ee16a14386 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2209,9 +2209,6 @@ chn_syncstate(struct pcm_channel *c) device_printf(c->dev, "EQ: Failed to set preamp -- %d\n", d->eqpreamp); - if (d->flags & SD_F_EQ_ENABLED && - FEEDER_SET(f, FEEDEQ_STATE, FEEDEQ_ENABLE) != 0) - device_printf(c->dev, "EQ: Failed to enable\n"); } } } diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index 10bfe9dca8f3..127b479cd7c9 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -119,9 +119,6 @@ enum { FEEDEQ_TREBLE, FEEDEQ_BASS, FEEDEQ_PREAMP, - FEEDEQ_STATE, - FEEDEQ_ENABLE, - FEEDEQ_UNKNOWN }; int feeder_eq_validrate(uint32_t); diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c index 6fd7d7f2bfff..fdb786171d5a 100644 --- a/sys/dev/sound/pcm/feeder_eq.c +++ b/sys/dev/sound/pcm/feeder_eq.c @@ -122,7 +122,6 @@ struct feed_eq_info { uint32_t rate; uint32_t align; int32_t preamp; - int state; }; #if !defined(_KERNEL) && defined(FEEDEQ_ERR_CLIP) @@ -277,7 +276,6 @@ feed_eq_init(struct pcm_feeder *f) info->treble.gain = FEEDEQ_L2GAIN(50); info->bass.gain = FEEDEQ_L2GAIN(50); info->preamp = FEEDEQ_PREAMP2IDX(FEEDEQ_PREAMP_DEFAULT); - info->state = FEEDEQ_UNKNOWN; f->data = info; @@ -303,8 +301,6 @@ feed_eq_set(struct pcm_feeder *f, int what, int value) if (feeder_eq_validrate(value) == 0) return (EINVAL); info->rate = (uint32_t)value; - if (info->state == FEEDEQ_UNKNOWN) - info->state = FEEDEQ_ENABLE; return (feed_eq_setup(info)); case FEEDEQ_TREBLE: case FEEDEQ_BASS: @@ -320,12 +316,6 @@ feed_eq_set(struct pcm_feeder *f, int what, int value) return (EINVAL); info->preamp = FEEDEQ_PREAMP2IDX(value); break; - case FEEDEQ_STATE: - if (value != FEEDEQ_ENABLE) - return (EINVAL); - info->state = value; - feed_eq_reset(info); - break; default: return (EINVAL); } @@ -449,8 +439,6 @@ static int sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS) { struct snddev_info *d; - struct pcm_channel *c; - struct pcm_feeder *f; int err, val, oval; d = oidp->oid_arg1; @@ -477,20 +465,11 @@ sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS) PCM_LOCK(d); - if (val == 1) { - val = FEEDEQ_ENABLE; + if (val == 1) d->flags |= SD_F_EQ_ENABLED; - } else + else d->flags &= ~SD_F_EQ_ENABLED; - CHN_FOREACH(c, d, channels.pcm.busy) { - CHN_LOCK(c); - f = feeder_find(c, FEEDER_EQ); - if (f != NULL) - (void)FEEDER_SET(f, FEEDEQ_STATE, val); - CHN_UNLOCK(c); - } - PCM_RELEASE(d); PCM_UNLOCK(d); } else From nobody Wed May 27 15:30:11 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 4gQYTb5fyyz6fCJV for ; Wed, 27 May 2026 15:30:11 +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 4gQYTb3QKqz3SyH for ; Wed, 27 May 2026 15:30:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895811; 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=PqnIZB+cGfU4N21E7gyII7jW8sRBCy4BwRZvkAGkv/Q=; b=cYD4+W4P8lryACMgalnlBazzQctOLvGjNVRFIWFuk/37Rt6N/+K4q92/8rCK6s9ZUhMo2o vxJRQvjBK91AvyBajZZCTOA8xBtVnERA0Wea20W4t1wFpb5IEbfcSVbS3sUjKc4HgrFmjO ObzWZAr2Ia947cq/a4sSIaSa8kcGrSVgunjC7jeNHwWNLiJZ2bFxqdxPgne/TaekHvUS0w bcneKWGqSP1GT0eToJik8Yqyt7sHgSpwqzivGBCbIzXXdBthN16iTufFPQvagdWpXi45Mj 3vdA9A6HcFJjRsi9IDTyRPl86rGZVEZmFGY4cNgid1TOmEY6INTf9AyIidDMpw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895811; a=rsa-sha256; cv=none; b=rr+Rm0UCRolPvVCbJXAHTiU8xCwVx8CRwj6afVlxwt3i5kpalxglKwOzaQYBjiilXOTcYJ POr4wCZ7MV491uoxsLaGMzM0veIb5AD92FGhupRx0zpqZg0w/T46ETyTkKvjJT9TQ5C5vp oW3cWLjf4ZKXssRL7LLkOsuZnt951ObuRn5cTZTeAaq8w9afzJzrFQxi/LQ6VRHWDT+8Ft eaI3k+fxT6N8ZQw2JOurhjRdAgFk1d2ct/uCwtcsImPskZZy/3Hy53TQXf10fsH3LP8vG3 XDM/C4Kcm+t81Yb3URUAALmftDSSFouMl3xvSpIwN0jvE+l9PAyIlGAAQ8DIiA== 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=1779895811; 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=PqnIZB+cGfU4N21E7gyII7jW8sRBCy4BwRZvkAGkv/Q=; b=mR2I+rJBWuVUZIe3IVf28qGlpnfFHMSlzMRpiGUMRWS2EP4FXoEYs/WUDI2im6ibDlVW0a rN3RdfG/5r+HYRjAEf1v151N7ppgRiTj8o9NJQ64i4cwPml0cNpObjifrGFTl0Dj1SuE4P wJr6WK59yyrhpKga+a7C31GPUMqurGVvEJvp/mHk0SmBpbmFj2YeBgiZ/+h2hPbj8BARBG jChuBY0V3pwZMVYm+scXJGC493yTVu8Dk3Uga/kFLpozt/7cwzT1c8YrrpOPP+YOy0a4JS SWRRUMVqjbKNjXDfzlq92YPIqOlHW3HhyTE2/VGXW9ipFMoHm+FkHUW4HVxcSg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTb2DT1z14jJ for ; Wed, 27 May 2026 15:30:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 271ae by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 3a3cb16ad418 - main - sound: Retire hint.pcm.%d.eq_preamp 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a3cb16ad4181700d787e6b24bedafe85c791901 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:11 +0000 Message-Id: <6a170e03.271ae.55ca0d60@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=3a3cb16ad4181700d787e6b24bedafe85c791901 commit 3a3cb16ad4181700d787e6b24bedafe85c791901 Author: Christos Margiolis AuthorDate: 2026-04-17 16:14:44 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 sound: Retire hint.pcm.%d.eq_preamp It wasn't documented in the first place, but it is easier to just use the sysctl. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- sys/dev/sound/pcm/feeder_eq.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c index fdb786171d5a..9179148d2bd2 100644 --- a/sys/dev/sound/pcm/feeder_eq.c +++ b/sys/dev/sound/pcm/feeder_eq.c @@ -542,17 +542,11 @@ void feeder_eq_initsys(device_t dev) { struct snddev_info *d; - const char *preamp; char buf[64]; d = device_get_softc(dev); - if (!(resource_string_value(device_get_name(dev), device_get_unit(dev), - "eq_preamp", &preamp) == 0 && - (d->eqpreamp = feed_eq_scan_preamp_arg(preamp)) != - FEEDEQ_PREAMP_INVALID)) - d->eqpreamp = FEEDEQ_PREAMP_DEFAULT; - + d->eqpreamp = FEEDEQ_PREAMP_DEFAULT; if (d->eqpreamp < FEEDEQ_PREAMP_MIN) d->eqpreamp = FEEDEQ_PREAMP_MIN; else if (d->eqpreamp > FEEDEQ_PREAMP_MAX) From nobody Wed May 27 15:30:12 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 4gQYTc5nBsz6fCJZ for ; Wed, 27 May 2026 15:30:12 +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 4gQYTc399Rz3T3f for ; Wed, 27 May 2026 15:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895812; 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=sfZB0CF595OIiy8DZpsMgb13NcDYGYGBG3aNPuY8tc4=; b=ylHynQ3UEVokUA1uCWNVwt/fC/V08aCXdx8CVH8uaHFATRTnaZc0gp7FZYzuc5H+8FWqra 05x2d/o1JJDbqmNOoXpC478qO8+Q2u7vmllnh7p/NqcdccU2DtK84ne/cQDpN5CjwGdZjB +526X20e4fK0mnGxs43NCFr7L4FrsURyZGTltgCKp3cc8qQa76VQQ0yM6oh3bguxifOk5E 949+MHx3oIZS/USpYw0+yH86vfawT6kBHg+DTOzmhwykEUpbcJp9V4UFGwZs9iA/twGpDa oYU0Kij80StwKM61a/YiTTtmZI+01kfGcCYJtST636fGIsftlyLZF5U22+memg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895812; a=rsa-sha256; cv=none; b=QnEisLE89b5l/y7ZjJ+XMPYF1BxWqF72kcsdW35I/qRPMIL2syKPzsjZSbGRPkv35+zEnl F9VH+VZ0mRJG2sCv18zwXQmYoARjBxRmH9zHVVM8Dj/rAN0lGJtLsXEvtUL06Mw1maKjWC BcVnUU79UkB0gEu0RhSmhd6VSeDsuYtHPHpBnJ4qYh8IO9e/P7wzHBRX8Q4OOKqyei0NJb P/MyQ/qUI014vHFkkgA5WtBs7rumRvK1/kVrz/dhep8JyOtQELU+wsLLPqcKGZBYCfJ0d4 Wbb/nkT/g7p4nqq1r4EyzyEzEFWEudcWsibZRVUssq9njMyUgBPLOVQ9apn9Ow== 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=1779895812; 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=sfZB0CF595OIiy8DZpsMgb13NcDYGYGBG3aNPuY8tc4=; b=gYNecErXUnMEVqbCXOnkKgWSy8cT32oWjsQOx2o8LEECy9nKizpe3K1q3kK8c9qK+J929Y kquWAwv5ELl9GEvFG7j8hVcZeGYF6NWWlhYBX/2n64ae5lIJCoUYzk03Gk9Ld3hkHd5GBV GHdk6zVA7h/JUMOoPr9bqfQMsu/yk+srCVGXz0RLegNBVhigfR9IlIejBIUg+Fev6BLQK/ su2UDUG1taeZlMjwNse6BuYMDuSc9v6katpbSHDNwuGoPmNNDydRxNtubFDJIf1CB+RnRs ToLilRgjbob7dtuCg3Y3JNCjM/MC4Tf3ORK9q3ZfM0Bb9ZnRk0LCdHM+N409Ag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTc2k27z14ny for ; Wed, 27 May 2026 15:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 272e3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 98a62ccab6ac - main - pcm.4: Document dev.pcm.%d.eq* 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98a62ccab6ac30d13c2dbcdc7468af8f87df4ec9 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:12 +0000 Message-Id: <6a170e04.272e3.7fd69b48@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=98a62ccab6ac30d13c2dbcdc7468af8f87df4ec9 commit 98a62ccab6ac30d13c2dbcdc7468af8f87df4ec9 Author: Christos Margiolis AuthorDate: 2026-04-17 15:47:44 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 pcm.4: Document dev.pcm.%d.eq* Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- share/man/man4/pcm.4 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/share/man/man4/pcm.4 b/share/man/man4/pcm.4 index 3f228d703b1a..b0f944a0d443 100644 --- a/share/man/man4/pcm.4 +++ b/share/man/man4/pcm.4 @@ -430,6 +430,17 @@ the definitive format/rate target. The recommended way to use bitperfect mode is to disable VCHANs and enable this sysctl. Default is disabled. +.It Va dev.pcm.%d.eq +Set to 1 or 0 to enable (1) or disable (0) the equalizer. +Default is disabled. +When enabled, the mixer bass and treble controls can be used, as well as the +.Va dev.pcm.%d.eq_preamp +tunable. +.It Va dev.pcm.%d.eq_preamp +Equalizer preamp (in dB). +.Va dev.pcm.%d.eq +has to be enabled, in order for this tunable to take effect. +Read the tunable's description to see the available range of values. .It Va dev.pcm.%d.[play|rec].vchans Enable (1) or disable (0) VCHANs. Default is enabled. From nobody Wed May 27 15:30:13 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 4gQYTd5PxPz6fCGH for ; Wed, 27 May 2026 15:30:13 +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 4gQYTd3xlKz3T3q for ; Wed, 27 May 2026 15:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895813; 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=KgDeuZ7bYKrf6HDtiCJXlFHTJR+g0UPsbn2q3AgPLII=; b=YgDwk4Itvil9UqcdVJlxv1YBlCeJcJ4hkSXLXc15yUzclPcvjhWdV6d7XH4XjcoEHWrAbN gkjbyECsPP+ju2b/shvJgf5NVkAncIchuG43u/Q61QWuPIr0llZ/7QhLzkHy/V7viBwcyR N449/5MhC/4+0maDdN1dSuqS8O32dFNp5IsjwGhrY4iUNlRMDyGRhcKVxmBCOz1uYRExu8 D5FH5Q4uZgaAMji532sHuErT3r4cfo9kI8w8/J9cpo+GqF8B+nVFLItInLKU+r2O6Fbp31 AL9c7KmpFu3UGDG7OWC7TJKx1L7sehWU8yjmL9xUzLOB3d/YbFEXGhTmFUsJiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895813; a=rsa-sha256; cv=none; b=yrymQ7RsBFgMOhv+cttutvwglRgd7T1rMPWk0X4glVu5dkthQEW8gcg0/hzn5+6hCTna19 6AD4VXSBfQ4LX9qiMSy+bb5xhPQShTPgEoL79s0ouFffIUCO6FeIPlFZoU3qn+k06g/19u 8MugX8Yx7LMu4OKgDFFJWYNVXvc+I8SSMtgF2uLKqvgA4GTaQxAhi9J29ewgfUFz1xfi2i mi6pcg+qtwaticFOE3ACyRwbuXOzfzN8r51CTg0+8h9EcUckbuehQZ6dXUsD5jiKKcxJ1D DEX6EPZc1eEbGLSCwVknwZ44+A3m7o4/Mre2YbDRS6ULdx3the+wZWlThIycTQ== 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=1779895813; 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=KgDeuZ7bYKrf6HDtiCJXlFHTJR+g0UPsbn2q3AgPLII=; b=Unw5qm3N013eZvEcQJ2NA2sqi9YP7TIQCErPoykZWaT+0w5s+xthi140OoZ6u6d2v+l1X1 GhvgJ9G27UhiLbkO6LUdTuL6IPqAeJhUmJ9JsW9eAk13UnzLP48wcDTpZvSzOjqtzR8PAd gVeUIwkGH3dv2A5q2oYg/7yuzOZJT95N669yBLlf5mbiXLfqMqhMX/AjWou09HYux2Y6ZR QBwyaIRgrslsOphuT948zhBFSqrXcMnO0C9i/KKQQ1f+EKJeFadBRonfBPgmnL8+CnNSF7 wBDMBK7m7qvW9nWRDidQhbk95ryjD9qDHgWJR4ZWV3aYc7OBXaxh3d94zCDm1Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTd39n9z14Gm for ; Wed, 27 May 2026 15:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27f99 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 8b8dbc6bbe39 - main - sndctl(8): Implement EQ controls 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b8dbc6bbe391fd95a19bd1d9f0aac47bac085f8 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:13 +0000 Message-Id: <6a170e05.27f99.78beea47@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=8b8dbc6bbe391fd95a19bd1d9f0aac47bac085f8 commit 8b8dbc6bbe391fd95a19bd1d9f0aac47bac085f8 Author: Christos Margiolis AuthorDate: 2026-04-17 16:10:48 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 sndctl(8): Implement EQ controls Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- usr.sbin/sndctl/sndctl.8 | 4 +++- usr.sbin/sndctl/sndctl.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/usr.sbin/sndctl/sndctl.8 b/usr.sbin/sndctl/sndctl.8 index 73414bd95325..44dcb791ca51 100644 --- a/usr.sbin/sndctl/sndctl.8 +++ b/usr.sbin/sndctl/sndctl.8 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 2, 2025 +.Dd April 17, 2026 .Dt SNDCTL 8 .Os .Sh NAME @@ -82,6 +82,8 @@ The device controls are as follows: .It bitperfect Ta Boolean Ta Read/Write Ta Bit-perfect mode enabled .It autoconv Ta Boolean Ta Read/Write Ta Auto-conversions enabled .It realtime Ta Boolean Ta Read/Write Ta Real-time mode enabled +.It eq Ta Boolean Ta Read/Write Ta Equalization enabled +.It eq_preamp Ta String Ta Read/Write Ta Equalization preamp value (in dB) .It play Ta Group Ta Read Ta Playback properties .It play.format Ta String Ta Read/Write Ta Playback format .It play.rate Ta Number Ta Read/Write Ta Playback sample rate diff --git a/usr.sbin/sndctl/sndctl.c b/usr.sbin/sndctl/sndctl.c index bbc2da6a4ab9..778643a2a978 100644 --- a/usr.sbin/sndctl/sndctl.c +++ b/usr.sbin/sndctl/sndctl.c @@ -97,6 +97,8 @@ struct snd_dev { int bitperfect; int realtime; int autoconv; + int eq; + char eq_preamp[BUFSIZ]; struct { char format[FMTSTR_LEN]; int rate; @@ -130,6 +132,8 @@ struct map { static int mod_bitperfect(struct snd_dev *, void *); static int mod_autoconv(struct snd_dev *, void *); static int mod_realtime(struct snd_dev *, void *); +static int mod_eq(struct snd_dev *, void *); +static int mod_eq_preamp(struct snd_dev *, void *); static int mod_play_vchans(struct snd_dev *, void *); static int mod_play_rate(struct snd_dev *, void *); static int mod_play_format(struct snd_dev *, void *); @@ -149,6 +153,8 @@ static struct snd_ctl dev_ctls[] = { { "bitperfect", F(bitperfect), NUM, mod_bitperfect }, { "autoconv", F(autoconv), NUM, mod_autoconv }, { "realtime", F(realtime), NUM, mod_realtime }, + { "eq", F(eq), NUM, mod_eq }, + { "eq_preamp", F(eq_preamp), STR, mod_eq_preamp }, { "play", F(play), GRP, NULL }, { "play.format", F(play.format), STR, mod_play_format }, { "play.rate", F(play.rate), NUM, mod_play_rate }, @@ -436,6 +442,7 @@ read_dev(char *path) struct sndstioc_nv_arg arg; struct snd_dev *dp = NULL; struct snd_chan *ch; + char buf[64]; size_t nitems, nchans, i, j; int fd, caps, unit, t1, t2, t3; @@ -557,6 +564,14 @@ read_dev(char *path) if (t1 == 0 && t2 == 0 && t3 == 0) dp->realtime = 1; + snprintf(buf, sizeof(buf), "dev.pcm.%d.eq", dp->unit); + if (sysctl_int(buf, NULL, &dp->eq)) + xo_err(1, "%s: sysctl", dp->name); + + snprintf(buf, sizeof(buf), "dev.pcm.%d.eq_preamp", dp->unit); + if (sysctl_str(buf, NULL, dp->eq_preamp, sizeof(dp->eq_preamp))) + xo_err(1, "%s: sysctl", dp->name); + if (!nvlist_exists(nvlist_get_nvlist(di[i], SNDST_DSPS_PROVIDER_INFO), SNDST_DSPS_SOUND4_CHAN_INFO)) xo_errx(1, "%s: channel info list empty", dp->name); @@ -842,6 +857,32 @@ mod_realtime(struct snd_dev *dp, void *arg) return (rc); } +static int +mod_eq(struct snd_dev *dp, void *arg) +{ + char buf[64]; + + if (dp->from_user) + return (-1); + + snprintf(buf, sizeof(buf), "dev.pcm.%d.eq", dp->unit); + + return (sysctl_int(buf, arg, &dp->eq)); +} + +static int +mod_eq_preamp(struct snd_dev *dp, void *arg) +{ + char buf[64]; + + if (dp->from_user) + return (-1); + + snprintf(buf, sizeof(buf), "dev.pcm.%d.eq_preamp", dp->unit); + + return (sysctl_str(buf, arg, dp->eq_preamp, sizeof(dp->eq_preamp))); +} + static int mod_play_vchans(struct snd_dev *dp, void *arg) { From nobody Wed May 27 15:30:14 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 4gQYTg0yGFz6fCDB for ; Wed, 27 May 2026 15:30:15 +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 4gQYTf47KFz3T42 for ; Wed, 27 May 2026 15:30:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779895814; 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=GiCkNOIpbyMV05J/oMgHAmcsmpQeAZIOi0aO24+7L1Q=; b=ANkq8x7Dk1VfcHXY3xsbyfHbx7jDPoA+zVxEIZaVLBHghBHXa6Q1WaKsPREuZ8nwy5Tz90 /hOegDqgHAsho2fagt87OsidjbxqI99/8LQTI5B690kOVg67yw27tLtQhSRdvwY/lw1ZVP F8cz/xxkHll3GRu3mPiSYjJZKw+SdwLto8vRd+YxpDqIgTrzde+TkmBqBIFCzMFX4drizi siDBHD/eWZCIOA6uSpAeLHGRHVwbuw0f9fWCxVO74QX6ptnY9W+xb8384pW7TMFWbiP0rG x43ow4z2NnMb1hue3FNYLlvvLdigAwOH6bJSQiBbJKkGyFrf6sJhdaaljg7hrQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779895814; a=rsa-sha256; cv=none; b=kExLsFuXo3O/aFD81vgGpnmOylbD0xeeQIk28BEgf6a5jKiyZ4+6ct40n3Ly+gilOWZ3fg 784id4o2+kNMWNDGE9crRVlo3lHuBldbEJl/P4SEq51QijVy6U3e89gcp05H53t4YUd+tN /rdPEbHGhSBXbUrvh5hos/QGMyqp//YhWuUjPan7FlKu57+hAUwWO09HT3J34ZjBG9oiYf RrbRiJ9Aope9nQgWKFl8a0C9LRr9Ci7lq56/ZVsAggdav9NEc+sJAeLPsobFjkjweZkZs9 whGs0wlc2Mo+nbfYVqMXGDfViOinDbBpZfQlE6GikQsuH+FuGhNhdKGXM7OMHw== 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=1779895814; 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=GiCkNOIpbyMV05J/oMgHAmcsmpQeAZIOi0aO24+7L1Q=; b=WaRQXlNaxJaRDyzmfJIA766yRhbvQubc44eooA6K4r6SjeSxTkANmI+1WMflP5pODwSpzW eied5cZv6puGfjZfOrsczUPuN+dnMY6ObRFvMC1zGg7QA850U4nJBo98/M6NikkHvNte8C AAV8Ug82HtEg7Ii4QIPcmJ2bff0sAJlYU5/4CikCdq7NnmftM6CiJz12jDU9kSJI+PRC1a PnWDifHZQa1CfonjqzNNV0/wzQfTvwJIFHu1G+qNUqvlGapTE9y+8iqxKZ4oXp7H071HQJ AH7VYTRPIfIOKS96CmAVTWvOQL5xx3D+iYgTsqz6z7oTQeNSIRHuYamKyrVCOQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYTf3Yzkz14gB for ; Wed, 27 May 2026 15:30:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 260d1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:30:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: dfa52e8ed5b5 - main - sound: Update feeder_eq.c LICENSE header 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfa52e8ed5b5c00f0a587f02258c90e407e5bf6b Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:30:14 +0000 Message-Id: <6a170e06.260d1.789bd89f@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=dfa52e8ed5b5c00f0a587f02258c90e407e5bf6b commit dfa52e8ed5b5c00f0a587f02258c90e407e5bf6b Author: Christos Margiolis AuthorDate: 2026-04-17 16:54:03 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:27:11 +0000 sound: Update feeder_eq.c LICENSE header Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15 --- sys/dev/sound/pcm/feeder_eq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c index 9179148d2bd2..0a28dfa1ba17 100644 --- a/sys/dev/sound/pcm/feeder_eq.c +++ b/sys/dev/sound/pcm/feeder_eq.c @@ -3,7 +3,7 @@ * * Copyright (c) 2008-2009 Ariff Abdullah * All rights reserved. - * Copyright (c) 2024-2025 The FreeBSD Foundation + * Copyright (c) 2024-2026 The FreeBSD Foundation * * Portions of this software were developed by Christos Margiolis * under sponsorship from the FreeBSD Foundation. From nobody Wed May 27 15:33:27 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 4gQYYM3Wnfz6fCPs for ; Wed, 27 May 2026 15:33:27 +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 4gQYYM31dhz3XBm for ; Wed, 27 May 2026 15:33:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896007; 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=zH9JF3gVuku2JDouS6FF6/1azRVlhlF2/vTB9RkEvtI=; b=deE4aat4kNQn37XVi6x4xzSkyq9qgf/Awn+3npnZvSAhI6idkf70gDyCTO2y2sQwrgLaUa e+o2mvmGwpjkpeCLGFrCL/ewNBbSZn+OVJBxOi4b3uzvtXP5mR4XOvZw0Iay9aZ9D4bwKc C3NXk5h4p/csEHCH/LcKkR6HlEkgrijpyAcYzij0xYboPiZA3ksGvyEskiaNKxo609mo7X mG5z29549XH+RULGdUyuyS/IDNENVMS7LhzR1htQ47duemBHGqDo7bMuVFUXxQRWB3bFsz 36NoHYr+wsHJd5qFxr0RS9IxgFw1DQuWVmRs/vnOqAx0HOoa+tIc+VK4XQA19g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896007; a=rsa-sha256; cv=none; b=KW1NG6ZcicBTr+weaHM2evuj5oaG4rB9uxR+wdKhnVPWbNEYK1T9EVMFyP/QQVHYU9HhFH wcAgD20J5ZzCmbOlXbQrV8EYypo4mSnn7zCVC5QwmbEAbWFOC0e2SQ/obnizeCAUdp/DaT dtQaQwHS+zgmGgMW9HUicuhCoclZ1d5j6KkZ5KED1R2UkR2R6KQuK4DJm0atvM1KkhG9An ZkI7VlHyec3+u/alG8PjRehBrTH861Gap/Rr/Kf5QURFMd9s1lXDHEGEAqmaoBRpix4t6N qgGXYtP+8X72/WCbzjb2eSk37hzmdKxaSd3sAJq+r16srfaMbYuFBNVIcUTYGA== 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=1779896007; 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=zH9JF3gVuku2JDouS6FF6/1azRVlhlF2/vTB9RkEvtI=; b=LEFTygeSZKWFDdA7v86gP0qAJ16aE82yv/Lmxo91BiwxIrO1MZri6s3h/nRdqmZLQN/06y aSrvEZ2BLNPNV6g67c4gJX/k6jYBCggXgbXo6jHtiXoS5jX4CFh+d3cNXd8O5jCoTsXq36 uFBEGXf/BJTExahcuCc9MJYZmcuR5Y9d5IEAxLuJoPbl+xkRYDqw+nOk4UMxCATPcfmiyI pzsrt59BqKX2R0r8gG/3d/QXPs2UzJKqKRhkbr6iR8ZWcTQug7k63/yqdjnlp2UF121/ux vZ/Zydai9MAyVAgyTQ9yjkd14PH+WcuzfynDP0LcsUYTxCdgtoYYQbNxn4gHWA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYM1tD8z14yj for ; Wed, 27 May 2026 15:33:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27fa0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: e8ea97602ca9 - main - sound: Retire M_MIXER 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8ea97602ca97166a0729fdc32c84c9016fe7b0c Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:27 +0000 Message-Id: <6a170ec7.27fa0.5e664930@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=e8ea97602ca97166a0729fdc32c84c9016fe7b0c commit e8ea97602ca97166a0729fdc32c84c9016fe7b0c Author: Christos Margiolis AuthorDate: 2026-04-15 23:39:23 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:11 +0000 sound: Retire M_MIXER Even though harmless, it is not really useful, as there is essentially only one allocation with M_MIXER. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/mixer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 8015c8fc0c32..7ccb57c205ba 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -37,8 +37,6 @@ #include "feeder_if.h" #include "mixer_if.h" -static MALLOC_DEFINE(M_MIXER, "mixer", "mixer"); - static int mixer_bypass = 1; SYSCTL_INT(_hw_snd, OID_AUTO, vpc_mixer_bypass, CTLFLAG_RWTUN, &mixer_bypass, 0, @@ -638,7 +636,7 @@ mixer_obj_create(device_t dev, kobj_class_t cls, void *devinfo, KASSERT(type == MIXER_TYPE_PRIMARY || type == MIXER_TYPE_SECONDARY, ("invalid mixer type=%d", type)); - m = (struct snd_mixer *)kobj_create(cls, M_MIXER, M_WAITOK | M_ZERO); + m = (struct snd_mixer *)kobj_create(cls, M_DEVBUF, M_WAITOK | M_ZERO); snprintf(m->name, sizeof(m->name), "%s:mixer", device_get_nameunit(dev)); if (desc != NULL) { @@ -659,7 +657,7 @@ mixer_obj_create(device_t dev, kobj_class_t cls, void *devinfo, if (MIXER_INIT(m)) { mtx_lock(&m->lock); mtx_destroy(&m->lock); - kobj_delete((kobj_t)m, M_MIXER); + kobj_delete((kobj_t)m, M_DEVBUF); return (NULL); } @@ -678,7 +676,7 @@ mixer_delete(struct snd_mixer *m) MIXER_UNINIT(m); mtx_destroy(&m->lock); - kobj_delete((kobj_t)m, M_MIXER); + kobj_delete((kobj_t)m, M_DEVBUF); return (0); } @@ -793,7 +791,7 @@ mixer_uninit(device_t dev) MIXER_UNINIT(m); mtx_destroy(&m->lock); - kobj_delete((kobj_t)m, M_MIXER); + kobj_delete((kobj_t)m, M_DEVBUF); d->mixer_dev = NULL; From nobody Wed May 27 15:33: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 4gQYYN4MGjz6fCqS for ; Wed, 27 May 2026 15:33:28 +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 4gQYYN2lKlz3X8s for ; Wed, 27 May 2026 15:33:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896008; 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=Mst7fsqNhKOfNiCbyQF06HPVH/piXD5KBMG7+iRDkkk=; b=eoel0mTP7pZDTzFWc3Ray1aDtvgeXFwkWyrBsT9Yp3uKO8IeeAFjEHyNYCW+3Q6rWMkjGr PIILsmdgsWftY1t1REvwhFeHiu8dEaIXcocA29d2x/l38eyiyTLZL4t3V6hmLJidY5P5if XsP+jRY1banjvzghEl1wd9SvlfLO07Qxhij44M9PP+Bj1OkLyIGeH6tX4VC3PWL+dOyegz lD2jH4IPwSubgAGPWhO/Aao8+WA5szkgBHMiiXtxVeXrWg4D2oT6i6hDaZ+rklS1oHpGXn Z9Ax7HjQWQS6vBALo+m1nlI/r1Szu1IUG2hHvuU0CwMIdSm7wUEU4ITf9NYWzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896008; a=rsa-sha256; cv=none; b=VqUVy7RyA1oASMrGkfGG7Rq03gBRVuafg+1oL8zyohzZG4MvV9UWUK9m5q2e17IF0nLp9a wZy76bKASeUbv3ZOMqZd/xWfRBxP6P1UoVeMjLtqmYEEJAyrEYVeRGnW4LvZY5XYaBLxRq yx9TIbWOZrTHwIWCG04dkYl1CFQsduAuKr/KxwpN43tiKWyVlZRbreU1g85cnyH1UNiL1r /+C8B81lg3W6Jc/0ERUQ2XNDVpiRdn8/z7g4v2V29zd6sz/N9oreRpAXxAjgYih0iuS70/ 3PBi9hIkJmgcc8gT8XHuHtmhj/gG8IByBfrG+ql4mqeZ+jZCjOW5sCNhn8XGoQ== 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=1779896008; 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=Mst7fsqNhKOfNiCbyQF06HPVH/piXD5KBMG7+iRDkkk=; b=nNFwiTw9BwIYO5eWNWLV6bxm600IZ4pKa5d0LoqpwV8YG8twMx3XuwQMjkCU7eBNWV16uT LOStauAY5lf/PT0NWmhX71gv2gBdzKlFof7VulY9G1xOIwNqDWk/VBtCQCKrY6b+g+G9Bo iYoEkDyLJS1qkJnk/wx1DcJuXenElSzibVy8HoNjnwD7/QEnKdGXbUFyMFQEdxpiwtmNAh OjjRtgGRVtHLwhIRj+qwdZXtBM0HV940XRj1Lz0zTmesUAINgpFmHiamCQkF4yQFUT13QM QLryFFIj/2FuJC3Pnkh5yiNrMrYHwNojUc3IBec07zXiAWArfsabDp/svowxgg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYN265fz14H7 for ; Wed, 27 May 2026 15:33:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30ba9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: f61e65e1b2ac - main - sound: Retire mixer_ioctl_channel() 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f61e65e1b2ac74034bfc5d1230ae23ea4b9faa60 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:28 +0000 Message-Id: <6a170ec8.30ba9.3ab5233a@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=f61e65e1b2ac74034bfc5d1230ae23ea4b9faa60 commit f61e65e1b2ac74034bfc5d1230ae23ea4b9faa60 Author: Christos Margiolis AuthorDate: 2026-04-16 11:00:16 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:11 +0000 sound: Retire mixer_ioctl_channel() This function never succeeds when it is not called from the same process that has opened the file descriptor (e.g., mixer(8)). The reason is that the CHN_FOREACH() loop tries to match the pid of each channel with the pid of the process performing the ioctl, which will not be the same, unless it's the same process that both opened the channel and performed the ioctl. In the case that the same process opens the channels and performs the ioctl, however, we still do not need to worry, because mixer_ioctl_cmd() essentially does the same thing anyway. Additionally, this scenario should be quite rare, given that most applications do not open both /dev/dsp* and /dev/mixer*, and in fact, it is actively encouraged by the official OSSv4 specification not to do that. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/mixer.c | 117 +--------------------------------------------- 1 file changed, 1 insertion(+), 116 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 7ccb57c205ba..be4447b13964 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -1032,113 +1032,6 @@ mixer_close(struct cdev *i_dev, int flags, int mode, struct thread *td) return (0); } -static int -mixer_ioctl_channel(struct cdev *dev, u_long cmd, caddr_t arg, int mode, - struct thread *td, int from) -{ - struct snddev_info *d; - struct snd_mixer *m; - struct pcm_channel *c, *rdch, *wrch; - pid_t pid; - int j, ret; - - if (td == NULL || td->td_proc == NULL) - return (-1); - - m = dev->si_drv1; - d = device_get_softc(m->dev); - j = cmd & 0xff; - - switch (j) { - case SOUND_MIXER_PCM: - case SOUND_MIXER_RECLEV: - case SOUND_MIXER_DEVMASK: - case SOUND_MIXER_CAPS: - case SOUND_MIXER_STEREODEVS: - break; - default: - return (-1); - } - - pid = td->td_proc->p_pid; - rdch = NULL; - wrch = NULL; - c = NULL; - ret = -1; - - /* - * This is unfair. Imagine single proc opening multiple - * instances of same direction. What we do right now - * is looking for the first matching proc/pid, and just - * that. Nothing more. Consider it done. - * - * The better approach of controlling specific channel - * pcm or rec volume is by doing mixer ioctl - * (SNDCTL_DSP_[SET|GET][PLAY|REC]VOL / SOUND_MIXER_[PCM|RECLEV] - * on its open fd, rather than cracky mixer bypassing here. - */ - CHN_FOREACH(c, d, channels.pcm.opened) { - CHN_LOCK(c); - if (c->pid != pid || - !(c->feederflags & (1 << FEEDER_VOLUME))) { - CHN_UNLOCK(c); - continue; - } - if (rdch == NULL && c->direction == PCMDIR_REC) { - rdch = c; - if (j == SOUND_MIXER_RECLEV) - goto mixer_ioctl_channel_proc; - } else if (wrch == NULL && c->direction == PCMDIR_PLAY) { - wrch = c; - if (j == SOUND_MIXER_PCM) - goto mixer_ioctl_channel_proc; - } - CHN_UNLOCK(c); - if (rdch != NULL && wrch != NULL) - break; - } - - if (rdch == NULL && wrch == NULL) - return (-1); - - if ((j == SOUND_MIXER_DEVMASK || j == SOUND_MIXER_CAPS || - j == SOUND_MIXER_STEREODEVS) && - (cmd & ~0xff) == MIXER_READ(0)) { - mtx_lock(&m->lock); - *(int *)arg = mix_getdevs(m); - mtx_unlock(&m->lock); - if (rdch != NULL) - *(int *)arg |= SOUND_MASK_RECLEV; - if (wrch != NULL) - *(int *)arg |= SOUND_MASK_PCM; - ret = 0; - } - - return (ret); - -mixer_ioctl_channel_proc: - - KASSERT(c != NULL, ("%s(): NULL channel", __func__)); - CHN_LOCKASSERT(c); - - if ((cmd & ~0xff) == MIXER_WRITE(0)) { - int left, right, center; - - left = *(int *)arg & 0x7f; - right = (*(int *)arg >> 8) & 0x7f; - center = (left + right) >> 1; - chn_setvolume_multi(c, SND_VOL_C_PCM, left, right, center); - } else if ((cmd & ~0xff) == MIXER_READ(0)) { - *(int *)arg = chn_getvolume_matrix(c, SND_VOL_C_PCM, SND_CHN_T_FL); - *(int *)arg |= - chn_getvolume_matrix(c, SND_VOL_C_PCM, SND_CHN_T_FR) << 8; - } - - CHN_UNLOCK(c); - - return (0); -} - static int mixer_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) @@ -1156,15 +1049,7 @@ mixer_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, PCM_GIANT_ENTER(d); PCM_ACQUIRE_QUICK(d); - ret = -1; - - if (mixer_bypass != 0 && (d->flags & SD_F_VPC)) - ret = mixer_ioctl_channel(i_dev, cmd, arg, mode, td, - MIXER_CMD_CDEV); - - if (ret == -1) - ret = mixer_ioctl_cmd(i_dev, cmd, arg, mode, td, - MIXER_CMD_CDEV); + ret = mixer_ioctl_cmd(i_dev, cmd, arg, mode, td, MIXER_CMD_CDEV); PCM_RELEASE_QUICK(d); PCM_GIANT_LEAVE(d); From nobody Wed May 27 15:33:29 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 4gQYYP5Zz6z6fCpc for ; Wed, 27 May 2026 15:33: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 4gQYYP3Vbqz3X4W for ; Wed, 27 May 2026 15:33:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896009; 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=onRzVuamNmEDiF05j0dAF9z36QYP6MVYsb3aFlGWmcg=; b=qMXfDawnWNQHdxxW7Yr8ErKVXtScqi9rQcrD2jlLFUQL/+iQsk+wdvp9kVbGMUR8XKC11B Uu+2Wck/f8KRfTDRgFFSfrCY3MS2k2g29KxgQm3/SrQHtZs5hmMGF2W09jfDeorQue7MEJ Q7SPulkk6/UosnpO4HQuBqMfu4i8pE0fIIgxyOnHt2alVo5qnjQ3YrYjEk/P9DgfeNZwLO qXoCJKwAVgaBkGI1M5MWncWMtnKWuEfmmhzuEikdVAhdiOGbSG2wJjSckqY7fFXqheDCHb etu7gZSDGTZTbQ+7e4mmQEuZVmNNCmUVg63leC81G+76Sj4IkhkRJkb1Eebriw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896009; a=rsa-sha256; cv=none; b=bZ/hzMtXZo6n1QZHJg2WchYL4OT1LSIM4RQcny9bbwG9HrXcy2ry5MUveOEAnX35embAY3 97pnLVodz6s+V28nbbj0sqINgtscGddV3IfKkZWzMNq11JSpm92YYg9hkqqClXKdywLM8v XLZy/zJW7vuXRJfazzElBumj7duQDXk5en9gLkh6nVWr/R7n/eAuabFDEEHEmVz4z72/Q4 8R+aM/SMSmHVjAIdaIVaxC3Nn6pvVPpMict+vG1kdHeCN8m3XvM93WrjjMnFjfFvwDY/UX /rYrkN48YQ/Oxw3NRoPPMadlR/VTOHpY00LWWpcta9p7Qme6m2nnQOEK09nKew== 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=1779896009; 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=onRzVuamNmEDiF05j0dAF9z36QYP6MVYsb3aFlGWmcg=; b=AI4iU/tzsOJ9ofa2lwpBvdJFdoIle46FDaGjb7PBL9XGNJXfrwiFHIJShbYGc02nvv3DBQ Q+g9uJTKLm2vsvXkq8oZIV2w8Ny7WWw8/dwlIswpBYV83jnTBfL3iD6jc/XVdy4wD+C7yE rRbEg4x9xLXZ35LgAI9YrufMV3Mi+S1bSTTdmpSoacPRRQK0Ddmyj6VBeUWUr9fPxWeNqO KmsXg8RBnGkwanvJMKUG/TkWINe/zeRalhRkpFXbg/bh2L5lyTRqVb0IMNyHniSPC0gQqb kXM2ra+B6d8Squc37ELPEeA6GrVHRuxpmjmn4wP91J0LANiPeHMns26+KcbpPw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYP2nLhz14k5 for ; Wed, 27 May 2026 15:33:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3036c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 8e804f3dd629 - main - sound: Retire unused hw.snd.vpc_mixer_bypass 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e804f3dd6298d6aa8cbaf0f2a0267c6207ac8f7 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:29 +0000 Message-Id: <6a170ec9.3036c.2571a1df@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=8e804f3dd6298d6aa8cbaf0f2a0267c6207ac8f7 commit 8e804f3dd6298d6aa8cbaf0f2a0267c6207ac8f7 Author: Christos Margiolis AuthorDate: 2026-04-16 11:25:20 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:11 +0000 sound: Retire unused hw.snd.vpc_mixer_bypass Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- share/man/man4/pcm.4 | 9 --------- sys/dev/sound/pcm/mixer.c | 5 ----- 2 files changed, 14 deletions(-) diff --git a/share/man/man4/pcm.4 b/share/man/man4/pcm.4 index b0f944a0d443..9ea0f14c3930 100644 --- a/share/man/man4/pcm.4 +++ b/share/man/man4/pcm.4 @@ -407,15 +407,6 @@ When a channel is closed the channel volume will be reset to 0db. This means that any changes to the volume will be lost. Enabling this will preserve the volume, at the cost of possible confusion when applications tries to re-open the same device. -.It Va hw.snd.vpc_mixer_bypass -The recommended way to use the VPC feature is to teach applications to use the -correct -.Fn ioctl : -.Dv SNDCTL_DSP_GETPLAYVOL , SNDCTL_DSP_SETPLAYVOL , -.Dv SNDCTL_DSP_SETRECVOL , SNDCTL_DSP_SETRECVOL . -This is however not always possible. -Enable this to allow applications to use their own existing mixer logic -to control their own channel volume. .It Va hw.snd.vpc_reset Enable to restore all channel volumes back to the default value of 0db. .It Va dev.pcm.%d.bitperfect diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index be4447b13964..d73361fe7e16 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -37,11 +37,6 @@ #include "feeder_if.h" #include "mixer_if.h" -static int mixer_bypass = 1; -SYSCTL_INT(_hw_snd, OID_AUTO, vpc_mixer_bypass, CTLFLAG_RWTUN, - &mixer_bypass, 0, - "control channel pcm/rec volume, bypassing real mixer device"); - #define MIXER_NAMELEN 16 struct snd_mixer { KOBJ_FIELDS; From nobody Wed May 27 15:33:30 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 4gQYYR1cH6z6fCVT for ; Wed, 27 May 2026 15:33:31 +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 4gQYYQ5CZjz3X9C for ; Wed, 27 May 2026 15:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896010; 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=GQRcPcqR2eFCjFCFkR3lk8QvVVN+3qZXZprVTilk/iU=; b=OkqEMntG2NXrAP6+pmT8i3kyzS0AVHo/MPyTAswLaf3lfjChl6Tr7IW03pwx9BHF53etQe dI7o9YKB5UedhaSH23Ogy9XQHwHkuBgZF6SJvCMaHi19yPEVsrV5JjbtC7QNiRDnfAN+Ui i4wEEgbuPsQa3SHGOCk8bPC46h8FwEaRz4oSjRmZFGnGx/0PU9eogN6sLLX9JETaTd6oNI EnBfL6m7dBAcfTAjxTZytovnglltJPA/3+ilUut/oQ1t1JeRYxgzjKO2qbQvA9UQyqa7wi l+AlKsrGLaIIQ6URn4425fy9yiStkD8HLqLHgieC7iTZC5mpJhYdAePHCpvPnQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896010; a=rsa-sha256; cv=none; b=Vp1zhXzwaLUOqFAl0vTdcE3/RyM+3sFaqKNy7v/MDZ5F7W0HYMva+z7KszBqBfdpkT9BrT 1c0H+6Iwi8tdHX+8PS64hYVH8/vYNcswBJxF6lMxUBFghdphmOK9X/Egwyyf1hmkGbKWVP arz+Gspc1iFVsUFN3zdu6FHwyKnvrf//XXujIsOulPflsua7qHOjHicSWwfepVVNLR1eY1 R53Cb7oYY9Xf7/9+xxNQpEo9rkP2TAm4TkrsKiigzNDBabRHwJlgPd5VxizedAlrO+b2Li JcXT6h5QJJHzKUP3Y6gRMAC1c05r5f191ElaTU0HEod5tFO7HhnrmsGx9CTaHg== 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=1779896010; 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=GQRcPcqR2eFCjFCFkR3lk8QvVVN+3qZXZprVTilk/iU=; b=SQUInj+0CUbz1wSlxDAxoih848APCIDc230rK1T3j84bse0lIc5ZIHQQQDWQ+damomeTGG DcgRZpdKVQhLYEmy6Jf/0ypx/vrAyvV582RVlCyC74p29AVPRkz7IoJgZb9PD45dXUKDg2 AaG8Hq10PyrGu6XERKaPZoWQG3LHYWiNb7KUfFx22vaBt85Xpn+Xtx0WXa9C+Ce0MX7Bo1 +mRDfHkiF9WgbhaTg6PVy8SPvytWDVWP8WgeKMbNrR+7N4k+m+ESWc2jT1w5RIC9IJYq1W J7HSUqlmGgf/Qx83izMZXxLA0J0oypaz39u2ca4FFXOKwiGoAbUOckiWYX5npA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYQ4HbBz14H8 for ; Wed, 27 May 2026 15:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 274d4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 22730c4b10ba - main - sound: Remove unused "from" mixer_ioctl_cmd() argument 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22730c4b10ba391859a06966ea3e429aaf43cd09 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:30 +0000 Message-Id: <6a170eca.274d4.2c5f71d5@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=22730c4b10ba391859a06966ea3e429aaf43cd09 commit 22730c4b10ba391859a06966ea3e429aaf43cd09 Author: Christos Margiolis AuthorDate: 2026-04-16 11:32:03 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:11 +0000 sound: Remove unused "from" mixer_ioctl_cmd() argument Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/dsp.c | 9 +++------ sys/dev/sound/pcm/mixer.c | 4 ++-- sys/dev/sound/pcm/mixer.h | 5 +---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 0f76791448ca..bc92a3fbd530 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -728,8 +728,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, if (d->mixer_dev != NULL) { PCM_ACQUIRE_QUICK(d); - ret = mixer_ioctl_cmd(d->mixer_dev, cmd, arg, -1, td, - MIXER_CMD_DIRECT); + ret = mixer_ioctl_cmd(d->mixer_dev, cmd, arg, -1, td); PCM_RELEASE_QUICK(d); } else ret = EBADF; @@ -1526,8 +1525,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, if (d->mixer_dev != NULL) { PCM_ACQUIRE_QUICK(d); - ret = mixer_ioctl_cmd(d->mixer_dev, xcmd, arg, -1, td, - MIXER_CMD_DIRECT); + ret = mixer_ioctl_cmd(d->mixer_dev, xcmd, arg, -1, td); PCM_RELEASE_QUICK(d); } else ret = ENOTSUP; @@ -1539,8 +1537,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, case SNDCTL_DSP_SET_RECSRC: if (d->mixer_dev != NULL) { PCM_ACQUIRE_QUICK(d); - ret = mixer_ioctl_cmd(d->mixer_dev, cmd, arg, -1, td, - MIXER_CMD_DIRECT); + ret = mixer_ioctl_cmd(d->mixer_dev, cmd, arg, -1, td); PCM_RELEASE_QUICK(d); } else ret = ENOTSUP; diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index d73361fe7e16..73d1b5870b83 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -1044,7 +1044,7 @@ mixer_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, PCM_GIANT_ENTER(d); PCM_ACQUIRE_QUICK(d); - ret = mixer_ioctl_cmd(i_dev, cmd, arg, mode, td, MIXER_CMD_CDEV); + ret = mixer_ioctl_cmd(i_dev, cmd, arg, mode, td); PCM_RELEASE_QUICK(d); PCM_GIANT_LEAVE(d); @@ -1067,7 +1067,7 @@ mixer_mixerinfo(struct snd_mixer *m, mixer_info *mi) */ int mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, - struct thread *td, int from) + struct thread *td) { struct snd_mixer *m; int ret = EINVAL, *arg_i = (int *)arg; diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h index 3ce8a4f5adee..4ced76082e31 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -36,7 +36,7 @@ int mixer_delete(struct snd_mixer *m); int mixer_init(device_t dev, kobj_class_t cls, void *devinfo); int mixer_uninit(device_t dev); int mixer_reinit(device_t dev); -int mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td, int from); +int mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td); int mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi); int mixer_hwvol_init(device_t dev); @@ -63,9 +63,6 @@ u_int32_t mix_getparent(struct snd_mixer *m, u_int32_t dev); void *mix_getdevinfo(struct snd_mixer *m); struct mtx *mixer_get_lock(struct snd_mixer *m); -#define MIXER_CMD_DIRECT 0 /* send command within driver */ -#define MIXER_CMD_CDEV 1 /* send command from cdev/ioctl */ - #define MIXER_TYPE_PRIMARY 0 /* mixer_init() */ #define MIXER_TYPE_SECONDARY 1 /* mixer_create() */ From nobody Wed May 27 15:33:32 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 4gQYYT0dzHz6fCpk for ; Wed, 27 May 2026 15:33:33 +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 4gQYYS5gPKz3XSC for ; Wed, 27 May 2026 15:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896012; 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=l5zbGz8SEb48hEViMCKZ00onjDI2ocdiDB6gYdOGkaQ=; b=Y6kReIsPjvLsPYlsG2j4166UjUS9OT8K+bP9bT18JMimrIdln0d09nW0OM3jag/dwdSibh IRk/lJVontRAcx8HhMewE0nruJpuJyrfD9WFhcoJxbOszFLhVodmQmNY0nnUUZt3lqVvQQ go60TnmsrbCLunVAZd6z6gtmX9QkFwDpl0KK5sv99R9yRIlNaFHBG4TffiPuzLQ9tY5PEj 7cIaIUYKZaYx0t1A/LoOFQA3ELsxDU7D9EbWGWgfccs+oXg7nNMmf4UUifj5u6EnLC1QU+ BoILRL0UqJ77Da4FUv91I99nogDLgpo+zSWb0po535l/KvB1XC5MKR1SD5Xv/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896012; a=rsa-sha256; cv=none; b=JvjmwIqzvzWiekKv/E+IqJ4kOUUm6tQ06CCHqIuI8uBFcXxVtMDv/0FrAMP571ueYH40GW 5ab6/97X/UwLEusGGCDmIxotfiTWv7TNCcU0C+QURj+OGh1JLb9eZPituoIfwslbP9apWH ADGMMTdavbJaILhIXLAXQmbjYJrnEds/nvw1/CVijeE1DFfJGC2h4PgO/7XTH00vtQQgpM xf6tBfahXsFkjaG9f8FB0qQbbBmWMmTebgE3iKnfoZWyE6Fs58Db+ufu8qT/MNLAvATtjO KVfjtx+5LsATlS+aLk3FG7WFpjYwFahLuU7QAM+7u5hFHFZaW/VkCLTt/wyWLA== 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=1779896012; 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=l5zbGz8SEb48hEViMCKZ00onjDI2ocdiDB6gYdOGkaQ=; b=Ssa/Kt/kvrSMFHelj3dLOOa7OsSAWh0d6lzru7DxofxDkzzHONFw8eBj24tzr4Ms3vt120 f9ft0vDNpk4+mIr6mOltdJXG/lcmuFW1eeH2P5oJg341nHv/qFeYtjbSVNhbSNAB9RRMQG JLgbKdCVkCMtHzy/q48LlIAiLrsJwn/6zYkmNc6p3OvyHBC085WccWxyBZ5JeniAEFKAcT uCZjx/d0AFtq6jEixLUvherXP16jhL/d5MwFy1zjbBsx+vs77lg7Dj2DQSKaoTiMgJp1Vr ud13XBHa4TrivEkVtOOUo60OjdgeRPIrRgAEa8mvxX9Law7q1utjcsPzPEXzyw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYS5DSTz14gx for ; Wed, 27 May 2026 15:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27fa4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: e87654db5a09 - main - snd_uaudio: Stop using mixer_get_lock() 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e87654db5a0923856afbaace9bd0975331782044 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:32 +0000 Message-Id: <6a170ecc.27fa4.15e5474b@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=e87654db5a0923856afbaace9bd0975331782044 commit e87654db5a0923856afbaace9bd0975331782044 Author: Christos Margiolis AuthorDate: 2026-04-16 12:30:25 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:11 +0000 snd_uaudio: Stop using mixer_get_lock() There is no reason to lock snd_mixer->lock here, since the only thing we are doing with snd_mixer is to call mix_getdevinfo() and mix_get_dev(), which are one-line getters, which are needed to eventually call uaudio_get_child_index_by_dev(). Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/usb/uaudio_pcm.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/sys/dev/sound/usb/uaudio_pcm.c b/sys/dev/sound/usb/uaudio_pcm.c index c24c111f983c..4b1762cfc3ec 100644 --- a/sys/dev/sound/usb/uaudio_pcm.c +++ b/sys/dev/sound/usb/uaudio_pcm.c @@ -134,39 +134,18 @@ ua_mixer_init(struct snd_mixer *m) static int ua_mixer_set(struct snd_mixer *m, unsigned type, unsigned left, unsigned right) { - struct mtx *mtx = mixer_get_lock(m); - uint8_t do_unlock; - - if (mtx_owned(mtx)) { - do_unlock = 0; - } else { - do_unlock = 1; - mtx_lock(mtx); - } uaudio_mixer_set(mix_getdevinfo(m), m, type, left, right); - if (do_unlock) { - mtx_unlock(mtx); - } + return (left | (right << 8)); } static uint32_t ua_mixer_setrecsrc(struct snd_mixer *m, uint32_t src) { - struct mtx *mtx = mixer_get_lock(m); int retval; - uint8_t do_unlock; - if (mtx_owned(mtx)) { - do_unlock = 0; - } else { - do_unlock = 1; - mtx_lock(mtx); - } retval = uaudio_mixer_setrecsrc(mix_getdevinfo(m), m, src); - if (do_unlock) { - mtx_unlock(mtx); - } + return (retval); } From nobody Wed May 27 15:33:31 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 4gQYYS26C1z6fCpw for ; Wed, 27 May 2026 15:33:32 +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 4gQYYR5C4Zz3XC9 for ; Wed, 27 May 2026 15:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896011; 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=FMcR/+EMaXSkDgyxdjLLVEyuV7vvfw/lXX9usA9Z/K0=; b=jbNHdoail995eEmBhZC9DUfOlt1px62d+zOfWW5b9VdVtVOrh9BVnpt/4nCpmb0lerfWPV 7rGJWSWrCJcUstgzj6BD7Jokda26icJmORyRtx4aH+hW+2FG/UrOFeTWY/u+lolHgFYV3Z BdGrJVGFXT4NLkKr6DGCShQ3eEs9Gq7dao0exBg1Tyi4Y5B+3xJbNtqHR8ZhQRSELtlxN1 N5VCiWH7F5GOCvqSG2UxuCoTIDSeznz9Z5sXGnJSMR25kJBIzxDdTXRLQs988gQPmCc5Fa KwhA11dCtXHgu90Uf94AO+tAAio19GO3jsmpN624xzzOaMwtn1+jjemzvvOJuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896011; a=rsa-sha256; cv=none; b=cdHSP+BAsVXR93FV6qTFLtRLt2IBQB+nP5OYZjaJdpVL9K3nlAVRkYjxTx+co/nfyr3Cb5 oMEzMRKiKUQQwqkuse42MndKuknIp+Tpnn2ZxUv0gNDmnOujw1UtmMSNU1duNBKxh3mqmJ 1a9krHMSsoHTK8HsGR+rD2puFDto7zYZ7kqWKkcXp2iaXmngaD3JcPar47PTWQcCM9RFAR vHNx3GflXY1xaxWe6lLhmMliPRHGkl6K//5fLQpSkMQUSlsGDR7xxL0JZL4NNqz3IxNy9l 2FFLycpH7sGFxGHlMq9VIgoF07JQ6jxFllkfEJenJf6i2+V/PwGZvujDuyu1jQ== 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=1779896011; 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=FMcR/+EMaXSkDgyxdjLLVEyuV7vvfw/lXX9usA9Z/K0=; b=HjbdD5bmxKdAGnS1lgO//KG1tNcl37f2EEY9P0f7rYWJtck7lEHwWNDh2eQPxAyp0W1V4P sobfdZZlLYmsDIKCsnh2/NtwCLY5aYn0teUOAt9akoM5JXsNamgOpiFzNKELSrlHFIqjMO G3g6kLl/75oyz9faIJfZRyT111bCUw/oY4dv7x6O/vGibqLw1mbtZtMnHpXWNtKqugZCcE CFMTODh+WD/OTZW1YT77Lp6B6WZ+FwcPllvPDqful2dssv4/AumSonVvgLxusgSsbra69w dkg0w82NG06LQl8zZLrQawxOslVQf1PrEZxs5+7heqASHgNjz837A6WfVMfpPA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYR4Rt4z14k6 for ; Wed, 27 May 2026 15:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30bad by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 9a00e0b8ca56 - main - snd_uaudio: Do not use snd_mixer->lock as mixer_lock 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a00e0b8ca566b6942874eb08c03baf035a17702 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:31 +0000 Message-Id: <6a170ecb.30bad.2cbf3f6f@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=9a00e0b8ca566b6942874eb08c03baf035a17702 commit 9a00e0b8ca566b6942874eb08c03baf035a17702 Author: Christos Margiolis AuthorDate: 2026-04-16 12:15:21 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:11 +0000 snd_uaudio: Do not use snd_mixer->lock as mixer_lock In similar fashion to c234740c9d34 ("snd_uaudio: Do not use pcm_channel->lock to protect uaudio_chan"), stop this layering violation, and introduce a snd_uaudio(4)-internal mixer_lock. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/usb/uaudio.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index f477eb768fde..27d5009da4fa 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -356,7 +356,7 @@ struct uaudio_hid { struct uaudio_softc_child { device_t pcm_device; - struct mtx *mixer_lock; + struct mtx mixer_lock; struct snd_mixer *mixer_dev; uint32_t mix_info; @@ -2955,12 +2955,9 @@ uaudio_mixer_sysctl_handler(SYSCTL_HANDLER_ARGS) sc = (struct uaudio_softc *)oidp->oid_arg1; hint = oidp->oid_arg2; - if (sc->sc_child[0].mixer_lock == NULL) - return (ENXIO); - /* lookup mixer node */ - mtx_lock(sc->sc_child[0].mixer_lock); + mtx_lock(&sc->sc_child[0].mixer_lock); for (pmc = sc->sc_mixer_root; pmc != NULL; pmc = pmc->next) { for (chan = 0; chan != (int)pmc->nchan; chan++) { if (pmc->wValue[chan] != -1 && @@ -2971,7 +2968,7 @@ uaudio_mixer_sysctl_handler(SYSCTL_HANDLER_ARGS) } } found: - mtx_unlock(sc->sc_child[0].mixer_lock); + mtx_unlock(&sc->sc_child[0].mixer_lock); error = sysctl_handle_int(oidp, &temp, 0, req); if (error != 0 || req->newptr == NULL) @@ -2979,7 +2976,7 @@ found: /* update mixer value */ - mtx_lock(sc->sc_child[0].mixer_lock); + mtx_lock(&sc->sc_child[0].mixer_lock); if (pmc != NULL && temp >= pmc->minval && temp <= pmc->maxval) { @@ -2989,7 +2986,7 @@ found: /* start the transfer, if not already started */ usbd_transfer_start(sc->sc_mixer_xfer[0]); } - mtx_unlock(sc->sc_child[0].mixer_lock); + mtx_unlock(&sc->sc_child[0].mixer_lock); return (0); } @@ -3220,10 +3217,7 @@ uaudio_mixer_reload_all(struct uaudio_softc *sc) struct uaudio_mixer_node *pmc; int chan; - if (sc->sc_child[0].mixer_lock == NULL) - return; - - mtx_lock(sc->sc_child[0].mixer_lock); + mtx_lock(&sc->sc_child[0].mixer_lock); for (pmc = sc->sc_mixer_root; pmc != NULL; pmc = pmc->next) { /* use reset defaults for non-oss controlled settings */ if (pmc->ctl == SOUND_MIXER_NRDEVICES) @@ -3235,7 +3229,7 @@ uaudio_mixer_reload_all(struct uaudio_softc *sc) /* start HID volume keys, if any */ usbd_transfer_start(sc->sc_hid.xfer[0]); - mtx_unlock(sc->sc_child[0].mixer_lock); + mtx_unlock(&sc->sc_child[0].mixer_lock); } static void @@ -5439,13 +5433,13 @@ uaudio_mixer_init_sub(struct uaudio_softc *sc, struct snd_mixer *m) DPRINTF("child=%u\n", i); - sc->sc_child[i].mixer_lock = mixer_get_lock(m); + mtx_init(&sc->sc_child[i].mixer_lock, "uaudio mixer lock", NULL, MTX_DEF); sc->sc_child[i].mixer_dev = m; if (i == 0 && usbd_transfer_setup(sc->sc_udev, &sc->sc_mixer_iface_index, sc->sc_mixer_xfer, uaudio_mixer_config, 1, sc, - sc->sc_child[i].mixer_lock)) { + &sc->sc_child[i].mixer_lock)) { DPRINTFN(0, "could not allocate USB transfer for mixer!\n"); return (ENOMEM); } @@ -5470,7 +5464,7 @@ uaudio_mixer_uninit_sub(struct uaudio_softc *sc, struct snd_mixer *m) if (index == 0) usbd_transfer_unsetup(sc->sc_mixer_xfer, 1); - sc->sc_child[index].mixer_lock = NULL; + mtx_destroy(&sc->sc_child[index].mixer_lock); return (0); } @@ -6186,9 +6180,6 @@ uaudio_hid_attach(struct uaudio_softc *sc, if (!(sc->sc_hid.flags & UAUDIO_HID_VALID)) return (-1); - if (sc->sc_child[0].mixer_lock == NULL) - return (-1); - /* Get HID descriptor */ error = usbd_req_get_hid_desc(uaa->device, NULL, &d_ptr, &d_len, M_TEMP, sc->sc_hid.iface_index); @@ -6247,7 +6238,7 @@ uaudio_hid_attach(struct uaudio_softc *sc, /* allocate USB transfers */ error = usbd_transfer_setup(uaa->device, &sc->sc_hid.iface_index, sc->sc_hid.xfer, uaudio_hid_config, UAUDIO_HID_N_TRANSFER, - sc, sc->sc_child[0].mixer_lock); + sc, &sc->sc_child[0].mixer_lock); if (error) { DPRINTF("error=%s\n", usbd_errstr(error)); return (-1); From nobody Wed May 27 15:33:33 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 4gQYYV2VrSz6fCQ2 for ; Wed, 27 May 2026 15:33:34 +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 4gQYYT6yW1z3XZf for ; Wed, 27 May 2026 15:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896014; 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=/FJN1qYPIhRqRLI0kmDtM2JF2tfHha9ZgQosmAnuv8w=; b=hhC9+vMkOk62q+6AhAA0YP1F9BOXKwnMnsS/5e8sEi1CCI3JSkvjwbSzUgJZIBkSBWwv9P WqA3Mh2Dt0pcQOX+GVuFehOEfkPRrPDX7PI4u+liaWGTtlryo/9jkvH1T1bHo02h6UFZlS rNBmDf6LUmtWNFu04BKx7+cS4pXW60hZ99xwoMyNhIPZN27nvfqumbyLIKfAaMM3/U9cLB zwHfsCqwWawOqAHuk4Tf8mIAssSDot8yaHQB2L1RAnQAnKNz9Q29eAddiAX8zjWnPyQtOo zBlQuTmln9r2PO9LVQ1Vk1yE9WTTifGFE+iTOHrBHa/sgEcdm9WvAaD0rp3atg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896014; a=rsa-sha256; cv=none; b=SV4AAkntQaVjMCp1Dr3zP1fynZ2oBNONjcnJWXO6+GcxVuYrJx28n4nHaQiCboxXHqqLwb 6avomMsWZBlpvek+Sc4Zkh7XrpWHWaJ805gjcnw/AfvukNNuyRHr2FaishSa6cSdgfkBKV PacfHpO6VZgbsIBeOFPmbo6JIlR2N3AJ3hV/3w6FTo9tVlGPoBNRZnoz0szu8f6dYjnXu6 tuTFNSBkSix0mFuWYUvGA+i+Eu9HX2+HEGc0EcJtdnVEV+GOupX78iJMh2V5AXI4JzFc8T h2Jc5umbkmwqPHFkguk2yw0PTKkZvWKRRzgUWfqKHdfJPErt3iuHAKdw3IOFIA== 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=1779896014; 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=/FJN1qYPIhRqRLI0kmDtM2JF2tfHha9ZgQosmAnuv8w=; b=gxKd1ARqNIHG0+s2l6js6TcKqpshrcbMshRoYk9JAfUsawJs9/VKZz3qeZq97X+NU2AmTr xs6zcV2SOwgwZXwQJimTzTz8vaQFBZajLU9ElylJGi5LHzbzkJNgriF62iktvSScB4tApn dqQ2D4yKrSHLnDhfddTFoIfHVHgZ0yjIL0LjMg0IVd3O43y9taAKhu/+alx4FIEOZAcG93 B8UkHEe85HsTQmwbvaAnqFKHcE8FVTKnl/LxKfeosWmXswu/zfY0LQEwOg5o/sWHiSItj0 2RKLRS6hTsaVV6SdAGzjFzUL/5yQuPlCYAEnL8nv7XJ/3PxO25gpH+hqSSZfag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYT6KMWz14HC for ; Wed, 27 May 2026 15:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 270ca by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 1e72608a3c6a - main - sound: Remove all remaining uses of mixer_get_lock() 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e72608a3c6a60b76938c5ded2a290d0b9ff6456 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:33 +0000 Message-Id: <6a170ecd.270ca.661b05a@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=1e72608a3c6a60b76938c5ded2a290d0b9ff6456 commit 1e72608a3c6a60b76938c5ded2a290d0b9ff6456 Author: Christos Margiolis AuthorDate: 2026-04-16 12:41:13 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:12 +0000 sound: Remove all remaining uses of mixer_get_lock() These functions are called from sound(4) through MIXER_SET() in mixer_set(), but nothing mixer-related is used or needs to be locked in these cases. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/arm/allwinner/a64/sun50i_a64_acodec.c | 14 -------------- sys/arm64/rockchip/rk3328_codec.c | 14 -------------- sys/dev/sound/macio/onyx.c | 17 ----------------- sys/dev/sound/macio/snapper.c | 17 ----------------- sys/dev/sound/macio/tumbler.c | 17 ----------------- 5 files changed, 79 deletions(-) diff --git a/sys/arm/allwinner/a64/sun50i_a64_acodec.c b/sys/arm/allwinner/a64/sun50i_a64_acodec.c index 12c9a86cf361..93b0328e99e0 100644 --- a/sys/arm/allwinner/a64/sun50i_a64_acodec.c +++ b/sys/arm/allwinner/a64/sun50i_a64_acodec.c @@ -339,19 +339,9 @@ static int a64codec_mixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) { struct a64codec_softc *sc; - struct mtx *mixer_lock; - uint8_t do_unlock; u_int val; sc = device_get_softc(mix_getdevinfo(m)); - mixer_lock = mixer_get_lock(m); - - if (mtx_owned(mixer_lock)) { - do_unlock = 0; - } else { - do_unlock = 1; - mtx_lock(mixer_lock); - } right = left; @@ -375,10 +365,6 @@ a64codec_mixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned ri } A64CODEC_UNLOCK(sc); - if (do_unlock) { - mtx_unlock(mixer_lock); - } - return (left | (right << 8)); } diff --git a/sys/arm64/rockchip/rk3328_codec.c b/sys/arm64/rockchip/rk3328_codec.c index 22e3cde9093e..a019cab27cc9 100644 --- a/sys/arm64/rockchip/rk3328_codec.c +++ b/sys/arm64/rockchip/rk3328_codec.c @@ -416,18 +416,8 @@ static int rkcodec_mixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) { struct rkcodec_softc *sc; - struct mtx *mixer_lock; - uint8_t do_unlock; sc = device_get_softc(mix_getdevinfo(m)); - mixer_lock = mixer_get_lock(m); - - if (mtx_owned(mixer_lock)) { - do_unlock = 0; - } else { - do_unlock = 1; - mtx_lock(mixer_lock); - } right = left; @@ -443,10 +433,6 @@ rkcodec_mixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned rig } RKCODEC_UNLOCK(sc); - if (do_unlock) { - mtx_unlock(mixer_lock); - } - return (left | (right << 8)); } diff --git a/sys/dev/sound/macio/onyx.c b/sys/dev/sound/macio/onyx.c index f4f825a705cc..5ba22dd7c495 100644 --- a/sys/dev/sound/macio/onyx.c +++ b/sys/dev/sound/macio/onyx.c @@ -268,38 +268,21 @@ static int onyx_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) { struct onyx_softc *sc; - struct mtx *mixer_lock; - int locked; uint8_t l, r; sc = device_get_softc(mix_getdevinfo(m)); - mixer_lock = mixer_get_lock(m); - locked = mtx_owned(mixer_lock); switch (dev) { case SOUND_MIXER_VOLUME: - - /* - * We need to unlock the mixer lock because iicbus_transfer() - * may sleep. The mixer lock itself is unnecessary here - * because it is meant to serialize hardware access, which - * is taken care of by the I2C layer, so this is safe. - */ if (left > 100 || right > 100) return (0); l = left + 128; r = right + 128; - if (locked) - mtx_unlock(mixer_lock); - onyx_write(sc, PCM3052_REG_LEFT_ATTN, l); onyx_write(sc, PCM3052_REG_RIGHT_ATTN, r); - if (locked) - mtx_lock(mixer_lock); - return (left | (right << 8)); } diff --git a/sys/dev/sound/macio/snapper.c b/sys/dev/sound/macio/snapper.c index f14009f447a8..ed83990d563b 100644 --- a/sys/dev/sound/macio/snapper.c +++ b/sys/dev/sound/macio/snapper.c @@ -436,14 +436,10 @@ static int snapper_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) { struct snapper_softc *sc; - struct mtx *mixer_lock; - int locked; u_int l, r; u_char reg[6]; sc = device_get_softc(mix_getdevinfo(m)); - mixer_lock = mixer_get_lock(m); - locked = mtx_owned(mixer_lock); if (left > 100 || right > 100) return (0); @@ -460,21 +456,8 @@ snapper_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) reg[4] = (r & 0x00ff00) >> 8; reg[5] = r & 0x0000ff; - /* - * We need to unlock the mixer lock because iicbus_transfer() - * may sleep. The mixer lock itself is unnecessary here - * because it is meant to serialize hardware access, which - * is taken care of by the I2C layer, so this is safe. - */ - - if (locked) - mtx_unlock(mixer_lock); - snapper_write(sc, SNAPPER_VOLUME, reg); - if (locked) - mtx_lock(mixer_lock); - return (left | (right << 8)); } diff --git a/sys/dev/sound/macio/tumbler.c b/sys/dev/sound/macio/tumbler.c index bd40ea6b4f6b..89af4434e7fe 100644 --- a/sys/dev/sound/macio/tumbler.c +++ b/sys/dev/sound/macio/tumbler.c @@ -383,14 +383,10 @@ static int tumbler_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) { struct tumbler_softc *sc; - struct mtx *mixer_lock; - int locked; u_int l, r; u_char reg[6]; sc = device_get_softc(mix_getdevinfo(m)); - mixer_lock = mixer_get_lock(m); - locked = mtx_owned(mixer_lock); switch (dev) { case SOUND_MIXER_VOLUME: @@ -407,21 +403,8 @@ tumbler_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) reg[4] = (r & 0x00ff00) >> 8; reg[5] = r & 0x0000ff; - /* - * We need to unlock the mixer lock because iicbus_transfer() - * may sleep. The mixer lock itself is unnecessary here - * because it is meant to serialize hardware access, which - * is taken care of by the I2C layer, so this is safe. - */ - - if (locked) - mtx_unlock(mixer_lock); - tumbler_write(sc, TUMBLER_VOLUME, reg); - if (locked) - mtx_lock(mixer_lock); - return (left | (right << 8)); } From nobody Wed May 27 15:33:34 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 4gQYYW2Xfpz6fCq3 for ; Wed, 27 May 2026 15:33:35 +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 4gQYYW0XJbz3Xd3 for ; Wed, 27 May 2026 15:33:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896015; 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=7T3R6ROUGQ312TbVJHtH0J0+56+SxenkYcaUIduHvko=; b=C6TDyVPpG26DIXkh+eFmqjfCys079uEpmKbOEwrQnPxdHszvQU1iU+zpOER35Jp1c8Q7ZY vBw0r0VJfpVFTuTQRz84gRH56+Afsfh+1Qi7tcy2Zf8uPyTLrgBcd5caBtoymuqi++if/2 JZm9AehOJqopcA0rvbWtb8uynI9Ea5e5IOqywS/Ce5nhC5kgs+u+AznEqexHTK4zYp/mfd l7zXBxkGAkfw6ZI8YJWr2I+8OGrJ6no5co6D/TWP5hNf/QqYcgoQ5K5T1XfsNglQ0mjRY/ Ic16rww68vpODgB3SAq9eZTjQBISs/Oaa7jblOoTLYUyUpF9UHhODqn6G09UvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896015; a=rsa-sha256; cv=none; b=Ao9+hH1e1oVNeEpEvg7FmU3Pt1GjB3e8j5JmuQq/lolFHzcSeW/Fq7uysepYZ8CVcqDkQy cito1F/2kjoSfjU+Nrrqh8ncmVySuvA3sf5+oqMOBjaAIhnhTbL2pTj94xJzo42NDiOfj5 VArq/xiuym1Eb9C7SMgTOVrpojao5N8Z+gKt4a2dZDUGXb5HCBvr3xzil1Kg2hDJBPZWX0 ndC/OZY70203+VRvE6bjmV0Wqm5Zf6R9yk9AXWZ7yZ+FNR9/6WuAIuT4Kr8QW4SxSKJlHR yBkW/uXrhFRKXM8pKfg+jLHcY75/brC1EuefN0q7xX+ez4CMpkzY1Wfz4Y2jJg== 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=1779896015; 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=7T3R6ROUGQ312TbVJHtH0J0+56+SxenkYcaUIduHvko=; b=foMsPXA8FbesEx+DQFwvpFvmM+aOjkal+OkT44hQk1sdhU92F+QJ0SBybYSAqbx4hOTUXS o8BY3odZdUlJMmyD2ZHf6Xyl72K90TNaHzhiwh6KCpq2LMhCymrBWvEyeuljEF0PbsEKp/ WNOyjl8RsdcTgYYXlAOnQBFeaezfEWIn2Oq4uyL3hMnmpQecnZlV4IZ4kd8TjVI8/lz2ri AbukHncXSIoNplMOTzKvb/eGjX4FoCH0Qi94+kvXe+7KEa+UfYtbAApcHyXvR3kKl0TSZv DwF+bXaiRsU1gBGTjQqd0Z087ohW1+woBrMm0A7PR/pUDFJ0AalAKNT2cGHWIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYV70ZMz14h0 for ; Wed, 27 May 2026 15:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27262 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 6a3a42c57cf4 - main - sound: Retire unused mixer_get_lock() 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a3a42c57cf45874294105419f5c5de6602db3f8 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:34 +0000 Message-Id: <6a170ece.27262.4a51f104@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6a3a42c57cf45874294105419f5c5de6602db3f8 commit 6a3a42c57cf45874294105419f5c5de6602db3f8 Author: Christos Margiolis AuthorDate: 2026-04-16 12:46:48 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:12 +0000 sound: Retire unused mixer_get_lock() Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/mixer.c | 10 ---------- sys/dev/sound/pcm/mixer.h | 1 - 2 files changed, 11 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 73d1b5870b83..1baeb1b23077 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -1382,13 +1382,3 @@ mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi) return (EINVAL); } - -/* - * Allow the sound driver to use the mixer lock to protect its mixer - * data: - */ -struct mtx * -mixer_get_lock(struct snd_mixer *m) -{ - return (&m->lock); -} diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h index 4ced76082e31..b16256862b4f 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -61,7 +61,6 @@ void mix_setparentchild(struct snd_mixer *m, u_int32_t parent, u_int32_t childs) void mix_setrealdev(struct snd_mixer *m, u_int32_t dev, u_int32_t realdev); u_int32_t mix_getparent(struct snd_mixer *m, u_int32_t dev); void *mix_getdevinfo(struct snd_mixer *m); -struct mtx *mixer_get_lock(struct snd_mixer *m); #define MIXER_TYPE_PRIMARY 0 /* mixer_init() */ #define MIXER_TYPE_SECONDARY 1 /* mixer_create() */ From nobody Wed May 27 15:33:36 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 4gQYYX2XHlz6fCQ7 for ; Wed, 27 May 2026 15:33: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQYYX1FN9z3XgN for ; Wed, 27 May 2026 15:33:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896016; 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=mm49BvmkSzIFjLGXsx+zLkrAHsQvsR4xWZtKce0UlmY=; b=Ob6mj0+0eKm68iXdlhqQNbm8AsOV1lBW651AMQNYbloNqphMs54FoivKPLPYRfcVU3m2Aj 4UbOd2kIEGdmCH/eVEhv70r/BfPpCqnBvuEAtFybIH1s/IIDanR0COHoznsmsHCOabSGRZ 4WWw/Ee73A0Fgnl01WDcuWzqJBcYhRxVuVD0q3/lvY66mYpw94w8LlHEwbPWbX4sRC1cCT MsXUHICvItkblRoiP05TTiYAFLqdXUeL5NJa4KIpkvBxChxVW4Mc7nIWT+7QMUShvmOh/m E2LnSnbD+vKjzkuYQQsWMm9/kGprfqvonlbUOmF2sTKImLp6Zpl9s/2Hw9qmxw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896016; a=rsa-sha256; cv=none; b=HDN1vc0+sqmKV1xwKYz/FsM1kh9iJcS/9NcTvDsGWNUjqZFb5HzHRr+FLwsy63fvi7JzLb nrLP1s+lkzxJiXMeHjKYg6unGOYfMIjaMFtLSm2y+0fziRVGa08KNsqevYF4sNjLHAN7fB z7BKHVrOEiHWxlOcKKCS4ax0C/e5cW4TfYPEk2CCdRDqNyqjScX/mAY8gAMd2xEwYFIPXr T0KFhgqwpuHsjg0QQi839jBDHMwGCfByd1M0GrjPnchX2MoV6tJT1nzDYaK3S4KEVbdEQx AmWX95NpAcHzA5xrRdpAumx9wEC3bB+bdNS6LW8BUi6pJGYl9RJCDhQk+YtR2g== 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=1779896016; 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=mm49BvmkSzIFjLGXsx+zLkrAHsQvsR4xWZtKce0UlmY=; b=XtTaEMVyzwIINr4n7+5If0KqLXXs1q2upiTPN2F03sg6fmkxLd04NFFHf/1dRW0EF1Utog Ggd620V7s45Jdd7zEKAGaI2V7IfHFhJb/ctcn/x6l810WWVIeeyAEXOjySHfkO6XJgBt27 00OZ+NyXextti1I09YLx586AkzlbA3HlUXRbiGjRuWO9/JRqoyL8ok+NXjIxOAllVBsCkf ggoyUVZLsdQeLTqRxUGaez84oqeaVdMZsmB3S2hI5AuWUBUwv1gq0bro3MoHFlQLnbNBiw bw6xDdMUl2P+G7IVhORKGVm2WFkfkvMw1pVRzSUkHBH2ebK7y7YUeiO4PfjHSQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYX0c0sz14kB for ; Wed, 27 May 2026 15:33:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2713f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 7485519d5634 - main - sound: Do not lock before destroying snd_mixer->lock 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7485519d56346909c4db595ab0342128353d5b8d Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:36 +0000 Message-Id: <6a170ed0.2713f.63ec4fd@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=7485519d56346909c4db595ab0342128353d5b8d commit 7485519d56346909c4db595ab0342128353d5b8d Author: Christos Margiolis AuthorDate: 2026-04-16 12:51:56 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:12 +0000 sound: Do not lock before destroying snd_mixer->lock Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/mixer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 1baeb1b23077..0001ea7b481a 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -650,7 +650,6 @@ mixer_obj_create(device_t dev, kobj_class_t cls, void *devinfo, } if (MIXER_INIT(m)) { - mtx_lock(&m->lock); mtx_destroy(&m->lock); kobj_delete((kobj_t)m, M_DEVBUF); return (NULL); From nobody Wed May 27 15:33:37 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 4gQYYY3XhBz6fCKw for ; Wed, 27 May 2026 15:33:37 +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 4gQYYY1tmGz3XXp for ; Wed, 27 May 2026 15:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896017; 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=fV90/9M3yf2GOUwH28foDST6j/OmGnRe/CHYuWMozeU=; b=OX8BmWs2ARLQuH9bdJ0ssfL7/wKtWUNYmgH2M2whc8DQqKpwSA6lEQe2JdqWZrrCvfRQOm XajDC7FJzYNKBUBHIYtTUdYqhUxGmpevctk4QcZ3Sf9gMrt3KRSx3hwQ+jCmkjLcpcbNzP 3DHTy6bglQYDQ+Ov9cordiyUoIfv55pCVl0+YEKoc7jjINmCQ+kf/inawbPiON8tooK4gv Is5jteIhjnEpLTHSSPWAQeR+fsUeeDectIonjagyFNz9uWHKtgYlIgV+xwuyuwlNeqjkZb UtjLVIeHxvvixwGVPMlGRP+NjbFiT2bDAB5Gt7J7VeGVlzEA9G8hIOdRIU8AfQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896017; a=rsa-sha256; cv=none; b=ONbY6tZz1rGszamYkTv+5+8T0XKd4bo7SUWAEgsFLOR4CwHxQIfguT9mv06hYQiaAHGRCT kuNqLuIrUvUBzycQoGgOhx2ImtU2olc3NplgLS8csSva5cdGBlCG1OQc6fqqvTb014Kp8/ NtryOxjX0bDqcVw3fQqdY27nwuyKElMqGkbmJAoji5rKF3wvEJx1UOUnqKT1BYhaUM5GT4 EgO7hooMlGUeWnTV796hG+DyA/YCinJMPWQcbG4PiSwo3S9mdzJ827nnvHh2uyTGplFCbx o4V5e+XYnzB9xOetuBM+lTTADDQs88qZ+/VJ3tbMOK2jXu73fVb6oxrFjsdiJw== 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=1779896017; 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=fV90/9M3yf2GOUwH28foDST6j/OmGnRe/CHYuWMozeU=; b=gBrndcPqSL9UVvH+ke0GFEOqS1HZS2z7d0sLonCNXHUSg0xbIIM1rFj+97VlMtmm+z0wpl SK+B1ji8V2q84ZP9YzGbEOKy3TecL1N3mS17NqQxbMefORzlOy6E3tFF350hiAUBZBRVBT bvXz0XYj6x1gLg3POVKC5xUg5ld8ucGvg7LXh9odQ08V+YrYVbCL4yjNzGMD/Y1V+bzh1p 33QtePS1+eIC2/8/xRfbgijvpm3a31Rx54QlZkou61AXo278H9nWdI//ayD8aghYa3SSJr nOzBSdfx2JFgPOR4hAbvpXHtzfeSv5SgiQN/Kl1h3aXtOp30j/ptku5tFR1ThA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYY1PYRz14HG for ; Wed, 27 May 2026 15:33:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 270cb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:37 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 5589a7499add - main - sound: Retire snd_mixer->enuminfo 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5589a7499add5912a88e9424b0aec843e099fb60 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:37 +0000 Message-Id: <6a170ed1.270cb.17e985b7@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5589a7499add5912a88e9424b0aec843e099fb60 commit 5589a7499add5912a88e9424b0aec843e099fb60 Author: Christos Margiolis AuthorDate: 2026-04-17 17:31:00 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:12 +0000 sound: Retire snd_mixer->enuminfo Instead of caching this when mix_setrecdevs() is called (which many drivers never call), calculate it when we need it. After all, it is quite rare that this structure is used by applications. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/mixer.c | 78 ++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 55 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 0001ea7b481a..e61371d13610 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -56,7 +56,6 @@ struct snd_mixer { u_int8_t realdev[32]; char name[MIXER_NAMELEN]; struct mtx lock; - oss_mixer_enuminfo enuminfo; int modify_counter; }; @@ -493,64 +492,12 @@ mix_setdevs(struct snd_mixer *m, u_int32_t v) * recording devices. This function records that value in a structure * used by the rest of the mixer code. * - * This function also populates a structure used by the SNDCTL_DSP_*RECSRC* - * family of ioctls that are part of OSSV4. All recording device labels - * are concatenated in ascending order corresponding to their routing - * numbers. (Ex: a system might have 0 => 'vol', 1 => 'cd', 2 => 'line', - * etc.) For now, these labels are just the standard recording device - * names (cd, line1, etc.), but will eventually be fully dynamic and user - * controlled. - * * @param m mixer device context container thing * @param v mask of recording devices */ void mix_setrecdevs(struct snd_mixer *m, u_int32_t v) { - oss_mixer_enuminfo *ei; - char *loc; - int i, nvalues, nwrote, nleft, ncopied; - - ei = &m->enuminfo; - - nvalues = 0; - nwrote = 0; - nleft = sizeof(ei->strings); - loc = ei->strings; - - for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { - if ((1 << i) & v) { - ei->strindex[nvalues] = nwrote; - ncopied = strlcpy(loc, snd_mixernames[i], nleft) + 1; - /* strlcpy retval doesn't include terminator */ - - nwrote += ncopied; - nleft -= ncopied; - nvalues++; - - /* - * XXX I don't think this should ever be possible. - * Even with a move to dynamic device/channel names, - * each label is limited to ~16 characters, so that'd - * take a LOT to fill this buffer. - */ - if ((nleft <= 0) || (nvalues >= OSS_ENUM_MAXVALUE)) { - device_printf(m->dev, - "mix_setrecdevs: Not enough room to store device names--please file a bug report.\n"); - device_printf(m->dev, - "mix_setrecdevs: Please include details about your sound hardware, OS version, etc.\n"); - break; - } - - loc = &ei->strings[nwrote]; - } - } - - /* - * NB: The SNDCTL_DSP_GET_RECSRC_NAMES ioctl ignores the dev - * and ctrl fields. - */ - ei->nvalues = nvalues; m->recdevs = v; } @@ -1104,10 +1051,31 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, mtx_lock(&m->lock); switch (cmd) { - case SNDCTL_DSP_GET_RECSRC_NAMES: - bcopy((void *)&m->enuminfo, arg, sizeof(oss_mixer_enuminfo)); + case SNDCTL_DSP_GET_RECSRC_NAMES: { + oss_mixer_enuminfo *ei = (oss_mixer_enuminfo *)arg; + char *loc; + int i, nvalues, nwrote, nleft, ncopied; + + nvalues = 0; + nwrote = 0; + nleft = sizeof(ei->strings); + loc = ei->strings; + + for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + if (!((1 << i) & m->recdevs)) + continue; + ei->strindex[nvalues] = nwrote; + ncopied = strlcpy(loc, snd_mixernames[i], nleft) + 1; + nwrote += ncopied; + nleft -= ncopied; + nvalues++; + loc = &ei->strings[nwrote]; + } + ei->nvalues = nvalues; + ret = 0; goto done; + } case SNDCTL_DSP_GET_RECSRC: ret = mixer_get_recroute(m, arg_i); goto done; From nobody Wed May 27 15:33:38 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 4gQYYZ3w9sz6fCtC for ; Wed, 27 May 2026 15:33:38 +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 4gQYYZ2pKTz3Xbj for ; Wed, 27 May 2026 15:33:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896018; 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=ShXiKXK8Wj4rj+cIc5r5/m/0ffFfza5X3HaG26ziy8k=; b=sSvpGBV0Cl8intZ88reyHRe+Esw0wP3np5RBnM5tLVL0AsAGLR5QU6Xq/0VuQ7vzWu1Wu3 rMqWfY59oqFK+ZsOXbdzPwHd2oYdlAtmvmq1RLhjv1Fa9CrxxT0D6GDpdJhQkHPmBhL5UP /Nzdz+Gr7CbYrE+oTKxYJiG98YElJhWiiXPumeqRvFLmUpMLazwzd5+xdYUytFQmtRBtL5 w7BVZe4YAbmVBLqzQu3DLRY0wsm9c5xio0fgDI3+qHSxib5uxJyQw3Ywao+KPpxFJG/YVm mwKenCLXZip9N2v4K6vbYsG2RuUtjTiBxUm4gkzrVRL0e+9Z27RofDPCmh0BcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896018; a=rsa-sha256; cv=none; b=tcFQ7O2MQIb981WZ9/TfiklgA63xyNUeD+U73mGb2+YrHk9oUzuekVFz2ss0MwhvOGFKZO s38Ch3ZPDUbubfUNQJ7O2UD2iN1AsUPUJ6ckouM6fbYKiHYV7rT/DaMUJpwd2CDZRkCEHW csqfp94QMUnVBLi+VpbUdPP78SDfKgu46GaRGz16oKVHf80SCLbtu+Br0QUBMtHv25dKrs LBPAmbpb1m5OkxUNhDkVh21sfs5gMhaEXnDzvZ3ymyZu3Jcl7y9Wpgrh7jvqGSUYbjwYTT w2Bpnzh+ZJvQjIaLu8weTDSaQ813SJQAyoONyCYu2fUnAoJfGhAUSp6tinkjVQ== 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=1779896018; 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=ShXiKXK8Wj4rj+cIc5r5/m/0ffFfza5X3HaG26ziy8k=; b=A0I63T//orLykveKWnIeT2H552dYozs6Ffgu+uz0fQmvavYcjgWPz3SdsENIhP/TDanc05 RntVzdbEXMYsNvSB5u3dtGnHg6nUTaxfdtiSckB83UpZLYL7hywycGRdGh+dwr99yr3cAM QsqPkaxBeluEqqyToKUB81edjH65F6DF+jmcquBKiNoRaKnRja83P73usZC0gK3bHNt809 L/6/UNpRAZBCqjkMr2ysmf/UrZionk32Fl5WFQVM0OPYRZhWi6xKHHTbJMi2vEa3Y9DxB7 Hc88vaY9ulIOdiamRa5dWR9RpSotz5MiiWsEu/Nb3HYFR315OBqBmJNSHTH1GA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYZ2DW6z14HJ for ; Wed, 27 May 2026 15:33:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27266 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 64ebbb1d7441 - main - sound: Retire MIXER_SIZE and use correct size in DEFINE_CLASS 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64ebbb1d74415cb93445cc625da63449f01ac8c5 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:38 +0000 Message-Id: <6a170ed2.27266.287a6f95@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=64ebbb1d74415cb93445cc625da63449f01ac8c5 commit 64ebbb1d74415cb93445cc625da63449f01ac8c5 Author: Christos Margiolis AuthorDate: 2026-04-18 10:29:39 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:12 +0000 sound: Retire MIXER_SIZE and use correct size in DEFINE_CLASS I am not sure why this hack was needed, but the size should be sizeof(struct snd_mixer). Unfortunately, we have to expose snd_mixer, but it should be better than relying on a hack. Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/mixer.c | 22 ---------------------- sys/dev/sound/pcm/mixer.h | 32 ++++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index e61371d13610..8d96486c862b 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -37,28 +37,6 @@ #include "feeder_if.h" #include "mixer_if.h" -#define MIXER_NAMELEN 16 -struct snd_mixer { - KOBJ_FIELDS; - void *devinfo; - int hwvol_mixer; - int hwvol_step; - int type; - device_t dev; - u_int32_t devs; - u_int32_t mutedevs; - u_int32_t recdevs; - u_int32_t recsrc; - u_int16_t level[32]; - u_int16_t level_muted[32]; - u_int8_t parent[32]; - u_int32_t child[32]; - u_int8_t realdev[32]; - char name[MIXER_NAMELEN]; - struct mtx lock; - int modify_counter; -}; - static u_int16_t snd_mixerdefaults[SOUND_MIXER_NRDEVICES] = { [SOUND_MIXER_VOLUME] = 75, [SOUND_MIXER_BASS] = 50, diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h index b16256862b4f..34f0514c6271 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -30,6 +30,28 @@ #ifndef _PCM_MIXER_H_ #define _PCM_MIXER_H_ +#define MIXER_NAMELEN 16 +struct snd_mixer { + KOBJ_FIELDS; + void *devinfo; + int hwvol_mixer; + int hwvol_step; + int type; + device_t dev; + u_int32_t devs; + u_int32_t mutedevs; + u_int32_t recdevs; + u_int32_t recsrc; + u_int16_t level[32]; + u_int16_t level_muted[32]; + u_int8_t parent[32]; + u_int32_t child[32]; + u_int8_t realdev[32]; + char name[MIXER_NAMELEN]; + struct mtx lock; + int modify_counter; +}; + struct snd_mixer *mixer_create(device_t dev, kobj_class_t cls, void *devinfo, const char *desc); int mixer_delete(struct snd_mixer *m); @@ -65,13 +87,7 @@ void *mix_getdevinfo(struct snd_mixer *m); #define MIXER_TYPE_PRIMARY 0 /* mixer_init() */ #define MIXER_TYPE_SECONDARY 1 /* mixer_create() */ -/* - * this is a kludge to allow hiding of the struct snd_mixer definition - * 512 should be enough for all architectures - */ -#define MIXER_SIZE (512 + sizeof(struct kobj) + \ - sizeof(oss_mixer_enuminfo)) - -#define MIXER_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, MIXER_SIZE) +#define MIXER_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, \ + sizeof(struct snd_mixer)) #endif /* _PCM_MIXER_H_ */ From nobody Wed May 27 15:33:39 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 4gQYYb4TsZz6fCL3 for ; Wed, 27 May 2026 15:33: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 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 4gQYYb2yjKz3Xjq for ; Wed, 27 May 2026 15:33:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779896019; 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=D6kHCszV2oeilqRW30EEGTgC9vKJnWUvyWM+Nza1UJ4=; b=fsyLVluvEpgwwBBuKh6PWNPmfat4oideO9p3F+nxX39l8USFWH6r/iLz8+syChZ+9cbzDQ oxUhYKPwOOIGYmdmVYfbyX/oZ3MsxtEOPbZN4OgBF3CWeXF8SzhsMG9idiYH87KTVJK8si KYwcuJqgfjliOEIMYWez9ulH2tCEtByOIYvUSW+l7iN1r4L1Dmo9uuhX6hnhQqhM+yLrf6 sLUFPcC26BAEcrmOGM5+LbRFX1TqMzxxA5cTl/leC1HW5zjv5FziNvHYKCceU9GXgThQIB xd9EBlqV4N0L6ltCMs+emNQwSoOzRu/xpoqa7IbgX4Mi0zShtB8w/CYtdBLY4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779896019; a=rsa-sha256; cv=none; b=UVnuakxaph6cyu0LRZGU16tslYVG7jhmQdqp2zAdmaprPLZAFCMIgv45TTha7yLwIRQbmI 2z5BdmUZ5LDCGFDeKSU2sa8QJizaXUikwxtigdaQh6h0bqKkpQ+RW4xIZHSrg67NfFYLms Zn9UzoD1WtaZ2tncUhfKDN/XbRSu2CAotIVc9d8Fp0jp4dJEex+z/Gf4Dpm3xKS/lsExg/ nvZEK5nvttOb7YOLG2P7U0MBuh7kTX19u1sksOs1KwwUOpeiv9VWTCYu0lg99ZYlCpTGm9 ilSZfb/eUIboVKO8Jzy1mIuUG25Prf/P05loZOtkFZ603RkkK9n0ojKIja2Slw== 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=1779896019; 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=D6kHCszV2oeilqRW30EEGTgC9vKJnWUvyWM+Nza1UJ4=; b=UQjCCpF7yfdLAOvs4FPwgrZ94Pyv8Vge1tdeCKrFfxCd6t5kb8KMX+YSjbO8cIgtbEayvs C5GzAfn789YWKhtZsizP9ksLKfmXvJCA76DGX1tg5NbRbSy9c/+BmeRnc78Q+SVrcGo+r1 BlNz2Tp3p7G+JA0vSV2rjKVlnHfOyEMKdEbmWayxV2OiLP3cVsTBn+hD6tTV8US4IrUpG3 QQIWdTLPgsLc1Kk0AugfbR+ylfFFUOpSvGTFbM1b1WY/Iuu5F4+zAXqJN6ub7tcEs5m4qK IkqY/Mbwroy3gAqPH97MQp2pJdJ4iw6Ww6eeztNlG5RZWt2q9/qJebverfIpoQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQYYb2P7kz14kC for ; Wed, 27 May 2026 15:33:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27143 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 15:33:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 773bbfc57328 - main - sound: Update mixer.c LICENSE header 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 773bbfc57328f0a7947f2ad9a30de6a45ccce758 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 15:33:39 +0000 Message-Id: <6a170ed3.27143.29e28ff@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=773bbfc57328f0a7947f2ad9a30de6a45ccce758 commit 773bbfc57328f0a7947f2ad9a30de6a45ccce758 Author: Christos Margiolis AuthorDate: 2026-04-17 17:33:00 +0000 Commit: Christos Margiolis CommitDate: 2026-05-27 15:32:12 +0000 sound: Update mixer.c LICENSE header Sponsored by: The FreeBSD Foundation MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/18 --- sys/dev/sound/pcm/mixer.c | 4 ++++ sys/dev/sound/pcm/mixer.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 8d96486c862b..3ddee24417cc 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -5,6 +5,10 @@ * Portions Copyright (c) Ryan Beasley - GSoC 2006 * Copyright (c) 1999 Cameron Grant * All rights reserved. + * Copyright (c) 2026 The FreeBSD Foundation + * + * Portions of this software were developed by Christos Margiolis + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h index 34f0514c6271..6f764307cfc8 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -4,6 +4,10 @@ * Copyright (c) 2005-2009 Ariff Abdullah * Copyright (c) 1999 Cameron Grant * All rights reserved. + * Copyright (c) 2026 The FreeBSD Foundation + * + * Portions of this software were developed by Christos Margiolis + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From nobody Wed May 27 17:02:41 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 4gQbXK75SCz6fLLX for ; Wed, 27 May 2026 17:02:41 +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 4gQbXK6YL1z3rYk for ; Wed, 27 May 2026 17:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779901361; 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=cOA285zLHtr9eKnVWRbEsRg6VGXvQofk5Gg9mk3eXlc=; b=ZKs1carXLRy8ooj38mEF2qp/1TTKxVXExpnUvdhaKtCuL+aZh4ylH/IMrIuNJlNAZqlZgd UnitXM24MDieeZ1WQ026RRhkdHgeATStBEhBEhuJrlBVhWEGsYNoqjRz280jnii+DdGR6d cCYybIqh1gC2Umcc4xteAhF1QUUxCUVD9rlpioqaiYjjWbwE5BVXesMTz3C/Fg8a84EDj/ 0aIAFQhyTQJfxzHAs8/oa7mSWgfuQsUEhC+8mf7ShZfWMwpnvXSJC67HebKRU2O5/yEPuo b125COC+vfRNXcslLIeY91lK83TTGR/jlec7OZjxYNrPYGXjqERI6R7WvYUb6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779901361; a=rsa-sha256; cv=none; b=LY1kK8KrsJbuZ6XDIjoRxtWDZwx9piDbYHV2tWHeDqk6BSttVBPeZNaoH0D++E0QcBLLKk 0DLvY8ECm9KM/VkPzO3l0B//XNt+W3RDCehHuHmSAr8P7De3D6+VcvHsPXnsBJy499vWut lmoa1VV8B+f7a51w66LW0hIa0ggChyNc9rx0NV7gkFiEmhYTp5XMCtl/jExF9s7ZugGaIJ BvG74NneAQKiaxf8+tvI8DWCUB1OFLE1N+GnvZFliHiLw2b15m5U0us6yEQIQmaQYLt0z4 y11+Xny2e60AkUNHglRrOzStzz69oxUZFTENfuvsOG9Sz4LZwpA2xtM/rTUm5Q== 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=1779901361; 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=cOA285zLHtr9eKnVWRbEsRg6VGXvQofk5Gg9mk3eXlc=; b=qHr+ud4NUTv1Rb+Z/AsDTeLxEk90lpLIi6R+SV5tzP7Kbwd+c/y3eFKTUkkPy3jWeZxMBa DrV8xAbz1saOpkffG+OXyI8arz25uG3X12GGd0z2qOiuLUOd2wFwv+uHhX8kdnxcWHIvna D1bmCpsoaIpYiYLq9s+apvgQtsE+GfgYQBLOJBJwPSrK5qw5NOJlWE6RnvQlmK+WR2Tz1M +YRKJivPoiqQO5elGEQ3BAxk+FnF5WW+vM3bJpXRRIm7IpAWOECA4HNUpW19LpZ2u+uMD4 FR6PWhXG4IC0iysLWESTJ4Y0kYkmdczYiIQs+sqjk/aV/eTLIf4IVRTJN5O1+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQbXK5wt5z17Xn for ; Wed, 27 May 2026 17:02:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3954e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 17:02:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: f2a89e7e1d87 - main - limits: Improve consistency 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2a89e7e1d87c5a3aaa243aff3f6086e7312ecf5 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 17:02:41 +0000 Message-Id: <6a1723b1.3954e.554c9451@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f2a89e7e1d87c5a3aaa243aff3f6086e7312ecf5 commit f2a89e7e1d87c5a3aaa243aff3f6086e7312ecf5 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-27 17:02:07 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-27 17:02:07 +0000 limits: Improve consistency Historical precedent seems pretty consistent: size limits have singular names, number limits have plural names. RLIMIT_VMM broke this, and I made matters worse by referring to this limit as “vmms†in limits(1). Consistently use “vms†everywhere user-visible, while leaving the question of whether or not to rename RLIMIT_VMM itself for another day. Fixes: 1092ec8b3375 ("kern: Introduce RLIMIT_VMM") Fixes: 53af2026f213 ("limits: Unbreak after RLIMIT_VMM addition") Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D57265 --- sys/sys/resource.h | 2 +- usr.bin/limits/limits.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/resource.h b/sys/sys/resource.h index 9e0635cdb328..6d8d17a05e02 100644 --- a/sys/sys/resource.h +++ b/sys/sys/resource.h @@ -145,7 +145,7 @@ static const char *rlimit_ident[] = { "kqueues", "umtx", "pipebuf", - "vmm", + "vms", }; #endif diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c index fbb19289e6ca..a6e95e7c37a9 100644 --- a/usr.bin/limits/limits.c +++ b/usr.bin/limits/limits.c @@ -247,7 +247,7 @@ static struct { { "kqueues", login_getcapnum }, { "umtxp", login_getcapnum }, { "pipebuf", login_getcapnum }, - { "vmms", login_getcapnum }, + { "vms", login_getcapnum }, }; _Static_assert(nitems(resources) == RLIM_NLIMITS, From nobody Wed May 27 17:02:42 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 4gQbXM0gKpz6fLQL for ; Wed, 27 May 2026 17:02:43 +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 4gQbXL73jBz3rrG for ; Wed, 27 May 2026 17:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779901363; 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=a52chv5Imf7woCvI2mD40Z/mtTKQMYdXe5mkW4q/b0I=; b=xVmhhv1kprBNutClflw6Ie0XeCym/1x4RCnyf+3Wcj5c1jukDQSV2H+RdjxYtNpglCMDhj RraKsWVlsITpaYlyi7o/oYxJ7KMCR5s8CmW/0c4XbgztTts6X5Xv3mxrdjwT2Y3niqBgwV bNyH9fNb8I3aPL+s93AK+r8Le9YgaCFilswtRUvJKXvrlfZvqj1lKVEJuLeru356nKJUnL uNqazMrlDNDJNRQ7dt73KjeEdg9A+LMP+yxwM8jrjCrtU61Ffpbbxi+S6Z1ZNFS96IceVF XEnM23TeJFRg9Pc/SdvMcpGVIO/8xnWLFfqMOFLgE1XUHKBdzAi5Qd0JgI4vYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779901363; a=rsa-sha256; cv=none; b=oZdnjyDrOvFnaxj3204DTpyJmuiV1ip9V++rux18xKCd2VuBIL/m+1Z6njLtUSm6T6qvBu Ft4+eQQh/7jjU1qsqi0ol1Bt3D586d2yXUlT38srWsCgL3OwWczwLA2ER1/WH0m+WyVeR/ 9jyD56g0xIaHThn+7jq2E5IN7CJ/yf9TXyF7ini2sd/yvh/OnIsyK79+z9wkXqfqpZ/CFL FargBwtfy/uCWSy5EFYVhXraN8uKQMDl/d60vSEngAjzpLUI/Xqi4UwkhAyx9GNdKWfIkR juCWFgglePT+Sw2LOFNpu94IXx6+kleQZITs9FsvuF6uiZx+yqixX5CNS9TP3w== 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=1779901363; 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=a52chv5Imf7woCvI2mD40Z/mtTKQMYdXe5mkW4q/b0I=; b=i9wgA55z05eeTIF7fnFuZvPc/YvKYm8KC+rWcqMQYsc9Pqu94xEEszNDVaKvjDRNm0V9d/ XOTWIX0GlM8cWQwdOSf0gD2t1H6uxbvNk/hhLheuQJC39zoYixzXtcr4itMdBntshM18LO DrUx+QhV5cD3iyqV3TSfd64dBPxi+mlUPq22+3SJ/VVlgFpAe3DKGit9fjTsurYJl0Ml0h 6JM4C1XsTBpShG5HoB30Uv+VuYhwsNUSMp7qd6XxK+dreHX3THJv+GRrur2KKFRKCup9Zn 6QFSyu00bBfbt+vhVYY8L8H6ylNdjrijJkzGXHHnCulkGa6UyM3NgQ571NkM7A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQbXL6YpWz17Md for ; Wed, 27 May 2026 17:02:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39d9e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 17:02:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 6880405bf97d - main - cap_mkdb: Fix memory leak 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6880405bf97df03ffce227d34c2faa99b602a49d Auto-Submitted: auto-generated Date: Wed, 27 May 2026 17:02:42 +0000 Message-Id: <6a1723b2.39d9e.375f4785@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=6880405bf97df03ffce227d34c2faa99b602a49d commit 6880405bf97df03ffce227d34c2faa99b602a49d Author: Dag-Erling Smørgrav AuthorDate: 2026-05-27 17:02:12 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-27 17:02:12 +0000 cap_mkdb: Fix memory leak This is not a big deal since it only iterates once before exiting, but that's no reason to set a bad example. PR: 195128 MFC after: 1 week Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D57251 --- usr.bin/cap_mkdb/cap_mkdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c index 7ee6d2ddd2b3..019dad1ee72e 100644 --- a/usr.bin/cap_mkdb/cap_mkdb.c +++ b/usr.bin/cap_mkdb/cap_mkdb.c @@ -117,6 +117,7 @@ main(int argc, char *argv[]) if (capdbp->close(capdbp) < 0) err(1, "%s", capname); + free(capname); capname = NULL; exit(0); } @@ -151,7 +152,7 @@ db_build(char **ifiles) data.data = NULL; key.data = NULL; - for (reccnt = 0, bplen = 0; (st = cgetnext(&bp, ifiles)) > 0;) { + for (reccnt = 0, bplen = 0; (st = cgetnext(&bp, ifiles)) > 0; free(bp)) { /* * Allocate enough memory to store record, terminating From nobody Wed May 27 18:22:58 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 4gQdJy3XmCz6fS3b for ; Wed, 27 May 2026 18:22:58 +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 4gQdJy2qZ2z426f for ; Wed, 27 May 2026 18:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779906178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q9oHfv5uZ20IfP3TnpP/BOaDqnyGAj6Ih/OaKbWNWuQ=; b=tx5UCE6nft1ADJ7kvdyuapK+fXKjXSDXIU3aVIxAMx4eriWM91B04Fz/ISoNwBO+C33qDW 0VnRdYDOXPGD9rh2b1lR3xeQL3YkUghTzZyzjxv2GpPJcVtNflWfW7o6EjDalgc/Angr5o i/TZlP9vtCbybAqLfFTVQ+NVdcXoSX2fZoIMI2gYpJxAic/v0qUQs3DVlbsJ7J9hce3Ycd vuiIb9K4KjkLs8/IZSuEiO3o6t2ZMxRH1fNCHmkZX8vgx9/5lXXL35GM6KYnC7m71BoQch gGyMrKGvomsuJzuca0EvTGCSJjDA0wkpgS/IJbs4Sol2Pi7clXc7pDTPb+3N0Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779906178; a=rsa-sha256; cv=none; b=oOnk8q/e4uWPu933bIm2FhA3MVoSE7nVijJKccvFmmJUhWThJGG7cDu9IWqvJddIlncNzl wABPElS8EtedJeZZ9srITTB1VGXDZzD/ksRPRznC+Ru2EF2WQba+xq6cbyMixnthzWvB5s S8ayYmkw8nOPS1v8fwbGLq1hY35/3pxLeDvuUxBMHKfke/SxFvGtJlaA31dT7j9pmJDd7e u9EbfzmiZ4ccCUtoxLt5FtgRirXYyq9Kl1QbUrwy1GLdO6/XAH/zOIsdWmctSYjbplGhW/ 6zbzJXuql6zfVVukyh7rhSlxoKpOU8oEwg7KgNli/+4FnRxqcM/1GYXwU09ZRA== 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=1779906178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q9oHfv5uZ20IfP3TnpP/BOaDqnyGAj6Ih/OaKbWNWuQ=; b=mQsu/Km99dRgF+DmB82biP9fPw7TKu6tsI7Kslg2AN1M4rYLESNaMPkfFp3K0RQVoRy6Ak F2IEzL5vTypDpvW3irVWI9ZUya8w9fmZb5Ua8mBhcfvG4pilnNhp/e98YTU4qnQ9gwoGzw TAfF91cLWxP9NP0TOxHvu2FjVPOwpXeaR3hUkb/yf7x2D5HKwYoQ3naL9jV7wipznaGPhY tF/MhrfkaaEg+2/HISYJssgZfIg7speZBfdHZrAki9bLvI4OELZNhjtqFOLvK73JpVyGU6 3WVu5zjN5GWk/XFbilUa1PMLNDf/G8FEMh11lI5l/XNz7u6KxRDPXl8fZ5CHCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQdJy2HJrz19jH for ; Wed, 27 May 2026 18:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fb6f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 18:22:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kyle Crenshaw From: Mitchell Horne Subject: git: ccda002ca10f - main - rk_gpio: implement PIC masking methods and mask unhandled IRQs 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccda002ca10f9fb88e65d4bc27f0676e6f97d16d Auto-Submitted: auto-generated Date: Wed, 27 May 2026 18:22:58 +0000 Message-Id: <6a173682.3fb6f.4ddf8fab@gitrepo.freebsd.org> The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=ccda002ca10f9fb88e65d4bc27f0676e6f97d16d commit ccda002ca10f9fb88e65d4bc27f0676e6f97d16d Author: Kyle Crenshaw AuthorDate: 2026-05-14 21:07:42 +0000 Commit: Mitchell Horne CommitDate: 2026-05-27 18:21:19 +0000 rk_gpio: implement PIC masking methods and mask unhandled IRQs The Rockchip GPIO controller implements PIC operations for the INTRNG framework but is missing four masking methods that INTRNG calls during the filter/ithread handoff: pic_disable_intr, pic_enable_intr, pic_pre_ithread, pic_post_ithread. Without them, level-sensitive interrupt sources connected to a Rockchip GPIO pin re-fire continuously while their ithread runs. On a RockPro64 with a FUSB302B Type-C controller (i2c) attached to gpio1 INT_N, the system enters a ~210 kHz interrupt storm the moment the fusb302 driver attaches and INT_N goes low. Two complementary changes: 1. Add the four pic_disable_intr/pic_enable_intr/pic_pre_ithread/ pic_post_ithread method bodies. Each toggles the pin's RK_GPIO_INTMASK bit so the source is masked during the in-flight ithread window and unmasked on return, honouring the generic INTRNG mask/unmask sequence. 2. When the GPIO IRQ filter dispatches a pin and finds no consumer registered, mask the pin at the controller (INTMASK=1, INTEN=0) before continuing. Level-triggered sources keep asserting until acked, so a single stuck pin used to flood the console with thousands of "Interrupt pin=N unhandled" lines per second. The mask survives until something re-attaches and re-enables the IRQ via the standard pic_enable_intr path. Affects all level-triggered IRQs on Rockchip GPIO banks; edge- triggered IRQs were already self-acking and unaffected. Signed-off-by: Kyle Crenshaw Reviewed by: mhorne MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/2197 --- sys/arm64/rockchip/rk_gpio.c | 106 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 6 deletions(-) diff --git a/sys/arm64/rockchip/rk_gpio.c b/sys/arm64/rockchip/rk_gpio.c index 8da37d516802..7c2071d2d178 100644 --- a/sys/arm64/rockchip/rk_gpio.c +++ b/sys/arm64/rockchip/rk_gpio.c @@ -227,8 +227,22 @@ rk_gpio_intr(void *arg) status &= ~(1 << pin); if (intr_isrc_dispatch(RK_GPIO_ISRC(sc, pin), tf)) { - device_printf(sc->sc_dev, "Interrupt pin=%d unhandled\n", - pin); + /* + * Pin asserted but no consumer is registered for it + * yet (or anymore). Level-triggered sources keep + * firing on every interrupt cycle, so a single stuck + * pin floods the console with thousands of these + * messages per second. Mask the pin's IRQ at the + * controller and disable further dispatches; if a + * consumer attaches later it will re-enable through + * pic_enable_intr / rk_gpio_pic_enable_intr. + */ + RK_GPIO_LOCK(sc); + rk_gpio_write_bit(sc, RK_GPIO_INTMASK, pin, 1); + rk_gpio_write_bit(sc, RK_GPIO_INTEN, pin, 0); + RK_GPIO_UNLOCK(sc); + device_printf(sc->sc_dev, + "Interrupt pin=%d unhandled — masked\n", pin); continue; } @@ -818,10 +832,14 @@ rk_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, return (EINVAL); } rk_gpio_write_bit(sc, RK_GPIO_DEBOUNCE, pin, 1); - rk_gpio_write_bit(sc, RK_GPIO_INTMASK, pin, 0); - rk_gpio_write_bit(sc, RK_GPIO_INTEN, pin, 1); RK_GPIO_UNLOCK(sc); + /* + * Leave the interrupt masked + disabled here. INTRNG will call + * pic_enable_intr() next to make it live. That keeps the + * masking responsibility cleanly in enable/disable rather than + * split between setup and disable. + */ return (0); } @@ -837,14 +855,86 @@ rk_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, if (isrc->isrc_handlers == 0) { irqsrc->mode = GPIO_INTR_CONFORM; RK_GPIO_LOCK(sc); - rk_gpio_write_bit(sc, RK_GPIO_INTEN, irqsrc->irq, 0); - rk_gpio_write_bit(sc, RK_GPIO_INTMASK, irqsrc->irq, 0); + /* + * INTEN/INTMASK are already cleared by pic_disable_intr, + * which INTRNG calls before teardown of the last handler. + * We only need to undo what setup_intr configured -- here, + * the debounce filter. + */ rk_gpio_write_bit(sc, RK_GPIO_DEBOUNCE, irqsrc->irq, 0); RK_GPIO_UNLOCK(sc); } return (0); } +/* + * INTRNG calls pic_disable_intr() during teardown of the final handler + * for a source, OR when a consumer explicitly wants the source off. + * Clear INTEN so the controller will not raise this pin at all. + * + * The in-flight masking between FILTER_SCHEDULE_THREAD and ithread + * completion is handled by pic_pre_ithread() / pic_post_ithread() + * below, NOT by this method. + */ +static void +rk_pic_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct rk_gpio_softc *sc = device_get_softc(dev); + struct rk_pin_irqsrc *rkisrc = (struct rk_pin_irqsrc *)isrc; + + RK_GPIO_LOCK(sc); + rk_gpio_write_bit(sc, RK_GPIO_INTMASK, rkisrc->irq, 1); + rk_gpio_write_bit(sc, RK_GPIO_INTEN, rkisrc->irq, 0); + RK_GPIO_UNLOCK(sc); +} + +/* + * INTRNG calls pic_enable_intr() to make a source live for the first + * time (after setup_intr), or to re-enable after a prior + * pic_disable_intr(). Set INTEN and unmask so the controller starts + * delivering this pin. + */ +static void +rk_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct rk_gpio_softc *sc = device_get_softc(dev); + struct rk_pin_irqsrc *rkisrc = (struct rk_pin_irqsrc *)isrc; + + RK_GPIO_LOCK(sc); + rk_gpio_write_bit(sc, RK_GPIO_INTEN, rkisrc->irq, 1); + rk_gpio_write_bit(sc, RK_GPIO_INTMASK, rkisrc->irq, 0); + RK_GPIO_UNLOCK(sc); +} + +/* + * Called by INTRNG before delivering to the ithread. Mask the source + * so it cannot re-fire during the ithread window -- without this, + * level-low IRQs (e.g. FUSB302 INT_N) re-trigger continuously and + * starve the ithread (~210 kHz storm observed via dtrace). + * Re-unmasked in pic_post_ithread() once the ithread acks the source. + */ +static void +rk_pic_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct rk_gpio_softc *sc = device_get_softc(dev); + struct rk_pin_irqsrc *rkisrc = (struct rk_pin_irqsrc *)isrc; + + RK_GPIO_LOCK(sc); + rk_gpio_write_bit(sc, RK_GPIO_INTMASK, rkisrc->irq, 1); + RK_GPIO_UNLOCK(sc); +} + +static void +rk_pic_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct rk_gpio_softc *sc = device_get_softc(dev); + struct rk_pin_irqsrc *rkisrc = (struct rk_pin_irqsrc *)isrc; + + RK_GPIO_LOCK(sc); + rk_gpio_write_bit(sc, RK_GPIO_INTMASK, rkisrc->irq, 0); + RK_GPIO_UNLOCK(sc); +} + static device_method_t rk_gpio_methods[] = { /* Device interface */ DEVMETHOD(device_probe, rk_gpio_probe), @@ -873,6 +963,10 @@ static device_method_t rk_gpio_methods[] = { DEVMETHOD(pic_map_intr, rk_pic_map_intr), DEVMETHOD(pic_setup_intr, rk_pic_setup_intr), DEVMETHOD(pic_teardown_intr, rk_pic_teardown_intr), + DEVMETHOD(pic_disable_intr, rk_pic_disable_intr), + DEVMETHOD(pic_enable_intr, rk_pic_enable_intr), + DEVMETHOD(pic_pre_ithread, rk_pic_pre_ithread), + DEVMETHOD(pic_post_ithread, rk_pic_post_ithread), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, rk_gpio_get_node), From nobody Wed May 27 18:22:57 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 4gQdK23qFyz6fSBp for ; Wed, 27 May 2026 18:23:02 +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 4gQdK237NRz429w for ; Wed, 27 May 2026 18:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779906182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RgVy7dIB6Dlp1CVZj3HtQ4Y2Vyn76uvb49neURyhF88=; b=ps2bw32NuFPssyElMrOzXQEZdKbM7QRw2lryNv4/aG3hrGGdEw7YmIdY4+5e2ZLtjNBZhe gUS1nQ2/RSZJE4Y97rY3R7Gne1eSu+qrRDMOiGetxmPqP4aitW/ijUDCItcIkNgRWoWiv2 1M7Y/I7UxNzt/XWni7U651VT/YUUFFkV0jP0OaFM8YkErtVu6f+zjiF+WOK/2/E+muOLZ+ Qa2aBCsR+rV+2AXPXuBC38Xp/AGPTtboY8SmCoFKLfNnkjvYxCvCYeKEPAXxJRUMGllGOp /ZkpeQUkaPXJ2q807Bepckc1LMYi9ixw7Zc0HlFqpBn8hUilDjkTqLUiMzwb5w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779906182; a=rsa-sha256; cv=none; b=DYixUEIc9v/MIXSW5GHafFHZrLRBMNl8fQzCJClM6VLiyQaLkndn9/SKLVtDtdk2tgUSQ8 IQPLmBA1Bpm4Ogx2YtJvV5mn72PWZGLIMx9kTcP0mYR3F/Kxjx6tGXhRlgStoiX5gIFKO8 fEVrh57CvdCCyFcvhLk2m8WLcR896oCMJ+NBGovZ/tAPRipL4AtT00YVcm7oer+LHpEMwx TJQ5d2DgNX/aJIKo930E9JhTPJld2qTiyu3kCfkWP/DDb16olLmCdvJbzHGwY1Eqt2G3m1 LG/1CnJVZPl75HtL0lljRbY8A+xvaHpN7bsIiLLYYRw9+Wp8gGngVHKfGFiMMQ== 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=1779906182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RgVy7dIB6Dlp1CVZj3HtQ4Y2Vyn76uvb49neURyhF88=; b=MXXeTfF/j7Dztn51qwxTAmSqmU/4hgdjWFgEq2RCVsd4FNZBQdLP1ip4CCpoLMd9lm78qj fTMK6SYQDpP3pzmHEHZtF+bK/WoXmSuSubZrcMRa2jJ0YqVn7WcTFZAxe77sb8vEemIfH9 aUtQ9SStdIrRCVngPd3QM2kIOTJbi+8sWcolvIVqXLXIJWdqDLxJrhdLKFnxjK9JuPAXFk rt20vn7tyQiW0fyBdSEKlxVMNYF8Qjv92F+WFriwm/IO0C/Psgyn0Slo/KT40yJKisCFeH s+B1rajFVFlGKvI6hI+Tdi4OeO7YQVNZS6nohzaGrhzOJHiLvmUqT6W1EtZdlQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQdK22ZC9z19jK for ; Wed, 27 May 2026 18:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 410bc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 18:22:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Haoxiang Li From: Mitchell Horne Subject: git: d1488cd762be - main - bcm2835_sdhci: Clean up DMA resources on attach failure 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d1488cd762bee79240a715bf04f3d30e9a121b26 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 18:22:57 +0000 Message-Id: <6a173681.410bc.778c744e@gitrepo.freebsd.org> The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=d1488cd762bee79240a715bf04f3d30e9a121b26 commit d1488cd762bee79240a715bf04f3d30e9a121b26 Author: Haoxiang Li AuthorDate: 2026-05-27 02:42:43 +0000 Commit: Mitchell Horne CommitDate: 2026-05-27 18:12:09 +0000 bcm2835_sdhci: Clean up DMA resources on attach failure bcm_sdhci_attach() allocates a DMA channel with bcm_dma_allocate() before creating the bus_dma tag and map. If a later initialization step fails, the common error path releases the interrupt and memory resources, but leaves the DMA channel allocated. Call bcm_dma_free() for cleanup, as it already performs the required internal checks and can therefore be invoked directly. Signed-off-by: Haoxiang Li Reviewed by: mhorne MFC after: 3 days Pull Request: https://github.com/freebsd/freebsd-src/pull/2241 --- sys/arm/broadcom/bcm2835/bcm2835_sdhci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c index e0c4327d8e05..6e974a1a61bb 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -365,6 +365,7 @@ bcm_sdhci_attach(device_t dev) return (0); fail: + bcm_dma_free(sc->sc_dma_ch); if (sc->sc_intrhand) bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand); if (sc->sc_irq_res) From nobody Wed May 27 20:15:08 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 4gQgpP1Sprz6fcJ9 for ; Wed, 27 May 2026 20:15:09 +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 4gQgpN6dxyz3Hbq for ; Wed, 27 May 2026 20:15:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779912908; 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=w5xRTNF2yjGKd2QO1dPaHN9mKoT5C2myP0IT9JWsxQI=; b=Byo75kOA9ehTTAk3Y7wliKksA9hwqb4t/rTAO7p/LvuwS39vcDKIQyxqa4amo2UbUmNZDj RR2wYpWMMS7X2/bcf4n81vGoIrAcAKidKeaXClwnjb1okOylBISPnc6sagmvOsKjWc3sYu 4J86lNM6BnK9F+4DN2mCno8y8J3pmfgq8h1W9GlXFkw4aE/DSv8RJydXKq1/4uUunRBMwG ca7pzNGfb2FycjPLLlnP0FPSjYHOcbf2IZl2wiIMMWy4EN0PVFhUIMC4ukX/EHZ4HNqrvV 6WQFRvEt0O8Q0uP0nk4yjepvEhtolkH5yw0mCTDkIRGsVDaulSMQM80hxFPNWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779912908; a=rsa-sha256; cv=none; b=fpObu+uZxuIbSXqfsYOdkjqagkviKPalBzr8TfmT7kelrzPcqdUFMpj2JBVdEX6negSQiu oFgQFqv8eiR616rym4GI217dClcThryzK1Z4Cb3lnjkGA1QxjvFK6h8mSy7j8dkr+Dv7jX plu5DuKVDkYQGsV/bL6o3zkh/PxzZnx35Au4bIGFu0xlpaty9UcLBg1HjL9+I1xsHqGwbc RqtsEdtih0PEAVBSoFqgDUjW+uAnr+W5bNbE5o9SgSVWX737wSu3DKXH8KzR6s8KeUsYTI 2lz8+cNii6qTEMXDN4PDmHCDrjhzJyxMuZJrY+A6kk4LSF8Qoq6oD/TveVeaBQ== 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=1779912908; 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=w5xRTNF2yjGKd2QO1dPaHN9mKoT5C2myP0IT9JWsxQI=; b=kdjdmEVb0Ozx+rHFWS9RwYNbpUa4rVIVIYXcPzij9b0JgUR8VsYAA3o+Du4CqfGhqpqr3+ HeseywE9COt7j6mTjtA4FIRqwVqMyY7uQakqaoOI1w49sk1wsj2TOGoq+DPAOBOFbADGHs l+hpRWlHxtY51w2BI4HSuaP4neart0/xGLJmtAqdDl1u2HON9i/LaL16FxA9UAiATNC0pR if2dg3wXNZo/NS5+f9TVbG0ysVgFaSca8VKNJ011xe6KUcm7guRYg2SKJ6KcoeqOX6kh6L oyRpUsMVM5rGFEiDx1RALuhRHK33wzFAmAsOlaDUw07b3HBfzrl9v881q5u7wA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQgpN5PLczSM for ; Wed, 27 May 2026 20:15:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1de87 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 20:15:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 40c846dc0794 - main - uart: Tidy the compat tables 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40c846dc07943df7cdebf091de09d5680a3f3606 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 20:15:08 +0000 Message-Id: <6a1750cc.1de87.5904db4@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=40c846dc07943df7cdebf091de09d5680a3f3606 commit 40c846dc07943df7cdebf091de09d5680a3f3606 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-27 20:14:58 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-27 20:14:58 +0000 uart: Tidy the compat tables No functional change intended. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D57269 --- sys/dev/uart/uart_dev_ns8250.c | 44 +++++++++++++++++++++--------------------- sys/dev/uart/uart_dev_pl011.c | 30 ++++++++++++++-------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index c13eabe9055e..d6940dc80005 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -529,40 +529,40 @@ UART_CLASS(uart_ns8250_class); */ #ifdef DEV_ACPI static struct acpi_spcr_compat_data acpi_spcr_compat_data[] = { - { &uart_ns8250_class, ACPI_DBG2_16550_COMPATIBLE }, - { &uart_ns8250_class, ACPI_DBG2_16550_SUBSET }, - { &uart_ns8250_class, ACPI_DBG2_16550_WITH_GAS }, + { &uart_ns8250_class, ACPI_DBG2_16550_COMPATIBLE }, + { &uart_ns8250_class, ACPI_DBG2_16550_SUBSET }, + { &uart_ns8250_class, ACPI_DBG2_16550_WITH_GAS }, { NULL, 0 }, }; UART_ACPI_SPCR_CLASS(acpi_spcr_compat_data); static struct acpi_uart_compat_data acpi_compat_data[] = { {"AMD0020", &uart_ns8250_class, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"}, - {"AMDI0020", &uart_ns8250_class, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"}, - {"APMC0D08", &uart_ns8250_class, 2, 4, 0, 0, "APM compatible UART"}, - {"MRVL0001", &uart_ns8250_class, 2, 0, 200000000, UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"}, - {"SCX0006", &uart_ns8250_class, 2, 0, 62500000, UART_F_BUSY_DETECT, "SynQuacer / Synopsys Designware UART"}, - {"HISI0031", &uart_ns8250_class, 2, 0, 200000000, UART_F_BUSY_DETECT, "HiSilicon / Synopsys Designware UART"}, - {"INTC1006", &uart_ns8250_class, 2, 0, 25000000, 0, "Intel ARM64 UART"}, - {"NXP0018", &uart_ns8250_class, 0, 0, 350000000, UART_F_BUSY_DETECT, "NXP / Synopsys Designware UART"}, - {"PNP0500", &uart_ns8250_class, 0, 0, 0, 0, "Standard PC COM port"}, - {"PNP0501", &uart_ns8250_class, 0, 0, 0, 0, "16550A-compatible COM port"}, - {"PNP0502", &uart_ns8250_class, 0, 0, 0, 0, "Multiport serial device (non-intelligent 16550)"}, - {"PNP0510", &uart_ns8250_class, 0, 0, 0, 0, "Generic IRDA-compatible device"}, - {"PNP0511", &uart_ns8250_class, 0, 0, 0, 0, "Generic IRDA-compatible device"}, - {"WACF004", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet PC Screen"}, - {"WACF00E", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet PC Screen 00e"}, - {"FUJ02E5", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet at FuS Lifebook T"}, - {NULL, NULL, 0 , 0, 0, 0, NULL}, + {"AMDI0020", &uart_ns8250_class, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"}, + {"APMC0D08", &uart_ns8250_class, 2, 4, 0, 0, "APM compatible UART"}, + {"MRVL0001", &uart_ns8250_class, 2, 0, 200000000, UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"}, + {"SCX0006", &uart_ns8250_class, 2, 0, 62500000, UART_F_BUSY_DETECT, "SynQuacer / Synopsys Designware UART"}, + {"HISI0031", &uart_ns8250_class, 2, 0, 200000000, UART_F_BUSY_DETECT, "HiSilicon / Synopsys Designware UART"}, + {"INTC1006", &uart_ns8250_class, 2, 0, 25000000, 0, "Intel ARM64 UART"}, + {"NXP0018", &uart_ns8250_class, 0, 0, 350000000, UART_F_BUSY_DETECT, "NXP / Synopsys Designware UART"}, + {"PNP0500", &uart_ns8250_class, 0, 0, 0, 0, "Standard PC COM port"}, + {"PNP0501", &uart_ns8250_class, 0, 0, 0, 0, "16550A-compatible COM port"}, + {"PNP0502", &uart_ns8250_class, 0, 0, 0, 0, "Multiport serial device (non-intelligent 16550)"}, + {"PNP0510", &uart_ns8250_class, 0, 0, 0, 0, "Generic IRDA-compatible device"}, + {"PNP0511", &uart_ns8250_class, 0, 0, 0, 0, "Generic IRDA-compatible device"}, + {"WACF004", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet PC Screen"}, + {"WACF00E", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet PC Screen 00e"}, + {"FUJ02E5", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet at FuS Lifebook T"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; UART_ACPI_CLASS_AND_DEVICE(acpi_compat_data); #endif #ifdef FDT static struct ofw_compat_data compat_data[] = { - {"ns16550", (uintptr_t)&uart_ns8250_class}, - {"ns16550a", (uintptr_t)&uart_ns8250_class}, - {NULL, (uintptr_t)NULL}, + {"ns16550", (uintptr_t)&uart_ns8250_class}, + {"ns16550a", (uintptr_t)&uart_ns8250_class}, + {NULL, (uintptr_t)NULL}, }; UART_FDT_CLASS_AND_DEVICE(compat_data); #endif diff --git a/sys/dev/uart/uart_dev_pl011.c b/sys/dev/uart/uart_dev_pl011.c index ae3c4d3218cf..f0d7bcda1fa4 100644 --- a/sys/dev/uart/uart_dev_pl011.c +++ b/sys/dev/uart/uart_dev_pl011.c @@ -382,32 +382,32 @@ static struct uart_class uart_pl011_class = { }; UART_CLASS(uart_pl011_class); -#ifdef FDT -static struct ofw_compat_data fdt_compat_data[] = { - {"arm,pl011", (uintptr_t)&uart_pl011_class}, - {NULL, (uintptr_t)NULL}, -}; -UART_FDT_CLASS_AND_DEVICE(fdt_compat_data); -#endif - #ifdef DEV_ACPI static struct acpi_spcr_compat_data acpi_spcr_compat_data[] = { - { &uart_pl011_class, ACPI_DBG2_ARM_PL011 }, - { &uart_pl011_class, ACPI_DBG2_ARM_SBSA_GENERIC }, - { &uart_pl011_class, ACPI_DBG2_ARM_SBSA_32BIT }, + { &uart_pl011_class, ACPI_DBG2_ARM_PL011 }, + { &uart_pl011_class, ACPI_DBG2_ARM_SBSA_GENERIC }, + { &uart_pl011_class, ACPI_DBG2_ARM_SBSA_32BIT }, { NULL, 0 }, }; UART_ACPI_SPCR_CLASS(acpi_spcr_compat_data); static struct acpi_uart_compat_data acpi_compat_data[] = { - {"ARMH0011", &uart_pl011_class, 2, 0, 0, 0, "uart pl011"}, - {"ARMHB000", &uart_pl011_class, 2, 0, 0, 0, "uart pl011"}, - {"ARMHB000", &uart_pl011_class, 2, 0, 0, 0, "uart pl011"}, - {NULL, NULL, 0, 0, 0, 0, NULL}, + {"ARMH0011", &uart_pl011_class, 2, 0, 0, 0, "uart pl011"}, + {"ARMHB000", &uart_pl011_class, 2, 0, 0, 0, "uart pl011"}, + {"ARMHB000", &uart_pl011_class, 2, 0, 0, 0, "uart pl011"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; UART_ACPI_CLASS_AND_DEVICE(acpi_compat_data); #endif +#ifdef FDT +static struct ofw_compat_data fdt_compat_data[] = { + {"arm,pl011", (uintptr_t)&uart_pl011_class}, + {NULL, (uintptr_t)NULL}, +}; +UART_FDT_CLASS_AND_DEVICE(fdt_compat_data); +#endif + static int uart_pl011_bus_attach(struct uart_softc *sc) { From nobody Wed May 27 21:00:32 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 4gQhpn1bXtz6fgs8 for ; Wed, 27 May 2026 21:00:33 +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 4gQhpm5hzRz3PJf for ; Wed, 27 May 2026 21:00:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779915632; 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=FmKEK5TO87cygLKVvQTmFIOkpLh2hQYj7UuM7fOysaY=; b=VgBRPNKnHhoEqIqCsHix4XijMxDOtCbm9S6a9r8S1UQrfWu5/+H+YReVD/TztfvvrZVv9k mx5m3H4rxRbZzQMMJlBXDclN4VMAr8S1sbFJxiQ6tnmqefBHHuKorb9XakXNXREnMNufSK pyZ35t8O1AWpg3Yklmyv7U0K/VNc6cRfRPcEQ2XH8AJWYOOCwrkc6LYWqJ8AYtpprIiFhx xBPFbDKcAw7ebqoV1LsOERY7oKP/xpo82vOoVbZD8XPWKMu+pFD+u9nEqDyiAu272CutwC MFlX4eIjVydkctqDjF4uVzuukGsCyoK/8GjYfgrnAakBwWaOT0Q27LgHWhY5JQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779915632; a=rsa-sha256; cv=none; b=oCvRELw9hhAZGwLlx23autKNkvti4QURn5yaS+6MNfzmSfz8q/xtANfa6yKLVrEdG8f85a HfKGTCXdQ9UWGJq/ZeU3xi8N9aeynoN7dfjJ6yIyn4X16YigNUtl9t20ic5hQ+SdwwsCte cj1FlT4JahhYTg00aznvJ5ehCZKPOdMkdpdS/HtEFKwP8hNRD2sYQIeWYJo34N16+OCjBS V5/4RTcXpM8aXelzE1Q8cKE9SLH4+AwTspNONDliXiWjw8PgO3SXz7goAYliVo9QsvMGtJ 5Crda6nOj6irhzhl4nQtSJKc+eXbDRzWyY5WVoacbiq9i4hBCf5OyxHv/FoVLQ== 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=1779915632; 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=FmKEK5TO87cygLKVvQTmFIOkpLh2hQYj7UuM7fOysaY=; b=EVpJxbn+d0FUAl1SNwjVD6RtMF+mfIMNmi1sSAmxjoBnyM0g6YAjaQvpa0uVmxT+87CqG7 RYTI5qqyWM38yGalNwGxl/nGDhM3/LR1BVD7+Tj0d5L/ieGoQLUPuFc/oGcELlYG8PESr+ LSkBKvD679SmrGRo0JcRo0Vx59AiNoHKejPKBLr7KJRPawxh2g/Al/9UArVNK7f4ZtmWQA BxYCd8Nfzzl+GrKGEW5FTXbum3qxXxaG4msTEflpAwtJtYIFdasx57nLVDPTWadiCmJIJe COioszoYI9+cCrBqW8L0VbSHfQVE3GBIVPZBJFCekClWHWFfs3MRcO4KoMgi6Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQhpm4m3gzvR for ; Wed, 27 May 2026 21:00:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22673 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 21:00:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 7a436d378951 - main - ctld: Don't ignore pp/vp values of kernel ports with pp == 0 but vp != 0 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a436d378951bedbdaa71d45bf236fb001323549 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 21:00:32 +0000 Message-Id: <6a175b70.22673.65ed394f@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7a436d378951bedbdaa71d45bf236fb001323549 commit 7a436d378951bedbdaa71d45bf236fb001323549 Author: John Baldwin AuthorDate: 2026-05-27 20:56:39 +0000 Commit: John Baldwin CommitDate: 2026-05-27 20:56:56 +0000 ctld: Don't ignore pp/vp values of kernel ports with pp == 0 but vp != 0 Fixes: c6f1e9b8a412 ("ctld: Simplify XML parsing memory management") Sponsored by: Chelsio Communications --- usr.sbin/ctld/kernel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/ctld/kernel.cc b/usr.sbin/ctld/kernel.cc index a6b0a79850ec..59a339e1c96b 100644 --- a/usr.sbin/ctld/kernel.cc +++ b/usr.sbin/ctld/kernel.cc @@ -549,7 +549,7 @@ conf_new_from_kernel(struct kports &kports) continue; std::string name = port.port_name; - if (port.pp != 0) { + if (port.pp != 0 || port.vp != 0) { name += "/" + std::to_string(port.pp); if (port.vp != 0) name += "/" + std::to_string(port.vp); From nobody Wed May 27 21:00:34 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 4gQhpq3nVRz6fgxB for ; Wed, 27 May 2026 21:00:35 +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 4gQhpp6k5Nz3PLt for ; Wed, 27 May 2026 21:00:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779915635; 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=2U0dCnjFlSaLJ63nvujJfVloP6DK3MZkgDhCIcuFetw=; b=OCVgFskHW7oj9fiCjgO7mY0TFFBlQLeubzfxF2vqcIfa7YZFTxA2hFkbD7sCWX/oEa8S7/ Lxs1ATqsZLyb0h0Zc2WGFYxGRJO5TlKn/FzLrq6hf785N5VfZSdqiphm3JWpvNCvGoqlPU y7Xdhhhprxkgc/MnIirdB7EKD6hABH78hAxD4PJ0KxNXThMytnz+ZdabcMB2nludOphZdv KUfiBM/GnblGiMLSc7hGqgrzw2koNhe+qohRIqgPs/LXJDTOkJL4f6aZb120jdrz4SJceV TuQuiHvpLuS03a4/dCXY5InYm2flot2vfekohJYTgtlwdBty1jeRi5UxkF2Kgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779915635; a=rsa-sha256; cv=none; b=wjcz35+n1K4+krQdAovj+dX9DYl2iFY/hdbRTi79nYrpRnFstUbSM+Q46AfIK9PJvBcN3C rug13b8+ygcpEMmWX9yZVFWbwq1Seh2ZGe6IJab+OBtxE36D33z+OYQVOvzXo6K94e3kQJ 1j322Li98ObF/ojL5yaoohAk7lPmSNuaXbe/+nFRs7XPvnvpWQ+cd4V2bvLKOGhizMTfTZ qLBxxM/btVuaulNFVaAD+ShrsJFpwSoV6evhiWIHOlGvRqkAMlcDRCk7WJpnCfQ4rdp78j JXCnyXiduiMorUpJc4bntl0nn9Ck12HXnZNbfu2STrHuQbwBiqaKmBGFx08uNg== 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=1779915635; 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=2U0dCnjFlSaLJ63nvujJfVloP6DK3MZkgDhCIcuFetw=; b=v3tipMmV+lh/eLb3KffHV+lwtJkzzNP4GRFxc8APJ6Y/yYJ6fmfZmW4CVeEjoCgzZzvsve aRPqMa+x4ot9BUVCtS4lU4ZdWvKmttSZFPzTBH7rfrGgeMzFJdDSXHcAQdLuMst9qRxpGV SqBqgYDEaZUaHm4aDa/4LhWfal72xleuRDRcgRYCLgxL7ema61SwbuPCmZkN1EYGMsWmvi QkgpcTLM6Pb6X95pG6ApvNF5eR7YIgGX5Z1KITgk/c87F9268xTJhBpzPr6D7zWmem6Lok /hOyH+pV7hceWBjZqwyRZOF2z/ORUnAaJi9hgWIKt1/pZzszkiS6ImPnxvF3Pg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQhpp6GRvz18W for ; Wed, 27 May 2026 21:00:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23b10 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 21:00:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d1a8fa2e0f41 - main - ctld: Only check physical port linking in a single configuration context 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d1a8fa2e0f415f941e628f959fa0e70f23058fdb Auto-Submitted: auto-generated Date: Wed, 27 May 2026 21:00:34 +0000 Message-Id: <6a175b72.23b10.16d36bc4@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d1a8fa2e0f415f941e628f959fa0e70f23058fdb commit d1a8fa2e0f415f941e628f959fa0e70f23058fdb Author: John Baldwin AuthorDate: 2026-05-27 20:57:38 +0000 Commit: John Baldwin CommitDate: 2026-05-27 20:57:38 +0000 ctld: Only check physical port linking in a single configuration context Commit 969876fcee57 moved struct pport from being per-configuration to being a "global" object shared across multiple configurations. As a result, the check for duplicate ports actually spanned across configurations, such that reloading a configuration would now think that existing physical ports were already linked. The linking field in pport added in the C++-ification (commit 6acc7afa34aa) faithfully replicated this bug (albeit simpler as I had noticed that the TAILQ links weren't used after the earlier commit). To restore the desired behavior, remove the linking field from struct pport entirely and use a local unordered_map in conf::add_pports which tracks if a given pport is claimed by more than one target. PR: 293076 Reported by: Ken J. Thomson Fixes: 969876fcee57 ("ctld: parse config file independently of getting kernel info") Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D57093 --- usr.sbin/ctld/ctld.cc | 12 +++++++----- usr.sbin/ctld/ctld.hh | 4 ---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.sbin/ctld/ctld.cc b/usr.sbin/ctld/ctld.cc index 8b99bde14911..834bef4ef363 100644 --- a/usr.sbin/ctld/ctld.cc +++ b/usr.sbin/ctld/ctld.cc @@ -1175,7 +1175,6 @@ conf::add_port(struct target *target, struct pport *pp) return (false); } - pp->link(); return (true); } @@ -2641,6 +2640,7 @@ conf_new_from_file(const char *path, bool ucl) bool conf::add_pports(struct kports &kports) { + std::unordered_map linked_ports; struct pport *pp; int ret, i_pp, i_vp; @@ -2654,11 +2654,13 @@ conf::add_pports(struct kports &kports) */ pp = kports.find_port(pport); if (pp != nullptr) { - if (pp->linked()) { + const auto &pair = linked_ports.try_emplace(pp, + targ); + if (!pair.second) { log_warnx("can't link port \"%s\" to " - "%s, port already linked to some " - "target", pport.c_str(), - targ->label()); + "%s, port already linked to %s", + pport.c_str(), targ->label(), + pair.first->second->label()); return (false); } diff --git a/usr.sbin/ctld/ctld.hh b/usr.sbin/ctld/ctld.hh index 8d63de06dd80..3bc92449e372 100644 --- a/usr.sbin/ctld/ctld.hh +++ b/usr.sbin/ctld/ctld.hh @@ -567,13 +567,9 @@ struct pport { const char *name() const { return pp_name.c_str(); } uint32_t ctl_port() const { return pp_ctl_port; } - bool linked() const { return pp_linked; } - void link() { pp_linked = true; } - private: std::string pp_name; uint32_t pp_ctl_port; - bool pp_linked = false; }; struct kports { From nobody Wed May 27 21:00:35 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 4gQhpr3qfpz6fgxH for ; Wed, 27 May 2026 21:00: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQhpr0F5kz3P5B for ; Wed, 27 May 2026 21:00:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779915636; 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=0VAkwTlpw63q/Ia2whio9nFIWyRdseE3POZ3oXk3tlA=; b=sUdP1YxMTwQ3MpsPJWS5V/UXoAoIvWD1FytDmYn8y0cpWoJGXAIkiLmTiv2VzfiwL+Vvi5 Fldonpd1Lvcmgv7I2iueFQSqaw57SSB2pv7u1TzmNT/cZJQnuMyzua/X9nHnfsNerPverb oFRrm5aX+AwZvn+uCJjfFenydLYRxsQ0znfOXDm/0UblzoPcrBikl7v7Q85+N4hUheCafo Ajs7R1EoMm3UVtuySpII2buXKiB8fy3m9X11MHmJ4MvMxa4wPvNhwyGnoK2wTpt9O5c02Z uMKeNE6v6hCUSuGrRpeNON3huW0dJQyLaun06v/e9lIvoS/1hQcCu9aQ7iPpdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779915636; a=rsa-sha256; cv=none; b=nll+nHfMIEfiXf/8t+2rKsQ9b6R/nDcDNw/0Bh8FjOOGDmaHGu7yjMT3VluGlcfTgUPR5s 3p3y2sXPX19OWyl0/MYErI8lfeH2OWSQyGL50cv91/HjQd8VY5xBW9YTBckp0IKd3fCQG9 l1reN1dZqCBJ9t4oWcKIR5/zqL2tLoCIMN6VmeSmPKmeiT2dUnCrCYk0csvjNsB2EkCa8C lQL4L1BpWXQJipgshfXfI2CfH4Pze9IZ4cVm4i7Eljo/EsCT2ZF6izLxBqf6RB1bn/HaO2 JnD+0Q7d4+cf+luAC+j7YLaBVSAw/a05QQAYvjd06i4irb63AuWmomoUfBNGFw== 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=1779915636; 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=0VAkwTlpw63q/Ia2whio9nFIWyRdseE3POZ3oXk3tlA=; b=OXljOCBAvB2OpjH3Aojr7wSUIm6hqFb742kQvdmUFA72j6PQTWI9GKsw0Ct7zBpf5T8eDE tKdJQrTyt2W/2ZsOK8onymIXL3+jm7jorMfu6Pi+SpW4cYpIAyzq4tlZZbtp5Woctpht2b ngzDwia6T53jC7v1MARIPprII4RI85Sadi7mjDdkX0OuIncu3vy5pm0Vni4sRlh+PVcugR LRDwmGVjiYX1r/3PrBTv2sLJNzzATuvdrzbjeP2gKczGBGZ28xGue/OooGMYC/0S0urJzl +UdgypFW6BDJTIGSoWnW8+tB3OG+7X08/HxpC2Bwx+PdBo00rlugfFONoe438Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQhpq6csqz1c6 for ; Wed, 27 May 2026 21:00:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2389a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 21:00:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 887841731be6 - main - ctl: Use CAM_PRIORITY_NORMAL for queued CCBs 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 887841731be60a958e471b9fd79261169b67b7ad Auto-Submitted: auto-generated Date: Wed, 27 May 2026 21:00:35 +0000 Message-Id: <6a175b73.2389a.154600ac@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=887841731be60a958e471b9fd79261169b67b7ad commit 887841731be60a958e471b9fd79261169b67b7ad Author: John Baldwin AuthorDate: 2026-05-27 20:58:05 +0000 Commit: John Baldwin CommitDate: 2026-05-27 20:58:05 +0000 ctl: Use CAM_PRIORITY_NORMAL for queued CCBs Previously this was using CAM_PRIORITY_NONE which tripped over the assertion added in b4b166b8c46b8. PR: 293076 Reported by: Ken J. Thomson Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D56995 --- sys/cam/ctl/scsi_ctl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 68f1cabf6d07..6a55aba2669b 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -522,7 +522,8 @@ ctlferegister(struct cam_periph *periph, void *arg) new_ccb->ccb_h.io_ptr = new_io; LIST_INSERT_HEAD(&softc->atio_list, &new_ccb->ccb_h, periph_links.le); - xpt_setup_ccb(&new_ccb->ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_ccb(&new_ccb->ccb_h, periph->path, + CAM_PRIORITY_NORMAL); new_ccb->ccb_h.func_code = XPT_ACCEPT_TARGET_IO; new_ccb->ccb_h.cbfcnp = ctlfedone; new_ccb->ccb_h.flags |= CAM_UNLOCKED; @@ -569,7 +570,8 @@ ctlferegister(struct cam_periph *periph, void *arg) new_ccb->ccb_h.io_ptr = new_io; LIST_INSERT_HEAD(&softc->inot_list, &new_ccb->ccb_h, periph_links.le); - xpt_setup_ccb(&new_ccb->ccb_h, periph->path, CAM_PRIORITY_NONE); + xpt_setup_ccb(&new_ccb->ccb_h, periph->path, + CAM_PRIORITY_NORMAL); new_ccb->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY; new_ccb->ccb_h.cbfcnp = ctlfedone; new_ccb->ccb_h.flags |= CAM_UNLOCKED; @@ -1003,7 +1005,7 @@ ctlfe_requeue_ccb(struct cam_periph *periph, union ccb *ccb, int unlock) * target/lun. Reset the target and LUN fields back to the wildcard * values before we send them back down to the SIM. */ - xpt_setup_ccb_flags(&ccb->ccb_h, periph->path, CAM_PRIORITY_NONE, + xpt_setup_ccb_flags(&ccb->ccb_h, periph->path, CAM_PRIORITY_NORMAL, ccb->ccb_h.flags); xpt_action(ccb); From nobody Wed May 27 21:00:33 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 4gQhpp513Rz6fgpK for ; Wed, 27 May 2026 21:00:34 +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 4gQhpn69Dbz3PJg for ; Wed, 27 May 2026 21:00:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779915633; 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=gfPlbozd8aELjELqMumpqpHVIqq5lF0Alfwd8zH98rE=; b=QeVHgxpJcZSIS86MbyyaGlfs1qGhdRA44V9pofh5doENyvilUH5NE48kdVK1w9IHOi5/Ew Mm8LKYmW23m6+EtcFccxbftv4o4CLOhn3clso8ha/jPhP2EYhYq64rXmGwogvCGI/0D4ZS WLcpXQ4g5hmR8Znaehgaq96Pa/2FoV++G54MS/X9bTIrM25JuGZCU/MDCmNjLfe0Op4JFl 4GuK2vXP3VYledw9/ckUA/b05PSBHDoZiNs1QlkXUNnnjrM/s7HYx36QlkJJ2oxfm57z5q x2FJLWgM1vO8a3mEDvNalZHwQZOAiSuHYrYMyIjqOHj7IVLm3vL9iB9dZNvQhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779915633; a=rsa-sha256; cv=none; b=uWyPvDC/xpZIrfLTTdHNdz2rOOLaCqF9bgtPp53lYn15HzstsSwRDfiEz5IbZNnRTEk2Qp 0nzUYxcUiiQ6WYTXPZaioHFM6IsWRyLxZWwj8gQyW7tOssaSQU2roIvNIKu1LmhWGRabRF HhLBIMxiEHl+YHBjCNngKKD+ikZfLyXFYYtejZA8NZ3nWSeVB7Bj9vgbXCif5fxixDprTZ 6gjRpQsDclhIRFSRyQ6xbg8qti1XqBvoyxNA5yQdWHxlpfxKmY+EZYIKp4U8kWeu+oDH0s puGyT40JDSKYnfVK3bec/b9FrH1bmGo6zeGvxCKm5Wk93EeVoPc1dVeYUJN9lQ== 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=1779915633; 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=gfPlbozd8aELjELqMumpqpHVIqq5lF0Alfwd8zH98rE=; b=g6JSOCwucC+jR1Mqen0B51AnILWvHS5rFWr30dRYt4yh9DvtNCL2suluQMoVY9Sl04o/+H 7Qb8l0H5FrLS5oduIFCRA3IgWpU2G8o3itCUtgvPOO85/IeQtpyBUPy9IVxIn0Oxo0wyxp FVabi4t5mBu2L05kqJINs1XYHoZa8QhlEfFS3Dn6pxl4nWF+fi3x2o8nCRWfFEbAS/m3dj o45MIEP/MnE4kawQGWRTKjKH8PDEhZHnw00Ec8JEBHCJZLm88crmxmpWvfwXTv16BNAXdM Sbm76f6FpedugSX+tfdliEF7vOQBM1DrIH4AF4UZQ9mBySQ2ZuhQxXkPBwAywg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQhpn5V4Bz1QB for ; Wed, 27 May 2026 21:00:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23698 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 21:00:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: caef3c50ac06 - main - ctld: Refactor ioctl port handling 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: caef3c50ac067ca751ba4950f310821a521ebf57 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 21:00:33 +0000 Message-Id: <6a175b71.23698.7ab2b30a@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=caef3c50ac067ca751ba4950f310821a521ebf57 commit caef3c50ac067ca751ba4950f310821a521ebf57 Author: John Baldwin AuthorDate: 2026-05-27 20:57:23 +0000 Commit: John Baldwin CommitDate: 2026-05-27 20:57:23 +0000 ctld: Refactor ioctl port handling - Normalize ioctl port names when the port name is first added to the configuration. This can catch potential duplicate port names sooner and helps with other parts of this change. - When recognizing existing ioctl ports, always expand the name to include the physical and virtual port numbers. This permits binding ioctl/0/0 or ioctl/1/0 to a target, for example. - When adding physical ports to a target, first check for an existing kernel port to reuse. This handles both ioctl and non-ioctl ports and removes the need for the conf::add_port method for ioctl ports to check in kports. - If an existing kport isn't found when adding physical ports, check to see if the port name is an ioctl port. If so, call conf::add_port to add an ioctl port. This add_port method overload is now simpler as it always creates a new port. NB: The kernel_port class handles CTL ports that already existed before ctld started including existing ioctl ports, whereas the ioctl_port class handles ioctl ports that are created and completely managed by ctld. This was true before this change but is perhaps more obvious after this change. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D57092 --- usr.sbin/ctld/ctld.cc | 80 ++++++++++++++++++++++++++++++------------------- usr.sbin/ctld/ctld.hh | 2 +- usr.sbin/ctld/kernel.cc | 5 +++- 3 files changed, 54 insertions(+), 33 deletions(-) diff --git a/usr.sbin/ctld/ctld.cc b/usr.sbin/ctld/ctld.cc index 9bdf15976911..8b99bde14911 100644 --- a/usr.sbin/ctld/ctld.cc +++ b/usr.sbin/ctld/ctld.cc @@ -1180,16 +1180,8 @@ conf::add_port(struct target *target, struct pport *pp) } bool -conf::add_port(struct kports &kports, struct target *target, int pp, int vp) +conf::add_port(struct target *target, const std::string &pname, int pp, int vp) { - struct pport *pport; - - std::string pname = freebsd::stringf("ioctl/%d/%d", pp, vp); - - pport = kports.find_port(pname); - if (pport != NULL) - return (add_port(target, pport)); - std::string name = pname + "-" + target->name(); const auto &pair = conf_ports.try_emplace(name, std::make_unique(target, pp, vp)); @@ -1387,6 +1379,19 @@ target::set_auth_type(const char *type) bool target::add_physical_port(std::string_view pport) { + /* Normalize ioctl port names. */ + std::string pname; + if (pport.compare(0, strlen("ioctl/"), "ioctl/") == 0) { + int ret, pp, vp; + + pname = std::string(pport); + ret = sscanf(pname.c_str(), "ioctl/%d/%d", &pp, &vp); + if (ret == 2) { + pname = freebsd::stringf("ioctl/%d/%d", pp, vp); + pport = pname; + } + } + for (const auto &s : t_pports) { if (s == pport) { log_warnx("duplicate physical port \"%s\" for target " @@ -2643,35 +2648,48 @@ conf::add_pports(struct kports &kports) struct target *targ = kv.second.get(); for (const auto &pport : targ->pports()) { - ret = sscanf(pport.c_str(), "ioctl/%d/%d", &i_pp, - &i_vp); - if (ret > 0) { - if (!add_port(kports, targ, i_pp, i_vp)) { - log_warnx("can't create new ioctl port " - "for %s", targ->label()); + /* + * If this port is already present in the + * kernel, reuse the existing port. + */ + pp = kports.find_port(pport); + if (pp != nullptr) { + if (pp->linked()) { + log_warnx("can't link port \"%s\" to " + "%s, port already linked to some " + "target", pport.c_str(), + targ->label()); return (false); } + if (!add_port(targ, pp)) { + log_warnx( + "can't link port \"%s\" to %s", + pport.c_str(), targ->label()); + return (false); + } continue; } - pp = kports.find_port(pport); - if (pp == NULL) { - log_warnx("unknown port \"%s\" for %s", - pport.c_str(), targ->label()); - return (false); - } - if (pp->linked()) { - log_warnx("can't link port \"%s\" to %s, " - "port already linked to some target", - pport.c_str(), targ->label()); - return (false); - } - if (!add_port(targ, pp)) { - log_warnx("can't link port \"%s\" to %s", - pport.c_str(), targ->label()); - return (false); + /* + * If this port is an ioctl port, create a new + * port. + */ + ret = sscanf(pport.c_str(), "ioctl/%d/%d", &i_pp, + &i_vp); + if (ret == 2) { + if (!add_port(targ, pport, i_pp, i_vp)) { + log_warnx("can't create new port %s " + "for %s", pport.c_str(), + targ->label()); + return (false); + } + continue; } + + log_warnx("unknown port \"%s\" for %s", + pport.c_str(), targ->label()); + return (false); } } return (true); diff --git a/usr.sbin/ctld/ctld.hh b/usr.sbin/ctld/ctld.hh index 7ae033804157..8d63de06dd80 100644 --- a/usr.sbin/ctld/ctld.hh +++ b/usr.sbin/ctld/ctld.hh @@ -487,7 +487,7 @@ struct conf { bool add_port(struct target *target, struct portal_group *pg, uint32_t ctl_port); bool add_port(struct target *target, struct pport *pp); - bool add_port(struct kports &kports, struct target *target, int pp, + bool add_port(struct target *target, const std::string &pname, int pp, int vp); bool add_pports(struct kports &kports); diff --git a/usr.sbin/ctld/kernel.cc b/usr.sbin/ctld/kernel.cc index 59a339e1c96b..8c5c447f3e80 100644 --- a/usr.sbin/ctld/kernel.cc +++ b/usr.sbin/ctld/kernel.cc @@ -549,7 +549,10 @@ conf_new_from_kernel(struct kports &kports) continue; std::string name = port.port_name; - if (port.pp != 0 || port.vp != 0) { + if (port.port_frontend == "ioctl") + name += "/" + std::to_string(port.pp) + "/" + + std::to_string(port.vp); + else if (port.pp != 0 || port.vp != 0) { name += "/" + std::to_string(port.pp); if (port.vp != 0) name += "/" + std::to_string(port.vp); From nobody Wed May 27 21:12:53 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 4gQj515xVsz6fh1t for ; Wed, 27 May 2026 21:12:53 +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 4gQj515Fy9z3SJ7 for ; Wed, 27 May 2026 21:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779916373; 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=L+nqS+KqaHrmztOrxSqjqngmFIqME2czJ+Z9O/kMU0I=; b=AJztgp0wGD6QiNuDVciOSQH9lQ3DFVx5YuhKzbRssmzawP/kQP1oSdF/Ps/c7ImBord5EE EyJeA73OB16jeQMOKbfTYGnN8qok1a3oYeILo9/9kuEmWgGPBpX9eN++9a/CXIH/D3+cqB Ff63DeQKZLx5HSdUOHsg3lSTG5SArSLu+8FqDO/R5tAJ0eC03754Srzst4a0LPVdEMN502 LP9ED/z0YM99/p6NiNeC65eo4Km0WW9y6OlzONMnpbAg1cFozuKA+6CjQU2PvKlQ2zifLp quCXcNAkp8PYhTXkL8XqbTxwS67laJrdj+AnYsKDFedtfoy6MoHQGPCcO9yEKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779916373; a=rsa-sha256; cv=none; b=YzemT4wdJdzGnrlzdGVHuAH3jEF+N9lbwJ8YH8alQSo/qgLhfQgWvhajcg1j30yp6sv5KV K7UCg7rTORGLmgnf9yoj27YehCIEm/FYRVw/3aE3OMwdiDZm+eQ2LnbRw3JA7w3iXHaz4y k6J4pcfkeWykDSa0j02dpOB6hspvJ0claN6pxoUzzCaJ7HQPryIfz+vmM/yqhFA69FDguk lh5KE/J+qaiug9Kj23LYRV2vm8nJE2142Rpfu9hgl/XcY3qTyq5cA2Fmb7eafHLvyLLusc s+OQqqLOFoVBHmZEC/+Vjte8+NCBCwCeA1GmS9ISz48So7nkN6C021hRzmWb4w== 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=1779916373; 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=L+nqS+KqaHrmztOrxSqjqngmFIqME2czJ+Z9O/kMU0I=; b=xlE/sG2GZoKDBcnRB+6dC/ib3j6K9Us4FEon5EoZCISfapUd02TpD9LnUVO8/yZkwL9ecn C7SKSNtKF86k1k3APDG7ZNFbX/A9vgh122k36ZLn2TuDPp4zlUr1i74XdjFl+pKNJWm8ku 0JM2+hDMrR0idSUnp7Ah8LZJTBAVc3Ujq8hLyohxdDPisgt8tHh81hH8oqWjmKSK7lm2dX +pcrwuVaMPrp6da+WR4HONGFvzeO0omO13V/faClBxKhnTZzuza3l+o4k+reVNdwPulGXq yBcOHKZ7I11Kl1qRjf0d/MFsXdqKJw68v0724uJcbwSZh7Qeh9RXScObf3qApQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQj514mvQz1hD for ; Wed, 27 May 2026 21:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 24294 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 21:12:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 0beb17289849 - main - ucode: Fix validation on Intel platforms 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0beb172898499fff51eed4df3d9284cd1094afbb Auto-Submitted: auto-generated Date: Wed, 27 May 2026 21:12:53 +0000 Message-Id: <6a175e55.24294.94fa17d@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0beb172898499fff51eed4df3d9284cd1094afbb commit 0beb172898499fff51eed4df3d9284cd1094afbb Author: Mark Johnston AuthorDate: 2026-05-27 20:18:05 +0000 Commit: Mark Johnston CommitDate: 2026-05-27 21:12:35 +0000 ucode: Fix validation on Intel platforms The check for the extended signature table was backwards, so we always ignored it. We should verify that the extended signature table fits within the total image size. Reviewed by: jrm, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D57209 --- sys/x86/x86/ucode.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/sys/x86/x86/ucode.c b/sys/x86/x86/ucode.c index 72133de211f8..2e996331dd2e 100644 --- a/sys/x86/x86/ucode.c +++ b/sys/x86/x86/ucode.c @@ -204,7 +204,6 @@ ucode_intel_match(const uint8_t *data, size_t *len) uint64_t platformid; size_t resid; uint32_t data_size, flags, regs[4], sig, total_size; - int i; do_cpuid(1, regs); sig = regs[0]; @@ -226,19 +225,35 @@ ucode_intel_match(const uint8_t *data, size_t *len) if (total_size == 0) total_size = UCODE_INTEL_DEFAULT_DATA_SIZE + sizeof(struct ucode_intel_header); - if (data_size > total_size + sizeof(struct ucode_intel_header)) + + if (total_size > data_size + sizeof(struct ucode_intel_header)) table = (const struct ucode_intel_extsig_table *) ((const uint8_t *)(hdr + 1) + data_size); else table = NULL; - if (hdr->processor_signature == sig) { - if ((hdr->processor_flags & flags) != 0) { - *len = data_size; - return (hdr + 1); + if (hdr->processor_signature == sig && + (hdr->processor_flags & flags) != 0) { + *len = data_size; + return (hdr + 1); + } + if (table != NULL) { + size_t extsize; + + extsize = total_size - + (data_size + sizeof(struct ucode_intel_header)); + if (extsize < sizeof(struct ucode_intel_extsig_table)) { + ucode_error = VERIFICATION_FAILED; + break; } - } else if (table != NULL) { - for (i = 0; i < table->signature_count; i++) { + extsize -= sizeof(struct ucode_intel_extsig_table); + for (uint32_t i = 0; i < table->signature_count; i++) { + if (extsize < sizeof(struct ucode_intel_extsig)) { + ucode_error = VERIFICATION_FAILED; + goto out; + } + extsize -= sizeof(struct ucode_intel_extsig); + entry = &table->entries[i]; if (entry->processor_signature == sig && (entry->processor_flags & flags) != 0) { @@ -248,6 +263,7 @@ ucode_intel_match(const uint8_t *data, size_t *len) } } } +out: return (NULL); } From nobody Wed May 27 21:12:54 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 4gQj533f0wz6fh1x for ; Wed, 27 May 2026 21:12:55 +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 4gQj5307zNz3Rst for ; Wed, 27 May 2026 21:12:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779916375; 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=bEq9KidXlS0K8VboRlfi+t5y1fcgIARPSKD40W2FX8c=; b=dvMnAEaEelR3Xwqp7uvhcLWQh13zZai7N5Tx8wjwSDktg6C59eCmSlrtTYQDQRfuTNSnqa yzhgBx+JxzrKeB1qdNZc1ND23NC/17/xB4zQSgOBosFfOJhyyn7ciA5D970+tvEM9La/gD IewBaR8+fsTFaD3Irwl/PA8INA7DiOEw7ZRrg1NVcVNtkCH9cG9W3D2Uo86ZnNIPmF2fnd mETB1YCaCqQWk+Kwz79LfRGjY6ugzTkZjQOj+YOPbzZ9NlBDxqYei02LZbq2ZK+xZ5hyuw lqde6NrFj4GAAcpzVHcP1uuWcL2K1eXvoqwxM9BbIEsDSsmm8EEWd0ClB3MRYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779916375; a=rsa-sha256; cv=none; b=saDkiIRvb1oKD7T09Pn2jrZz5I4wCNhzJI7QCoEvZwEA+k2qTg6q0e2wQcl0QQ2RvbXPAh rUn56zopKc9InA+7+8cpIulWYLaIB8YNSBX8bTt0mbRDtoriiCfBuN/n7VRS7R1icwJCa+ Izyt7TJ15yBxAo2uZPaFHlCPLp/AlqCxlVCIVek0Pz8qAjdS8p7oC8OrkTjBjL6y38t9ZB PIuAeRef6OPLbyhTK5A5vocYdRie5CRBqw2LSE22SX2l5MFvZMf/6YQn4sV0pwWsN6l5zB Fs6Z8kZn0lQVRdnzgVCAEPPNUeJpphnTuLojHYNsjHn72LA5bmXJISpv33vVyA== 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=1779916375; 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=bEq9KidXlS0K8VboRlfi+t5y1fcgIARPSKD40W2FX8c=; b=W6WTHxwZw/MwpA62Ml5onC8t1DeUNhb04KEqstFK0L9pdazRa2+m9GN0ZbKH8q1rfeqAzV FwA7n7wdu/t10eQb/Gm317Y4xBj6Gnezr2xStmiB0ASAZIKRUfhgnIMDdxk4Ld49Vu5DaW 1ueIyFnrLyjEmAljQHLnulP2uM1Itly7tIVH6cr6DK8qweNCJknO7blXIG9YATgHbi6B1n jf/kf8mcY2WPwU7RTQfb3Tlaiv/M2k749VG+7xG5dkgEoDiv3yPgGLxkBzRk3agw4ISYOG uRPZaepa8ZbFdL5wb3EMcBNz8ZzCP+xdZaAfR+JjShpVFkWrm+eoABW1W2lzCg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQj525YCWz255 for ; Wed, 27 May 2026 21:12:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 245a9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 21:12:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 96256587b06c - main - ucode: ucode_error can be defined with static 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 96256587b06cfcdbeb1789145f5e427831b3d732 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 21:12:54 +0000 Message-Id: <6a175e56.245a9.3038e1cf@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=96256587b06cfcdbeb1789145f5e427831b3d732 commit 96256587b06cfcdbeb1789145f5e427831b3d732 Author: Mark Johnston AuthorDate: 2026-05-27 20:41:15 +0000 Commit: Mark Johnston CommitDate: 2026-05-27 21:12:35 +0000 ucode: ucode_error can be defined with static MFC after: 1 week --- sys/x86/x86/ucode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/ucode.c b/sys/x86/x86/ucode.c index 2e996331dd2e..3d7008eb30f2 100644 --- a/sys/x86/x86/ucode.c +++ b/sys/x86/x86/ucode.c @@ -80,7 +80,7 @@ static const void *ucode_data; static struct ucode_ops *ucode_loader; /* Variables used for reporting success or failure. */ -enum { +static enum { NO_ERROR, NO_MATCH, VERIFICATION_FAILED, From nobody Wed May 27 22:59:06 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 4gQlRb0CfBz6fqZm for ; Wed, 27 May 2026 22:59:07 +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 4gQlRZ59nTz3kkM for ; Wed, 27 May 2026 22:59:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779922746; 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=aZtMGMtQUtzx9eK0Zl5otR11CqzVfLVbBpXBQObh5bU=; b=nY2Zt7QaBemQi1d0NIJK38QCvcJA0Kn3sLMbw3jat9LbFoLZiHrmxHdBD7yLcq3jUkCsDk 36OTYnkI+e0eLxs678HQeWsCl7ODGayQRmieWJ2L6SFt6K0ibidRtoM86+7nQtLVmbjjWc 2spBwWHGANN0C+LYhZb+y3UhAmOQrrS8CNAp93/qKIIEaE2SNi+FP55pdECRqBGzc9brHs HIB++HEpvxDQz3IL+CamdO8zdt+8EzhCnSpoaxqlB8gXxsdSeL+92s1KDbQjQdzoB8unN+ iOEd0/nOky4wtUekfx5IiM3fzUmIHfCjxRGQgtLK02cz0bAlQZSYk/BCX7l1HA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779922746; a=rsa-sha256; cv=none; b=K1rI92ATPE+JTPTPRwoAkhQIp1UxjA27VgPgvUsFdpLVdcKMVKINWI1VATXz+M9nabjp6C jPS7Mu+dksnwiJX8IZFfoQ7qpZF3wyx5sfqcQpaFwde8n23OWM3nD5EsV4Rr+E+B9J+ORO vjrKxQD3tsLfFv+ZzRnGmorxVQ4WBFeq8TrwFO10jlK0ft4LFRwwPvNmuVjiDjkeqAGZg5 Ac4SmPkdqpLSG1D70Q4bEOa01uJizPE5T0ALKEOKJq1/3A7BdbHpL1ifpyBvko6rbtIhs0 QImED3Ntlc3HqD3Dpmv9gCvrM4ssETWrSxCHNLSVOw6qzNzBOSrLZlgHingdIw== 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=1779922746; 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=aZtMGMtQUtzx9eK0Zl5otR11CqzVfLVbBpXBQObh5bU=; b=LohdspWhENtFYnpdKSzstaPG2QmaotW6AQJKTzOxboHjWkVSDUPlxruH6j10c9O/YSfPO6 P2FAw65JyhW6agdKAGoIOl1wMURPSvpTUeCLbzC927su4XXtx3TtPQSNve6L4CmGNJY9qH Ru5CzFXYoE56C5o0ZggAariVSyIK5z/TbY+BKDeobnubAerI54C6MWDcxlaY58zyP8xrqx pJly9NQpzmWyYmjwdKFrC4QsJ305qA1K1lD7P741kr6SEvKsu5cZ3yuSlP5SKEHe/YLJQc JB8HmCW5cXJI9IXp5Pg6rXErVg2oYa4ekA7YZNtO571gvz5OXXkTSKSL8DyeZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQlRZ4WP4z4Qj for ; Wed, 27 May 2026 22:59:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 370a1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 22:59:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aleksandr Rybalko Subject: git: 5a8e0e03ae86 - main - install: Bump compare size limit (128MB) to support large binaries 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: ray X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a8e0e03ae86b449f29626b4f9db25d17c89b273 Auto-Submitted: auto-generated Date: Wed, 27 May 2026 22:59:06 +0000 Message-Id: <6a17773a.370a1.46119b52@gitrepo.freebsd.org> The branch main has been updated by ray: URL: https://cgit.FreeBSD.org/src/commit/?id=5a8e0e03ae86b449f29626b4f9db25d17c89b273 commit 5a8e0e03ae86b449f29626b4f9db25d17c89b273 Author: Aleksandr Rybalko AuthorDate: 2026-05-27 12:07:47 +0000 Commit: Aleksandr Rybalko CommitDate: 2026-05-27 22:55:57 +0000 install: Bump compare size limit (128MB) to support large binaries Preserve metadata and prevent redundant disk writes during builds with the install's -C (compare) flag. The previous historical comparison limit of 16MB is insufficient for modern toolchains, frequently choked or bypassed by a large base components like LLVM/Clang, kernels, Rust apps, and large runtime libraries. By leaving matching files alone, install keeps their modification timestamps intact. make(1) safely ignores those files on subsequent runs. Base examples: 15.0 amd64 GENERIC kernel - 28MB, clang - 105MB, lldb - 97MB, etc. Reviewed by: glebius Approved by: glebius (mentor) Obtained from: Fudo Security MFC after: 2 weeks Sponsored by: Fudo Security Differential Revision: https://reviews.freebsd.org/D57271 --- usr.bin/xinstall/xinstall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 611274d0af68..d389bdbe3737 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -88,7 +88,7 @@ #define HAVE_STRUCT_STAT_ST_FLAGS 0 #endif -#define MAX_CMP_SIZE (16 * 1024 * 1024) +#define MAX_CMP_SIZE (128 * 1024 * 1024) #define LN_ABSOLUTE 0x01 #define LN_RELATIVE 0x02 From nobody Wed May 27 22:59:05 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 4gQlRY6mfBz6fqjf for ; Wed, 27 May 2026 22:59:05 +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 4gQlRY4rFdz3kkL for ; Wed, 27 May 2026 22:59:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779922745; 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=mAEwckJTQOGE4Zk5oBN5gzIVgWY7B9L7wAvtu3VDXcQ=; b=ZYo/QNJKHGXHqI1Yfyos3TEP5o4F9O25NI9cR6AgPDmOr7cjIw8E9kieB3wxaHdS0sfG1C Q17+dRTmSLousdTbQ4JxWPwooilzSlwiSa7rVfTNBRLx0WDCrOiwhueKa4AaHZ7Hlgke9x uPZ9tRtBApPivGDFf0LLbv/Be1Ks3qyCnfk7xGOMQbJwkFONJmf+bA34W4eQzx0JZNag97 Ns3kHeGBWvwF8istr0nNQ8fcwae8WPKFQNXYQdvd7mnvzCCXc7eKtN0bSweS7ezkV0OY8O OXX89aKp6StXjXHSuzOge3MH2acbWtwMt+zPJCYnVr5NefyB6Z+xY1AYiAy4Rw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779922745; a=rsa-sha256; cv=none; b=SVQxpNOmfkAGsEoZI28Vqq+dKF+hR5VFhKXFdncQinMTWVUxezhyn1fsfIh3qXmt3BHZod TdTQ38scY5ZPolj1+g/MM+8z9hGc2aVQ7JzLVrQCK5nSgJBiU6P9BO5RhNoqA0cfbKlIRW ygJfkNgD/l/imh+fcVM6kYMr78SGNTUf/Pk61EL5QilhaaasqoAxI5q72Abic4QT+OSBSa vBgLdhyzMcnjXio8g3cyILt2EXTqKwBlyAoejkxX0uhzywa0iG/XypFxLm9gQhz0OzDRHv hqIGkKZWPnpZ8L7ZAF4M70ECHYmcGN52pUSAIzOHa53qQuPZz2AdHd3+7b3PMQ== 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=1779922745; 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=mAEwckJTQOGE4Zk5oBN5gzIVgWY7B9L7wAvtu3VDXcQ=; b=oGA3UOMBV85PO+CgOJV6OSiRJPbxcGhdUPU7l11KnyKFikznGjAaGWXsWPhc3P680Le2OD Go1cCGQkk/d3hpVT9UaY+lxhuC/QY+DNXuMZYwWR1dmlxbAkZbdP0pyt9Kyr4dbpkmXJLs Tn6ikOdyXEeqFEBt+yiFjU2+vtoixE95AiJv94dMR41dTZ9D4znQ7aqVycfo81oG7K9G50 Q67LuuCFGvOwOy1O2g2HrT33SxFcgwOAqzXDinhvLoZrLKfd5iMR6mFDtScSeN1rdkKSO1 tE4SxU6Ic9K+InCWBq2hEUe0WejRYK098uyh4vNi6kiaP2l75LeBxxybV1wicQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQlRY3grNz4fV for ; Wed, 27 May 2026 22:59:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 341ea by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 27 May 2026 22:59:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aleksandr Rybalko Subject: git: 97cad013a50a - main - install: add -z option 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: ray X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97cad013a50a4012328e11424ed2350c1efc036c Auto-Submitted: auto-generated Date: Wed, 27 May 2026 22:59:05 +0000 Message-Id: <6a177739.341ea.6d7e7300@gitrepo.freebsd.org> The branch main has been updated by ray: URL: https://cgit.FreeBSD.org/src/commit/?id=97cad013a50a4012328e11424ed2350c1efc036c commit 97cad013a50a4012328e11424ed2350c1efc036c Author: Aleksandr Rybalko AuthorDate: 2026-05-25 07:53:20 +0000 Commit: Aleksandr Rybalko CommitDate: 2026-05-27 22:55:57 +0000 install: add -z option Introduces the -z flag, enabling users to set a custom file size limit for pre-installation change checks and avoiding future hard-coded limit modifications. Reviewed by: glebius Approved by: glebius (mentor) Obtained from: Fudo Security MFC after: 2 weeks Sponsored by: Fudo Security Differential Revision: https://reviews.freebsd.org/D57230 --- usr.bin/xinstall/Makefile | 2 +- usr.bin/xinstall/install.1 | 13 +++++++++++-- usr.bin/xinstall/xinstall.c | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/usr.bin/xinstall/Makefile b/usr.bin/xinstall/Makefile index fd95b97160fe..c05a50420c82 100644 --- a/usr.bin/xinstall/Makefile +++ b/usr.bin/xinstall/Makefile @@ -11,7 +11,7 @@ MAN= install.1 CFLAGS+= -I${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/lib/libnetbsd -LIBADD= md +LIBADD= md util CFLAGS+= -DWITH_MD5 -DWITH_RIPEMD160 .ifdef BOOTSTRAPPING diff --git a/usr.bin/xinstall/install.1 b/usr.bin/xinstall/install.1 index c923321f20fe..169bf4ef11fe 100644 --- a/usr.bin/xinstall/install.1 +++ b/usr.bin/xinstall/install.1 @@ -33,7 +33,7 @@ .Nd install binaries .Sh SYNOPSIS .Nm -.Op Fl bCcpSsUv +.Op Fl bCcpSsUvz .Op Fl B Ar suffix .Op Fl D Ar destdir .Op Fl f Ar flags @@ -45,9 +45,10 @@ .Op Fl N Ar dbdir .Op Fl o Ar owner .Op Fl T Ar tags +.Op Fl z Ar size .Ar file1 file2 .Nm -.Op Fl bCcpSsUv +.Op Fl bCcpSsUvz .Op Fl B Ar suffix .Op Fl D Ar destdir .Op Fl f Ar flags @@ -59,6 +60,7 @@ .Op Fl N Ar dbdir .Op Fl o Ar owner .Op Fl T Ar tags +.Op Fl z Ar size .Ar file1 ... fileN directory .Nm .Fl d @@ -264,6 +266,13 @@ Cause .Nm to be verbose, showing files as they are installed or backed up. +.It Fl z Ar maxsize +Limit the comparison feature of +.Fl C +to files no larger than +.Ar maxsize . +Files exceeding this limit bypass the comparison step and are directly overwritten. +The default maximum size is 128MiB. .El .Pp By default, diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 1aed8c1b24e4..611274d0af68 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include "mtree.h" @@ -137,6 +138,7 @@ static FILE *metafp; static const char *group, *owner; static const char *suffix = BACKUP_SUFFIX; static char *destdir, *digest, *fflags, *metafile, *tags; +static size_t max_compare_size = MAX_CMP_SIZE; static int compare(int, const char *, size_t, int, const char *, size_t, char **); @@ -168,12 +170,13 @@ main(int argc, char *argv[]) u_int iflags; char *p; const char *to_name; + uint64_t num; fset = 0; iflags = 0; set = NULL; group = owner = NULL; - while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uv")) != + while ((ch = getopt(argc, argv, "B:bCcD:df:g:h:l:M:m:N:o:pSsT:Uvz:")) != -1) switch((char)ch) { case 'B': @@ -270,6 +273,13 @@ main(int argc, char *argv[]) case 'v': verbose = 1; break; + case 'z': + if (expand_number(optarg, &num) != 0 || num == 0) { + errx(EX_USAGE, "invalid max compare filesize:" + " %s", optarg); + } + max_compare_size = num; + break; case '?': default: usage(); @@ -1092,7 +1102,7 @@ compare(int from_fd, const char *from_name __unused, size_t from_len, do_digest = (digesttype != DIGEST_NONE && dresp != NULL && *dresp == NULL); - if (from_len <= MAX_CMP_SIZE) { + if (from_len <= max_compare_size) { static char *buf, *buf1, *buf2; static size_t bufsize; int n1, n2; @@ -1484,11 +1494,11 @@ usage(void) { (void)fprintf(stderr, "usage: install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n" -" [-M log] [-D dest] [-h hash] [-T tags]\n" +" [-M log] [-D dest] [-h hash] [-T tags] [-z maxcmpsize]\n" " [-B suffix] [-l linkflags] [-N dbdir]\n" " file1 file2\n" " install [-bCcpSsUv] [-f flags] [-g group] [-m mode] [-o owner]\n" -" [-M log] [-D dest] [-h hash] [-T tags]\n" +" [-M log] [-D dest] [-h hash] [-T tags] [-z maxcmpsize]\n" " [-B suffix] [-l linkflags] [-N dbdir]\n" " file1 ... fileN directory\n" " install -dU [-vU] [-g group] [-m mode] [-N dbdir] [-o owner]\n" From nobody Thu May 28 05:05:35 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 4gQvZR2gS0z6f3SR for ; Thu, 28 May 2026 05:05:35 +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 4gQvZR1qCcz3P7v for ; Thu, 28 May 2026 05:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779944735; 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=DIXyQOwfgqYHls6Z1UG4vin1avFr9bUSBdYO72qEYSg=; b=BJHga3/CjhhFp2CfW69FzAp38cip835O+77GcyBL/i6vxg61P2jBKlrsPPleU8V13fv6ux tEkE2Oqdb/ZEO8HyfL1FJYMyjpiLSRyrXh850c9JPLHsYULEPiyC6VO1jNFSdAqDk0iX+6 1cC5VouwcptjqdcdstdG0YLvhfvZGV4h9OsrXDf2GB6cuJylU3PQwhoQfiHWNQCZhh9TC+ Fkg8CkdSYkrmhi4Xn435NQKDKQwBk9cFu8F+PW/JhdG0XAG5Dnl9z7CT4YjSBV2SENdy/n tadKDhKngfXPH0qrQR5x7zydpIfgPO+5w2vBs+krfa86gcseyzYxO5lZ7pkpbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779944735; a=rsa-sha256; cv=none; b=svQOEtNQeeOZLhhmJ6iZDt1SIBT2/4qsZgNg9R/tD0whOEzu/gIkHDbAdwgHg41Y77NYTh Qq5qtw21Pz4aU5Sta1dXEMyogU0lLCf9hacIX+EWxLoj0PSbeD8ODF1CJpDblnlWvKtEiX cJ77FHm+hjAuqYoRawfDrMpWV6yUNlMfySZIoUI56vFFqslXSuVVOf/5OdM2JwagrI6ggo yDX8HBsNW+cKCFPfOajHsrEq3mwCbwalQNhfu+qfC3XHJejnvvvs21B7l0Cuj8gQpDqgTM d7S2cOnHjuEPJ8XgsY2RwgwKB+F1AF6DsheuGZ2TLiqfvI8dEA1ShD+YmbhntQ== 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=1779944735; 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=DIXyQOwfgqYHls6Z1UG4vin1avFr9bUSBdYO72qEYSg=; b=ZAy8KuMIjDgEer/3rYNQaK+EO7uJxBQwP+7wOz6JD8Phw9Vya/JR/1cwWWPfjPusWQm1BR ujcghJHLUIO3nXEI4SXbTBHkGbBlNupho02BO55LdsRX4/RYFhNXE6a4oonJQof1FIYL0L 3+Lk4BwZIcwlExvlgX4G7fBAyVa+eAZUaln1kldpd5pjsBbylBQnKa3Ccs6EjOgpjiUuCC FwO6HYRrRKvAiWBW0ZWTLx8Ux1nh+UAe7nheWV8QDPykNJRt3o1YckspDKpaIHI8fwQGyJ IwkjVIF8PuP86wQ8FcnG+fmxlqN0qdjQcH97pYq7V/43wGewYufVCDs5ym1Xhw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQvZR0c1BzXmn for ; Thu, 28 May 2026 05:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e417 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 05:05:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: ca91300c0749 - main - inpcb: a pcb may travel only from the wild hash to exact, not vice versa 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca91300c074923cecfe197de16a3318b06876134 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 05:05:35 +0000 Message-Id: <6a17cd1f.3e417.5bc42168@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=ca91300c074923cecfe197de16a3318b06876134 commit ca91300c074923cecfe197de16a3318b06876134 Author: Gleb Smirnoff AuthorDate: 2026-05-28 04:46:27 +0000 Commit: Gleb Smirnoff CommitDate: 2026-05-28 04:46:27 +0000 inpcb: a pcb may travel only from the wild hash to exact, not vice versa The only possible way to exercise in_pcbrehash() is to bind(2) and then connect(2). The second branch was a dead code since fdb987bebddf. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57241 --- sys/netinet/in_pcb.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 66d2c610139f..84b175b42eec 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2805,7 +2805,6 @@ in_pcbrehash(struct inpcb *inp) struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; struct inpcbhead *head; uint32_t hash; - bool connected; INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(pcbinfo); @@ -2815,34 +2814,24 @@ in_pcbrehash(struct inpcb *inp) #ifdef INET6 if (inp->inp_vflag & INP_IPV6) { + MPASS(!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)); hash = INP6_PCBHASH(&inp->in6p_faddr, inp->inp_lport, inp->inp_fport, pcbinfo->ipi_hashmask); - connected = !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr); } else #endif { + MPASS(!in_nullhost(inp->inp_faddr)); hash = INP_PCBHASH(&inp->inp_faddr, inp->inp_lport, inp->inp_fport, pcbinfo->ipi_hashmask); - connected = !in_nullhost(inp->inp_faddr); } /* See the comment in in_pcbinshash(). */ - if (connected && (inp->inp_flags & INP_INLBGROUP) != 0) + if ((inp->inp_flags & INP_INLBGROUP) != 0) in_pcbremlbgrouphash(inp); - /* - * When rehashing, the caller must ensure that either the new or the old - * foreign address was unspecified. - */ - if (connected) { - CK_LIST_REMOVE(inp, inp_hash_wild); - head = &pcbinfo->ipi_hash_exact[hash]; - CK_LIST_INSERT_HEAD(head, inp, inp_hash_exact); - } else { - CK_LIST_REMOVE(inp, inp_hash_exact); - head = &pcbinfo->ipi_hash_wild[hash]; - CK_LIST_INSERT_HEAD(head, inp, inp_hash_wild); - } + CK_LIST_REMOVE(inp, inp_hash_wild); + head = &pcbinfo->ipi_hash_exact[hash]; + CK_LIST_INSERT_HEAD(head, inp, inp_hash_exact); } void From nobody Thu May 28 05:05:36 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 4gQvZS32Cnz6f3xq for ; Thu, 28 May 2026 05:05: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQvZS1Yprz3P5Y for ; Thu, 28 May 2026 05:05:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779944736; 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=0J9xnRtRYCmjjRuWJhafoyeXRF1o8f/5xehrmj78NoY=; b=wa+jWVUdvtcwRWpGoA8m+RE4Sznn/F9fwEZUFLqu9Qiwqwq5gKLswC9mYHxEwVP/a93QMt w+DNzE4rJrJWoFdJDjFG+mHkvzlb5NyVST9cv30kbddARbM6UDKYTzs3lSSN56xsPmP++T dLdubSD/YAPOx/o1fI9vQd5k03wtOf38A62H1Rih3fJr9zGjpV3m8Kp8D115GfcpBgEOwb xWy8s9MYMBzAKmR/jgycsRTUtwEL94p7ULl8qylut9QmqjwQjRjz05i+sPE/iNtTagjz+0 8+AurTtXG5lxYQFmDSSQrm77gJkD4d902BfZk16csgjsSk+aZCySQKegP30QNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779944736; a=rsa-sha256; cv=none; b=oEAC9oqPJpsCyXXuG/S4l3q+49+utDi9GdFnC7HwhQ+i3jtxeT5EmZtFMHVt9b7hpiUMqL ZdZMkr5dS3S4GnoyHmk7AfypAWICcug+YufkYkzhztqn0QC2u6Dj98yc0Fm7BE3mLuF+Hi /J5uzYD+5ZeGnjF1ovkPHiwn9CkzuuXI4R0yfgLc5Zvh0X+mYuWgo41WWd+IseHgzqRBGZ ZfnHlYNzm/yncztc2nk2GoxV0sCadn/cTzaoA0aA999lKF+86hjh8crlPG8AR5+CFKFson soTa78YMaWZznjLWg07I5s11L4Zsgwit2IxVZguo1AM6y5tXw9ZJaIHLWTTwAQ== 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=1779944736; 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=0J9xnRtRYCmjjRuWJhafoyeXRF1o8f/5xehrmj78NoY=; b=QSRmH7oJ+/4pIaIB1WAeIqDmAGMf4cgNdsSIXOsQTNjBpBKGz3DwVHuXPmPhBCJr7qtU8o ATzRwNnw9fdEW30KhD7Vz9Sk0EDUN6GALV4LRvAxiDH3FwmTzm3dsGk9oE8mR8EL3Zpl+n FFIeBrKrLpVHZ8is1CDmRxZ3MtIFzUgp+yFm1QRCkFju5NH+aGllYUCVy70nOiBMSIyRfW IdERm7OQRytSxEt+38SRjyfIM3R/AdI+QoPSd2IRIoVNK93OSkbEy1Yi9MEwSsfeABYLRm pe9mPtPbjmBMY9yfIrR3GWES4JmEozFYKyDtv/0PhKflDhtljoiiQFb6EZHiIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gQvZS1566zXmp for ; Thu, 28 May 2026 05:05:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3da74 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 05:05:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: d62e8c5c6fdc - main - inpcb: update inpcb multipath routing information only on success 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d62e8c5c6fdc9e3b006bf126e1fb863e8bdd6c51 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 05:05:36 +0000 Message-Id: <6a17cd20.3da74.17ec6fb1@gitrepo.freebsd.org> The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d62e8c5c6fdc9e3b006bf126e1fb863e8bdd6c51 commit d62e8c5c6fdc9e3b006bf126e1fb863e8bdd6c51 Author: Gleb Smirnoff AuthorDate: 2026-05-26 16:02:06 +0000 Commit: Gleb Smirnoff CommitDate: 2026-05-28 04:46:38 +0000 inpcb: update inpcb multipath routing information only on success This is very similar to IPv4 change 24e5c2ee2a18. Don't modify inpcb until we are sure connect(2) will be successful. Fixes: 0c325f53f16731f608919a4489f96fbbe28d2344 --- sys/netinet6/in6_pcb.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 8132899bb0d9..0cf6be2f9b33 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -465,15 +465,6 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred, bzero(&laddr6, sizeof(laddr6)); laddr6.sin6_family = AF_INET6; - if (V_fib_hash_outbound) { - uint32_t hash_type, hash_val; - - hash_val = fib6_calc_software_hash(&inp->in6p_laddr, - &sin6->sin6_addr, 0, sin6->sin6_port, - inp->inp_socket->so_proto->pr_protocol, &hash_type); - inp->inp_flowid = hash_val; - inp->inp_flowtype = hash_type; - } /* * Call inner routine, to assign local interface address. * in6_pcbladdr() may automatically fill in sin6_scope_id. @@ -520,6 +511,16 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred, in_pcbrehash(inp); INP_HASH_WUNLOCK(pcbinfo); + if (V_fib_hash_outbound) { + uint32_t hash_type, hash_val; + + hash_val = fib6_calc_software_hash(&inp->in6p_laddr, + &sin6->sin6_addr, 0, sin6->sin6_port, + inp->inp_socket->so_proto->pr_protocol, &hash_type); + inp->inp_flowid = hash_val; + inp->inp_flowtype = hash_type; + } + return (0); } From nobody Thu May 28 07:08:16 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 4gQyJH23gyz6fDRC for ; Thu, 28 May 2026 07:08:31 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQyJG72jzz3fML for ; Thu, 28 May 2026 07:08:30 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-516de78c4dcso53154331cf.2 for ; Thu, 28 May 2026 00:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779952109; cv=none; d=google.com; s=arc-20240605; b=Ic0FRK6+9rs8KDMpzewijaWLNQebCiIrumVJMd+5PEDvHDJ4sqFpTM0ub4T2u4dOPu TQMxrreaSvFcvZgUThmIXEWYOYPWCsRr9ce0aNc3SzcBHsfrZz7hAVrM6EGzyQhDhH0M fBxnXU4TQR6OEWbBN9MGT3jjyXylCAbKgqlJB27hPfqWoPJTwkpnnFrIR6W+PUGWlyVN QNHHl/VsqZWSV2txhYGjuXGgqedGetegLZAfy+W+zrn9k61d70kYCzcnvR7uEJXowuWC SswWiklHxbomNrcaX+z+8dVJWk3/pPF7qHnQuDoWqxaA/AcaXHzERNdynKPzmB73iWhR Qurw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ZVFp/9XOlKqF0EFm3bqSnP4GOAlox6eQTmlYe+x1W8Q=; fh=PPn+5ZkHH2k402L6IU432xZpLWPe+GtruU48AN6SDE8=; b=UaGnIIDHb4n/sFdKO6QYKRF/EOMXV2yzOAADvl2oseulFB7zTqEw9TaCyWFUdybF4U D0OlFNd6eJA6teqgjd+8Zg6g0353PoO/ayv0USl7VwlOHiIk+W/1ZEv9klklNscOGR/g SVp++StnbMbD4MhJk6ytzaOCxtbz4hZoeIQnTFNJDhAlAaNbLGlPTC4G0mVxRVGIjnbF m1EIHj0mnEFZ99ra0eIdMoqD9osyDNe01VnGWnGhGRTYvIHMN4zlTLiOktGYLR9vBxnS aRUl0vQpuAYj5cFoThXbcJbaz+3Zb1piE+keSc7ZYEjw+2medChUYkOed/lQ68VuqSYJ DcVg==; darn=freebsd.org ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779952109; x=1780556909; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZVFp/9XOlKqF0EFm3bqSnP4GOAlox6eQTmlYe+x1W8Q=; b=Jh01kt3PwOWVqTtQ19MKbIuKLHnzaeXfNBaocaB3I4zA49nboXgcHxh0wePtzN7btr 1do/MzpKK57ShCmrpOgKUJWtSLoxLtycZFzi5TXQfE737VW3fVHQc4gXtOvoQSpuHQRN AyKQFAwgIRgt2H3npk4IiMlMyvMWbx9GyW9qd3HR23HnH1QOGuS1BO7+O/wMj9lV3ee0 yFL7HZD5inRdsCB38sfahNxhCuAjnHtCXvNpx7OcXaOjw7CY5EDQ78MU/vzzSGK3TGTd ydhXB4GSKGhai1wJ6t3Ff43AI3AeiGjsmSrHdL6kdpyD3RqNlc9KW1Ur1aEAun8x7C0D TVlA== X-Forwarded-Encrypted: i=1; AFNElJ/M5cB2C2w1g6uCepe1Hvr2UuiA6MLyr/LT0AEFWG4oOpnls/5sUw4OB7GkcNC4FYOuWQiUt8Tyd5p9NgTRY9j8UDmIuA==@freebsd.org X-Gm-Message-State: AOJu0Yzk8F8jJuVFG+oDkrEG5g1mhWqPRMqkRWEKREqUKIRl67wzDktr UNXuXPpwmPBmhunhp1vh1DBlDclZGnzx1T548DdqbDVdM/SpbSb0z9yKf0dlKe3t1CHM5i+kcJ5 109AsvuXUVKAujnhF8yPggQSoH+YE/F8= X-Gm-Gg: Acq92OHETQEqaRCZYY4pkaFpOmdil4U+QYKJ2TmhS0V2/1sy0k+SZwXR/UsrfM0ROR8 NLHuS00JgPQnL7xtd5TxoxumG7yb2fbZcjT6K665a/Ryt90TuXeRI9GP+t3zI5jBwd1qDBVinre xw754Su+HkbhPs1MJXg5jylmEh0EfwhjTQWf+SEM92IQrKsy7qtp/DrJSeq8j7z9HvPM/UVZ2lU oQMOzL9Kfbj2+xqCEjkSr9h13PVaowyGceTehUCqDPUjU+BnBAjy5OzDp67oV1yBWtefFZ0SdZC iAomI+w/APRHdDGV4921QMgpbvTfvSTM+DGqmPAeklP14DgpJoILSbZUe/t0rQ== X-Received: by 2002:a05:622a:1441:b0:516:da58:35c with SMTP id d75a77b69052e-516da58061bmr331996221cf.24.1779952108953; Thu, 28 May 2026 00:08:28 -0700 (PDT) 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 References: <6a16eeef.475db.2283bfa4@gitrepo.freebsd.org> In-Reply-To: <6a16eeef.475db.2283bfa4@gitrepo.freebsd.org> From: Antoine Brodin Date: Thu, 28 May 2026 09:08:16 +0200 X-Gm-Features: AVHnY4KERz6TXxkwxJLmfH4U0g9v3cqAeCdcu7-KXc68IQ_LVoCZUGC2RkYndjw Message-ID: Subject: Re: git: bd15d6ef126e - main - libarchive: Force GNU iconv compatibility on FreeBSD To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Mark Johnston Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Queue-Id: 4gQyJG72jzz3fML X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Wed, May 27, 2026 at 3:17=E2=80=AFPM Dag-Erling Sm=C3=B8rgrav wrote: > > The branch main has been updated by des: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dbd15d6ef126ee4c0eac931117f= 6bbbf6f9a3fc72 > > commit bd15d6ef126ee4c0eac931117f6bbbf6f9a3fc72 > Author: Mark Johnston > AuthorDate: 2026-05-20 16:39:40 +0000 > Commit: Dag-Erling Sm=C3=B8rgrav > CommitDate: 2026-05-27 13:10:57 +0000 > > libarchive: Force GNU iconv compatibility on FreeBSD > > When libarchive is compiled with FreeBSD's native iconv instead of > libiconv, as happens with libarchive in the base system, we need to > configure iconv(3) to handle invalid sequences by returning -1, as > iconv_strncat_in_locale() assumes GNU iconv semantics. > > This corresponds to upstream PR 3056. > > PR: 294577 > MFC after: 1 week Hello, Could this change break some ports? (during previous run they were ok) https://pkg-status.freebsd.org/beefy24/data/main-amd64-default/p50aa2c1cc25= 8_s5a8e0e03ae8/logs/errors/py311-game-2.6.1_5.log https://pkg-status.freebsd.org/beefy24/data/main-amd64-default/p50aa2c1cc25= 8_s5a8e0e03ae8/logs/errors/py311-django52-5.2.14.log https://pkg-status.freebsd.org/beefy24/data/main-amd64-default/p50aa2c1cc25= 8_s5a8e0e03ae8/logs/errors/py311-django60-6.0.5.log https://pkg-status.freebsd.org/beefy24/data/main-amd64-default/p50aa2c1cc25= 8_s5a8e0e03ae8/logs/errors/aisleriot-3.22.35.log etc. Antoine From nobody Thu May 28 08:20:15 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 4gQzv4628Pz6fKt2; Thu, 28 May 2026 08:20:16 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gQzv43vLbz3ppc; Thu, 28 May 2026 08:20:16 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779956416; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LN6nr915MFzf9sk0PkZpuHPqX2jREj3GFZ0Pa5A9EP8=; b=BJsJHCAbI8vBQw9rL9ae/FaVKOyyGx+uJocLdqWnlqEgB7HZ1ManJQD8XR2Z8YjIFuPwLU Sj+7UnQi0JM6+nIVQJZFZwI9yqiHRhpAr6rboePYW7lERUvjoPom4cmQg8Mau9RYmlQnNz Tnhu38a/Lb6iOMalgyeloFgTEJ4oyXhZHMGfuLq4kyAhoW6MTEd9oxh4Uu50oL8+FnRrID +TNyRJQOWjPw1k+A9n9jWTSos66DxeSQV+ko6mbggEysIgAcWrleSccJrJxlvMQCuAdoHO mbaCYAkMfGPQld/OLl63cwobE7a2ih3xAUAZ8EJh6WRJN8DP4cZNqSkm1pMgNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779956416; a=rsa-sha256; cv=none; b=BtivqY6MiOYgv4IPyRsr+PkvQQEI0OQm1a75849KUS6QDZk9ivgA3D1GlNs7fJhFG2acLz 9a4hSOMF6g6TTRDcl6z+02bnB96QFUc4U4AWk81b+vdrBxWf56cQAwy6kqtCZq9g8v9xkn aGhe8XzDNABYr3wAYzKQ2FKEVUql7kodqFvHURe01ndVTP+EVnhoR20ZsG8zEvYzmF9RCH Wh/Hl1a/vvDELhlEq9Oq3iaVeJdz1Hq9DT6pRcg21YwjCXw2csg1+3UcVhxwp78binzP8W CuucdA/q0dDYDfmEZcUHhdwYxJYlmjQsGQey4whOw5kXdrQv7ArG9Z1dLKl0sQ== 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=1779956416; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LN6nr915MFzf9sk0PkZpuHPqX2jREj3GFZ0Pa5A9EP8=; b=CvIxNXqlD6eQI429iDnA31AU5N/TrLWUuCeNM5iIiRpeQTBz2wHpsHL8HUewTRNR/MAfa+ ZqNg4rwrPhcVYJlf4rysKRnZDwDNPBSc9NcygXx4V8sabLSzCqPYqqZBPc9FWBQDnuYdWc RUWSGVqukcgd3LMwC2SR3GfgvblA0xdPqlupxbUceASPtXTuCe7yVnQb3k7B9B2LEZok2g qaE5Gx0ooETtfTRHIxz2uUcKLFSo8+TwUv5VakVpt+kaJZPtKrQHHvkTshSfKnJ93NPW3B w1yooEVocY0u1X/vkilSYoMESDXBwUKb/hYHMRs39/ikhm9mb8rmCzzrsOHCNA== Received: from ltc.des.dev (unknown [92.183.12.56]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gQzv42Rysz1HqB; Thu, 28 May 2026 08:20:16 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id 42E8A74797; Thu, 28 May 2026 10:20:15 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Antoine Brodin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Mark Johnston Subject: Re: git: bd15d6ef126e - main - libarchive: Force GNU iconv compatibility on FreeBSD In-Reply-To: (Antoine Brodin's message of "Thu, 28 May 2026 09:08:16 +0200") References: <6a16eeef.475db.2283bfa4@gitrepo.freebsd.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Thu, 28 May 2026 10:20:15 +0200 Message-ID: <86eciwx7wg.fsf@ltc.des.dev> 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: quoted-printable Antoine Brodin writes: > Dag-Erling Sm=C3=B8rgrav writes: > > commit bd15d6ef126ee4c0eac931117f6bbbf6f9a3fc72 > > Author: Mark Johnston > > AuthorDate: 2026-05-20 16:39:40 +0000 > > Commit: Dag-Erling Sm=C3=B8rgrav > > CommitDate: 2026-05-27 13:10:57 +0000 > > > > libarchive: Force GNU iconv compatibility on FreeBSD > > > > When libarchive is compiled with FreeBSD's native iconv instead of > > libiconv, as happens with libarchive in the base system, we need to > > configure iconv(3) to handle invalid sequences by returning -1, as > > iconv_strncat_in_locale() assumes GNU iconv semantics. > > > > This corresponds to upstream PR 3056. > > > > PR: 294577 > > MFC after: 1 week > Could this change break some ports? Your logs show that LC_COLLATE is set to C. It should be set to C.UTF-8, or simply not set at all since LANG is already C.UTF-8. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Thu May 28 08:30:37 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 4gR07G10T6z6fLph for ; Thu, 28 May 2026 08:30:50 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gR07F2jrSz3wPq for ; Thu, 28 May 2026 08:30:49 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-91066394ef8so952700785a.1 for ; Thu, 28 May 2026 01:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1779957048; cv=none; d=google.com; s=arc-20240605; b=dxznLFbukZ8y/j2ckxYaVdqd58vpsiLyYicyxt6tmWeAgsXAnfZItt93PDwbwK5S7X 10RZM/yYnDMoP/ycuL8hS/+iAleCnv3zjOwC+EDKjyFSlnjcyfsA0AX0j0iPSB9kiv/U Rkv2oGKC0n7UNXCVjvPXTYemqL2CjDwB45eI6h5uZv6pN2OVUGO36vdSCRKbbPl+3DkB vEiEdk6AG6N0pGtQGGL5zmvmWfNvaFsWxXVtrSO/VB87q3GugJM8VckEvK32+VhjCSKg 6eNwU9E1OloVkVGVepSMJME0I91MRU3hy8CyWjbjWFdZWoj1PLNBfxO6MXLKvEhwDDPE +cEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=jxnc25DWxedzX3C3HxiLWMk2NG9nozsCcou4T/+pYd4=; fh=CHTV0bNQAsdg+f2G3Q0OSOyzGdAUOkYvJ5NpE3+6Qx0=; b=Z04f6jLwFl9i6k7bJpnJnA5k4IILVAKEvRcvjZoEAr23L3v1VmiRmU/bJnSmbDpqgL JDsG4/MBxmZ2P8XibsguAXgN2aAaBVXeLIXt0JxD3AIx+9AY6gMHX55lUsjE/3doQa41 J5DMzzrWJCFm4I93MgMHaDzJs817EavmwM5QwiKYUmeyD5A0LhZc/cWpClh6G8Q1z1zM GKOzBKt8lKHNODsxT+aSjjujXifWJmcONi46zMZ5ZXQNW/kTFMhVJZsKn5Fw1Hu65ZvA xVw31/MET7oyrBr74fpWHECAPGY3gGuRX9y1jG2k+qjJkC3zwCym9RPaR75Z2mJ/JJS5 K/Hg==; darn=freebsd.org ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779957048; x=1780561848; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jxnc25DWxedzX3C3HxiLWMk2NG9nozsCcou4T/+pYd4=; b=nxzlAKPd/u2cSsEAJLmJzgbzyHz017rBIS8f9eLT2h6H272PTkyNc0UN2UfT/tu77B Hp4Ao5rJ5SXxRiCFeyZzj7WJkwGoJcmrwz9HYzyYG6y2z9BlxWbRgd5PEWXgpnywuq0M XmEeIkVTGX7E1bfyRuetNgX4OmF46mIjKfQ2TG3pzYfm83151oaknTeMmnv+0u99CoiW CTa+XHJFXsacVjwiPGYW+naIl9RLE2W4cwhWM+DYjRSRATBAGztbmGJ0PYVxOk6ebRML Tb28XCOKeLfLAq32NvRC5pJvic8Oy8tQLGLAzAk5QuUVCT1whyfqt5nrfRszH0PjSV+B kq+w== X-Forwarded-Encrypted: i=1; AFNElJ9ATuZC91EUiF1Sxv44S9Ddey/3qMC+CykDKkIDCOdzEpiPx1GJIQF6Pv2T7/mUOXZ2IBHa/AOBWoxYPEg0Z+oC9VrNAQ==@freebsd.org X-Gm-Message-State: AOJu0YxtzF9+kfku8i2g2rKSO9BkaGXEAozor7CuqiMQmT1ztTymZYZl X4wsMyvR2xEKA77yphDDb8rPBAixtRyJhVoXkhdd8jnWBtxE2poJWzuoeZBL7Y4rpg4j8XYj8jB mi07Q7XBWdRAvjOPF4yYrWMMHkfy6QYY= X-Gm-Gg: Acq92OFwj/T0JAYItu+QJJhVGXOKDyMYk17OPHVdQyP+lMoqBUOhhp0teRGdeY3PqH3 LSEpYCN1buCxDan8N6/mRGzwTFCZNgmh3rd8IDdmSDfHY2NMFU1unZjxjiq0Sm7FeFTU8AQxCP6 qdmUrTwZJCH4f2RFENqXcKI1puVr3ehuqQ5d+i20I7Ki3rgrRf4WzBFcm4B2zYBVOk9ou3fhpxn QQAmXC7MkK3zYuZCsGMWU2uWupRHw/l/wiFN22eBgyXu4R7jlpEdYf8WOwIibVXwq55hdkNXh7f sdxJh0QP6N4emV3RyzHrY1lA86jPuwk6pjHbjjLuJulq1NjGU9U= X-Received: by 2002:a05:620a:458b:b0:914:c38a:4e80 with SMTP id af79cd13be357-914c38a52e6mr3042562785a.41.1779957048332; Thu, 28 May 2026 01:30:48 -0700 (PDT) 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 References: <6a16eeef.475db.2283bfa4@gitrepo.freebsd.org> <86eciwx7wg.fsf@ltc.des.dev> In-Reply-To: <86eciwx7wg.fsf@ltc.des.dev> From: Antoine Brodin Date: Thu, 28 May 2026 10:30:37 +0200 X-Gm-Features: AVHnY4Ii94wT8H1pK1oCcIYBJqfisBdreu9frVbchg9CLPnEhD0EizLORvktQS8 Message-ID: Subject: Re: git: bd15d6ef126e - main - libarchive: Force GNU iconv compatibility on FreeBSD To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= , Baptiste Daroussin , Bryan Drewery Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Mark Johnston Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Queue-Id: 4gR07F2jrSz3wPq X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Thu, May 28, 2026 at 10:20=E2=80=AFAM Dag-Erling Sm=C3=B8rgrav wrote: > Antoine Brodin writes: > > Dag-Erling Sm=C3=B8rgrav writes: > > > commit bd15d6ef126ee4c0eac931117f6bbbf6f9a3fc72 > > > Author: Mark Johnston > > > AuthorDate: 2026-05-20 16:39:40 +0000 > > > Commit: Dag-Erling Sm=C3=B8rgrav > > > CommitDate: 2026-05-27 13:10:57 +0000 > > > > > > libarchive: Force GNU iconv compatibility on FreeBSD > > > > > > When libarchive is compiled with FreeBSD's native iconv instead o= f > > > libiconv, as happens with libarchive in the base system, we need = to > > > configure iconv(3) to handle invalid sequences by returning -1, a= s > > > iconv_strncat_in_locale() assumes GNU iconv semantics. > > > > > > This corresponds to upstream PR 3056. > > > > > > PR: 294577 > > > MFC after: 1 week > > Could this change break some ports? > > Your logs show that LC_COLLATE is set to C. It should be set to > C.UTF-8, or simply not set at all since LANG is already C.UTF-8. I add bapt@ and bdrewery@ This LC_COLLATE comes from https://github.com/freebsd/poudriere/commit/a69f7a01ea7318aafc6d20eff500849= cb98c5c7a Antoine From nobody Thu May 28 09:01:11 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 4gR0pJ70Pdz6fNk2; Thu, 28 May 2026 09:01:12 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gR0pJ64hMz40jy; Thu, 28 May 2026 09:01:12 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779958872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cAxo1edq7+kS8SXssWXj/Gb9O8mLdLL9Y0qPOI/rboY=; b=KbNDx/ONo6k6ApTbgKdJQhCguldYn1HmA9vd64l3hA8oyxmOytAJ/g5k1KsP0s3oiBj8Pb iewdl57jTz5w0AcQpgeJZj6e+3bcoDeIHmNqB/lGv4keUbr1TU/L82zdq8Lr1qwZDuGr63 7GaMiBD4t3CYAvyTlbQY8XwNJF4M9XXk3DH0p5w+urPHWfuLRC5DtBPmLdQMb4PDFzsTww eJ0ahEu3g1ksFf5EEsk44PAIBLFPujpz9MemiYNvRp9hAmqy9JxSEjO159/CIF9fb2gtOV 0YNEuKS6XkmweeXaRwBZyq/bmCc1BrWJZSgVk+nJPANE3ihd/edvFx+jMUV0iA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779958872; a=rsa-sha256; cv=none; b=oMvA84gslcjcmFVN7OIxcHqLYK3vN8E7FZCBClKjRSs8yuqGC34CJssDDmDtHDIfyN5Jtt SkC2FMK2VqpG2zluq7u7sR043Lyh72ufkp9BjIB0fXzwrJ/Hhutcg5pwgZ38kADfHnA2WU cPSNu7nLY1yYYWTi4XBNCnLkPTY7qrSZVlBTfpfZnNYN1fERHqArTkT3BUoLhNhKBc2qbl gce9mHe1AMCp/HaoNjkkr3S9i/MmIBMmieD8bN30EVybyS8EjBnBsJOioCLtppyqYLjyb/ JjLUFejdzgTEyJJRJhxaaw8p8p/cF7fVCtrpSIGeeCcRyEysIj7gxXy6Hdc2ew== 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=1779958872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cAxo1edq7+kS8SXssWXj/Gb9O8mLdLL9Y0qPOI/rboY=; b=FrOOCyKHj7jG1yZqRcBaohc8YBi2sVo0eLB/mrWH3Pa+FZ2nrD8SkJV+VPjcCiCaGXr1Gv SJTiMZqGDol4CjxLwaV3ssj7H6pMJB3bgpPVtKamIYQjGu4ZecA6JVo7JsnKsVeNDoWOja dfHwGTapD2/z9m0ocRR8blOs4bbP2V3pviCcO4lum34AaT3FfoZ12umbp092AoAp9jT9qK eH+YasDrQ7k6Un9b6soQv1R83ZfIO/LdCBZyoSBAobVj6qvB7e4e9XJAyBvzH8Zq7PBiy4 NfdOwUmOT6dheryXY1yvQipNetTj/9eqFaZaRPMf31Le2bCx/p5gwA0kEmFDLQ== Received: from ltc.des.dev (2a01cb0585070b00922e16fffef1acef.ipv6.abo.wanadoo.fr [IPv6:2a01:cb05:8507:b00:922e:16ff:fef1:acef]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gR0pJ4CQJz1K2V; Thu, 28 May 2026 09:01:12 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id 142CD74506; Thu, 28 May 2026 11:01:11 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Antoine Brodin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Mark Johnston Subject: Re: git: bd15d6ef126e - main - libarchive: Force GNU iconv compatibility on FreeBSD In-Reply-To: <86eciwx7wg.fsf@ltc.des.dev> ("Dag-Erling =?utf-8?Q?Sm=C3=B8r?= =?utf-8?Q?grav=22's?= message of "Thu, 28 May 2026 10:20:15 +0200") References: <6a16eeef.475db.2283bfa4@gitrepo.freebsd.org> <86eciwx7wg.fsf@ltc.des.dev> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Thu, 28 May 2026 11:01:11 +0200 Message-ID: <86a4tjykko.fsf@ltc.des.dev> 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: quoted-printable Dag-Erling Sm=C3=B8rgrav writes: > Antoine Brodin writes: > > Could this change break some ports? > Your logs show that LC_COLLATE is set to C. It should be set to > C.UTF-8, or simply not set at all since LANG is already C.UTF-8. Hmm, this does not appear to be the correct answer. It looks like the ports tree is messing with the locale: des@crash /usr/ports/devel/py-game% export LANG=3DC.UTF-8 des@crash /usr/ports/devel/py-game% export LC_COLLATE=3DC des@crash /usr/ports/devel/py-game% locale=20=20=20=20=20=20=20=20=20= =20=20=20=20 LANG=3DC.UTF-8 LC_CTYPE=3D"C.UTF-8" LC_COLLATE=3DC LC_TIME=3D"C.UTF-8" LC_NUMERIC=3D"C.UTF-8" LC_MONETARY=3D"C.UTF-8" LC_MESSAGES=3D"C.UTF-8" LC_ALL=3D des@crash /usr/ports/devel/py-game% tar -xf /usr/ports/distfiles/pygame= -2.6.1.tar.gz -C /tmp des@crash /usr/ports/devel/py-game% make BATCH=3D extract=20=20=20=20= =20=20=20 =3D=3D=3D> License LGPL21 accepted by the user =3D=3D=3D> py311-game-2.6.1_5 depends on file: /usr/local/sbin/pkg - = found =3D=3D=3D> Fetching all distfiles required by py311-game-2.6.1_5 for bu= ilding =3D=3D=3D> Extracting for py311-game-2.6.1_5 =3D> SHA256 Checksum OK for pygame-2.6.1.tar.gz. tar: Pathname can't be converted from UTF-8 to current locale tar: Pathname can't be converted from UTF-8 to current locale [...] des@crash /usr/ports/devel/py-game% cat >/tmp/tar=20 #!/bin/sh locale exec /usr/bin/tar "$@" des@crash /usr/ports/devel/py-game% chmod a+rx /tmp/tar des@crash /usr/ports/devel/py-game% make BATCH=3D extract EXTRACT_CMD= =3D/tmp/tar =3D=3D=3D> License LGPL21 accepted by the user =3D=3D=3D> py311-game-2.6.1_5 depends on file: /usr/local/sbin/pkg - = found =3D=3D=3D> Fetching all distfiles required by py311-game-2.6.1_5 for bu= ilding =3D=3D=3D> Extracting for py311-game-2.6.1_5 =3D> SHA256 Checksum OK for pygame-2.6.1.tar.gz. LANG=3DC LC_CTYPE=3D"C" LC_COLLATE=3D"C" LC_TIME=3D"C" LC_NUMERIC=3D"C" LC_MONETARY=3D"C" LC_MESSAGES=3D"C" LC_ALL=3DC tar: Pathname can't be converted from UTF-8 to current locale tar: Pathname can't be converted from UTF-8 to current locale [...] des@crash /usr/ports/devel/py-game% cd ../.. des@crash /usr/ports% grep -w LANG Mk/bsd.port.mk=20 # USE_LOCALE - LANG and LC_ALL are set to the value of this variable in LANG=3D C .export LANG LC_ALL WRK_ENV+=3D LANG=3D${USE_LOCALE} LC_ALL=3D${USE_LOCALE} There we have it. The ports tree should set LANG to C.UTF-8, not C. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Thu May 28 09:08:57 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 4gR0zG4KpHz6fP2T; Thu, 28 May 2026 09:08:58 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gR0zG3jhsz41WX; Thu, 28 May 2026 09:08:58 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779959338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vQYJkLpJYILPwvRKaYwHMPxozcPSUNsZRweBjUzdiO0=; b=uXVRGntXwrySwc+ZCxwdDuTB2OrpvDUtmtf0yITSRA3cUA7p31wzl2WVNxosBz92cfb6o5 Qekpjq+SXP/uXMqzH3MLFMarzWSxWYxlPZuIoxb/IBBJVbPzD31grak5Uuc36S4tWeC+6C dFLZS7DuruLrph8R0o3SFDWPWr82TitDSReZMN1gm9Ni2lToFafgFEGGPTpRNb/77U4TYq Wi8QJ11kMJweyD5Yj+esEQAjblVqCBC1P+gqvwtnHdBnVNrfja21lzCMAbVneJ+ZWtsGh6 vLWjNgnu8t/Vzf+nJMUeJpPH+Rb0KuKcR2d9CcJ+ODp+hOnjiWFjceyDlLz/Kw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779959338; a=rsa-sha256; cv=none; b=NplM/+Bz1BZSjJSP918A/FYx+oye4MSgi0t2ut3HU3SCCtU1A5GbzlVOXK3iIZY26Y9NSd vMfjk7xajUjhcIHIzpczCQC8as8sORhc+UYNQx+x/JfXxbTKSIg5ktqYDaG0KZlGVBJWmq z+e3RCz4c4TQ6SQSSdBW54+9uPgeTi7+X5z55YgT8BotjMFYZ+ppAeR0p4uBfBVfEKR6Kc JOTXZ14FUCHMx8Tf3bmv1ldjH8dApoRAjCV/+9Wejzjsp9nfpl5rgn6Xu0GqkuotcYSYTg /g97im1jdCHSTxgUXiokrXUY9Cw2cQYyTJGUW7yZN1ma1JsWpg9XohNkNRx9Ew== 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=1779959338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vQYJkLpJYILPwvRKaYwHMPxozcPSUNsZRweBjUzdiO0=; b=Yp1Rb9OiWUmZT2/qPcJNO0MsgABifhhQMh/TBCL2mMtfeHk/8+0mJm9XnAc87GXAbduSsd 2uBd3OBreIvjUJfcELkmc9FP3epxmWyQLu0JFzhBZcrm+hf8NjulCy0k/iVsuUgA7s/8qs YhsMh5MsSamB6uISgDdAwQW+XCpf1JOm3FSXK5dFd+mZCNbChJT2IKzF55x3tkSLS1roCb uiLv9qoV6nSKdA/svzfRzLMPIPJNzrmXsB4h9W0vGYuZrld2DQx/gnYeaFeULW7C2yONhl P5NrayTSUnzC5IN43LfP3wpu/JpvAezTphDjl5x99mz6ueTbfgfSo2EzPY4SHA== Received: from ltc.des.dev (2a01cb0585070b00922e16fffef1acef.ipv6.abo.wanadoo.fr [IPv6:2a01:cb05:8507:b00:922e:16ff:fef1:acef]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gR0zG2DN1z1KM3; Thu, 28 May 2026 09:08:58 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id 42D9475102; Thu, 28 May 2026 11:08:57 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Antoine Brodin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Mark Johnston Subject: Re: git: bd15d6ef126e - main - libarchive: Force GNU iconv compatibility on FreeBSD In-Reply-To: <86a4tjykko.fsf@ltc.des.dev> ("Dag-Erling =?utf-8?Q?Sm=C3=B8r?= =?utf-8?Q?grav=22's?= message of "Thu, 28 May 2026 11:01:11 +0200") References: <6a16eeef.475db.2283bfa4@gitrepo.freebsd.org> <86eciwx7wg.fsf@ltc.des.dev> <86a4tjykko.fsf@ltc.des.dev> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Thu, 28 May 2026 11:08:57 +0200 Message-ID: <865x47yk7q.fsf@ltc.des.dev> 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: quoted-printable Dag-Erling Sm=C3=B8rgrav writes: > The ports tree should set LANG to C.UTF-8, not C. I just noticed that it sets both LANG and LC_ALL. This is meaningless since LC_ALL overrides both LANG and every other LC_* variable. Either way, the ports tree should use C.UTF-8, not C. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Thu May 28 10:45:01 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 4gR3653mZzz6fWDf for ; Thu, 28 May 2026 10:45:01 +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 4gR365340kz3Dt0 for ; Thu, 28 May 2026 10:45:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779965101; 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=C0/Sd9+7U/sVw/famJ6kL1ZeJcpYQXPE3VamsnVUlsg=; b=NV99khiP3FhSuCthghw/tMj0CUduASa7v8auQyTjEcdd54f3vsote7rVrcQ+vgNBn8GuO7 T0NFllvGeEjWCHl/xyL6WsR8gqMedJAooSedNxrZB/Qs8eQFEipLkzl1UqeY7ECoh6GgxM GqqaEsj1lmvEHTYa2PAGdObot+2592/PRt14cMYRttsgzUM+quPSeRWKL7tpzXzPlqKOXd CTjAyLol3eHdHFq8AD/NxRpyz/Qd7TBUbgbDJ/jLiNXSo6gSXCJmlr91hI7JKYvks3MQUA ePnc9e6GcP7zAUMooj6YPy3MBLofOK+D0zU6Y8rFooo6eq7iqWxCpXc1q4ijpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779965101; a=rsa-sha256; cv=none; b=AWPJi0Fh0UECzRprLTzDr91yxjPabGyMy7KTDNe3htfHq8QP8lgbMU3M7RuTdMMFe26ooC XJ3A6U7R6/e+ZXNhy3yGk4c89cbjQFANVhJtTihpXH16C8TK8Rqa+DCQFNuKc4tn6i1q/W 9xefOD1n0OFpT8T2+fq7ESUxZA3CtTg8/LiLEwkajqUbSZmySIYCucMOXgVXOU62ojTtkk TBDXXeUZ8Ei09mAfVkzDthhDr3iQX1XLFqhYPagGu/x6bXOwDsz2Rtm7l9PTk5ewm6e2EE vvZcOpSwFYCeg5cYDQrh80vNhc3Pk6MxDuLsCb9Rg/Nu01JaG6kMRq5qVteMuw== 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=1779965101; 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=C0/Sd9+7U/sVw/famJ6kL1ZeJcpYQXPE3VamsnVUlsg=; b=raPuYPkH05rZDsqHuxwl8mItclPUxOVRjnNgmg4X1t2NuoF3QHi6u7pLOis0plpCAJ2xfO Y3BXgNlrMPwLy4eiISOHun2pyj2hsBfZLCLIdbBYOyntfplsB0hUp6Wkg190CqVRLVbphX Hsyybr7hfg3im5eahnrcJIrNZK3U+Z731MkKK2LATpu50OwNTE2ZJAVGoAXP01t5yvIYw9 bb6k0cKvMQ61z1CEb+L5L9E1HHbWzQdEUQsXEaY+ZW2FFcVsBEaMxOda7y6cdh4pmFjPTQ BylfDBc1WTD6bQR4uKVLLaobPVVClAfLS/1AAP/OeRPQfcilbo/YZ3tI1zrOMA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR3652JWpzkDD for ; Thu, 28 May 2026 10:45:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ae9b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 10:45:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Cochard Subject: git: ff873565bc2c - main - ping: fix test timestamp_origin when tstamprepl is disabled 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: olivier X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff873565bc2c3e47fe1d070305aa851189ee8bcf Auto-Submitted: auto-generated Date: Thu, 28 May 2026 10:45:01 +0000 Message-Id: <6a181cad.3ae9b.32d308de@gitrepo.freebsd.org> The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/src/commit/?id=ff873565bc2c3e47fe1d070305aa851189ee8bcf commit ff873565bc2c3e47fe1d070305aa851189ee8bcf Author: Olivier Cochard AuthorDate: 2026-05-28 10:40:48 +0000 Commit: Olivier Cochard CommitDate: 2026-05-28 10:40:48 +0000 ping: fix test timestamp_origin when tstamprepl is disabled The timestamp_origin test sends an ICMP Timestamp Request (ping -Mt) and parses the tso/tsr fields out of the reply. When the sysctl net.inet.icmp.tstamprepl is 0, the kernel silently drops the request, ping receives no reply, and the sed extraction yields an empty $tso. The test then fails inside atf_check test -n "$tso" with the unhelpful message Approved by: maxim Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D57287 --- sbin/ping/tests/ping_test.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sbin/ping/tests/ping_test.sh b/sbin/ping/tests/ping_test.sh index af700615dc8d..ab45ad809a52 100644 --- a/sbin/ping/tests/ping_test.sh +++ b/sbin/ping/tests/ping_test.sh @@ -253,14 +253,22 @@ inject_reply_cleanup() ifconfig `cat tun.txt` destroy } -atf_test_case timestamp_origin +atf_test_case timestamp_origin cleanup timestamp_origin_head() { atf_set "descr" "ICMP Originate Timestamp" + atf_set "require.user" "root" + atf_set "require.config" "allow_sysctl_side_effects" } timestamp_origin_body() { require_ipv4 + # The kernel only replies to ICMP timestamp requests when + # net.inet.icmp.tstamprepl is enabled. Save the current value + # so the cleanup hook can restore it, then enable replies. + sysctl -n net.inet.icmp.tstamprepl > tstamprepl.txt + sysctl net.inet.icmp.tstamprepl=1 + # Run ping timestamp out=$(ping -Mt -c1 127.0.0.1) @@ -286,6 +294,12 @@ timestamp_origin_body() atf_fail "tso ($tso) differs from tsr ($tsr) by $diff seconds" fi } +timestamp_origin_cleanup() +{ + if [ -f tstamprepl.txt ]; then + sysctl net.inet.icmp.tstamprepl=`cat tstamprepl.txt` + fi +} atf_init_test_cases() { From nobody Thu May 28 10:45:56 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 4gR37B51N7z6fWqM; Thu, 28 May 2026 10:45:58 +0000 (UTC) (envelope-from des@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gR37B17GQz3FWK; Thu, 28 May 2026 10:45:58 +0000 (UTC) (envelope-from des@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779965158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+i0hD8P8TmCk0U7Z7NjtnmFzHaGJkDalmd29FF0ZM8g=; b=WfkRc4KKBWbWusdkCXUc1bhMDMJDDlsDOUw+GpCeZlQpQoEi6zzQhx90CspU7CaKQWVqrm MRf3/U2ZHEfO+N/5TCNrNqFQA3LksF0Ez0rrlqZyngT3c9yLdVUe+PDCBa+5wqCMRTZwPF 84rblKwbNWU+jPvkzNvM3P9wpT++8YlTqPxsA5MIBA17E+6JnA0fmUj0Gnjo0ExVh5dVC1 erLOGuU3/J1mGruPTIAI0crOUlbQuECHtDNHZoCinKPnYC1Xv6KaUhJRl4AWuQYQRAWvZ6 //Tn/t7fF0XrfVgHPIpx7CNE2a7AyIV8lTmu2A6EFzZ9mKnxmz+9ekvf2CKMKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779965158; a=rsa-sha256; cv=none; b=lZNFu/EuYNxvWIeKp+mfKUEWJEzp9IcoMV2QS85aT/NwVKs6PS9E7wrsL6gMUKppczzk1u TGFKsUwB6J6YEMlmzFcBtH3aklwg6pc/Drns23OJtuF8Ii4UjgWWS+zKcATNNUUBVcKmhu D47G6wUUmrBOAKzVIBJFeGJXuww6kILHcZosgl6BcIWwUTmalVwMGrsCdVBNTXcxeVofpZ VJu8DLuVq6ba7Xwhwa14B+04RhvkoaO3F9Tw+dHxKKWfDI71Qxd1kQSmaQGOiA0oW/iXY/ k5ZlUAAS9v7oXEgPHvQ2Z4nsIXCxbNt5bbczMuXh2hJ8n28C/vAzTqQHmDm5YA== 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=1779965158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+i0hD8P8TmCk0U7Z7NjtnmFzHaGJkDalmd29FF0ZM8g=; b=BZphffeSGdM4k4u6ljrgxOL/bYO7m7iFs0IksPMh0AaLTTnYHiiYwQQxdfVBdxoWMk/prZ YMu6QBNxRzEcehbBucXyO0f4mEn5D41HTaqy6q0h6obzh24tPeXbwI22uQTxwdhJLPBCBH e2hArIVA6JvN3XjPI/+HMefS0EEmvM/MCbu5Sc5+1FAZGBSrIFydb+mhuAenKE6Q5eDTx8 So36IzRw1ceTWBCnXdltsDwGCZ4txciZ+WwWSx98K/D7sztkzmwR11ZchE7Hgweo+kYwG9 FXW0yPmTeTJmHM9yQXh3Okv1y9p1KJAwQkOyU4NSyY6iULfs9F0BATwCONZ+JA== Received: from ltc.des.dev (unknown [92.183.12.56]) (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) (Authenticated sender: des/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gR3796vb0z1MJg; Thu, 28 May 2026 10:45:57 +0000 (UTC) (envelope-from des@freebsd.org) Received: by ltc.des.dev (Postfix, from userid 1001) id E6005749A8; Thu, 28 May 2026 12:45:56 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Antoine Brodin Cc: Baptiste Daroussin , Bryan Drewery , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Mark Johnston Subject: Re: git: bd15d6ef126e - main - libarchive: Force GNU iconv compatibility on FreeBSD In-Reply-To: (Antoine Brodin's message of "Thu, 28 May 2026 10:30:37 +0200") References: <6a16eeef.475db.2283bfa4@gitrepo.freebsd.org> <86eciwx7wg.fsf@ltc.des.dev> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Thu, 28 May 2026 12:45:56 +0200 Message-ID: <861pevyfq3.fsf@ltc.des.dev> 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: quoted-printable Antoine Brodin writes: > I add bapt@ and bdrewery@ > This LC_COLLATE comes from > https://github.com/freebsd/poudriere/commit/a69f7a01ea7318aafc6d20eff5008= 49cb98c5c7a The problem is actually here: https://cgit.freebsd.org/ports/commit/Mk/bsd.port.mk?id=3D02f27a83b44d4= 566fd409edc60570ac0734eb63e Here's a compromise solution: https://reviews.freebsd.org/D57295 but ideally the ports tree should use C.UTF-8 throughout, not C. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@FreeBSD.org From nobody Thu May 28 11:21:26 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 4gR3wC5Cl4z6fYk0 for ; Thu, 28 May 2026 11:21:31 +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 4gR3wC4VD5z3Jwh for ; Thu, 28 May 2026 11:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779967291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W+zmnVu96IYy3q25eYAONzlACw/eOticwbiq08NKfa4=; b=umcCVS70cnCVtE6nCEkvNBoHPmjfsMTex9EyxqpXOCLMHXZegOuyT2iY1/XejO1wgBYC93 n6NHtiw8u1XW37FlF7Mzv/HHKTMjzIFr93zco/FjO0m1niPLqeG/3k/BTO7KFrfdwTCn8o e0a1oKQW2H3SabNT/uBN0hFO98/1InGJCpWmhWm0Op6qGXazWGdoVhORPs4CpTm8p6IBTn 9d09o6zl1fN6Kf/hXnNQ8D1NQ+R8JOyfHfhfh22crJLC8q/51lRHXg6llfCTY7dmLy904L 8SWjoSq2qgL2mbd05Z+VCs6sEUsKS0KpPyl786iceQ3GBLazbrOQOuvFEFqy9w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779967291; a=rsa-sha256; cv=none; b=JUu2Dnjit5Ye/AzP+TtAR17W8DSpa6wbAdSW3fNz/n73P9dKe/HTURJ96UISspN8yGMXcP zrErf2CswVz/4kALiDYbIW/HWRWAAxdfmG0knEIbwJEtcELyTtnoDMXKSAOONSQECo07P+ 9oar6jvRM2jT4Sy/YhaAR6OGde5yHPZmLvZDy+6G/vRBe20OFHhz5g45rz0gHCvjufDIe7 hzkMO9GuQK6f9R6LtwNaV6RWL65jHfJHWnsNN3WOAD1f9VnFef/8DtErtZHQqVj51rwyO9 Scz6gOJD+8uxLSv/RFEH2D+1ojc0RV46s02ZmwpP0YFtiCKmJKAMayk0Bqv8Sw== 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=1779967291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W+zmnVu96IYy3q25eYAONzlACw/eOticwbiq08NKfa4=; b=T1QrZyfwDrYrNWK8seTVVTX1AvHBjtH2YTBqWY/GvBK/mQ472Y3Mmn0FI61y7TFFNMSnH7 To9MRpbk61itxKVArQFc/bBNg6WvIahF7ZFVaxlR7z1uLvr3+pmZElJI51Rx12OBeR+8Xj /MMQCl7Pi7uVB7X9nZHWuCwuSa56xR2A5FUtWZ1flJRLBY1QsoOz24znty86yu/I27KKu7 VvZUwVlQIa3xaet+0jveKzRhNOxil0fzJvXNGfCPDa/PLyDt7pDAnoh3lpAM15MubnDqQU E0TUEjE8gL7UqmJoPHAhpWqfmi+vpkbsm03tWNw8aa6vXgfeMugxcosF46q96w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR3wC42ZGzkCS for ; Thu, 28 May 2026 11:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ed09 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 11:21:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Mike Belanger From: Michael Tuexen Subject: git: b29842622dcb - main - if_ffec: correctly trim 2 bytes from the beginning 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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b29842622dcb9c9c9515fc04dc5826a8717537b1 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 11:21:26 +0000 Message-Id: <6a182536.3ed09.2c4ed400@gitrepo.freebsd.org> The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b29842622dcb9c9c9515fc04dc5826a8717537b1 commit b29842622dcb9c9c9515fc04dc5826a8717537b1 Author: Mike Belanger AuthorDate: 2026-05-28 11:09:52 +0000 Commit: Michael Tuexen CommitDate: 2026-05-28 11:09:52 +0000 if_ffec: correctly trim 2 bytes from the beginning PR: 283315 Tested by: tuexen MFC after: 3 days --- sys/dev/ffec/if_ffec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ffec/if_ffec.c b/sys/dev/ffec/if_ffec.c index 17fab283fc81..cf171a854406 100644 --- a/sys/dev/ffec/if_ffec.c +++ b/sys/dev/ffec/if_ffec.c @@ -850,7 +850,7 @@ ffec_rxfinish_onebuf(struct ffec_softc *sc, int len) * biggest header is, instead of the whole 1530ish-byte frame. */ if (sc->fecflags & FECFLAG_RACC) { - m->m_data = mtod(m, uint8_t *) + 2; + m_adj(m, 2); } else { src = mtod(m, uint8_t*); dst = src - ETHER_ALIGN; From nobody Thu May 28 12:27:32 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 4gR5NP0WcTz6ffkH for ; Thu, 28 May 2026 12:27:33 +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 4gR5NN3djBz3S5X for ; Thu, 28 May 2026 12:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779971252; 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=Qi1QGJHIT2GVuO1E/YHnX8EHj2zkeNPZ1JR6x+FFznA=; b=jNMm+j2gePNQB3FYa7KDBepeFwJW4GZ4+TqquxAxzwtk6D7Ewd+IZUGXFepjXBNqlsVDKh WuwXAoRPch8ZHPj7VOOqyoL7rjAps1iMJPFrbwsAGNTCE6o6dBle/ZRFi17w2YXv5Qkxg0 epYXPS4hydsEOur0zJSOujm5gpJXvziwoHPpH85561t2S4Amlxhd2Ekgr4T/97HS6Ubcmw FWmrFGwbslKFK1IpHx2r3dngfWekHNhMMrE51xMMCA41CnLf8WrHmXVQgA8uloxM7mgYko OY2d8OvnI72O+oC6aItUb2AIDND1/zUHffE8ZOLF9QLXV2oZkE3fmmgkyeyE4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779971252; a=rsa-sha256; cv=none; b=cXKYKRtt+BPu50Xp5dXFBKaKuLu/auJ6n7DUB9OGBWXYgxAD6mwT1nGpy9cs3tCsZ7tKFD 2uFAdySu22rwRsgb0XW7CIsKUOLrvpuoQNEN6n5Hs2VhNsg+/mWHaEV2WMzWhINOrvgdKc Hsq1kAufD6AB0U5oG66bgQA+uOkjokr7JH9nIX6HMeQmDZkP5MPwVKtgA3svoYMFmEGsXX XG5Hb4xTZ34gVohRPdaN+YRn/kPv0k9q5waBhcROBoalGYJHeYXoEArcJ5TeETykfLEYxC nFVTw1Om6KcmhpYEOFryL1iDHaB0nDsMkeHfFDjDEIYiWzxxKbSJ7zSx+QwLvw== 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=1779971252; 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=Qi1QGJHIT2GVuO1E/YHnX8EHj2zkeNPZ1JR6x+FFznA=; b=IC053vpa/KsBhpsN6oeeNU1+pGGAxAiqBSJP1o1wHartwwEO8a67MCj31RcDiqJwEqMbxs /h5HBbUdCfcHOQnjx5+73L1h/OLufmqlfS5pYeLyb5/VBcW0xxeyQDb8QkZ2TFYft91YdU hmZkOsWYA0qE76YCMNEHSfGFigEdrUYSGmfWCi1qJAXGdLWOQ291e8EEpZpmnCHeFkNjGw gvvqncNJiAyqWeosxC/EXsxxEXz186StQgACFLCiYXshb+XxFFOGiiaBfd1gdnzt68T8LY jVpmgJfN7Z2GfVNdmZGat13BFMdzV0fy9M3kX8NirhJM0teqoGa4xXj5g9t4pA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR5NN2MR7zmVh for ; Thu, 28 May 2026 12:27:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 43cc2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 12:27:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 05039fda7ee1 - main - tests: Fix reliability issues in POSIX ACL tests 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05039fda7ee12f3b857e55a461607b5af7b6c91f Auto-Submitted: auto-generated Date: Thu, 28 May 2026 12:27:32 +0000 Message-Id: <6a1834b4.43cc2.67dfe7ac@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=05039fda7ee12f3b857e55a461607b5af7b6c91f commit 05039fda7ee12f3b857e55a461607b5af7b6c91f Author: Dag-Erling Smørgrav AuthorDate: 2026-05-28 12:26:26 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-28 12:26:26 +0000 tests: Fix reliability issues in POSIX ACL tests The ACL tests use UIDs and GIDs 41 through 49 and expect them to be unassigned. Since GID 43 is now assigned to the audio group, some tests have begun to fail. While here, also fix a benign Perl syntax issue in the test runner. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57297 --- tests/sys/acl/run | 2 +- tests/sys/acl/tools-posix.test | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/sys/acl/run b/tests/sys/acl/run index f8e9c8d87f71..42dbc7373f7f 100644 --- a/tests/sys/acl/run +++ b/tests/sys/acl/run @@ -105,7 +105,7 @@ if (isatty(fileno(STDOUT))) { } } print $status, "\n"; -exit $failed ? 1 : 0; +exit($failed ? 1 : 0); sub process_test($$$$) { diff --git a/tests/sys/acl/tools-posix.test b/tests/sys/acl/tools-posix.test index 2b2a27d24a0d..aa92911761a6 100644 --- a/tests/sys/acl/tools-posix.test +++ b/tests/sys/acl/tools-posix.test @@ -80,7 +80,7 @@ $ getfacl -qh lll > group::r-x > other::r-x -$ getfacl -q lll +$ getfacl -nq lll > user::rw- > user:42:r-- > group::r-- @@ -89,7 +89,7 @@ $ getfacl -q lll > other::r-- $ setfacl -hm u:44:x,g:45:w lll -$ getfacl -h lll +$ getfacl -hn lll > # file: lll > # owner: root > # group: wheel @@ -111,7 +111,7 @@ $ rm lll # Test removing entries. $ setfacl -x user:42: xxx -$ getfacl xxx +$ getfacl -n xxx > # file: xxx > # owner: root > # group: wheel @@ -369,7 +369,7 @@ $ rm ddd/xxx $ setfacl -dm u::rwx,g::rx,o::rx,mask::rwx ddd $ setfacl -dm g:42:rwx,u:43:r ddd -$ getfacl -dq ddd +$ getfacl -dnq ddd > user::rwx > user:43:r-- > group::r-x @@ -378,7 +378,7 @@ $ getfacl -dq ddd > other::r-x $ touch ddd/xxx -$ getfacl -q ddd/xxx +$ getfacl -nq ddd/xxx > user::rw- > user:43:r-- > group::r-x # effective: r-- @@ -387,7 +387,7 @@ $ getfacl -q ddd/xxx > other::r-- $ mkdir ddd/ddd -$ getfacl -q ddd/ddd +$ getfacl -nq ddd/ddd > user::rwx > user:43:r-- > group::r-x @@ -405,7 +405,7 @@ $ ls -l fff | cut -d' ' -f1 > prw-r--r-- $ setfacl -m u:42:r,g:43:w fff -$ getfacl fff +$ getfacl -n fff > # file: fff > # owner: root > # group: wheel From nobody Thu May 28 12:28:29 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 4gR5PT2KrSz6fg6Y for ; Thu, 28 May 2026 12:28: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 4gR5PT1bzJz3SL7 for ; Thu, 28 May 2026 12:28:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779971309; 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=sm/7/hiG5AdiqpwVtmnCIQa8WXXDn2q7XbvA5Ou9MYQ=; b=rQ6HRe6iUTYKK2qrsBo4o4LVgKDhFrGAzfwMlegCJ6ciM7lv4XU97aD7ui86E/osT5MIn6 CoCLIxGeCoujr2Qplmtb/EeMY5LwTQ4pbKfY3Qkc6lhbwTBiGMLmA4AjM3z3soSWJCug68 UfTc0ogaM6U368OXJlSqd3G/RlHOwmh3LCuGXWVaaPTVjpzZLDCVLEkCGHMEtSrdSSI4UK woPX8V8I/4slCsBg32wFDODdXunmSJaMN0IOPI1FwO7mw4zh8u6mvjI9GUL4Wdffgv5DgL Z8SKwbmtcbN6gTiI+YyRbVwAN2AlogTzuxAMWRfwGpGI44dnwZ1IlVnpbyqUFw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779971309; a=rsa-sha256; cv=none; b=xgJXg2yRBPi+t3BNcGruM9EvjpgJIdq5dgJwWP3LSDIQFsm79ONJikf1enS1xbf6AS7Nqn eoK3aIjdvcdrarqJOxo59GpDiW988y2yhqaH6IInf59ra0kAjrx2RWUaIJ+egpCbqgxCS2 tK+iOOM5Je82n4jU3xU/c7Sv6yj7vchgYyw0G4xHqa5klH1soWOQDBJlN09QB8dvIx833/ o+mgTNWu5WZ2p+/Vs8rhfYlCYTc/sXLP8UwrcY2RufYxJ5nRIJzYmu1sCMyqTuxo0BN3So DQrhpipgEnEq62NMByIpXSmlYwJeYogls2jZOBuuLY3I9oayYDBcMXXNucFy6w== 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=1779971309; 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=sm/7/hiG5AdiqpwVtmnCIQa8WXXDn2q7XbvA5Ou9MYQ=; b=N/Luvm0B3o63ugedboNcPMnCbRFhGbLVsMZ1C1y+M/YkRxxG4CeXHZvSfbQvPpbQVG+atv s5VpOv993MQhLjtX/e0t97pbcv+cTDWAmAbOQzfSEopmF6t8mIfjTn5ISkGKmlBNP2mEDS 1yukQeGeZBms54/s04hhaHrZGPUELPKsCDtLSS4kMS/4DCS+aObSwudzdo+cBM7zoOZls+ ND3vHa4Vihl46JDDGAcuEYJTswU9o0LfporgBIKNmgLKkt40d0ZjHrzUoYHnJdL3GZ8jEz 59aGRORBC2wUxsbfxKIoKKDiklN4BuR9KeifxbQaEh05YacmwLiJP9uvEQ//2A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR5PT14nQzmVj for ; Thu, 28 May 2026 12:28:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 44699 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 12:28:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 39f23af2ba4b - main - certctl: Style nits 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 39f23af2ba4b845eb7f4ec7ae4079a67557eb63d Auto-Submitted: auto-generated Date: Thu, 28 May 2026 12:28:29 +0000 Message-Id: <6a1834ed.44699.6b2c3e1d@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=39f23af2ba4b845eb7f4ec7ae4079a67557eb63d commit 39f23af2ba4b845eb7f4ec7ae4079a67557eb63d Author: Dag-Erling Smørgrav AuthorDate: 2026-05-28 12:28:22 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-28 12:28:22 +0000 certctl: Style nits MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57298 --- usr.sbin/certctl/certctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/certctl/certctl.c b/usr.sbin/certctl/certctl.c index 0a07703bf37b..462f6c1730a9 100644 --- a/usr.sbin/certctl/certctl.c +++ b/usr.sbin/certctl/certctl.c @@ -1093,6 +1093,7 @@ int main(int argc, char *argv[]) { const char *command; + unsigned int i; int opt; while ((opt = getopt(argc, argv, "BcD:d:g:lL:M:no:Uv")) != -1) @@ -1155,8 +1156,8 @@ main(int argc, char *argv[]) set_defaults(); - for (unsigned i = 0; commands[i].name != NULL; i++) + for (i = 0; commands[i].name != NULL; i++) if (strcmp(command, commands[i].name) == 0) - exit(!!commands[i].func(argc, argv)); + exit(commands[i].func(argc, argv) == 0 ? 0 : 1); usage(); } From nobody Thu May 28 12:38:31 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 4gR5d43Tzzz6fgpM for ; Thu, 28 May 2026 12:38:32 +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 4gR5d411Xgz3TXG for ; Thu, 28 May 2026 12:38:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779971912; 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=OX4u897WSAa4OnoeoyxLrihTQR428pSGrQRx5CH1pYw=; b=VbbdwXfyQge6q5Xr8KcySWqa7raZtySfEh9E2PkrItc0CP7Ps3X185b7Bj5dD36nZXt8Xk +upb4jWQ23THlb3poFZy8Sxfx1CMYncPqRf3cKCdUZUBrnG60ctjNe+Vqd4y6g8GQpQeRq sd5D307hUbYfloIXYgnBM56zz4IFeb4R3YqlTwWosk6WsUr+2Ser/DsbKepo0sNtDPdk8O zQo3RDYjcz7UmmmsWuIXGSfTBcSSDgZhQFggUiV+Sc+6gQM4JDtOSJ0SrnTLuOl7HH+QzU TRagWqJuaxmJoR8LTVOteGmlaltxLvkBZw12XUsaWYZ/fYMwKJGzya5zUW0H+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779971912; a=rsa-sha256; cv=none; b=p8IrxRSerCFxzWM52Nzs5eXnHwY86nws1J9SGpGY81t4W6kNVI0wSMItPcbiGXbuCgy0hx 5EuHS64vpNZvI/q5bnB7XuDpwPwdXvVyouaGmk3Kmx9N2sySR9TzYDYfd0X90591rkH4g3 BbQkFEwgtMTfZgpLsOvnWB5yivHwToQsXmfXWa3GXzm3jEIgViyPIjFEO9ebASTnTKJj+d RWzBJgZwy7cJqis4Snaas1FO1pdhvQL5/VZpvoU51LClfP57/KyMOqECYpKLBC2KAsHR1u U6nzEP3D4zRUpdGQSnRxjTXqogXuJjxT05U3sPvBh+3gDx7ZfIv62/t4tMAbpA== 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=1779971912; 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=OX4u897WSAa4OnoeoyxLrihTQR428pSGrQRx5CH1pYw=; b=XtufOzLwSHCRaJTY3UNBZjLMr44AtzAHU2wiFqS5VwkCvvobGgRb0e/RUYisSNaxrLe6Lj cxzLWNsik7KA/JswS3EGFgXcy8uraOjqYriBbtUY1dJHBqyaWdWyeOmI3Ke9bkbm6AeZYd t0N9WnfsD5rBk2bwX5DYQCinob2IBs2S1p+iPK6Y8NKtHxdz3sipnRm53we6bYJIgWKvqE btOJh9tcfcaFY5EP7iXykhhyg37I2L75gni9L/RrRDHRMKVTrKtdB3rkcGSfot9ZorPpea sMHrwWm5KcY7Co0hySXpOgtvoJ8WaA/AjHNWWIuqMvsfMD0XiJw0omPNuWHv8Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR5d36ycBzmt9 for ; Thu, 28 May 2026 12:38:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4556b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 12:38:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 67d61d18bb8d - main - amd64: extract uiomove_mem() from memrw() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67d61d18bb8debb4ffc51ef2248aa37ed0bfb8f5 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 12:38:31 +0000 Message-Id: <6a183747.4556b.3070f025@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=67d61d18bb8debb4ffc51ef2248aa37ed0bfb8f5 commit 67d61d18bb8debb4ffc51ef2248aa37ed0bfb8f5 Author: Konstantin Belousov AuthorDate: 2026-05-24 11:48:45 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-28 12:38:25 +0000 amd64: extract uiomove_mem() from memrw() Reviewed by: markj Tested by: aokblast Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49566 --- sys/amd64/amd64/mem.c | 103 +++++------------------------------------- sys/amd64/amd64/uio_machdep.c | 96 +++++++++++++++++++++++++++++++++++++++ sys/amd64/include/md_var.h | 6 +++ 3 files changed, 113 insertions(+), 92 deletions(-) diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index ab1e6cde6cd5..7d1f0f42d01c 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -61,10 +61,6 @@ #include #include -#include -#include -#include - #include /* @@ -72,99 +68,22 @@ */ MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); -/* ARGSUSED */ int memrw(struct cdev *dev, struct uio *uio, int flags) { - struct iovec *iov; - void *p, *vd; - ssize_t orig_resid; - vm_prot_t prot; - u_long v; - u_int c; - int error; - - error = 0; - orig_resid = uio->uio_resid; - while (uio->uio_resid > 0 && error == 0) { - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - if (uio->uio_iovcnt < 0) - panic("memrw"); - continue; - } - v = uio->uio_offset; - c = ulmin(iov->iov_len, PAGE_SIZE - (u_int)(v & PAGE_MASK)); - - switch (dev2unit(dev)) { - case CDEV_MINOR_KMEM: - /* - * Since c is clamped to be less or equal than - * PAGE_SIZE, the uiomove() call does not - * access past the end of the direct map. - */ - if (v >= kva_layout.dmap_low && - v < kva_layout.dmap_high) { - error = uiomove((void *)v, c, uio); - break; - } - - switch (uio->uio_rw) { - case UIO_READ: - prot = VM_PROT_READ; - break; - case UIO_WRITE: - prot = VM_PROT_WRITE; - break; - } + enum uiomove_mem_req req; - if (!kernacc((void *)v, c, prot)) { - error = EFAULT; - break; - } - - /* - * If the extracted address is not accessible - * through the direct map, then we make a - * private (uncached) mapping because we can't - * depend on the existing kernel mapping - * remaining valid until the completion of - * uiomove(). - * - * XXX We cannot provide access to the - * physical page 0 mapped into KVA. - */ - v = pmap_extract(kernel_pmap, v); - if (v == 0) { - error = EFAULT; - break; - } - /* FALLTHROUGH */ - case CDEV_MINOR_MEM: - if (v < dmaplimit) { - vd = PHYS_TO_DMAP(v); - error = uiomove(vd, c, uio); - break; - } - if (v > cpu_getmaxphyaddr()) { - error = EFAULT; - break; - } - p = pmap_mapdev(v, PAGE_SIZE); - error = uiomove(p, c, uio); - pmap_unmapdev(p, PAGE_SIZE); - break; - } + switch (dev2unit(dev)) { + case CDEV_MINOR_KMEM: + req = UIO_MEM_KMEM; + break; + case CDEV_MINOR_MEM: + req = UIO_MEM_MEM; + break; + default: + __unreachable(); } - /* - * Don't return error if any byte was written. Read and write - * can return error only if no i/o was performed. - */ - if (uio->uio_resid != orig_resid) - error = 0; - return (error); + return (uiomove_mem(req, uio)); } /* diff --git a/sys/amd64/amd64/uio_machdep.c b/sys/amd64/amd64/uio_machdep.c index 16915bccf9f5..11e6ad2b1da9 100644 --- a/sys/amd64/amd64/uio_machdep.c +++ b/sys/amd64/amd64/uio_machdep.c @@ -44,9 +44,11 @@ #include #include +#include #include #include +#include /* * Implement uiomove(9) from physical memory using the direct map to @@ -141,3 +143,97 @@ out: td->td_pflags &= ~TDP_DEADLKTREAT; return (error); } + +int +uiomove_mem(enum uiomove_mem_req req, struct uio *uio) +{ + struct iovec *iov; + void *p, *vd; + ssize_t orig_resid; + vm_prot_t prot; + u_long v; + u_int c; + int error; + + error = 0; + orig_resid = uio->uio_resid; + while (uio->uio_resid > 0 && error == 0) { + iov = uio->uio_iov; + if (iov->iov_len == 0) { + uio->uio_iov++; + uio->uio_iovcnt--; + if (uio->uio_iovcnt < 0) + panic("memrw"); + continue; + } + v = uio->uio_offset; + c = ulmin(iov->iov_len, PAGE_SIZE - (u_int)(v & PAGE_MASK)); + + switch (req) { + case UIO_MEM_KMEM: + /* + * Since c is clamped to be less or equal than + * PAGE_SIZE, the uiomove() call does not + * access past the end of the direct map. + */ + if (v >= kva_layout.dmap_low && + v < kva_layout.dmap_high) { + error = uiomove((void *)v, c, uio); + break; + } + + switch (uio->uio_rw) { + case UIO_READ: + prot = VM_PROT_READ; + break; + case UIO_WRITE: + prot = VM_PROT_WRITE; + break; + } + + if (!kernacc((void *)v, c, prot)) { + error = EFAULT; + break; + } + + /* + * If the extracted address is not accessible + * through the direct map, then we make a + * private (uncached) mapping because we can't + * depend on the existing kernel mapping + * remaining valid until the completion of + * uiomove(). + * + * XXX We cannot provide access to the + * physical page 0 mapped into KVA. + */ + v = pmap_extract(kernel_pmap, v); + if (v == 0) { + error = EFAULT; + break; + } + /* FALLTHROUGH */ + case UIO_MEM_MEM: + if (v < dmaplimit) { + vd = PHYS_TO_DMAP(v); + error = uiomove(vd, c, uio); + break; + } + if (v > cpu_getmaxphyaddr()) { + error = EFAULT; + break; + } + p = pmap_mapdev(v, PAGE_SIZE); + error = uiomove(p, c, uio); + pmap_unmapdev(p, PAGE_SIZE); + break; + } + } + /* + * Don't return error if any byte was written. Read and write + * can return error only if no i/o was performed. + */ + if (uio->uio_resid != orig_resid) + error = 0; + return (error); +} diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 4b98c5d8c418..0e8fe916490b 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -106,6 +106,12 @@ void wrmsr_early_safe_start(void); void wrmsr_early_safe_end(void); int wrmsr_early_safe(u_int msr, uint64_t data); +enum uiomove_mem_req { + UIO_MEM_KMEM = 101, + UIO_MEM_MEM, +}; +int uiomove_mem(enum uiomove_mem_req req, struct uio *uio); + #endif /* !_MACHINE_MD_VAR_H_ */ #endif /* __i386__ */ From nobody Thu May 28 12:38:33 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 4gR5d545Nhz6fgXm for ; Thu, 28 May 2026 12:38:33 +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 4gR5d50TWBz3TZR for ; Thu, 28 May 2026 12:38:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779971913; 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=mrnOM+XHG2kgSKZ6k1giOBtgKVRnZg47U2jInl7ZLaM=; b=y3B7BE/1+zbIddzzKjp8xu+Y/f+tIgJgj47khCD8jPGzA/Y6/pOY/wlxV4ZfPOBqPQYpS/ WpHNTp+aUhFkOOx8cjuDjjihwnITp0so5fh3/AOP7sINC+NGViKUYezAMcJ6eAnZKfoY+k XfqEG7p8+ehXm3+f6s94J1ygmo5pdN96Svhhxw4y3Q70ugvvIjYoVUhveDN+i9zlgMbTew JfaKR0f4PVW1wrZK+AKX/XVLMyjTsprKPYEpA6ok2/gVSDiXwCIi/bTNLzbf13SaJrNJho 6uKf17mSG03sGEQavGkmoKFHmdfgmPRoOqBqBFKXQy+0TYq3YZtTakHBxyTKCA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779971913; a=rsa-sha256; cv=none; b=O4Wa2xHDMdEhmjqxuljtrJeMpQ9ewGVDavgok7O8QD1KzpyDEUF95iHShEITxmmvEK9UT9 fs9pBkWqeJ+wfPAeuZn5QCExgB2UiP9c6HWHSH/upqtrh7S+f6NG+ZccHLWWJkonxm7WzH l46jcLOixw0adFQL4Y/bwvga1Vg8XCBhQ0NW9mdKaBVn4jjimxOIpepbtWL6NfOlLq11Jo Y5Sb3smb5cwpEsyCJAkgAI87hUpP3oQjaR1qQvjpqV1X6SduObTQkJx4W5lMzVpEs3IHlV 8X4jcmfnE1t4NLIGQCsnNyMpJ7OL3k69ba5y2rRAcjL8Ptex1RoEflifm9TRjg== 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=1779971913; 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=mrnOM+XHG2kgSKZ6k1giOBtgKVRnZg47U2jInl7ZLaM=; b=kkFy2+ce/+RwAKjDXii+f1ZskHcMKOrmoDqQekOPeApnFDc5ZHpoPBeLJQ2P+0BAUmHjK1 7UbuGiBN0SYmgj4/r5mnNlD7Gwjgd3+IAjmM01PJ4l/8ogWW0vEe9D63AEsKmNSrO8+sAP aoOrQRBq4rRrmXBrS4zYLSn68dr4ZSWH5gOCli2rF28yf53Ojn1IZN2qEMSeQ22+DzkO/y 2dB8aWojljJvEno2F8jd6+7yN6UaYFb8FPBLBHBfRXLtZyqnwIgepxiWqowgtsajAXR2c1 e8MOxluwSpL7eFUa8u1x5B98N0juWB91U3I2TGt5YEnyaDXRtaE72Bq34El8GQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR5d504BPzn53 for ; Thu, 28 May 2026 12:38:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 45808 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 12:38:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 7b2702ee25f5 - main - sys: add safe_read(9) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b2702ee25f5230011fa7f8f650b65b37248fcca Auto-Submitted: auto-generated Date: Thu, 28 May 2026 12:38:33 +0000 Message-Id: <6a183749.45808.5d99f3ce@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7b2702ee25f5230011fa7f8f650b65b37248fcca commit 7b2702ee25f5230011fa7f8f650b65b37248fcca Author: Konstantin Belousov AuthorDate: 2025-03-29 17:17:01 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-28 12:38:25 +0000 sys: add safe_read(9) The MD function with MI interface to provide a way to read arbitrary (canonical) KVA. amd64 only for now. Reviewed by: markj Tested by: aokblast Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49566 --- sys/amd64/amd64/machdep.c | 18 ++++++++++++++++++ sys/sys/systm.h | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index dbad85096a1d..db2fd5927f7f 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1852,6 +1852,24 @@ wrmsr_early_safe_end(void) memset_early(gpf_descr, 0, sizeof(*gpf_descr)); } +int +safe_read(vm_offset_t addr, char *valp) +{ + struct uio uio; + struct iovec iov; + + iov.iov_base = valp; + iov.iov_len = 1; + uio.uio_offset = addr; + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + uio.uio_resid = 1; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_rw = UIO_READ; + uio.uio_td = NULL; + return (uiomove_mem(UIO_MEM_KMEM, &uio)); +} + #ifdef KDB /* diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 7f655b48ba08..88c25f06e0cb 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -553,6 +553,14 @@ void intr_prof_stack_use(struct thread *td, struct trapframe *frame); void counted_warning(unsigned *counter, const char *msg); +/* + * Safely read one byte of kernel memory at address addr, placing the + * value into *valp. Returns 0 on success, EFAULT if read was + * impossible, e.g. due to the address not being mapped or not having + * necessary permissions. + */ +int safe_read(vm_offset_t addr, char *valp); + /* * APIs to manage deprecation and obsolescence. */ From nobody Thu May 28 13:02:17 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 4gR68V0Wtnz6fj5H for ; Thu, 28 May 2026 13:02:18 +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 4gR68T50yqz3WWL for ; Thu, 28 May 2026 13:02:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779973337; 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=0qnQ16s+qqvzc0cj7Ni5Kr+Er5JYBm2wUbkuJypCL28=; b=VPZj6Blo/KIN4jLXngB2J3S9U+HgwIsI9JcYphi01ozP5mT7FaJfLSqYHHjq99HuOuaXy9 pnBMvSfF7xxJg9tuvwXkaGL1ls8lTIIIGH0/WxMFUmGAEdlEDldpgaFukMw1qpszGQffZt Bx+W7oR/tAM+KX5PbnsG053mzTq2BYQSUDVZkOQvvecfsbHG7xf+cM6olIt5nj/bKvegw/ fYdjOe5VtVoVjXthbDRzfLBlGart27BWjnjCz0kh1XwnO67qiN0QUf8j8gbQyP4BGQpr43 F782aXmZkvZ+C+HdXmYJEV1TD+Q0F8JToSiTJPiP+LwnLZxS9BMl/M5gIsClrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779973337; a=rsa-sha256; cv=none; b=bb8/OCHmb0jB6zqDV5Mmbp0vjqm9HCUoBqplLKLmmz2U7nJVuulEVYLrUVwvSHiVwN7oMt 4TDvKB7uS3Ow4yVpJcmhKDQSKUz523f7k36aj6VyuxWZ1zOns8ENfp2KaTMVPVMmoZBK1N RnZWdDdNMAkA+OcrQWHNeKjz1b5FZ4eCVG6HYkNpLojwErjzqsJQ07mKf0djt/8yiL2JC0 yoe81RqxLZfvlPLjtXbL7Vc+x/PUB+3VyklxuVaN/AeseMKJT8H8GdFJb7pS1UcA24XD/y 5qVnkaXIKJBZX21miNqh3L248ED1kL2gj4zIxTjxcsHf6R7wLSs/Dop4ZF1ylw== 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=1779973337; 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=0qnQ16s+qqvzc0cj7Ni5Kr+Er5JYBm2wUbkuJypCL28=; b=IosM6zxGDfg28PCkfRkuodtAF8sX85ulJMJCeI5W6hWOVQRcqocrszogUn8ecge4d6QfEl LeT8wg3xfSe/m7/hYofKdu6b3cYR1GvKIL0ZdCWfNgiJyaFCU8NQHzD8EvIrb3547rNghL f9TI2m+Bq1Ay+Su/2RIKxKlmPFq9BD4MOJH1U4IEcswBTNuHlNCoqR4KOPw+5jct/E6+NM SxdsgTE/c3UJwXy8nihZwA/9uYPb0OoEyGVS6vf1pS0p2BxaDIp9rGM/50ABvPE003eFa8 NtWLbxwgnd67+IqMzJpLXUE+Gcgm3LjCaA64UShZtS1MXTV5T1T/GWwpD4Cy5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR68T4Rvrzn6R for ; Thu, 28 May 2026 13:02:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 47551 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 13:02:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: fc9dc8482396 - main - snd_uaudio: Lock usbd_transfer_start() in uaudio_mixer_ctl_set() 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc9dc848239652ec1e4135adb4833a5f002cef0f Auto-Submitted: auto-generated Date: Thu, 28 May 2026 13:02:17 +0000 Message-Id: <6a183cd9.47551.25b33885@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=fc9dc848239652ec1e4135adb4833a5f002cef0f commit fc9dc848239652ec1e4135adb4833a5f002cef0f Author: Christos Margiolis AuthorDate: 2026-05-28 09:31:52 +0000 Commit: Christos Margiolis CommitDate: 2026-05-28 13:02:01 +0000 snd_uaudio: Lock usbd_transfer_start() in uaudio_mixer_ctl_set() This section would be previously locked by sound(4)'s mixer lock (see e87654db5a09 ("snd_uaudio: Stop using mixer_get_lock()")), but snd_uaudio(4) no longer uses it. This particular code path was missed during testing, because my sound card does not reach it. Fixes: 9a00e0b8ca56 ("snd_uaudio: Do not use snd_mixer->lock as mixer_lock") Reported by: netchild Tested by: netchild Sponsored by: The FreeBSD Foundation MFC after: 6 days --- sys/dev/sound/usb/uaudio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 27d5009da4fa..eedd52774b70 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -5386,8 +5386,8 @@ uaudio_mixer_bsd2value(struct uaudio_mixer_node *mc, int val) } static void -uaudio_mixer_ctl_set(struct uaudio_softc *sc, struct uaudio_mixer_node *mc, - uint8_t chan, int val) +uaudio_mixer_ctl_set(struct uaudio_softc *sc, unsigned index, + struct uaudio_mixer_node *mc, uint8_t chan, int val) { val = uaudio_mixer_bsd2value(mc, val); @@ -5396,7 +5396,9 @@ uaudio_mixer_ctl_set(struct uaudio_softc *sc, struct uaudio_mixer_node *mc, /* start the transfer, if not already started */ + mtx_lock(&sc->sc_child[index].mixer_lock); usbd_transfer_start(sc->sc_mixer_xfer[0]); + mtx_unlock(&sc->sc_child[index].mixer_lock); } static void @@ -5482,7 +5484,7 @@ uaudio_mixer_set(struct uaudio_softc *sc, struct snd_mixer *m, for (mc = sc->sc_mixer_root; mc != NULL; mc = mc->next) { if (mc->ctl == type) { for (chan = 0; chan < mc->nchan; chan++) { - uaudio_mixer_ctl_set(sc, mc, chan, + uaudio_mixer_ctl_set(sc, index, mc, chan, chan == 0 ? left : right); } } @@ -5523,7 +5525,7 @@ uaudio_mixer_setrecsrc(struct uaudio_softc *sc, struct snd_mixer *m, uint32_t sr for (i = mc->minval; (i > 0) && (i <= mc->maxval); i++) { if (temp != (1U << mc->slctrtype[i - 1])) continue; - uaudio_mixer_ctl_set(sc, mc, 0, i); + uaudio_mixer_ctl_set(sc, index, mc, 0, i); break; } } From nobody Thu May 28 13:04:02 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 4gR6BW0s9vz6fjNn for ; Thu, 28 May 2026 13:04:03 +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 4gR6BW0C0wz3X70 for ; Thu, 28 May 2026 13:04:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779973443; 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=bOJ7NDZSFij0b8n7uMBCfncsMEgI5DuG1JrN5JVpuoE=; b=AtoNdIVyFw0ikCvdgWI9rOCI16AFp1DP0hRXiFAJi6jnLlenLM3kxLBhkoPl08h/C73lDV 0yLhROnVVU4WpNuQBdJyD+UVFZ7FzFlDCPZb3s5QMZXPoCghl5eSrOO8XCe8i9bubSeQR0 JMFUeudcqcJLnMN//nGjfCFoao8HRoRH4L1uu9JmG4WDps4u//Zv4xNsnc40pxOzz/GsMJ lX+ThsNZfESqqyul43XrmHp292kMTKXBH1Xi1NquBmq1KbxKZhYp4er2WP3gdKR/wgEocS iW7BYKeUBWtp6N/KV+nr3AnF/OSmSYRcV4zqCBz1LVzdnHO8YJujd7yVvphPSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779973443; a=rsa-sha256; cv=none; b=fRapD2n0LbRpOPdzQJUqkcoBhS3yr5KTHdXA5BiD74r+qRjcna8jv0Vc4YVTjkB10tahS2 B5/e0vSHB8uO04udv5MZ6MKD0Q40Mh2xssljjCfTugYel4EOS0XYNk76ycmkt/VSFl1xAl 7bij2FYoYQmLM9Sp6LXYMjl/m4B+KZE/2/wZy1Q4YZnGhTpJrsJAP3XoEwYVRT28xhlq6O ZF4G2P1jHHQyij3ZA27iZvdNyUi+KFlbJUnvtV0i9/byMhRY1edLcy/00FLnNFjUBKx8/b 7a7/vD073dqKsqAGlTwS2OjH04YiQRhl/qXVsMSbl9gdc0rO+62kC4eER5EzRw== 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=1779973443; 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=bOJ7NDZSFij0b8n7uMBCfncsMEgI5DuG1JrN5JVpuoE=; b=lJgYY762ZU5+91JP678Ba9k+fMZqDX/yL94LkCKOYhZIqG+nRvfifXh+FVJv01T5fV2Bzz /wN9PqTbocJLlespE0ilJ2Bw2ZsSYlIvyNC4DkUJvIhYJiiquQsZdfmWoHUlG0urmLoQUQ P+qYVa6TyxRDbBMk87440HUFWUOGLLBwzRGupoW0O1PcknbxwE6ug3htv7NuOaoq8IeeSV N0U1ftot+rtMW14b/gkaYsdrA9ibpcG0hIF/AFmYpzKhqMTc+yctxn1AO/+CHBg7ZIjWV2 KFvTDIKcvT+NxeJvVgUn/ufbg8MT61qKaFq0NB4Ajb/g5z1tolF26mlRepQo6g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR6BV6vVczn6V for ; Thu, 28 May 2026 13:04:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 45b69 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 13:04:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: f9f46294d6af - main - bsdinstall: Use libarchive secure flags for extract 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9f46294d6af2a937afa74938bd4bb6826cbb921 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 13:04:02 +0000 Message-Id: <6a183d42.45b69.1e442ab1@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f9f46294d6af2a937afa74938bd4bb6826cbb921 commit f9f46294d6af2a937afa74938bd4bb6826cbb921 Author: Ed Maste AuthorDate: 2026-05-27 13:29:21 +0000 Commit: Ed Maste CommitDate: 2026-05-28 13:03:45 +0000 bsdinstall: Use libarchive secure flags for extract This doesn't really matter, as we trust that the installer tarballs are not malicious, but it doesn't hurt to set these flags. Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57274 --- usr.sbin/bsdinstall/distextract/distextract.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/bsdinstall/distextract/distextract.c b/usr.sbin/bsdinstall/distextract/distextract.c index 32bd9453eb80..35cf19aae33f 100644 --- a/usr.sbin/bsdinstall/distextract/distextract.c +++ b/usr.sbin/bsdinstall/distextract/distextract.c @@ -291,6 +291,8 @@ extract_files(struct bsddialog_fileminibar *file) /* If that went well, perform the extraction */ if (retval == ARCHIVE_OK) retval = archive_read_extract(archive, entry, + ARCHIVE_EXTRACT_SECURE_NODOTDOT | + ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS | ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL | ARCHIVE_EXTRACT_XATTR | ARCHIVE_EXTRACT_FFLAGS); From nobody Thu May 28 14:07:00 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 4gR7b84KSyz6fmxC for ; Thu, 28 May 2026 14:07:00 +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 4gR7b83cLcz3dQC for ; Thu, 28 May 2026 14:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779977220; 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=49dmHzPFfrBtQC1OfrZhJ3NCGiJEhH5ZbLM+8d1Ju+c=; b=yCCeJyuQ8onX+KaEMdA6qQ/IoUwJYFH7bwNDNT6prijybwlzn9MSwqWJ9vyFt3BnEE8xnH b2mdGJny9JUZLe45dFRzGMxiDSSkC6/pt0nzAqyfwqoi6Y376Ewvx/0W1wvmAO8IcdY2Jd k1HKx3tJatErdHleWLMuA360i/Nt2SEd46EFu0YRinbf0SmOoJGypTrC7Qvus9z6y0E/ee eY7Dt2+33mLXZyxtOvwZpSr0VX9tUEGxpx3x1r05276RoGuDVU4KOPDPIUHcSS0dhLaAKB AnKjMG3K6drZ0CHFfMzqfpxPoAja4bgrDObWEpDjlzIdsfsGRiczpr//xS671A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779977220; a=rsa-sha256; cv=none; b=mAqjmi3LDbivdPvCvKu8/sSHxk3izjrFnDAUPzOnI2+yvBuXHgJ+rgfpMWCdEZX7rv+WUe eE/VCHCje0S4qdmlpLryEsunR9iOJ8QwnqsWLelQJXg4InQQJjJxApuam+HukSWwObVz4K tqGKGc44sJQSBw1yb+vIHasYL1cioOaNVnRbmgzLdVTuXUWE0pChC6jnCTwNW14rnzyAIY VqxUJQKGYdSKk2cJTvDavDzvM7M3h4lfsjO3DGH3oKuGdrVoa4Js5gVMNpPJfasrl2CGP3 /Qi5iAoAYOFTNbFI0KbCNBLrt1fg/uoFyzumwE8Vy9+Y0pYepcI0b93uUyqkdA== 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=1779977220; 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=49dmHzPFfrBtQC1OfrZhJ3NCGiJEhH5ZbLM+8d1Ju+c=; b=lONgwazG7l2k43B6/jEbBqbzWFqoejaZm6bNMKdHYhPor1aRZzgh2QVDOsnB6SrZQy+5JR GTCZZG/LKR7c68oVpULQTMXTt+E/Gr/26wnMOTXNp6mAaFTjMXKnPh/YQ1jdZf0W+VZLgj 7Tk17/2tUcoo2ZpkjgLuUY+uu3u6c6ry2LLM5/xWYrmjcM84+LGJ70Dt16jq5hLQANPEjI Vgp3MS7/IvEfV7CTVHfUSL6kFh+glSH2GCOhE7P3qXW39X/NCFjNtyU+zjSMvZfG2OKnNX SQ3d2clDafvkeXScUZaFipw1v27QxBHUm3pVXYKwfLqIPav+2rZEeHEp59sdbg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR7b82g3dzq9j for ; Thu, 28 May 2026 14:07:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 20c80 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 14:07:00 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: a576e5140ef3 - main - rc: virtual_oss: Define some variables in rc.conf 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a576e5140ef352af6cf227528d1bfc6b964516c8 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 14:07:00 +0000 Message-Id: <6a184c04.20c80.27c0e61a@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=a576e5140ef352af6cf227528d1bfc6b964516c8 commit a576e5140ef352af6cf227528d1bfc6b964516c8 Author: Christos Margiolis AuthorDate: 2026-05-21 11:38:22 +0000 Commit: Christos Margiolis CommitDate: 2026-05-28 14:06:06 +0000 rc: virtual_oss: Define some variables in rc.conf They will now be part of /etc/defaults/rc.conf and be accessible by sysrc(8). Fixes: 70e27ecba518 ("virtual_oss: Introduce virtual_oss_default_control_device rc variable") PR: 295560 Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: 0mp, jrm Pull-Reqeust: https://ron-dev.freebsd.org/FreeBSD/src/pulls/33 --- libexec/rc/rc.conf | 6 +++++- libexec/rc/rc.d/virtual_oss | 12 +----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 75420e42cdeb..27e8c8456b6f 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -736,7 +736,11 @@ newsyslog_flags="-CN" # Newsyslog flags to create marked files mixer_enable="YES" # Run the sound mixer. opensm_enable="NO" # Opensm(8) for infiniband devices defaults to off nuageinit_enable="NO" # Run nuageinit at startup -virtual_oss_enable="NO" # Run virtual_oss at startup + +virtual_oss_enable="NO" # Run virtual_oss at startup. +virtual_oss_configs="dsp" # List of configurations. +virtual_oss_default_control_device="vdsp.ctl" # Default configuration's + # control device. # rctl(8) requires kernel options RACCT and RCTL rctl_enable="YES" # Load rctl(8) rules on boot diff --git a/libexec/rc/rc.d/virtual_oss b/libexec/rc/rc.d/virtual_oss index 73a486f547a5..07f81aeed4bc 100644 --- a/libexec/rc/rc.d/virtual_oss +++ b/libexec/rc/rc.d/virtual_oss @@ -22,13 +22,9 @@ status_cmd="${name}_status" required_modules="cuse" -configs= pidpath="/var/run/${name}" -default_unit=$(sysctl -n hw.snd.default_unit 2> /dev/null) - -# Default configuration's control device. -: "${virtual_oss_default_control_device:="vdsp.ctl"}" +default_unit=$(sysctl -n hw.snd.default_unit 2> /dev/null) virtual_oss_default_args="\ -S \ -C 2 \ @@ -42,12 +38,6 @@ virtual_oss_default_args="\ -l dsp.loop \ -t ${virtual_oss_default_control_device}" -# Set to NO by default. Set it to "YES" to enable virtual_oss. -: "${virtual_oss_enable:="NO"}" - -# List of configurations to use. Default is "dsp". -: "${virtual_oss_configs:="dsp"}" - # Default (dsp) virtual_oss config. : "${virtual_oss_dsp:="${virtual_oss_default_args}"}" From nobody Thu May 28 14:07:01 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 4gR7b96LxTz6fnKV for ; Thu, 28 May 2026 14:07:01 +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 4gR7b9539nz3d2s for ; Thu, 28 May 2026 14:07:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779977221; 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=JJVEqDVcwkgy+XDSWbmIby0RGLyJQSlaWV5EjT687Ck=; b=s2MeCZ+NKfL9uI0zB+cG35FK9n+kvC9jZWLpAvvBAzGFcS8mERfyl7sB9BTZUE3KEn0GeJ 0+GZSY4e2oej9IAd/RtWaiTT+PfGVIyzkIrXPE76faKMiwbNFdfkaOOSkyMG4mC5yIhDua 4NjsxM1QhrqR8dTJerTCn8SNMlAjSGlBG1ITrRoUbxaA9OkeVdc9c9Eh4+gSqt/9MPyQQO amPcUWgP9DKUgEw8O01Y+smKO8WYyBnJ0EIK91vfdU7uwhgsoSG2ZzYorh98i4LylZ5exB UQ57sMQWf4jTBwddVC1RohCbHaU8tKJRRjJGQX0hab0FMRUiYw/NTjm5qId62A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779977221; a=rsa-sha256; cv=none; b=MH9hOGUpbq+3hwflwimJMkW9OjJH3vNlZDJl8YXk7AvW2p+ZFDvH3DYHF5ebEyByOFu8xU 5yoJHfSWg9MoBYIdnZqUjMXPEniEiAo6z/ROL7ZFGzZBG6dSSVFGwfuYjbt1Rgpkrm/zqY mr5fjZhPuDrnywDcN+MvETQD+rcuDqqLB8sTj54VN5wcQuzNOj7TDMbPTAu60wk7ykovFv TmR/ViS6v6V+thTWyh2Lx/abbapH4JuysQEd97vxnT06qCbHYUpEspgixZLbm2NZPNlFAh /XXCSHLgC1vKOdFNlXBqnxi63lU1jm2EV8hABoSQTx4Yc5OzUpHpGxvC/kPGeA== 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=1779977221; 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=JJVEqDVcwkgy+XDSWbmIby0RGLyJQSlaWV5EjT687Ck=; b=BTTBq82GNqnm4uEVk3vyX5ZZ1M2WJcxcy0qKSbBYcRexpe9BiGVRUan1pxM0JDy01cJmFA Kh3H8o7uDNAk0yQUUPfFK2TkXhb5/v+J96JGPytYZMTvduQYRV7PH7YK9DIYsbLZZhZn85 AGYcZ/egeNUKNATH7o7k12jK51xoEcCL/hWRgl8p6zJqefWox3JsaydC4EFg4gtExtJiCd H8qIJ+q+Q8qZ5YyOaziMbCnNaCZnO+IutsV5HfA3kSpVgqRiG9xoKCAzJntyTUe8jb8iHi 6858yZPx3vaNBMXSCpTUJkkPEivP9n3li4IZJN4Axd7blC+xx60IjSHSYXkgCg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR7b92yfVzqTj for ; Thu, 28 May 2026 14:07:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1f89b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 14:07:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 803f686938ec - main - rc: virtual_oss: Wait for process to exit 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 803f686938ec2472d54a26bff668e48cc4999558 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 14:07:01 +0000 Message-Id: <6a184c05.1f89b.758265a9@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=803f686938ec2472d54a26bff668e48cc4999558 commit 803f686938ec2472d54a26bff668e48cc4999558 Author: Christos Margiolis AuthorDate: 2026-05-21 16:26:46 +0000 Commit: Christos Margiolis CommitDate: 2026-05-28 14:06:06 +0000 rc: virtual_oss: Wait for process to exit Sometimes virtual_oss processes do not exit immediatelly. If we do not wait for the processes to fully exit before returning from virtual_oss_stop(), then the service restart operation might call virtual_oss_start() too early and fail, because it will think the service wasn't stopped and is still running. Reported by: jrm Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: 0mp, jrm Pull-Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/33 --- libexec/rc/rc.d/virtual_oss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/virtual_oss b/libexec/rc/rc.d/virtual_oss index 07f81aeed4bc..dd3bbe41c094 100644 --- a/libexec/rc/rc.d/virtual_oss +++ b/libexec/rc/rc.d/virtual_oss @@ -76,8 +76,10 @@ stop_instance() if [ -z "${instance_args}" ]; then warn "no such config: ${config}" else + pid="$(cat "${pidpath}/${config}.pid")" startmsg -n "Stopping virtual_oss config: ${config}: " - kill "$(cat "${pidpath}/${config}.pid")" + kill "${pid}" + pwait "${pid}" rm -f "${pidpath}/${config}.pid" startmsg "done" fi From nobody Thu May 28 14:07:02 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 4gR7bC0jq0z6fnKY for ; Thu, 28 May 2026 14:07:03 +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 4gR7bB48snz3cnq for ; Thu, 28 May 2026 14:07:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779977222; 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=hZKFNX4380R4srrXcDVB3gQw0TRnW7Ep2Dh29pfJT6A=; b=FIdEsfMKjGctelRwogJqAX2zJAH5Ak/VjZFD0T+UlbwNBvkk98VrEMhCD4Csef4yv710qZ kLCx8ZhaKC244i9HNNgjm7PBt6qsTKvPo9o1qz/HVzV9XMiCGyDGCXO36+0mQI+5qQ+WaG 36MIqelAIYlXpGaID7COq2oz0l5t9VtMUcrNXCIE/iQ0GSdJpM7LAxKJ0+WVNyjYyxOY1V 3ZekjMFpDNAdHlKpMUeahNeph0UokNXbxMs3DdR2k0YGeebB3BnduRgEdfXaXEYPMconO/ lSVn3QosAkq0BU/yF+S3oNdswC7m0IxNkWG4kUetZSGWFd8UUZLLhle2u78JIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779977222; a=rsa-sha256; cv=none; b=XKWgRg6XaBe2nCU5CVvRs9t8taF6QsT/WFmgaw36GBVmU02kKx9mWHwi6J8q7wjHBZMTR9 +xOhJmKbazzTFRsy15Q627iK1tZn6bZquOtJHRu2LhT9/LbCE/zf7n7cstZuXKm3VvABK8 aCpmRUEXxpNBkx30CaYcWdRD4KWDYBz6nscNkP8nZg/FrHllrYf9egXQBlMd4NiOAJYVej Iwt2ZG/XwNP+zW55MrHXnMLJ227yotf0QDQkpbbY0vGY9X+y/tiKLzTWED/DMlA5XL10tv gECnTrB/8olAWtWaD4YI4f7vyORn/xNDqVyPrsr16HgIOqUZZn5xfH89F+/i3w== 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=1779977222; 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=hZKFNX4380R4srrXcDVB3gQw0TRnW7Ep2Dh29pfJT6A=; b=AtS3IauLgGzGo9C6hSW/K5LpYh9FAFAIjg2YJngqdFTutSxg26nvw+3xqhXaqkuMej98pU 6j5zUGvWo5RRXtP6NzapWsbHwtu58QERcHs1rEHOdLN2rXBckaei9YPKRwkwE1rditArzO 64DyyG6/Clw371kPiGyMsx6al7OFWMhhz4YqPXsjgqRs7JogOH9Ft7LPMGclhp+MVhnWX1 q7MXqK0zlST5Zo1sHytRTZ9DMghhHwNw8Q20ansgRAkgYKcLxm62QGyEVLm+3tyhVovfsR Y3qomTLI4jTDwo33Bzy8nZUoYzfnWTYIbLKXWSquTCYSstUWG8z1IMTGvFr43A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR7bB3T3fzqBw for ; Thu, 28 May 2026 14:07:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e964 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 14:07:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: b2677d002edb - main - rc: virtual_oss: Handle absent pidfile properly 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2677d002edbe9308b1f8cecd1a5fc515d2a5deb Auto-Submitted: auto-generated Date: Thu, 28 May 2026 14:07:02 +0000 Message-Id: <6a184c06.1e964.3e910c9e@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=b2677d002edbe9308b1f8cecd1a5fc515d2a5deb commit b2677d002edbe9308b1f8cecd1a5fc515d2a5deb Author: Christos Margiolis AuthorDate: 2026-05-21 16:53:27 +0000 Commit: Christos Margiolis CommitDate: 2026-05-28 14:06:06 +0000 rc: virtual_oss: Handle absent pidfile properly Instead of throwing errors from the programs that use it, print a warning if the file does not exist. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: 0mp, jrm Pull-Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/33 --- libexec/rc/rc.d/virtual_oss | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libexec/rc/rc.d/virtual_oss b/libexec/rc/rc.d/virtual_oss index dd3bbe41c094..9861545b8bfc 100644 --- a/libexec/rc/rc.d/virtual_oss +++ b/libexec/rc/rc.d/virtual_oss @@ -76,12 +76,17 @@ stop_instance() if [ -z "${instance_args}" ]; then warn "no such config: ${config}" else - pid="$(cat "${pidpath}/${config}.pid")" - startmsg -n "Stopping virtual_oss config: ${config}: " - kill "${pid}" - pwait "${pid}" - rm -f "${pidpath}/${config}.pid" - startmsg "done" + pidfile="${pidpath}/${config}.pid" + if [ ! -f "${pidfile}" ]; then + warn "not running: ${config}" + else + pid="$(cat "${pidfile}")" + startmsg -n "Stopping virtual_oss config: ${config}: " + kill "${pid}" + pwait "${pid}" + rm -f "${pidfile}" + startmsg "done" + fi fi } From nobody Thu May 28 14:08:39 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 4gR7d35t6mz6fnQW for ; Thu, 28 May 2026 14:08: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 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 4gR7d351Xsz3fV6 for ; Thu, 28 May 2026 14:08:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779977319; 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=Ckyailyrz25DgJt7zFRT3eRT6+RFLOXuBl1L4wubGvQ=; b=EJ4cgfDMaKRqxO56SSAoa1K6zFddMof0F/9HEkybMf3HTRcMNwJ3qNrQOy54VB4veLYt+U kV9rUAxAk+6FZ/RQk+CqlGX1TyCONPDJR5JVe6bZPNG/h8jQPHay84cntdUtwe1j8iQNuQ K+4eMg/sLLhYAoYXmtaMNW5VqL+QS/wR82k9ILZ3qjBa+2dEgPuDg96cxsSe5G5BnLI5Xd Jv7hQj3d0hYizfWYgnTKfP2tf23hQSytu+WiQ/X6a8SIZprl0eojSyit0uP5V8CnhC3yY5 4imacUcqcmiN9yVzrOiQbNgBMBo2EDDlKlCthmwRg0AjoaDwrES/bW5KoBEuAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779977319; a=rsa-sha256; cv=none; b=XAq/qYn+LHIw+zdbbtYyl5ozDDeZ73j88bdXdmOknPBoqvPPxExsRGJKABY/OAd3y2W9j9 0GbrrsaGRNMkc3jIKQfUCVx1G8YDOcDwN61WFCKq+ivfZ9WxWwDrke0vCjRs91aHN7aiHV 4i0ePcWYqk66rz6RfPe3wlRjecSQ46fXvxYClrMgDQGeoD2THKOYbkfUxnTX5DYdSZv5pY XDrzXUUdyUSIkmH6E6CYMXOAP84WK2nKQVxygAwnRygKWBsTyc2242EbnHc7VBoLkqilAO 2hOuy7Mbw7ECksy9cCk5RgLRWGQLXMm8K7Zy00esNNyoVMXZFIYgoRnfSuUNhw== 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=1779977319; 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=Ckyailyrz25DgJt7zFRT3eRT6+RFLOXuBl1L4wubGvQ=; b=wHNEeQLfllI9DqmRkVe973gB8Hxq973q79PBKsyN75jw1l1pvCQvFhUJ0YVLrgRQHfrrPw m77azUmIvJxHiW8VlTiABO6I617onGW0hgIZue5Rm7SlZbHpe0npI0FPMH3ANLb4PleZsW TSJ0fRIfnSmD1PGoi1ESLiA2CJmOf41345oqIrVc1tDn9B/UvdA3AToBnEOAAFN099cqYy diVfaOgE9f0blWoJP77XJLN2ngfA9urZri4RHMRJh9BvVGT97JBf3z+OjLtuLFqyMyS/zP XNLjR725VkYowDLQQwJo1pAHUsLz4DBLvfSIlANCofl5pKLMwatxeMzcscLkBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR7d34MBCzpwJ for ; Thu, 28 May 2026 14:08:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2041a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 14:08:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 9fb56421425f - main - sound: Centralize and improve hot-swapping 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9fb56421425fa35e56ce294284c08b09852052a5 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 14:08:39 +0000 Message-Id: <6a184c67.2041a.8cbcb0c@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=9fb56421425fa35e56ce294284c08b09852052a5 commit 9fb56421425fa35e56ce294284c08b09852052a5 Author: Christos Margiolis AuthorDate: 2026-05-21 12:22:38 +0000 Commit: Christos Margiolis CommitDate: 2026-05-28 14:08:20 +0000 sound: Centralize and improve hot-swapping Introduce pcm_hotswap(), which is responsible for sending devctl SND/CONN notifications. There are two user-visible improvements with this patch: First, in pcm_unregister(), instead of just sending a SND/CONN/NODEV notification when all devices have detached, we also switch to the new default device if the previously default one has detached, but there are more left. Second, in pcm_register(), if the device happens to also be the new default device, we hot-swap to it. Additionally, if hw.snd.default_auto is set to 2, then we will essentially be hot-swapping to the newest attached device. The latter is especially useful for laptops like the Framework 16, which comes with a built-in snd_hda(4) speaker-microphone-only device, and headphones can work with the Framework Audio Expansion Card, which does not extend the snd_hda(4) device, but is in fact a separate snd_uaudio(4) device. To achieve automatic audio redirection between headphones and speakers in this case, there has to be a way to switch between different devices. The way the Audio Expansion Card works is by having snd_uaudio(4) attach to it when the headphones are plugged, and detach when unplugged, so this patch, along with hw.snd.default_auto=2, can pick up those attach events and switch automatically. Combined with the pcm_unregister() update, it becomes possible to switch back and forth between headphones and speakers. While here, be more robust and lock around snd_unit reads. In collaboration with: jrm Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/sound/pcm/sound.c | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index d98952d7a984..235142eb5209 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -77,11 +77,30 @@ snd_setup_intr(device_t dev, struct resource *res, int flags, driver_intr_t hand return bus_setup_intr(dev, res, flags, NULL, hand, param, cookiep); } +static void +pcm_hotswap(void) +{ + struct snddev_info *d; + char buf[32]; + + bus_topo_assert(); + if (snd_unit >= 0) { + d = devclass_get_softc(pcm_devclass, snd_unit); + if (!PCM_REGISTERED(d)) + return; + snprintf(buf, sizeof(buf), "cdev=dsp%d", snd_unit); + if (d->reccount > 0) + devctl_notify("SND", "CONN", "IN", buf); + if (d->playcount > 0) + devctl_notify("SND", "CONN", "OUT", buf); + } else + devctl_notify("SND", "CONN", "NODEV", NULL); +} + static int sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS) { struct snddev_info *d; - char buf[32]; int error, unit; unit = snd_unit; @@ -95,13 +114,8 @@ sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS) } snd_unit = unit; snd_unit_auto = 0; + pcm_hotswap(); bus_topo_unlock(); - - snprintf(buf, sizeof(buf), "cdev=dsp%d", snd_unit); - if (d->reccount > 0) - devctl_notify("SND", "CONN", "IN", buf); - if (d->playcount > 0) - devctl_notify("SND", "CONN", "OUT", buf); } return (error); } @@ -373,6 +387,7 @@ int pcm_register(device_t dev, char *str) { struct snddev_info *d = device_get_softc(dev); + int err; /* should only be called once */ if (d->flags & SD_F_REGISTERED) @@ -417,6 +432,13 @@ pcm_register(device_t dev, char *str) vchan_initsys(dev); feeder_eq_initsys(dev); + sndstat_register(dev, SNDST_TYPE_PCM, d->status); + + err = dsp_make_dev(dev); + if (err) + return (err); + + bus_topo_lock(); if (snd_unit_auto < 0) snd_unit_auto = (snd_unit < 0) ? 1 : 0; if (snd_unit < 0 || snd_unit_auto > 1) @@ -424,9 +446,11 @@ pcm_register(device_t dev, char *str) else if (snd_unit_auto == 1) snd_unit = pcm_best_unit(snd_unit); - sndstat_register(dev, SNDST_TYPE_PCM, d->status); + if (snd_unit == device_get_unit(dev)) + pcm_hotswap(); + bus_topo_unlock(); - return (dsp_make_dev(dev)); + return (0); } int @@ -469,13 +493,14 @@ pcm_unregister(device_t dev) cv_destroy(&d->cv); mtx_destroy(&d->lock); + bus_topo_lock(); if (snd_unit == device_get_unit(dev)) { snd_unit = pcm_best_unit(-1); if (snd_unit_auto == 0) snd_unit_auto = 1; - if (snd_unit < 0) - devctl_notify("SND", "CONN", "NODEV", NULL); + pcm_hotswap(); } + bus_topo_unlock(); return (0); } From nobody Thu May 28 14:36:59 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 4gR8Fm0J0fz6fqHN for ; Thu, 28 May 2026 14:37:00 +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 4gR8Fl6cbpz3kX9 for ; Thu, 28 May 2026 14:36:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779979019; 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=4ZG3MhVxD9r5dp2AouwByMWLd1lpLTGPHMD1c4Lam74=; b=V82i3sstPE3USJOuRvcfjyOXLGAYkpU7SFS1Q+6IdQxTcJDV8Pn1kFm0milHtnYOBpvPIg tGqFm5BX9aSq+jtZxR9QSl0dvj+i1M09UNRmnfUPWyj0vF1ZhI4YRQRYYVx9w4W41ztFBe YbN5yUT/t3ZhZ2LBPO85l/dIhTKaDNbKBg+18MgdqzJmtnICQrB2dpowAYYNsc7byrehwM LQgclEk7UzZ8cYLNuZsQB+/f2Ck5q9QPIfjkUGiuaBGCVQXKTj3BbwvAoTCmodifhg9wKm +wR8utcS9CUs6oZY0j030i3sZ40grSlfXbIwi9sqAvcSa6YiQts0uNODUilsxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779979019; a=rsa-sha256; cv=none; b=DJiv0+jqdES4NvnmmVcwof66sd3lrJZq8S8D1QHyXKR+JQrznEjjxDuW4mQp33TmIzvOa4 jAqGULYDCM42lO8uPDEwhXevpraugCfpD/9UaT+K9uctWQMRBqwmOPDckymYQeqf+BVSuG Nt5ImOfY0gdAk6ZZoCql5LcGyEhfWcT6QKIuzpBztDd7GspoBsDrnxtvO+6f8mybCdPGJ9 pd+5qPsiyw0fuXYPejesSsV7nTt8ImFlGKDOY2DTU3VOLVUa9Ci0f1JHL0GCRT++JKSjzQ gN6SF8kRb+7DP2efjD1JZSqecMw4jtGvpY+oQQ/DPY0EK6b4DwuWRZcdoFV0vg== 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=1779979019; 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=4ZG3MhVxD9r5dp2AouwByMWLd1lpLTGPHMD1c4Lam74=; b=gvIsfUExQ/iCB9Lg9QYkmTmnkaOltqX+623uyCnSK9+LjpC2/VCwAOb4zNa2oOLdRiHKox KyLi5M8lvm6oyebWzGKXm2wlIms6rYAL9zxQC/rlDVYEv+Sqs0bx/8CRcHLDJrH8A4FWM6 4rOGeVqf0k1nqT3tZd0ug9tXRKVdr1K89hsEbKtMSba47Ba2p4UecnnNgJiGjM0qYw5XwT YDhyKuOxam1DQGmb31dOXG4aI7pNBINxYSILcWVIdHARfn/5xw5WfQJusC1ov73WEgJXQp 7upVHSlAMxgTqvydkK6SvJFdtPfzgTGA6pgUQhH2ocJCW8GBxKh8NT/PIIkS+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR8Fl5tpdzqZM for ; Thu, 28 May 2026 14:36:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22f16 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 14:36:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: ShengYi Hung Subject: git: df5e9e3da5b9 - main - usb: Add missing mtx lock and unlock in pushing dma queue 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: aokblast X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df5e9e3da5b9b3fe63ed4aaaa19b824fd18ae0f2 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 14:36:59 +0000 Message-Id: <6a18530b.22f16.2a0fd314@gitrepo.freebsd.org> The branch main has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=df5e9e3da5b9b3fe63ed4aaaa19b824fd18ae0f2 commit df5e9e3da5b9b3fe63ed4aaaa19b824fd18ae0f2 Author: ShengYi Hung AuthorDate: 2026-05-28 08:42:11 +0000 Commit: ShengYi Hung CommitDate: 2026-05-28 14:36:10 +0000 usb: Add missing mtx lock and unlock in pushing dma queue Accessing usb_xfer_queue requires bus lock, we added this missing lock in here to prevent racing issue. Reviewed by: adrian MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57293 --- sys/dev/usb/usb_transfer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index 67745cf49397..d41121ed3a06 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -1889,8 +1889,10 @@ usbd_transfer_submit(struct usb_xfer *xfer) */ #if USB_HAVE_BUSDMA if (xfer->flags_int.bdma_enable) { + USB_BUS_LOCK(bus); /* insert the USB transfer last in the BUS-DMA queue */ usb_command_wrapper(&xfer->xroot->dma_q, xfer); + USB_BUS_UNLOCK(bus); return; } #endif From nobody Thu May 28 14:46:09 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 4gR8SL1HfQz6fqj2 for ; Thu, 28 May 2026 14:46:10 +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 4gR8SK6cq9z3lF4 for ; Thu, 28 May 2026 14:46:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779979570; 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=TDm2qACsR9Li6caa/gKq9VZyf055xI0KHrGZZNGSbDQ=; b=Cqc8l305BeCl6+jYFicCLlxOzUtUi6OvgyrvoSmG7nOEeNRwtStfkhlvXvjvKeeovFqrmJ 0FwbV2B3v+mplwNK48fhzXl9pb4XF8KFgNwD005FqR2soo01hLtX1EPVbtUGR9iP4MgTnD WQJwkqX1+WmlujY7x06WNzjhehfugaLS6LMVtnfpqsJ9ia3NjYjtY3Sb1p2/OAxV0vGSjA ZhWUZXbkXPiM/tgGRYD+UwCSMw97S09j+2bHtszRmT7mnCKbWTohSsFytBd3jUVKoUbNQb VwxI+hXolDVavrhQtRhODGUhfnt/Ul/Kic5WKyPAKhfhrcXo6s3Ch/Ku/BQrLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779979570; a=rsa-sha256; cv=none; b=XyOFJd9bXthhpNEpVAu2lzkzarVugmyxzL7P5XXxaqrAPOpgBSFP11YLSZywIQWXJfDO/q rtm+z2M2WmlUt+zLehiXAL4h8/+X8zwzqUHITfXtjUWVcRNfch7ZhDGX1kOPeMDpTGxwZR NLFCB/QwTOi1wrWEOmUZV6UN2ozbIc0sdzqez7RNZm0aOdInQOkiOYwz0MdDDZLSutkYf7 /0dcy/dvI//kgvMz4k3kb7ejYm97WTXIa6bTpAf8bNuqOMWis8gYI6rEawLd9f/ABsBBke bgwCpyI0k+uL1VivP3MesZ8gyyFyxznNuhHVwfnIW6MLyJANLJAVogxT6WtcRg== 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=1779979570; 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=TDm2qACsR9Li6caa/gKq9VZyf055xI0KHrGZZNGSbDQ=; b=o277rd8A7xY+FeDTGrsuwuhAePR3fM8Hu4dkWcWsQJ7CnFBLJ0ht+VomusX6MxUJgXRSJP gysJfBq/bzfiPknkNy6aaBqYDCeqiiTChgSLbwrLvLNcPLapoicP5R7JjvMSHmBfKON+yr 1RnjwTiXJcpmVWM3q/wdnzzOdd8PR1lD+urP4wkQYxcIIvFNm1CTkhacRZASzAKPDUCB9O nLRnUFTAFaL/hWTHjHiHn/GSiUUA4IoZCYAirL3wkno76LIYf9vKEA0dzawo+dp5z9sL8J vbueHQdJMgUZsqoMu82wa09rjcnhZUIYO9Wfe55FjQm50KXxoSjFgc/9VedKQw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gR8SK5nczzrBg for ; Thu, 28 May 2026 14:46:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 24195 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 14:46:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 453de99b386d - main - virtual_oss(8): Fix buffer overflow in voss_compressor() call 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 453de99b386d40754a038cc4b804f4c7a3b04624 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 14:46:09 +0000 Message-Id: <6a185531.24195.1452040e@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=453de99b386d40754a038cc4b804f4c7a3b04624 commit 453de99b386d40754a038cc4b804f4c7a3b04624 Author: Christos Margiolis AuthorDate: 2026-05-28 13:51:26 +0000 Commit: Christos Margiolis CommitDate: 2026-05-28 14:46:01 +0000 virtual_oss(8): Fix buffer overflow in voss_compressor() call This particular calls swaps the samples and maxchan arguments, which can cause a buffer overflow in p_ch_chain if maxchan exceeds its bounds (VMAX_CHAN). Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li, and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste --- usr.sbin/virtual_oss/virtual_oss/virtual_oss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/virtual_oss/virtual_oss/virtual_oss.c b/usr.sbin/virtual_oss/virtual_oss/virtual_oss.c index 1d95c87d57b1..42a748a5e3bd 100644 --- a/usr.sbin/virtual_oss/virtual_oss/virtual_oss.c +++ b/usr.sbin/virtual_oss/virtual_oss/virtual_oss.c @@ -783,8 +783,8 @@ virtual_oss_process(void *arg __unused) /* check if compressor should be applied */ voss_compressor(buffer_temp, pvp->rx_compressor_gain, - &pvp->rx_compressor_param, samples, - samples * src_chans, (1ULL << (pvp->bits - 1)) - 1ULL); + &pvp->rx_compressor_param, samples * src_chans, + src_chans, (1ULL << (pvp->bits - 1)) - 1ULL); TAILQ_FOREACH(pvc, &pvp->head, entry) { From nobody Thu May 28 16:21:27 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 4gRBZJ0K0Fz6fyQg for ; Thu, 28 May 2026 16:21:28 +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 4gRBZH6Wpnz3wLP for ; Thu, 28 May 2026 16:21:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779985288; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AG9TyWg4Vd4c0DGMKp5sShX/sxT3xwaJT9m4zlMqlvw=; b=M4IyM8MZhXKPaQkYyj/iF+wNiCmNlth5SDIFRugn675rDpkMYD6/+1eDQn9GZQE+W5PP/k JcbYrpZA89CWnZzImtwA76nk5TCCo2qsivwQi9zLMDvwouodx1ZeA/qnBzOA00SO31Pavk mTzQiHrOCcYpUVvxPe2Y71tiQ9LOU84shkf1mGiIJ+3aivIKk/cv0iJsEn5xpVKgbONVsJ ZOLUsJ3pmRB+aeDh+Ljdre4wVEjVmwQ5TkoNNwt3WoxGyGMnW2an3kDlBWuahjQAYdKtSn WGANulh9oC8OyJnRi8Vi8hagvBOPLfHj5TJ6+IpOW4yucwS0rJ1czVGkIqkZBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779985287; a=rsa-sha256; cv=none; b=JDN5kK46wD7ZGOBYOvhTgo+IiXk1aldp4q1QmSTD5BBB1yOPDzEI/xT0Ke+pb+s/99vH05 ZwCn90B7O6be2jxJjDZgnOmTXu76gbcjUnmnZ7z1ZcXzXfmbh6ut7HsJNNP8CAX7XyT1cM E1LhZkaBbndziafQ3Ns3U32Vew44FSwcvGpmLnYhlNNXOb2zyitxExlBjB7ITPUgvJp6PJ A5mM6dRy6pemPXj2xrIqG1cdVodE9JMhU634Bx/64aSlsXgQGBSRQ9IvwubQmY2Oo3qb8A f0RkKATQzYDJov984X9gY9d2z0G49+j2Zc5pMDoVgFHeZ6/MPp//PlKdVxX1cQ== 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=1779985287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AG9TyWg4Vd4c0DGMKp5sShX/sxT3xwaJT9m4zlMqlvw=; b=HeTQHBa6M8E+Sww4+HI7eBbAetH5Gt71aCF3jAR2ENY9yBQ4fbLI6Z01Sas+GxX5vpri/q FAOiO+dU3uW6es3YXywP76z50R0Aj2JxctmRLhDHqULp7JtbzcPHw+XkqWaOoW7NNtKRgb PEIOqDRElr59c3kB7WeROV+yK3Nb0aBe4QrHg5qYt5FZoUJuy9pqO1Zmcq7vFCme3VG51n pVtI9qvbfEZhKVklYcdmLmT0dNwu6tDYGNIHu0+lsnfcBrhv2i4ypPd0p8+OADrcuUVVJd qigYafR+r2vlHoLM23cRAJV7BzHHKv4HtOI42/p9L+Vp6Z2aosJpOGXHqnxp2A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRBZH5xk1ztmy for ; Thu, 28 May 2026 16:21:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33dfa by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 16:21:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ricardo Branco From: Mitchell Horne Subject: git: 4dfc78e0e3bb - main - crashinfo: Create core.txt.last symlink 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4dfc78e0e3bb096514455e9bb6cf63e46e84db13 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 16:21:27 +0000 Message-Id: <6a186b87.33dfa.4b14b976@gitrepo.freebsd.org> The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=4dfc78e0e3bb096514455e9bb6cf63e46e84db13 commit 4dfc78e0e3bb096514455e9bb6cf63e46e84db13 Author: Ricardo Branco AuthorDate: 2026-05-15 14:58:41 +0000 Commit: Mitchell Horne CommitDate: 2026-05-28 16:20:30 +0000 crashinfo: Create core.txt.last symlink When saving a coredump, savecore(8) maintains .last symlinks for the info and vmcore artifacts, but not for the crashinfo text report. Make crashinfo(8) create the link, pointing at the current core.txt. file. This makes /var/crash/core.txt.last track the same core dump as info.last and vmcore.last. [mhorne: I tweaked the submission, such that the link will be created as soon as the core.txt.X file is generated; not only after a successful report has been written.] Signed-off-by: Ricardo Branco Reviewed by: mhorne MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/2199 --- usr.sbin/crashinfo/crashinfo.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/crashinfo/crashinfo.sh b/usr.sbin/crashinfo/crashinfo.sh index 68115f09f9d4..87e5565b98e3 100755 --- a/usr.sbin/crashinfo/crashinfo.sh +++ b/usr.sbin/crashinfo/crashinfo.sh @@ -149,11 +149,13 @@ fi VMCORE=$CRASHDIR/vmcore.$DUMPNR INFO=$CRASHDIR/info.$DUMPNR FILE=$CRASHDIR/core.txt.$DUMPNR +LINK=$CRASHDIR/core.txt.last HOSTNAME=`hostname` if $BATCH; then echo "Writing crash summary to $FILE." exec > $FILE 2>&1 + ln -sf $FILE $LINK fi GDB=/usr/local/bin/gdb @@ -204,6 +206,7 @@ machine=$(gdb_command $KERNEL 'printf "%s", machine') if ! $BATCH; then echo "Writing crash summary to $FILE." exec > $FILE 2>&1 + ln -sf $FILE $LINK fi echo "$HOSTNAME dumped core - see $VMCORE" From nobody Thu May 28 16:49:20 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 4gRCBS4vK8z6g1G4 for ; Thu, 28 May 2026 16:49:20 +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 4gRCBS4J4Nz4002 for ; Thu, 28 May 2026 16:49:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779986960; 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=Jouan5UC3bf7PHLA2c8IxxQNWPmCemBVG3kYzzLZeZc=; b=ukVGn2zYeRQ/lVRKyy2oGK9QJYu8md1PadZq9uMVX2TtC8/daOYXHVINPuBbBVth/ghzR+ 4tW+x/AXp82QGwrXAuhNS1fUisnBJzKQBKyQXeTAFpVvMM+Nv6R2IHKrDLtT21uEQiIwcL OcTF5CfNRWpx0/sSCZJ5wSrXxY2aYaSInYGJhPp+gR0XAaRGeS06dwDx0vHaTtiUTXkiAA Cc+pNAJJr0zKWavpdrEabBXQ/s2+AHkz5afX6U/UAeZqom6ckBSY+tPBYYCKN5VOhH/E/J uBTAjmbsVBn4/Rnlt76GDRXr4HIyMdmBtsMCa1Y6MgFeBDNasRXRSB+gJ3vfGg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779986960; a=rsa-sha256; cv=none; b=ytKUMCGirCj5YM4l0mcvm+SRBQrqcaWreMlWUbQbxngzOGB6+r9LZ74QnT7ajeeiMwfi91 cL8NA2uPesfahRNUKBfEUXZYprsGFf7fIGk35NAH+O0TqJKey05P+MyBuDfgpnbStKJ6tq 5ewnbP01gZBScjwWG0SiZipWrjLeC5bOroBrpbIox4O3leako2aPqrYYkWs1XaC0UjJh6I pzLxA02WjLsnYTF7pwQAmjhdNNWjB0d1vfykYOoVPsiHhl3UIseNjgFYwyZ8VR2YQqwNKc vuMJLJl5jXDPnDmbIWe8p/k6Fzsm2AKyE21Py6nkYCn4cP8ABSjThOoWyE+O4g== 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=1779986960; 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=Jouan5UC3bf7PHLA2c8IxxQNWPmCemBVG3kYzzLZeZc=; b=cKE/+hDzlfAgVzcgZwjrkBLtAiu2V/xRQ6ND8lHu0JD1n3q+5drSUC66CL3HQ8eDn6KfEx OXPp096iZ2cZVW+mHCRtUDyn8E9wV5RZ0IOJX357PzLtPUdfHCx4/ErcgrW8elN7e61Ozg mEh3tXLeAjGTCSglkaUvCc8Dc4npTFoHsXQxb6rC/qSs8BWYCa54VXxS0gsw8jLz3w5EFw DXKNco4mqCjhcfIGvT3E0oK8K0j1mobxWKMAChOoPk3z9uOihsWbvTO0q0+bg4VCkJEILQ h4DKIQvidB29PmkpNKNW4Z8p4wx6UnyK3Pks9CNv86h2B4qxgZrwQ9TbRPuovg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRCBS3tCFzvS2 for ; Thu, 28 May 2026 16:49:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39c80 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 16:49:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Siva Mahadevan Subject: git: a7df326619ef - main - ptrace_test: expect PT_STEP tests to fail on riscv 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: siva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7df326619ef9caa2ed00bf2d103dd278e7b32ec Auto-Submitted: auto-generated Date: Thu, 28 May 2026 16:49:20 +0000 Message-Id: <6a187210.39c80.56235993@gitrepo.freebsd.org> The branch main has been updated by siva: URL: https://cgit.FreeBSD.org/src/commit/?id=a7df326619ef9caa2ed00bf2d103dd278e7b32ec commit a7df326619ef9caa2ed00bf2d103dd278e7b32ec Author: Siva Mahadevan AuthorDate: 2026-05-28 16:32:24 +0000 Commit: Siva Mahadevan CommitDate: 2026-05-28 16:32:42 +0000 ptrace_test: expect PT_STEP tests to fail on riscv ptrace_single_step currently returns EOPNOTSUPP on riscv. This temporarily fixes the following CI failures: https://ci.freebsd.org/job/FreeBSD-main-riscv64-test/16606/testReport/sys.kern/ptrace_test/ptrace__PT_STEP_with_signal/ https://ci.freebsd.org/job/FreeBSD-main-riscv64-test/16606/testReport/sys.kern/ptrace_test/ptrace__step_siginfo/ Reviewed by: kib Approved by: emaste (mentor) Differential Revision: https://reviews.freebsd.org/D57288 --- tests/sys/kern/ptrace_test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index c1a5d226e990..3a55a6f48033 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -3614,6 +3614,10 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI); REQUIRE_EQ(pl.pl_siginfo.si_signo, SIGABRT); +#if defined(__riscv) + atf_tc_expect_fail("PT_STEP not implemented on riscv, see sys/riscv/riscv/ptrace_machdep.c"); +#endif + /* Step the child process inserting SIGUSR1. */ REQUIRE_EQ(ptrace(PT_STEP, fpid, (caddr_t)1, SIGUSR1), 0); @@ -3731,6 +3735,10 @@ ATF_TC_BODY(ptrace__step_siginfo, tc) ATF_REQUIRE(WIFSTOPPED(status)); REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); +#if defined(__riscv) + atf_tc_expect_fail("PT_STEP not implemented on riscv, see sys/riscv/riscv/ptrace_machdep.c"); +#endif + /* Step the child ignoring the SIGSTOP. */ REQUIRE_EQ(ptrace(PT_STEP, fpid, (caddr_t)1, 0), 0); From nobody Thu May 28 17:22:56 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 4gRCxF25nHz6g3Fj for ; Thu, 28 May 2026 17:22: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gRCxF01ptz42fQ for ; Thu, 28 May 2026 17:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779988977; 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=qJIHD9YKRw8/KHybEnOUyB8OPSgccTjNXUIGHDr0SSQ=; b=hG3isge4NZUXUZ9nowKPQ//HHZQ1ZR+2Spcl57S+ppf21ASlQVm3dYkqgzTSo1WT/HnizO QZySMoNDiA3e7abNSPpSeMSgTM2tUZZY73kS5+Ybre+zkn6egnHyi0r3Cd5o3eInXxSgoS h+RMkVOYbyn6IYLbKuA1VLqprLKuH7PTydo4WMv5iielk/gpeWxkfpr/4T4pISAkckiTGU GEWL/dPDZpO3F5yEulachmGywdQnwzpRIHLS+9hd7D+PmII0it4lCkNKIQpy+EmYOgtJj0 hHZQyaVRwBuVE+1+WBs5OAIVrEuYkjVdok7uiv6f5WindCGndnR4pliBUMSyVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779988977; a=rsa-sha256; cv=none; b=dVs5K3RGYNSNfFiPHOmrBl1Uduxyj+Ta4kiShWLyd2fAaYGfnoeJOTCX9Wi6RUDe5TWR8K 0k/u0H/tMIMXCYYQc+oNoBSyG1ucBWeCOG0uapZ+G2EwgNzi8K5gDB3/6d148U0OqIXAWI ny6JjnZDhMnYKO9vTYxS9J1ju0VRC1IENXmurMEB4aYGwRrGFTyE8c/bM/DK5qos72SQK7 SY2NDOYuQIciht/lIgo8mnZV7Vi3h87wX7jlSOijd9xUnFzj3E1cdKw9lBtp4QHU4UNmU0 Jg08pbzqJcDoHGPTPIEwCF7GClh+ramaGr5sHsAbFs9kjtdiPzLNdfjLvkt06g== 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=1779988977; 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=qJIHD9YKRw8/KHybEnOUyB8OPSgccTjNXUIGHDr0SSQ=; b=ZqosqRLP2t3c1cnC6BHyzcHzJCgC4NnKumsfoGrHR4MH3fC4TXM7+h8Tplx9fJIQHwkM/0 2XbH5ZWJ3DBf7rNqCnx/8qbbfcHQ7aIHQxwATcnW8F3wXWji6n6cLQGgsdm6L5+6F/cndf fkoirdDE1eL4BSdGnnYrFuIvHCarD5ZQODnGD9tnOOuQ++G3ogipWL2qThZIVOC56Nw0yM 9rgC0IbcXxAaXXBLFP1FGj5zphMJSiwHTHWp86WsN2TYhnHWAVsJv0zOW8SXMPfDGiJiDg xgdX7QZ8zJpCb/2aZfIuZ8vhwYIquiVpNHcKW6MivtAJE0AsiS1yOunezXp31g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRCxD5xVKzvrr for ; Thu, 28 May 2026 17:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d304 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 17:22:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 95fc64cc29fb - main - ctld: More consistent error messages 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95fc64cc29fb4cddc7cad093cfa32587a623f560 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 17:22:56 +0000 Message-Id: <6a1879f0.3d304.650514e4@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=95fc64cc29fb4cddc7cad093cfa32587a623f560 commit 95fc64cc29fb4cddc7cad093cfa32587a623f560 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-28 17:22:43 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-28 17:22:43 +0000 ctld: More consistent error messages The error messages ctld emits when it finds a port or LUN it did not create were inconsistent with each other as well as with ctld's other error messages. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D57270 --- usr.sbin/ctld/kernel.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.sbin/ctld/kernel.cc b/usr.sbin/ctld/kernel.cc index 8c5c447f3e80..ef7ef87af090 100644 --- a/usr.sbin/ctld/kernel.cc +++ b/usr.sbin/ctld/kernel.cc @@ -446,8 +446,8 @@ add_iscsi_port(struct kports &kports, struct conf *conf, const struct cctl_port &port, std::string &name) { if (port.cfiscsi_target.empty()) { - log_debugx("CTL port %u \"%s\" wasn't managed by ctld; ", - port.port_id, name.c_str()); + log_debugx("CTL iSCSI port %u \"%s\" is not managed by ctld; " + "ignoring", port.port_id, name.c_str()); if (!kports.has_port(name)) { if (!kports.add_port(name, port.port_id)) { log_warnx("kports::add_port failed"); @@ -498,8 +498,8 @@ add_nvmf_port(struct conf *conf, const struct cctl_port &port, std::string &name) { if (port.nqn.empty() || port.ctld_transport_group_name.empty()) { - log_debugx("CTL port %u \"%s\" wasn't managed by ctld; ", - port.port_id, name.c_str()); + log_debugx("CTL NVMeoF port %u \"%s\" is not managed by ctld; " + "ignoring", port.port_id, name.c_str()); return; } @@ -570,7 +570,7 @@ conf_new_from_kernel(struct kports &kports) for (const auto &lun : devlist.lun_list) { if (lun.ctld_name.empty()) { - log_debugx("CTL lun %ju wasn't managed by ctld; " + log_debugx("CTL lun %ju is not managed by ctld; " "ignoring", (uintmax_t)lun.lun_id); continue; } From nobody Thu May 28 17:27:36 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 4gRD2c2gMBz6g3jb for ; Thu, 28 May 2026 17:27: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gRD2c215Sz436J for ; Thu, 28 May 2026 17:27:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779989256; 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=H79c7Bl/dQkSQuO95pooluDu4PIkvwjmX5hmx/IuSJE=; b=Jz9O6yU7kEOqw++epvXJ6o8ZC9/tW+bDwTZ+VBb0YcYJD4u/3EsyEWHjBiOneAVu/BHsLx Eg6txg00h7AnXtgirOzMgZ3HPx8z/LNw0xrzXYSpBIy9g4pGEciDpsKRyMH4Eiy+YIMdb+ rucW2brI2ME2n5wpmjqvpohCd7I+0x/mieEqP45FYVLLAbcornvgI/D/fCTK+5jep4f9h7 nnz2pgKErKcQxI/YyXjbi6aOeX8cg3WcxtpfURUp25Wgut42Dkkxh44hEQlsGrOkzDEeqT 6TH+g7ggGOIwSkDoWKG+NFKJFY96OWs7vHid7FPkTfRhl7/0/l4iIglRM+HfGA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779989256; a=rsa-sha256; cv=none; b=QLKFWSh/NbV4W6uBcDHk8w+n+TUGyVbeaMAQEaRXUd2+gU9zLDd3+Up9tWZlb8fAclwmYw OVYELzLXnxNPgsXExkHpNiLTQe+6TmLXuSLhgWBU+4p70wwcjQjAOurvfL01l3K4mGEpbg Zsuhn1V+7t1hZGV2qBgFtgQ/gbaP1COAH6SbEt9DjmHiTtQOfYXIAQVF6Bq45ErDSTWvs9 NwdUqujV/dtSaRGG93i39hIBuPHKMo7PjMvmMZ0tGtxYFCU9taQTdTBSrpGnpR6LXr+5Oy iMidum+MsmJw8ABBLJwX+30PpYi3B51ffCx7M5sH9aXdLwr6l5BX4iYOHrqOwg== 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=1779989256; 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=H79c7Bl/dQkSQuO95pooluDu4PIkvwjmX5hmx/IuSJE=; b=Xu0mq45whUICTf66rLrRsrxxe0r/9xene/RDqQwRk6us2MuFxCeM/Wv4w4U8T7x29NsaR4 9Q7X5i+jI41WxjoqHGq0yMCnhOLOS+LgGRiG1GnXEdUVRATVZilYnQX1PnDQTUY0ciGwAH Lb8+jIjpDhFOUPi44y79LB83px4ivRYNRgA6NWxoXoCfIFrsiMmZji96xK/o69nM+ehACl AXxdZOHlTeqUUmJmEqUqNHCr1QNAPWIgyIS6ZdkaSSvwAlAfmJ9sglB7Yl/lus0q/11+04 r78n7GCPRH78ZVnMLe3koSGYGADPglpcv/gOAkjsM2FxHKda3fLFX2Yg8rO9cA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRD2c12njzwB3 for ; Thu, 28 May 2026 17:27:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d055 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 17:27:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0a02a47fd94a - main - x86: for wrmsr_early_safe(), catch all exceptions, not only #GP 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a02a47fd94a8326e84ac0a6cb857342b59671f8 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 17:27:36 +0000 Message-Id: <6a187b08.3d055.7ff4566f@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0a02a47fd94a8326e84ac0a6cb857342b59671f8 commit 0a02a47fd94a8326e84ac0a6cb857342b59671f8 Author: Konstantin Belousov AuthorDate: 2026-05-27 08:21:10 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-28 17:26:56 +0000 x86: for wrmsr_early_safe(), catch all exceptions, not only #GP Reviewed by: olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57264 --- sys/amd64/amd64/machdep.c | 24 +++++++++++++++--------- sys/amd64/amd64/support.S | 7 +++---- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index db2fd5927f7f..8df4868f5312 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1827,29 +1827,35 @@ wrmsr_early_safe_start(void) { struct region_descriptor efi_idt; struct gate_descriptor *gpf_descr; + int i; sidt(&wrmsr_early_safe_orig_efi_idt); efi_idt.rd_limit = 32 * sizeof(idt0[0]); efi_idt.rd_base = (uintptr_t)idt0; lidt(&efi_idt); - gpf_descr = &idt0[IDT_GP]; - gpf_descr->gd_looffset = (uintptr_t)wrmsr_early_safe_gp_handler; - gpf_descr->gd_hioffset = (uintptr_t)wrmsr_early_safe_gp_handler >> 16; - gpf_descr->gd_selector = rcs(); - gpf_descr->gd_type = SDT_SYSTGT; - gpf_descr->gd_p = 1; + /* Setup handler for all possible exceptions. */ + for (i = 0; i < 32; i++) { + gpf_descr = &idt0[i]; + gpf_descr->gd_looffset = + (uintptr_t)wrmsr_early_safe_gp_handler; + gpf_descr->gd_hioffset = + (uintptr_t)wrmsr_early_safe_gp_handler >> 16; + gpf_descr->gd_selector = rcs(); + gpf_descr->gd_type = SDT_SYSTGT; + gpf_descr->gd_p = 1; + } } void wrmsr_early_safe_end(void) { - struct gate_descriptor *gpf_descr; + int i; lidt(&wrmsr_early_safe_orig_efi_idt); - gpf_descr = &idt0[IDT_GP]; - memset_early(gpf_descr, 0, sizeof(*gpf_descr)); + for (i = 0; i < 32; i++) + memset_early(&idt0[i], 0, sizeof(idt0[0])); } int diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 09d4ef85b087..1d7d05843ba8 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -1566,20 +1566,19 @@ msr_onfault: ret ENTRY(wrmsr_early_safe) + movq %rsp,%r11 movl %edi,%ecx movl %esi,%eax sarq $32,%rsi movl %esi,%edx wrmsr xorl %eax,%eax -wrmsr_early_faulted: ret ENTRY(wrmsr_early_safe_gp_handler) - addq $8,%rsp + movq %r11,%rsp movl $EFAULT,%eax - movq $wrmsr_early_faulted,(%rsp) - iretq + ret /* * void pmap_pti_pcid_invalidate(uint64_t ucr3, uint64_t kcr3); From nobody Thu May 28 19:06:53 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 4gRGF93nCCz6dwPg for ; Thu, 28 May 2026 19:06:53 +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 4gRGF92vbnz4B3m for ; Thu, 28 May 2026 19:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779995213; 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=TQm3QGl8QagtWXfp0VqLPm6Hj1OP05OXgyH4rAAdwcc=; b=mtMwTzEdjkBjmPts8EDug11n7ku5S5HkqUtubr+MetO22kFTBc610UNpuCNw5IvWalrfM4 4CVs5znyyjEC+Inhoxvk/0kaIoKKhpO5b/p84UVke9L1R5ys5mzrY+OHxBx/CJa+WTTasK ZyCFXqhLzwuQ5yGL7mniplHV6JDhdzmKYcAkmPi2o0t6UGnOi/AcHS8RW9QjgY4H9tdC2j 9nv9BwI4AnULI6IoT9e2WdeLqmsXJ/OjKHgd3RaOAq1y2FuL8wVmNdsmadGrLyMx/AvMhn RR0eWr2R78ABwqj9RpFSnvb5aY8+fIOQ2Zznm8f97y5vSgGJ+iRv6SzMqXtSaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779995213; a=rsa-sha256; cv=none; b=Go3Fl4hXSF6bY7Ywo0y4sN4FTfGfUb2CijPGR39U/sTb8y4ghPOrsudgLGs7tm1Mqm6fqN 4uiIu9C9PQQz1fC0x3EGvYL1UA8zzxCNvrGRQA15Sx3nb0AxtQxBxVvhIsCyWzkDY1WXyo JJ9WjVIr9a0Q45lOYPjm5MZroVdrcr0IlPtjDnwBk1yn/ka2jdto62ImCs90OHVkpo+Jgf PPM8iYxxLgWqgadSRYes4ZbxHGagjeW1YOSC9/VGJ2Yu/YohdhAArs3dMn49wUEnCnN9CR JsR29axpaFXZWftmM7Pq2vUEyEwi8EGywqy5Ov/UXZtgJmOnCm3uaexM30eagg== 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=1779995213; 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=TQm3QGl8QagtWXfp0VqLPm6Hj1OP05OXgyH4rAAdwcc=; b=bHOTFpqmhEuBkKe+Z4VLTpL3zUDoKJ/9gOOh/NKvkW43cc+ny4Q8tPgKRYbrXXHE7wM4sd /MY672tyUMcM3xmNpHUvHu3+KV7qEq3aah0J6lY3L5so4oDxT3b3EX8UoAb/7HLMJaL7ii TShYVv03YaG+87su2gwtGmEUaCzeoi1MfxPOKAysWeGM7+0ZfE068n2sFi4nJ+hVdJabH1 SHs8zBm1DI0AUdab5TDvpDZEW66znUAbGMJmK0TMyucsQzREd76DqncHxPbYQRew18q2qR IKOY6w85/wnNsmUHWUTMl0QZbqFyvcpU0sBG+5C8HPBuDMt9xKB73tst3L5wNw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRGF9246xz108m for ; Thu, 28 May 2026 19:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1fcc9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 19:06:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: a172f9e5b3cf - main - cxgbe(4): Improvements to the slow interrupt handler 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: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a172f9e5b3cf41882f087f6c5311dc068d9d6b54 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 19:06:53 +0000 Message-Id: <6a18924d.1fcc9.67a666f1@gitrepo.freebsd.org> The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=a172f9e5b3cf41882f087f6c5311dc068d9d6b54 commit a172f9e5b3cf41882f087f6c5311dc068d9d6b54 Author: Navdeep Parhar AuthorDate: 2026-05-28 07:12:20 +0000 Commit: Navdeep Parhar CommitDate: 2026-05-28 19:05:57 +0000 cxgbe(4): Improvements to the slow interrupt handler * Add a flag to indicate that an INT_CAUSE should not be cleared automatically in the generic handler. This is to ensure correct operation of some INT_CAUSEs that are related to each other and must be cleared in a certain order. * Add decode for many more INT_CAUSE registers. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 1 + sys/dev/cxgbe/common/t4_hw.c | 1835 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 1648 insertions(+), 188 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 24a482b74dfb..8c5cf052b689 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -194,6 +194,7 @@ enum { IHF_CLR_ALL_SET = (1 << 5), /* Clear all set bits */ IHF_CLR_ALL_UNIGNORED = (1 << 6), /* Clear all unignored bits */ IHF_RUN_ALL_ACTIONS = (1 << 7), /* As if all cause are set */ + IHF_CLR_DELAYED = (1 << 9), /* Cleared in a delayed call */ }; #define IS_DETACHING(vi) ((vi)->flags & VI_DETACHING) diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index f4eef54e5c6b..41606201ad39 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -4794,6 +4794,27 @@ struct intr_info { const struct intr_action *actions; }; +/* Helper to clear interrupts that have IHF_CLR_DELAYED. */ +static void +clear_int_cause_reg(struct adapter *sc, const struct intr_info *ii, int flags) +{ + u32 cause, ucause; + + cause = ucause = t4_read_reg(sc, ii->cause_reg); + if (cause == 0) + return; + flags |= ii->flags; + if (flags & IHF_IGNORE_IF_DISABLED) + ucause &= t4_read_reg(sc, ii->enable_reg); + if (flags & IHF_CLR_ALL_SET) { + t4_write_reg(sc, ii->cause_reg, cause); + (void)t4_read_reg(sc, ii->cause_reg); + } else if (ucause != 0 && flags & IHF_CLR_ALL_UNIGNORED) { + t4_write_reg(sc, ii->cause_reg, ucause); + (void)t4_read_reg(sc, ii->cause_reg); + } +} + static inline char intr_alert_char(u32 cause, u32 enable, u32 fatal) { @@ -4869,8 +4890,8 @@ t4_handle_intr(struct adapter *sc, const struct intr_info *ii, uint32_t acause, } } - /* clear */ - if (cause != 0) { + /* Clear here unless delayed clear is requested. */ + if (cause != 0 && (flags & IHF_CLR_DELAYED) == 0) { if (flags & IHF_CLR_ALL_SET) { t4_write_reg(sc, ii->cause_reg, cause); (void)t4_read_reg(sc, ii->cause_reg); @@ -5003,22 +5024,63 @@ static bool pcie_intr_handler(struct adapter *adap, int arg, int flags) .details = NULL, .actions = NULL, }; + static const struct intr_details pcie_intr_cause_ext_details[] = { + { F_IPFORMQPERR, "PCIe IP FormQ Buffer PERR" }, + { F_IPFORMQCERR, "PCIe IP FormQ Buffer CERR" }, + { F_TRGT1GRPCERR, "TRGT1 Group FIFOs CERR" }, + { F_IPSOTCERR, "PCIe IP SOT Buffer SRAM CERR" }, + { F_IPRETRYCERR, "PCIe IP Replay Buffer CERR" }, + { F_IPRXDATAGRPCERR, "PCIe IP Rx Data Group SRAMs CERR" }, + { F_IPRXHDRGRPCERR, "PCIe IP Rx Header Group SRAMs CERR" }, + { F_A0ARBRSPORDFIFOPERR, "A0 Arbiter Response Order FIFO Parity Error" }, + { F_HRSPCERR, "Master HMA Channel Response Data SRAM CERR" }, + { F_HREQRDCERR, "Master HMA Channel Read Request SRAM CERR" }, + { F_HREQWRCERR, "Master HMA Channel Write Request SRAM CERR" }, + { F_DRSPCERR, "Master DMA Channel Response Data SRAM CERR" }, + { F_DREQRDCERR, "Master DMA Channel Read Request SRAM CERR" }, + { F_DREQWRCERR, "Master DMA Channel Write Request SRAM CERR" }, + { F_CRSPCERR, "Master CMD Channel Response Data SRAM CERR" }, + { F_ARSPPERR, "Master ARM Channel Response Data SRAM PERR" }, + { F_AREQRDPERR, "Master ARM Channel Read Request SRAM PERR" }, + { F_AREQWRPERR, "Master ARM Channel Write Request SRAM PERR" }, + { F_PIOREQGRPCERR, "PIO Request Group FIFOs CERR" }, + { F_ARSPCERR, "Master ARM Channel Response Data SRAM CERR" }, + { F_AREQRDCERR, "Master ARM Channel Read Request SRAM CERR" }, + { F_AREQWRCERR, "Master ARM Channel Write Request SRAM CERR" }, + { F_MARSPPERR, "INIC MA Ctrl and Data Rsp Perr" }, + { F_INICMAWDATAORDPERR, "INIC Ma Arb Write Ord Data Fifo Perr" }, + { F_EMUPERR, "CFG EMU SRAM PERR" }, + { F_ERRSPPERR, "CFG EMU SRAM CERR" }, + { F_MSTGRPCERR, "Master Data Path and Response Read Queue SRAM CERR" }, + { 0 } + }; struct intr_info pcie_int_cause_ext = { .name = "PCIE_INT_CAUSE_EXT", .cause_reg = A_PCIE_INT_CAUSE_EXT, .enable_reg = A_PCIE_INT_ENABLE_EXT, .fatal = 0, .flags = 0, - .details = NULL, + .details = pcie_intr_cause_ext_details, .actions = NULL, }; + static const struct intr_details pcie_intr_cause_x8_details[] = { + { F_X8TGTGRPPERR, "x8 TGT Group FIFOs parity error" }, + { F_X8IPSOTPERR, "PCIe x8 IP SOT Buffer SRAM PERR" }, + { F_X8IPRETRYPERR, "PCIe x8 IP Replay Buffer PERR" }, + { F_X8IPRXDATAGRPPERR, "PCIe x8 IP Rx Data Group SRAMs PERR" }, + { F_X8IPRXHDRGRPPERR, "PCIe x8 IP Rx Header Group SRAMs PERR" }, + { F_X8IPCORECERR, "x8 IP SOT, Retry, RxData, RxHdr SRAM CERR" }, + { F_X8MSTGRPPERR, "x8 Master Data Path and Response Read Queue SRAM PERR" }, + { F_X8MSTGRPCERR, "x8 Master Data Path and Response Read Queue SRAM CERR" }, + { 0 } + }; struct intr_info pcie_int_cause_x8 = { .name = "PCIE_INT_CAUSE_X8", .cause_reg = A_PCIE_INT_CAUSE_X8, .enable_reg = A_PCIE_INT_ENABLE_X8, .fatal = 0, .flags = 0, - .details = NULL, + .details = pcie_intr_cause_x8_details, .actions = NULL, }; bool fatal = false; @@ -5050,80 +5112,247 @@ static bool tp_intr_handler(struct adapter *adap, int arg, int flags) { F_FLMTXFLSTEMPTY, "TP out of Tx pages" }, { 0 } }; - static const struct intr_info tp_intr_info = { + static const struct intr_details t7_tp_intr_details[] = { + { F_FLMTXFLSTEMPTY, "Offload memory manager Tx free list empty" }, + { F_TPCERR, "TP modules flagged Correctable Error" }, + { F_OTHERPERR, "TP Other modules (Core, TM, FLM, MMGR, DB) Parity Error" }, + { F_TPEING1PERR, "TP-ESide Ingress1 Parity Error" }, + { F_TPEING0PERR, "TP-ESide Ingress0 Parity Error" }, + { F_TPEEGPERR, "TP-ESide Egress Parity Error" }, + { F_TPCPERR, "TP-CSide Parity Error" }, + { 0 } + }; + struct intr_info tp_intr_info = { .name = "TP_INT_CAUSE", .cause_reg = A_TP_INT_CAUSE, .enable_reg = A_TP_INT_ENABLE, .fatal = 0x7fffffff, - .flags = IHF_FATAL_IFF_ENABLED, - .details = tp_intr_details, + .flags = IHF_FATAL_IFF_ENABLED | IHF_CLR_DELAYED, + .details = NULL, .actions = NULL, }; - static const struct intr_info tp_inic_perr_cause = { - .name = "TP_INIC_PERR_CAUSE", - .cause_reg = A_TP_INIC_PERR_CAUSE, - .enable_reg = A_TP_INIC_PERR_ENABLE, + static const struct intr_details tp_cerr_cause_details[] = { + { F_TPCEGDATAFIFO, "TPCSide Egress Data FIFO" }, + { F_TPCLBKDATAFIFO, "TPCSide Loopback Data FIFO" }, + { F_RSSLKPSRAM, "RSS Lookup SRAM" }, + { F_SRQSRAM, "SRQ SRAM" }, + { F_ARPDASRAM, "ARP DA SRAM" }, + { F_ARPSASRAM, "ARP SA SRAM" }, + { F_ARPGRESRAM, "ARP GRE SRAM" }, + { F_ARPIPSECSRAM1, "ARP IPSec SRAM0" }, + { F_ARPIPSECSRAM0, "ARP IPSec SRAM1" }, + { 0 } + }; + static const struct intr_info tp_cerr_cause = { + .name = "TP_CERR_CAUSE", + .cause_reg = A_TP_CERR_CAUSE, + .enable_reg = A_TP_CERR_ENABLE, .fatal = 0xffffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = NULL, + .details = tp_cerr_cause_details, .actions = NULL, }; + static const struct intr_details tp_c_perr_details[] = { + { F_DMXFIFOOVFL, "Demux FIFO Overflow" }, + { F_URX2TPCDDPINTF, "ULPRX to TPC DDP Interface and FIFO" }, + { F_TPCDISPTOKENFIFO, "TPC Dispatch Token FIFO" }, + { F_TPCDISPCPLFIFO3, "TPC Dispatch CPL FIFO Ch3" }, + { F_TPCDISPCPLFIFO2, "TPC Dispatch CPL FIFO Ch2" }, + { F_TPCDISPCPLFIFO1, "TPC Dispatch CPL FIFO Ch1" }, + { F_TPCDISPCPLFIFO0, "TPC Dispatch CPL FIFO Ch0" }, + { F_URXPLDINTFCRC3, "ULPRX to TPC Payload Interface CRC Error Ch3" }, + { F_URXPLDINTFCRC2, "ULPRX to TPC Payload Interface CRC Error Ch2" }, + { F_URXPLDINTFCRC1, "ULPRX to TPC Payload Interface CRC Error Ch1" }, + { F_URXPLDINTFCRC0, "ULPRX to TPC Payload Interface CRC Error Ch0" }, + { F_DMXDBFIFO, "Demux DB FIFO" }, + { F_DMXDBSRAM, "Demux DB SRAM" }, + { F_DMXCPLFIFO, "Demux CPL FIFO" }, + { F_DMXCPLSRAM, "Demux CPL SRAM" }, + { F_DMXCSUMFIFO, "Demux Checksum FIFO" }, + { F_DMXLENFIFO, "Demux Length FIFO" }, + { F_DMXCHECKFIFO, "Demux Check CRC16 FIFO" }, + { F_DMXWINFIFO, "Demux Winner FIFO" }, + { F_EGTOKENFIFO, "Egress Token FIFO Parity Error" }, + { F_EGDATAFIFO, "Egress FIFO Parity Error" }, + { F_UTX2TPCINTF3, "ULPTX to TPC Interface Parity Error Ch3" }, + { F_UTX2TPCINTF2, "ULPTX to TPC Interface Parity Error Ch2" }, + { F_UTX2TPCINTF1, "ULPTX to TPC Interface Parity Error Ch1" }, + { F_UTX2TPCINTF0, "ULPTX to TPC Interface Parity Error Ch0" }, + { F_LBKTOKENFIFO, "Loopback Token FIFO Parity Error" }, + { F_LBKDATAFIFO, "Loopback FIFO Parity Error" }, + { 0 } + }; static const struct intr_info tp_c_perr_cause = { .name = "TP_C_PERR_CAUSE", .cause_reg = A_TP_C_PERR_CAUSE, .enable_reg = A_TP_C_PERR_ENABLE, .fatal = 0xffffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = NULL, + .details = tp_c_perr_details, .actions = NULL, }; + static const struct intr_details tp_e_eg_perr_details[] = { + { F_MPSLPBKTOKENFIFO, "MPS Loopback Token FIFO parity error" }, + { F_MPSMACTOKENFIFO, "MPS MAC Token FIFO parity error" }, + { F_DISPIPSECFIFO3, "Ch3 Dispatch IPSec FIFO parity error" }, + { F_DISPTCPFIFO3, "Ch3 Dispatch TCP FIFO parity error" }, + { F_DISPIPFIFO3, "Ch3 Dispatch IP FIFO parity error" }, + { F_DISPETHFIFO3, "Ch3 Dispatch ETH FIFO parity error" }, + { F_DISPGREFIFO3, "Ch3 Dispatch GRE FIFO parity error" }, + { F_DISPCPL5FIFO3, "Ch3 Dispatch CPL5 FIFO parity error" }, + { F_DISPIPSECFIFO2, "Ch2 Dispatch IPSec FIFO parity error" }, + { F_DISPTCPFIFO2, "Ch2 Dispatch TCP FIFO parity error" }, + { F_DISPIPFIFO2, "Ch2 Dispatch IP FIFO parity error" }, + { F_DISPETHFIFO2, "Ch2 Dispatch ETH FIFO parity error" }, + { F_DISPGREFIFO2, "Ch2 Dispatch GRE FIFO parity error" }, + { F_DISPCPL5FIFO2, "Ch2 Dispatch CPL5 FIFO parity error" }, + { F_DISPIPSECFIFO1, "Ch1 Dispatch IPSec FIFO parity error" }, + { F_DISPTCPFIFO1, "Ch1 Dispatch TCP FIFO parity error" }, + { F_DISPIPFIFO1, "Ch1 Dispatch IP FIFO parity error" }, + { F_DISPETHFIFO1, "Ch1 Dispatch ETH FIFO parity error" }, + { F_DISPGREFIFO1, "Ch1 Dispatch GRE FIFO parity error" }, + { F_DISPCPL5FIFO1, "Ch1 Dispatch CPL5 FIFO parity error" }, + { F_DISPIPSECFIFO0, "Ch0 Dispatch IPSec FIFO parity error" }, + { F_DISPTCPFIFO0, "Ch0 Dispatch TCP FIFO parity error" }, + { F_DISPIPFIFO0, "Ch0 Dispatch IP FIFO parity error" }, + { F_DISPETHFIFO0, "Ch0 Dispatch ETH FIFO parity error" }, + { F_DISPGREFIFO0, "Ch0 Dispatch GRE FIFO parity error" }, + { F_DISPCPL5FIFO0, "Ch0 Dispatch CPL5 FIFO parity error" }, + { 0 } + }; static const struct intr_info tp_e_eg_perr_cause = { .name = "TP_E_EG_PERR_CAUSE", .cause_reg = A_TP_E_EG_PERR_CAUSE, .enable_reg = A_TP_E_EG_PERR_ENABLE, .fatal = 0xffffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = NULL, + .details = tp_e_eg_perr_details, .actions = NULL, }; + static const struct intr_details tp_e_in0_perr_details[] = { + { F_DMXISSFIFO, "Demux ISS FIFO parity error" }, + { F_DMXERRFIFO, "Demux Error FIFO parity error" }, + { F_DMXATTFIFO, "Demux Attributes FIFO parity error" }, + { F_DMXTCPFIFO, "Demux TCP Fields FIFO parity error" }, + { F_DMXMPAFIFO, "Demux MPA FIFO parity error" }, + { F_DMXOPTFIFO, "Demux TCP Options FIFO parity error" }, + { F_INGTOKENFIFO, "Demux Ingress Token FIFO parity error" }, + { F_DMXPLDCHKOVFL1, "Ch1 PLD TxCheck FIFO Overflow" }, + { F_DMXPLDCHKFIFO1, "Ch1 PLD TxCheck FIFO parity error" }, + { F_DMXOPTFIFO1, "Ch1 Options buffer parity error" }, + { F_DMXMPAFIFO1, "Ch1 MPA FIFO parity error" }, + { F_DMXDBFIFO1, "Ch1 DB FIFO parity error" }, + { F_DMXATTFIFO1, "Ch1 Attribute FIFO parity error" }, + { F_DMXISSFIFO1, "Ch1 ISS FIFO parity error" }, + { F_DMXTCPFIFO1, "Ch1 TCP Fields FIFO parity error" }, + { F_DMXERRFIFO1, "Ch1 Error FIFO parity error" }, + { F_MPS2TPINTF1, "Ch1 MPS2TP Interface parity error" }, + { F_DMXPLDCHKOVFL0, "Ch0 PLD TxCheck FIFO Overflow" }, + { F_DMXPLDCHKFIFO0, "Ch0 PLD TxCheck FIFO parity error" }, + { F_DMXOPTFIFO0, "Ch0 Options buffer parity error" }, + { F_DMXMPAFIFO0, "Ch0 MPA FIFO parity error" }, + { F_DMXDBFIFO0, "Ch0 DB FIFO parity error" }, + { F_DMXATTFIFO0, "Ch0 Attribute FIFO parity error" }, + { F_DMXISSFIFO0, "Ch0 ISS FIFO parity error" }, + { F_DMXTCPFIFO0, "Ch0 TCP Fields FIFO parity error" }, + { F_DMXERRFIFO0, "Ch0 Error FIFO parity error" }, + { F_MPS2TPINTF0, "Ch0 MPS2TP Interface parity error" }, + { 0 } + }; static const struct intr_info tp_e_in0_perr_cause = { .name = "TP_E_IN0_PERR_CAUSE", .cause_reg = A_TP_E_IN0_PERR_CAUSE, .enable_reg = A_TP_E_IN0_PERR_ENABLE, .fatal = 0xffffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = NULL, + .details = tp_e_in0_perr_details, .actions = NULL, }; + static const struct intr_details tp_e_in1_perr_details[] = { + { F_DMXPLDCHKOVFL3, "Ch3 PLD TxCheck FIFO Overflow" }, + { F_DMXPLDCHKFIFO3, "Ch3 PLD TxCheck FIFO parity error" }, + { F_DMXOPTFIFO3, "Ch3 Options buffer parity error" }, + { F_DMXMPAFIFO3, "Ch3 MPA FIFO parity error" }, + { F_DMXDBFIFO3, "Ch3 DB FIFO parity error" }, + { F_DMXATTFIFO3, "Ch3 Attribute FIFO parity error" }, + { F_DMXISSFIFO3, "Ch3 ISS FIFO parity error" }, + { F_DMXTCPFIFO3, "Ch3 TCP Fields FIFO parity error" }, + { F_DMXERRFIFO3, "Ch3 Error FIFO parity error" }, + { F_MPS2TPINTF3, "Ch3 MPS2TP Interface parity error" }, + { F_DMXPLDCHKOVFL2, "Ch2 PLD TxCheck FIFO Overflow" }, + { F_DMXPLDCHKFIFO2, "Ch2 PLD TxCheck FIFO parity error" }, + { F_DMXOPTFIFO2, "Ch2 Options buffer parity error" }, + { F_DMXMPAFIFO2, "Ch2 MPA FIFO parity error" }, + { F_DMXDBFIFO2, "Ch2 DB FIFO parity error" }, + { F_DMXATTFIFO2, "Ch2 Attribute FIFO parity error" }, + { F_DMXISSFIFO2, "Ch2 ISS FIFO parity error" }, + { F_DMXTCPFIFO2, "Ch2 TCP Fields FIFO parity error" }, + { F_DMXERRFIFO2, "Ch2 Error FIFO parity error" }, + { F_MPS2TPINTF2, "Ch2 MPS2TP Interface parity error" }, + { 0 } + }; static const struct intr_info tp_e_in1_perr_cause = { .name = "TP_E_IN1_PERR_CAUSE", .cause_reg = A_TP_E_IN1_PERR_CAUSE, .enable_reg = A_TP_E_IN1_PERR_ENABLE, .fatal = 0xffffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = NULL, + .details = tp_e_in1_perr_details, .actions = NULL, }; + static const struct intr_details tp_other_perr_details[] = { + { F_DMARBTPERR, "DMARBT MA Rsp Interface parity Error" }, + { F_MMGRCACHEDATASRAM, "TP MMGR Cache Data SRAM" }, + { F_MMGRCACHETAGFIFO, "TP MMGR Cache Tag FIFO" }, + { F_DBL2TLUTPERR, "TP DB Lookup Table" }, + { F_DBTXTIDPERR, "TP DB FIFOs" }, + { F_DBEXTPERR, "TP DB Extended Opcode FIFO" }, + { F_DBOPPERR, "TP DB Opcode FIFO" }, + { F_TMCACHEPERR, "TP TM Cache SRAM" }, + { F_TPPROTOSRAM, "TP Protocol SRAM" }, + { F_HSPSRAM, "HighSpeed SRAM" }, + { F_RATEGRPSRAM, "Rate Group SRAM" }, + { F_TXFBSEQFIFO, "Tx Feedback Sequence Number FIFO" }, + { F_CMDATASRAM, "Cache Data SRAM" }, + { F_CMTAGFIFO, "Cache Tag FIFO" }, + { F_RFCOPFIFO, "RCF Opcode FIFO" }, + { F_DELINVFIFO, "Delete Invalid FIFO" }, + { F_RSSCFGSRAM, "RSS Config or Round-Robin SRAM" }, + { F_RSSKEYSRAM, "RSS Key SRAM" }, + { F_RSSLKPSRAM, "RSS Lookup SRAM" }, + { F_SRQSRAM, "SRQ SRAM" }, + { F_ARPDASRAM, "ARP DA SRAM" }, + { F_ARPSASRAM, "ARP SA SRAM" }, + { F_ARPGRESRAM, "ARP GRE SRAM" }, + { F_ARPIPSECSRAM1, "ARP IPSec SRAM0" }, + { F_ARPIPSECSRAM0, "ARP IPSec SRAM1" }, + { 0 } + }; static const struct intr_info tp_o_perr_cause = { .name = "TP_O_PERR_CAUSE", .cause_reg = A_TP_O_PERR_CAUSE, .enable_reg = A_TP_O_PERR_ENABLE, .fatal = 0xffffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = NULL, + .details = tp_other_perr_details, .actions = NULL, }; bool fatal; - fatal = t4_handle_intr(adap, &tp_intr_info, 0, flags); if (chip_id(adap) > CHELSIO_T6) { - fatal |= t4_handle_intr(adap, &tp_inic_perr_cause, 0, flags); + tp_intr_info.details = t7_tp_intr_details; + fatal = t4_handle_intr(adap, &tp_intr_info, 0, flags); + fatal |= t4_handle_intr(adap, &tp_cerr_cause, 0, flags); fatal |= t4_handle_intr(adap, &tp_c_perr_cause, 0, flags); fatal |= t4_handle_intr(adap, &tp_e_eg_perr_cause, 0, flags); fatal |= t4_handle_intr(adap, &tp_e_in0_perr_cause, 0, flags); fatal |= t4_handle_intr(adap, &tp_e_in1_perr_cause, 0, flags); fatal |= t4_handle_intr(adap, &tp_o_perr_cause, 0, flags); + } else { + tp_intr_info.details = tp_intr_details; + fatal = t4_handle_intr(adap, &tp_intr_info, 0, flags); } + clear_int_cause_reg(adap, &tp_intr_info, flags); return (fatal); } @@ -5133,16 +5362,86 @@ static bool tp_intr_handler(struct adapter *adap, int arg, int flags) */ static bool sge_intr_handler(struct adapter *adap, int arg, int flags) { + static const struct intr_details sge_int1_details[] = { + { F_PERR_FLM_CREDITFIFO, "SGE FLM credit FIFO parity error" }, + { F_PERR_IMSG_HINT_FIFO, "SGE IMSG hint FIFO parity error" }, + { F_PERR_HEADERSPLIT_FIFO3 | F_PERR_HEADERSPLIT_FIFO2, + "SGE header split FIFO parity error" }, + { F_PERR_PAYLOAD_FIFO3 | F_PERR_PAYLOAD_FIFO2, + "SGE payload FIFO parity error" }, + { F_PERR_PC_RSP, "SGE PC response parity error" }, + { F_PERR_PC_REQ, "SGE PC request parity error" }, + { 0x003c0000, "SGE DBP PC response FIFO parity error" }, + { F_PERR_DMARBT, "SGE DMA RBT parity error" }, + { F_PERR_FLM_DBPFIFO, "SGE FLM DBP FIFO parity error" }, + { F_PERR_FLM_MCREQ_FIFO, "SGE FLM MC request FIFO parity error" }, + { F_PERR_FLM_HINTFIFO, "SGE FLM hint FIFO parity error" }, + { 0x00003c00, "SGE align control FIFO parity error" }, + { 0x000003c0, "SGE EDMA FIFO parity error" }, + { 0x0000003c, "SGE PD FIFO parity error" }, + { F_PERR_ING_CTXT_MIFRSP, "SGE Ingress context MIF response parity error" }, + { F_PERR_EGR_CTXT_MIFRSP, "SGE Egress context MIF response parity error" }, + { 0 } + }; static const struct intr_info sge_int1_info = { .name = "SGE_INT_CAUSE1", .cause_reg = A_SGE_INT_CAUSE1, .enable_reg = A_SGE_INT_ENABLE1, .fatal = 0xffffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = NULL, + .details = sge_int1_details, .actions = NULL, }; - static const struct intr_info sge_int2_info = { + static const struct intr_details t7_sge_int2_details[] = { + { F_TF_FIFO_PERR, "SGE TF FIFO parity error" }, + { F_PERR_EGR_DBP_TX_COAL, "SGE egress DBP TX coal parity error" }, + { F_PERR_DBP_FL_FIFO, "SGE DBP FL FIFO parity error" }, + { F_DEQ_LL_PERR, "SGE linked list SRAM parity error" }, + { F_ENQ_PERR, "SGE enq tag SRAM parity error" }, + { F_DEQ_OUT_PERR, "SGE tbuf deq output FIFO parity error" }, + { F_BUF_PERR, "SGE tbuf main buffer parity error" }, + { F_PERR_CONM_SRAM, "SGE CONM SRAM parity error" }, + { F_PERR_ISW_IDMA3_FIFO | F_PERR_ISW_IDMA2_FIFO | + F_PERR_ISW_IDMA1_FIFO | F_PERR_ISW_IDMA0_FIFO, + "SGE ISW IDMA FIFO parity error" }, + { F_PERR_ISW_DBP_FIFO, "SGE ISW DBP FIFO parity error" }, + { F_PERR_ISW_GTS_FIFO, "SGE ISW GTS FIFO parity error" }, + { F_PERR_ITP_EVR, "SGE ITP EVR parity error" }, + { F_PERR_FLM_CNTXMEM, "SGE FLM context memory parity error" }, + { F_PERR_FLM_L1CACHE, "SGE FLM L1 cache parity error" }, + { F_SGE_IPP_FIFO_PERR, "SGE IPP FIFO parity error" }, + { F_PERR_DBP_HP_FIFO, "SGE DBP HP FIFO parity error" }, + { F_PERR_DB_FIFO, "SGE doorbell FIFO parity error" }, + { F_PERR_ING_CTXT_CACHE | F_PERR_EGR_CTXT_CACHE, + "SGE context cache parity error" }, + { F_PERR_BASE_SIZE, "SGE base size parity error" }, + { 0 } + }; + static const struct intr_details t6_sge_int2_details[] = { + { F_PERR_DBP_HINT_FL_FIFO, "SGE DBP hint FL FIFO parity error" }, + { F_PERR_EGR_DBP_TX_COAL, "SGE egress DBP TX coal parity error" }, + { F_PERR_DBP_FL_FIFO, "SGE DBP FL FIFO parity error" }, + { F_DEQ_LL_PERR, "SGE tbuf dequeue linked list SRAM parity error" }, + { F_ENQ_PERR, "SGE tbuf enqueue tag SRAM parity error" }, + { F_DEQ_OUT_PERR, "SGE tbuf dequeue output FIFO parity error" }, + { F_BUF_PERR, "SGE tbuf main buffer parity error" }, + { F_PERR_CONM_SRAM, "SGE CONM SRAM parity error" }, + { F_PERR_ISW_IDMA1_FIFO, "SGE ISW IDMA FIFO parity error" }, + { F_PERR_ISW_IDMA0_FIFO, "SGE ISW IDMA FIFO parity error" }, + { F_PERR_ISW_DBP_FIFO, "SGE ISW DBP FIFO parity error" }, + { F_PERR_ISW_GTS_FIFO, "SGE ISW GTS FIFO parity error" }, + { F_PERR_ITP_EVR, "SGE ITP EVR parity error" }, + { F_PERR_FLM_CNTXMEM, "SGE FLM context memory parity error" }, + { F_PERR_FLM_L1CACHE, "SGE FLM L1 cache parity error" }, + { F_PERR_DBP_HINT_FIFO, "SGE DBP hint FIFO parity error" }, + { F_PERR_DBP_HP_FIFO, "SGE DBP high priority FIFO parity error" }, + { F_PERR_DB_FIFO, "SGE DBP merge DB FIFO parity error" }, + { F_PERR_ING_CTXT_CACHE, "SGE ingress context cache parity error" }, + { F_PERR_EGR_CTXT_CACHE, "SGE egress context cache parity error" }, + { F_PERR_BASE_SIZE, "SGE base size parity error" }, + { 0 } + }; + struct intr_info sge_int2_info = { .name = "SGE_INT_CAUSE2", .cause_reg = A_SGE_INT_CAUSE2, .enable_reg = A_SGE_INT_ENABLE2, @@ -5231,16 +5530,105 @@ static bool sge_intr_handler(struct adapter *adap, int arg, int flags) .details = NULL, .actions = NULL, }; + static const struct intr_details sge_int4_details[] = { + { F_ERR_ISHIFT_UR1 | F_ERR_ISHIFT_UR0, "SGE ishift underrun" }, + { F_BAR2_EGRESS_LEN_OR_ADDR_ERR, "SGE BAR2 PL access length or alignment error" }, + { F_ERR_CPL_EXCEED_MAX_IQE_SIZE1 | F_ERR_CPL_EXCEED_MAX_IQE_SIZE0, + "SGE CPL exceeds max IQE size" }, + { F_ERR_WR_LEN_TOO_LARGE3 | F_ERR_WR_LEN_TOO_LARGE2 | + F_ERR_WR_LEN_TOO_LARGE1 | F_ERR_WR_LEN_TOO_LARGE0, + "SGE WR length too large" }, + { F_ERR_LARGE_MINFETCH_WITH_TXCOAL3 | F_ERR_LARGE_MINFETCH_WITH_TXCOAL2 | + F_ERR_LARGE_MINFETCH_WITH_TXCOAL1 | F_ERR_LARGE_MINFETCH_WITH_TXCOAL0, + "SGE invalid MinFetchBurst with TxCoalesce" }, + { F_COAL_WITH_HP_DISABLE_ERR, "SGE coalesce with HP disable error" }, + { F_BAR2_EGRESS_COAL0_ERR, "SGE BAR2 PL access addr offset 0" }, + { F_BAR2_EGRESS_SIZE_ERR, "SGE BAR2 illegal egress QID access" }, + { F_FLM_PC_RSP_ERR, "SGE FLM PC response error" }, + { F_ERR_TH3_MAX_FETCH | F_ERR_TH2_MAX_FETCH | + F_ERR_TH1_MAX_FETCH | F_ERR_TH0_MAX_FETCH, + "SGE max fetch violation" }, + { F_ERR_RX_CPL_PACKET_SIZE1 | F_ERR_RX_CPL_PACKET_SIZE0, + "SGE CPL length mismatch error" }, + { F_ERR_BAD_UPFL_INC_CREDIT3 | F_ERR_BAD_UPFL_INC_CREDIT2 | + F_ERR_BAD_UPFL_INC_CREDIT1 | F_ERR_BAD_UPFL_INC_CREDIT0, + "SGE upfl credit wrap error" }, + { F_ERR_PHYSADDR_LEN0_IDMA1 | F_ERR_PHYSADDR_LEN0_IDMA0, + "SGE CPL_RX_PHYS_ADDR length 0 error" }, + { F_ERR_FLM_INVALID_PKT_DROP1 | F_ERR_FLM_INVALID_PKT_DROP0, + "SGE IDMA packet drop due to invalid FLM context" }, + { F_ERR_UNEXPECTED_TIMER, "SGE unexpected timer error" }, + { 0 } + }; static const struct intr_info sge_int4_info = { .name = "SGE_INT_CAUSE4", .cause_reg = A_SGE_INT_CAUSE4, .enable_reg = A_SGE_INT_ENABLE4, .fatal = 0, .flags = 0, - .details = NULL, + .details = sge_int4_details, .actions = NULL, }; - static const struct intr_info sge_int5_info = { + static const struct intr_details t7_sge_int5_details[] = { + { F_ERR_T_RXCRC, "SGE RxCRC error" }, + { F_PERR_MC_RSPDATA, "SGE MC response data parity error" }, + { F_PERR_PC_RSPDATA, "SGE PC response data parity error" }, + { F_PERR_PD_RDRSPDATA, "SGE PD read response data parity error" }, + { F_PERR_U_RXDATA, "SGE U Rx data parity error" }, + { F_PERR_UD_RXDATA, "SGE UD Rx data parity error" }, + { F_PERR_UP_DATA, "SGE uP data parity error" }, + { F_PERR_CIM2SGE_RXDATA, "SGE CIM2SGE Rx data parity error" }, + { F_PERR_IMSG_PD_FIFO, "SGE IMSG PD FIFO parity error" }, + { F_PERR_ULPTX_FIFO1 | F_PERR_ULPTX_FIFO0, "SGE ULPTX FIFO parity error" }, + { F_PERR_IDMA2IMSG_FIFO3 | F_PERR_IDMA2IMSG_FIFO2 | + F_PERR_IDMA2IMSG_FIFO1 | F_PERR_IDMA2IMSG_FIFO0, + "SGE IDMA2IMSG FIFO parity error" }, + { F_PERR_POINTER_DATA_FIFO3 | F_PERR_POINTER_DATA_FIFO2 | + F_PERR_POINTER_DATA_FIFO1 | F_PERR_POINTER_DATA_FIFO0, + "SGE pointer data FIFO parity error" }, + { F_PERR_POINTER_HDR_FIFO3 | F_PERR_POINTER_HDR_FIFO2 | + F_PERR_POINTER_HDR_FIFO1 | F_PERR_POINTER_HDR_FIFO0, + "SGE pointer header FIFO parity error" }, + { F_PERR_PAYLOAD_FIFO1 | F_PERR_PAYLOAD_FIFO0, + "SGE payload FIFO parity error" }, + { F_PERR_MGT_BAR2_FIFO, "SGE MGT BAR2 FIFO parity error" }, + { F_PERR_HEADERSPLIT_FIFO1 | F_PERR_HEADERSPLIT_FIFO0, + "SGE header split FIFO parity error" }, + { F_PERR_HINT_DELAY_FIFO, "SGE hint delay FIFO parity error" }, + { 0 } + }; + static const struct intr_details t6_sge_int5_details[] = { + { F_ERR_T_RXCRC, "SGE T RxCRC parity error" }, + { F_PERR_MC_RSPDATA, "SGE MC response data parity error" }, + { F_PERR_PC_RSPDATA, "SGE PC response data parity error" }, + { F_PERR_U_RXDATA | F_PERR_UD_RXDATA, "SGE ULP Rx data parity error" }, + { F_PERR_UP_DATA, "SGE uP data parity error" }, + { F_PERR_CIM2SGE_RXDATA, "SGE CIM2SGE Rx data parity error" }, + { F_PERR_HINT_DELAY_FIFO1 | F_PERR_HINT_DELAY_FIFO0, + "SGE hint delay FIFO parity error" }, + { F_PERR_IMSG_PD_FIFO, "SGE IMSG PD FIFO parity error" }, + { F_PERR_ULPTX_FIFO1 | F_PERR_ULPTX_FIFO0, + "SGE ULPTX FIFO parity error" }, + { F_PERR_IDMA2IMSG_FIFO1 | F_PERR_IDMA2IMSG_FIFO0, + "SGE IDMA2IMSG FIFO parity error" }, + { F_PERR_POINTER_DATA_FIFO1 | F_PERR_POINTER_DATA_FIFO0, + "SGE pointer data FIFO parity error" }, + { F_PERR_POINTER_HDR_FIFO1 | F_PERR_POINTER_HDR_FIFO0, + "SGE pointer header FIFO parity error" }, + { F_PERR_PAYLOAD_FIFO1 | F_PERR_PAYLOAD_FIFO0, + "SGE payload FIFO parity error" }, + { F_PERR_EDMA_INPUT_FIFO3 | F_PERR_EDMA_INPUT_FIFO2 | + F_PERR_EDMA_INPUT_FIFO1 | F_PERR_EDMA_INPUT_FIFO0, + "SGE EDMA input FIFO parity error" }, + { F_PERR_MGT_BAR2_FIFO, "SGE MGT BAR2 FIFO parity error" }, + { F_PERR_HEADERSPLIT_FIFO1 | F_PERR_HEADERSPLIT_FIFO0, + "SGE header split FIFO parity error" }, + { F_PERR_CIM_FIFO1 | F_PERR_CIM_FIFO0, "SGE CIM FIFO parity error" }, + { F_PERR_IDMA_SWITCH_OUTPUT_FIFO1 | F_PERR_IDMA_SWITCH_OUTPUT_FIFO0, + "SGE IDMA switch output FIFO parity error" }, + { 0 } + }; + struct intr_info sge_int5_info = { .name = "SGE_INT_CAUSE5", .cause_reg = A_SGE_INT_CAUSE5, .enable_reg = A_SGE_INT_ENABLE5, @@ -5249,31 +5637,94 @@ static bool sge_intr_handler(struct adapter *adap, int arg, int flags) .details = NULL, .actions = NULL, }; + static const struct intr_details sge_int6_details[] = { + /* T7+ */ + { 0xe0000000, "SGE fatal DEQ0 DRDY error" }, + { 0x1c000000, "SGE fatal OUT0 DRDY error" }, + { F_IMSG_DBG3_STUCK | F_IMSG_DBG2_STUCK | + F_IMSG_DBG1_STUCK | F_IMSG_DBG0_STUCK, + "SGE IMSG stuck due to insufficient credits" }, + /* T6 + */ + { F_ERR_DB_SYNC, "SGE doorbell sync failed" }, + { F_ERR_GTS_SYNC, "SGE GTS sync failed" }, + { F_FATAL_LARGE_COAL, "SGE BAR2 payload too large" }, + { F_PL_BAR2_FRM_ERR, "SGE BAR2 framing error" }, + { F_SILENT_DROP_TX_COAL, "SGE silent drop of Tx coal WR" }, + { F_ERR_INV_CTXT4, "SGE context access for invalid queue thread 4" }, + { F_ERR_BAD_DB_PIDX4, "SGE doorbell pidx too large thread 4" }, + { F_ERR_BAD_UPFL_INC_CREDIT4, "SGE upfl credit wrap thread 4" }, + { F_FATAL_TAG_MISMATCH, "SGE doorbell tag mismatch" }, + { F_FATAL_ENQ_CTL_RDY, "SGE enq_ctl_fifo overflow" }, + { F_ERR_PC_RSP_LEN3 | F_ERR_PC_RSP_LEN2 | + F_ERR_PC_RSP_LEN1 | F_ERR_PC_RSP_LEN0, + "SGE PCIe response error for DBP threads" }, + { F_FATAL_ENQ2LL_VLD, "SGE tbuf fatal_enq2ll_vld" }, + { F_FATAL_LL_EMPTY, "SGE tbuf fatal_ll_empty" }, + { F_FATAL_OFF_WDENQ, "SGE tbuf fatal_off_wdenq" }, + { 0x00000018, "SGE tbuf fatal_deq1_drdy" }, + { 0x00000006, "SGE tbuf fatal_out1_drdy" }, + { F_FATAL_DEQ, "SGE tbuf fatal_deq" }, + { 0 } + }; static const struct intr_info sge_int6_info = { .name = "SGE_INT_CAUSE6", .cause_reg = A_SGE_INT_CAUSE6, .enable_reg = A_SGE_INT_ENABLE6, .fatal = 0, .flags = 0, - .details = NULL, + .details = sge_int6_details, .actions = NULL, }; + static const struct intr_details sge_int7_details[] = { + { F_HINT_FIFO_FULL, "SGE hint FIFO full" }, + { F_CERR_HINT_DELAY_FIFO, "SGE hint delay FIFO ECC error" }, + { F_COAL_TIMER_FIFO_PERR, "SGE coalescing timer FIFO parity error" }, + { F_CMP_FIFO_PERR, "SGE CMP FIFO parity error" }, + { F_SGE_IPP_FIFO_CERR, "SGE IPP FIFO ECC error" }, + { F_CERR_ING_CTXT_CACHE | F_CERR_EGR_CTXT_CACHE, + "SGE context cache ECC error" }, + { F_IMSG_CNTX_PERR, "SGE IMSG context parity error" }, + { F_PD_FIFO_PERR, "SGE PD FIFO parity error" }, + { F_IMSG_512_FIFO_PERR, "SGE IMSG 512 FIFO parity error" }, + { F_CPLSW_FIFO_PERR, "SGE CPLSW FIFO parity error" }, + { F_IMSG_FIFO_PERR, "SGE IMSG FIFO parity error" }, + { F_CERR_ITP_EVR, "SGE ITP EVR ECC error" }, + { F_CERR_CONM_SRAM, "SGE CONM SRAM ECC error" }, + { F_CERR_FLM_CNTXMEM, "SGE FLM context memory ECC error" }, + { F_CERR_FUNC_QBASE, "SGE function queue base ECC error" }, + { F_IMSG_CNTX_CERR, "SGE IMSG context ECC error" }, + { F_PD_FIFO_CERR, "SGE PD FIFO ECC error" }, + { F_IMSG_512_FIFO_CERR, "SGE IMSG 512 FIFO ECC error" }, + { F_CPLSW_FIFO_CERR, "SGE CPLSW FIFO ECC error" }, + { F_IMSG_FIFO_CERR, "SGE IMSG FIFO ECC error" }, + { 0x0000001e, "SGE header split FIFO ECC error" }, // Bits 4:1 + { F_CERR_FLM_L1CACHE, "SGE FLM L1 cache ECC error" }, + { 0 } + }; static const struct intr_info sge_int7_info = { .name = "SGE_INT_CAUSE7", .cause_reg = A_SGE_INT_CAUSE7, .enable_reg = A_SGE_INT_ENABLE7, .fatal = 0, .flags = 0, - .details = NULL, + .details = sge_int7_details, .actions = NULL, }; + static const struct intr_details sge_int8_details[] = { + { F_TRACE_RXPERR, "SGE trace packet parity error" }, + { F_U3_RXPERR | F_U2_RXPERR | F_U1_RXPERR | F_U0_RXPERR, + "SGE ULP interface parity error" }, + { F_T3_RXPERR | F_T2_RXPERR | F_T1_RXPERR | F_T0_RXPERR, + "SGE TP interface parity error" }, + { 0 } + }; static const struct intr_info sge_int8_info = { .name = "SGE_INT_CAUSE8", .cause_reg = A_SGE_INT_CAUSE8, .enable_reg = A_SGE_INT_ENABLE8, .fatal = 0, .flags = 0, - .details = NULL, + .details = sge_int8_details, .actions = NULL, }; bool fatal; @@ -5281,8 +5732,14 @@ static bool sge_intr_handler(struct adapter *adap, int arg, int flags) if (chip_id(adap) <= CHELSIO_T5) { sge_int3_info.details = sge_int3_details; + } else if (chip_id(adap) == CHELSIO_T6) { + sge_int3_info.details = t6_sge_int3_details; + sge_int2_info.details = t6_sge_int2_details; + sge_int5_info.details = t6_sge_int5_details; } else { sge_int3_info.details = t6_sge_int3_details; + sge_int2_info.details = t7_sge_int2_details; + sge_int5_info.details = t7_sge_int5_details; } fatal = false; @@ -5316,6 +5773,19 @@ static bool sge_intr_handler(struct adapter *adap, int arg, int flags) */ static bool cim_intr_handler(struct adapter *adap, int arg, int flags) { + static const struct intr_details cim_host_t7_intr_details[] = { + { F_CORE7ACCINT, "CIM slave core 7 access interrupt "}, + { F_CORE6ACCINT, "CIM slave core 6 access interrupt "}, + { F_CORE5ACCINT, "CIM slave core 5 access interrupt "}, + { F_CORE4ACCINT, "CIM slave core 4 access interrupt "}, + { F_CORE3ACCINT, "CIM slave core 3 access interrupt "}, + { F_CORE2ACCINT, "CIM slave core 2 access interrupt "}, + { F_CORE1ACCINT, "CIM slave core 1 access interrupt "}, + { F_TIMER1INT, "CIM TIMER0 interrupt" }, + { F_TIMER0INT, "CIM TIMER0 interrupt" }, + { F_PREFDROPINT, "CIM control register prefetch drop" }, + { 0} + }; static const struct intr_details cim_host_intr_details[] = { /* T6+ */ { F_PCIE2CIMINTFPARERR, "CIM IBQ PCIe interface parity error" }, @@ -5328,8 +5798,8 @@ static bool cim_intr_handler(struct adapter *adap, int arg, int flags) { F_SGE2CIMINTFPARERR, "CIM IBQ SGE interface parity error" }, { F_ULP2CIMINTFPARERR, "CIM IBQ ULP_TX interface parity error" }, { F_TP2CIMINTFPARERR, "CIM IBQ TP interface parity error" }, - { F_OBQSGERX1PARERR, "CIM OBQ SGE1_RX parity error" }, - { F_OBQSGERX0PARERR, "CIM OBQ SGE0_RX parity error" }, + { F_OBQSGERX1PARERR, "CIM OBQ PCIE_RX parity error" }, + { F_OBQSGERX0PARERR, "CIM OBQ SGE_RX parity error" }, /* T4+ */ { F_TIEQOUTPARERRINT, "CIM TIEQ outgoing FIFO parity error" }, @@ -5354,16 +5824,17 @@ static bool cim_intr_handler(struct adapter *adap, int arg, int flags) { F_PREFDROPINT, "CIM control register prefetch drop" }, { 0} }; - static const struct intr_info cim_host_intr_info = { + struct intr_info cim_host_intr_info = { .name = "CIM_HOST_INT_CAUSE", .cause_reg = A_CIM_HOST_INT_CAUSE, .enable_reg = A_CIM_HOST_INT_ENABLE, .fatal = 0x007fffe6, .flags = IHF_FATAL_IFF_ENABLED, - .details = cim_host_intr_details, + .details = NULL, .actions = NULL, }; static const struct intr_details cim_host_upacc_intr_details[] = { + { F_CONWRERRINT, "CIM condition write error "}, { F_EEPROMWRINT, "CIM EEPROM came out of busy state" }, { F_TIMEOUTMAINT, "CIM PIF MA timeout" }, { F_TIMEOUTINT, "CIM PIF timeout" }, @@ -5423,18 +5894,54 @@ static bool cim_intr_handler(struct adapter *adap, int arg, int flags) .details = NULL, .actions = NULL, }; + static const struct intr_details cim_perr_cause_details[] = { + { F_T7_MA_CIM_INTFPERR, "MA2CIM interface parity error" }, + { F_T7_MBHOSTPARERR, "Mailbox Host Read parity error" }, + { F_MAARBINVRSPTAG, "MA Arbiter Invalid Response Tag (Fatal)" }, + { F_MAARBFIFOPARERR, "MA Arbiter FIFO Parity Error" }, + { F_SEMSRAMPARERR, "Semaphore logic SRAM Parity Error" }, + { F_RSACPARERR, "RSA Code SRAM Parity Error" }, + { F_RSADPARERR, "RSA Data SRAM Parity Error" }, + { F_T7_PLCIM_MSTRSPDATAPARERR, "PL2CIM Master response data parity error" }, + { F_T7_PCIE2CIMINTFPARERR, "IBQ PCIE intf parity error" }, + { F_T7_NCSI2CIMINTFPARERR, "IBQ NCSI intf parity error" }, + { F_T7_SGE2CIMINTFPARERR, "IBQ SGE Intf Parity error" }, + { F_T7_ULP2CIMINTFPARERR, "IBQ ULP_TX intf parity error" }, + { F_T7_TP2CIMINTFPARERR, "IBQ TP intf parity error" }, + { F_CORE7PARERR, "Slave Core7 parity error" }, + { F_CORE6PARERR, "Slave Core6 parity error" }, + { F_CORE5PARERR, "Slave Core5 parity error" }, + { F_CORE4PARERR, "Slave Core4 parity error" }, + { F_CORE3PARERR, "Slave Core3 parity error" }, + { F_CORE2PARERR, "Slave Core2 parity error" }, + { F_CORE1PARERR, "Slave Core1 parity error" }, + { F_GFTPARERR, "GFT block Memory parity error" }, + { F_MPSRSPDATAPARERR, "MPS lookup interface Response parity error" }, + { F_ER_RSPDATAPARERR, "Expansion ROM/Flash Interface Response Parity Error" }, + { F_FLOWFIFOPARERR, "SGE FlowID Prefetch FIFO Parity Error" }, + { F_OBQSRAMPARERR, "OBQ SRAM Parity Error" }, + { F_TIEQOUTPARERR, "TIE Queue Outgoing FIFO parity error" }, + { F_TIEQINPARERR, "TIE Queue Incoming FIFO parity error" }, + { F_PIFRSPPARERR, "PIF Response interface FIFO Parity error" }, + { F_PIFREQPARERR, "PIF Request interface FIFO Parity error" }, + { 0 } + }; static const struct intr_info cim_perr_cause = { .name = "CIM_PERR_CAUSE", .cause_reg = A_CIM_PERR_CAUSE, .enable_reg = A_CIM_PERR_ENABLE, .fatal = 0xffffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = NULL, + .details = cim_perr_cause_details, .actions = NULL, }; u32 val, fw_err; bool fatal; + if (chip_id(adap) >= CHELSIO_T7) + cim_host_intr_info.details = cim_host_t7_intr_details; + else + cim_host_intr_info.details = cim_host_intr_details; /* * When the Firmware detects an internal error which normally wouldn't * raise a Host Interrupt, it forces a CIM Timer0 interrupt in order @@ -5477,62 +5984,237 @@ static bool ulprx_intr_handler(struct adapter *adap, int arg, int flags) { 0x007fffff, "ULPRX parity error" }, { 0 } }; - static const struct intr_info ulprx_intr_info = { + static const struct intr_details t6_ulprx_int_cause_details[] = { + { F_SE_CNT_MISMATCH_1, "SE count mismatch in channel1" }, + { F_SE_CNT_MISMATCH_0, "SE count mismatch in channel 0" }, + { F_CAUSE_CTX_1, "Context access error on channel 1" }, + { F_CAUSE_CTX_0, "Context access error on channel 0" }, + { F_CAUSE_FF, "filp-flop based fifos" }, + { F_CAUSE_APF_1, "Arb prefetch memory, channel 1" }, + { F_CAUSE_APF_0, "Arb prefetch memory, channel 0" }, + { F_CAUSE_AF_1, "Arb fetch memory, channel 1" }, + { F_CAUSE_AF_0, "Arb fetch memory, channel 0" }, + { F_CAUSE_DDPDF_1, "ddp_data_fifo Fifo, channel 1" }, + { F_CAUSE_DDPMF_1, "ddp_msg_fifo Fifo, channel 1" }, + { F_CAUSE_MEMRF_1, "mem_req_fifo_d Fifo, channel 1" }, + { F_CAUSE_PRSDF_1, "prsr_data_fifo Fifo, channel 1" }, + { F_CAUSE_DDPDF_0, "ddp_data_fifo Fifo, channel 0" }, + { F_CAUSE_DDPMF_0, "ddp_msg_fifo Fifo, channel 0" }, + { F_CAUSE_MEMRF_0, "mem_req_fifo_d Fifo, channel 0" }, + { F_CAUSE_PRSDF_0, "prsr_data_fifo Fifo, channel 0" }, + { F_CAUSE_PCMDF_1, "Pcmd Fifo, channel 1" }, + { F_CAUSE_TPTCF_1, "tpt_ctl_fifo Fifo, channel 1" }, + { F_CAUSE_DDPCF_1, "ddp_ctl_fifo Fifo, channel 1" }, + { F_CAUSE_MPARF_1, "mpar_ctl_fifo Fifo, channel 1" }, + { F_CAUSE_MPARC_1, "mpac_ctl_fifo Fifo, channel 1" }, + { F_CAUSE_PCMDF_0, "Pcmd Fifo, channel 0" }, + { F_CAUSE_TPTCF_0, "tpt_ctl_fifo Fifo, channel 0" }, + { F_CAUSE_DDPCF_0, "ddp_ctl_fifo Fifo, channel 0" }, + { F_CAUSE_MPARF_0, "mpar_ctl_fifo Fifo, channel 0" }, + { F_CAUSE_MPARC_0, "mpac_ctl_fifo Fifo, channel 0" }, + { 0 } + }; + static const struct intr_details t7_ulprx_int_cause_details[] = { + { F_CERR_PCMD_FIFO_3, "PCMD FIFO correctable Error3" }, + { F_CERR_PCMD_FIFO_2, "PCMD FIFO correctable Error2" }, + { F_CERR_PCMD_FIFO_1, "PCMD FIFO correctable Error1" }, + { F_CERR_PCMD_FIFO_0, "PCMD FIFO correctable Error0" }, + { F_CERR_DATA_FIFO_3, "DDP Data FIFO correctable Error3" }, + { F_CERR_DATA_FIFO_2, "DDP Data FIFO correctable Error2" }, + { F_CERR_DATA_FIFO_1, "DDP Data FIFO correctable Error1" }, + { F_CERR_DATA_FIFO_0, "DDP Data FIFO correctable Error0" }, + { F_SE_CNT_MISMATCH_3, "SE count mismatch in channel3" }, + { F_SE_CNT_MISMATCH_2, "SE count mismatch in channel2" }, + { F_T7_SE_CNT_MISMATCH_1, "SE count mismatch in channel1" }, + { F_T7_SE_CNT_MISMATCH_0, "SE count mismatch in channel 0" }, + { F_T7_ENABLE_CTX_3, "Context access error on channel 3" }, + { F_T7_ENABLE_CTX_2, "Context access error on channel 2" }, + { F_T7_ENABLE_CTX_1, "Context access error on channel 1" }, + { F_T7_ENABLE_CTX_0, "Context access error on channel 0" }, + { F_T7_ENABLE_ALN_SDC_ERR_3, "SDC error reported by aligner in channel3" }, + { F_T7_ENABLE_ALN_SDC_ERR_2, "SDC error reported by aligner in channel2" }, + { F_T7_ENABLE_ALN_SDC_ERR_1, "SDC error reported by aligner in channel1" }, + { F_T7_ENABLE_ALN_SDC_ERR_0, "SDC error reported by aligner in channel0" }, + { 0 } + }; + struct intr_info ulprx_intr_info = { .name = "ULP_RX_INT_CAUSE", .cause_reg = A_ULP_RX_INT_CAUSE, .enable_reg = A_ULP_RX_INT_ENABLE, .fatal = 0x07ffffff, .flags = IHF_FATAL_IFF_ENABLED, - .details = ulprx_intr_details, + .details = NULL, .actions = NULL, }; + static const struct intr_details ulprx_int_cause_2_details[] = { + { F_ULPRX2MA_INTFPERR, "SDC error reported by ULPRX2MA interface parity checker" }, + { F_ALN_SDC_ERR_1, "SDC error reported by aligner in channel 1" }, + { F_ALN_SDC_ERR_0, "SDC error reported by aligner in channel 0" }, + { F_PF_UNTAGGED_TPT_1, "Parity error from Untagged TPT prefetch fifo channel 1" }, + { F_PF_UNTAGGED_TPT_0, "Parity error from Untagged TPT prefetch fifo channel 0" }, + { F_PF_PBL_1, "Parity error from PBL prefetch fifo channel 1" }, + { F_PF_PBL_0, "Parity error from PBL prefetch fifo channel 0" }, + { F_DDP_HINT_1, "DDP hint fifo Perr in channel 1" }, + { F_DDP_HINT_0, "DDP hint fifo Perr in channel 0" }, + { 0 } + }; static const struct intr_info ulprx_intr2_info = { .name = "ULP_RX_INT_CAUSE_2", .cause_reg = A_ULP_RX_INT_CAUSE_2, .enable_reg = A_ULP_RX_INT_ENABLE_2, .fatal = 0, .flags = 0, - .details = NULL, + .details = ulprx_int_cause_2_details, .actions = NULL, }; + static const struct intr_details ulprx_int_cause_pcmd_details[] = { + { F_CAUSE_PCMD_SFIFO_3, "Small FIFOs, channel 3" }, + { F_CAUSE_PCMD_FIFO_3, "pcmd_ctl_fifo, channel 3" }, + { F_CAUSE_PCMD_DDP_HINT_3, "ddp_hint_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_PCMD_TPT_3, "tpt_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_PCMD_DDP_3, "ddp_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_PCMD_MPAR_3, "mpar_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_PCMD_MPAC_3, "mpac_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_PCMD_SFIFO_2, "Small FIFOs, channel 2" }, + { F_CAUSE_PCMD_FIFO_2, "pcmd_ctl_fifo, channel 2" }, + { F_CAUSE_PCMD_DDP_HINT_2, "ddp_hint_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_PCMD_TPT_2, "tpt_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_PCMD_DDP_2, "ddp_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_PCMD_MPAR_2, "mpar_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_PCMD_MPAC_2, "mpac_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_PCMD_SFIFO_1, "Small FIFOs, channel 1" }, + { F_CAUSE_PCMD_FIFO_1, "pcmd_ctl_fifo, channel 1" }, + { F_CAUSE_PCMD_DDP_HINT_1, "ddp_hint_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_PCMD_TPT_1, "tpt_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_PCMD_DDP_1, "ddp_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_PCMD_MPAR_1, "mpar_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_PCMD_MPAC_1, "mpac_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_PCMD_SFIFO_0, "Small FIFOs, channel 0" }, + { F_CAUSE_PCMD_FIFO_0, "pcmd_ctl_fifo, channel 0" }, + { F_CAUSE_PCMD_DDP_HINT_0, "ddp_hint_ctl_fifo FIFO, channel 0" }, + { F_CAUSE_PCMD_TPT_0, "tpt_ctl_fifo FIFO, channel 0" }, + { F_CAUSE_PCMD_DDP_0, "ddp_ctl_fifo FIFO, channel 0" }, + { F_CAUSE_PCMD_MPAR_0, "mpar_ctl_fifo FIFO, channel 0" }, + { F_CAUSE_PCMD_MPAC_0, "mpac_ctl_fifo FIFO, channel 0" }, + { 0 } + }; static const struct intr_info ulprx_int_cause_pcmd = { .name = "ULP_RX_INT_CAUSE_PCMD", .cause_reg = A_ULP_RX_INT_CAUSE_PCMD, .enable_reg = A_ULP_RX_INT_ENABLE_PCMD, .fatal = 0, .flags = 0, - .details = NULL, + .details = ulprx_int_cause_pcmd_details, .actions = NULL, }; + static const struct intr_details ulprx_int_cause_data_details[] = { + { F_CAUSE_DATA_SNOOP_3, "Snoop FIFO, channel 3" }, + { F_CAUSE_DATA_SFIFO_3, "Small FIFO, channel 3" }, + { F_CAUSE_DATA_FIFO_3, "data_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_DATA_DDP_3, "ddp_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_DATA_CTX_3, "ctx_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_DATA_PARSER_3, "parser_ctl_fifo FIFO, channel 3" }, + { F_CAUSE_DATA_SNOOP_2, "Snoop FIFO, channel 2" }, + { F_CAUSE_DATA_SFIFO_2, "Small FIFO, channel 2" }, + { F_CAUSE_DATA_FIFO_2, "data_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_DATA_DDP_2, "ddp_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_DATA_CTX_2, "ctx_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_DATA_PARSER_2, "parser_ctl_fifo FIFO, channel 2" }, + { F_CAUSE_DATA_SNOOP_1, "Snoop FIFO, channel 1" }, + { F_CAUSE_DATA_SFIFO_1, "Small FIFO, channel 1" }, + { F_CAUSE_DATA_FIFO_1, "data_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_DATA_DDP_1, "ddp_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_DATA_CTX_1, "ctx_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_DATA_PARSER_1, "parser_ctl_fifo FIFO, channel 1" }, + { F_CAUSE_DATA_SNOOP_0, "Snoop FIFO, channel 0" }, + { F_CAUSE_DATA_SFIFO_0, "Small FIFO, channel 0" }, + { F_CAUSE_DATA_FIFO_0, "data_ctl_fifo FIFO, channel 0" }, + { F_CAUSE_DATA_DDP_0, "ddp_ctl_fifo FIFO, channel 0" }, + { F_CAUSE_DATA_CTX_0, "ctx_ctl_fifo FIFO, channel 0" }, + { F_CAUSE_DATA_PARSER_0, "parser_ctl_fifo FIFO, channel 0" }, + { 0 } + }; static const struct intr_info ulprx_int_cause_data = { .name = "ULP_RX_INT_CAUSE_DATA", .cause_reg = A_ULP_RX_INT_CAUSE_DATA, *** 1717 LINES SKIPPED *** From nobody Thu May 28 19:50:10 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 4gRHCC2tvNz6f0md for ; Thu, 28 May 2026 19:50:15 +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 4gRHCC1chTz4HTd for ; Thu, 28 May 2026 19:50:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779997815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MG+JJ+R3Ulr831Nh/7wlxunxDxECkntNm9KpAwmPrBo=; b=vc/KRlKIaoad9xgd1Meu3dk7GvmXl44YPVtmsOLsJZBvIf5BYfERsmaPp5jzBcMVdOrHoc Bz/c6soX3KFDHioJPSi0kXCLt1LwvaYYOs1dd+jRipfK8DHelUPxi8Yc2Gl78kaglLzrN9 UsCMWKb9HOGm1P5Gk9vgC3sNjYaMiALFFI6QoCNljE1R6XY02zoQ138PfV3z90soNcCiti Hz7SxuiAHQ48WmdBjjLHRvYdFfCVXM8Lkha0s0BvYsQfgo0BWVYL6T87BtjakF6w9KE+3Y iOxuCb62RjbsmQjP2KkVfrqxAgYYAUpELBdZNEf/uR39F4VemdkOGVa6gYFthw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779997815; a=rsa-sha256; cv=none; b=lTVK8q5MRsxmt1iQE8mPwYWoO7kG1tTNcPJswEzBOCRYrLGl1/SRVAzuIbkn8eXdmQvhNu vCd51ZG7FUARv1hEhd6lr2P5BcLfknA1Zf80AFetWyF8lBp+IW7vXfm7wbraqkRg9Pxd5T vCTcBKRGpba14X77/wU00dNoQOK+9i1ZbGFQCJui6ZPfzvpuoZzD38TDPWPNhfoWVRcXPx lDB2DzcqTGTavnBReRLki7AHRq2K8bkfMdhlKKmqmzntbPpzYUFK5UdxwQ0WSwUGAVFNG/ hnwVvAX+vdE30jkm3dET/VTV0KZ/1o7bnM/mDK1tErHKH6fCQAl5x+Gg2kckYA== 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=1779997815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MG+JJ+R3Ulr831Nh/7wlxunxDxECkntNm9KpAwmPrBo=; b=Aa+uFK/WgN/0E/L91ZwyuXea2Rww60/qtWb+ejMmvfusTrdDKhjAlQNYtHaJIeZdZglfT0 CGBq5sxo64Hstz20yaGTSTpM2y+9s6x5EET3fEPRQZbz084NPTnjBjashkUEoy70rOebFA uH0EczLHEKq+gsjyOyrwl7ukSLW4vg7T6pYXG7TGb5I4tRos0pNpSyRcKsXh3jemErPYH2 s7gpQaGKtVi7jhXNAwGGEs7vvZq73/SedoLg0zrMwORZ/uWRW6sFcW5LnouGu6xR7yvC47 qYJ70FGWkvcw9ZwuTpuapqtUQT89WCh5lf/q6Coix51b7HkuFJGJn+7AdgABdQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRHCC1B3Zz11B6 for ; Thu, 28 May 2026 19:50:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 24675 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 19:50:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: YAO, Xin From: Pouria Mousavizadeh Tehrani Subject: git: 30c85b7cb9fc - main - linuxulator: return EBADF for O_PATH mmap() 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: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30c85b7cb9fc52492f2b3a3ae4e0b16ed717c58a Auto-Submitted: auto-generated Date: Thu, 28 May 2026 19:50:10 +0000 Message-Id: <6a189c72.24675.5cfb4a79@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=30c85b7cb9fc52492f2b3a3ae4e0b16ed717c58a commit 30c85b7cb9fc52492f2b3a3ae4e0b16ed717c58a Author: YAO, Xin AuthorDate: 2026-05-07 06:39:16 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-05-28 19:47:04 +0000 linuxulator: return EBADF for O_PATH mmap() This fixes LTP open13, which expects O_PATH mmap() to fail with EBADF, but FreeBSD returned EACCES. Signed-off-by: YAO, Xin PR: 295571 Reviewed by: kib Pull-Request: https://github.com/freebsd/freebsd-src/pull/2233 --- sys/compat/linux/linux_mmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c index a8e790a29da4..9fecb6ebb2ad 100644 --- a/sys/compat/linux/linux_mmap.c +++ b/sys/compat/linux/linux_mmap.c @@ -63,6 +63,10 @@ static int linux_mmap_check_fp(struct file *fp, int flags, int prot, int maxprot) { + /* Linux returns EBADF if mmap() is called on an O_PATH file descriptor */ + if (fp->f_ops == &path_fileops) + return (EBADF); + /* Linux mmap() just fails for O_WRONLY files */ if ((fp->f_flag & FREAD) == 0) return (EACCES); From nobody Thu May 28 19:50:16 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 4gRHCF0kkvz6f0V5 for ; Thu, 28 May 2026 19:50:17 +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 4gRHCD4Y75z4H9B for ; Thu, 28 May 2026 19:50:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779997816; 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=cyXlzvbAa+VZJbtIZvJLNGUFUP3lzqwgnqWEpkje5dI=; b=Pc2AtVl0wzVNq995Y3C4kPY5QjlZG5GYgIwdIcHmzRYEM46t7s14t445ND9zyqzwko17rh QWXTDfKM2CpFMSOtL5RJfHsC3O4q4CQ3w13epr3jpSYsi2d76jgFwM/q/2UNpB9Z0EB4Lx Rs+/8m2Gjhq8jQ2X9sPAZMwwhs/L9RUroU1Q0LRqyvQRgDdJqVTn7zEgFD89mONNvtHAxh jT+J9O5tqOinIuMGthEOwj9iPvj8eDD4L3qZtnuE9yJy1dprwxuBCV9c276+L5CQ5q8ujq Tvhwyv+meenWOru+dz2PgQr37/XFSDac0ZV1rJavdQgWPHR3m/GNqUPSDDzaCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779997816; a=rsa-sha256; cv=none; b=AGVg5s73427CBYCbzfuTRDCpZncBiw7mYbCMfW5YApPWwkaNO7fqXteq/36J9Y6kEep2NH wSBUe+ZQMV/faNL5/u/p2KBnabibStxbcQ1ibVhRnN/+NVXcusdfhYlAgpeGN7fAhJV2Hj acev3ATYitKKlAeNUwMIXGIaa7YQAgzjpbAoUdJ3jdsfV9QNaUjgvedzj2CU5hvI2aj0Tc gKAAw0WHGJJ1NSmBa0T0+5S6o0VdaKFxxaAapSiSS9n2qEpxYVG/aM9feJ4PFR5SEU22Be mtQYNH9kKZnET2fJ27vgs/3Hg6M1KfFvRehapT+1Q8BplEUUXQOyaM1EzwzO/Q== 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=1779997816; 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=cyXlzvbAa+VZJbtIZvJLNGUFUP3lzqwgnqWEpkje5dI=; b=Di/6oFwOWaNnwFaZoWz3eVvpT9yKaCkjWnys06VDXw4dyYSV7BLUy1VicrIRXPz8AEqHK2 d12ymsLvx/MSMhWvP17JQcwNShPm34EvtW/jMk2PAmzXf3YBJv0xypgFNIuRTtB4KjMF5A MKgmzQpVCtKy6xVdf6rwsOqfAJjIDBX1GpV8UdRoo8tp+NWWlWH0O1nRGyq1kWylApDrdb DkNPOHvnEMO/H/1BTDZ7qgscShG192cIUT7lAX7qb3rOpFNSyfdMfAmw7pkIFxLMP9XwqO oQAQpCW7eG54JPvh2qlQeFIPkHnSImPUeeOyhr/nTQH1JUgt3dIgFaCZVWRcZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRHCD47KTz10Tg for ; Thu, 28 May 2026 19:50:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23f6c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 19:50:16 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 774543072db4 - main - LinuxKPI: migrate key data access to functions 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 774543072db4949a4177ad4bbdac9fb712bc86f6 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 19:50:16 +0000 Message-Id: <6a189c78.23f6c.2aa49b96@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=774543072db4949a4177ad4bbdac9fb712bc86f6 commit 774543072db4949a4177ad4bbdac9fb712bc86f6 Author: Adrian Chadd AuthorDate: 2026-05-28 19:49:31 +0000 Commit: Adrian Chadd CommitDate: 2026-05-28 19:50:12 +0000 LinuxKPI: migrate key data access to functions * Migrate the k->wk_key and k->wk_keylen access to the new crypto methods in net80211 * don't use ic_miclen, use the tx/rx mic len methods * don't use wk_txmic and wk_rxmic, use the tx/rx mic data methods This is in preparation to support GTK/IGTK keys and > 128 bit keys. Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D54485 --- sys/compat/linuxkpi/common/src/linux_80211.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index cade61e8446f..901c59702840 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1607,12 +1607,13 @@ lkpi_iv_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) } sta = LSTA_TO_STA(lsta); - keylen = k->wk_keylen; + keylen = ieee80211_crypto_get_key_len(k); lcipher = lkpi_net80211_to_l80211_cipher_suite( - k->wk_cipher->ic_cipher, k->wk_keylen); + k->wk_cipher->ic_cipher, ieee80211_crypto_get_key_len(k)); switch (lcipher) { case WLAN_CIPHER_SUITE_TKIP: - keylen += 2 * k->wk_cipher->ic_miclen; + keylen += ieee80211_crypto_get_key_txmic_len(k); + keylen += ieee80211_crypto_get_key_rxmic_len(k); break; case WLAN_CIPHER_SUITE_CCMP: case WLAN_CIPHER_SUITE_GCMP: @@ -1643,8 +1644,9 @@ lkpi_iv_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) kc->hw_key_idx = /* set by hw and needs to be passed for TX */; #endif atomic64_set(&kc->tx_pn, k->wk_keytsc); - kc->keylen = k->wk_keylen; - memcpy(kc->key, k->wk_key, k->wk_keylen); + kc->keylen = ieee80211_crypto_get_key_len(k); + memcpy(kc->key, ieee80211_crypto_get_key_data(k), + ieee80211_crypto_get_key_len(k)); if (k->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)) kc->flags |= IEEE80211_KEY_FLAG_PAIRWISE; @@ -1656,8 +1658,12 @@ lkpi_iv_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) switch (kc->cipher) { case WLAN_CIPHER_SUITE_TKIP: - memcpy(kc->key + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY, k->wk_txmic, k->wk_cipher->ic_miclen); - memcpy(kc->key + NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY, k->wk_rxmic, k->wk_cipher->ic_miclen); + memcpy(kc->key + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY, + ieee80211_crypto_get_key_txmic_data(k), + ieee80211_crypto_get_key_txmic_len(k)); + memcpy(kc->key + NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY, + ieee80211_crypto_get_key_rxmic_data(k), + ieee80211_crypto_get_key_rxmic_len(k)); break; case WLAN_CIPHER_SUITE_CCMP: case WLAN_CIPHER_SUITE_GCMP: @@ -5531,10 +5537,10 @@ lkpi_hw_crypto_prepare_tkip(struct ieee80211_key *k, * "enmic" (though we do not do that). */ /* any conditions to not apply this? */ - if (skb_tailroom(skb) < k->wk_cipher->ic_miclen) + if (skb_tailroom(skb) < ieee80211_crypto_get_key_txmic_len(k)) return (ENOBUFS); - p = skb_put(skb, k->wk_cipher->ic_miclen); + p = skb_put(skb, ieee80211_crypto_get_key_txmic_len(k)); if ((kc->flags & IEEE80211_KEY_FLAG_PUT_MIC_SPACE) != 0) goto encrypt; From nobody Thu May 28 20:01:18 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 4gRHRy50yqz6f1J8 for ; Thu, 28 May 2026 20:01:18 +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 4gRHRy2k0mz4Jyq for ; Thu, 28 May 2026 20:01:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1779998478; 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=A5nHVuqrKnxoUgiX4MeiaVMewzjjrR/vl/hrPZEyU9A=; b=oS7xmthGVN6+jhIrugQ02celdaMyC+WAc3csKgchqTBNDtNIBLxzThKsh5BCvD4/0PU2YP uz+b+vTOQDpwJ6hXYQqOL30EcTpm69kKcnBjfSaCrV2K+xrH4DvjUHH0580t+KXM2e/rym 0yWDbqIFNP55vRsacqo9yau9I7mWYKrux2TYN3sTuFENjjzTbS4WWjZpXwN3YhBMtU7DZA HgL8sNBQuUXoBJOR0/7pPur3NtYT1zGc042pHZcl5yWHG9av+lku+rhwQimyuaxNYuvYzT WhUTPLgA2rkRkcBYrKdH+VdeAijKr+0Nk03QZQy9ZCTwB2nFbjI7Am3xC4zoRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1779998478; a=rsa-sha256; cv=none; b=fAisMhxZAeMxBFdy7Em721WCOa4cQ8x/Bx3M9yIblQuC6a/lF0q136T48HNH+j5+yNzBp2 3tr/KFLTbpgyMckwMtqISVJCd9olj4Qt3knwhnl7TuRDjas8BxgQuqLr6MOmrerST1gcIE PjXdgOTNE6o0+KHf/v1hyovxlWpCWRGUy2cGL/eCc30aMv0g21yV74HzlkdAQZzs9ehc1G Nuu2d2VKA29YgdFZEJ3Ne/u++TJ5RhgP2CnnDL4QPFRnU4VqHs+K8/Zb51iFBjmImQEzyG e5AVbK0IQzgnNPDTxp87NIHM2rbPLHLB0PHM04LCHZhi0cmrWCMhhdaci0XRZg== 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=1779998478; 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=A5nHVuqrKnxoUgiX4MeiaVMewzjjrR/vl/hrPZEyU9A=; b=YF4q7uCErujxU07lShtRhqvZk75x88o/sYdyZXuWlCcAp7ymgBoVAtxMZrGv+MFRXT+SUr BLTuNxQnHAKY8lq/bFuCyTZfEQP1qtV9/V9L5s3a4H1wLrnpbfC4aEHEjJuvDW+DcMwscd Amv35H564P3qIIo78G4rGrKBmv8w+MX91VuBS4aJuHJjz8l+e6cymOoUPc9EOVYYH4Rids E5vGTup/5FjvZ8h5npcyXUZ0mqZT8xkmFOweyictlHZG5v+hWesYbgyASRsmXHEYZkw9ni hOSB96JdDNuWHA6fdO8jNVNunythdL4cBZfftH34puYUbELRVMXtIAaf6AGykQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRHRy24Yhz11Rq for ; Thu, 28 May 2026 20:01:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26ecf by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 20:01:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: 97f7b21dd525 - main - rtnetlink: Fix weight overflow in RTA_MULTIPATH 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: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97f7b21dd52542421bc883e336e35af078af47fe Auto-Submitted: auto-generated Date: Thu, 28 May 2026 20:01:18 +0000 Message-Id: <6a189f0e.26ecf.5c59f70@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=97f7b21dd52542421bc883e336e35af078af47fe commit 97f7b21dd52542421bc883e336e35af078af47fe Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-05-27 09:58:34 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-05-28 20:00:15 +0000 rtnetlink: Fix weight overflow in RTA_MULTIPATH If the weight value is larger than 8 bits, set it to the maximum. Also, only send RTA_WEIGHT if its value is not the default. This reduces message size and matches the behavior of non-multipath routes. Reviewed by: emaste, markj Differential Revision: https://reviews.freebsd.org/D57266 --- sys/netlink/route/rt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index ee17737426ed..17aae399c10a 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -217,7 +217,7 @@ dump_rc_nhg(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtms return; rtnh->rtnh_flags = 0; rtnh->rtnh_ifindex = if_getindex(wn[i].nh->nh_ifp); - rtnh->rtnh_hops = wn[i].weight; + rtnh->rtnh_hops = MIN(wn[i].weight, UINT8_MAX); dump_rc_nhop_gw(nw, wn[i].nh); uint32_t rtflags = nhop_get_rtflags(wn[i].nh); if (rtflags != base_rtflags) @@ -242,7 +242,8 @@ dump_rc_nhg(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtms } nlattr_set_len(nw, off); nlattr_add_u32(nw, NL_RTA_PRIORITY, nhop_metric); - nlattr_add_u32(nw, NL_RTA_WEIGHT, nhop_weight); + if (nhop_weight != RT_DEFAULT_WEIGHT) + nlattr_add_u32(nw, NL_RTA_WEIGHT, nhop_weight); } static void From nobody Thu May 28 20:59:50 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 4gRJlV45Ypz6f5Xl for ; Thu, 28 May 2026 20:59:50 +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 4gRJlV3N2qz3CJd for ; Thu, 28 May 2026 20:59:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780001990; 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=gOGL05koK69ebE6RKpEb7tSeL4/EOmipbKwYlRE2hEY=; b=tgrFAdt69Fk9B17zcJ/0sgZPRuI/myEBwGHvp92GsIPAwImzyowmpUcBTocpqB7b3jCYmM WyCItd9GDTSn+51dqw2oZg7/s6bXTgRvg2cKl3NasHnJFwol69TAfN6BIVxcENAM39NgWT YSRFO7RTSus4LqnJfzA+QdnJtXly5RVXLpeL02rwU1mFihNh9zxMEoAFMDBAEyb72rnwxx kO9gQoUipt1/wSSdT7cwJLU6qqvuZ34jW6VpTOflRyg2RQnYE/7g0Bpcc2GBMeeetYiNPI l5PmAVFaD5sTsTYeZ7NuWetS++6IxV+MV75cDfDmmoWywphTbkVWJaTbp/TtOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780001990; a=rsa-sha256; cv=none; b=w8ehc8Ph9Fb4/hA/BBeOIDXafiEGTiPeDfswpGki9LP3ahrJ9Ht0UGs15pI4bdUOZ26hG9 ZqpID+pBYlD2C+R8snEjRVhy8XoAkVr3Vf+XSkQzQM2qrDUdEAOBPZ/UnaxDaTXgMT9CKH 8922tJKY3TZVsijMBj3tByM6wepwBvAonimZuoRRM7YHlJKJxa5Y3ghvmSwxPXdpeB1IwG BdTNz17EMIEVfg2/QQquNh4IJ+gXxSj7Xbme/jpjiYT7E2sDW1wfFaeo1lzTiTmTajeksm YDeBL71jKWBEihFNhgpQ8Xqj0GyhHAK8hV6EQhO2WrN0UazhpJQmwf7rFTf+NA== 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=1780001990; 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=gOGL05koK69ebE6RKpEb7tSeL4/EOmipbKwYlRE2hEY=; b=TuXY4osNGhdXePjYXr8aTMvp3ui6sK2m9JpOrzHa2+Hcmwz9WBtaNUF2glGwup5QAIz7+8 PlJU6Syb5H6AcODCCIn9fqYxye20bvgs3rQFpm38zTxpDnY8zz8Ch05aHpcv7dPlU2PQmt PlEJlpO1CrFrbWOgZVtkHGvX8cznpvS65WSZiqqQiJ9Jz2AzK3w9SMFwO2u0zawpuOhaJe X6AyNHJB8NvW2/smY08OdLHSzXVdKVE4clGtqG4nZgiEwmhjGl36ylfDbW65i9EBvqAHeC w4nhcbUm5sey2yT1jIrziPFMVtckAYIUAfeq4+kLJJYekoJYbpqY7J+RR+0wXA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRJlV2mQ2z12lb for ; Thu, 28 May 2026 20:59:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34382 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 20:59:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9b729333bb24 - main - image activators: pass the current thread 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b729333bb2495afb8821044fa42c9ebe0874703 Auto-Submitted: auto-generated Date: Thu, 28 May 2026 20:59:50 +0000 Message-Id: <6a18acc6.34382.2c1b9c0e@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9b729333bb2495afb8821044fa42c9ebe0874703 commit 9b729333bb2495afb8821044fa42c9ebe0874703 Author: Konstantin Belousov AuthorDate: 2026-05-28 09:06:04 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-28 20:59:25 +0000 image activators: pass the current thread Reviewed by: markj Tested by: Alex S Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57294 --- sys/kern/imgact_elf.c | 36 ++++++++++++++++-------------------- sys/kern/kern_exec.c | 1 + sys/sys/imgact.h | 1 + 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index af0841c75549..42cdfa08f19b 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -94,7 +94,7 @@ static int __elfN(check_header)(const Elf_Ehdr *hdr); static const Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, const char *interp, int32_t *osrel, uint32_t *fctl0); -static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr, +static int __elfN(load_file)(struct thread *td, const char *file, u_long *addr, u_long *entry); static int __elfN(load_section)(const struct image_params *imgp, vm_ooffset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, @@ -780,8 +780,8 @@ __elfN(load_sections)(const struct image_params *imgp, const Elf_Ehdr *hdr, * the entry point for the loaded file. */ static int -__elfN(load_file)(struct proc *p, const char *file, u_long *addr, - u_long *entry) +__elfN(load_file)(struct thread *td, const char *file, u_long *addr, + u_long *entry) { struct { struct nameidata nd; @@ -802,7 +802,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr, * XXXJA: This check can go away once we are sufficiently confident * that the checks in namei() are correct. */ - if (IN_CAPABILITY_MODE(curthread)) + if (IN_CAPABILITY_MODE(td)) return (ECAPMODE); #endif @@ -814,7 +814,8 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr, /* * Initialize part of the common data */ - imgp->proc = p; + imgp->td = td; + imgp->proc = td->td_proc; imgp->attr = attr; NDINIT(nd, LOOKUP, ISOPEN | FOLLOW | LOCKSHARED | LOCKLEAF, @@ -867,8 +868,8 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr, if (error != 0) goto fail; - if (p->p_sysent->sv_protect != NULL) - p->p_sysent->sv_protect(imgp, SVP_INTERP); + if (imgp->proc->p_sysent->sv_protect != NULL) + imgp->proc->p_sysent->sv_protect(imgp, SVP_INTERP); *addr = base_addr; *entry = (unsigned long)hdr->e_entry + rbase; @@ -1008,7 +1009,6 @@ static int __elfN(get_interp)(struct image_params *imgp, const Elf_Phdr *phdr, char **interpp, bool *free_interpp) { - struct thread *td; char *interp; int error, interp_name_len; @@ -1016,8 +1016,6 @@ __elfN(get_interp)(struct image_params *imgp, const Elf_Phdr *phdr, ("%s: p_type %u != PT_INTERP", __func__, phdr->p_type)); ASSERT_VOP_LOCKED(imgp->vp, __func__); - td = curthread; - /* Path to interpreter */ if (phdr->p_filesz < 2 || phdr->p_filesz > MAXPATHLEN) { uprintf("Invalid PT_INTERP\n"); @@ -1045,8 +1043,8 @@ __elfN(get_interp)(struct image_params *imgp, const Elf_Phdr *phdr, error = vn_rdwr(UIO_READ, imgp->vp, interp, interp_name_len, phdr->p_offset, - UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, - NOCRED, NULL, td); + UIO_SYSSPACE, IO_NODELOCKED, imgp->td->td_ucred, + NOCRED, NULL, imgp->td); if (error != 0) { free(interp, M_TEMP); uprintf("i/o error PT_INTERP %d\n", error); @@ -1079,13 +1077,13 @@ __elfN(load_interp)(struct image_params *imgp, const Elf_Brandinfo *brand_info, if (brand_info->interp_newpath != NULL && (brand_info->interp_path == NULL || strcmp(interp, brand_info->interp_path) == 0)) { - error = __elfN(load_file)(imgp->proc, + error = __elfN(load_file)(imgp->td, brand_info->interp_newpath, addr, entry); if (error == 0) return (0); } - error = __elfN(load_file)(imgp->proc, interp, addr, entry); + error = __elfN(load_file)(imgp->td, interp, addr, entry); if (error == 0) return (0); @@ -1102,7 +1100,6 @@ __elfN(load_interp)(struct image_params *imgp, const Elf_Brandinfo *brand_info, static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) { - struct thread *td; const Elf_Ehdr *hdr; const Elf_Phdr *phdr; Elf_Auxargs *elf_auxargs; @@ -1152,7 +1149,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) entry = proghdr = 0; interp = NULL; free_interp = false; - td = curthread; /* * Somewhat arbitrary, limit accepted max alignment for the @@ -1329,7 +1325,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) map = &vmspace->vm_map; maxv = sv->sv_usrstack; if ((imgp->map_flags & MAP_ASLR_STACK) == 0) - maxv -= lim_max(td, RLIMIT_STACK); + maxv -= lim_max(imgp->td, RLIMIT_STACK); if (error == 0 && mapsz >= maxv - vm_map_min(map)) { uprintf("Excessive mapping size\n"); error = ENOEXEC; @@ -1339,7 +1335,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) KASSERT((map->flags & MAP_ASLR) != 0, ("ET_DYN_ADDR_RAND but !MAP_ASLR")); error = __CONCAT(rnd_, __elfN(base))(map, - vm_map_min(map) + mapsz + lim_max(td, RLIMIT_DATA), + vm_map_min(map) + mapsz + lim_max(imgp->td, RLIMIT_DATA), /* reserve half of the address space to interpreter */ maxv / 2, maxalign, &imgp->et_dyn_addr); } @@ -1362,7 +1358,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) * calculation is that it leaves room for the heap to grow to * its maximum allowed size. */ - addr = round_page((vm_offset_t)vmspace->vm_daddr + lim_max(td, + addr = round_page((vm_offset_t)vmspace->vm_daddr + lim_max(imgp->td, RLIMIT_DATA)); if ((map->flags & MAP_ASLR) != 0) { maxv1 = maxv / 2 + addr / 2; @@ -2809,7 +2805,7 @@ __elfN(parse_notes)(const struct image_params *imgp, const Elf_Note *checknote, } error = vn_rdwr(UIO_READ, imgp->vp, buf, pnote->p_filesz, pnote->p_offset, UIO_SYSSPACE, IO_NODELOCKED, - curthread->td_ucred, NOCRED, NULL, curthread); + imgp->td->td_ucred, NOCRED, NULL, imgp->td); if (error != 0) { uprintf("i/o error PT_NOTE\n"); goto retf; diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 958ec559fd8d..4066682cbcc5 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -448,6 +448,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, */ bzero(imgp, sizeof(*imgp)); imgp->proc = p; + imgp->td = td; imgp->attr = &attr; imgp->args = args; oldcred = p->p_ucred; diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index c1c94a2eabfd..51cda4406cad 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -57,6 +57,7 @@ struct image_args { struct image_params { struct proc *proc; /* our process */ + struct thread *td; struct label *execlabel; /* optional exec label */ struct vnode *vp; /* pointer to vnode of file to exec */ struct vm_object *object; /* The vm object for this vp */ From nobody Thu May 28 20:59:51 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 4gRJlX1Hqjz6f5b6 for ; Thu, 28 May 2026 20:59:52 +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 4gRJlW4nRZz3CD0 for ; Thu, 28 May 2026 20:59:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780001991; 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=+GwwuckqTse1Kium0Rvk3bgOybdtWzKpzxuO+00imrw=; b=Qv+sITN+WnUhpdNz9PxJrHNKhyOFDbRly8g7Khfa6CyGjmV/6GFBehURMDUOLRciOtw7E1 LdFsPMbdi8/X0Wpub/UJrOnRyNpW54qpoMWvN5ruD9o+gGPoYN3S1IYcRgACj014ga4u0W /LbHBuHxzGv2bhPf6MIuBuzR3LsrfpM4D/HFmPMllnpvJYUAPv425nb3S2Vj9yXD4NYI4x CNOuLv+GWKW+D68e0Ns8Uc2CYqVhM9G8rQAl/kwAuY8ZEuBXmC6RLZq/+V+iXH8IKzirfp 9cQdBtemLw8cAN+MLGZ4qhTSi8CCvNIEuG82546xDVlqAmmWpXyltdkyCIYZ9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780001991; a=rsa-sha256; cv=none; b=a/LrpqcS79GuxS7uVGsazDAwnxm4XgSzNWtzKMDFJ9sr6Ayq1CDaWqoHcwCNB4RrIEUGIL yImxwbRT/e+7v0hTC9yTTBi+ca8nUMmP7vTi9g7SaX8S8BUMhSljdcM9cW/8ob3qftr/pq gvpRM6k7olaBprTehZcjwjSRjBi660AAXgjE8FRiS6+Y8kO14LxTVbzXTY95Yq+dngBgd4 qw/vry3NiTWZacWlwGzEOBzYBw8iKpFpH9rsoWCJOpwN96n55OSNxgkUGCrd9w82jxa/vK 2HIpyQHZRZuL2Yvk/INp125IvCbIjaT7QfV79xOIw8m/Bcc6r8dHlR5f9Cvm6g== 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=1780001991; 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=+GwwuckqTse1Kium0Rvk3bgOybdtWzKpzxuO+00imrw=; b=iP70yjbMFpuPSd6YkMagiylRkJIfWagBmClh7Tr5OzDhsDoLS3qBLLixJE2tfDNdR/MGVl +tDdYMBDo1ElEPCKYelyXqL63nSUmZRa0bJNgFQYFW8OF6Wseun1XiUq9enzjR4ZzU9G/X TcxA+B8DDMKCDtZeVm6THPSNoOGQOMwYYuZ2tnMBWlVyFx3qIVOWdRv2HMls7zDYTnASYj 58RrRlsfgFxeNvwVmAknekL9aMhfkmwmqHnxFIewZteOpzjPsLtrCjUNm/7AcDQPepBbVz HFiLBsOSGgjhcxwJJo8twM5iKGW5R9FKT2pjA5FRKgp30Jc95G7cL82kboZTAw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRJlW3fn5z12yl for ; Thu, 28 May 2026 20:59:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32ef9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 28 May 2026 20:59:51 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 804daf166406 - main - imgact_elf: read program headers if not contained in the first page 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 804daf166406a1b0e22f93b9417b90ed7d3aa1ae Auto-Submitted: auto-generated Date: Thu, 28 May 2026 20:59:51 +0000 Message-Id: <6a18acc7.32ef9.6a0db43@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=804daf166406a1b0e22f93b9417b90ed7d3aa1ae commit 804daf166406a1b0e22f93b9417b90ed7d3aa1ae Author: Konstantin Belousov AuthorDate: 2026-05-28 09:06:33 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-28 20:59:26 +0000 imgact_elf: read program headers if not contained in the first page PR: 295629 Reviewed by: markj Tested by: Alex S Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57294 --- sys/kern/imgact_elf.c | 91 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 29 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 42cdfa08f19b..e3969223c170 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -84,6 +84,8 @@ #define ELF_NOTE_ROUNDSIZE 4 #define OLD_EI_BRAND 8 +#define ELF_OFFPAGE_PHNUM 128 + /* * ELF_ABI_NAME is a string name of the ELF ABI. ELF_ABI_ID is used * to build variable names. @@ -93,7 +95,7 @@ static int __elfN(check_header)(const Elf_Ehdr *hdr); static const Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp, - const char *interp, int32_t *osrel, uint32_t *fctl0); + const Elf_Phdr *phdr, const char *interp, int32_t *osrel, uint32_t *fctl0); static int __elfN(load_file)(struct thread *td, const char *file, u_long *addr, u_long *entry); static int __elfN(load_section)(const struct image_params *imgp, @@ -103,7 +105,7 @@ static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp); static bool __elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel); static bool kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel); -static bool __elfN(check_note)(struct image_params *imgp, +static bool __elfN(check_note)(struct image_params *imgp, const Elf_Phdr *phdr, const Elf_Brandnote *checknote, int32_t *osrel, bool *has_fctl0, uint32_t *fctl0); static vm_prot_t __elfN(trans_prot)(Elf_Word); @@ -339,8 +341,8 @@ __elfN(brand_inuse)(const Elf_Brandinfo *entry) } static const Elf_Brandinfo * -__elfN(get_brandinfo)(struct image_params *imgp, const char *interp, - int32_t *osrel, uint32_t *fctl0) +__elfN(get_brandinfo)(struct image_params *imgp, const Elf_Phdr *phdr, + const char *interp, int32_t *osrel, uint32_t *fctl0) { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; const Elf_Brandinfo *bi, *bi_m; @@ -369,8 +371,8 @@ __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, has_fctl0 = false; *fctl0 = 0; *osrel = 0; - ret = __elfN(check_note)(imgp, bi->brand_note, osrel, - &has_fctl0, fctl0); + ret = __elfN(check_note)(imgp, phdr, bi->brand_note, + osrel, &has_fctl0, fctl0); /* Give brand a chance to veto check_note's guess */ if (ret && bi->header_supported) { ret = bi->header_supported(imgp, osrel, @@ -787,12 +789,13 @@ __elfN(load_file)(struct thread *td, const char *file, u_long *addr, struct nameidata nd; struct vattr attr; struct image_params image_params; - } *tempdata; + } *tempdata = NULL; const Elf_Ehdr *hdr = NULL; const Elf_Phdr *phdr = NULL; struct nameidata *nd; struct vattr *attr; struct image_params *imgp; + void *m_phdrs = NULL; u_long rbase; u_long base_addr = 0; int error; @@ -852,16 +855,27 @@ __elfN(load_file)(struct thread *td, const char *file, u_long *addr, goto fail; } - /* Only support headers that fit within first page for now */ - if (!__elfN(phdr_in_zero_page)(hdr)) { + if (!aligned(imgp->image_header + hdr->e_phoff, Elf_Addr)) { error = ENOEXEC; goto fail; } - - phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); - if (!aligned(phdr, Elf_Addr)) { - error = ENOEXEC; - goto fail; + if (__elfN(phdr_in_zero_page)(hdr)) { + phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); + } else { + if (hdr->e_phnum > ELF_OFFPAGE_PHNUM) { + error = ENOEXEC; + goto fail; + } + VOP_UNLOCK(imgp->vp); + phdr = m_phdrs = malloc(hdr->e_phnum * sizeof(Elf_Phdr), + M_TEMP, M_WAITOK | M_ZERO); + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + error = vn_rdwr(UIO_READ, imgp->vp, m_phdrs, + hdr->e_phnum * sizeof(Elf_Phdr), hdr->e_phoff, + UIO_SYSSPACE, IO_NODELOCKED, imgp->td->td_ucred, + NOCRED, NULL, imgp->td); + if (error != 0) + goto fail; } error = __elfN(load_sections)(imgp, hdr, phdr, rbase, &base_addr); @@ -883,6 +897,7 @@ fail: VOP_UNSET_TEXT_CHECKED(nd->ni_vp); vput(nd->ni_vp); } + free(m_phdrs, M_TEMP); free(tempdata, M_TEMP); return (error); @@ -1108,6 +1123,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) char *interp; const Elf_Brandinfo *brand_info; struct sysentvec *sv; + void *m_phdrs; u_long addr, baddr, entry, proghdr; u_long maxalign, maxsalign, mapsz, maxv, maxv1, anon_loc; uint32_t fctl0; @@ -1132,16 +1148,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) * detected an ELF file. */ - if (!__elfN(phdr_in_zero_page)(hdr)) { - uprintf("Program headers not in the first page\n"); - return (ENOEXEC); - } - phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); - if (!aligned(phdr, Elf_Addr)) { - uprintf("Unaligned program headers\n"); - return (ENOEXEC); - } - n = error = 0; baddr = 0; osrel = 0; @@ -1149,6 +1155,33 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) entry = proghdr = 0; interp = NULL; free_interp = false; + m_phdrs = NULL; + + if (!aligned(imgp->image_header + hdr->e_phoff, Elf_Addr)) { + uprintf("Unaligned program headers\n"); + return (ENOEXEC); + } + if (hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize < hdr->e_phoff) { + uprintf("PHDRS wrap\n"); + return (ENOEXEC); + } + if (__elfN(phdr_in_zero_page)(hdr)) { + phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); + } else if (hdr->e_phnum > ELF_OFFPAGE_PHNUM) { + uprintf("Too many program headers\n"); + return (ENOEXEC); + } else { + VOP_UNLOCK(imgp->vp); + phdr = m_phdrs = malloc(hdr->e_phnum * sizeof(Elf_Phdr), + M_TEMP, M_WAITOK | M_ZERO); + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); + error = vn_rdwr(UIO_READ, imgp->vp, m_phdrs, + hdr->e_phnum * sizeof(Elf_Phdr), hdr->e_phoff, + UIO_SYSSPACE, IO_NODELOCKED, imgp->td->td_ucred, + NOCRED, NULL, imgp->td); + if (error != 0) + goto ret; + } /* * Somewhat arbitrary, limit accepted max alignment for the @@ -1230,7 +1263,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) } } - brand_info = __elfN(get_brandinfo)(imgp, interp, &osrel, &fctl0); + brand_info = __elfN(get_brandinfo)(imgp, phdr, interp, &osrel, &fctl0); if (brand_info == NULL) { uprintf("ELF binary type \"%u\" not known.\n", hdr->e_ident[EI_OSABI]); @@ -1434,6 +1467,7 @@ ret: ASSERT_VOP_LOCKED(imgp->vp, "skipped relock"); if (free_interp) free(interp, M_TEMP); + free(m_phdrs, M_TEMP); return (error); } @@ -2914,17 +2948,16 @@ note_fctl_cb(const Elf_Note *note, void *arg0, bool *res) * as for headers. */ static bool -__elfN(check_note)(struct image_params *imgp, const Elf_Brandnote *brandnote, - int32_t *osrel, bool *has_fctl0, uint32_t *fctl0) +__elfN(check_note)(struct image_params *imgp, const Elf_Phdr *phdr, + const Elf_Brandnote *brandnote, int32_t *osrel, bool *has_fctl0, + uint32_t *fctl0) { - const Elf_Phdr *phdr; const Elf_Ehdr *hdr; struct brandnote_cb_arg b_arg; struct fctl_cb_arg f_arg; int i, j; hdr = (const Elf_Ehdr *)imgp->image_header; - phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); b_arg.brandnote = brandnote; b_arg.osrel = osrel; f_arg.has_fctl0 = has_fctl0; From nobody Fri May 29 02:10:32 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 4gRRf02bcjz6flCJ for ; Fri, 29 May 2026 02:10:32 +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 4gRRf01mFQz3gFg for ; Fri, 29 May 2026 02:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780020632; 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=WyaDcyGjZs1MzVAIAENNnUI82fQXCWfEvZ3pWS+zxsY=; b=wEUKlgQB7lErkOoZGN7sSRwUMWtVoZ0PPbRCL4G0+giAwPJydmo8vi2Q4uqDX3+tThgYuo nT901NuNmLSrP2FtM10HnDAykXJlkTfN7daFytDIABa4eUwRlt57gGDRQPyy9+GArj9et/ 4DVgP29Ok3ZszGOPbf0SholByukjORroEyslIelfExoqzP93sWIhm+aIcORdwBHfEbWLMK 62MbBvuIJvqtZEdXVxz06dfqlLRMJWUnvkrITnR5Zm6ZYChstXAQWb6lvoWpEzgeHXczNY gkHrDkt2XGCZvRRowknIM61RPrxcGOtDpSCqcwTDoAejpna8XvSylw8ZGUvNkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780020632; a=rsa-sha256; cv=none; b=liwKJbQcbOeQClKQrJWHsY6WEL1L+ZOsl7KucrV6FHhyPZPuoouxETLv0+cZH3H+q1wASd 1Ir6CN5EeOl9PNQcSx4oBhLrZ1Sxa8sl/GJP0ga4aX7kNvtIFerd8kPX+XXfUIbdLvJrCI eZWewMOgHjtjODpp8yPys89Oqka31PdVL58V99Y1WCOjKpbW1g0cXayoLe0+LnT9cX9ivO nDnqyE7lpm/v0tbD/99tkMA79pykR5Okilhdva/9VhA1c7qwMTp+hfGd6wPpXgulA6/Tjn 6Ai7qCmHYe9KRgkeDWFh3B31kF0NQdOgoUuF8JGOUY1hhI4qvaSZMNaYzdI7hw== 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=1780020632; 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=WyaDcyGjZs1MzVAIAENNnUI82fQXCWfEvZ3pWS+zxsY=; b=noo3tyViIfe7PTAC2XUgrsIClJKOS7PQsDfwMyJI2t4UcU/y/VFpVCU15+oGDaut7uPgkR W7yY1Bz/3lZLlBz4rS761tJFywLKLYaInI5hNv8e8kbGGeiTo+y2TWHUJnvejAXfHkPmOq AATy8Ut6sz7a6kNzWSEADm8CvHab9fobUwaqRX7w8UTG+0+MIN5CimS82nV82GO07Vh74u I3l6pD9qZrDFXDWZnxuS5yPdjb9H5kRpZLFN8xJU6gWQwxJnHg25GvqRufR0zDQT7YTQ2y /SneYsMkQtOzB5YFA00WuEfmCrY0HVkb7FU3J/RgTAEaobtk6uPl67rJQFIk/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRRf01KYsz1BLY for ; Fri, 29 May 2026 02:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 248cf by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 02:10:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 283959bbe086 - main - bsdinstall: script: Fix scripted DISTRIBUTIONS 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: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 283959bbe0863917c4fc3200a92d1055a4c89bdc Auto-Submitted: auto-generated Date: Fri, 29 May 2026 02:10:32 +0000 Message-Id: <6a18f598.248cf.32d03e2a@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=283959bbe0863917c4fc3200a92d1055a4c89bdc commit 283959bbe0863917c4fc3200a92d1055a4c89bdc Author: Jose Luis Duran AuthorDate: 2026-05-29 02:09:49 +0000 Commit: Jose Luis Duran CommitDate: 2026-05-29 02:09:49 +0000 bsdinstall: script: Fix scripted DISTRIBUTIONS Restore exporting DISTRIBUTIONS to make it available to other scripts. Reviewed by: imp, asomers Fixes: dc14ae4217a0 ("bsdinstall: do pkgbase installations with the "script" command") MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D57319 --- usr.sbin/bsdinstall/scripts/script | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script index 93d07c7899c3..4c792d80df6a 100755 --- a/usr.sbin/bsdinstall/scripts/script +++ b/usr.sbin/bsdinstall/scripts/script @@ -50,6 +50,7 @@ f_include $BSDCFG_SHARE/variable.subr ############################################################ GLOBALS : ${TMPDIR:="/tmp"} +: ${DISTRIBUTIONS=""}; export DISTRIBUTIONS # # Strings that should be moved to an i18n file and loaded with f_include_lang() From nobody Fri May 29 13:06:04 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 4gRkBN5H4Pz6f1Rh for ; Fri, 29 May 2026 13:06:04 +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 4gRkBN4c0jz3hxP for ; Fri, 29 May 2026 13:06:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780059964; 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=X1vvz02igSCm7plPELW/3iPtAIuC5X87Sar/pn6OPfI=; b=DTB2vn6QfBIBAMrx1SLlNngN3RVDTH6yHl23+fjRA9c6EF6NXY0ZlbJaOpevfIPXHG3LU/ 74XrS1H24guwdKQ43dgLlUsZBsUCTrC7l7TcCbY6lCNocfBU+W3dSUPA4kDkjxcsfhrdNw hj8so4A3g5JO165+vZS0d41+L36hS6EdUjZbanOx4zPrSJer1SAAWJOHpvFI6MjgIHXC8c 4IE8mIpfG24WamSq9x3eCwMGMm1qit+M0PeQAyq4W8FxylUjARKiEr7WxAUff1pT+zzbr4 19W/OOFqb99Rkuo5aL2cJRt9ldyBLBA5oqaElWb2TMKZq3Ryaz4og3IzkD3gyQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780059964; a=rsa-sha256; cv=none; b=lyArFF4o61zcuwUVKV+AYO3V5LtpXGlxsJF1T//WucmygZUd7CFQFvME2YB1poeMBFcfsp NqrCC43n6S1dyBblKdFEvDSpEYH21mNbfFO2lfB8Hmv8SoZWE8kto9sAmB2XZ20ePcOyY2 mzfpEJsqKiHBrz4fYA8dCVghIUxYaOyB3tC4ql2rbVYu7g4qvPkORVI+x6IrF+4+V1zs1D 2OHSeieJsvsLMj7xuWosrG2oJTDu43PTvaW0gVZGKrOayto5r34zZpLkDeBWjmKiC+GXM6 bFTTg5dSXk5oNhCg6z/BCJyTRC0OjheTQOcqHD5hFgq1DINTlsN6X9EAhMhkkw== 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=1780059964; 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=X1vvz02igSCm7plPELW/3iPtAIuC5X87Sar/pn6OPfI=; b=nbi5RpjONEDS+4m8P5fiZJxxaagBBnCjP8himF+MiZR2xlUbEVUOeRUSoQO7+n2bENr3cz 7r+g23RBLWxxf00/2Rg1PRQ2j3gpobQgcgbfNPXgDGdYk3TQIFBLWizlv97b65V+8vfmgq Zm66h9k/ADhwq6sPYpTCil9HvZHGBwBhgWzmsNgryLKbQZjwQ/Eiig02a+URIOnnBpe0aa qYY73EajUoGerDmLgReaDB0ViTpVEbSQzrZEki6S4Go1aQFp4UYiuEaR8ikqfo4NFaf9Q1 xUoIgc/11X2tqPFIE1rKt7LFJHkGU9XluJ9DbMgbU7EVIZfmG0hw4csspZi3eg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRkBN3yPnzZH8 for ; Fri, 29 May 2026 13:06:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18959 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 13:06:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 3118f1b99f23 - main - bnxt: Fix build / load error for bnxt(4) in kernels without PCI_IOV 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: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3118f1b99f23431235c202d9aadbe3d183bcc259 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 13:06:04 +0000 Message-Id: <6a198f3c.18959.5a9a2104@gitrepo.freebsd.org> The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=3118f1b99f23431235c202d9aadbe3d183bcc259 commit 3118f1b99f23431235c202d9aadbe3d183bcc259 Author: Andrew Gallatin AuthorDate: 2026-05-29 12:52:44 +0000 Commit: Andrew Gallatin CommitDate: 2026-05-29 13:05:25 +0000 bnxt: Fix build / load error for bnxt(4) in kernels without PCI_IOV This change removes the hard-forcing of PCI_IOV and adds shims to allow the driver to compile and work when the kernel is missing PCI_IOV support. Fixes: 7c450d1127c7 Reviewed by: sumit.saxena_broadcom.com Differential Revision: https://reviews.freebsd.org/D57300 Sponsored by: Netflix --- sys/dev/bnxt/bnxt_en/bnxt_sriov.c | 39 +++++++++++++++++++++++++++++++++++++++ sys/dev/bnxt/bnxt_en/bnxt_sriov.h | 4 ---- sys/dev/bnxt/bnxt_en/if_bnxt.c | 2 -- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/sys/dev/bnxt/bnxt_en/bnxt_sriov.c b/sys/dev/bnxt/bnxt_en/bnxt_sriov.c index 270c18165fb7..071feffbadfd 100644 --- a/sys/dev/bnxt/bnxt_en/bnxt_sriov.c +++ b/sys/dev/bnxt/bnxt_en/bnxt_sriov.c @@ -7,6 +7,8 @@ #include "bnxt_hwrm.h" #include "bnxt_sriov.h" +#ifdef PCI_IOV + static int bnxt_set_vf_admin_mac(struct bnxt_softc *softc, struct bnxt_vf_info *vf, const uint8_t *mac) @@ -973,6 +975,43 @@ void bnxt_sriov_attach(struct bnxt_softc *softc) device_printf(dev, "Failed to initialize SR-IOV (error=%d)\n", rc); } +#else + +void +bnxt_sriov_attach(struct bnxt_softc *softc __unused) +{ +} + +int +bnxt_cfg_hw_sriov(struct bnxt_softc *softc __unused, + uint16_t *num_vfs __unused, bool reset __unused) +{ + return (0); +} + +int +bnxt_approve_mac(struct bnxt_softc *sc __unused) +{ + return (0); +} + +void +bnxt_hwrm_exec_fwd_req(struct bnxt_softc *softc __unused) +{ +} + +bool +bnxt_promisc_ok(struct bnxt_softc *softc __unused) +{ + return (true); +} + +void +bnxt_update_vf_mac(struct bnxt_softc *sc __unused) +{ +} +#endif + void bnxt_reenable_sriov(struct bnxt_softc *bp) { if (BNXT_PF(bp)) { diff --git a/sys/dev/bnxt/bnxt_en/bnxt_sriov.h b/sys/dev/bnxt/bnxt_en/bnxt_sriov.h index 176f54af0aa8..24ea11f29b83 100644 --- a/sys/dev/bnxt/bnxt_en/bnxt_sriov.h +++ b/sys/dev/bnxt/bnxt_en/bnxt_sriov.h @@ -8,10 +8,6 @@ #include "opt_global.h" #include "bnxt.h" -#ifndef PCI_IOV -#define PCI_IOV 1 -#endif - /* macro definations */ #define BNXT_MAX_VFS 4 diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c index 6618016f3932..6d82302615e1 100644 --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -2875,11 +2875,9 @@ bnxt_attach_post(if_ctx_t ctx) bnxt_dcb_init(softc); bnxt_rdma_aux_device_init(softc); -#if PCI_IOV /* SR-IOV attach */ if (BNXT_PF(softc) && BNXT_CHIP_P5_PLUS(softc)) bnxt_sriov_attach(softc); -#endif failed: return rc; From nobody Fri May 29 14:30:48 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 4gRm4973mvz6f71G; Fri, 29 May 2026 14:30:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gRm496PXyz3wFx; Fri, 29 May 2026 14:30:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780065049; 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: in-reply-to:in-reply-to:references:references; bh=HzpTa50fkAnmm7Y0nShZKwGZcbTlnGr5KqPwsQ1NwgM=; b=tTlrb1F+v1pL+cnApE7BMdrTUkvp1I3Y7CmqeL0BhXFIn5O8+Fcds3gbsIGeBLVW+inHy1 ZD73ocb1WsjYUVODrY1nxwPPQnCm1C8xXyi+TpPGEKy53Y/2VxvPjzWVv1fojfFXAJijcP Mcow9aHN+0k4tblULuvRulCUYXB7WCUrCNx/iCkpccJQB8hHT8fBp/6fkrLWDxyWw73Dth wA27UKuVClT78HCU5G/ZGBbKYRYEfYXe1p+k/RewYsmx/gGTNrxLzK+GND72wFQYJv/MI4 X7fMaOdsuIoTEl4MXHjosIMX1oYZvrm4kKd9xArw/O/Vn8qWLdPT3xSjp6mnhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780065049; a=rsa-sha256; cv=none; b=DSszjp01WdxRbgibyln71sGsvrszhLR0WBxTiuYqjDSAC9Zb4LIO5e2pLunKgNBe9vMZB1 gIfDL+EzHGgTPSEd1WdSsqEH5kmGWR1NGdO7r7TqzIDuY+cCugjZfQtt7Vqo1w+BWiPBlY o7TrK5VaC0RXU/KmtYkVvvf0csQqkyTd1+m+ePwsY/hGlz7YOFxOZVh2krwo0W/x5eEEnn mViBfzMb7XDrrP9Q/R1pKgB+3r3gvLZNFfnsNqxYxY822PdDR5nxRGjacy5RQHvjcitAF5 oJzBVagRN4GN/uo+70sPqpxXoEZ/MA0v9FXqnfeairMdRqz45SRSBGpIw02ETA== 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=1780065049; 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: in-reply-to:in-reply-to:references:references; bh=HzpTa50fkAnmm7Y0nShZKwGZcbTlnGr5KqPwsQ1NwgM=; b=V2k/AYTri0czOw9w3aNR4T//BKSYnR2XIFh2Pk4ZP168wiP0dHfkaaT6nOnMndl9jXNB9O H89Fi5+ct4oORLjH3qNvJn6bXO8KV30F2DsCl4bhvLg6wgiaySrbGR8767d058NegcIPbL hlnO9cVF2e91D8zzZHr+SHssUGeNoPsMcNirUYz5TBtpTE96p/QMHE8PR2n0KVFMHuZUkH XZNLt3OEI1TKVlvyYIHVR5fxPGdIJCCr1oMHrZXN6S/bNktZPUQrA5TDbFyHNbXeykq1R4 KKALonKY28Q2NIltTlPkBBXkrH9/reqdLFVMq14+SkcBPQCIezV4JO3sJn1o2g== Received: from [IPV6:2601:5c0:4202:5670:34ab:c755:3b3:4faa] (unknown [IPv6:2601:5c0:4202:5670:34ab:c755:3b3:4faa]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gRm494JmmzlSH; Fri, 29 May 2026 14:30:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Fri, 29 May 2026 10:30:48 -0400 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 User-Agent: Mozilla Thunderbird Subject: Re: git: 804daf166406 - main - imgact_elf: read program headers if not contained in the first page Content-Language: en-US To: Konstantin Belousov , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <6a18acc7.32ef9.6a0db43@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <6a18acc7.32ef9.6a0db43@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/28/26 16:59, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=804daf166406a1b0e22f93b9417b90ed7d3aa1ae > > commit 804daf166406a1b0e22f93b9417b90ed7d3aa1ae > Author: Konstantin Belousov > AuthorDate: 2026-05-28 09:06:33 +0000 > Commit: Konstantin Belousov > CommitDate: 2026-05-28 20:59:26 +0000 > > imgact_elf: read program headers if not contained in the first page > > PR: 295629 > Reviewed by: markj > Tested by: Alex S > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D57294 Oh well, I wish I had seen this earlier. I already had a version of this downstream in CheriBSD as we have a CHERI-specific case of many phdrs. I had a sysctl/tunable to control how many pages of phdrs were allowed which defaulted to something like 4 pages worth but could be more easily adjusted than the hardcoded constant here. I will see if I can upstream the sysctl at least. -- John Baldwin From nobody Fri May 29 14:39:56 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 4gRmGy1yqVz6f7bF; Fri, 29 May 2026 14:40:10 +0000 (UTC) (envelope-from kib@freebsd.org) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4gRmGx5ngCz3x80; Fri, 29 May 2026 14:40:09 +0000 (UTC) (envelope-from kib@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 64TEdu47060538; Fri, 29 May 2026 17:39:59 +0300 (EEST) (envelope-from kib@freebsd.org) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 64TEdu47060538 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 64TEdu4V060537; Fri, 29 May 2026 17:39:56 +0300 (EEST) (envelope-from kib@freebsd.org) X-Authentication-Warning: tom.home: kostik set sender to kib@freebsd.org using -f Date: Fri, 29 May 2026 17:39:56 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 804daf166406 - main - imgact_elf: read program headers if not contained in the first page Message-ID: References: <6a18acc7.32ef9.6a0db43@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4gRmGx5ngCz3x80 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Fri, May 29, 2026 at 10:30:48AM -0400, John Baldwin wrote: > On 5/28/26 16:59, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=804daf166406a1b0e22f93b9417b90ed7d3aa1ae > > > > commit 804daf166406a1b0e22f93b9417b90ed7d3aa1ae > > Author: Konstantin Belousov > > AuthorDate: 2026-05-28 09:06:33 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2026-05-28 20:59:26 +0000 > > > > imgact_elf: read program headers if not contained in the first page > > PR: 295629 > > Reviewed by: markj > > Tested by: Alex S > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D57294 > > Oh well, I wish I had seen this earlier. I already had a version of this downstream in > CheriBSD as we have a CHERI-specific case of many phdrs. I had a sysctl/tunable to control > how many pages of phdrs were allowed which defaulted to something like 4 pages worth but > could be more easily adjusted than the hardcoded constant here. I will see if I can upstream > the sysctl at least. A sysctl should be a no-brainer, I can add it. I did not see much value in it being tunable, the current 128 value should be enough for everything? From nobody Fri May 29 14:52:22 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 4gRmYB2L6Sz6ff4V; Fri, 29 May 2026 14:52:30 +0000 (UTC) (envelope-from kib@freebsd.org) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4gRmY93Z94z41Cg; Fri, 29 May 2026 14:52:29 +0000 (UTC) (envelope-from kib@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=freebsd.org (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kib@freebsd.org) smtp.mailfrom=kib@freebsd.org Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 64TEqMoU061420; Fri, 29 May 2026 17:52:25 +0300 (EEST) (envelope-from kib@freebsd.org) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 64TEqMoU061420 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 64TEqMeE061419; Fri, 29 May 2026 17:52:22 +0300 (EEST) (envelope-from kib@freebsd.org) X-Authentication-Warning: tom.home: kostik set sender to kib@freebsd.org using -f Date: Fri, 29 May 2026 17:52:22 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 804daf166406 - main - imgact_elf: read program headers if not contained in the first page Message-ID: References: <6a18acc7.32ef9.6a0db43@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Spamd-Result: default: False [-2.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.975]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : No valid SPF, No valid DKIM,none]; ARC_NA(0.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; FREEFALL_USER(0.00)[kib]; TO_DN_SOME(0.00)[]; HAS_XAW(0.00)[]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_THREE(0.00)[4] X-Spamd-Bar: -- X-Rspamd-Queue-Id: 4gRmY93Z94z41Cg On Fri, May 29, 2026 at 05:40:02PM +0300, Konstantin Belousov wrote: > On Fri, May 29, 2026 at 10:30:48AM -0400, John Baldwin wrote: > > On 5/28/26 16:59, Konstantin Belousov wrote: > > > The branch main has been updated by kib: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=804daf166406a1b0e22f93b9417b90ed7d3aa1ae > > > > > > commit 804daf166406a1b0e22f93b9417b90ed7d3aa1ae > > > Author: Konstantin Belousov > > > AuthorDate: 2026-05-28 09:06:33 +0000 > > > Commit: Konstantin Belousov > > > CommitDate: 2026-05-28 20:59:26 +0000 > > > > > > imgact_elf: read program headers if not contained in the first page > > > PR: 295629 > > > Reviewed by: markj > > > Tested by: Alex S > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 1 week > > > Differential revision: https://reviews.freebsd.org/D57294 > > > > Oh well, I wish I had seen this earlier. I already had a version of this downstream in > > CheriBSD as we have a CHERI-specific case of many phdrs. I had a sysctl/tunable to control > > how many pages of phdrs were allowed which defaulted to something like 4 pages worth but > > could be more easily adjusted than the hardcoded constant here. I will see if I can upstream > > the sysctl at least. > > A sysctl should be a no-brainer, I can add it. I did not see much value > in it being tunable, the current 128 value should be enough for everything? D57328 From nobody Fri May 29 16:01:26 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 4gRp4l28hFz6flMG for ; Fri, 29 May 2026 16:01:27 +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 4gRp4k59Bgz3Gst for ; Fri, 29 May 2026 16:01:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070486; 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=o+875Bvb4vZn5aG2lYgEBAfdoV3e2f9XGY8LV6wRqfc=; b=IrPE4feeHSD2DZgBWEaeoSW8NqCUA6eh+hKcj9oW+N2iNEit/lzo6SbJOWY0V7ccHSvkDb ScO0w0akS5Iir5KNCrpL50mL4l5UQ80BVOg798Z4SaTkQEOjV9rtpfTam4PGKHlyHIOEl6 Tkl+4LkqcZ3xEViiJDUgU+H1iPUS+GAXexkXPSk+2ciwkhbVg2Lu/w2+3NHI8S+uZwcipL azIhVR15DPo5mOtowYc3VyrJdZW4ZqUxDfMbXFS0CmlntLUOJ4TzTG9Amc6v32yP7RChYu Lsa5lawziTdRKH5YZfPEV9oYXO1lKvz10BI4+bz5arp4m3kUFUXSzBy8v/87PQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070486; a=rsa-sha256; cv=none; b=GF2coefEVg0rrpvm+VullTQKiSYa64nG9HkeuyDgjcKBgFLdzKNRnXrCP73iqLx6PDlKcW wLm/dBAOawxF0GtQQbcawDNMVw6Paf/AOJwgcEO1eXXEoTtWcbfjpsC38Yb58jKjQR0HiI KlSPEFJJqh/86qp8Urpbzn7MHxv2ncNxesUm0d9ij6HAYnE1Qt0vRy0CPmRENZ8csU4ejT piPUyBttsXipeFolMOqKlX11a18xbL3lIb6Q3EQ8jhumudXTINvO99D4Vhqi0admj3KVOL c3kBc4pJCPCC2oc+86gJn4DdomXHxeLh1lCLRvvz2/4cXMEjLv6AZi+125ML7g== 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=1780070486; 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=o+875Bvb4vZn5aG2lYgEBAfdoV3e2f9XGY8LV6wRqfc=; b=KCSBvb7FjZBpg15frTnVNH1PZxSIaVnW1D1SRrNhgMwvY0ct8mKIcSUSFiRhCGmPVuRm99 xFf86XzOqqTfudWnJAJikJVwLjmIPmtPO9BbSpAnFbD/fbg/K42RrB72iR3svqyVTTpjAX kOJnrMNQYjCDNZASJVdJqxRb9H+HT6wg0rknbalu8KnLsUG3J297MnDZtkln43Ji81ZZ6P tQn/ymNnK9M/roKr2Xq7k4Qc+RNkU0YvA80hmFcp/wwH/L3XtSEXlOselSNqLdOX06o3GG qXahIf6JSF4iasAEiKYeXAWpp3+wljtxQYahK5Vpumhc0DTpA6gLz1eLrzMY+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4k4Svbzg6N for ; Fri, 29 May 2026 16:01:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35e14 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 3e17f37c2cd2 - main - MAC/do: Update copyright 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: 3e17f37c2cd2064c5db3fb63fad57f40e4e334fa Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:26 +0000 Message-Id: <6a19b856.35e14.9688c1d@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=3e17f37c2cd2064c5db3fb63fad57f40e4e334fa commit 3e17f37c2cd2064c5db3fb63fad57f40e4e334fa Author: Olivier Certner AuthorDate: 2026-05-20 11:41:07 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:13:07 +0000 MAC/do: Update copyright Add Kushagra to account for the commit adding the "executable paths" feature. Reviewed by: bapt 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index b63fc2a5bbc8..5c184273595a 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -3,6 +3,7 @@ * * Copyright(c) 2024 Baptiste Daroussin * Copyright (c) 2024 The FreeBSD Foundation + * Copyright (c) 2025 Kushagra Srivastava * * Portions of this software were developed by Olivier Certner * at Kumacom SARL under sponsorship from the FreeBSD From nobody Fri May 29 16:01:27 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 4gRp4m1Mwvz6fl4v for ; Fri, 29 May 2026 16:01:28 +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 4gRp4l5XLxz3H6H for ; Fri, 29 May 2026 16:01:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070487; 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=aE4Ee4YClW8PgSXT+LpA1zHRiJCM7d2rcjkXt/ySXqc=; b=mYGbazNDoY8JzEUDBM9Holvem643OaZDq8LTgQsbp+nK+0qwfCVnTHJyLCdmVlix9zYrf+ y929rfrE3/1bsQxWY+R/FPg4wkt+nUaGcaNRntXoHwVxN5x0g61lG07r0GF9ULnIA6QPkm 6SY5Kp2NPM0Cx+lkdzrz+aXtyxnETGHhO5WUN8Roa1JX+dTDPDW4gRZwQ6hqe8tArv1G9X B0MGO45l2m/MW1iol3tqq0rm9XuBPioa6/6Wiy+WdpDmH36Inkc0GXlUWBXhtCphFvL2wJ 97/ltp6lGeis8QeL40FmEcCJOUvld+CJTe7xTybVAxAJjPRZaQaO22a/ggTM+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070487; a=rsa-sha256; cv=none; b=CZtg3OubK1Md/B8N5Iqj4oj0gwk1SV8ElYrYTI1p4C7Cu1Fw95D/ZFPVaKN9tHBaNeWGvg rAX3fDXimWIZq/HPWESoyr0MQptbSAMtYBwnYPGpCh7P/T7ljFJI+XMwzVuCOL9UeFaAec yRdNaK/7E0MfhjkatsRE2jU1zpIHtbr+5jzEDt9vUwYXvbwhO4KIdJOLCiT9nwOHMEYIrr OnUyBVhJQaVWNLN0EQxStpP67UAmaClV7vDyIpRuohFduMjqsvxPFSOOWanLEjgpK25dop M5ysrMJ66qHwlw1KmLiwoOcQ6YfC92GltKF07Y75xBqq28iesm538xhoPGPvcg== 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=1780070487; 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=aE4Ee4YClW8PgSXT+LpA1zHRiJCM7d2rcjkXt/ySXqc=; b=hc2loMhnAKNtw8+qb2HvHAm+VZ144RXrSMsjlS05yZPlg8VubJ98YOySZm7EjXaEEZ9fsE gbS0uBT4ZLfubPTchZh9lIs4/aMTNH9HZLSz74JAeVRi8q5J7xlOT6GBfjsObO/y3RM9kt kiqHLvO3fYl/2Ij9NZWOSVzr958+Fkfpgef5kOaEOz/tfDzSeUkhxasOvjivH53Fm/9ZSv bMOL/rXymiDmjI0oera2BbomMBRn/ghzSXAEI7Gbn++Xa27pTFlrKQsfTu+i5lsL+LaU9C SoHcqQE8NOn46XPFy4gg53to9k18949fHyf9lurUtaKFgBNK7ARAsCaiJaJsiQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4l55g2zgmp for ; Fri, 29 May 2026 16:01:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34039 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: f93cd891aefd - main - MAC/do: Make it style(9) compliant again 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: f93cd891aefd839da869dcdb450d00050d5e701e Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:27 +0000 Message-Id: <6a19b857.34039.3f229724@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=f93cd891aefd839da869dcdb450d00050d5e701e commit f93cd891aefd839da869dcdb450d00050d5e701e Author: Olivier Certner AuthorDate: 2026-03-23 11:45:17 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:14:14 +0000 MAC/do: Make it style(9) compliant again Fix too long lines, declarations not at head of block, improper indentation and superfluous whitespace coming from the previous commit introducing the configurable executable paths feature. While here, fix some older improper comment formatting. Reviewed by: bapt Fixes: 6c3def74e2de ("MAC/do: Support multiple users and groups as single rule's targets") 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 | 166 +++++++++++++++++++++++++------------------ 1 file changed, 96 insertions(+), 70 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 5c184273595a..c889b218cad3 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -127,11 +127,15 @@ typedef uint16_t flags_t; #define MDF_MAY_REJ_SUPP (1u << 11) /* (t,gid) Some explicit ID (not MDF_CURRENT) has MDF_SUPP_MUST. */ #define MDF_EXPLICIT_SUPP_MUST (1u << 12) -/* (t,gid) Whether any target clause is about primary groups. Used during - * parsing only. */ +/* + * (t,gid) Whether any target clause is about primary groups. Used during + * parsing only. + */ #define MDF_HAS_PRIMARY_CLAUSE (1u << 13) -/* (t,gid) Whether any target clause is about supplementary groups. Used during - * parsing only. */ +/* + * (t,gid) Whether any target clause is about supplementary groups. Used during + * parsing only. + */ #define MDF_HAS_SUPP_CLAUSE (1u << 14) #define MDF_TYPE_GID_MASK (MDF_ANY_SUPP | MDF_MAY_REJ_SUPP | \ MDF_EXPLICIT_SUPP_MUST | MDF_HAS_PRIMARY_CLAUSE | MDF_HAS_SUPP_CLAUSE) @@ -236,7 +240,7 @@ check_type_and_id_flags(const id_type_t type, const flags_t flags) } break; default: - __assert_unreachable(); + __assert_unreachable(); } return; @@ -359,7 +363,8 @@ init_exec_paths(struct exec_paths *const exec_paths) static struct conf * alloc_conf(void) { - struct conf *const conf = malloc(sizeof(*conf), M_MAC_DO, M_WAITOK | M_ZERO); + struct conf *const conf = malloc(sizeof(*conf), M_MAC_DO, M_WAITOK | + M_ZERO); init_rules(&conf->rules); init_exec_paths(&conf->exec_paths); @@ -463,7 +468,8 @@ static void make_parse_error(struct parse_error **const parse_error, const size_t pos, const char *const fmt, ...) { - struct parse_error *const err = malloc(sizeof(*err), M_MAC_DO, M_WAITOK); + struct parse_error *const err = malloc(sizeof(*err), M_MAC_DO, + M_WAITOK); va_list ap; err->pos = pos; @@ -1079,7 +1085,7 @@ out: static int parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, - struct parse_error **const parse_error) + struct parse_error **const parse_error) { const size_t len = strlen(string); char *copy, *p, *path; @@ -1089,8 +1095,8 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, if (len >= EXEC_PATHS_MAXLEN) { make_parse_error(parse_error, 0, - "Exec path specification string is too long (%zu, max %u)", - len, EXEC_PATHS_MAXLEN - 1); + "Exec path specification string is too long (%zu, max %u)", + len, EXEC_PATHS_MAXLEN - 1); return (ENAMETOOLONG); } @@ -1103,26 +1109,30 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, p = copy; while ((path = strsep_noblanks(&p, ":")) != NULL) { + size_t path_len; + if (*path == '\0') continue; if (exec_paths->exec_path_count >= MAX_EXEC_PATHS) { make_parse_error(parse_error, path - copy, - "Too many exec paths specified (max %d)", MAX_EXEC_PATHS); + "Too many exec paths specified (max %d)", + MAX_EXEC_PATHS); error = EINVAL; goto out; } - const size_t path_len = strlen(path); + path_len = strlen(path); if (path_len >= PATH_MAX) { make_parse_error(parse_error, path - copy, - "Exec paths too long (%zu, max %u)", - path_len, PATH_MAX - 1); + "Exec paths too long (%zu, max %u)", + path_len, PATH_MAX - 1); error = ENAMETOOLONG; goto out; } - strlcpy(exec_paths->exec_paths[exec_paths->exec_path_count], path, PATH_MAX); + strlcpy(exec_paths->exec_paths[exec_paths->exec_path_count], + path, PATH_MAX); exec_paths->exec_path_count++; } @@ -1287,7 +1297,8 @@ set_default_conf(struct prison *const pr) { struct conf *const conf = alloc_conf(); - strlcpy(conf->exec_paths.exec_paths_str, "/usr/bin/mdo", EXEC_PATHS_MAXLEN); + strlcpy(conf->exec_paths.exec_paths_str, "/usr/bin/mdo", + EXEC_PATHS_MAXLEN); strlcpy(conf->exec_paths.exec_paths[0], "/usr/bin/mdo", PATH_MAX); conf->exec_paths.exec_path_count = 1; @@ -1310,19 +1321,20 @@ clone_rules(struct rules *dst, struct rules *const src) STAILQ_INIT(&dst->head); STAILQ_FOREACH(src_rule, &src->head, r_entries) { - dst_rule = malloc(sizeof(*dst_rule), M_MAC_DO, M_WAITOK | M_ZERO); + dst_rule = malloc(sizeof(*dst_rule), M_MAC_DO, M_WAITOK | + M_ZERO); bcopy(src_rule, dst_rule, sizeof(*dst_rule)); if (src_rule->uids_nb > 0) { - dst_rule->uids = malloc(sizeof(*dst_rule->uids) * src_rule->uids_nb, - M_MAC_DO, M_WAITOK); + dst_rule->uids = malloc(sizeof(*dst_rule->uids) * + src_rule->uids_nb, M_MAC_DO, M_WAITOK); bcopy(src_rule->uids, dst_rule->uids, sizeof(*dst_rule->uids) * src_rule->uids_nb); } if (src_rule->gids_nb > 0) { - dst_rule->gids = malloc(sizeof(*dst_rule->gids) * src_rule->gids_nb, - M_MAC_DO, M_WAITOK); + dst_rule->gids = malloc(sizeof(*dst_rule->gids) * + src_rule->gids_nb, M_MAC_DO, M_WAITOK); bcopy(src_rule->gids, dst_rule->gids, sizeof(*dst_rule->gids) * src_rule->gids_nb); } @@ -1336,18 +1348,17 @@ clone_exec_paths(struct exec_paths *dst, struct exec_paths *const src) { bzero(dst, sizeof(*dst)); dst->exec_path_count = src->exec_path_count; - for (int i = 0; i < src->exec_path_count; i++) { + for (int i = 0; i < src->exec_path_count; i++) strlcpy(dst->exec_paths[i], src->exec_paths[i], - sizeof(dst->exec_paths[i])); - } + sizeof(dst->exec_paths[i])); strlcpy(dst->exec_paths_str, src->exec_paths_str, - sizeof(dst->exec_paths_str)); + sizeof(dst->exec_paths_str)); } -static int -parse_and_set_conf(struct prison *pr, const char *rules_string, - const char *exec_paths_string, struct parse_error **parse_error) +static int +parse_and_set_conf(struct prison *pr, const char *rules_string, + const char *exec_paths_string, struct parse_error **parse_error) { struct prison *ppr = NULL; struct conf *applicable_conf = NULL; @@ -1358,7 +1369,7 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, *parse_error = NULL; need_applicable_conf = (rules_string == NULL || rules_string[0] == '\0' || - exec_paths_string == NULL || exec_paths_string[0] == '\0'); + exec_paths_string == NULL || exec_paths_string[0] == '\0'); if (need_applicable_conf) { applicable_conf = find_conf(pr, &ppr); @@ -1377,11 +1388,13 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, clone_rules(&conf->rules, &applicable_conf->rules); if (exec_paths_string != NULL && exec_paths_string[0] != '\0') { - error = parse_exec_paths(exec_paths_string, &conf->exec_paths, parse_error); + error = parse_exec_paths(exec_paths_string, &conf->exec_paths, + parse_error); if (error != 0) goto out; } else if (applicable_conf != NULL) - clone_exec_paths(&conf->exec_paths, &applicable_conf->exec_paths); + clone_exec_paths(&conf->exec_paths, + &applicable_conf->exec_paths); set_conf(pr, conf); @@ -1468,12 +1481,12 @@ out: } SYSCTL_PROC(_security_mac_do, OID_AUTO, exec_paths, - CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE, - 0, 0, mac_do_sysctl_exec_paths, "A", - "Colon-separated list of allowed executables"); + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE, + 0, 0, mac_do_sysctl_exec_paths, "A", + "Colon-separated list of allowed executables"); -SYSCTL_JAIL_PARAM_STRING(_mac_do, exec_paths, CTLFLAG_RW, EXEC_PATHS_MAXLEN, - "Jail MAC/do executable paths"); +SYSCTL_JAIL_PARAM_STRING(_mac_do, exec_paths, CTLFLAG_RW, EXEC_PATHS_MAXLEN, + "Jail MAC/do executable paths"); static int mac_do_jail_create(void *obj, void *data) @@ -1510,7 +1523,8 @@ mac_do_jail_get(void *obj, void *data) if (error != 0 && error != ENOENT) goto done; - error = vfs_setopts(opts, "mac.do.exec_paths", exec_paths->exec_paths_str); + error = vfs_setopts(opts, "mac.do.exec_paths", + exec_paths->exec_paths_str); if (error != 0 && error != ENOENT) goto done; @@ -1531,7 +1545,6 @@ _Static_assert(-1 != JAIL_SYS_DISABLE && -1 != JAIL_SYS_NEW && * We perform only cheap checks here, i.e., we do not really parse the rules * specification string, if any. */ - static int mac_do_jail_check(void *obj, void *data) { @@ -1558,14 +1571,17 @@ mac_do_jail_check(void *obj, void *data) * jail_set() calls vfs_getopts() itself later (they becoming * inconsistent wouldn't cause any security problem). */ - error = vfs_getopt(opts, "mac.do.rules", (void **)&rules_string, &rules_len); + + error = vfs_getopt(opts, "mac.do.rules", (void **)&rules_string, + &rules_len); if (error == ENOENT) rules_string = NULL; else { if (error != 0) return (error); if (rules_len == 0 || rules_string[rules_len - 1] != '\0') { - vfs_opterror(opts, "'mac.do.rules' not a proper string"); + vfs_opterror(opts, + "'mac.do.rules' not a proper string"); return (EINVAL); } if (rules_len > MAC_RULE_STRING_LEN) { @@ -1575,14 +1591,17 @@ mac_do_jail_check(void *obj, void *data) } /* Handle 'exec_paths' input */ - error = vfs_getopt(opts, "mac.do.exec_paths", (void **)&exec_paths_string, &exec_paths_len); + error = vfs_getopt(opts, "mac.do.exec_paths", + (void **)&exec_paths_string, &exec_paths_len); if (error == ENOENT) exec_paths_string = NULL; else { if (error != 0) return (error); - if (exec_paths_len == 0 || exec_paths_string[exec_paths_len - 1] != '\0') { - vfs_opterror(opts, "'mac.do.exec_paths' not a proper string"); + if (exec_paths_len == 0 || + exec_paths_string[exec_paths_len - 1] != '\0') { + vfs_opterror(opts, + "'mac.do.exec_paths' not a proper string"); return (EINVAL); } if (exec_paths_len > EXEC_PATHS_MAXLEN) { @@ -1592,12 +1611,13 @@ mac_do_jail_check(void *obj, void *data) } /* - * Be liberal, considering that an empty rule or exec paths specification - * is equivalent to no specification. - * This affects the JAIL_SYS_DISABLE and JAIL_SYS_INHERIT sanity checks below. + * Be liberal, considering that an empty rule or exec paths + * specification is equivalent to no specification. This affects the + * JAIL_SYS_DISABLE and JAIL_SYS_INHERIT sanity checks below. */ - has_rules = rules_string && rules_string[0] != '\0'; - has_exec_paths = exec_paths_string && exec_paths_string[0] != '\0'; + has_rules = rules_string != NULL && rules_string[0] != '\0'; + has_exec_paths = exec_paths_string != NULL && + exec_paths_string[0] != '\0'; /* Infer 'jsys' if needed */ if (jsys == -1) { @@ -1612,18 +1632,23 @@ mac_do_jail_check(void *obj, void *data) case JAIL_SYS_DISABLE: case JAIL_SYS_INHERIT: if (has_rules) { - vfs_opterror(opts, "'mac.do.rules' specified but should not be when mac.do is disabled or inherited"); + vfs_opterror(opts, + "'mac.do.rules' specified but should not be when " + "'mac.do' is 'disabled' or 'inherited'"); return (EINVAL); } if (has_exec_paths) { - vfs_opterror(opts, "'mac.do.exec_paths' specified but should not be when mac.do is disabled or inherited"); + vfs_opterror(opts, + "'mac.do.exec_paths' specified but should not be " + "when 'mac.do' is 'disabled' or 'inherited'"); return (EINVAL); } break; case JAIL_SYS_NEW: if (!has_rules && !has_exec_paths) { - vfs_opterror(opts, "mac.do set to 'new' but neither rules nor exec_paths specified"); + vfs_opterror(opts, "'mac.do' set to 'new' but neither " + "rules nor executable paths specified"); return (EINVAL); } /* Allow: rules only, exec_paths only (though exec_paths only is discouraged), or both */ @@ -1661,8 +1686,9 @@ mac_do_jail_set(void *obj, void *data) exec_paths_string = vfs_getopts(opts, "mac.do.exec_paths", &error); MPASS(error == 0 || error == ENOENT); - has_rules = (rules_string != NULL && rules_string[0] != '\0'); - has_exec_paths = (exec_paths_string != NULL && exec_paths_string[0] != '\0'); + has_rules = rules_string != NULL && rules_string[0] != '\0'; + has_exec_paths = exec_paths_string != NULL && + exec_paths_string[0] != '\0'; if (jsys == -1) { if (has_rules || has_exec_paths) @@ -1683,14 +1709,15 @@ mac_do_jail_set(void *obj, void *data) case JAIL_SYS_NEW: error = parse_and_set_conf(pr, - has_rules ? rules_string : NULL, - has_exec_paths ? exec_paths_string : NULL, - &parse_error); + has_rules ? rules_string : NULL, + has_exec_paths ? exec_paths_string : NULL, + &parse_error); if (error != 0) { if (parse_error != NULL) { - vfs_opterror(opts, "MAC/do: Parse error at index %zu: %s\n", - parse_error->pos, parse_error->msg); + vfs_opterror(opts, + "MAC/do: Parse error at index %zu: %s\n", + parse_error->pos, parse_error->msg); free_parse_error(parse_error); } @@ -1737,8 +1764,8 @@ struct mac_do_data_header { * indicates this header is uninitialized. */ int priv; - /* Rules to apply. */ - struct conf *conf; + /* The configuration that applies. */ + struct conf *conf; }; /* @@ -2233,7 +2260,11 @@ static int check_proc(void) { char *path, *to_free; - int error = EPERM; + struct conf *conf; + struct exec_paths *exec_paths; + struct prison *td_pr; + struct prison *pr; + int error; /* * Only grant privileges if requested by the right executable. @@ -2256,22 +2287,17 @@ check_proc(void) if (vn_fullpath_jail(curproc->p_textvp, &path, &to_free) != 0) return (EPERM); - struct conf *conf; - struct exec_paths *exec_paths; - struct prison *td_pr = curproc->p_ucred->cr_prison; - struct prison *pr; + error = EPERM; + td_pr = curproc->p_ucred->cr_prison; conf = find_conf(td_pr, &pr); exec_paths = &conf->exec_paths; - if (exec_paths->exec_path_count > 0) { - for (int i = 0; i < exec_paths->exec_path_count; i++) { + if (exec_paths->exec_path_count > 0) + for (int i = 0; i < exec_paths->exec_path_count; i++) if (strcmp(exec_paths->exec_paths[i], path) == 0) { error = 0; break; } - } - - } prison_unlock(pr); 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: From nobody Fri May 29 16:01:29 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 4gRp4q1x1Gz6fl37 for ; Fri, 29 May 2026 16:01:31 +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 4gRp4p1L78z3H1v for ; Fri, 29 May 2026 16:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070490; 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=CDjs0osB7HaWYWLgKCY/Wa309nnPvr/MmelH3wXKFdE=; b=vi1AAJ6491S+7nSc5FbgFKj0XBW8/MG7fH8+QBQ1Ft2dMw5Oe7NDmuwSOlRO5iBT3+kmHX e6zb3TyFRirLnS6CzJzUX2gaySKrvWlVrDkv5XjfKW+9KcboWVx6BY8UmhhS6udfRlH5W5 1qeBoVeH0deZYelv2/2fKp5i9AieWZiMWPtNTqfceXie++Yr4NOL/Hy10IdMJrAjEtklqY 0zMODEEBo8PZ5MUltQXVz+b0IeCeaJGgrlLLVKQIX0xhcTAKSvFjMV2bDHJB54l/vzY2Nf xxQBwml6clkx8od/BHezT+E6MYI1B5sbCX1AzJ4lmXWWzMRl6jVdy29MSjS57g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070490; a=rsa-sha256; cv=none; b=Hl2kLIbg9Q6pN7/i+fTWb2YL9rYqsGWbYUuWucjvsx2HyC040rBGitkLyIKWGT7JTuD5gi R7nbQvalmTGVD8O1p0wsRBRKLJcx224Ku5I9C36yPY/OKKZS7WuD1AR7gly+Yi8j/6fLnZ KH2Ak2Uh4M27lEfeuqsyfiOQdvTi9Nhtn8TH3oftiDfU+2Y6TC6N+8rJSjAA/Wb5qRDNrx S94tTm4yJXMn5fG7PHBEL1Tf6remAtE7tO5E6xe7EGnaozXA+QIsP06I82KNKcET0F9l13 49mE9hgUDI/Bb4oHAWIWsXjoo8veYBTnGFfUhMNucGixCqRcJeUdaVeev6fwzg== 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=1780070490; 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=CDjs0osB7HaWYWLgKCY/Wa309nnPvr/MmelH3wXKFdE=; b=X0lUMG/Xc8BIEXAuQK8jrmcIFxEVUlwNLEUCGlGHfaSK0+1LN7f2Xz8WsPmCU9MS2NWpp+ ANUGm1E0dRrxO3rfpMCltUEPYLdNfIXO9SmsdTi1Sf3P0r2kq9wZFUUIjw3W88Ehv2xhKw 6c5MC99dIMnOvqpCYv4L27i7/J/hBtGzAz7vcBCmHTydmVW0N83ynzpx2mmNetoova6IaY npzKOJjeDN2p/mnY5UXYdjTmM/kYCdxgJ6RwtAzmxX4X+h8cTJpTK+L+uNA27y2BFIllWu 8KMnpbuyACh4/aNluNC+qGIG1sMzVG06Ox4kFse19zQ7PsHWsIrDIhNdIHgUcA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4n6jjdzg96 for ; Fri, 29 May 2026 16:01:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35d20 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 22a0912bb1dc - main - MAC/do: Expand "conf" to "configuration" in a panic message on INVARIANTS 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: 22a0912bb1dc71f18d2e33ec9915a54a8324a3ff Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:29 +0000 Message-Id: <6a19b859.35d20.36ae3bec@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=22a0912bb1dc71f18d2e33ec9915a54a8324a3ff commit 22a0912bb1dc71f18d2e33ec9915a54a8324a3ff Author: Olivier Certner AuthorDate: 2026-03-23 14:42:07 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:20:35 +0000 MAC/do: Expand "conf" to "configuration" in a panic message on INVARIANTS No functional change. 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 2258c358ce92..9da7aaa257d5 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1201,8 +1201,8 @@ check_conf_use_count(const struct conf *const conf, u_int expected) const u_int use_count = refcount_load(&conf->use_count); if (use_count != expected) - panic("MAC/do: Conf at %p: Use count is %u, expected %u", - conf, use_count, expected); + panic("MAC/do: Configuration at %p: Use count is %u, " + "expected %u", conf, use_count, expected); } #else #define check_conf_use_count(...) From nobody Fri May 29 16:01:25 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 4gRp4q0JNTz6flRl for ; Fri, 29 May 2026 16:01:31 +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 4gRp4p5grgz3HMl for ; Fri, 29 May 2026 16:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070490; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LwlLyTAJzU+RscZ/1yX1cmBqpKE4Uz+ZelX0Cbh1hKc=; b=PR9Qq9zgsPtuf6DcniQaNpJw0+EeZ6H2fITelsGmKgesLBpdnJkIuax4Vv5GPDdrO3nEzC aXLkhbQRPymVhronRKEawgGMf1sFS0bMbHp7TkVAcZ2z/qWgSnu62N978vvkojOc4E/36T 41sSXnTZMydYZ7GWGwiCF+8fizuISHt8b95xQhGjLr0uyFoIZRu5MEerxvkRe64yIDTA4R Aq5VTa4+NdCkhm9JSAgb/GvXq5wkK4hfdLDmMByqc//pX6OCViu9Fw78bto/nKMfB5RSsO j/5pblTx4wCKFE2oEgs7CIgTPfKxnAkyF4gH7rgWQOgo6W9rbo5chJtD2jq6Rg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070490; a=rsa-sha256; cv=none; b=Kut9SMgVnc2ijKR/JIcbS00trTGksu+DKYM0nBLjT3sWbTrD1/6bIviMmyNduzheTBdkfF UDwQrpRMTx1Po+YO/a4Nt6xRQhk2qHXzdX2BBdhxfdSh2/BJg9RAgLkQG6eQ2XaFuq/wt5 E36HPnM7qaZOP+sGlsjXs9DUcb8za8KwDPyo1oriVrXawAV/sH2sl/SE+US/kcSMlwkUeB PFTvHbz20LPv96TeNCSlgVncd99hi+JgrWx9IGYiEQNKU9pyRcTNT0AYOx5ZbQOEBMNEM+ nC0MCfR2YTmMAculnZXl6EUlF0JRkIzzFrZzd/Z785UNFNt7IysWzvvds3mpgg== 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=1780070490; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LwlLyTAJzU+RscZ/1yX1cmBqpKE4Uz+ZelX0Cbh1hKc=; b=r0BgApfkCPB3TGJq0csAPWbGmLvgKVp9zG7z+L9ax5iXa+YV+g4qO7Xb0xPyj88kiruFVa FCG6rkaPblbip7pBwID1G++vt80qPccD7FXoss4PdfVts+/FjRFAvTeuS70f97qzBrroar 85dyCJd7G3ZOY5WfO2PvGPjLJn7/GFs14GzvaDRasRjC9LMtpR79GcJlpKMBfn5JCN977Z HxVANfMYovbnjIyDFQaUyx1hpTMeBkcsqVjM6A8heM6EGVRjNDPs7dFqIv9i6HB8AfJiVr T2LizmfUdymDs5cXKVS8jth6hoRKb8ZHMrkauLDH/TdOKYJeL3O8w6TM0nzB/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4p53BbzgcS for ; Fri, 29 May 2026 16:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32eea by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Kushagra Srivastava From: Olivier Certner Subject: git: 9818224174c4 - main - MAC/do: Executable paths feature (GSoC 2025's final state) 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: 9818224174c41a434028446fb6fa5516a6291755 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:25 +0000 Message-Id: <6a19b855.32eea.4f007537@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=9818224174c41a434028446fb6fa5516a6291755 commit 9818224174c41a434028446fb6fa5516a6291755 Author: Kushagra Srivastava AuthorDate: 2025-08-14 14:41:57 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:02:44 +0000 MAC/do: Executable paths feature (GSoC 2025's final state) By design, mac_do(4) only authorizes credentials change requests if they are issued by a process spawned from '/usr/bin/mdo'. The executable paths feature introduces some flexibility by allowing to change that path, thus allowing another executable to make requests, and to use multiple such paths (up to 8 in the current implementation). Its purpose is to enable thin jails scenarios where mdo(1) may not be at its canonical path ('/usr/bin/mdo') and to allow experimenting with other userland programs leveraging setcred(2). Configuration of executable paths is per-jail and intentionally works completely similarly with rules. It is accessible from within a jail through the 'security.mac.do.exec_paths' sysctl knob and from outside a jail through the 'mac.do.exec_paths' jail parameter. This commit groups the verbatim changes of the following commits that Kushagra Srivastava, our GSoC 2025 student, created in his GitHub repository (https://github.com/thesynthax/freebsd-src), branch 'task/exec-paths-refactor': mac_do(4): Complete refactor of allowed executable paths feature mac_do(4): Fixed changing security.mac.do.* knobs in inheritance mode mac_do(4): Debugging rules and exec_paths leak on destroy mac_do(4): Deep copy rules mac_do(4): Fixed leak mac_do(4): fixed various bugs, structs inlined, leaks remain mac_do(4): MAC/do working in jail, leaks decreased mac_do(4): MAC/do fixed, works in host and jails, leaks removed mac_do(4): style Frozen log for these commits: https://github.com/OlCe2/freebsd-src/compare/main...14fdc49fb29265fac5d0daf95a13d0dce325c951. The corresponding pull request is at: https://github.com/OlCe2/freebsd-src/pull/2. The GSoC's final state of this code still has a number of problems that are fixed in subsequent commits. It is however committed separately to clearly delineate Kushagra's work. Reviewed by: olce (amendments to come, see above) MFC after: 1 month Relnotes: yes Sponsored by: Google LLC (GSoC 2025) Sponsored by: The FreeBSD Foundation (review, commit) Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 --- sys/security/mac_do/mac_do.c | 581 +++++++++++++++++++++++++++++++------------ 1 file changed, 422 insertions(+), 159 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index ba49da22ce67..b63fc2a5bbc8 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -46,6 +46,9 @@ SYSCTL_INT(_security_mac_do, OID_AUTO, print_parse_error, CTLFLAG_RWTUN, static MALLOC_DEFINE(M_MAC_DO, "mac_do", "mac_do(4) security module"); +#define EXEC_PATHS_MAXLEN 2048 +#define MAX_EXEC_PATHS 8 + #define MAC_RULE_STRING_LEN 1024 static unsigned osd_jail_slot; @@ -167,6 +170,17 @@ STAILQ_HEAD(rulehead, rule); struct rules { char string[MAC_RULE_STRING_LEN]; struct rulehead head; +}; + +struct exec_paths { + char exec_paths_str[EXEC_PATHS_MAXLEN]; + char exec_paths[MAX_EXEC_PATHS][PATH_MAX]; + int exec_path_count; +}; + +struct conf { + struct rules rules; + struct exec_paths exec_paths; volatile u_int use_count __aligned(CACHE_LINE_SIZE); }; @@ -323,19 +337,34 @@ toast_rules(struct rules *const rules) free(rule->gids, M_MAC_DO); free(rule, M_MAC_DO); } - free(rules, M_MAC_DO); } -static struct rules * -alloc_rules(void) +/* Assuming storage is zeroed already */ +static void +init_rules(struct rules *const rules) { - struct rules *const rules = malloc(sizeof(*rules), M_MAC_DO, M_WAITOK); - _Static_assert(MAC_RULE_STRING_LEN > 0, "MAC_RULE_STRING_LEN <= 0!"); - rules->string[0] = 0; STAILQ_INIT(&rules->head); - rules->use_count = 0; - return (rules); +} + +static void +init_exec_paths(struct exec_paths *const exec_paths) +{ + _Static_assert(EXEC_PATHS_MAXLEN > 0, "EXEC_PATHS_MAXLEN <= 0!"); + bzero(exec_paths, sizeof(*exec_paths)); + exec_paths->exec_paths_str[0] = 0; +} + +static struct conf * +alloc_conf(void) +{ + struct conf *const conf = malloc(sizeof(*conf), M_MAC_DO, M_WAITOK | M_ZERO); + + init_rules(&conf->rules); + init_exec_paths(&conf->exec_paths); + conf->use_count = 0; + + return (conf); } static bool @@ -1007,12 +1036,11 @@ einval: * - "gid=1010>gid=1011,gid=1012,gid=1013" */ static int -parse_rules(const char *const string, struct rules **const rulesp, +parse_rules(const char *const string, struct rules *const rules, struct parse_error **const parse_error) { const size_t len = strlen(string); char *copy, *p, *rule; - struct rules *rules; int error = 0; *parse_error = NULL; @@ -1024,7 +1052,6 @@ parse_rules(const char *const string, struct rules **const rulesp, return (ENAMETOOLONG); } - rules = alloc_rules(); bcopy(string, rules->string, len + 1); MPASS(rules->string[len] == '\0'); /* Catch some races. */ @@ -1044,31 +1071,90 @@ parse_rules(const char *const string, struct rules **const rulesp, } } - *rulesp = rules; +out: + free(copy, M_MAC_DO); + return (error); +} + +static int +parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, + struct parse_error **const parse_error) +{ + const size_t len = strlen(string); + char *copy, *p, *path; + int error = 0; + + *parse_error = NULL; + + if (len >= EXEC_PATHS_MAXLEN) { + make_parse_error(parse_error, 0, + "Exec path specification string is too long (%zu, max %u)", + len, EXEC_PATHS_MAXLEN - 1); + return (ENAMETOOLONG); + } + + bcopy(string, exec_paths->exec_paths_str, len + 1); + MPASS(exec_paths->exec_paths_str[len] == '\0'); + + copy = malloc(len + 1, M_MAC_DO, M_WAITOK); + bcopy(string, copy, len + 1); + MPASS(copy[len] == '\0'); + + p = copy; + while ((path = strsep_noblanks(&p, ":")) != NULL) { + if (*path == '\0') + continue; + + if (exec_paths->exec_path_count >= MAX_EXEC_PATHS) { + make_parse_error(parse_error, path - copy, + "Too many exec paths specified (max %d)", MAX_EXEC_PATHS); + error = EINVAL; + goto out; + } + + const size_t path_len = strlen(path); + if (path_len >= PATH_MAX) { + make_parse_error(parse_error, path - copy, + "Exec paths too long (%zu, max %u)", + path_len, PATH_MAX - 1); + error = ENAMETOOLONG; + goto out; + } + + strlcpy(exec_paths->exec_paths[exec_paths->exec_path_count], path, PATH_MAX); + exec_paths->exec_path_count++; + } + + if (exec_paths->exec_path_count == 0) { + make_parse_error(parse_error, 0, "No valid exec paths found"); + error = EINVAL; + goto out; + } + out: free(copy, M_MAC_DO); return (error); } /* - * Find rules applicable to the passed prison. + * Find conf applicable to the passed prison. * - * Returns the applicable rules (and never NULL). 'pr' must be unlocked. + * 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 rules. '*aprp' is equal to 'pr' if and - * only if the current jail has its own set of rules. + * 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. */ -static struct rules * -find_rules(struct prison *const pr, struct prison **const aprp) +static struct conf * +find_conf(struct prison *const pr, struct prison **const aprp) { struct prison *cpr, *ppr; - struct rules *rules; + struct conf *conf; cpr = pr; for (;;) { prison_lock(cpr); - rules = osd_jail_get(cpr, osd_jail_slot); - if (rules != NULL) + conf = osd_jail_get(cpr, osd_jail_slot); + if (conf != NULL) break; prison_unlock(cpr); @@ -1078,34 +1164,36 @@ find_rules(struct prison *const pr, struct prison **const aprp) } *aprp = cpr; - return (rules); + return (conf); } static void -hold_rules(struct rules *const rules) +hold_conf(struct conf *const conf) { - refcount_acquire(&rules->use_count); + refcount_acquire(&conf->use_count); } static void -drop_rules(struct rules *const rules) +drop_conf(struct conf *const conf) { - if (refcount_release(&rules->use_count)) - toast_rules(rules); + if (refcount_release(&conf->use_count)) { + toast_rules(&conf->rules); + free(conf, M_MAC_DO); + } } #ifdef INVARIANTS static void -check_rules_use_count(const struct rules *const rules, u_int expected) +check_conf_use_count(const struct conf *const conf, u_int expected) { - const u_int use_count = refcount_load(&rules->use_count); + const u_int use_count = refcount_load(&conf->use_count); if (use_count != expected) - panic("MAC/do: Rules at %p: Use count is %u, expected %u", - rules, use_count, expected); + panic("MAC/do: Conf at %p: Use count is %u, expected %u", + conf, use_count, expected); } #else -#define check_rules_use_count(...) +#define check_conf_use_count(...) #endif /* INVARIANTS */ /* @@ -1117,7 +1205,7 @@ check_rules_use_count(const struct rules *const rules, u_int expected) static void dealloc_jail_osd(void *const value) { - struct rules *const rules = value; + struct conf *const conf = value; /* * If called because the "holding" jail goes down, no one should be @@ -1133,8 +1221,8 @@ dealloc_jail_osd(void *const value) * we ensure that all thread's slots are freed first in mac_do_destroy() * to be able to check that only one reference remains. */ - check_rules_use_count(rules, 1); - toast_rules(rules); + check_conf_use_count(conf, 1); + drop_conf(conf); } /* @@ -1146,9 +1234,9 @@ dealloc_jail_osd(void *const value) * Destroys the 'osd_jail_slot' slot of the passed jail. */ static void -remove_rules(struct prison *const pr) +remove_conf(struct prison *const pr) { - struct rules *old_rules; + struct conf *old_conf; int error __unused; prison_lock(pr); @@ -1158,7 +1246,7 @@ remove_rules(struct prison *const pr) * decrement their use count, and possibly free them, outside of the * prison lock. */ - old_rules = osd_jail_get(pr, osd_jail_slot); + old_conf = osd_jail_get(pr, osd_jail_slot); error = osd_jail_set(pr, osd_jail_slot, NULL); /* osd_set() never allocates memory when 'value' is NULL, nor fails. */ MPASS(error == 0); @@ -1169,40 +1257,40 @@ remove_rules(struct prison *const pr) osd_jail_del(pr, osd_jail_slot); prison_unlock(pr); - if (old_rules != NULL) - drop_rules(old_rules); + if (old_conf != NULL) + drop_conf(old_conf); } -/* - * Assign already built rules to a jail. - */ static void -set_rules(struct prison *const pr, struct rules *const rules) +set_conf(struct prison *const pr, struct conf *const conf) { - struct rules *old_rules; + struct conf *old_conf; void **rsv; - check_rules_use_count(rules, 0); - hold_rules(rules); + hold_conf(conf); rsv = osd_reserve(osd_jail_slot); prison_lock(pr); - old_rules = osd_jail_get(pr, osd_jail_slot); - osd_jail_set_reserved(pr, osd_jail_slot, rsv, rules); + old_conf = osd_jail_get(pr, osd_jail_slot); + osd_jail_set_reserved(pr, osd_jail_slot, rsv, conf); prison_unlock(pr); - if (old_rules != NULL) - drop_rules(old_rules); + if (old_conf != NULL) + drop_conf(old_conf); } /* - * Assigns empty rules to a jail. + * Assigns default conf to a jail. */ static void -set_empty_rules(struct prison *const pr) +set_default_conf(struct prison *const pr) { - struct rules *const rules = alloc_rules(); + struct conf *const conf = alloc_conf(); + + strlcpy(conf->exec_paths.exec_paths_str, "/usr/bin/mdo", EXEC_PATHS_MAXLEN); + strlcpy(conf->exec_paths.exec_paths[0], "/usr/bin/mdo", PATH_MAX); + conf->exec_paths.exec_path_count = 1; - set_rules(pr, rules); + set_conf(pr, conf); } /* @@ -1210,18 +1298,99 @@ set_empty_rules(struct prison *const pr) * * Returns the same error code as parse_rules() (which see). */ -static int -parse_and_set_rules(struct prison *const pr, const char *rules_string, - struct parse_error **const parse_error) + +static void +clone_rules(struct rules *dst, struct rules *const src) { - struct rules *rules; - int error; + struct rule *src_rule, *dst_rule; + + bzero(dst, sizeof(*dst)); + strlcpy(dst->string, src->string, sizeof(dst->string)); + STAILQ_INIT(&dst->head); + + STAILQ_FOREACH(src_rule, &src->head, r_entries) { + dst_rule = malloc(sizeof(*dst_rule), M_MAC_DO, M_WAITOK | M_ZERO); + bcopy(src_rule, dst_rule, sizeof(*dst_rule)); + + if (src_rule->uids_nb > 0) { + dst_rule->uids = malloc(sizeof(*dst_rule->uids) * src_rule->uids_nb, + M_MAC_DO, M_WAITOK); + bcopy(src_rule->uids, dst_rule->uids, + sizeof(*dst_rule->uids) * src_rule->uids_nb); + } + + if (src_rule->gids_nb > 0) { + dst_rule->gids = malloc(sizeof(*dst_rule->gids) * src_rule->gids_nb, + M_MAC_DO, M_WAITOK); + bcopy(src_rule->gids, dst_rule->gids, + sizeof(*dst_rule->gids) * src_rule->gids_nb); + } - error = parse_rules(rules_string, &rules, parse_error); + STAILQ_INSERT_TAIL(&dst->head, dst_rule, r_entries); + } +} + +static void +clone_exec_paths(struct exec_paths *dst, struct exec_paths *const src) +{ + bzero(dst, sizeof(*dst)); + dst->exec_path_count = src->exec_path_count; + for (int i = 0; i < src->exec_path_count; i++) { + strlcpy(dst->exec_paths[i], src->exec_paths[i], + sizeof(dst->exec_paths[i])); + } + + strlcpy(dst->exec_paths_str, src->exec_paths_str, + sizeof(dst->exec_paths_str)); +} + +static int +parse_and_set_conf(struct prison *pr, const char *rules_string, + const char *exec_paths_string, struct parse_error **parse_error) +{ + struct prison *ppr = NULL; + struct conf *applicable_conf = NULL; + struct conf *conf; + int error = 0; + bool need_applicable_conf; + + *parse_error = NULL; + + need_applicable_conf = (rules_string == NULL || rules_string[0] == '\0' || + exec_paths_string == NULL || exec_paths_string[0] == '\0'); + + if (need_applicable_conf) { + applicable_conf = find_conf(pr, &ppr); + hold_conf(applicable_conf); + prison_unlock(ppr); + } + + conf = alloc_conf(); + + if (rules_string != NULL && rules_string[0] != '\0') { + error = parse_rules(rules_string, &conf->rules, parse_error); + if (error != 0) + goto out; + } + else if (applicable_conf != NULL) + clone_rules(&conf->rules, &applicable_conf->rules); + + if (exec_paths_string != NULL && exec_paths_string[0] != '\0') { + error = parse_exec_paths(exec_paths_string, &conf->exec_paths, parse_error); + if (error != 0) + goto out; + } else if (applicable_conf != NULL) + clone_exec_paths(&conf->exec_paths, &applicable_conf->exec_paths); + + set_conf(pr, conf); + +out: + if (applicable_conf != NULL) + drop_conf(applicable_conf); if (error != 0) - return (error); - set_rules(pr, rules); - return (0); + drop_conf(conf); + + return (error); } static int @@ -1230,12 +1399,12 @@ mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) char *const buf = malloc(MAC_RULE_STRING_LEN, M_MAC_DO, M_WAITOK); struct prison *const td_pr = req->td->td_ucred->cr_prison; struct prison *pr; - struct rules *rules; + struct conf *conf; struct parse_error *parse_error; int error; - rules = find_rules(td_pr, &pr); - strlcpy(buf, rules->string, MAC_RULE_STRING_LEN); + conf = find_conf(td_pr, &pr); + strlcpy(buf, conf->rules.string, MAC_RULE_STRING_LEN); prison_unlock(pr); error = sysctl_handle_string(oidp, buf, MAC_RULE_STRING_LEN, req); @@ -1243,13 +1412,14 @@ mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) goto out; /* Set our prison's rules, not that of the jail we inherited from. */ - error = parse_and_set_rules(td_pr, buf, &parse_error); + error = parse_and_set_conf(td_pr, buf, NULL, &parse_error); if (error != 0) { if (print_parse_error) printf("MAC/do: Parse error at index %zu: %s\n", parse_error->pos, parse_error->msg); free_parse_error(parse_error); } + out: free(buf, M_MAC_DO); return (error); @@ -1265,13 +1435,52 @@ SYSCTL_JAIL_PARAM_SYS_SUBNODE(mac, do, CTLFLAG_RW, "Jail MAC/do parameters"); SYSCTL_JAIL_PARAM_STRING(_mac_do, rules, CTLFLAG_RW, MAC_RULE_STRING_LEN, "Jail MAC/do rules"); +static int +mac_do_sysctl_exec_paths(SYSCTL_HANDLER_ARGS) +{ + char *const buf = malloc(EXEC_PATHS_MAXLEN, M_MAC_DO, M_WAITOK); + struct prison *const td_pr = req->td->td_ucred->cr_prison; + struct prison *pr; + struct conf *conf; + struct parse_error *parse_error; + int error; + + conf = find_conf(td_pr, &pr); + strlcpy(buf, conf->exec_paths.exec_paths_str, EXEC_PATHS_MAXLEN); + prison_unlock(pr); + + error = sysctl_handle_string(oidp, buf, EXEC_PATHS_MAXLEN, req); + if (error != 0 || req->newptr == NULL) + goto out; + + error = parse_and_set_conf(td_pr, NULL, buf, &parse_error); + if (error != 0) { + if (print_parse_error) + printf("MAC/do: Parse error at index %zu: %s\n", + parse_error->pos, parse_error->msg); + free_parse_error(parse_error); + } + +out: + free(buf, M_MAC_DO); + return (error); +} + +SYSCTL_PROC(_security_mac_do, OID_AUTO, exec_paths, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE, + 0, 0, mac_do_sysctl_exec_paths, "A", + "Colon-separated list of allowed executables"); + +SYSCTL_JAIL_PARAM_STRING(_mac_do, exec_paths, CTLFLAG_RW, EXEC_PATHS_MAXLEN, + "Jail MAC/do executable paths"); static int -mac_do_jail_create(void *obj, void *data __unused) +mac_do_jail_create(void *obj, void *data) { struct prison *const pr = obj; - set_empty_rules(pr); + set_default_conf(pr); + return (0); } @@ -1280,10 +1489,14 @@ mac_do_jail_get(void *obj, void *data) { struct prison *ppr, *const pr = obj; struct vfsoptlist *const opts = data; + struct conf *conf; struct rules *rules; + struct exec_paths *exec_paths; int jsys, error; - rules = find_rules(pr, &ppr); + conf = find_conf(pr, &ppr); + rules = &conf->rules; + exec_paths = &conf->exec_paths; jsys = pr == ppr ? (STAILQ_EMPTY(&rules->head) ? JAIL_SYS_DISABLE : JAIL_SYS_NEW) : @@ -1296,6 +1509,10 @@ mac_do_jail_get(void *obj, void *data) if (error != 0 && error != ENOENT) goto done; + error = vfs_setopts(opts, "mac.do.exec_paths", exec_paths->exec_paths_str); + if (error != 0 && error != ENOENT) + goto done; + error = 0; done: prison_unlock(ppr); @@ -1313,13 +1530,16 @@ _Static_assert(-1 != JAIL_SYS_DISABLE && -1 != JAIL_SYS_NEW && * We perform only cheap checks here, i.e., we do not really parse the rules * specification string, if any. */ + static int mac_do_jail_check(void *obj, void *data) { struct vfsoptlist *opts = data; - char *rules_string; - int error, jsys, size; + char *rules_string, *exec_paths_string; + 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) jsys = -1; @@ -1337,60 +1557,82 @@ mac_do_jail_check(void *obj, void *data) * jail_set() calls vfs_getopts() itself later (they becoming * inconsistent wouldn't cause any security problem). */ - error = vfs_getopt(opts, "mac.do.rules", (void**)&rules_string, &size); - if (error == ENOENT) { - /* - * Default (in absence of "mac.do.rules") is to disable (and, in - * particular, not inherit). - */ - if (jsys == -1) - jsys = JAIL_SYS_DISABLE; - - if (jsys == JAIL_SYS_NEW) { - vfs_opterror(opts, "'mac.do.rules' must be specified " - "given 'mac.do''s value"); + error = vfs_getopt(opts, "mac.do.rules", (void **)&rules_string, &rules_len); + if (error == ENOENT) + rules_string = NULL; + else { + if (error != 0) + return (error); + if (rules_len == 0 || rules_string[rules_len - 1] != '\0') { + vfs_opterror(opts, "'mac.do.rules' not a proper string"); return (EINVAL); } + if (rules_len > MAC_RULE_STRING_LEN) { + vfs_opterror(opts, "'mac.do.rules' too long"); + return (ENAMETOOLONG); + } + } - /* Absence of "mac.do.rules" at this point is OK. */ - error = 0; - } else { + /* Handle 'exec_paths' input */ + error = vfs_getopt(opts, "mac.do.exec_paths", (void **)&exec_paths_string, &exec_paths_len); + if (error == ENOENT) + exec_paths_string = NULL; + else { if (error != 0) return (error); - - /* Not a proper string. */ - if (size == 0 || rules_string[size - 1] != '\0') { - vfs_opterror(opts, "'mac.do.rules' not a proper string"); + if (exec_paths_len == 0 || exec_paths_string[exec_paths_len - 1] != '\0') { + vfs_opterror(opts, "'mac.do.exec_paths' not a proper string"); return (EINVAL); } - - if (size > MAC_RULE_STRING_LEN) { - vfs_opterror(opts, "'mdo.rules' too long"); + if (exec_paths_len > EXEC_PATHS_MAXLEN) { + vfs_opterror(opts, "'mac.do.exec_paths' too long"); return (ENAMETOOLONG); } + } - if (jsys == -1) - /* Default (if "mac.do.rules" is present). */ - jsys = rules_string[0] == '\0' ? JAIL_SYS_DISABLE : - JAIL_SYS_NEW; + /* + * Be liberal, considering that an empty rule or exec paths specification + * is equivalent to no specification. + * This affects the JAIL_SYS_DISABLE and JAIL_SYS_INHERIT sanity checks below. + */ + has_rules = rules_string && rules_string[0] != '\0'; + has_exec_paths = exec_paths_string && exec_paths_string[0] != '\0'; - /* - * Be liberal and accept JAIL_SYS_DISABLE and JAIL_SYS_INHERIT - * with an explicit empty rules specification. - */ - switch (jsys) { - case JAIL_SYS_DISABLE: - case JAIL_SYS_INHERIT: - if (rules_string[0] != '\0') { - vfs_opterror(opts, "'mac.do.rules' specified " - "but should not given 'mac.do''s value"); - return (EINVAL); - } - break; + /* Infer 'jsys' if needed */ + if (jsys == -1) { + if (has_rules || has_exec_paths) + jsys = JAIL_SYS_NEW; + else + jsys = JAIL_SYS_DISABLE; + } + + /* Final checks based on resolved 'jsys' */ + switch (jsys) { + case JAIL_SYS_DISABLE: + case JAIL_SYS_INHERIT: + if (has_rules) { + vfs_opterror(opts, "'mac.do.rules' specified but should not be when mac.do is disabled or inherited"); + return (EINVAL); + } + if (has_exec_paths) { + vfs_opterror(opts, "'mac.do.exec_paths' specified but should not be when mac.do is disabled or inherited"); + return (EINVAL); } + break; + + case JAIL_SYS_NEW: + if (!has_rules && !has_exec_paths) { + vfs_opterror(opts, "mac.do set to 'new' but neither rules nor exec_paths specified"); + return (EINVAL); + } + /* Allow: rules only, exec_paths only (though exec_paths only is discouraged), or both */ + break; + + default: + __assert_unreachable(); } - return (error); + return (0); } static int @@ -1398,9 +1640,10 @@ mac_do_jail_set(void *obj, void *data) { struct prison *pr = obj; struct vfsoptlist *opts = data; - char *rules_string; - struct parse_error *parse_error; + char *rules_string, *exec_paths_string; + struct parse_error *parse_error = NULL; int error, jsys; + bool has_rules, has_exec_paths; /* * The invariants checks used below correspond to what has already been @@ -1414,49 +1657,50 @@ mac_do_jail_set(void *obj, void *data) rules_string = vfs_getopts(opts, "mac.do.rules", &error); MPASS(error == 0 || error == ENOENT); - if (error == 0) { - MPASS(strlen(rules_string) < MAC_RULE_STRING_LEN); - if (jsys == -1) - /* Default (if "mac.do.rules" is present). */ - jsys = rules_string[0] == '\0' ? JAIL_SYS_DISABLE : - JAIL_SYS_NEW; + exec_paths_string = vfs_getopts(opts, "mac.do.exec_paths", &error); + MPASS(error == 0 || error == ENOENT); + + has_rules = (rules_string != NULL && rules_string[0] != '\0'); + has_exec_paths = (exec_paths_string != NULL && exec_paths_string[0] != '\0'); + + if (jsys == -1) { + if (has_rules || has_exec_paths) + jsys = JAIL_SYS_NEW; else - MPASS(jsys == JAIL_SYS_NEW || - ((jsys == JAIL_SYS_DISABLE || - jsys == JAIL_SYS_INHERIT) && - rules_string[0] == '\0')); - } else { - MPASS(jsys != JAIL_SYS_NEW); - if (jsys == -1) - /* - * Default (in absence of "mac.do.rules") is to disable - * (and, in particular, not inherit). - */ jsys = JAIL_SYS_DISABLE; - /* If disabled, we'll store an empty rule specification. */ - if (jsys == JAIL_SYS_DISABLE) - rules_string = ""; } switch (jsys) { case JAIL_SYS_INHERIT: - remove_rules(pr); - error = 0; - break; + remove_conf(pr); + return (0); + case JAIL_SYS_DISABLE: + rules_string = ""; + has_rules = true; + /* FALLTHROUGH */ + case JAIL_SYS_NEW: - error = parse_and_set_rules(pr, rules_string, &parse_error); + error = parse_and_set_conf(pr, + has_rules ? rules_string : NULL, + has_exec_paths ? exec_paths_string : NULL, + &parse_error); + if (error != 0) { - vfs_opterror(opts, - "MAC/do: Parse error at index %zu: %s\n", - parse_error->pos, parse_error->msg); - free_parse_error(parse_error); + if (parse_error != NULL) { + vfs_opterror(opts, "MAC/do: Parse error at index %zu: %s\n", + parse_error->pos, parse_error->msg); + free_parse_error(parse_error); + } + + return (error); } - break; + + return (0); + default: __assert_unreachable(); } - return (error); } /* @@ -1493,7 +1737,7 @@ struct mac_do_data_header { */ int priv; /* Rules to apply. */ - struct rules *rules; + struct conf *conf; }; /* @@ -1536,7 +1780,7 @@ clear_data(void *const data) struct mac_do_data_header *const hdr = data; if (hdr != NULL) { - drop_rules(hdr->rules); + drop_conf(hdr->conf); /* We don't deallocate so as to save time on next access. */ hdr->priv = 0; } @@ -1558,7 +1802,7 @@ is_data_reusable(const void *const data, const size_t size) static void set_data_header(void *const data, const size_t size, const int priv, - struct rules *const rules) + struct conf *const conf) { struct mac_do_data_header *const hdr = data; @@ -1567,7 +1811,7 @@ set_data_header(void *const data, const size_t size, const int priv, MPASS(size <= hdr->allocated_size); hdr->size = size; hdr->priv = priv; - hdr->rules = rules; + hdr->conf = conf; } /* The proc lock (and any other non-sleepable lock) must not be held. */ @@ -1933,7 +2177,7 @@ static int mac_do_priv_grant(struct ucred *cred, int priv) { struct mac_do_setcred_data *const data = fetch_data(); - const struct rules *rules; + struct rules *rules; const struct ucred *new_cred; const struct rule *rule; u_int setcred_flags; @@ -1950,7 +2194,7 @@ mac_do_priv_grant(struct ucred *cred, int priv) /* No. */ return (EPERM); - rules = data->hdr.rules; + rules = &data->hdr.conf->rules; new_cred = data->new_cred; KASSERT(new_cred != NULL, ("priv_check*() called before mac_cred_check_setcred()")); @@ -1988,7 +2232,7 @@ static int check_proc(void) { char *path, *to_free; - int error; + int error = EPERM; /* * Only grant privileges if requested by the right executable. @@ -2010,7 +2254,26 @@ check_proc(void) */ if (vn_fullpath_jail(curproc->p_textvp, &path, &to_free) != 0) return (EPERM); - error = strcmp(path, "/usr/bin/mdo") == 0 ? 0 : EPERM; + + struct conf *conf; + struct exec_paths *exec_paths; + struct prison *td_pr = curproc->p_ucred->cr_prison; + struct prison *pr; + conf = find_conf(td_pr, &pr); + exec_paths = &conf->exec_paths; + + if (exec_paths->exec_path_count > 0) { + for (int i = 0; i < exec_paths->exec_path_count; i++) { + if (strcmp(exec_paths->exec_paths[i], path) == 0) { + error = 0; + break; + } + } + + } + + prison_unlock(pr); + free(to_free, M_TEMP); return (error); } @@ -2018,9 +2281,9 @@ check_proc(void) static void mac_do_setcred_enter(void) { - struct rules *rules; struct prison *pr; struct mac_do_setcred_data * data; + struct conf *conf; int error; /* @@ -2042,8 +2305,8 @@ mac_do_setcred_enter(void) /* * Find the currently applicable rules. */ - rules = find_rules(curproc->p_ucred->cr_prison, &pr); - hold_rules(rules); + conf = find_conf(curproc->p_ucred->cr_prison, &pr); + hold_conf(conf); prison_unlock(pr); /* @@ -2052,7 +2315,7 @@ mac_do_setcred_enter(void) data = fetch_data(); if (!is_data_reusable(data, sizeof(*data))) data = alloc_data(data, sizeof(*data)); - set_data_header(data, sizeof(*data), PRIV_CRED_SETCRED, rules); + set_data_header(data, sizeof(*data), PRIV_CRED_SETCRED, conf); /* Not really necessary, but helps to catch programming errors. */ data->new_cred = NULL; data->setcred_flags = 0; *** 13 LINES SKIPPED *** From nobody Fri May 29 16:01:32 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 4gRp4r4xdmz6flRv for ; Fri, 29 May 2026 16:01:32 +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 4gRp4r1jWhz3H6j for ; Fri, 29 May 2026 16:01:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070492; 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=j2IQAxe9s+nWBf4WUwMUur9dvTwcPnlGeQVqhHU5UXc=; b=Om0k6ArOezhUcE2ZMZUrg9eMtx6h2rXope9xofh3oyMG+KALt4rJh6fKZJ/x2BMIkP4B+x ocV70Pn7XU3cxBqaESX1bsHGEzyg2H0DOTcB0rU5mRBh4Ca2wUCvBux/TVHO0mW8+oDWAT lUugsxwA6rY184nP4RGhoJzaJWCsJpEBpLj5OjOtBSawjNB1tOLxNAOi2YawVspFmKKsu8 Hpv5POeXsTNHSGtQDpehYuGcmCuscsgxdqbblrSLmeVxkqEZrsQbD7KxjSe02hfdp5gnwf 6zODRZ4jYrSjRoDhox+irq2pMU0ipX6DEJmmfVqXtlojNleSPoHD7KwhuDjC1w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070492; a=rsa-sha256; cv=none; b=oATcDfQRDwCTVahjiU24t6xM+A6eZGQX9PdUU7XUEyuYvLXWDqVLMsp66mvLpTM+b1pGhg hyT/wGpcpY0sNh+SFzMZLsvEfVEAXgtupcj2YtwkHvScOYxAsHZ/bChEJ8pD5xzmKzZVbU 8Vv0b4u9ALV+KyxKacWIlQalyrJ/ehuFtud4V62u/UzcrjkK9B6AgcdxzbXC+9unZ1Vc6d ZDLVPEOMkzG+U5Idqz0GhLJkKNul5+J+/l3wERRrksFfn55TqGDxHU/7KLuEg02CVYf4uF 0gX8KQZoG35iSZfq31VEam5/5m3AWhXnYPaa93A3rs8+xlGObolnlp8crI2kOA== 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=1780070492; 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=j2IQAxe9s+nWBf4WUwMUur9dvTwcPnlGeQVqhHU5UXc=; b=jyemNoyZs9YAYqeOd9HjiOwQVmlRhUsriKJkltyKh6gemeHQRqE8PCQY87+0t991/pvwKp +phn5aHCTnjHdqtvhNh5zc98Hg95HOSmPEl/d7aQGwV7b85pM/bGciBm+xHdRT2W7EPj96 GsmhQnOgVqxCihBXMK4ink1hq3X/rx+5xS4NCqNtlvQJoNZCWMYIbl5VbKwUS2HjW3kZcH FHFqGtgJbc6xN4GPYTqlgSYXbCRqOilEJwl3ywyS94qzZRFvXwzO5mCPyuDBge9voBSsDe kuHYnEendwZjwaLC7ZYyUQRM7R+XVQju/oUSgRfVxb0ZouGIl8SBtCDmp1uAow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4r18BxzgQr for ; Fri, 29 May 2026 16:01:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35df6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 0aef1c059fae - main - MAC/do: Document and assert when parse error objects must be built 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: 0aef1c059fae86a7f62b444dc3352eb0d5bdaa31 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:32 +0000 Message-Id: <6a19b85c.35df6.481edbe9@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=0aef1c059fae86a7f62b444dc3352eb0d5bdaa31 commit 0aef1c059fae86a7f62b444dc3352eb0d5bdaa31 Author: Olivier Certner AuthorDate: 2026-05-19 19:38:41 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:21:16 +0000 MAC/do: Document and assert when parse error objects must be built The invariant is that parse_*() functions must create a parse error object and return it through their 'parse_error' argument if and only if they return an error code (non-zero). Add assertions checking this invariant in various places, and in particular in the new parse_exec_paths(), to be future proof. Change the contract of parse_and_set_conf() so that the caller is required to pass a NULL '*parse_error'. Remove useless resetting of '*parse_error' to NULL. While here, remove a test that is always true thanks to this invariant and that was recently introduced with the "executable paths" feature. No functional change intended. Reviewed by: bapt 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 | 82 +++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 5aacce1b4d09..dc5d3d29d988 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -71,6 +71,11 @@ static const char *id_type_to_str[] = { #define PARSE_ERROR_SIZE 256 +/* + * All functions having a parse error parameter must return through it a parse + * error object if and only if they return an error value (non-zero); else, NULL + * must be returned through it. + */ struct parse_error { size_t pos; char msg[PARSE_ERROR_SIZE]; @@ -776,6 +781,7 @@ parse_target_clause(char *to, struct rule *const rule, check_type_and_finish: check_type_and_type_flags(type, *tflags); finish: + MPASS(error == 0 && *parse_error == NULL); return (0); einval: /* We must have built a parse error on error. */ @@ -853,7 +859,7 @@ pour_list_into_rule(const id_type_t type, struct id_list *const list, make_parse_error(parse_error, 0, "Incompatible flags or duplicate " "GID %u.", id); - return (EINVAL); + goto einval; } check_type_and_id_flags(type, array[ref_idx].flags); @@ -867,7 +873,7 @@ pour_list_into_rule(const id_type_t type, struct id_list *const list, */ make_parse_error(parse_error, 0, "Duplicate UID %u.", id); - return (EINVAL); + goto einval; default: __assert_unreachable(); @@ -876,7 +882,12 @@ pour_list_into_rule(const id_type_t type, struct id_list *const list, *nb = ref_idx + 1; } + MPASS(*parse_error == NULL); return (0); + +einval: + MPASS(*parse_error != NULL); + return (EINVAL); } /* @@ -1002,6 +1013,7 @@ parse_single_rule(char *rule, struct rules *const rules, } STAILQ_INSERT_TAIL(&rules->head, new, r_entries); + MPASS(error == 0 && *parse_error == NULL); return (0); einval: @@ -1019,13 +1031,13 @@ einval: /* * Parse rules specification and produce rule structures out of it. * - * Returns 0 on success, with '*rulesp' made to point to a 'struct rule' - * representing the rules. On error, the returned value is non-zero and - * '*rulesp' is unchanged. If 'string' has length greater or equal to - * MAC_RULE_STRING_LEN, ENAMETOOLONG is returned. If it is not in the expected - * format, EINVAL is returned. If an error is returned, '*parse_error' is set - * to point to a 'struct parse_error' giving an error message for the problem, - * else '*parse_error' is set to NULL. + * Must be called with '*parse_error' set to NULL. Returns 0 on success, with + * '*rulesp' made to point to a 'struct rule' representing the rules. On error, + * the returned value is non-zero and '*rulesp' is unchanged. If 'string' has + * length greater or equal to MAC_RULE_STRING_LEN, ENAMETOOLONG is returned. If + * it is not in the expected format, EINVAL is returned. If an error is + * returned, '*parse_error' is set to point to a 'struct parse_error' giving an + * error message for the problem. * * Expected format: A >-colon-separated list of rules of the form * ">" (for backwards compatibility, a semi-colon ":" is accepted @@ -1050,8 +1062,6 @@ parse_rules(const char *const string, struct rules *const rules, char *copy, *p, *rule; int error = 0; - *parse_error = NULL; - if (len >= MAC_RULE_STRING_LEN) { make_parse_error(parse_error, 0, "Rule specification string is too long (%zu, max %zu)", @@ -1074,15 +1084,22 @@ parse_rules(const char *const string, struct rules *const rules, if (error != 0) { (*parse_error)->pos += rule - copy; toast_rules(rules); - goto out; + goto error; } } + MPASS(error == 0 && *parse_error == NULL); out: free(copy, M_MAC_DO); return (error); +error: + MPASS(error != 0 && *parse_error != NULL); + goto out; } +/* + * Similar constraints as parse_rules() (which see). + */ static int parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, struct parse_error **const parse_error) @@ -1091,8 +1108,6 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, char *copy, *p, *path; int error = 0; - *parse_error = NULL; - if (len >= EXEC_PATHS_MAXLEN) { make_parse_error(parse_error, 0, "Exec path specification string is too long (%zu, max %u)", @@ -1119,7 +1134,7 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, "Too many exec paths specified (max %d)", MAX_EXEC_PATHS); error = EINVAL; - goto out; + goto error; } path_len = strlen(path); @@ -1128,7 +1143,7 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, "Exec paths too long (%zu, max %u)", path_len, PATH_MAX - 1); error = ENAMETOOLONG; - goto out; + goto error; } strlcpy(exec_paths->exec_paths[exec_paths->exec_path_count], @@ -1139,12 +1154,16 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, if (exec_paths->exec_path_count == 0) { make_parse_error(parse_error, 0, "No valid exec paths found"); error = EINVAL; - goto out; + goto error; } + MPASS(error == 0 && *parse_error == NULL); out: free(copy, M_MAC_DO); return (error); +error: + MPASS(error != 0 && *parse_error != NULL); + goto out; } /* @@ -1360,6 +1379,7 @@ clone_exec_paths(struct exec_paths *dst, struct exec_paths *const src) sizeof(dst->exec_paths_str)); } +/* Must be called with '*parse_error' set to NULL. */ static int parse_and_set_conf(struct prison *pr, const char *rules_string, const char *exec_paths_string, struct parse_error **parse_error) @@ -1370,8 +1390,6 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, int error = 0; bool need_applicable_conf; - *parse_error = NULL; - need_applicable_conf = (rules_string == NULL || rules_string[0] == '\0' || exec_paths_string == NULL || exec_paths_string[0] == '\0'); @@ -1386,7 +1404,7 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, if (rules_string != NULL && rules_string[0] != '\0') { error = parse_rules(rules_string, &conf->rules, parse_error); if (error != 0) - goto out; + goto error; } else if (applicable_conf != NULL) clone_rules(&conf->rules, &applicable_conf->rules); @@ -1395,20 +1413,22 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, error = parse_exec_paths(exec_paths_string, &conf->exec_paths, parse_error); if (error != 0) - goto out; + goto error; } else if (applicable_conf != NULL) clone_exec_paths(&conf->exec_paths, &applicable_conf->exec_paths); set_conf(pr, conf); + MPASS(error == 0 && *parse_error == NULL); out: if (applicable_conf != NULL) drop_conf(applicable_conf); - if (error != 0) - drop_conf(conf); - return (error); +error: + MPASS(error != 0 && *parse_error != NULL); + drop_conf(conf); + goto out; } static int @@ -1418,7 +1438,7 @@ mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) struct prison *const td_pr = req->td->td_ucred->cr_prison; struct prison *pr; struct conf *conf; - struct parse_error *parse_error; + struct parse_error *parse_error = NULL; int error; conf = find_conf(td_pr, &pr); @@ -1460,7 +1480,7 @@ mac_do_sysctl_exec_paths(SYSCTL_HANDLER_ARGS) struct prison *const td_pr = req->td->td_ucred->cr_prison; struct prison *pr; struct conf *conf; - struct parse_error *parse_error; + struct parse_error *parse_error = NULL; int error; conf = find_conf(td_pr, &pr); @@ -1725,12 +1745,10 @@ mac_do_jail_set(void *obj, void *data) &parse_error); if (error != 0) { - if (parse_error != NULL) { - vfs_opterror(opts, - "MAC/do: Parse error at index %zu: %s\n", - parse_error->pos, parse_error->msg); - free_parse_error(parse_error); - } + vfs_opterror(opts, + "MAC/do: Parse error at index %zu: %s\n", + parse_error->pos, parse_error->msg); + free_parse_error(parse_error); return (error); } From nobody Fri May 29 16:01:31 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 4gRp4q3QPBz6flPF for ; Fri, 29 May 2026 16:01:31 +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 4gRp4q0xdGz3H6b for ; Fri, 29 May 2026 16:01:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070491; 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=ToBB8BgKXryuBNu+SkvLV63Euw6lXIAKvsC6u5hv8PM=; b=YRBCqyQthSjhLhukSRGZrDhLSyeUZsy6Ik/7So1LZUxct4Kvpgs6e8gsbwdUm2pTg/MDdr Ygk1LkL/nSbDpCLIpqwHVpmesavTGjFRqVFvAp3v0ieLjA7bAGGAgYgb5jvyuMjfE7ENWI LjRNGZ2XOloPiP1EG884ISIxVMufHIhCz3VqjxXJW+UA+wjjyv5qSHlLGDlVcgZ0ElzJMH v4o7KLBKhBklbEMUNLzQkXhF1flhLc/qB7lTjy0a6Sz0Cs1HnHb3gFeV6xFAaYBRiF6E1L ar4N7osNFemGPef6dhihHrFpTcPW2yQH8mvz5dWpJlhJ6I+Z3ve3VEMd/dDXDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070491; a=rsa-sha256; cv=none; b=qk9PtOBrAT3faoC1MkKCvdarq+ycdKpHstR2INept67KFSlgaZZUvu4wfk1sQRdkb7UPlm rSqYVP4cu2d8rehbrYvjdpKf+bCS9Vo1zf+xvOpbhsdHSX4YIj/hbjc6tl30sLPkDoTyZZ ieJYeWwt93AMQVrgvfnn1QU0aDYggaVhU71OQBcMzPyQ2AHu4gLiW0I9rniR+ksUi4SuIp vB+J/TYeHuxI3AD9j4VKdlPSQHbZY30/wV0eKerPTdnyMu1TdLZopoF8lMRSVxetDyA/hu 21znLj35whAq4f5kAdkrA7m/S2NhrSELp6Lst3pKoxT/8lprfGcx+tE0Pha58w== 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=1780070491; 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=ToBB8BgKXryuBNu+SkvLV63Euw6lXIAKvsC6u5hv8PM=; b=i0P2ig4YOrn8MTaGYbNFebPd26/E6/QNPxCKpSdyNWxo3asTW8wdE1owEPrx3m/Ko6b/8j Wqc84wpeXwUFSiOq8PrHpldrs8bwGm8EOx8Uyxq9sdW9JPtMJuM5gQpclzcQHusUGlSOGi Jk9hsc/9+dVB0vfepYMxCv8eQYtW8KJDDASdE/hLLOPw2TbYBLZjupAB/UUNehHc/Ct61P 4mME27GiZapf4vehk5qj2/rCOm0t4vEJ5ONAeCu26pBH7zEAO3pczPQjc0faz1RtK4MI2p nVsjuMne3hyTi6LA8feWx7E8m6RN/braXeMQU3afEIlhAukS3FT8X1+2BeVMng== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4q0KxxzgCH for ; Fri, 29 May 2026 16:01:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35f90 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: d554b89f4096 - main - MAC/do: check_proc(): Remove a superfluous 'if' 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: d554b89f4096589d00abef584552eff0481418db Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:31 +0000 Message-Id: <6a19b85b.35f90.2a7d1a60@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=d554b89f4096589d00abef584552eff0481418db commit d554b89f4096589d00abef584552eff0481418db Author: Olivier Certner AuthorDate: 2026-04-28 13:44:53 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:21:10 +0000 MAC/do: check_proc(): Remove a superfluous 'if' No functional change (intended). Reviewed by: bapt 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 9da7aaa257d5..5aacce1b4d09 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -2303,12 +2303,11 @@ check_proc(void) conf = find_conf(td_pr, &pr); exec_paths = &conf->exec_paths; - if (exec_paths->exec_path_count > 0) - for (int i = 0; i < exec_paths->exec_path_count; i++) - if (strcmp(exec_paths->exec_paths[i], path) == 0) { - error = 0; - break; - } + for (int i = 0; i < exec_paths->exec_path_count; i++) + if (strcmp(exec_paths->exec_paths[i], path) == 0) { + error = 0; + break; + } prison_unlock(pr); From nobody Fri May 29 16:01:33 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 4gRp4s4Dnwz6fl0N for ; Fri, 29 May 2026 16:01:33 +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 4gRp4s2LR2z3H6m for ; Fri, 29 May 2026 16:01:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070493; 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=3EPuKbd7wBR5Y/Kzwv3OrSfpO6Saa3GjndvocnAtWiY=; b=ao9vP+Dtao1QTVLFWEOR/X6M7BxuZazdHU8bCZ1wV0qKjbjk9pIRmEZcHzVyLexnnchVOC xF9d37a+d24R33SQXL2BQ0mjwzKYtFDK5Mtwh6+f4B8dJN6Uxdd+MxrY6ZzCW0LbYIAd+B WKFt5V+mkaQ8Oe43C6hDotdzOEIY8HRhW+rfIlnSXxO9df+qyrlm42IyiIue7RMELaBIKd Os1xyajqabSHXMkYypzHivkvkyUlC9mxXdTvhR51d5g6jE7elH3VNp6/4ts3dVr/9eKTvF 4d5imnN5hRNn3JYCDa6WWflWksQbflF6TtDkyRkGxiAeJcTf2jWrHvSeK9d+SQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070493; a=rsa-sha256; cv=none; b=SOZXPwzScGflwBlv81ijQBM7iGI/brLgu0YPnQZu7E/GQc7IH6uQ8JU2KVd6zSo5JtetGS cSlSVKTNWaIorDcU9Ywo8shZPfHDX10JdsvM4ube4W+4djuSWnm0Bv2SskC+2i6pV9AVC/ t41djtZY18C2QqxS3mw3E3dyZSmdv5P73u1GxZ2IgrXwZzCPEeAuRVotVxlBz6Db9famB3 dfkSuPaOa6UIeh5ycwhmBFITj0Gbg8kIf5eKPxUgSy3f7p7zUoSAZKYLwt+0bT04jxLpUp 76ZGM55Fc7jxslynoVh0Mzr7M1DgLYOlClMwnh97MkCFp8jEwUnUR9TadCBmcg== 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=1780070493; 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=3EPuKbd7wBR5Y/Kzwv3OrSfpO6Saa3GjndvocnAtWiY=; b=m8AiOaD0YOgSnXU7pogoVSHZS9FvDeQ+p+CJpDq/zMzWyxcKcpHu12lJ+JzFPU3z9HLftg tLgx6kwbgWQzdiwbOwXY+9Wn0rcn3R8w8J47UWy896ziuiFYwcHn7P2+o1yeHWgwJPsPIi fIq3BWopWFMazOjx8bmiEper/nyFwgB8BjeYaIba5fmqcMbwjs8PDhu7iN3YYP3AvSGB64 FlR0yqDcfYHFd+fDaS3Az6hIczxQm0+gXrpqXMsAxZ6hgEqFpZEHLP3BbE2GNiUEIufSdG EWwcDukBqld8Kx94ySMDzLPVTmeOiHkhwSg7Y3gk/TZlTNMwvS5Gc01ST04c0w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4s1x01zgms for ; Fri, 29 May 2026 16:01:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36016 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 3a4433425e63 - main - MAC/do: Executable paths: Accept an empty string 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: 3a4433425e63f88e70078a354bd404d7ea6ca3ce Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:33 +0000 Message-Id: <6a19b85d.36016.2de3173d@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=3a4433425e63f88e70078a354bd404d7ea6ca3ce commit 3a4433425e63f88e70078a354bd404d7ea6ca3ce Author: Olivier Certner AuthorDate: 2026-04-28 13:37:50 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:21:22 +0000 MAC/do: Executable paths: Accept an empty string This effectively allows to disable mac_do(4) by setting the executable paths to an empty string, realizing a symmetry with rules to be leveraged in subsequent commits. 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 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index dc5d3d29d988..dd349c3f1a67 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1151,12 +1151,6 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, exec_paths->exec_path_count++; } - if (exec_paths->exec_path_count == 0) { - make_parse_error(parse_error, 0, "No valid exec paths found"); - error = EINVAL; - goto error; - } - MPASS(error == 0 && *parse_error == NULL); out: free(copy, M_MAC_DO); From nobody Fri May 29 16:01:34 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 4gRp4v15P2z6flMp for ; Fri, 29 May 2026 16:01:35 +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 4gRp4t3RWKz3H9L for ; Fri, 29 May 2026 16:01:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070494; 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=vvGuqvhQOmgquyoN8sy6S9GI2Qou2at+bAWm7WGE2Cs=; b=aG2WpqLFhN2DnBwEK3Td0Dy3I2H4MZBINnsW3YAKs2adocEvegg4UzL3zCGCcrR3EiOygC 8lLnIyMtqfKw2YLvDbcTRvDyHF5M5e/BbgFUVzRKMucQtWJH6U+gP8pYtObWzU+R4y/QmY QW+Xy+r2SwMsoyVeBhVj+62a+lyD/AGG9veXOOfCTTAXMZclG6sAkN9KdJbVM1r0HdiDJT BL0WTmg/DhO6J57MD0VexIA4il4U8Hb2xx79WI6gtt5zD8/kS/AfpYHXWOEEhbwQ2OwdJB M9gZdTGIR8T+mJafgVQBipvffQSn7gRJANMHAjMSFW0ekyxSv+ZP3DS6SpVvDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070494; a=rsa-sha256; cv=none; b=qGlxfp5GNfGpPHy9xPVgV3ldXrL0/sFmRhfzVYQDkHBKJ+9ppLsqZDFagv6fkLljglKde9 jddA6z8GZOLvagQolrhA0qu5mlFjqeJVN9eaNEk46LtSdBraRb6S2KL9sYEJFqdTjCLrQb wmCqGAc5WnuUsO8qv0Dmv24d9v/e/i2WWcbJi1MyMNckBhD+m5CSfg1iiJ+GneE63bNL3A ms5uHG4PHsY/orST0XIpz4j3Q+w5WD4IUgMCwIQ56QSUMvVoJ8MZyr9aFjjb5wKJOJY+nd +3N7TCRNc4no2ZE39urHMNJP4rkHvPry09picc3bKuDIt365m3nOrWOpc9/jzg== 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=1780070494; 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=vvGuqvhQOmgquyoN8sy6S9GI2Qou2at+bAWm7WGE2Cs=; b=HBi8kqqatpiRFrJkvRNbEYOxFwAxWXgBAJ4qVfLGDtnTMbylCwQhKLnZZd7o5GfgJrPlVn scnAGWzV5mI25unEyH794Fpa6F90fjBoh6p/CIqdJZaMojmKc0/9Th2ZWMtmTYUnLGg+MI pAfcExEgI/JChgCT4WqCeBbZ5/MXSSAMM4K4U3a0zGECLnDP0OVNZ7/IiILSK9Sln/+zJ0 1OjmBMMMcL0NJAiLt0DPdUubyK98nfqDJipd4O0w5CAnRwFAdpcAzizeCjvmTcPj+0megh KaROE6wls2wxtW3iS0mWE7uhwBTMxKR3D68FiShRmDaMIlt/8ontb1wDGck0kg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4t2kmhzg99 for ; Fri, 29 May 2026 16:01:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35d24 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 28ebab7c3730 - main - MAC/do: Rename size constants/variables to clear confusion with string lengths 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: 28ebab7c3730105f06f982950e9aee4130469906 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:34 +0000 Message-Id: <6a19b85e.35d24.665c0b23@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=28ebab7c3730105f06f982950e9aee4130469906 commit 28ebab7c3730105f06f982950e9aee4130469906 Author: Olivier Certner AuthorDate: 2026-03-23 16:13:37 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:21:44 +0000 MAC/do: Rename size constants/variables to clear confusion with string lengths These constants represent buffer sizes in bytes, not string lengths. While here, move MAX in EXEC_PATHS_MAXLEN at start, like the other constants. While here, fix the prefix of the old MAC_RULE_STRING_LEN accordingly. No functional change. Reviewed by: bapt Fixes: 8aac90f18aef ("mac_do: add a new MAC/do policy and mdo(1) utility") 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 | 68 ++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index dd349c3f1a67..ab6c21b38063 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -47,10 +47,10 @@ SYSCTL_INT(_security_mac_do, OID_AUTO, print_parse_error, CTLFLAG_RWTUN, static MALLOC_DEFINE(M_MAC_DO, "mac_do", "mac_do(4) security module"); -#define EXEC_PATHS_MAXLEN 2048 -#define MAX_EXEC_PATHS 8 +#define MAX_EXEC_PATHS_SIZE 2048 +#define MAX_EXEC_PATHS 8 -#define MAC_RULE_STRING_LEN 1024 +#define MAX_RULE_STRING_SIZE 1024 static unsigned osd_jail_slot; static unsigned osd_thread_slot; @@ -157,7 +157,7 @@ struct id_spec { /* * This limits the number of target clauses per type to 65535. With the current - * value of MAC_RULE_STRING_LEN (1024), this is way more than enough anyway. + * value of MAX_RULE_STRING_SIZE (1024), this is way more than enough anyway. */ typedef uint16_t id_nb_t; /* We only have a few IT_* types. */ @@ -178,12 +178,12 @@ struct rule { STAILQ_HEAD(rulehead, rule); struct rules { - char string[MAC_RULE_STRING_LEN]; + char string[MAX_RULE_STRING_SIZE]; struct rulehead head; }; struct exec_paths { - char exec_paths_str[EXEC_PATHS_MAXLEN]; + char exec_paths_str[MAX_EXEC_PATHS_SIZE]; char exec_paths[MAX_EXEC_PATHS][PATH_MAX]; int exec_path_count; }; @@ -353,14 +353,14 @@ toast_rules(struct rules *const rules) static void init_rules(struct rules *const rules) { - _Static_assert(MAC_RULE_STRING_LEN > 0, "MAC_RULE_STRING_LEN <= 0!"); + _Static_assert(MAX_RULE_STRING_SIZE > 0, "MAX_RULE_STRING_SIZE <= 0!"); STAILQ_INIT(&rules->head); } static void init_exec_paths(struct exec_paths *const exec_paths) { - _Static_assert(EXEC_PATHS_MAXLEN > 0, "EXEC_PATHS_MAXLEN <= 0!"); + _Static_assert(MAX_EXEC_PATHS_SIZE > 0, "MAX_EXEC_PATHS_SIZE <= 0!"); bzero(exec_paths, sizeof(*exec_paths)); exec_paths->exec_paths_str[0] = 0; } @@ -1034,7 +1034,7 @@ einval: * Must be called with '*parse_error' set to NULL. Returns 0 on success, with * '*rulesp' made to point to a 'struct rule' representing the rules. On error, * the returned value is non-zero and '*rulesp' is unchanged. If 'string' has - * length greater or equal to MAC_RULE_STRING_LEN, ENAMETOOLONG is returned. If + * length greater or equal to MAX_RULE_STRING_SIZE, ENAMETOOLONG is returned. If * it is not in the expected format, EINVAL is returned. If an error is * returned, '*parse_error' is set to point to a 'struct parse_error' giving an * error message for the problem. @@ -1062,10 +1062,10 @@ parse_rules(const char *const string, struct rules *const rules, char *copy, *p, *rule; int error = 0; - if (len >= MAC_RULE_STRING_LEN) { + if (len >= MAX_RULE_STRING_SIZE) { make_parse_error(parse_error, 0, "Rule specification string is too long (%zu, max %zu)", - len, MAC_RULE_STRING_LEN - 1); + len, MAX_RULE_STRING_SIZE - 1); return (ENAMETOOLONG); } @@ -1108,10 +1108,10 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, char *copy, *p, *path; int error = 0; - if (len >= EXEC_PATHS_MAXLEN) { + if (len >= MAX_EXEC_PATHS_SIZE) { make_parse_error(parse_error, 0, "Exec path specification string is too long (%zu, max %u)", - len, EXEC_PATHS_MAXLEN - 1); + len, MAX_EXEC_PATHS_SIZE - 1); return (ENAMETOOLONG); } @@ -1315,7 +1315,7 @@ set_default_conf(struct prison *const pr) struct conf *const conf = alloc_conf(); strlcpy(conf->exec_paths.exec_paths_str, "/usr/bin/mdo", - EXEC_PATHS_MAXLEN); + MAX_EXEC_PATHS_SIZE); strlcpy(conf->exec_paths.exec_paths[0], "/usr/bin/mdo", PATH_MAX); conf->exec_paths.exec_path_count = 1; @@ -1428,7 +1428,7 @@ error: static int mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) { - char *const buf = malloc(MAC_RULE_STRING_LEN, M_MAC_DO, M_WAITOK); + char *const buf = malloc(MAX_RULE_STRING_SIZE, M_MAC_DO, M_WAITOK); struct prison *const td_pr = req->td->td_ucred->cr_prison; struct prison *pr; struct conf *conf; @@ -1436,10 +1436,10 @@ mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) int error; conf = find_conf(td_pr, &pr); - strlcpy(buf, conf->rules.string, MAC_RULE_STRING_LEN); + strlcpy(buf, conf->rules.string, MAX_RULE_STRING_SIZE); prison_unlock(pr); - error = sysctl_handle_string(oidp, buf, MAC_RULE_STRING_LEN, req); + error = sysctl_handle_string(oidp, buf, MAX_RULE_STRING_SIZE, req); if (error != 0 || req->newptr == NULL) goto out; @@ -1464,13 +1464,13 @@ SYSCTL_PROC(_security_mac_do, OID_AUTO, rules, SYSCTL_JAIL_PARAM_SYS_SUBNODE(mac, do, CTLFLAG_RW, "Jail MAC/do parameters"); -SYSCTL_JAIL_PARAM_STRING(_mac_do, rules, CTLFLAG_RW, MAC_RULE_STRING_LEN, +SYSCTL_JAIL_PARAM_STRING(_mac_do, rules, CTLFLAG_RW, MAX_RULE_STRING_SIZE, "Jail MAC/do rules"); static int mac_do_sysctl_exec_paths(SYSCTL_HANDLER_ARGS) { - char *const buf = malloc(EXEC_PATHS_MAXLEN, M_MAC_DO, M_WAITOK); + char *const buf = malloc(MAX_EXEC_PATHS_SIZE, M_MAC_DO, M_WAITOK); struct prison *const td_pr = req->td->td_ucred->cr_prison; struct prison *pr; struct conf *conf; @@ -1478,10 +1478,10 @@ mac_do_sysctl_exec_paths(SYSCTL_HANDLER_ARGS) int error; conf = find_conf(td_pr, &pr); - strlcpy(buf, conf->exec_paths.exec_paths_str, EXEC_PATHS_MAXLEN); + strlcpy(buf, conf->exec_paths.exec_paths_str, MAX_EXEC_PATHS_SIZE); prison_unlock(pr); - error = sysctl_handle_string(oidp, buf, EXEC_PATHS_MAXLEN, req); + error = sysctl_handle_string(oidp, buf, MAX_EXEC_PATHS_SIZE, req); if (error != 0 || req->newptr == NULL) goto out; @@ -1503,7 +1503,7 @@ SYSCTL_PROC(_security_mac_do, OID_AUTO, exec_paths, 0, 0, mac_do_sysctl_exec_paths, "A", "Colon-separated list of allowed executables"); -SYSCTL_JAIL_PARAM_STRING(_mac_do, exec_paths, CTLFLAG_RW, EXEC_PATHS_MAXLEN, +SYSCTL_JAIL_PARAM_STRING(_mac_do, exec_paths, CTLFLAG_RW, MAX_EXEC_PATHS_SIZE, "Jail MAC/do executable paths"); static int @@ -1568,7 +1568,7 @@ mac_do_jail_check(void *obj, void *data) { struct vfsoptlist *opts = data; char *rules_string, *exec_paths_string; - int error, jsys, rules_len = 0, exec_paths_len = 0; + int error, jsys, rules_size = 0, exec_paths_size = 0; bool has_rules, has_exec_paths; error = vfs_copyopt(opts, "mac.do", &jsys, sizeof(jsys)); @@ -1587,26 +1587,26 @@ mac_do_jail_check(void *obj, void *data) } /* - * 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). + * We use vfs_getopt() below instead of vfs_getopts() to get the + * string's buffer size. 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); + &rules_size); if (error == ENOENT) rules_string = NULL; else { if (error != 0) return (error); - if (rules_len == 0 || rules_string[rules_len - 1] != '\0') { + if (rules_size == 0 || rules_string[rules_size - 1] != '\0') { vfs_opterror(opts, "'mac.do.rules' not a proper string"); return (EINVAL); } - if (rules_len > MAC_RULE_STRING_LEN) { + if (rules_size > MAX_RULE_STRING_SIZE) { vfs_opterror(opts, "'mac.do.rules' too long"); return (ENAMETOOLONG); } @@ -1614,19 +1614,19 @@ mac_do_jail_check(void *obj, void *data) /* Executable paths. */ error = vfs_getopt(opts, "mac.do.exec_paths", - (void **)&exec_paths_string, &exec_paths_len); + (void **)&exec_paths_string, &exec_paths_size); if (error == ENOENT) exec_paths_string = NULL; else { if (error != 0) return (error); - if (exec_paths_len == 0 || - exec_paths_string[exec_paths_len - 1] != '\0') { + if (exec_paths_size == 0 || + exec_paths_string[exec_paths_size - 1] != '\0') { vfs_opterror(opts, "'mac.do.exec_paths' not a proper string"); return (EINVAL); } - if (exec_paths_len > EXEC_PATHS_MAXLEN) { + if (exec_paths_size > MAX_EXEC_PATHS_SIZE) { vfs_opterror(opts, "'mac.do.exec_paths' too long"); return (ENAMETOOLONG); } From nobody Fri May 29 16:01:35 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 4gRp4w0mjCz6flV4 for ; Fri, 29 May 2026 16:01: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gRp4v40Vtz3HP2 for ; Fri, 29 May 2026 16:01:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070495; 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=BdzfrOuC0h1KEOGJx75uOjhe2ykcdvnInCq1Jjj1KKs=; b=dLXEg44+p31nMzPR40NIcXM+wH682tKBbue9xpNajju+FijF0h3GmtneWNgm71bTiNqVia TYXLWWi5GDMtoCXeuJvEOL4FlXtnTUjvblLyMKMC5nM9AlX/0xgB6N8hY1KjkjuPcPzLoe 6D4RHmbbMdTV4cwhKKl4mEd+/QTE5lQEyoJ01h4CjY+ivvq2XOHnm1GZP2wmIbhrVie+VS +wgeRDMk74w6b08bbB9rnAbNfkXyHnMliR5B/ktTqukHSE9W1sqgeKiS+/QPUzeG0uCizq gZLtbCrWRUNguva9A7wcvxenZs5QjUvXKqTs/+eTpocq2RDUeXgKOmAMaY3yUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070495; a=rsa-sha256; cv=none; b=DANhVy2n5ULe9DWbAXL2vJ2biFc+zNkKoavfI6oZePcOIpfjVaYxJSv/01QYPfbpD0y0BY DkAJZvGPsvPc3mY1im2cReJPoL15yiWFwgspjgSupHpR1eliN9W2rQ/7qXo2QIpn4DJRa7 2aCd9topIX4kyIky8EJMhFEG0zLfdBaWkMYZG/tFNrFCKfK7Ii4Gec/oQMQhrqMADZsBDd AJLbJIM8CMCjInJZP8aoauu8YRP68mMwdan7tGaD796T92TbGvGPHCox7zjkrF/91c2xiC teIkq/gk3G8hBdg3dhYRI0xAvJU5G3EkYrAC4Odz0Y+g31H8EoPMthRCX79w5g== 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=1780070495; 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=BdzfrOuC0h1KEOGJx75uOjhe2ykcdvnInCq1Jjj1KKs=; b=aZG2X6ljh9u+UEhDpFtzqH+js/V1USL3crmLGv/6fmznaoz9a+PH7gHRss8kODvyWFRxXD wepUMRkisPfWQegBr09R5lA8PvSyaFurwZhXqA5HQfvAZ7OntXWLcoW+MJ/vTeXCUNCXhw G4bqvJHZpAo4f0ex2sRb4qaGelsgPgbLX7mGqzbW3JJEGLi9JqVkJQf2s75njQZBPuWtzg 5FLo3IxLLHRWQIiQKqKb1PPCPm/7Xeh9pHXfpPcOUL76yuVto8jJ5uGJF8LY4q/Gv0iBeu 0qHlzb+DTeoLaMkfJb0Y6ezE+I+yydwoh/L5ebsTc8b4q0SJo2KVR9ZUoVojKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4v3c6tzg9B for ; Fri, 29 May 2026 16:01:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 346b4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: cf942ac9e967 - main - MAC/do: find_conf(): Turn an MPASS() into a KASSERT() 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: cf942ac9e967055286a7076bf76e9a62e1d22d8f Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:35 +0000 Message-Id: <6a19b85f.346b4.2d2a568@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=cf942ac9e967055286a7076bf76e9a62e1d22d8f commit cf942ac9e967055286a7076bf76e9a62e1d22d8f Author: Olivier Certner AuthorDate: 2026-04-27 12:16:46 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:21:55 +0000 MAC/do: find_conf(): Turn an MPASS() into a KASSERT() Turn the pre-existing comment into an assertion message, with an update following the introduction of the "executable paths" feature. Explain in a comment why this situation cannot happen. Without INVARIANTS, such a situation would cause an immediate panic() (NULL is dereferenced in the next iteration of the loop), so leave the check under INVARIANTS only. Reviewed by: bapt 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index ab6c21b38063..3d0ce2b49baa 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1184,7 +1184,15 @@ find_conf(struct prison *const pr, struct prison **const aprp) prison_unlock(cpr); ppr = cpr->pr_parent; - MPASS(ppr != NULL); /* prison0 always has rules. */ + /* + * 'prison0' normally always have a mac_do(4) configuration + * because we installed one on module load/activation and + * nothing can destroy it as 'prison0' is not a regular jail and + * the 'mac.do' parameter cannot be set to 'inherit' on it, + * which is the only way to clear an existing configuration. + */ + KASSERT(ppr != NULL, + ("MAC/do: 'prison0' must always have a configuration.")); cpr = ppr; } From nobody Fri May 29 16:01:36 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 4gRp4x1hRJz6flF3 for ; Fri, 29 May 2026 16:01:37 +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 4gRp4w56gbz3HTt for ; Fri, 29 May 2026 16:01:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070496; 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=QjUCqDLr2bG6q3GqBtkL4/0s6O8RtdT7aDxuryyPqIc=; b=ATJY23Gc/biYO6eiDFcmskKxdoRLQtwZz5PhEZpKSlbmM/lmgH1cWEaNNVYktA7kdhcqko cS7/4XrILm3Hq3xsjI7NP/XHucYqJU9EmFB7jf4hMf/DhCa0Cb6IAuM1JVt7+IjSU8sFCV z0sqz/bc4iJlQxZA07t6qyCa189+GzRjAlo6if3fStFct/r0Olz7bezYUQDE0h+rqKPr05 PYoltxFgxFwyk5zt70r+E9X2/7i65fUqhhe47jxUwkCWpQpf0P0FLYy435TkhsgXn4fSYl R54J82Q2BwxskhkhsuDfmhm7tM0vho+d/s9nzGGYyGmAmCBIW6CKZhJLx17kdQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070496; a=rsa-sha256; cv=none; b=ZWDUkahA7yhYyRpQl9IWrDD7AMSLth99DSkNc8pJOBSTCHufP/QUHbFGkjV7WkN84JOBCF 6TJENl/DyUt1BVOjx6aaoR0DPpHf0sgcVVw80coyEjmUwqeGPodISOE0IzkRLumJNVzIMs tZtdTsP7ub5J+tNYUb37w+RARvU8cpiqCxeJn9Z3WrI9YJ+21IPM4zf6V8FecoCOWxTaY3 7EwuQ3ukNSM90whSlRR+w4zh0a5d6p4SwwrN9u+5DEWvKcx4U2uP0OTxfdobqsBlvrqrt5 v51oneLTLIp/mComP0TSZNkordr7tuXD2/osFUUkO3wkYOfTP/twelKA7ap8kA== 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=1780070496; 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=QjUCqDLr2bG6q3GqBtkL4/0s6O8RtdT7aDxuryyPqIc=; b=wUk93CZ3me2NW4VpYE0PVUJ/UCPzIi8uE4M5mQ9SxB4rzp/MsMvAacvQpLf2R/VUAj1Aik yXDhmJEPrdFxUKYoAsZALpduX3a0lTmuHIhQva34TGZ9zEN7wuzhVc7mUrlgsIps26Qmhv CFJldPgoV2rmJAL7Cb7qEG7GkFWK4GJgIo0rJJhXUz8XLVDYQGKuV8Lqz565wSRlcnflsg /PFyb6VuvjkgkloKibmkkZ2kANWZ7+tn7G+ju8qIKIkQ2UXCxLLPcHWoMVaomnxd/DyVy/ 0uYpW/5SV09y+bFQELhNBAEXdPoDGdPqz2CYeLfWFdAp0sSwfHqt25bk2QERFw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4w4YrWzg6W for ; Fri, 29 May 2026 16:01:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 367a2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: cd1ac0440935 - main - MAC/do: Move hold_conf() and drop_conf() earlier 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: cd1ac04409359ec1357e23752f20b22f5055ddfa Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:36 +0000 Message-Id: <6a19b860.367a2.539585dc@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=cd1ac04409359ec1357e23752f20b22f5055ddfa commit cd1ac04409359ec1357e23752f20b22f5055ddfa Author: Olivier Certner AuthorDate: 2026-04-27 12:55:05 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:22:01 +0000 MAC/do: Move hold_conf() and drop_conf() earlier This is in preparation for using hold_conf() in find_conf(). Reviewed by: bapt 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 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 3d0ce2b49baa..cb351cef15ce 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1160,6 +1160,21 @@ error: goto out; } +static void +hold_conf(struct conf *const conf) +{ + refcount_acquire(&conf->use_count); +} + +static void +drop_conf(struct conf *const conf) +{ + if (refcount_release(&conf->use_count)) { + toast_rules(&conf->rules); + free(conf, M_MAC_DO); + } +} + /* * Find configuration applicable to the passed prison. * @@ -1200,21 +1215,6 @@ find_conf(struct prison *const pr, struct prison **const aprp) return (conf); } -static void -hold_conf(struct conf *const conf) -{ - refcount_acquire(&conf->use_count); -} - -static void -drop_conf(struct conf *const conf) -{ - if (refcount_release(&conf->use_count)) { - toast_rules(&conf->rules); - free(conf, M_MAC_DO); - } -} - #ifdef INVARIANTS static void check_conf_use_count(const struct conf *const conf, u_int expected) From nobody Fri May 29 16:01:37 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 4gRp4y2wGMz6flS5 for ; Fri, 29 May 2026 16:01:38 +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 4gRp4x6F7yz3Hd8 for ; Fri, 29 May 2026 16:01:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070497; 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=bKqAWvH+FBHFg8Q7AkA35xHLXEKaDPr0cMRnKk9DbWw=; b=YdoexmHeSGfJ6RJh+grxN00kYEeOB9r9mmme26b80/z69wvTxWijGvgaZB9SS1LaHgijqz efasnaQLY17gq6Om5j5N9nxlbx8h0rEViJhn+MmbkC0OZxor3OTAGwJkZMHqHwiC7Dsw5/ mHj0W6aiPLb7Zqak8fyGfvrXSFuFjuZLlBEtBzlk2d7R2gqgp0anl60stuQ2B2U/+o1znM 3aZiY6u/gw2q1MqVzI7aYGe4ziPVXDheQtbopqiPBAiwjD72C4Ik3xjS2qNTmGL2hscyEb qHDQ0o5mjfc3KG7VV0/htl5OHOP5eHYvEYr5VhMvj6/9pqypYtOLD/TF2lAnEA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070497; a=rsa-sha256; cv=none; b=BlFn1KE6n6YyUsH4ixAGebW8pVvllXHTAdxGtIp40CrWLVh3v7DKqRkQOAFZJWpEIsOgLt C1AcjC5w8zgIynbZCPZd7N5dRYzacsss8eGUjye2jMEBziFxKQs7rN9OuEv9HWw4X4Iky3 sqLF4VhSXK6S1jrMQgIiEvAjqqu4Z00u4Xd4poktiQK3l5hnT3fQ8u4uQi3P3ZINStwXCS kW0JMYW5ivh1f1dSYLOpjH/I4z1XEIMensN8bDbk+YtWyPiaLGQuOrj/7cvb4xeTh/ia4V EGBJoN3vC9jeSQwoC3vMTr+MDWJ8iyz/vqbQ1+PdgSZujAr4l7L7qxZG0Qlgeg== 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=1780070497; 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=bKqAWvH+FBHFg8Q7AkA35xHLXEKaDPr0cMRnKk9DbWw=; b=FvPebxKrj5Y/9NnmbGaao+PZx3SUrlAy3Wry4TVBYc6FXD79j+ZfBHpaqJyRdqCOi3jx/y /mGJ6rXeTBky9geKbrRCOfUOrvE+93cOm2BMycefR4cHZipjKk3FvmIJp5Z2jQT4behEKU XTcqTO5QHv/vyYa0l0Q5bwtzzdKSgiU3SVS8gbLjE+kQ4AymTh1YJ9uUnJELpYAkdug2l8 /rGqnJcX4Kp7ff3nDD6gusYY/sXXwS1Bbj5FyO3sRlgNVDTYMUrRHFm2AptIGGcoDjS4/J tduQcj7k33JwSEY1IylMWxgcbKjbR0h38pEEnUR1CSqaNbs+tj1y2wD9TbbLqw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4x5NvgzgpN for ; Fri, 29 May 2026 16:01:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36524 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:37 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 4e4cf18b85cc - main - MAC/do: find_conf(): Return configuration with a true reference 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: 4e4cf18b85cc51f41bcae20114f9c0e7b69f76e0 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:37 +0000 Message-Id: <6a19b861.36524.14a4bcac@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=4e4cf18b85cc51f41bcae20114f9c0e7b69f76e0 commit 4e4cf18b85cc51f41bcae20114f9c0e7b69f76e0 Author: Olivier Certner AuthorDate: 2026-04-27 14:39:15 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:22:09 +0000 MAC/do: find_conf(): Return configuration with a true reference In addition to the applicable configuration, find_conf() was returning a pointer to the actual jail holding the configuration object, with that jail's mutex locked in order to ensure liveness of the returned configuration (if we wouldn't, a concurrent thread modifying the jail's configuration could destroy this configuration object underneath us). But: 1. Ensuring configuration stability by owning the holding jail's mutex requires callers to either keep that mutex locked for a longer period of time than just accessing the corresponding 'struct prison' (in general, bad for concurrency with other operations involving jails) or to perform an additional dance to acquire a real reference in case the jail's mutex, for some reason (in general, LORs or acquiring a sleepable lock) must be dropped before use. 2. Most code does not actually need to know which jail holds the applicable configuration but for unlocking the jail's mutex. Having to deal with the jail holding the configuration can cause confusion about which jail (the current one, or the one holding the configuration) must be used (and actually did in the very initial version of MAC/do, which had a serious flaw as a consequence). So, do not keep a lock on the holding jail. Instead, ensure configuration stability by always acquiring a true reference from the start and passing it to the caller. Those callers not doing the dance mentioned above now need to free it when finished (but this need replaces the one to unlock the prison). Additionally, only return the holding jail if explicitly requested by the caller. mac_do_jail_get() is currently the only caller that needs it, in order to be able to reliably report if the configuration is inherited. Reviewed by: bapt 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 | 83 +++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 43 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index cb351cef15ce..a2259ed777ae 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1178,14 +1178,19 @@ drop_conf(struct conf *const conf) /* * Find configuration applicable to the passed prison. * - * 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. + * Returns the applicable configuration (which always exists), with an + * additional reference that must be freed by the caller. 'pr' must not be + * locked. + * + * The applicable configuration is that of the closest ancestor prison + * (including itself) of the passed prison that actually has a 'struct conf' + * associated to it. + * + * If 'hpr' is not NULL, it is used to return a pointer to the (unlocked) prison + * holding the applicable configuration. */ static struct conf * -find_conf(struct prison *const pr, struct prison **const aprp) +find_conf(struct prison *const pr, struct prison **const hpr) { struct prison *cpr, *ppr; struct conf *conf; @@ -1211,7 +1216,11 @@ find_conf(struct prison *const pr, struct prison **const aprp) cpr = ppr; } - *aprp = cpr; + hold_conf(conf); + prison_unlock(cpr); + + if (hpr != NULL) + *hpr = cpr; return (conf); } @@ -1386,7 +1395,6 @@ static int parse_and_set_conf(struct prison *pr, const char *rules_string, const char *exec_paths_string, struct parse_error **parse_error) { - struct prison *ppr = NULL; struct conf *applicable_conf = NULL; struct conf *conf; int error = 0; @@ -1395,11 +1403,8 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, need_applicable_conf = (rules_string == NULL || rules_string[0] == '\0' || exec_paths_string == NULL || exec_paths_string[0] == '\0'); - if (need_applicable_conf) { - applicable_conf = find_conf(pr, &ppr); - hold_conf(applicable_conf); - prison_unlock(ppr); - } + if (need_applicable_conf) + applicable_conf = find_conf(pr, NULL); conf = alloc_conf(); @@ -1437,22 +1442,20 @@ static int mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) { char *const buf = malloc(MAX_RULE_STRING_SIZE, M_MAC_DO, M_WAITOK); - struct prison *const td_pr = req->td->td_ucred->cr_prison; - struct prison *pr; + struct prison *const pr = req->td->td_ucred->cr_prison; struct conf *conf; struct parse_error *parse_error = NULL; int error; - conf = find_conf(td_pr, &pr); + conf = find_conf(pr, NULL); strlcpy(buf, conf->rules.string, MAX_RULE_STRING_SIZE); - prison_unlock(pr); error = sysctl_handle_string(oidp, buf, MAX_RULE_STRING_SIZE, req); if (error != 0 || req->newptr == NULL) goto out; /* Set our prison's rules, not that of the jail we inherited from. */ - error = parse_and_set_conf(td_pr, buf, NULL, &parse_error); + error = parse_and_set_conf(pr, buf, NULL, &parse_error); if (error != 0) { if (print_parse_error) printf("MAC/do: Parse error at index %zu: %s\n", @@ -1461,6 +1464,7 @@ mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) } out: + drop_conf(conf); free(buf, M_MAC_DO); return (error); } @@ -1479,21 +1483,19 @@ static int mac_do_sysctl_exec_paths(SYSCTL_HANDLER_ARGS) { char *const buf = malloc(MAX_EXEC_PATHS_SIZE, M_MAC_DO, M_WAITOK); - struct prison *const td_pr = req->td->td_ucred->cr_prison; - struct prison *pr; + struct prison *const pr = req->td->td_ucred->cr_prison; struct conf *conf; struct parse_error *parse_error = NULL; int error; - conf = find_conf(td_pr, &pr); + conf = find_conf(pr, NULL); strlcpy(buf, conf->exec_paths.exec_paths_str, MAX_EXEC_PATHS_SIZE); - prison_unlock(pr); error = sysctl_handle_string(oidp, buf, MAX_EXEC_PATHS_SIZE, req); if (error != 0 || req->newptr == NULL) goto out; - error = parse_and_set_conf(td_pr, NULL, buf, &parse_error); + error = parse_and_set_conf(pr, NULL, buf, &parse_error); if (error != 0) { if (print_parse_error) printf("MAC/do: Parse error at index %zu: %s\n", @@ -1502,6 +1504,7 @@ mac_do_sysctl_exec_paths(SYSCTL_HANDLER_ARGS) } out: + drop_conf(conf); free(buf, M_MAC_DO); return (error); } @@ -1527,20 +1530,19 @@ mac_do_jail_create(void *obj, void *data) static int mac_do_jail_get(void *obj, void *data) { - struct prison *ppr, *const pr = obj; + struct prison *const pr = obj; struct vfsoptlist *const opts = data; - struct conf *conf; - struct rules *rules; - struct exec_paths *exec_paths; + struct prison *hpr_out; + struct conf *const applicable_conf = find_conf(pr, &hpr_out); + const struct prison *const hpr = hpr_out; + const struct rules *const rules = &applicable_conf->rules; + const struct exec_paths *const exec_paths = &applicable_conf->exec_paths; int jsys, error; - conf = find_conf(pr, &ppr); - rules = &conf->rules; - exec_paths = &conf->exec_paths; - - jsys = pr == ppr ? + jsys = hpr == pr ? (STAILQ_EMPTY(&rules->head) ? JAIL_SYS_DISABLE : JAIL_SYS_NEW) : JAIL_SYS_INHERIT; + error = vfs_setopt(opts, "mac.do", &jsys, sizeof(jsys)); if (error != 0 && error != ENOENT) goto done; @@ -1556,7 +1558,7 @@ mac_do_jail_get(void *obj, void *data) error = 0; done: - prison_unlock(ppr); + drop_conf(applicable_conf); return (error); } @@ -2290,11 +2292,10 @@ mac_do_priv_grant(struct ucred *cred, int priv) static int check_proc(void) { + struct prison *const pr = curproc->p_ucred->cr_prison; char *path, *to_free; struct conf *conf; struct exec_paths *exec_paths; - struct prison *td_pr; - struct prison *pr; int error; /* @@ -2319,8 +2320,7 @@ check_proc(void) return (EPERM); error = EPERM; - td_pr = curproc->p_ucred->cr_prison; - conf = find_conf(td_pr, &pr); + conf = find_conf(pr, NULL); exec_paths = &conf->exec_paths; for (int i = 0; i < exec_paths->exec_path_count; i++) @@ -2329,8 +2329,7 @@ check_proc(void) break; } - prison_unlock(pr); - + drop_conf(conf); free(to_free, M_TEMP); return (error); } @@ -2338,7 +2337,7 @@ check_proc(void) static void mac_do_setcred_enter(void) { - struct prison *pr; + struct prison *const pr = curproc->p_ucred->cr_prison; struct mac_do_setcred_data * data; struct conf *conf; int error; @@ -2362,9 +2361,7 @@ mac_do_setcred_enter(void) /* * Find the currently applicable rules. */ - conf = find_conf(curproc->p_ucred->cr_prison, &pr); - hold_conf(conf); - prison_unlock(pr); + conf = find_conf(pr, NULL); /* * Setup thread data to be used by other hooks. From nobody Fri May 29 16:01:39 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 4gRp503pNLz6flN8 for ; Fri, 29 May 2026 16:01:40 +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 4gRp500RvMz3HdP for ; Fri, 29 May 2026 16:01:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070500; 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=CKKRAzQlnHhjfS4JhY5p7i6tAGnj+C0vppgH5Ig6zXc=; b=yFMm81EdIyz/468JSpusLNi2pFTvVyM73O6vp2d0D1OD6wgkH4Y9X1G50wpaERRuNUDWW4 O49zjS8n6WqOTy/JkE/RLwjICnRyDj463qQD63g+6o17UFloUq7vxa+3NmDFWvQVGwjoXz a3cc23CyaOeHeNV5wdizJK9tXB0jg2IFwXDG3Xay7VyPrsI+cdmYfYuzU6FKXzLJhxRohZ EkctDPrXwgT1Pm8z+8UTGjruVrNQhJjsIEb2mVBYvz2T8AlcvOJohZm0SvkiqL1cYs1Em6 GlHu3Uct0cTsKDebdQqM961r3LR7q6UuZWaDdOE2559E08EA3OwS8H4Nzp+cWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070500; a=rsa-sha256; cv=none; b=aR69ntAS3wkb0BiY3XEUFwziU/xm8IKyfyhBCgzghUjaHuiNK4iJ7Ke9w3hzcke1hIIvBE 3zXWb1CWzITU9UPQQNlCe3yKiOCfo6o/H4AjD2DmrpoG0n4kDv2YaqfwR1OfQYwuwQ10kU aG+Kz5xqz3aRSPFGdm54YRSqEzs/AJbxmgfsQ+EhgG1JReCN+8rskln/fIu/I4jg9EUrMr L/S23DB8j9KuEVtkfmZhagtT3Ekrb9qfGzg17ap4Epmthf8IXObC1a4BYBjfYxxUB6H54l 0il2rHJyWQWJXMogUEpo5ztHetKCGARWJLhgNrYMVzXBQbIFLXlqtqZynRbJGQ== 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=1780070500; 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=CKKRAzQlnHhjfS4JhY5p7i6tAGnj+C0vppgH5Ig6zXc=; b=OHmjaHOSO+AZJNvsoDAK4wf6yDvvLeRu3tv95Pnr3Pc++ebYqpLIXSDnG3HHzg3GojxsPp K+e/SpQsnMaHwWia0nfOjf7sjmLOEM0UsiGBM23x8aoimf3iuo93gCfvzx/7JIgYnLUgpu xig03O6GF3L4fIACmbdEQ3ZbfIZvv2H9lksgfZ8/IOuXKt0Obn4hzloC/TkCo3e183LE9C 2PYOW+c/GWTe53xvPC1LthlpwbqxNvbbpW48LxDf8RPaVdDe8/WK0covy7AW8IrA22TjCd MHc2nvaIWTJrKOGiNt+rtJ14tRKLK5KtLAHi4MVej7Fk4VpAoKZZ+7VTDsQf7w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4z74d9zg6Y for ; Fri, 29 May 2026 16:01:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3601e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 68cc6aa2e93a - main - MAC/do: Constify clone_rules() and clone_exec_paths()'s source argument 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: 68cc6aa2e93a2a2969eb40b5588452eeb1805fa6 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:39 +0000 Message-Id: <6a19b863.3601e.6c6fad73@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=68cc6aa2e93a2a2969eb40b5588452eeb1805fa6 commit 68cc6aa2e93a2a2969eb40b5588452eeb1805fa6 Author: Olivier Certner AuthorDate: 2026-04-27 16:24:01 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:22:32 +0000 MAC/do: Constify clone_rules() and clone_exec_paths()'s source argument Defensive programming. Reviewed by: bapt 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 58abf1a8f608..7a08cdd5425f 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1350,7 +1350,7 @@ set_default_conf(struct prison *const pr) */ static void -clone_rules(struct rules *dst, struct rules *const src) +clone_rules(struct rules *const dst, const struct rules *const src) { struct rule *src_rule, *dst_rule; @@ -1382,7 +1382,8 @@ clone_rules(struct rules *dst, struct rules *const src) } static void -clone_exec_paths(struct exec_paths *dst, struct exec_paths *const src) +clone_exec_paths(struct exec_paths *const dst, + const struct exec_paths *const src) { bzero(dst, sizeof(*dst)); dst->exec_path_count = src->exec_path_count; From nobody Fri May 29 16:01:38 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 4gRp4z1lX1z6flVG for ; Fri, 29 May 2026 16:01: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 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 4gRp4y6cyXz3HdH for ; Fri, 29 May 2026 16:01:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070498; 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=kFcb9ZEc3mjBdzo3YHx2YQvrAIosGUc0ssCmoUOw6AM=; b=gMJAH0f5eTBTjlQ949PeRe+1jA0gqiBmeto6nM0KiIOE8/S3RjP+/KmEmQbnQEJ1+nx5QV At3t08QZhZfjqk08jAE3n6VNrQ+QVoWCBTNu5c7BzACVMrfXZZMLDrI7i1x3vIXl2CyDF0 ADsx9OweMAePYviMaDzsMIRzojkSAfck3M5J9whFuWqbiOAO4P8cQokC0bu2MOeNjoL8Nz ay0zN8XYOH+DZ6TtzHPollOs/rf1T3Nda5eCh9IBIxxEM0qqtXRLgyWLRjbAcQoE3655gB 06qYqV22dtdNKoANqICrBnOulP0t0QgBH9l5dXMDQxEoXgTgNicBbhvw6G1ccg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070498; a=rsa-sha256; cv=none; b=QxV3G40iLVXtoDVMvK/qqmTjChgXaWdvBhhMnUL8C4PJJuBR8V37DKJ3Y48bcH7MWk7RES R40tdp1xAyTCguYLHP6La2pGoNg5XgkL9roeeJ9uf+M5880LCGAKXDoeuJEoyATgvjB4GY 6/Bt/tLzM/eoNfYK8g8z09eExYAtPlxDxzn3wqxB7+bfFt7S+RvN94nUnzW3GEIwDcMr/2 j6YXdEgJ9Ij0RnXnXIGicNiRfELw5B3JN4VNljVxI4fbtvfK0gJL/gwphaReEYc7vkdg8a 8dW/NqsvVov9w/bbNHZYLYi1DNh84a/6RH0QbjPf2NjkCnXH3XB7DdVohsvU1g== 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=1780070498; 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=kFcb9ZEc3mjBdzo3YHx2YQvrAIosGUc0ssCmoUOw6AM=; b=gCd8rdecYYoGjxBnAntAlb81bt5HJlmcqG3vLnPC/9TlDIx0Fv+GlzEmIkEPBGSYtK+cWn GvMkbu5B7CwvHfQJXWp5rEcyUhwDwGjZ8PG0PGADIy4cw/5iNbn43LksuSoIewqmN7rWyH BOhmozRolnergOYsoiXdnA7WQKwZcy2xtGnX6Xi+kRtMpPEQQi6JWOXDQe007Q0fUT7LuR GhpQPLMTPDZXW0L5PADBWKeajgbMXgeWaEi3BakXpewZVaE1jX99yEJ9dHmyorGWOMfBtI 2iNhOxWDRlV8mMATFWKAmV2hqdZesSUisc6TSHb50ISYx7WVy6DtiMa3bCXaiw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp4y6Dt2zg6X for ; Fri, 29 May 2026 16:01:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3601a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: a7a9e6cc64aa - main - MAC/do: Fix releasing a nonexistent reference on configuration parsing error 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: a7a9e6cc64aa90a899aad9ea1395bfc77bb26f48 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:38 +0000 Message-Id: <6a19b862.3601a.7ce95a22@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=a7a9e6cc64aa90a899aad9ea1395bfc77bb26f48 commit a7a9e6cc64aa90a899aad9ea1395bfc77bb26f48 Author: Olivier Certner AuthorDate: 2026-04-28 08:42:01 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:22:21 +0000 MAC/do: Fix releasing a nonexistent reference on configuration parsing error On parsing error, parse_and_set_conf(), introduced with the recent "executable paths" feature, has been calling drop_conf() on the being-built configuration. However, that configuration structure is allocated through alloc_conf(), which does not grab a reference. Calling drop_conf() on it, which releases a reference, is thus erroneous, and causes the underlying counter to saturate, translating into a memory leak. To fix this bug, make alloc_conf() grab a reference on the newly-created 'struct conf', and rename it to new_conf() to be more in line with what it does. Keep set_conf() as is, i.e., grabbing an additional reference on behalf of the jail that is going to hold the configuration. Consequently, make sure that callers of alloc_conf() unconditionally drop the reference acquired by the latter before returning (i.e., even if set_conf() has been called). While here, since hold_conf() is always used to obtain additional references on a configuration (new_conf() does not use it, instead directly setting the use count), add an assertion that it is never used on a configuration that has no references at all (which indicates that the configuration has been destroyed). These changes generally simplify the lifecycle of configurations, reducing the probability of re-introducing reference mismatches (at the expense of slightly more reference counting operations, but performance does not matter here). 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 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index a2259ed777ae..58abf1a8f608 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -366,14 +366,14 @@ init_exec_paths(struct exec_paths *const exec_paths) } static struct conf * -alloc_conf(void) +new_conf(void) { struct conf *const conf = malloc(sizeof(*conf), M_MAC_DO, M_WAITOK | M_ZERO); init_rules(&conf->rules); init_exec_paths(&conf->exec_paths); - conf->use_count = 0; + refcount_init(&conf->use_count, 1); return (conf); } @@ -1163,7 +1163,10 @@ error: static void hold_conf(struct conf *const conf) { - refcount_acquire(&conf->use_count); + int old_count __diagused = refcount_acquire(&conf->use_count); + + KASSERT(old_count != 0, + ("MAC/do: Trying to resurrect a destroyed configuration.")); } static void @@ -1329,7 +1332,7 @@ set_conf(struct prison *const pr, struct conf *const conf) static void set_default_conf(struct prison *const pr) { - struct conf *const conf = alloc_conf(); + struct conf *const conf = new_conf(); strlcpy(conf->exec_paths.exec_paths_str, "/usr/bin/mdo", MAX_EXEC_PATHS_SIZE); @@ -1337,6 +1340,7 @@ set_default_conf(struct prison *const pr) conf->exec_paths.exec_path_count = 1; set_conf(pr, conf); + drop_conf(conf); } /* @@ -1406,7 +1410,7 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, if (need_applicable_conf) applicable_conf = find_conf(pr, NULL); - conf = alloc_conf(); + conf = new_conf(); if (rules_string != NULL && rules_string[0] != '\0') { error = parse_rules(rules_string, &conf->rules, parse_error); @@ -1429,12 +1433,12 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, MPASS(error == 0 && *parse_error == NULL); out: + drop_conf(conf); if (applicable_conf != NULL) drop_conf(applicable_conf); return (error); error: MPASS(error != 0 && *parse_error != NULL); - drop_conf(conf); goto out; } From nobody Fri May 29 16:01:41 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 4gRp515mzkz6flVL for ; Fri, 29 May 2026 16:01:41 +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 4gRp510sMxz3HSG for ; Fri, 29 May 2026 16:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070501; 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=qs2ktg24z9KFQOsT8rCIrDXJthUBb9JjXDV+BlkyOLg=; b=eRZF9Auuv6qF9GNEMQMS3hy+uWtvRIlbpW2lXIbCctIvyzJHmouLLTMKeXxAZcgcz+8GGJ Dzk50e1mNjW6t4KGYFfNCr5nSBKg92tYEGhIsI1YUj07ghJx6JxDw71EWfmJZUqI8OdOml A0S/HO2Ygh/VEV7Kh+6HJDO7JNUN7mtYkIgDL767ri2m2wTvUdNTrp3A2wcvjDwMoDzT6J XUTU5P7miHfGucp3hQHPIjEkGwa0Csn6Ed6teQE9BGstsAx7Ybci2bSxs/ZPPkpQDOKhwr 9k2fF6j0+1Rcx7C5dIllqNSn95JjIB2hXgQztYs5hcRrtXeobAIWSkgWEIEcgA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070501; a=rsa-sha256; cv=none; b=MCz0fnrc2D+8rmKLL3P5g0gNqtXMM4c/minzbzARNHdtf4BOXyptYedfUmSKvqAgaJRjOb hmMvBErq06awxA3QFgm+0F8vwKHXUYHbAVVhmIKu52M6DScxKk18Cj1EgWhtOf97StKwsx iVRRgoHK3NVJDpYS6mIqtQA8VRFeRp7lay62tyAUXK6RQnIenLUyeiS9ERZ7ezs47bFWm3 2GBrEfXbDX2o+cNEcukAPZET5zu2ZLoFa9y/EBG5KKPJRmOxaRGrGzWo+Is9BcvtPxRGQb sEghhbG8uGjwmqhiOgE4oGxodqX4rzKAMafyHqDsWyJGwdg0LaasYpo6UFIV8g== 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=1780070501; 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=qs2ktg24z9KFQOsT8rCIrDXJthUBb9JjXDV+BlkyOLg=; b=wVxU5nE1zVUR97kgN3myOC26JzaT0WffQvhthSbYD8YWGsKPHKtCsGHcrALbnMwDJRTjqq ctXWFBxkZSZPaaS5zphICGNc2Ls3e2+0LXjRDrMS9JnoK3VBWciMLtO8bvp56zI+O4/6/a mBfABs+A6hij0AJ7w/xDtDTtZMltZ7x3tY4S+SzLyA03LnzBZLMpDHS1Z1xIDbQamqLHpx CHMWjniX31mkpkFxRD4j60WGYWji8Un+UwesZSEpebYDlx8bk5AJHI5HIBS6tR+pASGrto ZB4vKgUAKpDsHJQDA4ON/UDWr0H3JVXHeO7GFKs26KC3uu/gOZP61mn5tyh0pg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp510Q1Xzg9D for ; Fri, 29 May 2026 16:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36528 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 4e27cc086b3f - main - MAC/do: Move static assertions on constants close to their definitions 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: 4e27cc086b3f9e029160da8830abacb06a2f9e39 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:41 +0000 Message-Id: <6a19b865.36528.531ce00e@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=4e27cc086b3f9e029160da8830abacb06a2f9e39 commit 4e27cc086b3f9e029160da8830abacb06a2f9e39 Author: Olivier Certner AuthorDate: 2026-05-20 09:38:37 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:22:43 +0000 MAC/do: Move static assertions on constants close to their definitions And document more clearly their purpose. Reviewed by: bapt 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 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 7a08cdd5425f..1d9b756bc0fc 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -47,10 +47,14 @@ SYSCTL_INT(_security_mac_do, OID_AUTO, print_parse_error, CTLFLAG_RWTUN, static MALLOC_DEFINE(M_MAC_DO, "mac_do", "mac_do(4) security module"); +#define MAX_RULE_STRING_SIZE 1024 +_Static_assert(MAX_RULE_STRING_SIZE > 0, + "MAX_RULE_STRING_SIZE: No space for the NUL terminator!"); + #define MAX_EXEC_PATHS_SIZE 2048 #define MAX_EXEC_PATHS 8 - -#define MAX_RULE_STRING_SIZE 1024 +_Static_assert(MAX_EXEC_PATHS_SIZE > 0, + "MAX_EXEC_PATHS_SIZE: No space for the NUL terminator!"); static unsigned osd_jail_slot; static unsigned osd_thread_slot; @@ -353,14 +357,12 @@ toast_rules(struct rules *const rules) static void init_rules(struct rules *const rules) { - _Static_assert(MAX_RULE_STRING_SIZE > 0, "MAX_RULE_STRING_SIZE <= 0!"); STAILQ_INIT(&rules->head); } static void init_exec_paths(struct exec_paths *const exec_paths) { - _Static_assert(MAX_EXEC_PATHS_SIZE > 0, "MAX_EXEC_PATHS_SIZE <= 0!"); bzero(exec_paths, sizeof(*exec_paths)); exec_paths->exec_paths_str[0] = 0; } From nobody Fri May 29 16:01:42 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 4gRp523r0Hz6flSK for ; Fri, 29 May 2026 16:01:42 +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 4gRp522JwDz3Hgh for ; Fri, 29 May 2026 16:01:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070502; 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=tkqa2enoSH3eChTmWAMsobUyghtmBWAfY94eJohBqf4=; b=xGk3EDY52sccMdsL7y/06kDhXSWbk99Gx0QKe+WeMNqT1NRQr6PcAEmFtO1vnqHPPdb7HF y/jCCWYKP1MAng2EQHqyv15vbdyIsIm6/Q9FhIoa1JRM4w/DvdDqcEyQHu/9gfxKhLNONd lMKjbYCTRrTzDXQ+DtlDWtmHM/iuJ/Oj/jt+GoNZbatIdMyWwpXLOXv3hN7USgn2PjvjqB Cc1LGG+gYIup5HiK8v2crUoOIeh7f2QA0LpPkjdG/8C3K8+kK8jxMCnZcGco0I3AavhyAI 5jbhyopHxeDQkBVaZ9GefsKE91diaU0OCQwzI2shDgIyZ7nYBpVHmyBJUzVLvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070502; a=rsa-sha256; cv=none; b=P+LIn6ao9QlKVyg8vnVL32/CWoaDJfabDJZDQgOIDOnmaIoZkSDe8SB7alKI7UNpUvs8Ht RIzMSoz9gsKWCOKf9NIpNi5Hkd956qYNZsv05klv7VgIa5+cGJsD7O7DvAJfZMpVgv+5Yj ZYpad7TJmMjCRA85KxFMIRjz1w+jsc9gWny660dnHQa7dBvZMc6ecqoxYyavp5ykIUMpyP VHU7Un/1FxHMoFu7jL4OwCayOBkfV+XaBPln77l/8dLG4cf3mlQcZ2yOanoMv/Fovz+H6r iVLQkAgjnjY0ccRhqvgw1BZ5J/iQlHtvJVQUELAM/3/P22wfQOtSAlPIU+bhNQ== 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=1780070502; 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=tkqa2enoSH3eChTmWAMsobUyghtmBWAfY94eJohBqf4=; b=j4kSMM1IaoQ99TV507SbJzaSi4oIVE7QXMmdt46zSow1p8qE2GsY7C9K+pX4px3kZ3wBP5 jz854+PCNc9fnp52n9zShZ0Q68ObmPZrcd66fLrjSTAH+ZyJOkewD/DnkR97uPRYSw7N5Z Q5PCZOFgx39VMu9b0XGbcamDBWV6uDecv7T5Qw0BxNzyPIZe9y0Um1+rAAewOQkJQ1LmtU TkIM5M3A29kWWddz333QZdszZp/3QkB5mJDrgbwUcrVmdVOeaoO27mHfKpTV1MRx6Ja9Hm CPICuXWFy/WCdiHyOUz5ctkwbnPo4bh/je1BcbNnuNrKl1r/fU7/Ze022EzaMQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp521Cjlzg9F for ; Fri, 29 May 2026 16:01:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35dfa by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 11b567e94ad2 - main - MAC/do: Remove superfluous configuration initialization 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: 11b567e94ad2a1b4baf768d77c6f1fb2018cfe83 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:42 +0000 Message-Id: <6a19b866.35dfa.21209291@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=11b567e94ad2a1b4baf768d77c6f1fb2018cfe83 commit 11b567e94ad2a1b4baf768d77c6f1fb2018cfe83 Author: Olivier Certner AuthorDate: 2026-05-20 09:29:51 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:22:49 +0000 MAC/do: Remove superfluous configuration initialization Configuration objects would be initialized (zeroed, and some STAILQ_INIT() called) multiple times. Make sure they are so only once, and add assertions to check that this is actually the case for functions that expect it. Reviewed by: bapt 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 | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 1d9b756bc0fc..fa20beadbaad 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -33,6 +33,23 @@ #include +#ifdef INVARIANTS +/* + * Should typically be moved to libkern (and perhaps libc) at some point, and be + * optimized if to be used outside of INVARIANTS. + */ +static bool +is_zeroed(const void *const buf, const size_t size) +{ + const char *const p = buf; + + for (size_t i = 0; i < size; ++i) + if (p[i] != 0) + return (false); + return (true); +} +#endif + static SYSCTL_NODE(_security_mac, OID_AUTO, do, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "mac_do policy controls"); @@ -353,25 +370,24 @@ toast_rules(struct rules *const rules) } } -/* Assumes storage has been zeroed. */ -static void +static inline void init_rules(struct rules *const rules) { + MPASS(is_zeroed(rules, sizeof(*rules))); STAILQ_INIT(&rules->head); } -static void +static inline void init_exec_paths(struct exec_paths *const exec_paths) { - bzero(exec_paths, sizeof(*exec_paths)); - exec_paths->exec_paths_str[0] = 0; + MPASS(is_zeroed(exec_paths, sizeof(*exec_paths))); } static struct conf * new_conf(void) { - struct conf *const conf = malloc(sizeof(*conf), M_MAC_DO, M_WAITOK | - M_ZERO); + struct conf *const conf = malloc(sizeof(*conf), M_MAC_DO, + M_WAITOK | M_ZERO); init_rules(&conf->rules); init_exec_paths(&conf->exec_paths); @@ -1356,9 +1372,7 @@ clone_rules(struct rules *const dst, const struct rules *const src) { struct rule *src_rule, *dst_rule; - bzero(dst, sizeof(*dst)); strlcpy(dst->string, src->string, sizeof(dst->string)); - STAILQ_INIT(&dst->head); STAILQ_FOREACH(src_rule, &src->head, r_entries) { dst_rule = malloc(sizeof(*dst_rule), M_MAC_DO, M_WAITOK | @@ -1387,7 +1401,7 @@ static void clone_exec_paths(struct exec_paths *const dst, const struct exec_paths *const src) { - bzero(dst, sizeof(*dst)); + MPASS(is_zeroed(dst, sizeof(*dst))); dst->exec_path_count = src->exec_path_count; for (int i = 0; i < src->exec_path_count; i++) strlcpy(dst->exec_paths[i], src->exec_paths[i], From nobody Fri May 29 16:01:43 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 4gRp5373sNz6fl7r for ; Fri, 29 May 2026 16:01:43 +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 4gRp532zpFz3Hdt for ; Fri, 29 May 2026 16:01:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070503; 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=d1fRAtUftT22uAmxat0XUe+AqZAgw8TyJa8vQ1BsKYg=; b=kXRBykQCdDr/KRA+DcV5AilIPB3hgBxDWqq5WqexkoNBCXniQWuvzk6j6+EKxKd+Cbb+8s YviTPmDjuL32vhWcwY5N7ZUuDi0Trcu+Sh1oBRtiPgURw6SFSnn39mkTh0pc/2bK5n+D3g F9gLU1Uw7LzdeK5D5GpWCH1Jz7DG4Tqw24shMdIE2aOZ9KHPSxLaVx51s7wGXk2+XX6Mm8 Ipe6KFpUuwd3DHhz3Efe4jOg7unLK6qjDg5q4rWEMZTpyFZCVyWkRJhnYQQveZYXrRugjF mY3+UnhVi8CCmBLuaEmAWIR9rkJ4x0rU6S/lEOBBfiTRBtCY+ROO3hUe/+SCNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070503; a=rsa-sha256; cv=none; b=m8G/ygmn1mH5ySTt1fPMvPIuTtVTzkHDk4yFqt9JJRbmcFLyfvnfyYDPoi6NmYq+Bl+HmX 5jkILjKLKVzmVs61xyafvJEuz3OOggxWJdJDEl7R674XkOYYiPN5bVCE/6kl0YN/jv6uwP CYTM7I9tx8gu7m5njnrPEPZRChiJy/vLwfFiliu7aM7jkRw2Ya+9KACyHc1UCAWG0EMfg0 zx0XbFekDLUZungQ4lZqdcY5zS9wB/uZWkbZLY0jqH+vR+r0cPa760J2yF1FLRX70P6Nh0 oJA+rKVXYBon03tBUinSuaM1J8VHCtfCwICj/RWOSFXzmfjntlvSEAP3Y83sCg== 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=1780070503; 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=d1fRAtUftT22uAmxat0XUe+AqZAgw8TyJa8vQ1BsKYg=; b=YdnXZlr1adxLt9XEvGdbsUgVC81v/Ixm6+Sy3UutSc0JC1xZUCfUgfUB4S8gA1/3ifpUS3 Da3Aga5oxTQKRZ9XkMp7KmpAE9wVm5ueKeuyB3TbeOosZIDQvhpizRFNNQSwvsngRuhykU pBZwcAsC5vtw71zXCF/pEJswoyPfC1hjwAQJIaTWpYB8ZNKixwQEGlVRjAeu4L3pGW8NHQ E/xuBAsBzk75IZeXwBgNvkCz5gTbxnp2dPz2MMQdnkiB6oS4J2IlUxgyrBZ9IE4Ou+ud4H wxtq/WCe4pSKu7AYatfjnEfTTsJmBRYxhtGESjtvreYeTjSWgC4KAsLisB7RXQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp531zzyzgmy for ; Fri, 29 May 2026 16:01:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36088 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: ce59a4181593 - main - MAC/do: clone_rules(): Readability improvements, constification 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: ce59a4181593f59028d3a26f2b63dcf2c8041d79 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:43 +0000 Message-Id: <6a19b867.36088.150fa440@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=ce59a4181593f59028d3a26f2b63dcf2c8041d79 commit ce59a4181593f59028d3a26f2b63dcf2c8041d79 Author: Olivier Certner AuthorDate: 2026-05-20 10:33:41 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:23:04 +0000 MAC/do: clone_rules(): Readability improvements, constification Constify in order to let the compiler check that source and destination arguments are passed in the proper order in the different calls. No functional change (intended). Reviewed by: bapt 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 | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index fa20beadbaad..b24daaf093c0 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1370,27 +1370,29 @@ set_default_conf(struct prison *const pr) static void clone_rules(struct rules *const dst, const struct rules *const src) { - struct rule *src_rule, *dst_rule; + const struct rule *src_rule; strlcpy(dst->string, src->string, sizeof(dst->string)); STAILQ_FOREACH(src_rule, &src->head, r_entries) { - dst_rule = malloc(sizeof(*dst_rule), M_MAC_DO, M_WAITOK | - M_ZERO); + struct rule *const dst_rule = malloc(sizeof(*dst_rule), + M_MAC_DO, M_WAITOK); bcopy(src_rule, dst_rule, sizeof(*dst_rule)); if (src_rule->uids_nb > 0) { - dst_rule->uids = malloc(sizeof(*dst_rule->uids) * - src_rule->uids_nb, M_MAC_DO, M_WAITOK); - bcopy(src_rule->uids, dst_rule->uids, - sizeof(*dst_rule->uids) * src_rule->uids_nb); + const size_t uids_size = sizeof(*dst_rule->uids) * + src_rule->uids_nb; + + dst_rule->uids = malloc(uids_size, M_MAC_DO, M_WAITOK); + bcopy(src_rule->uids, dst_rule->uids, uids_size); } if (src_rule->gids_nb > 0) { - dst_rule->gids = malloc(sizeof(*dst_rule->gids) * - src_rule->gids_nb, M_MAC_DO, M_WAITOK); - bcopy(src_rule->gids, dst_rule->gids, - sizeof(*dst_rule->gids) * src_rule->gids_nb); + const size_t gids_size = sizeof(*dst_rule->gids) * + src_rule->gids_nb; + + dst_rule->gids = malloc(gids_size, M_MAC_DO, M_WAITOK); + bcopy(src_rule->gids, dst_rule->gids, gids_size); } STAILQ_INSERT_TAIL(&dst->head, dst_rule, r_entries); From nobody Fri May 29 16:01:44 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 4gRp5501pxz6flXS for ; Fri, 29 May 2026 16:01:45 +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 4gRp543Dxtz3HSd for ; Fri, 29 May 2026 16:01:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070504; 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=kfkahbPsEfE/xnqQowDJ9iXbFoMf8DhA5G6qr3r5yZU=; b=AMn4hvCqUkU5pOr/S1AIWw/JBIuYMyhpP7W1hNcAVeqnE0zJ0deIossmJ2avxVsY33nSrv wsVdy0XMCq1Xvg5/NzIKKgwYFMim09BrHHGt4ZxR1BlKyq6+OKm7HBwN/8A7wDbPYQNn4q AkzgjTE7t+o7wIvbKkdrcvSGGT/b/Jxi4JlLtlnzYCGMRbICV2YGem6PKjZDGDK5oBSCSN laO+kOQMe3boNQXNnnycNRyiKGK1z/6HNbh8maEsQAV74gEH7YD2lyEJqdb7dU95zE3KdV Mrnt3rv9vx3sPtk55HuxLdOI3muW+4gxlu7pZpU9M3b4+meFUv7bGyWGZXBfcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070504; a=rsa-sha256; cv=none; b=hRyPiz3wMlgOliy04n3NJMnyBW3c68NEHDjnRdH0fImfE5l7YglOXikbRKMcQ0s72G7/a+ EkpCKekGyy0FlW1YLNGGcOEIOYQuYTPEgIByZaWLgEZXE2QeKzTOUz9dASEFn3JdWwvC5N ncHWjqS80Sb1XbJqwBVm1RutxRnYbrPFBgHED/bVu4TdhDsiFoQL5zPZjijNety83dENMi c+xUxrRrZcfTFuaawZyGkt7fBswbasR5TcphOzxTXU4vbeE+nbmNsv95hkzFZ/06AXc+6P WqiTHeTpn/p3vrkT0k47F5DadJaQis4CevxElh0aE5yfMBUwfri4uC7SnGdJAQ== 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=1780070504; 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=kfkahbPsEfE/xnqQowDJ9iXbFoMf8DhA5G6qr3r5yZU=; b=JfAKvDCisYPAFJdTntOdznGpH+fOD1TkNwT0njTuucuj+u7Rm69UqnHLVtd5PAkDN2KNW+ BPiYH/qP8dw14kW4O4UUDzRY2ACVof5xC9u3QIqfb2wkOZnDCMyrq0o5/0ixQZrj1areyj NQNrBJj7odng62jv4ZESP6rvIckW10K6hsddvGxZ++WgwfoV5IBflF+5KXo+ZntN8CUisu yZAAUelcCrzY1XtyshpOr4RNbm0O51pCbvY0+fiE97LYjPVsCxFZ4dwaa8PK0QVhOhRMvI IiP3Bi4YW9Zk1Ml/mKdZg7bMttC9yoTNbQuSYiacT9zbDMx2fU4GvTkwP19QZg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp542pLJzgCL for ; Fri, 29 May 2026 16:01:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 342b9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: d254322f6fa4 - main - MAC/do: parse_and_set_conf(): Obey empty parameters; Add doc 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: d254322f6fa46010bb94d658ff13c06ad438ee77 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:44 +0000 Message-Id: <6a19b868.342b9.21db378@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=d254322f6fa46010bb94d658ff13c06ad438ee77 commit d254322f6fa46010bb94d658ff13c06ad438ee77 Author: Olivier Certner AuthorDate: 2026-04-27 16:12:08 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:23:10 +0000 MAC/do: parse_and_set_conf(): Obey empty parameters; Add doc parse_and_set_conf() is meant to be used in all situations when there is a need to set or modify some jail's MAC/do configuration. This entails passing the information of whether some parameter was explicitly specified. For example, an administrator setting/modifying jail parameters may not specify executable paths but only rules, in which case the executable paths value is copied from the currently-applicable configuration. The sysctl(8) knobs case always leverages this feature, since setting a knob changes one parameter at a time. Currently, a NULL or empty string argument is treated as a non-specified parameter. This causes a bug where disabling MAC/do in a jail does not actually work because, to this end, parse_and_set_conf() is passed an empty string which it then interprets as a request to copy the currently applicable configuration's value, which may well not be empty. Fix this problem by only treating NULL as a marker for a non-specified parameter, in accordance with the original design for this function. While here, write some documentation to explain the interface. While here, remove the original herald comment for parse_and_set_rules(), which was inadvertently pushed apart from the replacing parse_and_set_conf(). 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 | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index b24daaf093c0..3ae5aba4bb8a 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1361,12 +1361,6 @@ set_default_conf(struct prison *const pr) drop_conf(conf); } -/* - * Parse a rules specification and assign them to a jail. - * - * Returns the same error code as parse_rules() (which see). - */ - static void clone_rules(struct rules *const dst, const struct rules *const src) { @@ -1413,7 +1407,17 @@ clone_exec_paths(struct exec_paths *const dst, sizeof(dst->exec_paths_str)); } -/* Must be called with '*parse_error' set to NULL. */ +/* + * Sets/modifies the MAC/do configuration for a jail. + * + * Must be called with '*parse_error' set to NULL. + * + * Supports explicitly setting all parameters or only some of them, in which + * case the implicit ones are copied from the currently applicable configuration + * (that of the closest ancestor jail that has one). + * + * An unspecified parameter must be passed as NULL. + */ static int parse_and_set_conf(struct prison *pr, const char *rules_string, const char *exec_paths_string, struct parse_error **parse_error) @@ -1421,17 +1425,13 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, struct conf *applicable_conf = NULL; struct conf *conf; int error = 0; - bool need_applicable_conf; - - need_applicable_conf = (rules_string == NULL || rules_string[0] == '\0' || - exec_paths_string == NULL || exec_paths_string[0] == '\0'); - if (need_applicable_conf) + if (rules_string == NULL || exec_paths_string == NULL) applicable_conf = find_conf(pr, NULL); conf = new_conf(); - if (rules_string != NULL && rules_string[0] != '\0') { + if (rules_string != NULL) { error = parse_rules(rules_string, &conf->rules, parse_error); if (error != 0) goto error; @@ -1439,7 +1439,7 @@ parse_and_set_conf(struct prison *pr, const char *rules_string, else if (applicable_conf != NULL) clone_rules(&conf->rules, &applicable_conf->rules); - if (exec_paths_string != NULL && exec_paths_string[0] != '\0') { + if (exec_paths_string != NULL) { error = parse_exec_paths(exec_paths_string, &conf->exec_paths, parse_error); if (error != 0) From nobody Fri May 29 16:01:46 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 4gRp566l1bz6flQK for ; Fri, 29 May 2026 16:01:46 +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 4gRp564mWkz3HZF for ; Fri, 29 May 2026 16:01:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070506; 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=0Djgo440Q2g8Xh5TtiTQzXeTNxjx1G/c0R4ebGLFxuM=; b=nIKzS3BXTqcOj07IQMj90YzM29gs2+j7qEmfyYUk9hSeMelpwjfWKPuXwWxA1YD089a64x rSgadvgKuIlHAlMJJHPTN8nqGxWgdqBktFR0dBJeffzV3ObdL6Dq66GYYFPsZFHJ3waM4k pcP12j8/rnSVB2g+uF3raGdZqvknqnrl50gK9as7P/HBP9YrhGYrenPpxUIvr+vEY00sL1 gofL38RNOKidDUjlcXcCN0V0/43qxITvkTTTPLri3vn3wWBFcc9u9R1nDildw80q4IvbnG j3Y/xAKtLWyePqeSblOHi7QpBwkrWhGB0Jqv0RA2rHVRsgnZptn8fbnyH2RmGA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070506; a=rsa-sha256; cv=none; b=srxdga0vN435P8SF3Or5Ed0wjavXd/OlMc2Rui7BJ9aRJqc+SKRkdij0WYykK5ybTFAx6p ruUDA2cb5HdwRJygKl98EREboKZWnyk4TFQwymNGuNOUpSp4x2hDnp0wJs2yRKE0zxS2Mr 34gpzdtKtqoWkLYls7xtpLS8zwEhsq6bL1G0Qrwd4EHIwYhCVydc46M4b5sXzpaPYBO9zg MaimuugERKzpasj2wQDlFcbPj1vvcQjhoqE0G8mlfd1Etp6gXuzIgJfcVx4ocbQ82rvrmw UaaaqJHBQI/0D6AP3wOOPotBcUEq76P5nvfPq9T1w+osQmMlDM35DHstdMdLlQ== 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=1780070506; 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=0Djgo440Q2g8Xh5TtiTQzXeTNxjx1G/c0R4ebGLFxuM=; b=llg1Vns6ZRlX4b3qDZkW3RpBngL1RxY8Oi/qYfobcgkxofT9mhk+kgvL4HJIpOzOA4Q2tS ktLlpC2c92bfw74YUskmetUCEmu0xKvO1jVcuX0j6utEsCroeppX2lrdLNwEpRs6YNX0fa oi68zfwoW1GWXfko7Wbtsp6c2fnbcDU7aj2+Q/vYRUhmpJQN6WDhLsIQk+FCPOThXcGlri 8Tc7sCO+UYoQwUxHLsgQrOkHP0LBBjOXWLUqflW7pdKx1URQcIX3//6BRKe4kAW4LrX/Ym LF767oXPHU8wcBf/a5yaRCYMv6aEYji0lNU3HfSkrDss3fVzke/N+DlY1RHkSw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp564CxTzgn0 for ; Fri, 29 May 2026 16:01:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35dfe by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:46 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: dbf8f0895ad8 - main - MAC/do: Fix obsolete wording in a comment ("ascendant" => "ancestor") 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: dbf8f0895ad86fea10adbd678873f8af0bd7558c Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:46 +0000 Message-Id: <6a19b86a.35dfe.4a06e523@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=dbf8f0895ad86fea10adbd678873f8af0bd7558c commit dbf8f0895ad86fea10adbd678873f8af0bd7558c Author: Olivier Certner AuthorDate: 2026-04-28 09:58:31 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:25:52 +0000 MAC/do: Fix obsolete wording in a comment ("ascendant" => "ancestor") Reviewed by: bapt 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 3da2f4ed5c80..03569fab87d6 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1292,7 +1292,7 @@ dealloc_jail_osd(void *const value) * Remove the rules specifically associated to a prison. * * In practice, this means that the rules become inherited (from the closest - * ascendant that has some). + * ancestor that has some). * * Destroys the 'osd_jail_slot' slot of the passed jail. */ From nobody Fri May 29 16:01:45 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 4gRp556ylJz6flb0 for ; Fri, 29 May 2026 16:01:45 +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 4gRp554Pctz3HSm for ; Fri, 29 May 2026 16:01:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070505; 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=0UINIjlkD8JlLp6RmMKmS62BsmmSrlfDLGFXGRxTvFY=; b=nXPzD0TPzAmj3Xfsdq//2A3eNLmg6AjFRCUerQ2TegBVg0Ds2i4/1jCsCoC7zj8HKr+qHU iH+izboOW+2CUe1vT0Vq57SexT39R/3aWb0SN4TyGnmUb1LLT7WKrnh9RIJ4bmQMqi9BHp QLT3FGyoISkNh/293OOVbQ40zRDN9CoipMigOPeQ7htovnDOvDsstCT5/ASJngxzr+G2ic 9Du5KNd0d/fzaGXxon1ST6VP7wm7vhqJ7h2dd1QDVY4x22QPjhHSVdZjDOtSkD3+Ze+1sO fw80UDjttX96GUPaegS5MMQjzvYv/XqKNbv1NYpIyPmcMJvDuN73J+C/TjSbvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070505; a=rsa-sha256; cv=none; b=w/mzHp6lpNFpYKGz8DUgQo+2//4ohr3qLATy/a+lRpJSHC1ivv3nfc41RUelBWeO2Lmd+x 40aC7pBqTIBIPdaJ8qp9qw21bvLtkiSHzk3sz1zjgWHodwPIUXlIFvq2zURjaN4VIF6VZN 5k1nxcetvxvQ7QiPMhVWi/rGEiXI0JmwJsunVkhtZQTiKNpaTJ8EM+ATGOYZldwWtPFWrI H9b01lkw+fzP+ZiG9BRkSlYq7W55XRVel8/1hI6lZiMDNgye64B+sLuSSogXboCBwjL8Z0 1A3wn/9cx6W6VIBDxK0dSYkHGvT6qv0ZLrJYb0PKGqt8udOsZD2Km4Lk83n+cA== 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=1780070505; 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=0UINIjlkD8JlLp6RmMKmS62BsmmSrlfDLGFXGRxTvFY=; b=yDe5dY65wV6CUu2my8sE8t6e5PwallverhO4bt3TViKQe5fVcsNetDGNgup3xONdRojwsX +McHHW55dmoWcb0509fBEa/xSwkQjMB8XwSgRhMxjQp/fvqoepH3hDsiSLnziC52jzeBGV aNTTtYDcV+eEOZkHf1lhZ0a2GWzZn3rSBihcEMHj0Ro4IU6qxQPMzCJ+lk8Eb4PZfqkU5I GF9hQpf5sRa6ph7VNKldg5+BHis6ceUvW9183HVaaWSP/TsiWIYmGcLJf8VjbW/1QQp7Cx jEIwxPHsA1lrgOFde6xiaDs/ZhwulIag/p0L3T7NKV++VUbM8wQwGZgGviAFAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp553dWNzgCN for ; Fri, 29 May 2026 16:01:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 344fc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 73215eba8b91 - main - MAC/do: parse_and_set_conf(): Require the model configuration 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: 73215eba8b91fab37c1ad380fca04f082f3f92fd Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:45 +0000 Message-Id: <6a19b869.344fc.51914074@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=73215eba8b91fab37c1ad380fca04f082f3f92fd commit 73215eba8b91fab37c1ad380fca04f082f3f92fd Author: Olivier Certner AuthorDate: 2026-04-28 09:55:29 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:25:09 +0000 MAC/do: parse_and_set_conf(): Require the model configuration This change is a prerequisite for the next change in caller mac_do_jail_set(), which for semantic correctness needs to rely on a stable model configuration. The two other callers already call find_conf() to retrieve the applicable configuration, so for these a second call to find_conf() can be saved. However, this does not fix (actually, makes slightly worse) an atomicity problem when multiple threads concurrently change some jail's configuration (or the configuration inherited by a jail), which has existed since the introduction of executable paths due to being able to change only rules or executable paths independently (and the possibility of not specifying them and having them copied from the currently applicable configuration). Before tackling it in later commits, we first focus on fixing the semantics of configuration changes in the very next patches. Reviewed by: bapt 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 | 66 +++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 3ae5aba4bb8a..3da2f4ed5c80 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1412,49 +1412,46 @@ clone_exec_paths(struct exec_paths *const dst, * * Must be called with '*parse_error' set to NULL. * - * Supports explicitly setting all parameters or only some of them, in which - * case the implicit ones are copied from the currently applicable configuration - * (that of the closest ancestor jail that has one). - * - * An unspecified parameter must be passed as NULL. + * Supports explicitly setting all parameters or only some of them. An + * unspecified parameter must be passed as NULL. The values of unspecified + * parameters are copied from those of the passed model configuration (which is + * expected to be the currently applicable configuration, i.e., that of the + * closest ancestor jail that has one). */ static int -parse_and_set_conf(struct prison *pr, const char *rules_string, - const char *exec_paths_string, struct parse_error **parse_error) +parse_and_set_conf(struct prison *const pr, const char *const rules_string, + const char *const exec_paths_string, const struct conf *const model_conf, + struct parse_error **const parse_error) { - struct conf *applicable_conf = NULL; - struct conf *conf; + struct conf *const conf = new_conf(); int error = 0; - if (rules_string == NULL || exec_paths_string == NULL) - applicable_conf = find_conf(pr, NULL); - - conf = new_conf(); + KASSERT(model_conf != NULL || + (rules_string != NULL && exec_paths_string != NULL), + ("MAC/do: %s: Model configuration needed!", __func__)); if (rules_string != NULL) { error = parse_rules(rules_string, &conf->rules, parse_error); if (error != 0) goto error; } - else if (applicable_conf != NULL) - clone_rules(&conf->rules, &applicable_conf->rules); + else + clone_rules(&conf->rules, &model_conf->rules); if (exec_paths_string != NULL) { error = parse_exec_paths(exec_paths_string, &conf->exec_paths, parse_error); if (error != 0) goto error; - } else if (applicable_conf != NULL) + } else clone_exec_paths(&conf->exec_paths, - &applicable_conf->exec_paths); + &model_conf->exec_paths); set_conf(pr, conf); MPASS(error == 0 && *parse_error == NULL); out: drop_conf(conf); - if (applicable_conf != NULL) - drop_conf(applicable_conf); return (error); error: MPASS(error != 0 && *parse_error != NULL); @@ -1477,8 +1474,7 @@ mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) if (error != 0 || req->newptr == NULL) goto out; - /* Set our prison's rules, not that of the jail we inherited from. */ - error = parse_and_set_conf(pr, buf, NULL, &parse_error); + error = parse_and_set_conf(pr, buf, NULL, conf, &parse_error); if (error != 0) { if (print_parse_error) printf("MAC/do: Parse error at index %zu: %s\n", @@ -1518,7 +1514,7 @@ mac_do_sysctl_exec_paths(SYSCTL_HANDLER_ARGS) if (error != 0 || req->newptr == NULL) goto out; - error = parse_and_set_conf(pr, NULL, buf, &parse_error); + error = parse_and_set_conf(pr, NULL, buf, conf, &parse_error); if (error != 0) { if (print_parse_error) printf("MAC/do: Parse error at index %zu: %s\n", @@ -1726,6 +1722,7 @@ mac_do_jail_set(void *obj, void *data) struct vfsoptlist *opts = data; char *rules_string, *exec_paths_string; struct parse_error *parse_error = NULL; + struct conf *model_conf; int error, jsys; bool has_rules, has_exec_paths; @@ -1755,20 +1752,32 @@ mac_do_jail_set(void *obj, void *data) jsys = JAIL_SYS_DISABLE; } - switch (jsys) { - case JAIL_SYS_INHERIT: + if (jsys == JAIL_SYS_INHERIT) { + MPASS(!has_rules && !has_exec_paths); remove_conf(pr); return (0); + } + + model_conf = NULL; + switch (jsys) { case JAIL_SYS_DISABLE: rules_string = ""; has_rules = true; /* FALLTHROUGH */ case JAIL_SYS_NEW: + /* + * If 'pr' has a configuration, we want to use it as the model + * (i.e., only change what has been explicitly specified). + * Else, we want as default values those that are inherited. + */ + model_conf = !has_rules || !has_exec_paths ? + find_conf(pr, NULL) : NULL; error = parse_and_set_conf(pr, has_rules ? rules_string : NULL, has_exec_paths ? exec_paths_string : NULL, + model_conf, &parse_error); if (error != 0) { @@ -1776,15 +1785,16 @@ mac_do_jail_set(void *obj, void *data) "MAC/do: Parse error at index %zu: %s\n", parse_error->pos, parse_error->msg); free_parse_error(parse_error); - - return (error); } - - return (0); + break; default: __assert_unreachable(); } + + if (model_conf != NULL) + drop_conf(model_conf); + return (error); } /* From nobody Fri May 29 16:01:47 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 4gRp5843Kcz6flSj for ; Fri, 29 May 2026 16:01:48 +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 4gRp575cBJz3HZR for ; Fri, 29 May 2026 16:01:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070507; 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=dHtdIP1HshnJN7Q7r3mkYVYOOychWcL6RwYNQXNNmjE=; b=xNN4o9112CHGTmntFEEdWKaFWRFLkCXKV6Iu1j6ibRbRv0xKQFZwerzw1RAsEmwoV6Q3XH WyF3VWUVcDKZCQXxROUV87qZ55PJkF6ejy3vufX+o4whYfxsOQtc1lL47bM3dxuMTfsB6O f9znZ45nx7JXkh+kMF7EFzD3nao1GdFw+9OTWzO0yIdztR0lrvzp+X7q7gGEM69PlqoaLX w5sZtjotEq8JRTiv8MOch8zL6gTulT1WV8WEiqCa30wMnwI/F0EF4E7luY/twZGlL27JAo 0yDWNbqZCZ5hs713A4FNXQCDPH3LzvEmlS1jH074JCsF+X/EQHBI17ppXGFZ9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070507; a=rsa-sha256; cv=none; b=qnCNnsHtnmONT5HSNLX+kzcdKS3xAjd1Z0X98JwxsivtadyjM9NBOGI1LzE7XdOyPviHNl jTfqn8USWKObrg7NYUry4Ul89+9Yahc9PQoGxbVi/vLJwHhUdzmggSX1IeJCMgUbtzDM4O cENP2fTuJZLAX3dO5FWPH8URsSG2AdthQaoiBn97eUm+/apKN6y+ZrRFeUl9mU/zo4Nxaq nw/Wl87BFzROGGnmpm6kYAA+4AFuI3bWjMPooMGGtnrKiu2w0nd7nyecvpoGrAHOxhW6H0 Y36hzAv5XXnLR8HDbaxTB16cQCyk3SVBNnxVhvVSYYtnAipiJwL5NyGRnUERDg== 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=1780070507; 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=dHtdIP1HshnJN7Q7r3mkYVYOOychWcL6RwYNQXNNmjE=; b=TpN3kNTm8CmeB8rkPDenWQ4BKLQRyNFyZJ6tdHG8tGGoaflZBaEPA0aWa7IGxNaHXDiRFb Ad1TsCnVMwB8lp/F0W9TyLbRMyHJs4m19OVWJc2aJ3++apt8t2kwXAYMt+qrxRbO6lRgi7 n19bYC++XmdXTfYnZZEcTh1uIBo3Vxj/uDr3bQn8vFh4+Zx8nljBWR3tsLbwZlv/nGgU3H H17utQz4Eak9a/Evq0k7x81XtdYnqkJ1prwjOQUf5HkkQZ/bdbpNidK/2Vg2v+ffQKKk91 Xy1dVqpNgvtpnJIhESNO8l51Rkz6uFCV5C2gNyx14U97ahmg8eB8/EOeKneMpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5750lWzgCP for ; Fri, 29 May 2026 16:01:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33f53 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 37bc08d5fe99 - main - MAC/do: Constify is_null_or_empty() 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: 37bc08d5fe9933f41574bf477080d729daf19928 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:47 +0000 Message-Id: <6a19b86b.33f53.7429bed9@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=37bc08d5fe9933f41574bf477080d729daf19928 commit 37bc08d5fe9933f41574bf477080d729daf19928 Author: Olivier Certner AuthorDate: 2026-05-20 11:12:38 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:26:48 +0000 MAC/do: Constify is_null_or_empty() Reviewed by: bapt 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 03569fab87d6..493dcaf66f89 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -397,7 +397,7 @@ new_conf(void) } static bool -is_null_or_empty(const char *s) +is_null_or_empty(const char *const s) { return (s == NULL || s[0] == '\0'); } From nobody Fri May 29 16:01:49 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 4gRp5B37VQz6fl1v for ; Fri, 29 May 2026 16:01:50 +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 4gRp596rFkz3Hnc for ; Fri, 29 May 2026 16:01:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070510; 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=Kf13hkR21h3J+YjRxSmS1FGfLWu695wGrh7XOKzKYdk=; b=NV2gDY/FgjzLtrK6rsIS4Vk/rtL7ebfAdwG0pTgh9ifJIo/19SDX6hDy1LWk1AT+Fqm7TV ZjuOt8rHdCDfdeWpOcvgStfX20xeCTfH0X+6NCLfwRW85nsPWezrQzh6gKvwjVunIh0JUW +jzNATuZuAUcNjVucxeALR3qoFXc/x6hbfI/ETFRflKGVXbRFveIss6fi2yoAZDYxpk9H/ 8msiacr5+9MEn6ioEEA1Oq+bBSN9czdnw6pw1+AajiqRuKnrBN/9tweMnOva6dNMF/wcNS fnV0CXwiXiLZErwc3++JWYfzl8kMdpFr4X6cSTL6efRhiA7nyoW70hr/kjd6tA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070510; a=rsa-sha256; cv=none; b=se+xEnMl9zqShYF7aU2CcMigE7sPQ123WCx8p8m92lOIiPHBBI9wihmDGBr17cnbwE6j4+ Q/83A/HlMSWcCC04OTsalYmeoniczgqfc8fOw3TfV6Uay66seJPEk44HmvHeYxo5yuphQx 2ji05hRukZ8lOK2gDVBfMT+0U1Gbu9/duMql5HgCohSN83v7vwTO9QDa69ctlQCBLlpxF2 BDlTtbU6yIVDA5zl9sQdnmsHh2UkSuxRACLnXXO5QnLJao1Ea7HB7n7GdUlxaj093KB64K HuT00Kd3Vnvy2wLjtrvL6dGM84ILOgSb9C4sS5i8k3HFrFzvzaDC1kQTee8Vgw== 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=1780070510; 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=Kf13hkR21h3J+YjRxSmS1FGfLWu695wGrh7XOKzKYdk=; b=kg/TQdnS7JAwnLPMnhhf76OPUVO0ignYUbwidBYAO8J6upcdl+swY7IYmW4iaV5SdxkCxD 0dKJtAPh0PTlmeeZVAK0gaSOQVLlv+XPkdr1zInOD+SXA911Yx8L5Yks7mfWr00oqjdRY0 3uKaiflsc53wj6cY1FYM2c1kGksP8XW1T0ZhNn54wBDqZ0c9FcTlhVYZ8sMLu5ExekFzy5 XBFnrUL9oSSTIWIoXq0fnlAa8fZMPuoc3xzsZc0hWlSS2UNtrwMNDnIQfkqTFWglzlMYNz n+d8Pgm0kPFAu3gTu2oD/7pEu/40XH4lPpQcygtYa+uGvngUAIEuEb+TjGzhPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp596MLtzgpS for ; Fri, 29 May 2026 16:01:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 338f5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:49 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 51cc5840b66c - main - MAC/do: Configuration: Fix default values: Remove jail creation method 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: 51cc5840b66c9565e1740c1198a0e684d81e3734 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:49 +0000 Message-Id: <6a19b86d.338f5.e63f434@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=51cc5840b66c9565e1740c1198a0e684d81e3734 commit 51cc5840b66c9565e1740c1198a0e684d81e3734 Author: Olivier Certner AuthorDate: 2026-04-28 13:10:14 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:27:57 +0000 MAC/do: Configuration: Fix default values: Remove jail creation method mac_do_jail_create() would create a default configuration on the just-created jail, erroneously causing mac_do_jail_set() to then retrieve it and use it as a model when determining the default values for not-specified parameters, instead of using the configuration applicable to the parent jail. Setting a default configuration in mac_do_jail_create() had been done as a kind of defensive measure to prevent a created jail not to have a configuration (effectively making it inherit from an ancestor jail, which is a security hazard except if explicitly requested). However, this measure was never really effective (osd_jail_call(PR_METHOD_CREATE) in kern_jail_set() calls the PR_PETHOD_CREATE methods in an unspecified order, and stops at the first error), so we are forced to rely in any case on the fact that an error in a PR_METHOD_CREATE or PR_METHOD_SET method leads to stopping the jail creation process (which is the case today; see kern_jail_set()). 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 | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 7890af9bcfec..fb7eb00cd6d5 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1548,16 +1548,6 @@ SYSCTL_PROC(_security_mac_do, OID_AUTO, exec_paths, SYSCTL_JAIL_PARAM_STRING(_mac_do, exec_paths, CTLFLAG_RW, MAX_EXEC_PATHS_SIZE, "Jail MAC/do executable paths"); -static int -mac_do_jail_create(void *obj, void *data) -{ - struct prison *const pr = obj; - - set_default_conf(pr); - - return (0); -} - static int mac_do_jail_get(void *obj, void *data) { @@ -1879,12 +1869,14 @@ mac_do_jail_set(void *obj, void *data) /* * OSD jail methods. * - * There is no PR_METHOD_REMOVE, as OSD storage is destroyed by the common jail - * code (see prison_cleanup()), which triggers a run of our dealloc_jail_osd() - * destructor. + * There is no PR_METHOD_REMOVE method, as OSD storage is destroyed by the + * common jail code (see prison_cleanup()), which triggers a run of our + * dealloc_jail_osd() destructor. There is neither a PR_METHOD_CREATE as + * PR_METHOD_SET is called just after (or the created jail destroyed if some + * PR_METHOD_CREATE fails), and our mac_do_jail_set() will ensure a jail is + * properly configured. */ static const osd_method_t osd_methods[PR_MAXMETHOD] = { - [PR_METHOD_CREATE] = mac_do_jail_create, [PR_METHOD_GET] = mac_do_jail_get, [PR_METHOD_CHECK] = mac_do_jail_check, [PR_METHOD_SET] = mac_do_jail_set, From nobody Fri May 29 16:01:48 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 4gRp591kFNz6fl7y for ; Fri, 29 May 2026 16:01:49 +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 4gRp585zq4z3Hsd for ; Fri, 29 May 2026 16:01:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070508; 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=PqviM8v3AcrhTZ1hLo02YCe/YV7AeKwOTakhPitDD1Y=; b=juy9Ebl+m48K2evFt3BzbrLFILDzKDZW6Tv/pnafCmH9cp78y64Yle//cVVcNpCS4L68or ee4zQKbNsvRkWxr2C2fB7QFj6h+dh4dxR32Hwt8gbgiK3WTE2yw47lqCdDIp6g/EVfIQad r7fb+fXYvSPqh8X/GavGzm5kkipeN6PkFTU+vvjj44vFRSb6hXg/xTRgcdtNe4tdxEsP0z EkkXxek0Rvs7G4eSN2M16pVTOcFQVWWvkGd5DDu9cql8Cy/c7G1N59m2i0a8dVw6w1jXGY dZVwCg3BsVzEatVqdZUY7ZBsZMjuGh53xCk3XB7bTlERzFExDTBJgWYqVHSOQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070508; a=rsa-sha256; cv=none; b=UUN1uBNk2AY7IYHxsUmI/XE8gwmHVxZjQCsv+Ttkbie18AYjKG331MUJhwGsjgmrE8ifeN j2eU2W4ppGrFbdw6Cz5CnVHPg1Bbe+1qHQgETlfv1oJvqS0jQiDDjCo1AefxVEbtvZQZBd SHBdmFo0aJA//7D7TgW7Wo3N0F9w9ZH7p229B2/6aH/K/6H5yyF+vSjz5MuZd6Sh55XN38 5foRWa9W8u0jAPQ5pcj5tmYPF6LK3AIIGrZhgpZjc/Kj/TsyoeIdyB7xR/gJP6kEytJ4QC FzReDFnJY5GRSbQZfm9mWsYIYHygPnCGAM85UuVXI9oiscXhKGRToKnK+5g5yA== 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=1780070508; 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=PqviM8v3AcrhTZ1hLo02YCe/YV7AeKwOTakhPitDD1Y=; b=BYJFpaY7Al6cFUSYvULZCiqPpJeM2U5F21w7iwjMYCF4YfBrVxqADQ38zozO196dDOx5PJ Md8On8qeLUn381asrWhyK+ovMnOqFqFdTl5qKFktMgli/jP8Y/NMxqHSMSqwYYXhX1p5r8 x5WjRsxSEA7cpFLZV/onrPXmfEuclKKUWlOSfbLkqQm7q4ExemHUfdyrhidVLG6+SwCNiq tFxMgPhUrdNkx65jESbmskHW0I3U6tm3eMT61IbrbQOXUbP4LETD1K005JdBi25eaLl5mb gmX2TIUD8LFHtj0UrKNz2HxdpAOl9ICV0CpOHds2YhoWyNPYir1oew9eOodFyA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp585SCBzgrn for ; Fri, 29 May 2026 16:01:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3652c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:48 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 7929f364ef51 - main - MAC/do: Fix the recent logic to set jail parameters, make it more tolerant 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: 7929f364ef5135f712e061d291d1c2c0fb48abde Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:48 +0000 Message-Id: <6a19b86c.3652c.80b6732@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=7929f364ef5135f712e061d291d1c2c0fb48abde commit 7929f364ef5135f712e061d291d1c2c0fb48abde Author: Olivier Certner AuthorDate: 2026-04-28 12:40:19 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:27:30 +0000 MAC/do: Fix the recent logic to set jail parameters, make it more tolerant The logic introduced in the initial commit for the "executable paths" feature did not match the specification we discussed in that specifying an empty value (for rules or executable paths) on "mac.do" being "new" would be treated as an absence of value and trigger a copy from the currently applicable configuration, instead of being an override that deactivates mac_do(4) in the jail. Fix that by distinguishing both cases. More generally, a non-explicitly specified parameter is set to the same value it has in the currently applicable configuration (that of the closest ancestor jail that has one; 'prison0' (the host) always has one), with an exception in the disable case. On disable (explicit: "mac.do" to "disable", implicit: no parameters passed, or at least one is empty), now accept parameters with a non-empty value as long as at least one of them is empty (which alone is enough to disable mac_do(4)). If no parameters are passed, both are copied from the currently applicable configuration; if none of them is empty, then the rules are emptied to effectively disable mac_do(4) (see the inline comment as to why this was chosen). On explicit enable ("mac.do" to "enable"), allow not specifying any of the rules and executable paths, in which case both are copied from the currently applicable configuration (consistently with what is done when only one is missing). Note that, as mentioned above, not specifying any of them by default still resolves to disabling mac_do(4) (i.e., on no explicit "mac.do" parameter). On (explicit) inheritance, allow specifying non-empty parameters, provided they match the values we are going to inherit. This enables re-applying jail parameters' reported values verbatim to the current jail (idempotence) or, e.g., to some sibling jail. (While here, make some existing code easier to read by leveraging is_null_or_empty().) 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 | 201 ++++++++++++++++++++++++++++++------------- 1 file changed, 140 insertions(+), 61 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 493dcaf66f89..7890af9bcfec 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -326,6 +326,18 @@ unexpected_flags: #define check_type_and_type_flags(...) #endif /* INVARIANTS */ +static bool +has_rules(const struct rules *const rules) +{ + return (rules->string[0] != '\0'); +} + +static bool +has_exec_paths(const struct exec_paths *const exec_paths) +{ + return (exec_paths->exec_paths_str[0] != '\0'); +} + /* * Returns EALREADY if both flags have some overlap, or EINVAL if flags are * incompatible, else 0 with flags successfully merged into 'dest'. @@ -1598,7 +1610,7 @@ mac_do_jail_check(void *obj, void *data) struct vfsoptlist *opts = data; char *rules_string, *exec_paths_string; int error, jsys, rules_size = 0, exec_paths_size = 0; - bool has_rules, has_exec_paths; + bool absent_or_empty_rules, absent_or_empty_exec_paths; error = vfs_copyopt(opts, "mac.do", &jsys, sizeof(jsys)); if (error == ENOENT) @@ -1661,22 +1673,17 @@ mac_do_jail_check(void *obj, void *data) } } - /* - * 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. - */ - has_rules = rules_string != NULL && rules_string[0] != '\0'; - has_exec_paths = exec_paths_string != NULL && - exec_paths_string[0] != '\0'; + absent_or_empty_rules = is_null_or_empty(rules_string); + absent_or_empty_exec_paths = is_null_or_empty(exec_paths_string); /* 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). + * is to disable. We never implicitly inherit, as that changes + * reasoning about configurations. */ - if (has_rules || has_exec_paths) + if (!absent_or_empty_rules || !absent_or_empty_exec_paths) jsys = JAIL_SYS_NEW; else jsys = JAIL_SYS_DISABLE; @@ -1685,31 +1692,38 @@ mac_do_jail_check(void *obj, void *data) /* Final checks based on resolved 'jsys'. */ switch (jsys) { case JAIL_SYS_DISABLE: - case JAIL_SYS_INHERIT: - if (has_rules) { - vfs_opterror(opts, - "'mac.do.rules' specified but should not be when " - "'mac.do' is 'disabled' or 'inherited'"); - return (EINVAL); - } - if (has_exec_paths) { + /* + * Tolerate specified but empty rules or execution paths + * (instead of not being specified). Also, tolerate that one of + * them is not empty (but not both). Indeed, as soon as one is + * empty, mac_do(4) is effectively disabled. This allows the + * administrator to still specify a value for one of them, which + * is then used for new sub-jails that do not inherit and for + * which no value for the parameter is explicitly specified + * (because then the value passed here is copied). + */ + if (!absent_or_empty_rules && !absent_or_empty_exec_paths) { vfs_opterror(opts, - "'mac.do.exec_paths' specified but should not be " - "when 'mac.do' is 'disabled' or 'inherited'"); + "One of 'mac.do.rules' and 'mac_do.exec_paths' " + "should not be specified or should be empty when " + "'mac.do' is 'disabled'"); return (EINVAL); } break; - case JAIL_SYS_NEW: - if (!has_rules && !has_exec_paths) { - vfs_opterror(opts, "'mac.do' set to 'new' but neither " - "rules nor executable paths specified"); - return (EINVAL); - } + case JAIL_SYS_INHERIT: + /* + * Canonically, no parameters should be specified in this case. + * However, we tolerate empty ones, and also non-empty ones + * provided they match the inherited values, so that we can + * report the *resolved* value of current parameters via + * mac_do_jail_get() and have them re-applicable to this jail in + * a similar situation. Testing that inherited values are the + * same as passed ones is more expensive than a single test and + * requires some atomicity, which is why we do not perform that + * here but only in mac_do_jail_set(). + */ break; - - default: - __assert_unreachable(); } return (0); @@ -1718,13 +1732,13 @@ mac_do_jail_check(void *obj, void *data) static int mac_do_jail_set(void *obj, void *data) { - struct prison *pr = obj; - struct vfsoptlist *opts = data; + struct prison *const pr = obj; + struct vfsoptlist *const opts = data; char *rules_string, *exec_paths_string; struct parse_error *parse_error = NULL; struct conf *model_conf; int error, jsys; - bool has_rules, has_exec_paths; + bool absent_or_empty_rules, absent_or_empty_exec_paths; /* * The invariants checks used below correspond to what has already been @@ -1741,59 +1755,124 @@ mac_do_jail_set(void *obj, void *data) exec_paths_string = vfs_getopts(opts, "mac.do.exec_paths", &error); MPASS(error == 0 || error == ENOENT); - has_rules = rules_string != NULL && rules_string[0] != '\0'; - has_exec_paths = exec_paths_string != NULL && - exec_paths_string[0] != '\0'; + absent_or_empty_rules = is_null_or_empty(rules_string); + absent_or_empty_exec_paths = is_null_or_empty(exec_paths_string); if (jsys == -1) { - if (has_rules || has_exec_paths) + if (!absent_or_empty_rules || !absent_or_empty_exec_paths) jsys = JAIL_SYS_NEW; else jsys = JAIL_SYS_DISABLE; } if (jsys == JAIL_SYS_INHERIT) { - MPASS(!has_rules && !has_exec_paths); - remove_conf(pr); - return (0); + error = 0; + + if (!absent_or_empty_rules || !absent_or_empty_exec_paths) { + /* + * Some values specified. Check that they match the + * ones we are going to inherit. + */ + model_conf = find_conf(pr->pr_parent, NULL); + if (strcmp(model_conf->rules.string, rules_string) + != 0) { + error = EINVAL; + vfs_opterror(opts, + "'mac.do' is 'inherited' but 'mac.do.rules'" + " was specified with a different value " + "than the one to be inherited (\"%s\")", + model_conf->rules.string); + } + if (strcmp(model_conf->exec_paths.exec_paths_str, + exec_paths_string) != 0) { + error = EINVAL; + vfs_opterror(opts, + "'mac.do' is 'inherited' but " + "'mac.do.exec_paths' was specified with a " + "different value than the one to be " + "inherited (\"%s\")", + model_conf->exec_paths.exec_paths_str); + } + drop_conf(model_conf); + } + + if (error == 0) + /* + * There's no TOCTOU problem here as the removal of the + * current jail's configuration commutes with changing + * the inherited configuration we checked against. + */ + remove_conf(pr); + + return (error); } model_conf = NULL; switch (jsys) { case JAIL_SYS_DISABLE: - rules_string = ""; - has_rules = true; - /* FALLTHROUGH */ - - case JAIL_SYS_NEW: /* - * If 'pr' has a configuration, we want to use it as the model - * (i.e., only change what has been explicitly specified). - * Else, we want as default values those that are inherited. + * mac_do(4) is disabled iff one of the parameter's string is + * empty. The parse_and_set_conf() call below treats passing + * NULL for a parameter as a flag to copy its value from the + * relevant ancestor jail's configuration, so we have to watch + * for the final result having an empty parameter if no + * parameter has been explicitly passed as empty. Thanks to + * mac_do_jail_check(), we know that at least one parameter is + * absent or empty (see the comment for the corresponding case + * there). */ - model_conf = !has_rules || !has_exec_paths ? - find_conf(pr, NULL) : NULL; - error = parse_and_set_conf(pr, - has_rules ? rules_string : NULL, - has_exec_paths ? exec_paths_string : NULL, - model_conf, - &parse_error); - - if (error != 0) { - vfs_opterror(opts, - "MAC/do: Parse error at index %zu: %s\n", - parse_error->pos, parse_error->msg); - free_parse_error(parse_error); + MPASS(absent_or_empty_rules || absent_or_empty_exec_paths); + if (!absent_or_empty_rules) + exec_paths_string = ""; + else if (!absent_or_empty_exec_paths) + rules_string = ""; + else { + /* + * Both are either empty or absent. If at least one is + * absent, we retrieve the applicable configuration as + * it will serve as a template (provides default + * values). + */ + if (rules_string == NULL || exec_paths_string == NULL) + model_conf = find_conf(pr, NULL); + /* If both are absent, we have to examine if, in the + * currently applicable configuration, one of the + * parameters, which we are going to copy, is + * effectively empty. If both of those are non-empty, + * we keep the executable paths and empty the rules, + * since we expect that this is more convenient to + * administrators that may want to enable mac_do(4) + * later by just setting new rules. + */ + if (rules_string == NULL && exec_paths_string == NULL && + has_rules(&model_conf->rules) && + has_exec_paths(&model_conf->exec_paths)) + rules_string = ""; } break; + case JAIL_SYS_NEW: + /* See the comment before the call to find_conf() above. */ + if (rules_string == NULL || exec_paths_string == NULL) + model_conf = find_conf(pr, NULL); + break; + default: __assert_unreachable(); } + error = parse_and_set_conf(pr, rules_string, exec_paths_string, + model_conf, &parse_error); if (model_conf != NULL) drop_conf(model_conf); + if (error != 0) { + vfs_opterror(opts, + "MAC/do: Parse error at index %zu: %s\n", + parse_error->pos, parse_error->msg); + free_parse_error(parse_error); + } + return (error); } From nobody Fri May 29 16:01:51 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 4gRp5C6DKdz6flSq for ; Fri, 29 May 2026 16:01:51 +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 4gRp5C0tnLz3Ht8 for ; Fri, 29 May 2026 16:01:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070511; 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=UPyxB1+DmC7XwYkDne/fdr1i3coui/Tvg3uKtfNN/gk=; b=l6zvZnZ/U9YTSCUGbo5zeMbn+58/Q2O2DWCLK+MsR58VE+prLRQpnidjGuXPEpMDFe/xmv eEoFyZMmmELMVZFcryOZG/qovqiculYHdiCyQHi30TTYmAK3HSzVrRCeKz/8lem9C3UFM/ AgaI4zJAJEDNRUSNjGmbC+SV19C3lPRnX3HgqWEGr/71vn5YjY7gLv1LjlhGjOvgHOecdc usnFTcZ9oL+JER3db8C/rC5+ea5RNhObf46OzG5PIDmIcHDFf3aqkmrhGJbnZCCaS5K44W iMCXh9FP4XXi3+8SpBfFV3GvODMQrwiovPw9Ztb+lyn37CfEIyoFb2YA6TGVkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070511; a=rsa-sha256; cv=none; b=NAxKNN/yP7c/LVkzxUqRre/NC2jfpdu5+izXnp0RjrWpoZ0uCIQagUyiMGMynvsZ3Yg0Vq peNXo2EjgSXUNbiDhZ9j5ySNuUO6H2Bl73/m5U9fpfV7QjE6rixdC0es3RtRVXZWo/uP+F 9504AJnCWgMHIklxRJGuKL9nExdPb2M0/D/LJnZyrNNzTdAzm/5USWKi0J51ihuCL/WTrr wn2BXfl1pdaZOM7BZc4eG2NNGLqsIq963YrwCvTe+Az7FLraGLj+YViEU174qso8159Z6L /AcfZMaue6hhldgTpMwedN/EsWBMgwl9s1oOlTHKTeL3sUK1ctaTl6vPrDT+2g== 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=1780070511; 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=UPyxB1+DmC7XwYkDne/fdr1i3coui/Tvg3uKtfNN/gk=; b=mFeyjLxv4JUEzFra3FKoEBr9zNRyLqcKDsBXMX6E//QRXtslr3ADRuEb7glRWKN2aL6xxn HHW5av49lA2hrIu6xPpZrE43al8IlX/88RLl74C5WZoaqyQvj7i1EEqnqGTioEuTo1iDdS XUacQ4hhVgPs7MANKHsJUxGR+BP4PTkJWWAWe66EpRGbWUI+0H4Xrhec0G1LV6lwedQoiO /rpAltUccWB9gQykibj82WAjryhLNQ2G3J7G4ylFI4LodlN0tppZPguor9zIkhSOe6nESe 342xThR29jUq3E6RPWw6EUbuJedzUX0bBgc1aNAungHahnNkyTmwmoWQLBi3KQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5C0DR8zg6k for ; Fri, 29 May 2026 16:01:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36109 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:51 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 888a84ceeded - main - MAC/do: Fix reporting of "mac.do" post-"executable paths" 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: 888a84ceeded9ef69903e352827cdef58163027e Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:51 +0000 Message-Id: <6a19b86f.36109.119d6c7b@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=888a84ceeded9ef69903e352827cdef58163027e commit 888a84ceeded9ef69903e352827cdef58163027e Author: Olivier Certner AuthorDate: 2026-04-28 13:17:18 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:28:29 +0000 MAC/do: Fix reporting of "mac.do" post-"executable paths" In mac_do_jail_get(), computation of 'jsys' had not been updated to take into account executable paths. 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index fb7eb00cd6d5..8ed1f18a8df6 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1560,9 +1560,8 @@ mac_do_jail_get(void *obj, void *data) const struct exec_paths *const exec_paths = &applicable_conf->exec_paths; int jsys, error; - jsys = hpr == pr ? - (STAILQ_EMPTY(&rules->head) ? JAIL_SYS_DISABLE : JAIL_SYS_NEW) : - JAIL_SYS_INHERIT; + jsys = hpr == pr ? (has_rules(rules) && has_exec_paths(exec_paths) ? + JAIL_SYS_NEW : JAIL_SYS_DISABLE) : JAIL_SYS_INHERIT; error = vfs_setopt(opts, "mac.do", &jsys, sizeof(jsys)); if (error != 0 && error != ENOENT) From nobody Fri May 29 16:01:53 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 4gRp5F4sdvz6flbd for ; Fri, 29 May 2026 16:01:53 +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 4gRp5F2PBqz3HrX for ; Fri, 29 May 2026 16:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070513; 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=zP/sch5TsaMpErHW3pzU41eq36eSYbzLGpmXQcPe0Yc=; b=q2UiR0flBRSejtxOLAGetdEOwNXXa+4ba9QXemntw4KApKmIA9LcX5VIlgX7q9IQS0siTx mFNEqN8cAfwrlYe3+0TnWI3LupYYK/fDTTKnGDGHiXgiAY1O3zoRv/ea7ZriP7FglpM34j wX0PznJJ507H3R0wLAtAwZJ4BAJj3v0B80k/Bn6Sa3QbVXO6Frlk7Y5cW78HgFknUsqvDy A3zZCL6tHVGjJaH2wWAatYTK3rBUrQisaEmR72XyY+gLDH0RHc3eA3Cfv+WOuaNgTXQ30n XbD4UgGMcDNZQDTnSd7G6uGvHcRu1kQXsGerzdBFwbAvzGQLFEvrHVuO4qCDZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070513; a=rsa-sha256; cv=none; b=uD6zt0et9n71iGLLJAfmeKUJjfvLYbaMo+X7ri74VLKoW2QvBXGG83AdI3wvqKjz0jG/5M Etu9c9atuTD6Cn7pgLN5TN2xJuDOMzmWHXHHfR6vV4u/RipDLqpEVU+9UCszXkX0+q1rxK j5IWPViccwHJxg2rr9udrYXUUAaaOQ1e7Mn0b6DrDj8ckkTiYT4Jr7UsYsh4/Ig0oRDrnY YftWF7MbX5Twg8MdnzZ9//5v0Otjgc7CjjZXdL31sjYTGtE4AmWPENy6d25aH6hlr6rvg/ Io19+CB0XB/I/eLiCf4k3PzI+BLTKqwzZOMzC62ApflZUidvHSk4CJmMhEgA/Q== 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=1780070513; 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=zP/sch5TsaMpErHW3pzU41eq36eSYbzLGpmXQcPe0Yc=; b=DL6zgR/V6yXimVBL5zyuQgRhAHH/FmOxFWcyZUQH+Y5RRmu5SQwak161/dEDoDuGJ2QZAN axTIZX4BKDDjjyOlQ8AZdGXOTuftwMVvs86Ecplcj2F3dAlbUdc07s9yf8SjlAh8wd9fni n4wmnIezFR2QLklWdivc8Fuv9u+5KRBAM5dHXN3pBe5tx4JOXvJEF0j9+pcguMXVYbOzav n1qSQ+iYSF/Q66X1kvP4oxq0eJ0thzVNELt3kycDnQerPA418fqfXMHL+N2f261P763/LH 7oqE5dgmCj7gDbtEMyQ0zb7jhE9fUVA4lay4M+22Wdtmpu3BhBfVMRXJz1JcPw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5F1qKHzgn4 for ; Fri, 29 May 2026 16:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32eef by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 31ef4ee2e357 - main - MAC/do: Allocate only one default configuration 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: 31ef4ee2e3570b8f438b9b3fb09b3d87c87419ff Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:53 +0000 Message-Id: <6a19b871.32eef.6cccea60@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=31ef4ee2e3570b8f438b9b3fb09b3d87c87419ff commit 31ef4ee2e3570b8f438b9b3fb09b3d87c87419ff Author: Olivier Certner AuthorDate: 2026-04-29 13:12:10 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:32:44 +0000 MAC/do: Allocate only one default configuration When mac_do(4) is loaded, all jails get the same default configuration (disabled, with only one allowed executable path: '/usr/bin/mdo'). Share it between all jails instead of creating a separate copy for each. 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 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 4feff477b18a..125054d15423 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1358,21 +1358,19 @@ set_conf(struct prison *const pr, struct conf *const conf) drop_conf(old_conf); } -/* - * Assigns the default configuration to a jail. - */ -static void -set_default_conf(struct prison *const pr) +static struct conf * +new_default_conf(void) { - struct conf *const conf = new_conf(); + const char *const mdo_path = "/usr/bin/mdo"; + struct conf *conf = new_conf(); - strlcpy(conf->exec_paths.exec_paths_str, "/usr/bin/mdo", + strlcpy(conf->exec_paths.exec_paths_str, mdo_path, MAX_EXEC_PATHS_SIZE); - strlcpy(conf->exec_paths.exec_paths[0], "/usr/bin/mdo", PATH_MAX); + strlcpy(conf->exec_paths.exec_paths[0], mdo_path, + PATH_MAX); conf->exec_paths.exec_path_count = 1; - set_conf(pr, conf); - drop_conf(conf); + return (conf); } static void @@ -2521,14 +2519,16 @@ mac_do_setcred_exit(void) static void mac_do_init(struct mac_policy_conf *mpc) { + struct conf *const default_conf = new_default_conf(); struct prison *pr; osd_jail_slot = osd_jail_register(dealloc_jail_osd, osd_methods); - set_default_conf(&prison0); + set_conf(&prison0, default_conf); sx_slock(&allprison_lock); TAILQ_FOREACH(pr, &allprison, pr_list) - set_default_conf(pr); + set_conf(pr, default_conf); sx_sunlock(&allprison_lock); + drop_conf(default_conf); osd_thread_slot = osd_thread_register(dealloc_thread_osd); } From nobody Fri May 29 16:01:52 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 4gRp5D4RW2z6flSx for ; Fri, 29 May 2026 16:01:52 +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 4gRp5D1d4Sz3HtK for ; Fri, 29 May 2026 16:01:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070512; 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=GykyDB2BRReoslKHTdQAHJMqTpFkvN248TAqpZ+J4p8=; b=xuMvGG6gNXUmFqf4kCjHQ5wzzczAJuu8HZQKpyE0mK4qPbMa8b7uX1KbU0pRFS8k0m/AgZ QDk29VPtqCi7laR1+d0SW+kZktRuzIDIgTVguVWQKz6HAvXqxycoPrOo85yVlLQh9NmHb8 r0yPEmtDV/LqWrzms2LDhLdDrySqOQxHOYTGYY9rqzpsiA9IH4pkTi7rpMJWNYzaW2ISoE IY319RZVqE7LE1Xtl1ise274q/ZBJrmVIlPVWrj/ZoicJbrirOKBTb1JG3+BeeJGWcTQnB CoUnzjBpL7F8IA7zX0pRgKvqtnL+wvxCwBzSy6JsiYBuAPraRQMElLbhdO8Vkg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070512; a=rsa-sha256; cv=none; b=qxTv7suKvYI9Hl8vqlBWkQPcsZt4c3zIO6eV6TkFpxNyGqGpvYiNWIhjonD+FMEFgmSXrO dzqmv3DCgRiGT5jdTNIQMhkom/yzd9yA+CKz76lcJKXXIQyBNNqT/jceipZIjZkIGQz9Wt hQWYQ8xCx6JTltrnEcM6fviNHcE4ibXF7tXo9V/YS+Fz0I+2CpNI930uZh3S9sbx2R4wU/ UGBQU3i4b45IOh+yr39LVxu+17ceLWXlB+7bE9y0kqjG9ZyvLkHcDuuRI4w4VTnvU4oi2/ buWm8J3OFoZ974/uTsijjVv7j66HKmuBEH3KkAxT/LzBnqcVsoelPEm8bQo02w== 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=1780070512; 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=GykyDB2BRReoslKHTdQAHJMqTpFkvN248TAqpZ+J4p8=; b=dN3Q6iU6EiIqA3hk/JjCix6P8MZ0yj8JfeTDm/ZdwS80tQXXjBGB7ouT6ui0XQ60Ooqm0t 4dnkdw2gB8u2n+fjEeWUKV2YgXugySP6JJ+X2qbMkFPic5B+H91KXCcZnCzwdGTlvU1T60 vBo1JUxwVFZXLvZ4EyDYHm4FM5A+oBa22rCiDc3kU5iKZp/2aNk+olCRoZtdsL5yVhHSp/ BwN+C5j4uRSQHo3mw6DDEp1Vv4DAtD8nbyu1kRnRZ+OYFq5l8M9+60w4hej6F/XWcQoZlg CXUpCW+wa2hMBCjqhjGfvWnKndI0E+zqG7ItK5iIKD0uYmDcY3JBVOUmBPqCOg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5D12NgzgCW for ; Fri, 29 May 2026 16:01:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3610d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 01e2b0ce1820 - main - MAC/do: Visually separate some file sections 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: 01e2b0ce1820adf475e372ec72371dffca17a7af Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:52 +0000 Message-Id: <6a19b870.3610d.21601de4@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=01e2b0ce1820adf475e372ec72371dffca17a7af commit 01e2b0ce1820adf475e372ec72371dffca17a7af Author: Olivier Certner AuthorDate: 2026-04-28 13:39:09 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:29:02 +0000 MAC/do: Visually separate some file sections With additional empty lines. No functional change (intended). Reviewed by: bapt 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 8ed1f18a8df6..4feff477b18a 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -33,6 +33,7 @@ #include + #ifdef INVARIANTS /* * Should typically be moved to libkern (and perhaps libc) at some point, and be @@ -226,6 +227,7 @@ struct id_elem { STAILQ_HEAD(id_list, id_elem); + #ifdef INVARIANTS static void check_type(const id_type_t type) From nobody Fri May 29 16:01:54 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 4gRp5G626gz6flWB for ; Fri, 29 May 2026 16:01:54 +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 4gRp5G3CmXz3J08 for ; Fri, 29 May 2026 16:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070514; 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=Ys50pLuQT+xKGkoHlKEr/0djjte9GEuo7DORh7nCsc4=; b=Vve/7JGkduvqy+zNeSEFPjJ3ogi2ECnAVz/DnsJxO+eFOp/iq5nN9x/Hg+aDVAnpUyBmez z3Xi1xNELWIYqqt5Q0BaG2Y1UUw8k94/9BwEjBsISQHzj1GNw+tZOF6YHYo4XS8uIPxBX6 4N7s5n4oIm2PLyOQaVO3+Et0y+QTp1d7E3WI9oobReJuBxgfJEhWq88/XdXsWStZQvKx04 3xanDqlbCYqpqIgxGQsO1hcsW5oKmDv9PDLtNfrkQs1bN3MQ1T8unjM9+6x4Z+UkjW80wi oF+gD4OjrRwffBkWdzvcszmpIzAaoNPmHiM8gPfsMSFWXpcw/ZmYjLuVDvo5ZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070514; a=rsa-sha256; cv=none; b=T7bW2F06Mc/NMv8AIakaMcoUcgb527yZ/FOXWYg1Gr7bJdEhbWEWv+ptRmUtWIufe49DZ7 rWiYACipUQnbwFY0+ZY7N/t0DdsTyRytjywCQuiUl8VfTCQIHD830AERrzt7UEE7FTsMVz 3zZXz+C5DoOftg5FwcT9yl82rwlSFuP59rRIjZ6WkdVDuh25F1o3/aCixvQJ8jb/eAuL8w rM95BsqipZnn8wwC+tbXHV5AZLYL7MAi9DVxEIBdMK7M06cd8hHETh5aCHkTJDKB9tCPwq 2f04rYX3ifMUFgzTXfqpwOKPnV53UJDer5VEcrnxB256bOd8nlL3B6Y1GH2JLA== 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=1780070514; 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=Ys50pLuQT+xKGkoHlKEr/0djjte9GEuo7DORh7nCsc4=; b=L0lPZTvBwd8mDDrMmjphqPCHLRfFp7wQnDgo3HQgXX3dVL5ovOkDwbf+tEa+aSYVG5O3WO 8JyzAY/tQdQf9gdlv1SohYMewCI3IaZXkJF858d7mDhfoyb67wXgiV8h7MGv+TgV50FJKf nuVzCTwzqVCKS+5Q6o0itcXsFB3/Cw0+jQWRuQLcC2J+zY2JquyvZL216ySUNeQftfqeYq HXRT3QH6Jum8ofhH/a0ukgagFc7jWVwOx2NajsGrTGjUHa+7y4xB42M4p9iwo30NKZYwJq 1IQbSYufpnJ5VqbDOtquZkJKQ+VK9CP7HUzjkvKo7XZJrsLgFmmm8IiQixOKug== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5G2fFkzgrp for ; Fri, 29 May 2026 16:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36802 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 5bedb5e44757 - main - MAC/do: Comment to explain the main invariant for configurations 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: 5bedb5e44757ba83dba9d618f5b951416cf44345 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:54 +0000 Message-Id: <6a19b872.36802.4ec96f57@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=5bedb5e44757ba83dba9d618f5b951416cf44345 commit 5bedb5e44757ba83dba9d618f5b951416cf44345 Author: Olivier Certner AuthorDate: 2026-04-29 17:11:34 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:33:24 +0000 MAC/do: Comment to explain the main invariant for configurations Once visible, configuration structures must *never* change. Spell that out in a comment to help future readers/contributors understand the design. Reviewed by: bapt 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 125054d15423..4e7a65ae2cae 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -210,6 +210,11 @@ struct exec_paths { int exec_path_count; }; +/* + * Once in use, i.e., being pointed to by a jail, a configuration structure MUST + * NEVER CHANGE (except for the 'use_count' field). This invariant is + * fundamental to correctness! + */ struct conf { struct rules rules; struct exec_paths exec_paths; From nobody Fri May 29 16:01:56 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 4gRp5K1JZCz6flY5 for ; Fri, 29 May 2026 16: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 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 4gRp5J57XDz3Hjy for ; Fri, 29 May 2026 16: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=1780070516; 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=GbNuzTqwyTCC0cVWzUkf68J0UDfnxk9u8tQCpDAhcac=; b=ZBa/fJKqiHbtB81xddd3V3aC8ejmqoSNb9eoVJxbc6LM/61Y+SbrPfaHBGMhvFMqJfKfEa aEHihpgJIR1LCjwvMkEWUGKmIpG5aAiSTiDvF7Now/R6nqyEN9WEIjLhHbgXjLPS54zjSS r1hi4yvQrpfJumI56a0FY/hNcobKxN2cf/7Mx4nmS4MWWdkouSzBCneB4o7oGQCJ+9P8oO WMEZTMjWJgXTzcB6LlfVPgvi35KIQW9HurKzFPw8oX/i6GjfDpJzcTWcgSu3zaDVwisr95 8uGoyYDjMMAmG51Pd3H08tONVaZeoyUTvGKm6s0Fnb9vSTLKZ4+VEPhid6h+sA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070516; a=rsa-sha256; cv=none; b=NB9eSayImmuDs1uCL8dyizRghH7QPrsnmlM4NgxNFPzlGze0SK8xMEJX4Mt9yB+IN6AZQu 9RidTi/77CGR6JAJfQVknxgYRMq3f3Se1+O1wckInq+vuFl4FcLy6nx4V0couyzkrbGsnY ptbVnCvjwgO0/sLcKlV3lqaPs01v8Q/lX8QkNgERMwIHTTQTy45fjeFNwaBCk6mtf3682u gulcOcSXqmFWpxS3g48+CUGcq+zoPipqBqTAxHxW/eZDy8aeRRoJEjzXJ6hQ6MZgJxisKI zzu6K+nyT27oGxK7wBzi9tNR8ucySdj5gnCOKrVkJyaevEztEvna70bxioaDHw== 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=1780070516; 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=GbNuzTqwyTCC0cVWzUkf68J0UDfnxk9u8tQCpDAhcac=; b=VsCXN31YAQBLlumKi11x2ZG14U9TIDVvACDmQL4srSvwdy/IwiLEQajxKtMGQFitwz8ptE gIMLUIRX0K6ZF0FLE6Qmu557Dd8HRHeWTe0m7hivtdZ5R8/9DtNP39OfySQyXUT5r1/Nzv PxC52OeCnj4FYeWxVorJyNxVhOtBhP5sCBfjwV9zTHcBoBtbeLD5AwZeoPAqvMiyubAE0T DjXS59+Yhr9kqfIqDgYA1UeIDeZN2pRx5NdzPfVND0Bypx7fhU7PTYPdnsvTdg0aY72IHM brh8EWDK4OqMLQJQ/FplgfcDT84kPESyOQxp3cV5gw/NoWMbc4bs22T9TcVpnA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5J4HhYzg6p for ; Fri, 29 May 2026 16:01:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 367a6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 0db7f110cb81 - main - MAC/do: Support for atomically modifying configurations 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: 0db7f110cb810b7aa6d29df221edf9091d66b58a Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:56 +0000 Message-Id: <6a19b874.367a6.3a018215@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=0db7f110cb810b7aa6d29df221edf9091d66b58a commit 0db7f110cb810b7aa6d29df221edf9091d66b58a Author: Olivier Certner AuthorDate: 2026-04-29 16:28:44 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:35:19 +0000 MAC/do: Support for atomically modifying configurations As mentioned in previous commits "MAC/do: parse_and_set_conf(): Require the model configuration" and "MAC/do: Sequential consistency for configuration retrieval", the introduction of the "executable path" feature, more fundamentally, the fact that there is now more than one per-jail parameter and that parameters can be independently modified or copied, causes an atomicity problem in case of concurrent accesses to of a jail's applicable configuration. Partially modifying a configuration is indeed akin to a read-modify-write operation, where the read is either to the current or an inherited configuration. More precisely, once pointed to by a jail, a configuration object is immutable, and changing the jail's configuration means making the jail point to another configuration object. To change a jail's configuration, a new configuration object is thus built, and if only some parameters have been explicitly specified, those that have not been are set by copying the corresponding values from an existing configuration object (in case of partial modification of the existing configuration, from the original configuration object that is going to be replaced; in case of breakage of inheritance or at jail creation, from the applicable configuration object, which is on an ancestor jail). This process is not immune to concurrent modifications because nothing prevents changes of configurations between reading existing values and setting the new configuration. Thus, some other thread could change the value of a parameter after a copy of it has been made into the new object but before that copy is actually installed, which effectively will erase the other thread's modification. To avoid this, we introduce support for serializing configuration changes on a given jail. To this end, we move the jail climbing process from find_conf() into find_conf_locked(), and make the former call the latter in a read-locked section. Similarly, we isolate setting a configuration in the new set_conf_locked() function, and make set_conf() call it inside a write-locked section. The new *_unlocked() variants make it possible to prevent any configuration access between determining and reading an applicable configuration, computing from it a new configuration object and finally setting it, by holding a write lock over the whole process (there is a trade-off here, as read-mostly locks cannot be upgraded), effectively making it atomic and realizing full sequential consistency of configuration changes. Also, the 'mac_do_rm' global read-mostly lock is made sleepable so that it can be write-locked over sysctl_handle*() functions or memory allocations (eases implementation, at the expense of a potential loss of concurrency which is most probably irrelevant). No functional change (intended) at this point. 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 | 64 +++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 3775466326f4..8065ff4a0e47 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1244,13 +1244,12 @@ drop_conf(struct conf *const conf) * one, establishing inheritance from higher up). */ static struct conf * -find_conf(struct prison *const pr, struct prison **const hpr) +find_conf_locked(struct prison *const pr, struct prison **const hpr) { struct prison *cpr, *ppr; /* Current and parent. */ struct conf *conf; - struct rm_priotracker rmpt; - rm_rlock(&mac_do_rml, &rmpt); + rm_assert(&mac_do_rml, RA_LOCKED); /* * We do not need to take any locks here to climb the prison tree as * either the start prison ('pr') is that of the current thread (and our @@ -1278,11 +1277,20 @@ find_conf(struct prison *const pr, struct prison **const hpr) } hold_conf(conf); - rm_runlock(&mac_do_rml, &rmpt); - if (hpr != NULL) *hpr = cpr; + return (conf); +} + +static struct conf * +find_conf(struct prison *const pr, struct prison **const hpr) +{ + struct conf *conf; + struct rm_priotracker rmpt; + rm_rlock(&mac_do_rml, &rmpt); + conf = find_conf_locked(pr, hpr); + rm_runlock(&mac_do_rml, &rmpt); return (conf); } @@ -1330,22 +1338,29 @@ dealloc_jail_osd(void *const value) } /* - * Assign an already-built configuration to a jail. + * Sets a mac_do(4) configuration on a jail. * - * Takes care of write-locking 'mac_do_rm', which should be unlocked on entry - * and will be unlocked on exit. + * 'conf' is the new conf to set (can be NULL), and an additional reference will + * be taken on it to represent the jail holding it (if not NULL). 'rsv' must + * have been allocated through osd_reserve() (if 'conf' is not NULL; else can + * be NULL). + * + * The previous configuration on the jail (or NULL) is returned (with an + * associated reference if not NULL). */ -static void -set_conf(struct prison *const pr, struct conf *const conf) +static struct conf * +set_conf_locked(struct prison *const pr, struct conf *const conf, + void **const rsv) { - void **const rsv = conf != NULL ? osd_reserve(osd_jail_slot) : NULL; struct conf *old_conf; int error __diagused; + KASSERT(conf == NULL || rsv != NULL, + ("MAC/do: OSD reserve needed to avoid allocating memory")); + rm_assert(&mac_do_rml, RA_WLOCKED); + if (conf != NULL) hold_conf(conf); - - rm_wlock(&mac_do_rml); old_conf = osd_jail_get_unlocked(pr, osd_jail_slot); error = osd_jail_set_reserved(pr, osd_jail_slot, rsv, conf); KASSERT(error == 0, ("MAC/do: osd_jail_set_reserved() failed " @@ -1356,8 +1371,27 @@ set_conf(struct prison *const pr, struct conf *const conf) * destructor since we've just put NULL into the slot. */ osd_jail_del(pr, osd_jail_slot); - rm_wunlock(&mac_do_rml); + return (old_conf); +} +/* + * Immediately replace the jail's configuration. + * + * To be used only if the configuration to set does not depend in any way on the + * currently applicable configuration. + * + * Takes care of write-locking 'mac_do_rml', which should be unlocked on entry + * and will be unlocked on exit. + */ +static void +set_conf(struct prison *const pr, struct conf *const conf) +{ + void **const rsv = conf != NULL ? osd_reserve(osd_jail_slot) : NULL; + struct conf *old_conf; + + rm_wlock(&mac_do_rml); + old_conf = set_conf_locked(pr, conf, rsv); + rm_wunlock(&mac_do_rml); if (old_conf != NULL) drop_conf(old_conf); } @@ -2540,7 +2574,7 @@ mac_do_init(struct mac_policy_conf *mpc) struct conf *const default_conf = new_default_conf(); struct prison *pr; - rm_init(&mac_do_rml, "mac_do(4)"); + rm_init_flags(&mac_do_rml, "mac_do(4)", RM_SLEEPABLE); osd_jail_slot = osd_jail_register(dealloc_jail_osd, osd_methods); set_conf(&prison0, default_conf); From nobody Fri May 29 16:01:55 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 4gRp5H6RM8z6fl21 for ; Fri, 29 May 2026 16:01:55 +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 4gRp5H4ND6z3Hws for ; Fri, 29 May 2026 16:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070515; 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=SOkpJ5aV+tGfIhxOoS9Yw9Z3HFKnnxeoqxMYWh5UtVE=; b=SWbT3uWLd9eMSmS/jQhfL4ihpLz5XJXS2I9CW4EszvUKWMN17QRU3szPVluCoIyb6m6FGN ru4if33lQYifdmMEnzW8jcTuczeGglpT7mbEiJVv1/KHzaWOsHKhIKyuSqtTd1qqfZ4Jn5 /geFctogO/ErD8JU7qWiywhn2feHHAUHDloLaINRSZG3D0HYNAi7FvPhnlpdeIPzOmp5pb lEcjFSSJ61tYTxfmajTxW/0X6hDGP+3oMYqaZDTV3SVJtiTvoF0fQJZ2P/mrLcXasfmoAo 4DmjV7SZ7QTfBRe0cFH1P1TozLlI/AG6H1XliE9tdG1obDNVxE03TMHVlefSwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070515; a=rsa-sha256; cv=none; b=bDgBdr/8tjR4+XP/R38kNVypMeui6XWQJMdkTk7ZlhFPYJFHSqEI706J1UIO6TVHjiXudy MtBWZYM3bOYcEths8barjhJ9CIbdhAjX9bkwjGKv4lyu6Tf3F0qbU4oqYSXRLcY3jsVN65 TUsukx06ZPDXmOzyjCzB058e6NYBx352Imbpz1Oxf0SCDB/UtJnAyMwwlrgjqxLhcPwQ+Q LBQypxH7VXroHsxc/Y7zapvRpPdKOChqbGz+raTsRUReA/8lE2ergEpyavUonaVo2vKKQN hV7uDvvWaESQR7cYtH/d1iqiGHEDKgGduFIMmFY+knCY8Cx3uGmvxfVPkQFeUw== 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=1780070515; 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=SOkpJ5aV+tGfIhxOoS9Yw9Z3HFKnnxeoqxMYWh5UtVE=; b=NM9Q6MPLd06iprS/xTzIFXpM99d3/wFMSEfrAGqAIeJVIgEMd8Sxo8gIdbKjScM0pDKHUQ bKehTFKlkVn1do8d3ghwnPy+/ASoSo2W9U6Yn8fg4ii1SkVVrLWtt43ur9yhONXc/nhu+s uuCpC18VikSV/T5LJCbplYcW00p/WrF/qT8D3Ft92fIOY7qdJVYwj1M8/BUY+0Ay1JdrUE ciJKG2G87SDluLdYeA9EuLGie5mfLhBgerY2m//90da9LvOI/PI0h8YxlmAxGFbRD54rlb 8lmvpU/vjkgn1TkRuV2TQ19HRyGpnFL47McGXcvK19uzKHAnRJlrqqclTign6A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5H3TGjzgCb for ; Fri, 29 May 2026 16:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3403d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 5b194a4ae319 - main - MAC/do: Sequential consistency for configuration retrieval 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: 5b194a4ae3190a9954544058dfc0790fd9a16172 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:55 +0000 Message-Id: <6a19b873.3403d.51353838@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=5b194a4ae3190a9954544058dfc0790fd9a16172 commit 5b194a4ae3190a9954544058dfc0790fd9a16172 Author: Olivier Certner AuthorDate: 2026-04-29 17:14:13 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:34:04 +0000 MAC/do: Sequential consistency for configuration retrieval Since the inception of mac_do(4), find_conf(), used to retrieve the applicable configuration, has been weakly consistent with respect to concurrent modifications to configuration inheritance that influence its result (and it has been sequentially consistent with respect to other configuration modifications, which the initial executable paths feature and introduction of implicit parameters broke and which will be fixed in a subsequent commit). Indeed, find_conf() climbs the jail tree to find an applicable configuration, which is not an atomic operation. It examines the current jail's configuration pointer for each browsed jail, which does not prevent concurrent modifications of the configuration pointer for jails below or above it. Modifications above the current jail are not a problem, since if climbing needs to continue (i.e., the current jail inherits), these modifications will be seen if performed before that check (and may or may not be seen if performed after that check). However, modifications below the current jail impair sequential consistency, because they could be done before other modifications at the current jail or higher up, and the latter could still be picked up by the rest of the climb, effectively ignoring that the former should have blocked the climb earlier, making them look as if they had happened after for the climbing thread. As a concrete example of this situation, let's examine a scenario where some jail A is the parent of some jail B, and B inherits its configuration from A. An administrator may want to relax the rules only for jail A but not B. To this end, he first copies the current rules on B over to A and then relaxes the rules on A. He can intuitively and reasonably expect that changing B's rules first will prevent A's relaxed rules to leak to threads in B. Unfortunately, that is not the case: As explained in the previous paragraph, there can be a time window where threads from B can still pick up A's new configuration just after it has been installed. This arguably makes changing inheritance in mac_do(4) in a fully secure fashion almost impossible. If preserving fine-grained locking of prisons, we could prevent this problem by having find_conf(), once it has climbed to a non-NULL pointer (actual, non-inherited configuration), do another climb to check that it can reach the same configuration on the same jail again. If the new climb gives another pointer or jail, it could make it the new candidate and do a climb check again until the situation stabilizes. A climb check detects whether changes in jails below that of the candidate configuration object happened, catching in particular such changes that happened before changes to the candidate object. However, that process alone would still be subject to ABA problems, and we would additionally need to tag each prison with some modification timestamp (global, or local but necessitating allocating memory during the check) to fix them. In the end, we considered this direction to be unnecessarily complex, given that configuration changes are to be rare events and most uses will just be configuration determination. Consequently, switch protecting jail configurations with a single read-mostly lock. While here, adapt set_conf() to accept NULL as the new configuration object, and have remove_conf() call it, which removes duplicated code. While here, add a comment explaining why we do not need to take any more locks when climbing the jail tree. Reviewed by: bapt 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 | 112 ++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 48 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 4e7a65ae2cae..3775466326f4 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,8 @@ _Static_assert(MAX_RULE_STRING_SIZE > 0, _Static_assert(MAX_EXEC_PATHS_SIZE > 0, "MAX_EXEC_PATHS_SIZE: No space for the NUL terminator!"); +struct rmlock mac_do_rml; + static unsigned osd_jail_slot; static unsigned osd_thread_slot; @@ -1228,28 +1231,46 @@ drop_conf(struct conf *const conf) * * If 'hpr' is not NULL, it is used to return a pointer to the (unlocked) prison * holding the applicable configuration. + * + * The find_conf_unlocked() variant needs 'mac_do_rml' to be (read- or write-) + * locked. The find_conf() variant will take a read lock for the duration of + * the search. + * + * The configuration returned by this function is sequentially consistent with + * other concurrent reads and configuration modifications, even in the presence + * of concurrent changes of configurations higher up in the jail tree (whether + * they "change" the value of some parameters, install a new configuration where + * there wasn't any, breaking inheritance from higher up, or remove an existing + * one, establishing inheritance from higher up). */ static struct conf * find_conf(struct prison *const pr, struct prison **const hpr) { - struct prison *cpr, *ppr; + struct prison *cpr, *ppr; /* Current and parent. */ struct conf *conf; + struct rm_priotracker rmpt; + rm_rlock(&mac_do_rml, &rmpt); + /* + * We do not need to take any locks here to climb the prison tree as + * either the start prison ('pr') is that of the current thread (and our + * ancestors are necessarily stable), or it is a prison passed by the jail + * machinery to an OSD method, in which case the prison tree lock is + * already being held. + */ cpr = pr; for (;;) { - prison_lock(cpr); - conf = osd_jail_get(cpr, osd_jail_slot); + conf = osd_jail_get_unlocked(cpr, osd_jail_slot); if (conf != NULL) break; - prison_unlock(cpr); ppr = cpr->pr_parent; /* - * 'prison0' normally always have a mac_do(4) configuration - * because we installed one on module load/activation and - * nothing can destroy it as 'prison0' is not a regular jail and - * the 'mac.do' parameter cannot be set to 'inherit' on it, - * which is the only way to clear an existing configuration. + * 'prison0' always has a mac_do(4) configuration because we + * installed one on module load/activation and nothing can + * destroy it as 'prison0' is not a regular jail and the + * 'mac.do' parameter cannot be set to 'inherit' on it, which is + * the only way to clear an existing configuration. */ KASSERT(ppr != NULL, ("MAC/do: 'prison0' must always have a configuration.")); @@ -1257,10 +1278,11 @@ find_conf(struct prison *const pr, struct prison **const hpr) } hold_conf(conf); - prison_unlock(cpr); + rm_runlock(&mac_do_rml, &rmpt); if (hpr != NULL) *hpr = cpr; + return (conf); } @@ -1308,59 +1330,50 @@ dealloc_jail_osd(void *const value) } /* - * Remove the rules specifically associated to a prison. - * - * In practice, this means that the rules become inherited (from the closest - * ancestor that has some). + * Assign an already-built configuration to a jail. * - * Destroys the 'osd_jail_slot' slot of the passed jail. + * Takes care of write-locking 'mac_do_rm', which should be unlocked on entry + * and will be unlocked on exit. */ static void -remove_conf(struct prison *const pr) +set_conf(struct prison *const pr, struct conf *const conf) { + void **const rsv = conf != NULL ? osd_reserve(osd_jail_slot) : NULL; struct conf *old_conf; - int error __unused; + int error __diagused; - prison_lock(pr); - /* - * We burden ourselves with extracting rules first instead of just - * letting osd_jail_del() call dealloc_jail_osd() as we want to - * decrement their use count, and possibly free them, outside of the - * prison lock. - */ - old_conf = osd_jail_get(pr, osd_jail_slot); - error = osd_jail_set(pr, osd_jail_slot, NULL); - /* osd_set() never allocates memory when 'value' is NULL, nor fails. */ - MPASS(error == 0); - /* - * This completely frees the OSD slot, but doesn't call the destructor - * since we've just put NULL in the slot. - */ - osd_jail_del(pr, osd_jail_slot); - prison_unlock(pr); + if (conf != NULL) + hold_conf(conf); + + rm_wlock(&mac_do_rml); + old_conf = osd_jail_get_unlocked(pr, osd_jail_slot); + error = osd_jail_set_reserved(pr, osd_jail_slot, rsv, conf); + KASSERT(error == 0, ("MAC/do: osd_jail_set_reserved() failed " + "with 'conf' = %p and 'rsv' = %p", conf, rsv)); + if (conf == NULL) + /* + * This completely frees the OSD slot, but doesn't call the + * destructor since we've just put NULL into the slot. + */ + osd_jail_del(pr, osd_jail_slot); + rm_wunlock(&mac_do_rml); if (old_conf != NULL) drop_conf(old_conf); } /* - * Assign an already-built configuration to a jail. + * Remove the rules specifically associated to a prison. + * + * In practice, this means that the rules become inherited (from the closest + * ancestor that has some). + * + * Destroys the 'osd_jail_slot' slot of the passed jail. */ static void -set_conf(struct prison *const pr, struct conf *const conf) +remove_conf(struct prison *const pr) { - struct conf *old_conf; - void **rsv; - - hold_conf(conf); - rsv = osd_reserve(osd_jail_slot); - - prison_lock(pr); - old_conf = osd_jail_get(pr, osd_jail_slot); - osd_jail_set_reserved(pr, osd_jail_slot, rsv, conf); - prison_unlock(pr); - if (old_conf != NULL) - drop_conf(old_conf); + set_conf(pr, NULL); } static struct conf * @@ -2527,6 +2540,8 @@ mac_do_init(struct mac_policy_conf *mpc) struct conf *const default_conf = new_default_conf(); struct prison *pr; + rm_init(&mac_do_rml, "mac_do(4)"); + osd_jail_slot = osd_jail_register(dealloc_jail_osd, osd_methods); set_conf(&prison0, default_conf); sx_slock(&allprison_lock); @@ -2547,6 +2562,7 @@ mac_do_destroy(struct mac_policy_conf *mpc) */ osd_thread_deregister(osd_thread_slot); osd_jail_deregister(osd_jail_slot); + rm_destroy(&mac_do_rml); } static struct mac_policy_ops do_ops = { From nobody Fri May 29 16:01:57 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 4gRp5L0Lvyz6flR2 for ; Fri, 29 May 2026 16:01:58 +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 4gRp5K5l2tz3J4q for ; Fri, 29 May 2026 16:01:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070517; 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=VT0r9zqvYaJ2EWnSSjgnZmOYcH1OrfSQoBQ64mV7jpY=; b=xgYa4QVOmae+mkT7WJkoP/+0X2Dn++yX8SDII1iSixutxsG5ct1sBWHfDaCh53o/JPCtj4 d9JLrAfg8ZXaooA8C6pBQvRtma/3prnqiacNoosEgliGqd/IJ9+b+r/QMtFceerw9n+zkj yiWJpq5NXTICQ5SmaZX1vMc6HdtUABRP5BVU9XyCwuRoTpBAMmAp4hBjCF4YuVaeoII8mr APlLpMPNHce5JtgYdPbgW6DrProHYyyLe66xI1/wh/PxitoX6dZbaN8WvIvm+zrO5oEaZF FlxRNVHkKabP/Iets9bv3nT6cFOZqtDQgf/IlKQowP4Gh09rd7zz1+wXIp08GA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070517; a=rsa-sha256; cv=none; b=jnuNZz2BjZkwfBvCy+M4yjF8PwxGbbDkr4fzN1xMf7awB2fYzop+9nnLjmc3q7mcO5tZ9g TP0qYcZBUnsIauCUy3yIALQ+9bd+t7GkkI3+SgS7aXtFyATJcAatNv9StHRZkPg7pXlgRr 6E5RZ3Pxeq40MJpxme+JrA1Si1NLgos9Z63J9aUstuT7Ch0n/VTTWHCxczKMFv8tubxPbM PDNSq89piuUJ5CP6n6NsnIZpMWQ15HaMrf9V6r/rriqwvC0jVfbj+tAdDGH4hE7OQmpuvq rzHWk2alvG4ZbaoJBWSoDIN+cLqni4F/s7b/H/Nnu8BDtTELqvQfgF++HBhnYg== 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=1780070517; 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=VT0r9zqvYaJ2EWnSSjgnZmOYcH1OrfSQoBQ64mV7jpY=; b=kdW90R14E8CxwQiyKA7zZAZLj8oFIl/z9PlNCQsJ7Ufz39DNxH2kGzgf9RfyO/t8ZuTtDO sWUfT3ENrUCIwIj29l+2piqnLpxClNx0FyXxJXeQ+VT939rXN36N82ea+3Tu/NlCKoL4a6 J5uPN/5RePayYCzNi4s6UmGu85hR+iAZbqz+sEIka+8gZmQ7dP9ESt4mxyjzazqg0b8+Xq eL7jr4ObED4E+q/rH3EoRIiYePtfSXpRTAmcDNciR2mJc7w5cpZgffygj96qr61aKyzfAy qDD1xLfwWib7vuRwmibf6cYQc/c1XxEeX5yUVCP9TvtQBCJuUUPQE2i8GQJilA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5K56hMzgCd for ; Fri, 29 May 2026 16:01:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36111 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 4c98f7a0025e - main - MAC/do: Serialize installing/modifying some jail's configuration 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: 4c98f7a0025eea550ecf6f93f818cd03c6ac0fd5 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:57 +0000 Message-Id: <6a19b875.36111.367fa35d@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=4c98f7a0025eea550ecf6f93f818cd03c6ac0fd5 commit 4c98f7a0025eea550ecf6f93f818cd03c6ac0fd5 Author: Olivier Certner AuthorDate: 2026-04-29 18:32:56 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:36:29 +0000 MAC/do: Serialize installing/modifying some jail's configuration See the immediately preceding commit for explanations on what this is fixing. When setting 'mac.do' to 'inherit' on a jail with 'mac.do.rules' and 'mac.do.exec_paths' also specified in the same call, ensure that the check that these passed parameters are the same as those to be inherited is atomic with respect to enabling the inheritance (i.e., removing the jail's 'struct conf' object). (See previous commit "MAC/do: Fix the recent logic to set jail parameters, make it more tolerant" as for why this check exists.) Because we currently only modify a single configuration object per transaction, we introduce the parse_and_commit_conf() wrapper around parse_and_set_conf() to remove duplicated code that would ensue from calling the latter directly, namely, releasing the 'mac_do_rwl' lock and freeing the old configuration object (if any). Taking the 'mac_do_rwl' lock for writing as a way to freeze all accesses to mac_do(4) configurations was deemed too thin an operation to be worth wrapping. Reviewed by: bapt (older version) 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 | 99 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 23 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 8065ff4a0e47..c30ece0a0794 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1404,10 +1404,10 @@ set_conf(struct prison *const pr, struct conf *const conf) * * Destroys the 'osd_jail_slot' slot of the passed jail. */ -static void -remove_conf(struct prison *const pr) +static struct conf * +remove_conf_locked(struct prison *const pr) { - set_conf(pr, NULL); + return (set_conf_locked(pr, NULL, NULL)); } static struct conf * @@ -1481,11 +1481,15 @@ clone_exec_paths(struct exec_paths *const dst, * parameters are copied from those of the passed model configuration (which is * expected to be the currently applicable configuration, i.e., that of the * closest ancestor jail that has one). + * + * 'mac_do_rml' needs to be write-locked (and stays so). 'old_conf' serves to + * return, on no error, the old configuration with a reference (which must be + * eventually freed). */ static int parse_and_set_conf(struct prison *const pr, const char *const rules_string, const char *const exec_paths_string, const struct conf *const model_conf, - struct parse_error **const parse_error) + struct conf **const old_conf, struct parse_error **const parse_error) { struct conf *const conf = new_conf(); int error = 0; @@ -1511,7 +1515,8 @@ parse_and_set_conf(struct prison *const pr, const char *const rules_string, clone_exec_paths(&conf->exec_paths, &model_conf->exec_paths); - set_conf(pr, conf); + MPASS(error == 0); + *old_conf = set_conf_locked(pr, conf, osd_reserve(osd_jail_slot)); MPASS(error == 0 && *parse_error == NULL); out: @@ -1522,6 +1527,30 @@ error: goto out; } +/* + * Calls parse_and_set_conf() and closes the current configuration transaction. + * + * Closes the transaction by unlocking 'mac_do_rml' and releasing the old + * configuration returned by parse_and_set_conf(). + */ +static int +parse_and_commit_conf(struct prison *const pr, const char *const rules_string, + const char *const exec_paths_string, const struct conf *const model_conf, + struct parse_error **const parse_error) +{ + struct conf *old_conf; + int error; + + error = parse_and_set_conf(pr, rules_string, exec_paths_string, + model_conf, &old_conf, parse_error); + rm_wunlock(&mac_do_rml); + + if (error == 0 && old_conf != NULL) + drop_conf(old_conf); + return (error); +} + + static int mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) { @@ -1531,14 +1560,23 @@ mac_do_sysctl_rules(SYSCTL_HANDLER_ARGS) struct parse_error *parse_error = NULL; int error; - conf = find_conf(pr, NULL); + if (req->newptr != NULL) { + rm_wlock(&mac_do_rml); + conf = find_conf_locked(pr, NULL); + } else + conf = find_conf(pr, NULL); strlcpy(buf, conf->rules.string, MAX_RULE_STRING_SIZE); error = sysctl_handle_string(oidp, buf, MAX_RULE_STRING_SIZE, req); - if (error != 0 || req->newptr == NULL) + if (req->newptr == NULL) + goto out; + if (error != 0) { + rm_wunlock(&mac_do_rml); goto out; + } - error = parse_and_set_conf(pr, buf, NULL, conf, &parse_error); + /* Unlocks 'mac_do_rml'. */ + error = parse_and_commit_conf(pr, buf, NULL, conf, &parse_error); if (error != 0) { if (print_parse_error) printf("MAC/do: Parse error at index %zu: %s\n", @@ -1571,14 +1609,23 @@ mac_do_sysctl_exec_paths(SYSCTL_HANDLER_ARGS) struct parse_error *parse_error = NULL; int error; - conf = find_conf(pr, NULL); + if (req->newptr != NULL) { + rm_wlock(&mac_do_rml); + conf = find_conf_locked(pr, NULL); + } else + conf = find_conf(pr, NULL); strlcpy(buf, conf->exec_paths.exec_paths_str, MAX_EXEC_PATHS_SIZE); error = sysctl_handle_string(oidp, buf, MAX_EXEC_PATHS_SIZE, req); - if (error != 0 || req->newptr == NULL) + if (req->newptr == NULL) goto out; + if (error != 0) { + rm_wunlock(&mac_do_rml); + goto out; + } - error = parse_and_set_conf(pr, NULL, buf, conf, &parse_error); + /* Unlocks 'mac_do_rml'. */ + error = parse_and_commit_conf(pr, NULL, buf, conf, &parse_error); if (error != 0) { if (print_parse_error) printf("MAC/do: Parse error at index %zu: %s\n", @@ -1807,14 +1854,17 @@ mac_do_jail_set(void *obj, void *data) } if (jsys == JAIL_SYS_INHERIT) { + struct conf *old_conf = NULL; + error = 0; + rm_wlock(&mac_do_rml); if (!absent_or_empty_rules || !absent_or_empty_exec_paths) { /* * Some values specified. Check that they match the * ones we are going to inherit. */ - model_conf = find_conf(pr->pr_parent, NULL); + model_conf = find_conf_locked(pr->pr_parent, NULL); if (strcmp(model_conf->rules.string, rules_string) != 0) { error = EINVAL; @@ -1838,23 +1888,25 @@ mac_do_jail_set(void *obj, void *data) } if (error == 0) - /* - * There's no TOCTOU problem here as the removal of the - * current jail's configuration commutes with changing - * the inherited configuration we checked against. - */ - remove_conf(pr); + old_conf = remove_conf_locked(pr); + + rm_wunlock(&mac_do_rml); + + if (old_conf != NULL) + drop_conf(old_conf); return (error); } model_conf = NULL; + /* Freeze configuration accesses. */ + rm_wlock(&mac_do_rml); switch (jsys) { case JAIL_SYS_DISABLE: /* * mac_do(4) is disabled iff one of the parameter's string is - * empty. The parse_and_set_conf() call below treats passing + * empty. The parse_and_commit_conf() call below treats passing * NULL for a parameter as a flag to copy its value from the * relevant ancestor jail's configuration, so we have to watch * for the final result having an empty parameter if no @@ -1876,7 +1928,7 @@ mac_do_jail_set(void *obj, void *data) * values). */ if (rules_string == NULL || exec_paths_string == NULL) - model_conf = find_conf(pr, NULL); + model_conf = find_conf_locked(pr, NULL); /* If both are absent, we have to examine if, in the * currently applicable configuration, one of the * parameters, which we are going to copy, is @@ -1894,16 +1946,17 @@ mac_do_jail_set(void *obj, void *data) break; case JAIL_SYS_NEW: - /* See the comment before the call to find_conf() above. */ + /* See the comment before the same test above. */ if (rules_string == NULL || exec_paths_string == NULL) - model_conf = find_conf(pr, NULL); + model_conf = find_conf_locked(pr, NULL); break; default: __assert_unreachable(); } - error = parse_and_set_conf(pr, rules_string, exec_paths_string, + /* Unlocks 'mac_do_rml'. */ + error = parse_and_commit_conf(pr, rules_string, exec_paths_string, model_conf, &parse_error); if (model_conf != NULL) drop_conf(model_conf); From nobody Fri May 29 16:01:58 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 4gRp5M0TKcz6flTJ for ; Fri, 29 May 2026 16:01:59 +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 4gRp5L6SW5z3Hvq for ; Fri, 29 May 2026 16:01:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070518; 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=vwQTyXCrb6lUOSci4Cq1MT1iZvK6jrrKQf5TJz8+P1A=; b=ZKyFWsaL6clTEx3+EqeFy/qNRbF7UteG8uaWn4UsIBppVCnqqL4m8rFULAggGAu+2dwAa8 wOHOFf4J6anTgkekeolIa8/9UMwIFt7J8TqTTsRTbZtpAlwPY0M1fyk/biRhoFNLsYtTVK h1HiYvniPRmV2V3Ae8ZMNY0UksDHnM64AxiiZ6mibNYojU1dRKsG9LvomaplqhjMyXBRjR U7VRDIWsn88tyMUomyqObPf9txj0o9i2VBQEmHuHpsGOqhKWwyKJb5PRV9hz9FF2eIHwUu cF6qxsBJ4py6g7CO/wdyIldoUkGl/ildBAuRBWsbD3xjDI2/kJmYaXV/wsPF5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070518; a=rsa-sha256; cv=none; b=UEgW3sJxprNch8eHHTM0cECqCBicNDM3c70mnN0f6JtNwByqv5B6d7Z14jpLidzbzIAxx+ icslLCohpKNH2m7Gy1DZooS5VY191gi9h7l79oXLyu0o9YHFTGdLAWLmVOPQI0+yz7fT8G jy8o2asByPG4OjgkR+BhVrtL1LKTBhpaGMwcj/5CNIf48iAY24o+ZbTEik4Iy/16DwasLC uYH5MYXEJvt7BFb9HQIphFO36+A2BmSn9h/+ZwuXtP3suRU71JdSxH2vV0/tzLW5PiSwOO TPkPuJLF6lOemhD8A4E5vx/UXU/TIRdhFXkALud1PyagPj3Mzh9uLn3efLKLKQ== 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=1780070518; 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=vwQTyXCrb6lUOSci4Cq1MT1iZvK6jrrKQf5TJz8+P1A=; b=AY1LizFNMoCseCIz16AOPkDUU+qGizhUNYWI64oA2xVvq5boRRDIoFSZYs+w3s5oizWkDi i+hKD4zK45/XqfGEDrIh/97dS7az9TyFaDl/PMcygNxJu26XZWD7LRch2RcPbXh2o9xsxT Bt/2NGf/5ouYRuCZgvG5Kue2KVwq9PK71sLzce0OTV3cSiRIiw5AyZpBRknwkDlhVElw8K pRmZFpWbeheuH+T68sZTPHH/GSea6UjxJ6lNGPAXkwjL6wKb9uzyQ8Ccwo2Ithj9zcoBfH x2UD89jvHCr9r4uVjkQPe+w0B+NHeEQPV1t0sSkKYx5Lup2iwIv/MsOI/MCXng== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5L5wkHzgcr for ; Fri, 29 May 2026 16:01:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36115 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 1fa1e3f3950f - main - MAC/do: Do not skip blanks when parsing executable paths 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: 1fa1e3f3950fc0593ab73ea075c24c9bfbe8afd6 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:58 +0000 Message-Id: <6a19b876.36115.530a6f75@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=1fa1e3f3950fc0593ab73ea075c24c9bfbe8afd6 commit 1fa1e3f3950fc0593ab73ea075c24c9bfbe8afd6 Author: Olivier Certner AuthorDate: 2026-05-07 15:32:28 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:37:14 +0000 MAC/do: Do not skip blanks when parsing executable paths The kind of tolerance we apply to parsing rules, whose format we have defined, cannot be applied to paths since blank characters are allowed there. There is still the limitation that no escape character is currently supported, and so it is not possible to configure a path having a ':' character. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index c30ece0a0794..9e9f57be6c3c 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1163,7 +1163,7 @@ parse_exec_paths(const char *const string, struct exec_paths *const exec_paths, MPASS(copy[len] == '\0'); p = copy; - while ((path = strsep_noblanks(&p, ":")) != NULL) { + while ((path = strsep(&p, ":")) != NULL) { size_t path_len; if (*path == '\0') From nobody Fri May 29 16:01:59 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 4gRp5N3gGdz6flkM for ; Fri, 29 May 2026 16:02:00 +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 4gRp5N0Dd3z3J9p for ; Fri, 29 May 2026 16:02:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070520; 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=KfReVBlPKmDiEJ56e7tVu6uT9iyJz3eJm/iXjc66PCk=; b=S5VfxVLGGRa+yss8evSQyucJ5bbphMocEA0GTw4BhM/fDBxyOO6Cc4s9xwTfxT/PPSKG6j /AzYuXgzq7EjwAspaQTb1E9dnQVhVLaVi4YVD1ecbF15pf/kxvpzGJ0fkhv0VOQ6egOevn 8UZdwVbV4jBR+qwJCIzU6orKRRHT+7hjOVkxQ3x6vVU7gFDtHQ0V/VJlhIKW9eOGPhzSrn 0vcHoHQ/qLoS4ZzYc/g44ELRzmdWNVLSWL318KfZa+zNapy9zpd8+rVAelX4xberyFbUCI vpgIkyxBCDLjewETY0U7D4j0CBxzhaQ9Dkb8nWxVBjGST3XrSdvmf2bAaRRI5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070520; a=rsa-sha256; cv=none; b=OEIea6NAs+ux8+afoKurXwjueoserc0hjZzmoRole+RNZRqmkGxIrWFWZaZGWmkNpZCPpA JFkTzBO1xnQy+uHkiveugsVZIZ7VhjWEn/UdfgIr7Dxzd9gn52tqdIOEJ09+dreKF6lclu AY1hZqwbJ8oCDC5vCi0IOsB1C/jrtyGOOsHoTLoDvTABkIOrGjVuFCnpc5ZO8+NL/ybRr2 qbwIR6CblIKD7pDGkEI+jjEeC3CNxMp2cVpJoIovssLANvUR8LdJPrwJ6NUI2QgqrSnY5d /H5cMjKhP+jHSYkGstGSt85xW5eSPEAKCr5jkCdIbFN03VOIYhqMQiC/GXBXUg== 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=1780070520; 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=KfReVBlPKmDiEJ56e7tVu6uT9iyJz3eJm/iXjc66PCk=; b=qCiVCYKAXGvWhoOz7BmH+jaRC/dEZu+EhxfnsTRY4cq4MAoqAzr0W4Z5tt9jyesybmDu7B 1AypTBBCOWueRobwihAz1YWpPonQ9Nb5eRBRhoufVstCAGSkfNmkwcUw45m77AyqIsxAMx hbUn5Uu0wl811HD3TgrihsVqEnfK0ILNNvwFEcT6DZgJibGhbdYX5PhttJqwr57+LrrzFN I/TIDgXKPtQFg6nifMZWucxttOwfyBBv1MiCvnd4jxGEAOinR9VP/RCeFskMqn2W3K4kX/ F+IukPCu84TtehbEs+2AMS4LByl9ZR+BjlxQgnWYvNwcRi9ty9o0yGeCmP1Q4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5M6gvzzgn7 for ; Fri, 29 May 2026 16:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 342bd by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:01:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: fcb0018634c7 - main - MAC/do: Update copyright 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: fcb0018634c77fe32ed99bca00f856af18ed240b Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:01:59 +0000 Message-Id: <6a19b877.342bd.46eb6dba@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=fcb0018634c77fe32ed99bca00f856af18ed240b commit fcb0018634c77fe32ed99bca00f856af18ed240b Author: Olivier Certner AuthorDate: 2026-05-20 11:46:45 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:39:20 +0000 MAC/do: Update copyright Update years for the Foundation. While here, remove the initial '/*-' which has been useless for a long time. While here, add a missing space on bapt@'s copyright line (approved by him). Reviewed by: bapt 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 9e9f57be6c3c..93f2084d1c93 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -1,8 +1,8 @@ -/*- +/* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright(c) 2024 Baptiste Daroussin - * Copyright (c) 2024 The FreeBSD Foundation + * Copyright (c) 2024 Baptiste Daroussin + * Copyright (c) 2024, 2026, The FreeBSD Foundation * Copyright (c) 2025 Kushagra Srivastava * * Portions of this software were developed by Olivier Certner From nobody Fri May 29 16:02:01 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 4gRp5P4GNWz6flYN for ; Fri, 29 May 2026 16:02:01 +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 4gRp5P1kFmz3JBD for ; Fri, 29 May 2026 16:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070521; 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=Ee+TxMNh/RBtxX/OMXiJNOSpkmaV1Ihk0RkGoF1KUf4=; b=JV7HP1a9JiiftL8Q+IGq8hYdxmfK/kKtBGcR8VHOBAYvn6BY190e/bLeLH9pRMrlHzGAnL WeNDja/7ow2jnsE6mkehfa/STMj4K2/tawAu3mnvQFbN5bqQDCw4RrPE8yvuOIHfiodmlE FhyWCt6jYrXrIg4ipV7gS4V3JnppXWFyL7alDRYQGpITQPgIR0XszR7zq+rMP6LGrFJS+x EkMiwznZl9gtf5ETbR7R7tO5KBiDE6X6CrOp5SyO8u4HQ8s1CzOHCkY2vOky3uYeK6+g+Z PY5PX7Kd2hZLcplVnTblD21FvzoEAUSB9Uag29ATVldepkGhaHhSPj+mXYV0oA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070521; a=rsa-sha256; cv=none; b=NKCwu6rjBwZY9DEIjnnKZyGvjxk28nFmomPSCMCjOiuGEkL9K3OcqbvTMb3ujtLayLr7Nv 21Pp+W5D20LQcDRZyXUpdKUxixrQEt4EcrwqesN99DDhxeKjD4h6fbfGNQ38Yo3xC1celv WQCq9dvN6B2KmNpOZ99cUpTnz2PLjEnU/lvTAhMhel5Ofi1ISGg0aKFQHKu79/g2ABjUrz Q4qlvQofczY+Eyuup8gdyZujKRNXixPHXvp8BvlF93Zbh6qfNhUJjSOXxcwRt/rcIHXMyB 7DP9L4IAWh35mLY0chCf6yiFyH5Dg02oA8cG0Y92AvBLXaTFVGb9eImZvOzgLA== 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=1780070521; 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=Ee+TxMNh/RBtxX/OMXiJNOSpkmaV1Ihk0RkGoF1KUf4=; b=tg9/8BFsWwzohYy4Yi/bhg3suzTU4r2YjPA/knqaSyo+fi5SlYcdJSsxK2g3Fg30HmgaHS A3D/jkbDjj7F9CadxnSIfYLrrxPAO5CBj5Uo6lErY7o1MPRvr9rG7JAzXZirunupOwq9GO ouagFjvWnCWY1p5RY4yfcHURhYPjrVa2hv+UNQKoo8SXtsGcHXRDFVALN/snZ4UKVEY6M3 LMdIsABxrFYBonb6AWvI6QF04czYyjpgEnfOt0lQhqS9qvOyklZzAttvYo+41YW85V478l 9Ot9otRJRxeUpO344GQGtZsi2fUFq9LKVCdgxNi/PS/ssCBopWrKMa5AHKVWSg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5P0Wb2zgR5 for ; Fri, 29 May 2026 16:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34041 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:02:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 39818654ae87 - main - mac_do.4: Document executable paths, default jail values and consistency 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: 39818654ae879788807d3a87c2d75cc700cc7113 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:02:01 +0000 Message-Id: <6a19b879.34041.444d4be8@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=39818654ae879788807d3a87c2d75cc700cc7113 commit 39818654ae879788807d3a87c2d75cc700cc7113 Author: Olivier Certner AuthorDate: 2026-05-20 16:23:33 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:40:25 +0000 mac_do.4: Document executable paths, default jail values and consistency While here, fix the bug of mentioning 'enable' as a possible value for the 'mac.do' jail parameter whereas it is 'new' instead. Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 --- share/man/man4/mac_do.4 | 189 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 143 insertions(+), 46 deletions(-) diff --git a/share/man/man4/mac_do.4 b/share/man/man4/mac_do.4 index 8c08e072be88..7f05d5f88bf8 100644 --- a/share/man/man4/mac_do.4 +++ b/share/man/man4/mac_do.4 @@ -1,8 +1,8 @@ .\"- .\" SPDX-License-Identifier: BSD-2-Clause .\" -.\" Copyright (c) 2024 Baptiste Daroussin -.\" Copyright (c) 2024 The FreeBSD Foundation +.\" Copyright (c) 2024, Baptiste Daroussin +.\" Copyright (c) 2024, 2026, The FreeBSD Foundation .\" .\" Portions of this documentation were written by Olivier Certner .\" at Kumacom SARL under sponsorship from the FreeBSD @@ -42,13 +42,23 @@ policy module allows unprivileged users to change process credentials according to rules configured by the administrator. It supports per-jail configuration. .Pp -Currently, the +The .Nm -policy module only produces effects to processes spawned from the +policy module only produces effects on processes spawned from specific +executables from a configurable whitelist. +By default, this whitelist only contains the .Pa /usr/bin/mdo executable, please see .Xr mdo 1 for more details on this program. +.Pp +Section +.Sx CREDENTIALS RULES +specifies the format of credentials transition rules, and section +.Sx CONFIGURATION +explains how to configure +.Nm , +including rules and authorized executables. .Sh CREDENTIALS RULES Rules specify which transitions of process credentials .Nm @@ -267,84 +277,170 @@ then converted to unsigned ones as specified in the C standard for the and .Vt gid_t types, which are both 32-bit unsigned integers. -.Sh RUNTIME CONFIGURATION -The following +.Sh CONFIGURATION +Each parameter of +.Nm +has a corresponding +.Xr sysctl 8 +knob. +.Nm +supports per-jail values for most parameters. +.Ss Sysctl Knobs +The .Xr sysctl 8 -knobs are available: +knobs presented by +.Nm +are of two types: Global ones, which influence all uses of the module, and +per-jail ones, which allow to retrieve or change the setting applicable to +a jail +.Pq or the host +from within. +They are tagged accordingly in the list below. +.Pp +The indicated default values for per-jail parameters applies to the host. +Those applying to jails are described in the +.Sx Jail Parameters +subsection below. +.Pp +The following knobs are available: .Bl -tag -width indent .It Va security.mac.do.enabled Enable the .Nm policy. -(Default: 1). -.It Va security.mac.do.rules -The list of credential rules, whose syntax is described in the -.Sx CREDENTIALS RULES -section above. -This list is specific to each jail. -Please see the -.Sx JAIL SUPPORT -section below for more details on the interaction of -.Nm -with jails. +.Pq Global. Default: 1. .It Va security.mac.do.print_parse_error Logs a message on trying to set incorrect rules via the .Va security.mac.do.rules .Xr sysctl 8 knob. +.Pq Global. Default: 1. +.It Va security.mac.do.rules +The list of credentials transition rules, whose syntax is described in the +.Sx CREDENTIALS RULES +section above. +An empty string effectively disables the policy. +.Pq Per-jail. Default: Empty. +.It Va security.mac.do.exec_paths +The list of absolute paths +.Pq relative to the current jail's root +to authorized executables, separated by colons +.Pq Ql ":" . +Only processes launched from these executables are considered by the +.Nm +policy. +An empty string effectively disables the policy. +.Po +Per-jail. Default: +.Ql "/usr/bin/mdo" . +.Pc .El -.Sh JAIL SUPPORT +.Ss Jail Parameters +Most parameters of .Nm -supports per-jail configuration of rules. +are per-jail +.Po +see the +.Sx "Sysctl Knobs" +subsection above +.Pc . +Those that are per-jail have corresponding jail parameters that can be used to +set their initial values on jail creation or modify their values in a running +jail from outside the jail. .Pp -By default, at creation, a new jail has no credentials rules, effectively -disabling +By default, as it is for the host, a new jail has .Nm -for its processes. +disabled for its processes, as if the +.Va mac.do +parameter below was explicitly set to +.Ql disable . .Pp -The following jail parameters are defined: +Each unspecified parameter other than +.Va mac.do +defaults to a copy of its value in the currently applicable configuration for +a running jail, or from the parent jail on jail creation. +.Pp +The following jail parameters are available: .Bl -tag -width indent .It Va mac.do Possible values are: +.Pp .Bl -tag -width "'disable'" -compact .It Ql new .Nm -will enforce specific credential rules in the jail. -The -.Va mac.do.rules -jail parameter must also be set in this case. +will use a specific configuration for the jail. +This case degrades to +.Ql disable +if one of the other jail parameters end up empty after applying the default +values rule +.Pq see the preamble . .It Ql disable Disables .Nm in the jail. -Strictly equivalent to jail creation's default behavior and to setting the rules -to an empty string. +This is achieved by ensuring that at least one of the +.Va mac.do.rules +and +.Va mac.do.exec_paths +jail parameters are empty. +If none of them ends up empty after applying the default values rule +.Pq see the preamble , +.Va mac.do.rules +is forced to an empty value. +An explicit +.Ql disable +is incompatible with explicit non-empty values for all other jail parameters and +will trigger an error. .It Ql inherit -The jail's credentials rules are inherited from the jail's parent +The other per-jail parameters are inherited from those applicable to the jail's +parent .Pq which may themselves have been inherited . -Modified rules propagate to all children jails configured for inheritance. +Configuration modifications immediately propagate to all descendant jails +configured for inheritance +.Po +as long as there is no intervening jail having its own specific configuration +.Pc . .El +.Pp +The default value depends on the absence or presence and value of the other jail +parameters. +As soon as one of the latter is present and not empty, the default value is +.Ql new , +else it is +.Ql disable . +Inheritance is never established implicitly, it must be explicitly requested. .It Va mac.do.rules The credentials rules for the jail. -It is always equal to the value that can be retrieved by the +See the description of the corresponding .Xr sysctl 8 knob .Va security.mac.do.rules -described in section -.Sx RUNTIME CONFIGURATION . -If set, and the jail parameter -.Va mac.do -is not so explicitly, the value of the latter will default to -.Ql disable -if empty, else to -.Ql new . +in subsection +.Sx "Sysctl Knobs" +above. +See also the preamble for the default values rule. +.It Va mac.do.exec_paths +The authorized executables. +See the description of the corresponding +.Xr sysctl 8 +knob +.Va security.mac.do.exec_paths +in subsection +.Sx "Sysctl Knobs" +above. +See also the preamble for the default values rule. .El +.Ss Consistency +Values read or set from jail parameters are always consistent with their +corresponding +.Xr sysctl 8 +knobs, effectively operating on the same internal +.Dq variable . .Pp -Each jail must have -.Xr mdo 1 -installed at path -.Pa /usr/bin/mdo , -as this path is currently not configurable. +All accesses to some parameter or some jail configuration as a whole, whether +a read or a modification, are sequentially consistent. +In other words, they appear to be atomic, and all threads see them happening in +the same order. .Sh EXAMPLES Here are several examples of single rules matching processes having a real user ID of 10001: @@ -405,6 +501,7 @@ current supplementary groups must be kept. .Sh AUTHORS .An Olivier Certner Aq Mt olce@FreeBSD.org .An Baptiste Daroussin Aq Mt bapt@FreeBSD.org +.An Kushagra Srivastava Aq Mt kushagra1403@gmail.com .Sh BUGS Currently, .Nm From nobody Fri May 29 16:02:02 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 4gRp5Q6CPPz6flhD for ; Fri, 29 May 2026 16:02:02 +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 4gRp5Q1jnkz3Hxx for ; Fri, 29 May 2026 16:02:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070522; 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=rnlfH4NVtE9/AROPNZ36h4h3JqUoeUMIHAX7XHBzJ/w=; b=aU10AHZ3MU9DUiWKozhrYbU7QTBh3k5Rnsprg3Sbs/GSijAhVwxzER3gucYD2t4fRd19Pn bhPSGHLMx9jJlH/5kgyG3rG0eNFAe2ZHvdTqTybytIjQE0yoCeH91XM5PV9vezXQpPoQMt ORoK2MRyHpFZLs4udzoWexveAuXz6ZgpbEXabwElYBUANXbb/JvrzIWXL9A3rDt9511gK9 NRLFnDUVfQdyy0x5/vULabhSV9UVhXIronDMncJ4KzT648IEjsV6ukMv1C5YYJ8cdW0dEs a75makeRdr+AqnAho+NfSf/07xeWLXBBbuJ1i98Gn0yXGOfo5gCTm0XpqoaBaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070522; a=rsa-sha256; cv=none; b=DdMwwwIrH4V1ydIwaMoBvzP8842j7dny2GD8/cgWzF3zTaEtgTids0r+R6K4GPfrsmloUB 9mMODc9fvx4iCUeoOoNb3SFGzXj6cuVivYUMSctzTrU2XI1MVto09SlCd7iLkuDvHklHtz 0Ye8SiKAVUsqypEWB1Zna60APz0czyxG4W9AGZqbJz5SwvZwZsV4Fxv94ZbYpO7hh7OEx+ LX9pRa8v+QEz8cFqAZsC1WDyuqV55XhOPkBT1F4ZZMa138abJlTxnmmtPkyfpXL022rLD1 YyPR2crNT/gHF3vtd5WTAmioZdDl2/Y+yUiIpxs+k0p9k/enEy1TBhCWYV3Fcw== 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=1780070522; 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=rnlfH4NVtE9/AROPNZ36h4h3JqUoeUMIHAX7XHBzJ/w=; b=m562M0py1r3McPFaw8CA1ZYiXfnYapmS9sG5ipKJJYUz57DZuhAMvsI8e81PX1xuMWn0Ug fUgUXLfbs8DVc/1vek9gJ/nthm2+hzl4OotxvZvhKJBzy8WeC2tgMrfLrbVQzsAuUL7svI qsIsgb+MxXe8miVYSyMk2R41Gbrn+55R2y+Afm2IiSsvCYA6zQ6WRGA66/lDikrzXhHnLk quR+PMUTCWwMnuhoYAbUk87bjalJUghGn9PqP6MZ4dmCervYuCcww6oAfvh8fxTkaGmsiU /M5urpBnGn3vULoHxJMBPdS7OZjuQUR1LCB/Xr3a9P1xWBJ7UXVdA1etPpYwZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5Q1GbczgR6 for ; Fri, 29 May 2026 16:02:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3608c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:02:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 79a987aba154 - main - MAC/do: Tests: Remove shebang lines 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: 79a987aba154aca5965e4746ec5f867be8f22997 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:02:02 +0000 Message-Id: <6a19b87a.3608c.182f3071@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=79a987aba154aca5965e4746ec5f867be8f22997 commit 79a987aba154aca5965e4746ec5f867be8f22997 Author: Olivier Certner AuthorDate: 2026-05-22 16:47:04 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:41:02 +0000 MAC/do: Tests: Remove shebang lines They are automatically added by . Reviewed by: bapt MFC after: 3 days Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 --- tests/sys/mac/do/invalid_configs.sh | 2 -- tests/sys/mac/do/valid_configs.sh | 2 -- 2 files changed, 4 deletions(-) diff --git a/tests/sys/mac/do/invalid_configs.sh b/tests/sys/mac/do/invalid_configs.sh index f24309cb2f3b..9758a0239082 100644 --- a/tests/sys/mac/do/invalid_configs.sh +++ b/tests/sys/mac/do/invalid_configs.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env atf-sh -# # Copyright (c) 2026, The FreeBSD Foundation # # This software was developed by Olivier Certner at diff --git a/tests/sys/mac/do/valid_configs.sh b/tests/sys/mac/do/valid_configs.sh index bd5b53b5d5d8..be4e59ce54ca 100644 --- a/tests/sys/mac/do/valid_configs.sh +++ b/tests/sys/mac/do/valid_configs.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env atf-sh -# # Copyright (c) 2026, The FreeBSD Foundation # # This software was developed by Olivier Certner at From nobody Fri May 29 16:02:03 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 4gRp5R4Njwz6flYX for ; Fri, 29 May 2026 16:02:03 +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 4gRp5R27TXz3J65 for ; Fri, 29 May 2026 16:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070523; 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=GRgP82W6tkIsK35gfG6f4wLsv5w2RLbfalFsJRVDTCI=; b=ShnxOUf0JnMFO2A9mWSgsL4HdacZRQypQhMgz5tkbbFDN6aUgMzfEPxEKGrl+y1o96sUZ5 5rkDWw2tUB7OYaFY+evCHkPuegvVl5IdSm7tj0L3et4aaA3nJAVw5CdBv9wtuwGGXhGmdl FXU3vzYesIhHRyu/gUkMnUh2sC6uD+BGHlaLxUXblKQDL4bbgUNjTdM6GFfZK0JK/D6Dw1 IwRLU5oiaedUROBpXZLvJonQ5Z4/tliYvhTS0F0W2isNDDg7eySkJwF1YmhT5H3Zhmzw6Q LuVa7cmFzCC5bBxtMmZ1DOVexmITY3Nz3e9Z36xEm3KeI78onkfSVyLjeA/neA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070523; a=rsa-sha256; cv=none; b=yIXr7bl1WfcvhlF/L0tfe4DLwNhdNv3pgauh3DGX4hqZgzq4V5vnXNzopCOlk7OyfHOk+O GJjDQvAOpiO4wWwQqJ96sso51kx5rdPBacU5w1Sku6uh6cdLg/tUOLs6qsMAkFQ49pzhW1 AcuxFrPgij2kOnR5WJFrnit/qICZmB3mtypBCyq8xRohBefO9VSOTDiyglLPuKjEeK9E12 beQ/coS12ca57DE9NEmyIpg8rYHijc1qyWG4A+PplHgafk3c+QXLL4bG3KQV7cC1bDcP1H zEPSnjkRGFF1X1dO7FtqbIV0C3MtORXbbGS0ovmLwujLtafi2502BNsyueiaCw== 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=1780070523; 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=GRgP82W6tkIsK35gfG6f4wLsv5w2RLbfalFsJRVDTCI=; b=g5A4mBoxI/67Moa1Aa2bak7aM2cB7O1/jRNAcH8WWoVoDrirD4PxxqaHGsG3XcafP8S6DV xs0AWu7Pyss6/A+mH0Ymdkjw1lK8Wh9yKmH41eg8kVlpjLPYNfvwIJXRROTYQA7oEVqSWf 9q4bN08qYLwv4quN3bpT5el25Qw6Mso8jLJFoCzx8yz6o5ZgOReNvSIrqRuU0xKgWEPXPF 1hJCHa04EVJdk/m7tz4/DzO2jdpH7uFNKJSb68tDR+npsQigfSU2ICDpxC5syy3Ml9udTX zFaS/A/Op/dfE6mKu3iwnxMQ64A8y0lHtjbL6J3ciC7vsaoClmFIZOZGRIt2Zw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5R1g3NzgCl for ; Fri, 29 May 2026 16:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35f10 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:02:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: b0c948fe92ac - main - MAC/do: Tests: Fix copyrights 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: b0c948fe92acc8bd295cc53584e25c082c749cd1 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:02:03 +0000 Message-Id: <6a19b87b.35f10.7c808221@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=b0c948fe92acc8bd295cc53584e25c082c749cd1 commit b0c948fe92acc8bd295cc53584e25c082c749cd1 Author: Olivier Certner AuthorDate: 2026-05-26 17:06:55 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:41:17 +0000 MAC/do: Tests: Fix copyrights No comma needed after a single year. Add SPDX. Reviewed by: bapt MFC after: 3 days Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 --- tests/sys/mac/do/common.sh | 3 ++- tests/sys/mac/do/invalid_configs.sh | 4 +++- tests/sys/mac/do/valid_configs.sh | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/sys/mac/do/common.sh b/tests/sys/mac/do/common.sh index 88529adcc1f3..444a74b4c2ab 100644 --- a/tests/sys/mac/do/common.sh +++ b/tests/sys/mac/do/common.sh @@ -1,5 +1,6 @@ +# Copyright (c) 2026 The FreeBSD Foundation # -# Copyright (c) 2026, The FreeBSD Foundation +# SPDX-License-Identifier: BSD-2-Clause # # This software was developed by Olivier Certner at # Kumacom SARL under sponsorship from the FreeBSD Foundation. diff --git a/tests/sys/mac/do/invalid_configs.sh b/tests/sys/mac/do/invalid_configs.sh index 9758a0239082..848e2b5c9579 100644 --- a/tests/sys/mac/do/invalid_configs.sh +++ b/tests/sys/mac/do/invalid_configs.sh @@ -1,4 +1,6 @@ -# Copyright (c) 2026, The FreeBSD Foundation +# Copyright (c) 2026 The FreeBSD Foundation +# +# SPDX-License-Identifier: BSD-2-Clause # # This software was developed by Olivier Certner at # Kumacom SARL under sponsorship from the FreeBSD Foundation. diff --git a/tests/sys/mac/do/valid_configs.sh b/tests/sys/mac/do/valid_configs.sh index be4e59ce54ca..44cfd62acc6e 100644 --- a/tests/sys/mac/do/valid_configs.sh +++ b/tests/sys/mac/do/valid_configs.sh @@ -1,4 +1,6 @@ -# Copyright (c) 2026, The FreeBSD Foundation +# Copyright (c) 2026 The FreeBSD Foundation +# +# SPDX-License-Identifier: BSD-2-Clause # # This software was developed by Olivier Certner at # Kumacom SARL under sponsorship from the FreeBSD Foundation. From nobody Fri May 29 16:02:04 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 4gRp5S4HqNz6flYc for ; Fri, 29 May 2026 16:02:04 +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 4gRp5S3CFjz3JHL for ; Fri, 29 May 2026 16:02:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070524; 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=sm9RHuX5iyoCaNUtjATTlFwjqWlu/0SkmhaArfeXpsU=; b=blzQ1DAeU0uNzJ1mVxCJ6KO/vhDessbEA+ddmkCBxmY3SHBpdBDMCBVBtOy0SFlQ4M7xDQ wKvQqOBTMhLRkd4rpkoEc493gtD034ZJnew0MHiiEg9lRMvE6svmxhFfOT503itm22hvZb RHO0H0FzbH+nJV7U0TVfrJ8t9AYO3ZK5B78jTwbstDFE+Isq9CVZDqlZD118JPb4ZNn4CK DUHJs6beScoMgmj1L/Vl4sF2Us0soHxXKdWdKCaMU1mSAyPfSEYN41hosd+ec72a4PjtyU hU37h2SUiVoD6S6fMHdWanc+HJVQFvzKMxMq3UjRvarzQJJdBLhsANQziFycSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070524; a=rsa-sha256; cv=none; b=SFZ/YmgSlBr/1ZVt41OkIiJSi3uS6Xfu5yjTUhK5fop0XMM3OsjjU7QJClsUUmFWOnANwI 9pI53KZ46WavSrW0NpbVmEqyBN5TgQCuF4dk3l6dF3YREg6cgDgfo2n85NuhLcIcDMTK0t 3uxi3ulr7NYY7flQhtIGXAVm8VXc1XXb+PU5e3uHDmwRiFmjEKVQJOLgS4Ozkywyb4FdDi SLPJywnG5hs0cJyykK1eUvxtUv4A+g9a6IMiM+0eS+YtA196H+O1z25tbTibNGVhvuOkBb skJkSalysoCIV3+jq95tcZDc8MD11GHn62NQB+xgWRLISQpTCzsDrLW4xo2uTA== 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=1780070524; 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=sm9RHuX5iyoCaNUtjATTlFwjqWlu/0SkmhaArfeXpsU=; b=EtwTDeppA9Ofl2PRmj8omlIIViFolB6cH3qdOxijGrcMKHjGFGWx7rOOEs509Nn3jQ5BZF kAz1USp1wFlYMhFjqaWbGkFw29ga+NnPM+iycNX0we9A0DZlJIcEZiuwm8Z+k8MG5k+PgX vZvf4XkfMygIko4G/sNMMy4jZvCy6G+jq5z6TRcfhwRHkvnR7knek0IDIEjkL8DMYoxxh4 9gEppjgLCvN0VIVOwlo8j+suaxJSDagS2+7mg9j1pnEUlkBhj5hJASs1lCGFRqxIf4aDTc XIbF7cLnU6AdJzF2vfoXFhnTtbXc1B05F5dfdM9zeJQ25A7+ucP/1MfL03El6g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5S2SmLzgpd for ; Fri, 29 May 2026 16:02:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 367aa by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:02:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 6159187329b5 - main - MAC/do: Tests: Declare required programs closer to use 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: 6159187329b56a9b550db193796ae4d76c1a306c Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:02:04 +0000 Message-Id: <6a19b87c.367aa.11d54015@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=6159187329b56a9b550db193796ae4d76c1a306c commit 6159187329b56a9b550db193796ae4d76c1a306c Author: Olivier Certner AuthorDate: 2026-05-22 14:19:57 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:41:24 +0000 MAC/do: Tests: Declare required programs closer to use Reviewed by: bapt MFC after: 3 days Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 --- tests/sys/mac/do/Makefile | 1 - tests/sys/mac/do/common.sh | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/sys/mac/do/Makefile b/tests/sys/mac/do/Makefile index 980067ea56e6..bfca40efdc8d 100644 --- a/tests/sys/mac/do/Makefile +++ b/tests/sys/mac/do/Makefile @@ -9,6 +9,5 @@ ${PACKAGE}FILES+= common.sh TEST_METADATA+= execenv="jail" TEST_METADATA+= required_kmods="mac_do" TEST_METADATA+= required_user="root" -TEST_METADATA+= required_programs="sysctl" .include diff --git a/tests/sys/mac/do/common.sh b/tests/sys/mac/do/common.sh index 444a74b4c2ab..6c4b138bdac0 100644 --- a/tests/sys/mac/do/common.sh +++ b/tests/sys/mac/do/common.sh @@ -69,5 +69,7 @@ sysctl_set_and_check_fails_rules() sysctl_set_and_check_rules_common sysctl_set_and_check_fails "$value" } +atf_require_prog sysctl + # Do not pollute kernel logs with parse errors sysctl $PPE_KNOB=0 >/dev/null 2>&1 From nobody Fri May 29 16:02:05 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 4gRp5V23kSz6flcN for ; Fri, 29 May 2026 16:02:06 +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 4gRp5T3mznz3JKD for ; Fri, 29 May 2026 16:02:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070525; 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=M0QkOkV8NR7gBFPC9u8+GVfaTI8J5du3TtJh+LwBdzA=; b=RrtySqvbK3wi8UJ3L99a8Fk3pUt1G/EOkJy/0S8B+UtwB6R6bClGY4HwaRaUSdgTUuHTgk SRQ9ipeNb4ifnUB/4q/Fj2RxpPiTPOd3kFF6uXjNZZUvn+729PVaQWgqxkhKYjEdImckcr Yqij9u29az29f6QOwBnEHXOP3Q1JBpAtkS6DC4Z8lO9uNqEZOUrdO/TT/ocaIIHAdG4aNo ZsbX1ScCa6oig7Z1D0IpIwHu2HZJony9ResA7XoJdgZ3ISogm9R7Jw56mzKHNwL2m44kXo AjH0y1XuhMi7gk42knirKDzCBQNWAJiE4fdy01yZ2cLP0AtrGO+kywHfrddTvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070525; a=rsa-sha256; cv=none; b=uug5HQy3EpOjmdtJsMl2ZD4bra/FGGqt3RiIN0ZKdxFxR+JTCBlZNrT8OEKChJEtAhEtuG +w/e7AVh2876wRFFoJggqvRFognL0EZ37lq2OStQzq+u8lAK1V7c/cpBS4oZVoIfJcFtN+ A1KViGyIpNLAxXOrdlmoAHq9aSw68IHynJzZRNyIijX7RuY6snwSTSXP+6x7Ej2mjmgOv4 AR0u3LF7RwWDI58EQaLqlpE6ti1Cubz9HUxss8J/vcN5PE6y+nrqJjWXy5WZjFe2+1NHoB zTqtffZxcY263F362gH+HDUsCT5GDEQWoIlpDoFSF5LPDtf4UERh5ILNxe09eQ== 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=1780070525; 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=M0QkOkV8NR7gBFPC9u8+GVfaTI8J5du3TtJh+LwBdzA=; b=hIM+W2CP8wpMUm9tv25hF2ue8Ru5Mepm796VupqOTrzvDVs9nfCMnLXPcxOoQ1NEOSlozd 5ttGK7k1uWgj0vAIsxXsRC6xr2A75AhKHjY/dBxVTRYvSGasZRDmneSaThc0T1olc6OZqA RYIhVgfUFjreK/KRpLzWm7ZTbUAklK7SxKFJohiITu3uWEOzNTzXhmZIPXk90nZ06dc5CY Xafp43hsrANht3yl0S4j6woGBxxarHOwoIwkSFGlIB9iW2W60W+gL7KuahA0KEdPJDKhUa diIHzlGzKXizt/iVLes0cdiA/IImUQU4jCXfvjk3yMn4oWi+iNvA4GVkhuKuYw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5T3DHxzgpf for ; Fri, 29 May 2026 16:02:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35f14 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:02:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 33daea3f862d - main - MAC/do: Tests: Quote the source directory 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: 33daea3f862d7fe996602756805a92a600356f94 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:02:05 +0000 Message-Id: <6a19b87d.35f14.27512d18@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=33daea3f862d7fe996602756805a92a600356f94 commit 33daea3f862d7fe996602756805a92a600356f94 Author: Olivier Certner AuthorDate: 2026-05-22 14:21:39 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:41:29 +0000 MAC/do: Tests: Quote the source directory In a standard test suite installation, this is not necessary, but be bullet-proof to custom ones, however improbable. Reviewed by: bapt MFC after: 3 days Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 --- tests/sys/mac/do/invalid_configs.sh | 2 +- tests/sys/mac/do/valid_configs.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/mac/do/invalid_configs.sh b/tests/sys/mac/do/invalid_configs.sh index 848e2b5c9579..d1a9eb8c1e96 100644 --- a/tests/sys/mac/do/invalid_configs.sh +++ b/tests/sys/mac/do/invalid_configs.sh @@ -75,7 +75,7 @@ rules_wrong_separator_body() atf_init_test_cases() { - . $(atf_get_srcdir)/common.sh + . "$(atf_get_srcdir)"/common.sh atf_add_test_case rule_no_target_part atf_add_test_case rule_no_match_part diff --git a/tests/sys/mac/do/valid_configs.sh b/tests/sys/mac/do/valid_configs.sh index 44cfd62acc6e..fc1c9a370854 100644 --- a/tests/sys/mac/do/valid_configs.sh +++ b/tests/sys/mac/do/valid_configs.sh @@ -120,7 +120,7 @@ gid= 1001 >gid =5" atf_init_test_cases() { - . $(atf_get_srcdir)/common.sh + . "$(atf_get_srcdir)"/common.sh atf_add_test_case rule_uid_to_any atf_add_test_case rule_uid_to_uid From nobody Fri May 29 16:02:06 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 4gRp5W1tjfz6flds for ; Fri, 29 May 2026 16:02:07 +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 4gRp5V4l6Rz3JHf for ; Fri, 29 May 2026 16:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070526; 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=RRRUCey/UphbgZXAGxbqIV12gyYE6BvzqX48OeJ8jGw=; b=KYi4ZHSoQ6xFJy4sWR8aH5QWAkndQ70EWtglIyMINPK01m6/RIQaMwaXaXtpPAYHCB7Q2B fZFv2ZXYJDyOqh/VrHqwUrtSCHhnVQw9sOVp8bpoUvi9zZ+Z6InWi2PgfKukVotzjn1aCW nmH/KoBN7cWwmain6qR50kTzbnX1xhinUu498HfwSKbSSrsVDdH0Ki52kePQ+BOY2xZ26a YKFB6OspgmNJZCPKUTcI4V2muWpCWIg2W8FyJYaMgbecUxtRjHSklBPTxNsek864GJvylj S/Y2tDf7iquS4jsx3DcQYE6iCbJTgrQYyf++jgWNXkiAOU+P/oBZSYzxMX7MhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070526; a=rsa-sha256; cv=none; b=KXcwOMwps8VqLDxtRForaAsMYv8xCfs5lxOLx5uG3z+tu57sjCgyZfjmg0cPA8bEdaJ6zn 3VaSlYmexMZ9nCpOX6wHasHMi3rIvhei/FlVxJ91t2om3BPFxyHjjvEoYsNTynOR36qV+U L0ABnWMwRgTe6SppQYvwvkC6nOfHnIC3DXzZV/UJNRJCRVkR82mpUu8KdxeBnBhypNO+se qXSHZZKE9L4sQSfanGVwUUQpjq6+bnu48dDHqMWqej40/nYMp5guA/zPOp6+73vZyFBpnw XXjL73whuZDwQfwK4kaYQPMcq2hb8F6vXgGbiaHofZuqtT6kpAUn65wBaGCVZg== 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=1780070526; 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=RRRUCey/UphbgZXAGxbqIV12gyYE6BvzqX48OeJ8jGw=; b=YuA6kzT5yoorgsOwTG79i0XIqkvgrf2xruKuqtgpZjs2W/VX1L6YoAcCOS7LbUCPAm9lcz LEEuQlzfKLSEYVl4/OR5iJIkDqMNWZBFgK2xcXdyUgH74+/dma7qszt7kj+RnX0Is6NbZd Kze+ACZiQr3aB3JBP1YKhSl9KApJxG709gIoZxY853/Ojs65t7DhapowAlx63UHxFVC/9N u9aX9rN+sQr7C0xEZCI10Ybzqt6KWK93jSfJFmu2b1FVjeg6M1MmQmHs9dPeyKJsCwIZTO 3opRR1RXTSqXpSkHPA8ZOA6pIzGLW3BQsIEP5whbd+u8IjMIILE1Yb97KbEWkA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5V43Lfzg6t for ; Fri, 29 May 2026 16:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33f57 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:02:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: a95ff5ef7d1f - main - MAC/do: Tests: Add support for exec paths, jail parameters, subjails 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: a95ff5ef7d1ffcb701913028253a4700cd9a1459 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:02:06 +0000 Message-Id: <6a19b87e.33f57.5e693405@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=a95ff5ef7d1ffcb701913028253a4700cd9a1459 commit a95ff5ef7d1ffcb701913028253a4700cd9a1459 Author: Olivier Certner AuthorDate: 2026-05-22 14:23:31 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:41:36 +0000 MAC/do: Tests: Add support for exec paths, jail parameters, subjails And also allow configuration of the mdo(1) executable path. This commit only contains new or modified infrastructure. No functional change intended at this point. Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 --- tests/sys/mac/do/common.sh | 119 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 110 insertions(+), 9 deletions(-) diff --git a/tests/sys/mac/do/common.sh b/tests/sys/mac/do/common.sh index 6c4b138bdac0..4f0e838bbf5f 100644 --- a/tests/sys/mac/do/common.sh +++ b/tests/sys/mac/do/common.sh @@ -10,11 +10,79 @@ rules_parameter() echo "$1".rules } +exec_paths_parameter() +{ + echo "$1".exec_paths +} + +: ${MDO:=/usr/bin/mdo} + +ROOT_KNOB=security.mac.do +RULES_KNOB=$(rules_parameter ${ROOT_KNOB}) +EXEC_PATHS_KNOB=$(exec_paths_parameter ${ROOT_KNOB}) +PPE_KNOB=${ROOT_KNOB}.print_parse_error + +ROOT_JAIL_PARAM=mac.do +RULES_JAIL_PARAM=$(rules_parameter ${ROOT_JAIL_PARAM}) +EXEC_PATHS_JAIL_PARAM=$(exec_paths_parameter ${ROOT_JAIL_PARAM}) + +# To be overridden to execute commands in a sub-jail +JEXEC= + +# Exit status: 0 iff disabled +mac_do_disabled() +{ + [ -z "$($JEXEC sysctl -n ${RULES_KNOB})" ] || + [ -z "$($JEXEC sysctl -n ${EXEC_PATHS_KNOB})" ] +} + +mac_do_check_disabled() +{ + mac_do_disabled || atf_fail "mac_do(4) expected disabled but is not." +} + +mac_do_ensure_disabled() +{ + mac_do_disabled || $JEXEC sysctl ${RULES_KNOB}="" +} + +sysctl_rules() +{ + $JEXEC sysctl -n ${RULES_KNOB} +} + +sysctl_exec_paths() +{ + $JEXEC sysctl -n ${EXEC_PATHS_KNOB} +} + +# $1 = sysctl func, $2 = expected value +sysctl_check() +{ + local func value + + func=$1 + value=$2 + atf_check [ "$($func)" = "$value" ] +} + +# $1 = value +sysctl_check_rules() +{ + local value -CONF_ROOT_KNOB=security.mac.do -RULES_KNOB=$(rules_parameter ${CONF_ROOT_KNOB}) -PPE_KNOB=${CONF_ROOT_KNOB}.print_parse_error + value=$1 + sysctl_check sysctl_rules $value +} +# $1 = value +sysctl_check_exec_paths() +{ + local value + + value=$1 + sysctl_check sysctl_exec_paths $value +} # $1 = knob name, $2 = value sysctl_set_and_check() @@ -23,8 +91,8 @@ sysctl_set_and_check() knob=$1 value=$2 - atf_check -o ignore sysctl "$knob"="$value" - atf_check -o inline:"$value\n" sysctl -n "$knob" + atf_check -o ignore $JEXEC sysctl "$knob"="$value" + atf_check -o inline:"$value\n" $JEXEC sysctl -n "$knob" } # $1 = knob name, $2 = value @@ -35,8 +103,8 @@ sysctl_set_and_check_fails() knob=$1 value=$2 orig_value=$(sysctl -n "$knob") - atf_check -s not-exit:0 -o ignore -e ignore sysctl "$knob"="$value" - atf_check -o inline:"${orig_value}\n" sysctl -n "$knob" + atf_check -s not-exit:0 -o ignore -e ignore $JEXEC sysctl "$knob"="$value" + atf_check -o inline:"${orig_value}\n" $JEXEC sysctl -n "$knob" } # $1 = sysctl function, $2 = value @@ -46,9 +114,9 @@ sysctl_set_and_check_rules_common() func=$1 value=$2 - "$func" ${RULES_KNOB} "$value" - # Same spec but using the older in-rule separator (':') + # Use older in-rule separator (':') first to have final value as specified "$func" ${RULES_KNOB} "$(echo "$value" | sed 's%>%:%')" + "$func" ${RULES_KNOB} "$value" } # $1 = value @@ -69,7 +137,40 @@ sysctl_set_and_check_fails_rules() sysctl_set_and_check_rules_common sysctl_set_and_check_fails "$value" } +# $1 = sysctl function, $2 = value +sysctl_set_and_check_exec_paths_common() +{ + local func value + + func=$1 + value=$2 + # Use older in-rule separator (':') first to have final value as specified + "$func" ${EXEC_PATHS_KNOB} "$(echo "$value" | sed 's%>%:%')" + "$func" ${EXEC_PATHS_KNOB} "$value" +} + +# $1 = value +sysctl_set_and_check_exec_paths() +{ + local value + + value=$1 + sysctl_set_and_check_exec_paths_common sysctl_set_and_check "$value" +} + +# Create a persistent subjail. Echoes its JID. +launch_subjail() +{ + ( + set -o pipefail + $JEXEC jail -c -J /dev/stdout persist=true | + sed -nE 's%^.*jid=([0-9]+).*$%\1%p' + ) || atf_fail "Cannot create a subjail (check children limits?)" +} + atf_require_prog sysctl +atf_require_prog jail +atf_require_prog sed # Do not pollute kernel logs with parse errors sysctl $PPE_KNOB=0 >/dev/null 2>&1 From nobody Fri May 29 16:02:07 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 4gRp5X1Fv6z6flYy for ; Fri, 29 May 2026 16:02:08 +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 4gRp5W5C99z3JHr for ; Fri, 29 May 2026 16:02:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070527; 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=CVIeqI1x4ZAH1FSggkZr+6aECNHCfG4DH9LuKuBrvls=; b=Axz0KO4wOJwb7G9ge6f7DHzk88112Nk5LDutPud2siMyYTwO9MxE3dRro35g4rPhF/8URx TMZ4TxcO+sepD4XVX+0tnRLWl7YmfaPaOD/Uue8DLy4TBiukXecye2PZfTgmuYdqN0i1Ie 1LazHIUSSIjiivH+hjvJdsNLSxI2Dk9aUgdseEc1k+V0LTlJzDq41aoqxoew5C3QHBPULx kUvD9HTkaMxji1hJQbXj+3rt+yEU0YneIkc/1A0ClcxzFHDRjxOZbY8tdxDNVxPnGJaBtL 5Pj88BYTljnE3O2xW2dEl0Rf8JbMe+NGFqcI1qo+na+LPvC1bYs9MO1+9XbwiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070527; a=rsa-sha256; cv=none; b=jo3aR1HC69VqfeEjXV2I7ACUcapadhZdGLauhtn4TQ0KfNnj4t24FxlJ2kkfRS4aFBGnHN tqbpRH8/siiXjvIeSKbkZ2OPzNJ6CMvOkKtxJi7MOiZ7BELe6UBB10+O/FhKdzUNIPT+Bk 2IVXvyTaO1/fczKbl+S/vsKFh5lDb15JZFO7JErkn3xgYOCdReOr8VvQSapv9yY3GvOjgv ZuykFzbC5wU1mQ+cFYoicYSpwAC/xyYzoWSptOTH1hhBsrwdCIIiwdz0v+hx551UA04vhM 4YtcD6rF1E/H+06Ny5ayN7H8sNCSEpLbS2EIN8PrAdq7q7KZTrGWNDNEWds7kQ== 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=1780070527; 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=CVIeqI1x4ZAH1FSggkZr+6aECNHCfG4DH9LuKuBrvls=; b=a6tkD8E3FJRBahoXBHOmmfRcsWxbKOgQgrHcjMYTCHmrwHG8osFdFbpRLVB6CndxPTX1sV BUkr9ZbwBtELN7jhVJ6mz2Qxth9N+0JF7c2qMTYp+o0Lfp0cT3lt0Inqm95q3EyL1S8PED Hty0W9K9EXfJBMMWaZxj/1rzFlPjYTWao1msyt9O5OU1PK48110aiWTGLgEGSo7oYTimnT r6R5F1VuPnI3o2vkDtX4BtGr2FgHCHT5w9lEXm2sDSr9GwCrzz9CLKkzSKfPuLgaq0Apne 2bn4OVfVObHw2w5DNQxMdmkR02kI5pgWMrhgLEZrvWWfkxijaDTo/XTQPhrpFQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRp5W4n8vzg9R for ; Fri, 29 May 2026 16:02:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 367ae by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:02:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 851499046d25 - main - MAC/do: Add consistency tests 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: 851499046d25fbe5841a55fb7bfcc879522f59a8 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:02:07 +0000 Message-Id: <6a19b87f.367ae.8e17660@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=851499046d25fbe5841a55fb7bfcc879522f59a8 commit 851499046d25fbe5841a55fb7bfcc879522f59a8 Author: Olivier Certner AuthorDate: 2026-05-22 14:33:18 +0000 Commit: Olivier Certner CommitDate: 2026-05-29 15:41:51 +0000 MAC/do: Add consistency tests Test that: 1. Concurrent changes to different parameters on the same jail are independent/atomic. 2. Inheritance works. 3. Relaxing only parent jail rules does not leak to a subjail thanks to sequential consistency. 4. Sysctl knobs and jail parameters stay consistent. Some of these tests may be extended in the future with several layers of jails (there is only a single subjail currently). Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38 --- tests/sys/mac/do/Makefile | 2 +- tests/sys/mac/do/consistency.sh | 211 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+), 1 deletion(-) diff --git a/tests/sys/mac/do/Makefile b/tests/sys/mac/do/Makefile index bfca40efdc8d..0c40f65b65f6 100644 --- a/tests/sys/mac/do/Makefile +++ b/tests/sys/mac/do/Makefile @@ -2,7 +2,7 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/mac/do -ATF_TESTS_SH+= valid_configs invalid_configs +ATF_TESTS_SH+= valid_configs invalid_configs consistency ${PACKAGE}FILES+= common.sh diff --git a/tests/sys/mac/do/consistency.sh b/tests/sys/mac/do/consistency.sh new file mode 100644 index 000000000000..6a64917edb6d --- /dev/null +++ b/tests/sys/mac/do/consistency.sh @@ -0,0 +1,211 @@ +# Copyright (c) 2026 The FreeBSD Foundation +# +# SPDX-License-Identifier: BSD-2-Clause +# +# This software was developed by Olivier Certner at +# Kumacom SARL under sponsorship from the FreeBSD Foundation. + +SJ_JID_FILE=sj.jid + +atf_test_case concurrent_rules_exec_paths_changes +concurrent_rules_exec_paths_changes_head() +{ + atf_set descr "Consistency of rules and exec paths changes on same jail" +} +concurrent_rules_exec_paths_changes_body() +{ + local rules exec_paths rules_es exec_paths_es + + for I in $(jot - 1 1000); do + sysctl_set_and_check_rules "uid=$I>uid=1001" + done & + rules=$! + + for I in $(jot - 1 1000); do + sysctl_set_and_check_exec_paths /nowhere/nonexistent$I + done & + exec_paths=$! + + wait $rules + rules_es=$? + + wait $exec_paths + exec_paths_es=$? + + # atf_check called in the asynchronous AND-OR lists above causes exit of the + # subshells and also a write to the ATF result file. These writes are + # concurrent and may cause the result file to be malformed. Consequently, + # it is important that, once execution becomes sequential again, atf_fail() is + # called again (and not just exit()). + if [ $rules_es -ne 0 ] || [ $exec_paths_es -ne 0 ]; then + atf_fail "Rules exit status: $rules_es, \ +exec paths exit status: $exec_paths_es" + fi +} + +atf_test_case inheritance cleanup +inheritance_head() +{ + atf_set descr "Simple inheritance test (values propagated to child jail)" +} +inheritance_body() +{ + local sj rules exec_paths + + # For the sake of not running the test under Kyua + mac_do_ensure_disabled + + sj=$(launch_subjail) + echo $sj > "${SJ_JID_FILE}" + + jail -m jid=$sj ${ROOT_JAIL_PARAM}=inherit + JEXEC="jexec $sj" + mac_do_check_disabled + JEXEC= + + rules="uid=1001>uid=0" + sysctl_set_and_check_rules $rules + JEXEC="jexec $sj" + sysctl_check_rules $rules + JEXEC= + + rules="gid=1001>uid=0" + sysctl_set_and_check_rules $rules + JEXEC="jexec $sj" + sysctl_check_rules $rules + JEXEC= + + # Not really necessary, just to keep mac_do(4) disabled + sysctl_set_and_check_rules "" + + exec_paths="/nowhere/nonexistent" + sysctl_set_and_check_exec_paths $exec_paths + JEXEC="jexec $sj" + sysctl_check_exec_paths $exec_paths + JEXEC= + + exec_paths="$MDO" + sysctl_set_and_check_exec_paths $exec_paths + JEXEC="jexec $sj" + sysctl_check_exec_paths $exec_paths + JEXEC= +} +inheritance_cleanup() +{ + # We clean up our subjail manually just for the sake of launching this test + # with atf-sh. Kyua is informed that these tests should run in a jail, and + # kills it automatically after the test, which kills all subjails. It is + # annoying that atf-sh does not offer a more practical way to pass + # information from the body to the cleanup part than a file. + jail -r $(cat "${SJ_JID_FILE}") + rm -f "${SJ_JID_FILE}" +} + +atf_test_case inheritance_relax_parent_jail cleanup +inheritance_relax_parent_jail_head() +{ + atf_set descr \ + "Test sequential consistency in a \"relax parent rules\" scenario" +} +inheritance_relax_parent_jail_body() +{ + local sj rules exec_paths subproc + + sj=$(launch_subjail) + echo $sj > "${SJ_JID_FILE}" + + jail -m jid=$sj ${ROOT_JAIL_PARAM}=inherit + rules="uid=1001>uid=0" + sysctl_set_and_check_rules $rules + # Additional inheritance sanity check + JEXEC="jexec $sj" + sysctl_check_rules $rules + JEXEC= + exec_paths="$MDO" + sysctl_set_and_check_exec_paths $exec_paths + # Additional inheritance sanity check + JEXEC="jexec $sj" + sysctl_check_exec_paths $exec_paths + JEXEC= + + # Launch a process that tries to become 'root' from user 1002, and verify + # that this always fails. + { for I in $(jot - 1 1000); do + jexec $sj "$MDO" -u 1002 -g 1002 -G 1002 "$MDO" -i true 2>/dev/null && + exit 1 + done; true; } & + subproc=$! + + # Decouple the subjail from the parent jail, copying its parameters + jail -m jid=$sj ${ROOT_JAIL_PARAM}=new + # Allow user 1002 to become 'root' on the parent jail + sysctl_set_and_check_rules "$rules;uid=1002>uid=0" + JEXEC="jexec $sj" + # Additional sanity check (that rules of the subjail are now independent) + [ "$(sysctl_rules)" == $rules ] || atf_fail "Rules not copied" + [ "$(sysctl_exec_paths)" == $exec_paths ] || + atf_fail "Exec paths not copied" + JEXEC= + + wait $subproc || atf_fail "A transition wrongly succeeded in the subjail!" +} +inheritance_relax_parent_jail_cleanup() +{ + # See inheritance_cleanup() for explanations + jail -r $(cat "${SJ_JID_FILE}") + rm -f "${SJ_JID_FILE}" +} + +atf_test_case same_knob_and_jail_parameter cleanup +same_knob_and_jail_parameter_head() +{ + atf_set descr \ + "Corresponding sysctl knobs and jail parameters have same value" +} +same_knob_and_jail_parameter_body() +{ + local sj rules exec_paths subproc + + sj=$(launch_subjail) + echo $sj > "${SJ_JID_FILE}" + + # Set sysctl knobs, observe parameters + rules="uid=19999>uid=21700" + exec_paths="/improbable/path/he" + JEXEC="jexec $sj" + sysctl_set_and_check_rules $rules + sysctl_set_and_check_exec_paths $exec_paths + JEXEC= + atf_check -o inline:"$rules\n" jls -j $sj ${RULES_JAIL_PARAM} + atf_check -o inline:"${exec_paths}\n" jls -j $sj ${EXEC_PATHS_JAIL_PARAM} + + # Set parameters, observe knobs + rules="uid=128000>uid=-1" + exec_paths="/hello/i_ve/changed" + jail -m jid=$sj ${RULES_JAIL_PARAM}=$rules \ + ${EXEC_PATHS_JAIL_PARAM}=${exec_paths} + JEXEC="jexec $sj" + sysctl_check_rules $rules + sysctl_check_exec_paths $exec_paths + JEXEC= +} +same_knob_and_jail_parameter_cleanup() +{ + # See inheritance_cleanup() for explanations + jail -r $(cat "${SJ_JID_FILE}") + rm -f "${SJ_JID_FILE}" +} + + +atf_init_test_cases() +{ + . $(atf_get_srcdir)/common.sh + atf_require_prog jot + # Needs an absolute path for mdo(1), to set it in exec_paths + atf_require_prog "$MDO" + + atf_add_test_case concurrent_rules_exec_paths_changes + atf_add_test_case inheritance + atf_add_test_case inheritance_relax_parent_jail + atf_add_test_case same_knob_and_jail_parameter +} From nobody Fri May 29 16:06: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 4gRpBY47z4z6fljx for ; Fri, 29 May 2026 16:06: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 4gRpBX54T6z3SYQ for ; Fri, 29 May 2026 16:06:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780070788; 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=yP6uRoBXITeMoCEFJnCd4fQYhSNmcwO7IA7AZ6i3rZo=; b=dQjRerXjNnKEXk+wFe4tD3HJgklkTlbGGpxMV+oabxNuNT1E2yi77pWh78FIAzS6HkuDLh HTHX19wb+SzqcwTXaw2wU8Ecle6bmv0/3rpe70KT8QCiR+P4/xKNo7GYQuPU34qO7hmmba 6LYfKqytwIL7AFzaltjRTmxqy0tJN/t/J/L2Mm1XLE1oP8YkfT1ZBwlHV+aHPn2QkJAY+o gvyqj8At/smCJk8L1N3nZ1HonJkO0WxZtrZCNP60VwbPladtbScLyDh1nSKMHsmaDIDnml lRzHnT8n9obMXtRjDF+0+titfYBBiE3w7pmcrrdCx0Au0Rm96zChBIFouRY0iw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780070788; a=rsa-sha256; cv=none; b=pOvh+yYh9SoNZ33iuc45zeOg+zgM40xPiCFKORE+7BqtEVNC/m7HWhf4cZ8TFRsGKjE7f6 /MWzDG7KeW9wB2eWU3MamGfgukdJKqKcNGxV/IygJMiIeGyzOLjZFuoCUNLZwovSQdVclN pOGA2+leuROUTaEAnI2OmlZWZOt8xgrjz/ZdOHmzZzf61Bd1Qb5wlrAEDldOr6QwBl6DX5 hmAiXi5zQumSdLt3wKEDYCDQKWJhNoYFhlHK/DjPIab4ipvoPO7bLLT7h6eeKolhuMcnTy Z4OcncFTnHSevr+nzovXCJb2/4vmqRJuC6e8U99qR0IW0z2789gODAOJ23BqTw== 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=1780070788; 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=yP6uRoBXITeMoCEFJnCd4fQYhSNmcwO7IA7AZ6i3rZo=; b=V00Y5NNehZhu1s9pxb9yg2QAu4mgmDN2aKChY6IGXZ2wxy64tTkJpmVxm7iC67qekWKV0m p0sDTV5S67CkQjzDCWD4evSNfV6U6KARptnIcZD4x4gqOc2fFwnymlPr9F17nStw3sgy/P sACt3WN4Xfsxsgr5lfvUWl19IKC65iHmLtctw2vnf0RCs2edz4bChcNPdmTGndMcrc8GQs Hw8RA0bUTKVPjvTc6M5C4B57/LL+PzW7Yn/eC7zyMRRtBNKJjfUo3oc50hS5mEqbg+ej9a J3L/4TVH/g0rFlROy0AlaZcSDVDkqrbcpCIrFXfLxPhjpqzGI3YQqPL+4qkGMA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRpBX4BhZzgrx for ; Fri, 29 May 2026 16:06:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32e7a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:06:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: f6911b941f14 - main - sys: Renumber MTE SEGV codes 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6911b941f142aef47479d7ec631724bff138f5c Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:06:28 +0000 Message-Id: <6a19b984.32e7a.3d09316d@gitrepo.freebsd.org> The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f6911b941f142aef47479d7ec631724bff138f5c commit f6911b941f142aef47479d7ec631724bff138f5c Author: Andrew Turner AuthorDate: 2026-05-29 15:22:29 +0000 Commit: Andrew Turner CommitDate: 2026-05-29 16:06:14 +0000 sys: Renumber MTE SEGV codes Some third party software expects these to not conflict. As the MTE support isn't fully in the tree, and these values aren't in a release we can renumber them without any backwards compatibility issues. Sponsored by: Arm Ltd --- sys/sys/signal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/signal.h b/sys/sys/signal.h index 863b981c2b7a..792087f735a1 100644 --- a/sys/sys/signal.h +++ b/sys/sys/signal.h @@ -307,8 +307,8 @@ struct __siginfo32 { #define SEGV_ACCERR 2 /* Invalid permissions for mapped */ /* object. */ #define SEGV_PKUERR 100 /* x86: PKU violation */ -#define SEGV_MTEAERR 100 /* arm64: Asynchronous Arm MTE error */ -#define SEGV_MTESERR 101 /* arm64: Synchronous Arm MTE error */ +#define SEGV_MTEAERR 200 /* arm64: Asynchronous Arm MTE error */ +#define SEGV_MTESERR 201 /* arm64: Synchronous Arm MTE error */ /* codes for SIGFPE */ #define FPE_INTOVF 1 /* Integer overflow. */ From nobody Fri May 29 16:15:53 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 4gRpPV5Lm2z6fmV9 for ; Fri, 29 May 2026 16:15:58 +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 4gRpPP249Xz3Zkx for ; Fri, 29 May 2026 16:15:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780071353; 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=lZQSe+EBm5Sv+sIpePpm4OHfYBTtoLf9AJ1/MhznQUk=; b=M5sbaZglWletSKvQmPCE6Q/U/uknHYfDidOFPEMVLhjx23sn+t+TgDEDARInsTfXpRvsz1 FrXwcVz8ShTI5MNFhYOW6r3GErrFkQ196i2zmMLBfiqSpkAPbV1lup0xkdjTrTU8rl8HkY UHLQXUCXGBU6PHo9Gz+YCetOpdnes+2DGsb0OWDTBWA25zzWYwUvHw6aKQ72M/W99njaT+ A2bPxv+iOl3v3JhwR4X3yvLi+KuE03If3hr71RCg5UYWLrq5t4VQiCrjEmiXRC1RQCLD+r zrnN22fP73GzQufbjfUfnR/i6JtQtia12nj/ajb078GY8rtaGbDljJQlYIx8DA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780071353; a=rsa-sha256; cv=none; b=W3R9Z77jT8tdrwloZLnQEq0esbQMfXv40Oj3YVzkFFJVPpZCS9YxsOwdjKcfrCfn8oUOhg NGstq3AIHCpj2WxdqrbGLqTk/gRFTP2AuckCpQqF5ojuyFaWF84RV2N/dARCfgQhP9Kp3D BKT5bOzswNl9r9oCtyhYIFRjHnGD21Zpuh80TRuB8SqQELnUEsSCrRBXa/JREcMF/gOyEt 7MVgs/Gq1KMR6qDO2FZvS8HZKVfoti0VRgE2nIhteD3h5RTw57u/ODnBb+OyleT+ZiVpcs aDPR1FPJeKOEu5xyIoMYzxz27psWlP1ZCJYoEg2noad2aAaxLWWUu47T3Z3b6A== 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=1780071353; 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=lZQSe+EBm5Sv+sIpePpm4OHfYBTtoLf9AJ1/MhznQUk=; b=CHbMsXmUjFuZ5BAQS/K8+M7cs2tS0HdFvReue/pBzP68sEHfZ+wTArDQ6JKEpe6j3uOVQt NRGRs7dISMG/z6q2IGilKXN0ZH3c8a6ZYz1i8g0gYbcelpWXbvtE0u4kIe7UBXGzd6/mTt Gy4+YP/XFkXpkcwCv5purwtu8CyHJJw6W8EZxRf0XMKaA2TvaRlODDdxznCyx0aiBkFPm0 VljjPu26tyqdgfcESOgzBXc0In8xnpQlYxUmCGtPWfidI/BGp9AaTFnOgTAclU9AJE0Wr9 njfOttATMJhVUkECJOgXRpRti8QnHKDdF/qlBiMFsAYLi92aVlZmEFLeMZAjKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRpPP1NK6zgqd for ; Fri, 29 May 2026 16:15:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 367da by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 16:15:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefa=?utf-8?Q?n E=C3=9Fer?= Subject: git: aa029088ec13 - main - tools/test/stress2/misc: Add msdosfs tests (currently failing) 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: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa029088ec130d71b406c4118346fbd933940826 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 16:15:53 +0000 Message-Id: <6a19bbb9.367da.25daf623@gitrepo.freebsd.org> The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=aa029088ec130d71b406c4118346fbd933940826 commit aa029088ec130d71b406c4118346fbd933940826 Author: Stefan Eßer AuthorDate: 2026-05-29 15:52:05 +0000 Commit: Stefan Eßer CommitDate: 2026-05-29 16:15:33 +0000 tools/test/stress2/misc: Add msdosfs tests (currently failing) Test msdos22.sh creates 1000 files with long random names consisting of only ASCII characters. The mount is performed without -L option, therefore no use of iconv to convert between character sets. Test msdos23.sh mixes some non-ASCII characters into the file names. The file system is therefore mounted with -L C.UTF-8 to include tests of the conversions between UTF-8 and UTF-16. Test msdos24.sh adds emojis to the names to test the (not yet committed) support of UTF-16 surrogate pairs in filenames. All 3 tests succeed with a small number of files (e.g., 10), but fail most of the time when testing with 1000 files. The tests have been added to all.exclude since they are expected to fail. They shall be enabled as regression tests, when the msdosfs code has been fixed. --- tools/test/stress2/misc/all.exclude | 3 ++ tools/test/stress2/misc/msdos22.sh | 79 ++++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/msdos23.sh | 79 ++++++++++++++++++++++++++++++++++++ tools/test/stress2/misc/msdos24.sh | 80 +++++++++++++++++++++++++++++++++++++ 4 files changed, 241 insertions(+) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 9ec5bffde0f6..7109555c5508 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -39,6 +39,9 @@ mount7.sh https://people.freebsd.org/~pho/stress/log/log0549.txt 20240912 mlockall2.sh Unrecoverable OOM killing seen 20190203 mlockall6.sh https://people.freebsd.org/~pho/stress/log/log0430.txt 20230403 mlockall7.sh Needs further investigation 20210123 +msdos22.sh Waiting for fix 20260529 +msdos23.sh Waiting for fix 20260529 +msdos24.sh Waiting for fix 20260529 msetdomain.sh May change policy for random threads to domainset_fixed 20210104 newfs4.sh watchdog fired. newbuf (still seen 20240729) 20190225 nfs10.sh Double fault 20151013 diff --git a/tools/test/stress2/misc/msdos22.sh b/tools/test/stress2/misc/msdos22.sh new file mode 100755 index 000000000000..158a52a7aa7b --- /dev/null +++ b/tools/test/stress2/misc/msdos22.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +# Test file operations using long random file names consisting only of ASCII characters + +MDUNIT=10 +FS=/mnt +LOCALE=C.UTF-8 +FILES=1000 + +export LANG=$LOCALE + +randomfilename () { + name="f" + count=$(jot -r 1 10 3) + for r in $(jot -r $count 7 0); do + r=$(( r + 0 )) + c='_' + if [ $r -gt 0 ]; then + for i in $(jot $r); do + name="$name$i" + done + fi + count=$(( count - 1 )) + if [ "$count" -gt 0 ]; then + name="$name$c" + fi + done + echo "$name" +} + +( + set -e + + mdconfig -u $MDUNIT -t malloc -s 512m + newfs_msdos -c 8 -F 32 /dev/md$MDUNIT > /dev/null 2>&1 + mkdir -p $FS + mount_msdosfs /dev/md$MDUNIT $FS + + mkdir -p $FS/test + cd $FS/test + + for i in $(jot $FILES); do + newfile=$(randomfilename) + case $testfiles in + *"$newfile"*) continue;; + esac + testfiles="$(randomfilename) +$testfiles" + done + + for f in $testfiles; do + echo "$f" > $f + done + for f in $(echo "$testfiles" | sort -R); do + cp $f $f.tmp + done + for f in $(echo "$testfiles" | sort -R); do + mv $f.tmp $f + done + for f in $(echo "$testfiles" | sort -R); do + rm $f + done +) + +failed=$? + +cd + +[ "$failed" -ne 0 ] && ls $FS/test + +umount /dev/md$MDUNIT + +#[ "$failed" -ne 0 ] && hd /dev/md$MDUNIT > /tmp/msdos22.dump + +fsck_msdosfs -y /dev/md$MDUNIT + +mdconfig -d -u $MDUNIT 2>/dev/null + +exit $failed diff --git a/tools/test/stress2/misc/msdos23.sh b/tools/test/stress2/misc/msdos23.sh new file mode 100755 index 000000000000..18982c34f68b --- /dev/null +++ b/tools/test/stress2/misc/msdos23.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +# Test file operations using random file names containing non-ASCII characters + +MDUNIT=10 +FS=/mnt +LOCALE=C.UTF-8 +FILES=1000 + +export LANG=$LOCALE + +randomfilename () { + name="f" + count=$(jot -r 1 10 3) + for r in $(jot -r $count 7 0); do + r=$(( r + 0 )) + c='·' + if [ $r -gt 0 ]; then + for i in $(jot $r); do + name="$name$i" + done + fi + count=$(( count - 1 )) + if [ "$count" -gt 0 ]; then + name="$name$c" + fi + done + echo "$name" +} + +( + set -e + + mdconfig -u $MDUNIT -t malloc -s 512m + newfs_msdos -c 8 -F 32 /dev/md$MDUNIT > /dev/null 2>&1 + mkdir -p $FS + mount_msdosfs -L $LOCALE /dev/md$MDUNIT $FS + + mkdir -p $FS/test + cd $FS/test + + for i in $(jot $FILES); do + newfile=$(randomfilename) + case $testfiles in + *"$newfile"*) continue;; + esac + testfiles="$(randomfilename) +$testfiles" + done + + for f in $testfiles; do + echo "$f" > $f + done + for f in $(echo "$testfiles" | sort -R); do + cp $f $f.tmp + done + for f in $(echo "$testfiles" | sort -R); do + mv $f.tmp $f + done + for f in $(echo "$testfiles" | sort -R); do + rm $f + done +) + +failed=$? + +cd + +[ "$failed" -ne 0 ] && ls $FS/test + +umount /dev/md$MDUNIT + +#[ "$failed" -ne 0 ] && hd /dev/md$MDUNIT > /tmp/msdos23.dump + +fsck_msdosfs -y /dev/md$MDUNIT + +mdconfig -d -u $MDUNIT 2>/dev/null + +exit $failed diff --git a/tools/test/stress2/misc/msdos24.sh b/tools/test/stress2/misc/msdos24.sh new file mode 100755 index 000000000000..195c4ba8d9b9 --- /dev/null +++ b/tools/test/stress2/misc/msdos24.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# Test file operations using long random file names containing UTF-16 surrogate pairs + +MDUNIT=10 +FS=/mnt +LOCALE=C.UTF-8 +FILES=1000 + +export LANG=$LOCALE + +randomfilename () { + name="f" + count=$(jot -r 1 10 3) + for r in $(jot -r $count 7 0); do + r=$(( r + 0 )) + emoji="\0360\0237\0230\020$r" + c=$(echo -e $emoji) + if [ $r -gt 0 ]; then + for i in $(jot $r); do + name="$name$i" + done + fi + count=$(( count - 1 )) + if [ "$count" -gt 0 ]; then + name="$name$c" + fi + done + echo "$name" +} + +( + set -e + + mdconfig -u $MDUNIT -t malloc -s 512m + newfs_msdos -c 8 -F 32 /dev/md$MDUNIT > /dev/null 2>&1 + mkdir -p $FS + mount_msdosfs -L $LOCALE /dev/md$MDUNIT $FS + + mkdir -p $FS/test + cd $FS/test + + for i in $(jot $FILES); do + newfile=$(randomfilename) + case $testfiles in + *"$newfile"*) continue;; + esac + testfiles="$(randomfilename) +$testfiles" + done + + for f in $testfiles; do + echo "$f" > $f + done + for f in $(echo "$testfiles" | sort -R); do + cp $f $f.tmp + done + for f in $(echo "$testfiles" | sort -R); do + mv $f.tmp $f + done + for f in $(echo "$testfiles" | sort -R); do + rm $f + done +) + +failed=$? + +cd + +[ "$failed" -ne 0 ] && ls $FS/test + +umount /dev/md$MDUNIT + +#[ "$failed" -ne 0 ] && hd /dev/md$MDUNIT > /tmp/msdos24.dump + +fsck_msdosfs -y /dev/md$MDUNIT + +mdconfig -d -u $MDUNIT 2>/dev/null + +exit $failed From nobody Fri May 29 17:00:25 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 4gRqNv1WXSz6fqFS for ; Fri, 29 May 2026 17:00:31 +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 4gRqNt5jTWz3fdM for ; Fri, 29 May 2026 17:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780074030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7gq34NYJTm0ObEoCxAEaUl36dUfoI0LnYMcgLkPWUw8=; b=UyheD1jTaPaCGDvHdBIcKxEeo6rFwD+RSOZaN0Id20Hop3U7M6v8QMaIKz0AQQ+kHWMjlW UccRm8KBZXhwSsoSrtmWtgryOzoanNcP/SS6GOr95Mp+6w2jnf2+BS0B9b4PwbMYjgnMgB G7BwHSNAiiPam9Nd4lrSeZPDA+hVJ4vOoayvpz2G0kF9F44CsDGN0Yi0rVQiLqzYDMXvEi XZNZ4xNv9dgssokaKFETvOvsE3LkWTaxyxI6VNVwJP6eiRouCnxpaF4UycwhEO2gBjbx9q XXYcTFIHdiurRXRgJoNwvWWEPrxVlP8FZBmcMclO7+e1l1LbZZMYZkLWgkfZhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780074030; a=rsa-sha256; cv=none; b=ruX+OyuY7EgUzWxojTWJvvuVOxT6fdcNYf/UDWJuM52sAWZgmYHr3fTljdWcsqkHcsLzuJ keqqg5JROI2hDlEVmwlBDuu/xTYDSQ72uBhTwY+HJOv2/JMAtkOy0pXFz+hQ/g8TVdFzn5 Kn1YUolvgFHl3QV72b+N3zO4RQtfQS2HEN5M/4XrNQfLsRqw0r8dxeXrwfhX7lte6XK4u9 Y/HSTdPhncCk89jbF/ZCpadfzV7+jbOMW12CbmQ5koIqfAXyKGMAj19jtHBCUAXiZgWTTj AGiYXMKGcpfkJv9H1cpzYw+bqfiOsxIGLWfe/0Gq43oEFHWpYmyqnPhGulbqmw== 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=1780074030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7gq34NYJTm0ObEoCxAEaUl36dUfoI0LnYMcgLkPWUw8=; b=nZuNvAw6EpqW/sPLaztHXdtjhNTlgOH3cgW6Rt47Bj2Cn+pa/aRkWQGfYry3rPE31FVQEP OQxRwOL/mKSeeNX8jMS1SjuxnDLCLQkk+jEb0N2rXQlH5yf90IqyzhKC8ow28OJIlzEPFB JbZU6x8chkweykzhFRcCDvc/FiW8BAaC0wWObVhu6f0dOYXKqH1JJex5MyBHsn6Q+xB3B/ +reFR4SzxEr4o8dZYaYRVTJ5jS9m2SveYBV88VQmrs4nkrF1XZWDT3Q1m8NDtHtFT+tQ33 TvsrLk+x8o9shb6ZlVe/GtkEEHeMMqOch3tAXBgfF5f8ax8zinyHCBaeoiIT0w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRqNt4nlTzjBh for ; Fri, 29 May 2026 17:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b0b1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 17:00:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Sulev-Madis Silber From: Adrian Chadd Subject: git: ee41a882054c - main - spi: switch to switch 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee41a882054c0761853971f8742607b3eae06784 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 17:00:25 +0000 Message-Id: <6a19c629.3b0b1.63ab913@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=ee41a882054c0761853971f8742607b3eae06784 commit ee41a882054c0761853971f8742607b3eae06784 Author: Sulev-Madis Silber AuthorDate: 2026-05-29 16:58:50 +0000 Commit: Adrian Chadd CommitDate: 2026-05-29 16:58:50 +0000 spi: switch to switch use recommended switch with default case to catch invalid values Reviewed by: kevans, adrian Differential Revision: https://reviews.freebsd.org/D54759 --- usr.sbin/spi/spi.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/usr.sbin/spi/spi.c b/usr.sbin/spi/spi.c index 1ced2371e3d0..bbbc3d322b00 100644 --- a/usr.sbin/spi/spi.c +++ b/usr.sbin/spi/spi.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -364,30 +365,24 @@ main(int argc, char *argv[], char *envp[] __unused) /* do data transfer */ - if (stream) { - while (!err && !feof(stdin)) { - if (fdir == DIR_READ) { - err = perform_read(hdev, &opt); - } - else if (fdir == DIR_WRITE) { - err = perform_write(hdev, &opt); - } - else if (fdir == DIR_READWRITE) { - err = perform_readwrite(hdev, &opt); - } - } - } - else { - if (fdir == DIR_READ) { + assert(fdir != DIR_NONE); + do { + switch (fdir) { + case DIR_READ: err = perform_read(hdev, &opt); - } - else if (fdir == DIR_WRITE) { + break; + case DIR_WRITE: err = perform_write(hdev, &opt); - } - else if (fdir == DIR_READWRITE) { + break; + case DIR_READWRITE: err = perform_readwrite(hdev, &opt); + break; + default: + fprintf(stderr, "Invalid state (%d)\n", fdir); + err = EINVAL; + break; } - } + } while (stream && !err && !feof(stdin)); the_end: From nobody Fri May 29 17:45:17 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 4gRrNY4xzbz6fsHv for ; Fri, 29 May 2026 17:45:17 +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 4gRrNY4BzMz3kc9 for ; Fri, 29 May 2026 17:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780076717; 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=p5sxPwyzNce3nNf6GfoJRVQEAsdLm8r+nVyAcMt7JU0=; b=wEu71G2vfgnBRu2ontL9vSMAu1eB2xwkcYf6Qio3b6igDS1O+iKsQ7LOZw+5N1XLlw5QQw xbLeGErucCDtskWJOhj/YhGsE/ragSJ8n3zgcvh9xqooVNLjX0ksizvfTVU7rRsolqLR1F 3syKPr2oTuFoIuF67mqcvtq6/2XfHFgcnb07tLbE+gPpglEzu8qfxC6cadmCrSgNh5+FI+ luUgN/PlclQjubgbJxhrJxpafb/IggmKs7Y+8kYvCKJaaP5miYlgtg+WxdYQVeuJLaQ7Kl nVDl8VGSCM6VgrwgYtFd+dJFbNTIMO8KRknCA/0wjTpy+/XOlTp6gsg/y3NdTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780076717; a=rsa-sha256; cv=none; b=tIuhM6KQHydJxIlLt4qYt7J617WAlz32NO3XvrFgjkN8GkoGpKl7V2bVdsME8dX5A0363I B16Rp4hR4Umu8QYeGMLhsJfxhWy2wqqQ9MMIsA5O652ubamYc9dRV6nH926KstOlmMw8iE GbfU5o8Ww5uEw80C8vWwPgNWF03T4CocrMG7ldVKva+Fk2NRh+xp24CpVXsbMLoyzv/OUF X+AdTW7uPM+fL9H9s8YjXBJw6BfAOCrE45GWvskOkLkY4CWw/fiJUwVL+4bde7DNmtqxqC zen+OUoYQzEJQjoUXJ4onl2ttfqmDEMKtJguG/Wvq+Ye9a7fgN8vHj1fXLDuTA== 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=1780076717; 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=p5sxPwyzNce3nNf6GfoJRVQEAsdLm8r+nVyAcMt7JU0=; b=NqOYVBf38ty/z8UhCaZlfDDHAyhCwBn5XLrosMCRHmqB3oBD5K2ooTdEkZ2oSJT0Zs9LkX fd/S5E8ZYP2JE61bK+nG10tT4H5Gh1lBydgL7yV3+3YRFFwXn5v9kYGVHHfbD18oyPdvKJ IqnozmP9gAY+ZriVcUaQmYQKVepA6UecRD09cIALvMK0Y3Ad8V9I6G03Y08k1HFwoQ+7rV IHo6j1EyLdiUa2dGFJN+9dlcyNiF+jPpRHBURviXUvt77KS08wJFep73oR5GdYFUB+FGc9 uKlhsyij8D3LwZ6ivQcvq5/pOvAXC3G/ah6VwK/tURJs301Xo4hWPLj8DtOmDg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRrNY3RnSzk65 for ; Fri, 29 May 2026 17:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f4d4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 17:45:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 7ec549870f2a - main - fts: Add some depth to the options test 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ec549870f2adeb0e896885220d4af6b47c4c9ba Auto-Submitted: auto-generated Date: Fri, 29 May 2026 17:45:17 +0000 Message-Id: <6a19d0ad.3f4d4.40283f93@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=7ec549870f2adeb0e896885220d4af6b47c4c9ba commit 7ec549870f2adeb0e896885220d4af6b47c4c9ba Author: Dag-Erling Smørgrav AuthorDate: 2026-05-29 17:45:01 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-29 17:45:01 +0000 fts: Add some depth to the options test MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D57323 --- lib/libc/tests/gen/fts_options_test.c | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/lib/libc/tests/gen/fts_options_test.c b/lib/libc/tests/gen/fts_options_test.c index fc3015138a49..863c0809d16e 100644 --- a/lib/libc/tests/gen/fts_options_test.c +++ b/lib/libc/tests/gen/fts_options_test.c @@ -36,6 +36,8 @@ fts_options_prepare(const struct atf_tc *tc) ATF_REQUIRE_EQ(0, mkdir("dir", 0755)); ATF_REQUIRE_EQ(0, close(creat("file", 0644))); ATF_REQUIRE_EQ(0, close(creat("dir/file", 0644))); + ATF_REQUIRE_EQ(0, mkdir("dir/sd", 0750)); + ATF_REQUIRE_EQ(0, mkdir("dir/sd/sd", 0700)); ATF_REQUIRE_EQ(0, symlink("..", "dir/up")); ATF_REQUIRE_EQ(0, symlink("dir", "dirl")); ATF_REQUIRE_EQ(0, symlink("file", "filel")); @@ -57,6 +59,10 @@ ATF_TC_BODY(fts_options_logical, tc) { FTS_DL, "dead", "dead" }, { FTS_D, "dir", "dir" }, { FTS_F, "file", "dir/file" }, + { FTS_D, "sd", "dir/sd" }, + { FTS_D, "sd", "dir/sd/sd" }, + { FTS_DP, "sd", "dir/sd/sd" }, + { FTS_DP, "sd", "dir/sd" }, { FTS_D, "up", "dir/up" }, { FTS_DL, "dead", "dir/up/dead" }, { FTS_DC, "dir", "dir/up/dir" }, @@ -67,6 +73,10 @@ ATF_TC_BODY(fts_options_logical, tc) { FTS_DP, "dir", "dir" }, { FTS_D, "dirl", "dirl" }, { FTS_F, "file", "dirl/file" }, + { FTS_D, "sd", "dirl/sd" }, + { FTS_D, "sd", "dirl/sd/sd" }, + { FTS_DP, "sd", "dirl/sd/sd" }, + { FTS_DP, "sd", "dirl/sd" }, { FTS_D, "up", "dirl/up" }, { FTS_DL, "dead", "dirl/up/dead" }, { FTS_DC, "dir", "dirl/up/dir" }, @@ -108,6 +118,10 @@ ATF_TC_BODY(fts_options_logical_nostat, tc) { FTS_DL, "dead", "dead" }, { FTS_D, "dir", "dir" }, { FTS_NSOK, "file", "dir/file" }, + { FTS_D, "sd", "dir/sd" }, + { FTS_D, "sd", "dir/sd/sd" }, + { FTS_DP, "sd", "dir/sd/sd" }, + { FTS_DP, "sd", "dir/sd" }, { FTS_D, "up", "dir/up" }, { FTS_DL, "dead", "dir/up/dead" }, { FTS_DC, "dir", "dir/up/dir" }, @@ -118,6 +132,10 @@ ATF_TC_BODY(fts_options_logical_nostat, tc) { FTS_DP, "dir", "dir" }, { FTS_D, "dirl", "dirl" }, { FTS_NSOK, "file", "dirl/file" }, + { FTS_D, "sd", "dirl/sd" }, + { FTS_D, "sd", "dirl/sd/sd" }, + { FTS_DP, "sd", "dirl/sd/sd" }, + { FTS_DP, "sd", "dirl/sd" }, { FTS_D, "up", "dirl/up" }, { FTS_DL, "dead", "dirl/up/dead" }, { FTS_DC, "dir", "dirl/up/dir" }, @@ -151,6 +169,14 @@ ATF_TC_BODY(fts_options_logical_seedot, tc) { FTS_DOT, ".", "dir/." }, { FTS_DOT, "..", "dir/.." }, { FTS_F, "file", "dir/file" }, + { FTS_D, "sd", "dir/sd" }, + { FTS_DOT, ".", "dir/sd/." }, + { FTS_DOT, "..", "dir/sd/.." }, + { FTS_D, "sd", "dir/sd/sd" }, + { FTS_DOT, ".", "dir/sd/sd/." }, + { FTS_DOT, "..", "dir/sd/sd/.." }, + { FTS_DP, "sd", "dir/sd/sd" }, + { FTS_DP, "sd", "dir/sd" }, { FTS_D, "up", "dir/up" }, { FTS_DOT, ".", "dir/up/." }, { FTS_DOT, "..", "dir/up/.." }, @@ -165,6 +191,14 @@ ATF_TC_BODY(fts_options_logical_seedot, tc) { FTS_DOT, ".", "dirl/." }, { FTS_DOT, "..", "dirl/.." }, { FTS_F, "file", "dirl/file" }, + { FTS_D, "sd", "dirl/sd" }, + { FTS_DOT, ".", "dirl/sd/." }, + { FTS_DOT, "..", "dirl/sd/.." }, + { FTS_D, "sd", "dirl/sd/sd" }, + { FTS_DOT, ".", "dirl/sd/sd/." }, + { FTS_DOT, "..", "dirl/sd/sd/.." }, + { FTS_DP, "sd", "dirl/sd/sd" }, + { FTS_DP, "sd", "dirl/sd" }, { FTS_D, "up", "dirl/up" }, { FTS_DOT, ".", "dirl/up/." }, { FTS_DOT, "..", "dirl/up/.." }, @@ -198,6 +232,10 @@ ATF_TC_BODY(fts_options_physical, tc) { FTS_SL, "dead", "dead" }, { FTS_D, "dir", "dir" }, { FTS_F, "file", "file" }, + { FTS_D, "sd", "sd" }, + { FTS_D, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, { FTS_SL, "up", "up" }, { FTS_DP, "dir", "dir" }, { FTS_SL, "dirl", "dirl" }, @@ -224,6 +262,10 @@ ATF_TC_BODY(fts_options_physical_nochdir, tc) { FTS_SL, "dead", "dead" }, { FTS_D, "dir", "dir" }, { FTS_F, "file", "dir/file" }, + { FTS_D, "sd", "dir/sd" }, + { FTS_D, "sd", "dir/sd/sd" }, + { FTS_DP, "sd", "dir/sd/sd" }, + { FTS_DP, "sd", "dir/sd" }, { FTS_SL, "up", "dir/up" }, { FTS_DP, "dir", "dir" }, { FTS_SL, "dirl", "dirl" }, @@ -250,10 +292,18 @@ ATF_TC_BODY(fts_options_physical_comfollow, tc) { FTS_DL, "dead", "dead" }, { FTS_D, "dir", "dir" }, { FTS_F, "file", "file" }, + { FTS_D, "sd", "sd" }, + { FTS_D, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, { FTS_SL, "up", "up" }, { FTS_DP, "dir", "dir" }, { FTS_D, "dirl", "dirl" }, { FTS_F, "file", "file" }, + { FTS_D, "sd", "sd" }, + { FTS_D, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, { FTS_SL, "up", "up" }, { FTS_DP, "dirl", "dirl" }, { FTS_F, "file", "file" }, @@ -279,10 +329,18 @@ ATF_TC_BODY(fts_options_physical_comfollowdir, tc) { FTS_DL, "dead", "dead" }, { FTS_D, "dir", "dir" }, { FTS_F, "file", "file" }, + { FTS_D, "sd", "sd" }, + { FTS_D, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, { FTS_SL, "up", "up" }, { FTS_DP, "dir", "dir" }, { FTS_D, "dirl", "dirl" }, { FTS_F, "file", "file" }, + { FTS_D, "sd", "sd" }, + { FTS_D, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, { FTS_SL, "up", "up" }, { FTS_DP, "dirl", "dirl" }, { FTS_F, "file", "file" }, @@ -308,6 +366,10 @@ ATF_TC_BODY(fts_options_physical_nostat, tc) { FTS_SL, "dead", "dead" }, { FTS_D, "dir", "dir" }, { FTS_NSOK, "file", "file" }, + { FTS_D, "sd", "sd" }, + { FTS_D, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, { FTS_NSOK, "up", "up" }, { FTS_DP, "dir", "dir" }, { FTS_SL, "dirl", "dirl" }, @@ -334,6 +396,10 @@ ATF_TC_BODY(fts_options_physical_nostat_type, tc) { FTS_SL, "dead", "dead" }, { FTS_D, "dir", "dir" }, { FTS_F, "file", "file" }, + { FTS_D, "sd", "sd" }, + { FTS_D, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, { FTS_SL, "up", "up" }, { FTS_DP, "dir", "dir" }, { FTS_SL, "dirl", "dirl" }, @@ -362,6 +428,14 @@ ATF_TC_BODY(fts_options_physical_seedot, tc) { FTS_DOT, ".", "." }, { FTS_DOT, "..", ".." }, { FTS_F, "file", "file" }, + { FTS_D, "sd", "sd" }, + { FTS_DOT, ".", "." }, + { FTS_DOT, "..", ".." }, + { FTS_D, "sd", "sd" }, + { FTS_DOT, ".", "." }, + { FTS_DOT, "..", ".." }, + { FTS_DP, "sd", "sd" }, + { FTS_DP, "sd", "sd" }, { FTS_SL, "up", "up" }, { FTS_DP, "dir", "dir" }, { FTS_SL, "dirl", "dirl" }, From nobody Fri May 29 17:45:18 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 4gRrNZ6436z6fstM for ; Fri, 29 May 2026 17:45:18 +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 4gRrNZ518hz3kRK for ; Fri, 29 May 2026 17:45:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780076718; 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=O4wFSCGKBeMfSHMIEvVBWpmRowXOWubmSm9oMbpEMzs=; b=cmmBZSHhGCddYUeeI+F7/+ydg+eBjFJOzYOx0/jRtKKVHZ3ELwxGOxalISu7VW1kzMNhB3 1CWbyykOCu2TepxPOa4hdt/MCApRX2o+ulnoUb+f/EB3Vn/AvQY2l+HHHCiJuaaD9A4DTZ UKWym0fq3egfA0BcjEFCKT2hoU5NXSxcNMjei+/k/LIRHeqAvAQbTifu+wlKrpya+H5TaI oivw1T6qOj8v93aQ5MYybvyz3yQFZ1HDbCiaW4nWZ44VXj++o2muVDK/yxRls4wMX7Dh08 ckXcPaLudriA6bRLFbXJ4zpu5bPG1UvWyYbZHzTAZms//d6Jj/zDLRSWJwnDqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780076718; a=rsa-sha256; cv=none; b=iEo2oNArriDTWri4A1Jl+4XS8Makh9zThcCFdnpX29YMtfu3sahkietJvyAqoVIdWMBaRf htv8FvxSSKxzow0V6ZTg0RCh2EHd1CaFTasS9QzhAK9e3cnSKqSCvMYsxPqVlrlGYnk97B XLpbXYCbyD5a7q9tGORaU/wopUfjNx6nkJ6tKr9yT0yEbJHnwSuOixHD9mU4dwV4JLHHu9 oOhlGwgGsFjRO9rJZ5fOMDM6uueMFjzVvC9QJ/aaI2GlISF2B43pTDtQg2D1aILreoH8JB V95cyqcWphiteKIg8fubpO/HD0Qdh3f0Yx0zCh+sBZi/zwKAtT2Wf6hJn65OGg== 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=1780076718; 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=O4wFSCGKBeMfSHMIEvVBWpmRowXOWubmSm9oMbpEMzs=; b=yVfTlAzbMjxEc8N2qaFLVOnqbH0GvBielqbEfNdZnu/we49o+DFW9lLwpdUCcslHtxUHxr BfXwB49bkskGgFEhJJhDlbdx+CfKhkKWAJAULa/k3MioTuIFbA1He+ISqTJ5Qj8dnvcw9J uLN709I4/ON4hLVy6AHe8jRFWHhlJ75geNY8rJr7kX/W2Dggqoyr0N43Mt6f581fpsOXOE IAgYlBIeH2YD6u45cVWeK526a6Ks4yYp6N6D/gMUBSvzD2D1tpGHN2czx9YU8XwKnnSVeA RnzBJSnYDlmwYCQen5hS40an14jD+bTlhJKdxfFs44pL6m/fxIM3tRL8C+AgbA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRrNZ3v6szkFH for ; Fri, 29 May 2026 17:45:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3fbb7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 17:45:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: b2b95249ae0e - main - fts: Check link count before using it 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2b95249ae0e24a6e24ad4286da56f1aff7a6db0 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 17:45:18 +0000 Message-Id: <6a19d0ae.3fbb7.5b206217@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=b2b95249ae0e24a6e24ad4286da56f1aff7a6db0 commit b2b95249ae0e24a6e24ad4286da56f1aff7a6db0 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-29 17:45:06 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-29 17:45:06 +0000 fts: Check link count before using it * Check the range of the link count before trying to use it. * Rewrite the comment explaining what the link count is used for. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D57324 --- lib/libc/gen/fts.c | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index 4aa386d777cd..e8063ecb646e 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,19 @@ static const char *ufslike_filesystems[] = { 0 }; +/* + * POSIX provides nlink_t but unfortunately not NLINK_MAX. + */ +#define NLINK_MAX \ + _Generic((nlink_t)0, \ + int16_t: INT16_MAX, \ + uint16_t: UINT16_MAX, \ + int32_t: INT32_MAX, \ + uint32_t: UINT32_MAX, \ + int64_t: INT64_MAX, \ + uint64_t: UINT64_MAX, \ + default: 0) + static FTS * __fts_open(FTS *sp, char * const *argv) { @@ -736,7 +750,7 @@ fts_build(FTS *sp, int type) int cderrno, descend, oflag, saved_errno, nostat, doadjust, readdir_errno; long level; - long nlinks; /* has to be signed because -1 is a magic value */ + int64_t nlinks; /* has to be signed because -1 is a magic value */ size_t dnamlen, len, maxlen, nitems; /* Set current node pointer. */ @@ -759,16 +773,36 @@ fts_build(FTS *sp, int type) } /* - * Nlinks is the number of possible entries of type directory in the - * directory if we're cheating on stat calls, 0 if we're not doing - * any stat calls at all, -1 if we're doing stats on everything. + * In the FTS_PHYSICAL | FTS_NOSTAT case, we want to avoid calling + * fstat() unnecessarily, but we still need to call it for + * subdirectories. The current directory's link count provides an + * upper bound on the number of subdirectories we may encounter + * (including . and .. in the FTS_SEEDOT case). We initialize + * nlinks to the current directory's link count, then decrement it + * every time we encounter a directory, so when we hit zero we can + * save some time by not calling fstat() on subsequent entries. + * + * If FTS_NOSTAT is not set, or the link count is less than two + * (which should not be possible) or equal to NLINK_MAX (which + * suggests that the actual value could be higher), or the current + * filesystem is not known to provide reliable link counts, we + * initialize nlinks to -1 and fstat() everything. + * + * In the rare case where we don't need to stat anything, even + * subdirectories, we initialize nlinks to 0 regardless of the + * actual link count. + * + * Note that we ignore the FTS_NOSTAT flag in the FTS_LOGICAL + * case, although we could choose to only stat symbolic links. + * Implementing this is left as an exercise for the reader. */ if (type == BNAMES) { nlinks = 0; /* Be quiet about nostat, GCC. */ nostat = 0; } else if (ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL)) { - if (fts_ufslinks(sp, cur)) + if (cur->fts_nlink >= 2 && cur->fts_nlink < NLINK_MAX && + cur->fts_nlink <= INT64_MAX && fts_ufslinks(sp, cur)) nlinks = cur->fts_nlink - (ISSET(FTS_SEEDOT) ? 0 : 2); else nlinks = -1; From nobody Fri May 29 17:45:19 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 4gRrNb6RwFz6fslx for ; Fri, 29 May 2026 17:45:19 +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 4gRrNb5JpRz3kTj for ; Fri, 29 May 2026 17:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780076719; 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=IZcqTjIR4r5IsGvS0d/OgYiI+gbd8dt+Vs6aDN2bELc=; b=c5pseZc+5/JsCYW847ScXGAB94aprXjhPtoUPsBzGFr7puoG/2vgY2JhAgXL8Re+5Dw0V6 UGwvcWRUT/2GErx3ar18vChUvhuI893TA8mpWqpfH52kuImmf4AWcDrzqDj0txExcnfTIM yYvaKzLKPdi7m49AazSuih2g8AkTfavV4e6fs2vRymEcPEJ75ojnPKHEBlSxVdzMEYjwj7 tsDjcKXXs7Ljftpn16I1DFgfnC73Vt17wCzNM5fsZrqMbW3bfWIjhUFLap2c/LL1pt9RqQ XXDzakomKp4AgJjpvPqavK1qmaEUDVN7V0HCpQg//ROvG5WfBcZ3NpPVHrgmcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780076719; a=rsa-sha256; cv=none; b=Pmgo3N/1c4FqXJADci/AijsUK/0c7ryp5K6bKZHgmKhuvbOLFbdjOZjGobN21l5svvKqtO POij4zcZMNznrmiwMIxa7IHxmdR/2zlpVqp8JCLSzDWVr71Q+7o+ehs2Pd4VkOQnWxaP28 jYCYa58W2ZLEfY7klpJi5uI3u4WIPL07SCI7yng/dNdUmrFL5j3w8MoOzyyi/+2yxhftHz 6dk2af5c5rSTfFq1csQTgl2apr9RAfRwoA2S0xhBKfEAunMMp/RQsSDu47QQkyzierxqkL CODN1jVAQyeHXWCXBkjqDMCSyWmEVKhMe71gNfq/02mHsqHlaQoQT8tU5pmtdA== 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=1780076719; 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=IZcqTjIR4r5IsGvS0d/OgYiI+gbd8dt+Vs6aDN2bELc=; b=l0Y244OMhXXzHAV63xXzyc4bzCktsoBGrcxSGqVyArNcUyuKcBos+6sYUOP92krHUFkU9s PJ7TckfOcbbf4Bkx4/fe0FgDDeXJBR+Gn3sFd5fqRLF4Y33BwG7jeRfDmRLY357jE1OoWY 1FribztDL8a8LXT/EPV03QyNKK+EOf+D27vS9TgaeKgYsEr8fxMK6Su4fi1iiYgmL11ZaP GCBpft67xZFcYfQ73c0ZvJPBBwF/PXpefB5Yzf55MAI364xgcQJ0TlFUN3HiKqLz3Uvp6z OId0001P0gSV6gyTcJRrQVR+vSeAqPlcwQf44xoY8DBE2CmugddOAxkeGW7mbg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRrNb4fDszkFK for ; Fri, 29 May 2026 17:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3efa6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 17:45:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: dce6aff90b13 - main - fts: Improve the description of FTS_NOSTAT 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dce6aff90b13f30fcb4c1fa263868607ccda8041 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 17:45:19 +0000 Message-Id: <6a19d0af.3efa6.6a09da6a@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=dce6aff90b13f30fcb4c1fa263868607ccda8041 commit dce6aff90b13f30fcb4c1fa263868607ccda8041 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-29 17:45:10 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-29 17:45:10 +0000 fts: Improve the description of FTS_NOSTAT Note that we still need to stat directories and the roots. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D57325 --- lib/libc/gen/fts.3 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/libc/gen/fts.3 b/lib/libc/gen/fts.3 index 199603b5f3c7..b6dbfffe8079 100644 --- a/lib/libc/gen/fts.3 +++ b/lib/libc/gen/fts.3 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 21, 2026 +.Dd May 29, 2026 .Dt FTS 3 .Os .Sh NAME @@ -497,6 +497,13 @@ field to and leave the contents of the .Fa statp field undefined. +The roots and any directories encountered during traversal +.Po +.Dv FTS_D , +.Dv FTS_DC , +.Dv FTS_DP +.Pc +are still fully populated. .It Dv FTS_NOSTAT_TYPE This option is similar to .Dv FTS_NOSTAT , From nobody Fri May 29 22:07:05 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 4gRyBf2tP8z6gB3R for ; Fri, 29 May 2026 22:07:06 +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 4gRyBf15j1z4G2Z for ; Fri, 29 May 2026 22:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780092426; 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=HcLJEo+81pWcB8I0DJVVBrsx2LBk5FLNzN4chGtOg/Q=; b=lJpHxCGlOBrtfBmxdsEoG3uNosNVPmb0vIHe4VbAPboljrQ4tt8/IRUueboVzI6VN8pJ4I wmc3w5qJcb3Efd460HUPG0bYqAKp5Iu+YJbgPBAhpnAhlgiEVTT9p+MYdTSShn1Mdm2EjP YrjcwGEj7GrmHA7ZEkcQhAfcVYNuk1v+l8ukdTPmCyXc6W/Bc9H0MJf2JVNTBfrMOU8tQ+ 93fT2i/HdqAMNcwU6hBKWK4J32izPkrcWQ1/E+fmjtEb13cCT3kvO4LR+RehOfimowS8un womU44N3NuUfquhTzsico0t7eGMkGUNRjIDYZCXB9VPonE06JBs9gMkv/N3+3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780092426; a=rsa-sha256; cv=none; b=YPSfJP0VQE9qNDnpH/Yt8+NqYGQ+Y70gXal6cM/SNItZ3DfAvG3bqmx0w3145EsiPqbMGL TkbyLgabnRK1mkYFutDdMfUfMdJnq0z+z+QLtUXK6BlgRkcv/N3bQc/kyYjy+Yn0ai6M3n a0fz0BzD/+tIH1zAEiY4gj/65Bto4JieEA+4zVshaw/DDmr5pAuCptnvyeZu0XrDNTQ4e7 Ta2f2r8waHekjpWAbmqgw/kQtOpddXZh93b8SsxuD5+duWns6Gj9/V3t8OiH8TI/Lq+1TH uR0c9rdgEGnKATDgoaeQI0WKlJvrZ/QrxsiJhHQw3lIrKk4li+R+YmpMZKkabA== 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=1780092426; 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=HcLJEo+81pWcB8I0DJVVBrsx2LBk5FLNzN4chGtOg/Q=; b=EeGduz2g5hv1JiksJxq1NxGVfeiRhweExQtWQR1Xe9wYC30nBi9oWMyoSfJa5oTX2AU3VW l4Cavng3DnOhwW0t3FclPZ7QiPLEuBAhRLSoT+5YVvqiog0mMKemfR26IPrvXUu9EFCPo3 aDLyjNY6vuNx0A+y2fN8WCOzKwmt+uHAhn/TKAnRpUUydY54x8wZRiQ7rJoDFWRaCW1eim lGL9hpzN7nRvfk/BtXJXXtgeRn/Wjs9fn4qNB2kO1ZMG3M3+zxXCPMZAH7ycuDjcPtpJYJ RHvgapRA1fpiyvYh+eDw/bFucBgn205soyQYoMJ86autmJO9VUzftgfldMiOjA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRyBf03KMzrGW for ; Fri, 29 May 2026 22:07:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d024 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 22:07:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: b5dce0ae4f78 - main - login_class: Fix kqueues, pipebuf resource types 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5dce0ae4f78251f56ffcb6c6a58b9e6c20380e0 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 22:07:05 +0000 Message-Id: <6a1a0e09.3d024.b2b496d@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=b5dce0ae4f78251f56ffcb6c6a58b9e6c20380e0 commit b5dce0ae4f78251f56ffcb6c6a58b9e6c20380e0 Author: Dag-Erling Smørgrav AuthorDate: 2026-05-29 22:06:44 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-05-29 22:06:44 +0000 login_class: Fix kqueues, pipebuf resource types * kqueues is a count but is listed as a size * pipebuf is a size but is listed as a count PR: 295623 MFC after: 1 week Fixes: a4c04958f526 ("libutil: support RLIMIT_PIPEBUF") Fixes: 85a0ddfd0b26 ("Add a resource limit for the total...") Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D57333 --- lib/libutil/login_class.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c index 90e4e01f7c3b..8a465e2eb24e 100644 --- a/lib/libutil/login_class.c +++ b/lib/libutil/login_class.c @@ -63,9 +63,9 @@ static struct login_res { { "vmemoryuse", login_getcapsize, RLIMIT_VMEM }, { "pseudoterminals", login_getcapnum, RLIMIT_NPTS }, { "swapuse", login_getcapsize, RLIMIT_SWAP }, - { "kqueues", login_getcapsize, RLIMIT_KQUEUES }, + { "kqueues", login_getcapnum, RLIMIT_KQUEUES }, { "umtxp", login_getcapnum, RLIMIT_UMTXP }, - { "pipebuf", login_getcapnum, RLIMIT_PIPEBUF }, + { "pipebuf", login_getcapsize, RLIMIT_PIPEBUF }, { "vms", login_getcapnum, RLIMIT_VMM }, { NULL, 0, 0 } }; From nobody Fri May 29 22:18:55 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 4gRySH1b46z6gBYN for ; Fri, 29 May 2026 22:18:55 +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 4gRySH11x9z4JgH for ; Fri, 29 May 2026 22:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780093135; 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=iuUQllQ5VuvlW8KtWK+RmjUoh7E4eQdLaoovIOXJVYc=; b=a2qLnVmzVQhX98m62byCsjRwSdKzzPdGE3rTo/+U5wIkPaBnjtlLkvgdVZdyNHdeo2VDCB 10RSQ/dK5ikuZXc5wLS8/2C0OmQ8AJtINQfXN2lDNFXcZgSfr9dNGOGiB7hBwGMEzcV5MQ HmE4WBTR5xKorlqTxxWQCiyEBzqvpxycDJWpJW4QPMq4jVbQKDa4OziSw+CKwynaZ2QJ7m iQMgy2w2obnoWVIIp/++zAEnEHYd3jLA1ygLex2WmDlG1V2xCMlRy35I25kVEoU+dlm0Na MPMR9gSC6I4YgcziafWQf3EKBYOa+bDOsU+zfMaLjKuU4Y3I2FEn/6u+6dz+vA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780093135; a=rsa-sha256; cv=none; b=SaEwSUOk9QnaMK46WroWMT2pQ9Zu8ckSh61RBySctFavpUb4sm8/R5spL/fTO/ftDGTemQ /vHjc3slIWC98qpzkIBFmxA/7m4C5lsmaoE0U1SYur8KjLU8IoZQW5Y13agxbJVTY4LMMJ qBcxGUE6XDUB1z6B2qH/vwIyaODEiGJEG2V+180+ndvwmZmVafkoy1rfwsxHyf385pJiF2 wYMYintDIoxlOWhkQINYmO/WYkeYNBhmJYlKuN7aEjgVpS1J4jQl1cQWyc16ObdusNUT5F eehS+H5tV4OUz/ImKXV1Y5wGXi0vCcUT7EVvLOEMKHznwDcMnMpna1E9TckX2g== 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=1780093135; 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=iuUQllQ5VuvlW8KtWK+RmjUoh7E4eQdLaoovIOXJVYc=; b=YfWMyiUz1e8jcm+YYUWC0qf1dOQyNE1QyOuqBo596xU+Br20Pg894XfxhKaBAi5yK7ZZ1x mR20/PQt9p4haXAHC7dxS7Cgxg1zepMp8BeTSKz6aw4tAtQSGOztVNLFQWmwB2JVCULbux zM2oDBP+7C/lF1h2Z7Z3m3y5ZRjG9y5WKWbCzcceIxgr+Ck29IpsYaACBmyFwmPYyySA9v /1R/KqwTg+cyp+m/ySOloI3lGWdwO4ZrkSsdv75EUjU/enghiBgM9n7wcTyC3a2CJL4uR7 PsG1zARgyOBMMJ1we1Bd7LD+SylM8dZNcc+7MASIT07XF/PgBScdCA8umh0zmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRySH0QBxzrp5 for ; Fri, 29 May 2026 22:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b5de by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 22:18:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 32a7ba251acb - main - route: Fix `flush` w/o specified address family 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 32a7ba251acbfb442665eed40fb4f48c8f2bd710 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 22:18:55 +0000 Message-Id: <6a1a10cf.3b5de.2223573f@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=32a7ba251acbfb442665eed40fb4f48c8f2bd710 commit 32a7ba251acbfb442665eed40fb4f48c8f2bd710 Author: Ed Maste AuthorDate: 2026-05-29 16:44:09 +0000 Commit: Ed Maste CommitDate: 2026-05-29 22:18:20 +0000 route: Fix `flush` w/o specified address family PR: 291867 Reported by: gavin Reviewed by: pouria, melifaro Sponsored by: The FreeBSD Foundation Fixes: c597432e2297 ("route(8): convert to netlink") Differential Revision: https://reviews.freebsd.org/D57336 --- sbin/route/route_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/route/route_netlink.c b/sbin/route/route_netlink.c index 051662688047..0d4420767082 100644 --- a/sbin/route/route_netlink.c +++ b/sbin/route/route_netlink.c @@ -950,7 +950,8 @@ flushroutes_fib_nl(int fib, int af) struct snl_msg_info attrs = {}; print_nlmsg(&h, hdr, &attrs); } - if (r.rta_table != (uint32_t)fib || r.rtm_family != af) + if (r.rta_table != (uint32_t)fib || + (af != AF_UNSPEC && r.rtm_family != af)) continue; if ((r.rta_rtflags & RTF_GATEWAY) == 0) continue; From nobody Fri May 29 22:25:50 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 4gRycG6bC4z6gBcy for ; Fri, 29 May 2026 22:25:50 +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 4gRycG5pnyz4L72 for ; Fri, 29 May 2026 22:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780093550; 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=WZI9nbniJdrZa4+C4WmpiVC/A4oYCjSwW+p7PaGhsPE=; b=eBhAGYpn7yFhALBFFVjZxG7A1Y4ungfYYACYhhkK9ABjA2nm/JyEn+Y8OXquilLn4MkFSE DvlYoo7TV+wzTVl88FfMeOPq3djvXX0qqn2Ah1kMczCaBjeF3yGbD/5FUKPNfYfMNjJvr7 TwY0YvxZpj7S8KiHxx/yj/prbmRBXMjZoY02ePVUBF2EayAmbtaLJVeccWwkvaWTQXuOmh jX7qfwmYRnNKpT16l/sQ0i9Z98QwdWyEGceZvwFstQU2othYZL0XaXpR+ktbHBZc016GYK 8jXCFHf+NWKe+vDBhm4KbNQDc9V13BDFPysN+z8MnRJ/p4QlSW/gw0iYoGwK8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780093550; a=rsa-sha256; cv=none; b=OQ5qij4Vivplj8waAfZhbxNh+ThdKFRyae8zO0siIq6Gwy2EefqpQCLgCEy7JwPws57olc kHeT5ue3A88oJum1zQ5JOuI7isFcKYcD69vFfEq+VwDf+g6AIy+Tu9Byw/DT65YZU+OUxW ObgEshL358lqDiRs361E5r2zSQTpe4x/qLnr0arZ0eW8r3slPf4iTvZGKBaeip5piUzRNW NxzSO+d82cF3BJ2hyfohWnJeXmUhP7CGc0gSTEXHCMia7zA5ck5Ej/7xgCxt1Liyzvx6fu eBt9YeJeB5Jj2rpj50v97UKC0IxhR8Dor775ow8NmtHKfb89MCYNS2G+w1l79g== 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=1780093550; 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=WZI9nbniJdrZa4+C4WmpiVC/A4oYCjSwW+p7PaGhsPE=; b=BmnnoD7MbJ+S6+MpgqZJ+mLpiZq+PuRzTKN9gxAWVE7hVYj8hFmTCP4rMFTb3H+TMT/dbf 3nQOo9evXY1LujUrAhfpdXRhJqzPlu+QKycD0h3ylE7niE0MXijTPlv5j9EYRnQeVuzi/T NHAgbFriSLpXD4NQYL/OmAfgLlS/3JDKNrqqHU277/t35jzJVZz67NH1+B7Jo8Lqs/jfQ5 dk4+KajfKio5cZHopu72NPPGX0koZL4Rmzl62GEFYnmdARQNM36ahQeq24mawHGSGqwHBX O8YWoWW/voDufl5M62PcLkMXMhgRAJXDcaAfH3I2IVtUQ73EE4Q1uLocSH9JfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRycG57tGzslt for ; Fri, 29 May 2026 22:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f100 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 22:25:50 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 692b0ef1506b - main - syscalls.master: Allow clock_nanosleep in capability mode 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 692b0ef1506ba51b72d0a2707cbf8879a6e01d78 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 22:25:50 +0000 Message-Id: <6a1a126e.3f100.48138132@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=692b0ef1506ba51b72d0a2707cbf8879a6e01d78 commit 692b0ef1506ba51b72d0a2707cbf8879a6e01d78 Author: Ed Maste AuthorDate: 2026-05-29 20:26:06 +0000 Commit: Ed Maste CommitDate: 2026-05-29 22:25:42 +0000 syscalls.master: Allow clock_nanosleep in capability mode It is akin to nanosleep(2) and does not access global namespaces. It should be permitted in capability mode. Reviewed by: vangyzen Fixes: 3f8455b0905a ("Add clock_nanosleep()") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57343 --- sys/kern/syscalls.master | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index b3e1d4be9fee..1032f6cd1bf0 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1430,7 +1430,7 @@ _Out_ _Contains_timet_ struct ffclock_estimate *cest ); } -244 AUE_NULL STD { +244 AUE_NULL STD|CAPENABLED { int clock_nanosleep( clockid_t clock_id, int flags, From nobody Fri May 29 23:10:57 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 4gRzcM1NN3z6gGRK for ; Fri, 29 May 2026 23:10:59 +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 4gRzcK54yMz3Vvr for ; Fri, 29 May 2026 23:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780096257; 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=I9LIO5X/zNUzkVa7SbpZn6OGikz2u1pzq426czeQQk8=; b=PU+R2zu7gISoNuaWg8KW6lKeof+VQpAGsFMboAFH1SlyjsXrt4hsU9gQse3kXPb8iodCJe echAmXy0C9/NjZMeswNO6RtujJBmt3E5X9242epyh+ZTBMlLSQQ+eU5h5VvXRX2kpYzRej E2afBgmxoZcTrOUkCNcKWoKSsaArYC2UKA9zWOUJNLYhhgvNS69Omppln9jNv80H2EVx6l jaOSKu6WBGPgEFOCVLfVH2jlHnY7hIWpMSedNNE1Dx2NR4YPfKwOJWYVLz2ORNECHakhSz oJu8+Wi7itbWfv0v48YclTUTRxulgYWKD3eJDQboZLKQ8yUJLfRiognjMkzxLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780096257; a=rsa-sha256; cv=none; b=P9dBztPVZbhmbJ03a5gOzVdBByYxZAjqZXFh6OWFKHNruM2Wp5KDH5bv7Qzu0+qY2fx1I7 O++QbpVZ4X60RaOnvV2diw3MD22qDUDqgsqJz6TLRmqGTVLW4kaLUpenTWuvuhYARUp9GV jed0XAyoVysux4FHgfQWrvNp/ZBZljxsd3RU4eqwSx1I0/gRaOqO6qaQQEuT3MN+9yJx2l ZGwi+M8dr2jdJ8lzqoSQidlNMXnF+rgTdY/wsUed1PmQrXxJt8mHbZeixFgpKNyVnHdF3a 8paMgrE0JipDLcjs8q7lTmQVXs5VuOOpmBCzimIWE67CKeTREhm9PQp1N2kkjA== 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=1780096257; 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=I9LIO5X/zNUzkVa7SbpZn6OGikz2u1pzq426czeQQk8=; b=V0VFUAeJImujWKVmnmDyUGhMfBbljVH56ca2CQcBrHgZd4I+eAC/k3J7F4krpNgQd1G7qP rg+5ZaAkqfMA7+LrD6Fe9lQfKSK179fbejeVCuIU+LwmmlatGdqwK9c7EMLQqeVceusMhF QpEZtWxMxpLI5snzFzTK8VzPy0BiOgRB4J0wjRqosZSnHZOh7r1hyAqzUe7jo5V84/+6xB a2/QBQs/i6nS9bQGtvm51U9iLu2eC8iMmJw9W3Hopo47wCbJY6Pa2l8vsCVobzcSbK0Fh8 UdT6KF2ZWUsMojSnbAp+SPAzz+O1IV+gWyExcvmKQuJEGWu7UtfAXVozMtU0RQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRzcK4hbLzvJG for ; Fri, 29 May 2026 23:10:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 43233 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 23:10:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefa=?utf-8?Q?n E=C3=9Fer?= Subject: git: 11f23d7c078b - main - tools/test/stress2/misc: Fix and enable new tests 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: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11f23d7c078b319285727d277f05b6962280bcce Auto-Submitted: auto-generated Date: Fri, 29 May 2026 23:10:57 +0000 Message-Id: <6a1a1d01.43233.7f1bad43@gitrepo.freebsd.org> The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=11f23d7c078b319285727d277f05b6962280bcce commit 11f23d7c078b319285727d277f05b6962280bcce Author: Stefan Eßer AuthorDate: 2026-05-29 23:05:04 +0000 Commit: Stefan Eßer CommitDate: 2026-05-29 23:10:35 +0000 tools/test/stress2/misc: Fix and enable new tests The previously committed versions of these tests failed to prevent duplicate file names in the list of files to process, leading to missing files when a "mv" commando tried to operate on a file that had already been renamed. The test for filenames containing UTF-16 surrogate pairs stays disabled, since the required kernel changes have not been committed, yet. --- tools/test/stress2/misc/all.exclude | 2 -- tools/test/stress2/misc/msdos22.sh | 14 ++++++-------- tools/test/stress2/misc/msdos23.sh | 12 +++++------- tools/test/stress2/misc/msdos24.sh | 12 +++++------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 7109555c5508..ef8cb69cd241 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -39,8 +39,6 @@ mount7.sh https://people.freebsd.org/~pho/stress/log/log0549.txt 20240912 mlockall2.sh Unrecoverable OOM killing seen 20190203 mlockall6.sh https://people.freebsd.org/~pho/stress/log/log0430.txt 20230403 mlockall7.sh Needs further investigation 20210123 -msdos22.sh Waiting for fix 20260529 -msdos23.sh Waiting for fix 20260529 msdos24.sh Waiting for fix 20260529 msetdomain.sh May change policy for random threads to domainset_fixed 20210104 newfs4.sh watchdog fired. newbuf (still seen 20240729) 20190225 diff --git a/tools/test/stress2/misc/msdos22.sh b/tools/test/stress2/misc/msdos22.sh index 158a52a7aa7b..f3a2110f13f1 100755 --- a/tools/test/stress2/misc/msdos22.sh +++ b/tools/test/stress2/misc/msdos22.sh @@ -4,13 +4,13 @@ MDUNIT=10 FS=/mnt -LOCALE=C.UTF-8 +LOCALE=C FILES=1000 export LANG=$LOCALE randomfilename () { - name="f" + name="" count=$(jot -r 1 10 3) for r in $(jot -r $count 7 0); do r=$(( r + 0 )) @@ -40,14 +40,12 @@ randomfilename () { cd $FS/test for i in $(jot $FILES); do - newfile=$(randomfilename) - case $testfiles in - *"$newfile"*) continue;; - esac - testfiles="$(randomfilename) -$testfiles" + testfiles="$testfiles +$(randomfilename)" done + testfiles=$(echo "$testfiles" | grep "." | sort -R | uniq) + for f in $testfiles; do echo "$f" > $f done diff --git a/tools/test/stress2/misc/msdos23.sh b/tools/test/stress2/misc/msdos23.sh index 18982c34f68b..fcaa90917235 100755 --- a/tools/test/stress2/misc/msdos23.sh +++ b/tools/test/stress2/misc/msdos23.sh @@ -10,7 +10,7 @@ FILES=1000 export LANG=$LOCALE randomfilename () { - name="f" + name="" count=$(jot -r 1 10 3) for r in $(jot -r $count 7 0); do r=$(( r + 0 )) @@ -40,14 +40,12 @@ randomfilename () { cd $FS/test for i in $(jot $FILES); do - newfile=$(randomfilename) - case $testfiles in - *"$newfile"*) continue;; - esac - testfiles="$(randomfilename) -$testfiles" + testfiles="$testfiles +$(randomfilename)" done + testfiles=$(echo "$testfiles" | grep "." | sort -R | uniq) + for f in $testfiles; do echo "$f" > $f done diff --git a/tools/test/stress2/misc/msdos24.sh b/tools/test/stress2/misc/msdos24.sh index 195c4ba8d9b9..edb524293c0c 100755 --- a/tools/test/stress2/misc/msdos24.sh +++ b/tools/test/stress2/misc/msdos24.sh @@ -10,7 +10,7 @@ FILES=1000 export LANG=$LOCALE randomfilename () { - name="f" + name="" count=$(jot -r 1 10 3) for r in $(jot -r $count 7 0); do r=$(( r + 0 )) @@ -41,14 +41,12 @@ randomfilename () { cd $FS/test for i in $(jot $FILES); do - newfile=$(randomfilename) - case $testfiles in - *"$newfile"*) continue;; - esac - testfiles="$(randomfilename) -$testfiles" + testfiles="$testfiles +$(randomfilename)" done + testfiles=$(echo "$testfiles" | grep "." | sort -R | uniq) + for f in $testfiles; do echo "$f" > $f done From nobody Fri May 29 23:11:31 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 4gRzd02YBDz6gGXC for ; Fri, 29 May 2026 23:11:32 +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 4gRzcz5dMwz3WwY for ; Fri, 29 May 2026 23:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780096291; 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=/elXd4oReAjVvlVVMyiuzgrX4MtpE0xlWUCvDV6o7rA=; b=nMoEWcIE+DqVgdCFy9TNf0zfdtw5g5bfx3S/eQu5/3Pd/xtMyoEAX3qhtyLUv9bqYFR/oA 1aOzr31rfoHTTFCN8Yr6YdrMARFbvYTBqgV7oO/Ye3mAv2KTOMtzs4/8lTlbE8iWx3fLRM TVdLlVFY9TQRj8nRYriQ/FqNYAZWWNYhNxRb9QdJwt3A34z0jTTnkKqjwHnvFY5QkmWS85 bz59qm3N1DZqESW0z6GEkh6Aif2XmLtsIerDsHNmxpcjlTEsq8QyzYQOWbCoh+OSBfnazM DQ8KDn/sIoaXJRcnI4WcjLOmDDqHNOLwBX6UlowcpVTMru4NrGJ51xjej+eEdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780096291; a=rsa-sha256; cv=none; b=ctVK6FopQzBr5PtLushhW2u1QckM/Ralo7r0fHE0zUfU56N3yENQvQnvXneQYmirq69EC9 iLAneGhckHzSt7C6Wmd5E5DOPeieBfPW6A4hg75Gt5pGvTCDQDzJiFUL6utRz2n3ifTgHr 61z55CHqqnYR6/T4rpmG1Kea9niinuaysS+AGrPH+APvF3QBS4/H7SFFgftg3+zcHMaexx 7C8R7qULVv862LQ35U9lsW+ZVc577y5bnIRmAvFngI8Nxre0bvX9pFXD+OImHy9ST1jJYS 4kvJSFJ5pOc0kXIRdmSEnMke6yfcAj1bv4xaLcyVoxYs/9eVrum4OiXCoUtWrQ== 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=1780096291; 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=/elXd4oReAjVvlVVMyiuzgrX4MtpE0xlWUCvDV6o7rA=; b=lRWz58QJkqmXqyEkEidqiBw2dTkWCl6MMVavcgoBZQARH00hVlykas5y6EocVXawBDJKuK XFKdXa2d5K6pbWFYIjLpVA2XNMiq4R8m169i/PLU+ZwD7W7ZB2YmpdoLaYxSr4zz1NIRs8 bgP/ZJRLyTOvPK3KT/a/uA8cJTuC9xz1yy9UQsbQYo9dtVJAmla967AYuKxiQhfZuhG56A 8QsSag1o54YXamohiFGyTvzxNEGwqAjUzhAKBlCssTQkIUSNOEjO3vBQ9TZRpULSJQo8ia A3G4QO8QZBU8+lIYdZtsN4fEe004gR7+/44TuUW3xRL/U5wxxyJDF98WeP7aJQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRzcz4zR2zvBw for ; Fri, 29 May 2026 23:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 432b1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 23:11:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 9ddb6064f815 - main - netlink: Use early exit pattern in _nl_modify_ifp_generic 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ddb6064f815ebdd0cfea4b2e0d3b6f0c98ea072 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 23:11:31 +0000 Message-Id: <6a1a1d23.432b1.113a7418@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9ddb6064f815ebdd0cfea4b2e0d3b6f0c98ea072 commit 9ddb6064f815ebdd0cfea4b2e0d3b6f0c98ea072 Author: Ed Maste AuthorDate: 2026-05-29 21:08:51 +0000 Commit: Ed Maste CommitDate: 2026-05-29 23:11:21 +0000 netlink: Use early exit pattern in _nl_modify_ifp_generic No functional change. Reviewed by: pouria, melifaro Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57349 --- sys/netlink/route/iface_drivers.c | 53 ++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c index 31d2523a479b..d26e92044ff5 100644 --- a/sys/netlink/route/iface_drivers.c +++ b/sys/netlink/route/iface_drivers.c @@ -69,17 +69,16 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, int error; if (lattrs->ifla_ifalias != NULL) { - if (nlp_has_priv(npt->nlp, PRIV_NET_SETIFDESCR)) { - int len = strlen(lattrs->ifla_ifalias) + 1; - char *buf = if_allocdescr(len, M_WAITOK); - - memcpy(buf, lattrs->ifla_ifalias, len); - if_setdescr(ifp, buf); - if_setlastchange(ifp); - } else { + if (!nlp_has_priv(npt->nlp, PRIV_NET_SETIFDESCR)) { nlmsg_report_err_msg(npt, "Not enough privileges to set descr"); return (EPERM); } + int len = strlen(lattrs->ifla_ifalias) + 1; + char *buf = if_allocdescr(len, M_WAITOK); + + memcpy(buf, lattrs->ifla_ifalias, len); + if_setdescr(ifp, buf); + if_setlastchange(ifp); } if ((lattrs->ifi_change & IFF_UP) != 0 || lattrs->ifi_change == 0) { @@ -91,18 +90,17 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, } if (lattrs->ifla_mtu > 0) { - if (nlp_has_priv(npt->nlp, PRIV_NET_SETIFMTU)) { - struct ifreq ifr = { .ifr_mtu = lattrs->ifla_mtu }; - error = ifhwioctl(SIOCSIFMTU, ifp, (char *)&ifr, - curthread); - if (error != 0) { - nlmsg_report_err_msg(npt, "Failed to set mtu"); - return (error); - } - } else { + if (!nlp_has_priv(npt->nlp, PRIV_NET_SETIFMTU)) { nlmsg_report_err_msg(npt, "Not enough privileges to set mtu"); return (EPERM); } + struct ifreq ifr = { .ifr_mtu = lattrs->ifla_mtu }; + error = ifhwioctl(SIOCSIFMTU, ifp, (char *)&ifr, + curthread); + if (error != 0) { + nlmsg_report_err_msg(npt, "Failed to set mtu"); + return (error); + } } if ((lattrs->ifi_change & IFF_PROMISC) != 0 || @@ -117,21 +115,20 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, if_setppromisc(ifp, (lattrs->ifi_flags & IFF_PROMISC) != 0); if (lattrs->ifla_address != NULL) { - if (nlp_has_priv(npt->nlp, PRIV_NET_SETIFMAC)) { - error = if_setlladdr(ifp, - NLA_DATA(lattrs->ifla_address), - NLA_DATA_LEN(lattrs->ifla_address)); - if (error != 0) { - nlmsg_report_err_msg(npt, - "setting IFLA_ADDRESS failed with error code: %d", - error); - return (error); - } - } else { + if (!nlp_has_priv(npt->nlp, PRIV_NET_SETIFMAC)) { nlmsg_report_err_msg(npt, "Not enough privileges to set IFLA_ADDRESS"); return (EPERM); } + error = if_setlladdr(ifp, + NLA_DATA(lattrs->ifla_address), + NLA_DATA_LEN(lattrs->ifla_address)); + if (error != 0) { + nlmsg_report_err_msg(npt, + "setting IFLA_ADDRESS failed with error code: %d", + error); + return (error); + } } return (0); From nobody Fri May 29 23:11:32 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 4gRzd12GBpz6gGVH for ; Fri, 29 May 2026 23:11:33 +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 4gRzd06DcSz3WmQ for ; Fri, 29 May 2026 23:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780096292; 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=Vu5nOhN+5onxA1TeYdlNXeBFd2yE89ukXpoIvP48aQo=; b=DeesSdKceAl3ZlAILN5ySoOxvZyWS4c/1rHNSTRL09y/ACjsVAa9MyulJmGvmwDdgAr4X/ 6sELY6qHnAJQVmfVuwAey8YXqIkxrhwiKE4gNffUZFrIPZsIveiFu7sipiklFO/kRbzi67 RIRowLra/sR0yMp8sgpgjD7vwlehRYVscmN6RHkiuP84fZuqLufU1u+eBHKt5SdmgbfwCd CnaEGwBLE0kSRwXQ5gQMuLauw5KPllGkjsZAUQInTZl1u0gSZ2isVWVkApk97nWbQpDx8J N0fOUVb9b3k0pNksm1Phu9L7CEUhhketjxrKKdWml+Y61s8bs/KxLm6UXkXkUw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780096292; a=rsa-sha256; cv=none; b=FdLw4O14gD1Iu/MjQCHhx1/RgeaxkWYdv5FMB795JIFuoqdF3+mm91lT4rYfD2NqU+xbh6 FSZ5XwnM9Mp6T6eCxxew8zK0nTk7nJPtJSkZU8wUuOe6igKwKfkti7452wDWRbsK3bNGfC HEW9wFzch53JR6XCxqhj0yEyHllq4OCnQKz5TYCAL5GckmkEU6aB8htYjZnlFmGenSeBGi KFawfkm/3c1d786WCRMHoUHEkWAoIPEjTWzlz9hiprvauqW83k9/Jp4IBKs7L/QxZrwnsS UQnEvbxrwRLOwP9NeDctqx+qKF8O9N4UAMnxdt3qj8Gje30j1z5zdsv9vNp23w== 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=1780096292; 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=Vu5nOhN+5onxA1TeYdlNXeBFd2yE89ukXpoIvP48aQo=; b=tdvrDND2HPbmSWYpD1zUvfCN/vVqe/xpIM0KrQesh2p9mANt0VwqtY2KIhdBbdfXriqBYN tjtia5nwHUVhhV+CNm6f3oAWMTD1VZZ82Ux1PGgXbErv775Ssg/R/BI+/LJHZbXskVVQ0f CBZvs8nbsXFQeTl6friH9OhMhojW+Bf+o7xaka8j8zPsOAgDUmekc7FgolOoUx4ftamRCW a9vClmptuGdSHuwdBt2b5FQyl0lDgio5G6k/oMcSNsQk8VrtB/ldT7PgLZcQXNz/IerHxA zm1ndMJ/An/yCFvKu70X0xK/1/fCPzJ8Q0fY/N1OcUEVpQ4TqHKUYgKDeN/tbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRzd05MX7zv3v for ; Fri, 29 May 2026 23:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 43c1e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 23:11:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 96dbc9a8de10 - main - netlink: Check permissions for interface flag changes 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 96dbc9a8de105065b6b1e55702aa648319176587 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 23:11:32 +0000 Message-Id: <6a1a1d24.43c1e.1bfef5c@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=96dbc9a8de105065b6b1e55702aa648319176587 commit 96dbc9a8de105065b6b1e55702aa648319176587 Author: Ed Maste AuthorDate: 2026-05-29 15:52:03 +0000 Commit: Ed Maste CommitDate: 2026-05-29 23:11:21 +0000 netlink: Check permissions for interface flag changes Reviewed by: pouria, melifaro Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57332 --- sys/netlink/route/iface_drivers.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/netlink/route/iface_drivers.c b/sys/netlink/route/iface_drivers.c index d26e92044ff5..79daa4215dba 100644 --- a/sys/netlink/route/iface_drivers.c +++ b/sys/netlink/route/iface_drivers.c @@ -83,6 +83,10 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, if ((lattrs->ifi_change & IFF_UP) != 0 || lattrs->ifi_change == 0) { /* Request to up or down the interface */ + if (!nlp_has_priv(npt->nlp, PRIV_NET_SETIFFLAGS)) { + nlmsg_report_err_msg(npt, "Not enough privileges to set flags"); + return (EPERM); + } if (lattrs->ifi_flags & IFF_UP) if_up(ifp); else @@ -104,7 +108,7 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, } if ((lattrs->ifi_change & IFF_PROMISC) != 0 || - lattrs->ifi_change == 0) + lattrs->ifi_change == 0) { /* * When asking for IFF_PROMISC, set permanent flag instead * (IFF_PPROMISC) as we have no way of doing promiscuity @@ -112,7 +116,12 @@ _nl_modify_ifp_generic(struct ifnet *ifp, struct nl_parsed_link *lattrs, * function either sets or unsets IFF_PROMISC, and ifi_change * is usually set to 0xFFFFFFFF. */ + if (!nlp_has_priv(npt->nlp, PRIV_NET_SETIFFLAGS)) { + nlmsg_report_err_msg(npt, "Not enough privileges to set promisc"); + return (EPERM); + } if_setppromisc(ifp, (lattrs->ifi_flags & IFF_PROMISC) != 0); + } if (lattrs->ifla_address != NULL) { if (!nlp_has_priv(npt->nlp, PRIV_NET_SETIFMAC)) { From nobody Fri May 29 23:24:32 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 4gRzw06Dmrz6gHQQ for ; Fri, 29 May 2026 23:24:32 +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 4gRzw058mhz3wJn for ; Fri, 29 May 2026 23:24:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780097072; 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=e+yV82aFoLB2XPMBfMYVK4rL2vlsQ58ikvj53C/gZUc=; b=AmsfGuNIshkhDkBDoTJc3tod4i/51IiaM05j4Hg4l0xlalNjRg72QsTJ4HlrjAQjp9s9Mi KEuKyVEFZTXkVAm6Zr5dnJMQdRX0hDfIoyVmS4bNWvzdkO03UajEmVNrsvqVF9dDgcRaPH pqP17lnBW855Zj+yTZ7GBKdy1pKnzmKwolGn7PmxGF/3yXyId6dvKeKKqmpERXSJ6XpewT NpxkGkhThjsVMIUMFG8/9dH/wY5u/FQRIdPb4rHCySeXa81B08KQFeoFXSmwXYYR5i0iw+ xQtf0TelGgr0SawsCFlyAUxUJQgGdqZzpeFRoZ2ZvzOhcN7rXivSU1vMGcQZTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780097072; a=rsa-sha256; cv=none; b=DuQiDxCXwxoThvjg/8P6M6W05QYySbndFXYdXULTQaFau5ye7HdSMINLYYtfKK34Cg/vvV 3HU5VmsH63M7NUgpr6AmJKOxnCI+g/PMKL7afJ+4otyuaKY3AXwxQH+A77N4ZF9Qzdcz4W a9zGooH/Ap9tfT9UBSuJfwDrR8bkO3J8pBCrfSrrttafcyKdUeVrsjFnZeA9dQULXpoCXW M7ibY1L6WXl01mSWFAU9ed+KdmZzoDvk2xaZj6ATAyJoEWQnvp8JTOU/dyznR2evQmUX1d JGK0vfpkq+WnozKVCv49orJGWYqL9iiEQwAjoUqjov1Pi5RVFLcVItuDYRjv5Q== 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=1780097072; 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=e+yV82aFoLB2XPMBfMYVK4rL2vlsQ58ikvj53C/gZUc=; b=C+fkojYZm/hFelfGOjy6Q7NmK1MJX2fmlbTvRbbjeJ70xNLM27MVZUVJN0Rf9NDJ5/os1+ 3QkJTYRxs5lFLRPwTF4GmIsJ90H396v0ZzUInJeGDsDpmsOCvjo4DC6muzNshKkiYzNMY2 PQDFI/S7BPz4G/8NnWwrAM4FwuiD5GgFEtatMjELoJV6DiETduC3JZE/b4ZJaSW/lbriEo tHPuOHxqY1k9V8FOx9dN4LHepAyP84tcutt5qoar9MNKqLoieCXGsHwJ5Fb1Soy3cWJIc0 C1mpFypZ3KHpfwkuq2NagBH8gBZwtER6uG3Ng+ZY+Bucrysc9KmZv+K/i+I9mQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRzw04SnwzvTv for ; Fri, 29 May 2026 23:24:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4494d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 23:24:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Cochard Subject: git: e492ad08fc34 - main - netlink/route: extend pre-2.6.19 Linux compat shim to del/getroute 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: olivier X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e492ad08fc347ebf40979d3a6baa9d7b8917c76b Auto-Submitted: auto-generated Date: Fri, 29 May 2026 23:24:32 +0000 Message-Id: <6a1a2030.4494d.65ac4e59@gitrepo.freebsd.org> The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/src/commit/?id=e492ad08fc347ebf40979d3a6baa9d7b8917c76b commit e492ad08fc347ebf40979d3a6baa9d7b8917c76b Author: Olivier Cochard AuthorDate: 2026-05-29 23:17:28 +0000 Commit: Olivier Cochard CommitDate: 2026-05-29 23:23:12 +0000 netlink/route: extend pre-2.6.19 Linux compat shim to del/getroute Commit f34aca55adef ("netlink/route: provide pre-2.6.19 Linux compat shim", 2024-06) fixed the partial fix for net/bird2 on the netlink path by mapping the legacy 8-bit struct rtmsg::rtm_table field onto the modern 32-bit RTA_TABLE attribute when the latter is absent. That fix, however, was only applied to rtnl_handle_newroute. The two sibling handlers: rtnl_handle_delroute and rtnl_handle_getroute were left looking at attrs.rta_table directly. They are reachable from exactly the same client (bird, in its netlink scan path), so any FIB number that fits in 8 bits silently maps to RT_TABLE_UNSPEC in those handlers. Reviewed by: melifaro (previous version) Approved by: emaste MFC after: 1 week Sponsored by: Netflix --- sys/netlink/route/rt.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 17aae399c10a..39ecb537d365 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -978,6 +978,14 @@ create_nexthop_from_attrs(struct nl_parsed_route *attrs, return (nh); } +/* pre-2.6.19 Linux API compatibility: prefer RTA_TABLE, fall back to rtm_table */ +static inline void +old_linux_compat(struct nl_parsed_route *attrs) +{ + if (attrs->rtm_table > 0 && attrs->rta_table == 0) + attrs->rta_table = attrs->rtm_table; +} + static int rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *npt) @@ -997,9 +1005,7 @@ rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp, return (EINVAL); } - /* pre-2.6.19 Linux API compatibility */ - if (attrs.rtm_table > 0 && attrs.rta_table == 0) - attrs.rta_table = attrs.rtm_table; + old_linux_compat(&attrs); if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) { NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); return (EINVAL); @@ -1066,6 +1072,7 @@ rtnl_handle_delroute(struct nlmsghdr *hdr, struct nlpcb *nlp, return (ESRCH); } + old_linux_compat(&attrs); if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) { NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); return (EINVAL); @@ -1089,6 +1096,7 @@ rtnl_handle_getroute(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * if (error != 0) return (error); + old_linux_compat(&attrs); if (attrs.rta_table >= V_rt_numfibs || attrs.rtm_family > AF_MAX) { NLMSG_REPORT_ERR_MSG(npt, "invalid fib"); return (EINVAL); From nobody Sat May 30 01:17:17 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 4gS2Q53vSRz6dwds for ; Sat, 30 May 2026 01:17:17 +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 4gS2Q51xTPz48tj for ; Sat, 30 May 2026 01:17:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780103837; 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=YemURN+qpCmvPROWO1U/yNc9lB8WcJPWVVbHV6LW/Ec=; b=J0hlzJ76fNQiQxsoOiSgHzmF1Q/ZbZtObizdTx5LmE6ke5lVscBT0btqaymMu0tT7/c3IZ gEbWDmuH0ZSwhJcDaPzf/i4dKTg4xD7ahJL87QUyf4+/ckKP8ylvywyEjr7FhTateltuPY WpuuorXfdSg7ED0YphfmBoiXMmQ9Nc/nYHR8RKdaYlS6gJMzs1lSvqSiuDHIM7jb2J3iKT TfhMgUvY/5IW04MC3ZrJa2kWoslJoNyVpqBFzgDz+dFTO6XKWHB6p+lXzIaTEYAsgybKXr GJeqKFb5zb5yLE4nMkqgsZB6ihF3DqVYspWEYVhmF7N3oOOKdMmO70wWqz980Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780103837; a=rsa-sha256; cv=none; b=ZdnZSHuruam2yhLTIE6VH91mxUMdRERo1t1RjzE8DQ476GZDWjyI/W47GBBJxm14iDprZE gzyjIvxLudivBwm5mt/EXQzzNA0uApYvOWQYbK8OA0M6iwBBnP5kJW3v+nBpkOrLWkJthU q95cN4At39yaJ+zH7ngfWB1y3mTw/mnvgnIpMp1vQpA+Kt0j3hy1c9vYFMWSfuRe6B3Lih pgJ80yhSwoSejXh27n7OtPK4NzCvF6N98BHkbJGxmT1feQW6Weq5wRc5p+Ktk7W/8RqMTn L1o4PmlLkIV1ljiIDdVcBwQXUsiEWQJxlMLAenA/LmwWSSjnL8W7FPIw73UWLQ== 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=1780103837; 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=YemURN+qpCmvPROWO1U/yNc9lB8WcJPWVVbHV6LW/Ec=; b=qr3u+vw0qtQuh/TftzveizYf1zJWC3znAGGfdrxCNlZyWUPpEVcPCneY06ghwJ5ONQNEYQ ZBSmM7crZ86tBBfY+qz1Al6w3O3W5xWD5jh5Nk8r1QkTsqdmYg43yVXFyK4N3Z8efSwKl7 /m6DzGAJC22n8vxjaYzqTKD7og4A1XK3/8i3pfUGgixqxHLi8bzAGIM+EN8uAyEXGkQeqb hn/JWRXq1nq/1l0WDfx5Ft+pKMnuUoBOYOMwfadOOJcJmzByYa3nVwFmVunSQAtSv4nfJE GcHev7plX0n9M9UHECrLny3Lj8wVTeOuuehVM6KwibCLmL9PrCdEdB2Ynf1APg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gS2Q51WywzyTd for ; Sat, 30 May 2026 01:17:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e4e3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 01:17:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f048a1a1decb - main - tests/ipsec: Run in parallel 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f048a1a1decb9140ec779951e886ec41ae34cec4 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 01:17:17 +0000 Message-Id: <6a1a3a9d.1e4e3.5cb5f0af@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f048a1a1decb9140ec779951e886ec41ae34cec4 commit f048a1a1decb9140ec779951e886ec41ae34cec4 Author: Mark Johnston AuthorDate: 2026-05-29 22:25:02 +0000 Commit: Mark Johnston CommitDate: 2026-05-30 01:16:51 +0000 tests/ipsec: Run in parallel Use execenv=jail to enable this. MFC after: 1 week --- tests/sys/netipsec/tunnel/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/netipsec/tunnel/Makefile b/tests/sys/netipsec/tunnel/Makefile index c6060a790cc3..49fddc403005 100644 --- a/tests/sys/netipsec/tunnel/Makefile +++ b/tests/sys/netipsec/tunnel/Makefile @@ -13,8 +13,8 @@ ATF_TESTS_SH+= empty \ aesni_aes_gcm_256 \ chacha20_poly1305 -# Each test uses the same names for its jails, so they must be run serially. -TEST_METADATA+= is_exclusive=true +TEST_METADATA+= execenv="jail" \ + execenv_jail_params="vnet allow.raw_sockets" ${PACKAGE}FILES+= utils.subr From nobody Sat May 30 02:45:11 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 4gS4MW43qhz6f47C for ; Sat, 30 May 2026 02:45:11 +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 4gS4MW3JGXz3N0b for ; Sat, 30 May 2026 02:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780109111; 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=dof4Zy1EPJf+0KkKzNyWuLP3ZIMO6Ew1P/VQdp2PRl4=; b=exfmWhOHorXpa8OlMI98ppQFgOzdWBDM4679m6n5DSh2DgL9ELdGanlhcR4Y0bNY3aqmxa hHP/5lx7HgvmzuSofQBQLUwZfgbLJsUvpD07WRFjzTaa+hVycbZRwXY/SNMWkpZTditJ7c DVz2/LmAhuJ8UhduLuArfbzxdzcIFeUhAeX+y9WXlOXN9KXh0NWiTwNCgDtCSZT58LPPGb 1KK610aWKU3P758dy+j8wLSBFKJk1qzvQjH/zHdKBJbptUhQanqLM+qS5OMxywufZYkyCx TD9zhJJqI5ghJXJjlyIxFXs9P7RJKzfjpHDS1YDlVFU+6h/rs5H3FFJmSLP4tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780109111; a=rsa-sha256; cv=none; b=XpCb+X/V1XbqsV98MKFtA9r0YWqmuHUxIbidkcKjYr8qfMl7EEPQs3Xsa7C+FdYaDfOXO8 s9EUUc28xI4aP3imrzMfmCBh1xV8X4g8ZICjdRJ3OnXjg9TZh9o0rIL8q8x5UHZbb8qqbX uwZCB5HTXSjm8mDP5KToI6nfccJHnhla8Yao8uSO4znOlR+978KSSE1jBR0hiN+eb3T8PS jfLHl2WHo5oRmj0xLYSgLzBYr8BdZeq2aGM7WgR0EARMcIfe+YLBQTkamzAkQDu99q3cbN z1wg+vH4Dy8Rhf9ug0OF5md+dLtQoyXJUKY0XKmPadl3tvTahwL8ULUWjF061Q== 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=1780109111; 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=dof4Zy1EPJf+0KkKzNyWuLP3ZIMO6Ew1P/VQdp2PRl4=; b=QWocURefz7ruQEUwCKp5aZmOTOU4sUjxiiYIEfJiSoiSWGr+zUJblUZimV+qRQ5wa/bnEu 1KgFcMSVy6w8RtAwftKzxsQ+cvjP0JTH7TbX1Ggk4oePi0supr2VMkH5rloULvk0wAShqg JP7Mw2XeMdn0CRysojoTx6CXvAVtN9PwESSTDrD1eQ0uKRYPWo6kKyRrvjGgR6nZ+018Ma +0ODj4Rs94/AFXZD4G90u0ij+sxaHfYxmH5lr4aj3pesnYTnE7XqW6AM4EFG9PMTpTlzeb pgdHqIJaWuRBi3uDwC0xNOEm0ryHgn+YbO4FfaWP+Dqbf29wvj953E5pN2bavw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gS4MW2sxHz11wb for ; Sat, 30 May 2026 02:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31c8e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 02:45:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: d15cc7625dde - main - stand: compile ia32 EFI loader with -malign-double 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: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d15cc7625dde9bcb6a63ee59cccf14f3b93b15bf Auto-Submitted: auto-generated Date: Sat, 30 May 2026 02:45:11 +0000 Message-Id: <6a1a4f37.31c8e.265484b8@gitrepo.freebsd.org> The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=d15cc7625dde9bcb6a63ee59cccf14f3b93b15bf commit d15cc7625dde9bcb6a63ee59cccf14f3b93b15bf Author: Ahmad Khalifa AuthorDate: 2026-05-30 02:40:39 +0000 Commit: Ahmad Khalifa CommitDate: 2026-05-30 02:40:39 +0000 stand: compile ia32 EFI loader with -malign-double The UEFI spec says: > Structures are aligned on boundaries equal to the largest internal > datum of the structure and internal data are implicitly padded to > achieve natural alignment. Unlike the old Intel EFI toolkit, the EDK2 headers expect ia32 builds to use -malign-double to achive this. Make EFI versions of libsa32, liblua32, and ficl32. With the difference being that they are compiled with -malign-double. Differential Revision: https://reviews.freebsd.org/D55385 --- stand/defs.mk | 2 +- stand/efi/Makefile | 8 +++++++- stand/efi/Makefile.inc | 5 +++++ stand/efi/ficl32efi/Makefile | 3 +++ stand/efi/liblua32efi/Makefile | 3 +++ stand/efi/libsa32efi/Makefile | 1 + stand/loader.mk | 4 ++-- 7 files changed, 22 insertions(+), 4 deletions(-) diff --git a/stand/defs.mk b/stand/defs.mk index 7f3803c7ab42..ac4f38451111 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -78,7 +78,7 @@ LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} .else -LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a +LIBSA32= ${BOOTOBJ}/${"${LOADER}" == "loader_ia32":?efi/libsa32efi:libsa32}/libsa32.a .endif # Standard options: diff --git a/stand/efi/Makefile b/stand/efi/Makefile index 1887b9536a5b..5ece7eff8ef2 100644 --- a/stand/efi/Makefile +++ b/stand/efi/Makefile @@ -3,12 +3,18 @@ NO_OBJ=t .include SUBDIR.yes+= libefi -SUBDIR.${MK_LOADER_IA32}+= libefi32 +SUBDIR.${MK_LOADER_IA32}+= libsa32efi libefi32 SUBDIR.${MK_FDT}+= fdt SUBDIR.yes+= .WAIT SUBDIR.yes+= boot1 gptboot +.if ${LOADER_DEFAULT_INTERP} == "lua" +SUBDIR.${MK_LOADER_IA32}+= liblua32efi +.elif ${LOADER_DEFAULT_INTERP} == "4th" +SUBDIR.${MK_LOADER_IA32}+= ficl32efi +.endif + SUBDIR.${MK_FORTH}+= loader_4th SUBDIR.${MK_LOADER_LUA}+= loader_lua SUBDIR.${MK_LOADER_IA32}+= loader_ia32 diff --git a/stand/efi/Makefile.inc b/stand/efi/Makefile.inc index 6bb0af1d84f3..452820aeeb32 100644 --- a/stand/efi/Makefile.inc +++ b/stand/efi/Makefile.inc @@ -8,6 +8,11 @@ LDFLAGS+= -nostdlib .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -fshort-wchar CFLAGS+= -mno-red-zone +.if ${DO32:U0} == 1 +# This is needed so the EDK2 EFI structs have the correct layout for +# the ia32 loader. +CFLAGS+= -malign-double +.endif .endif .if ${MACHINE_CPUARCH} == "aarch64" diff --git a/stand/efi/ficl32efi/Makefile b/stand/efi/ficl32efi/Makefile new file mode 100644 index 000000000000..63800cb0f209 --- /dev/null +++ b/stand/efi/ficl32efi/Makefile @@ -0,0 +1,3 @@ +DO32=1 + +.include "${.CURDIR}/../../ficl/Makefile" diff --git a/stand/efi/liblua32efi/Makefile b/stand/efi/liblua32efi/Makefile new file mode 100644 index 000000000000..cf391967ecf0 --- /dev/null +++ b/stand/efi/liblua32efi/Makefile @@ -0,0 +1,3 @@ +DO32=1 + +.include "${.CURDIR}/../../liblua/Makefile" diff --git a/stand/efi/libsa32efi/Makefile b/stand/efi/libsa32efi/Makefile new file mode 100644 index 000000000000..109c420bf734 --- /dev/null +++ b/stand/efi/libsa32efi/Makefile @@ -0,0 +1 @@ +.include "${.CURDIR}/../../libsa32/Makefile" diff --git a/stand/loader.mk b/stand/loader.mk index 496252e7a534..0d94ed3e6263 100644 --- a/stand/loader.mk +++ b/stand/loader.mk @@ -162,14 +162,14 @@ LIBFICL= ${BOOTOBJ}/ficl/libficl.a .if ${MACHINE} == "i386" LIBFICL32= ${LIBFICL} .else -LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a +LIBFICL32= ${BOOTOBJ}/${"${LOADER}" == "loader_ia32":?efi/ficl32efi:ficl32}/libficl.a .endif LIBLUA= ${BOOTOBJ}/liblua/liblua.a .if ${MACHINE} == "i386" LIBLUA32= ${LIBLUA} .else -LIBLUA32= ${BOOTOBJ}/liblua32/liblua.a +LIBLUA32= ${BOOTOBJ}/${"${LOADER}" == "loader_ia32":?efi/liblua32efi:liblua32}/liblua.a .endif CLEANFILES+= vers.c From nobody Sat May 30 02:45:12 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 4gS4MX5Zx7z6f3nP for ; Sat, 30 May 2026 02:45:12 +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 4gS4MX40DGz3NSB for ; Sat, 30 May 2026 02:45:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780109112; 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=7+Yjo+mpzHHU1qymwUFPs3cHpM4xBJP3UONyXhMUelU=; b=xqI81uRmyf2HOi97zBEtRxoNLRQGBIm7Q17chFj5GRLVN6x4ujTuwtAAyc+qqlQVycpLhu iL/qf04YWPnT6MP+qsM7cc+ghDwzthsxNBRfHxMwCv78GT5ki2UakB6N4urDg/EWv0m8mr 3srDqC8r9sFCE9/jcc3UhbVp7p98FTk43o/grlU725Jg3NRY733ad5e5OUHTOYfrEtdxrG gD+hAnXuCvFHnliFG2Z9EyZ2UfBec87t4sdrwTsp60sGNpPCVGcky1UYMJouLC5Vn6XnMD 80zhDkhN25pEFyBBouNeP1cLawJdoGZlnfOWw+u7fXerA+KNXB+brAoqwWxqFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780109112; a=rsa-sha256; cv=none; b=nPF4ErIxENyZOxBAML6WZLU0G9cK7rUXs3xPPCuOBUG9mjxf27HazsEyelvHURuRjJgPWk yUvGKFUmh/HYPN26yaXPZ0u7Wut16SbBbmXwsVnZxDXk/zWPohASddPB2qDIRJEPcXnQvm HeuLtPkoL5dLuwtroiJ/A44ddQpTDVZFZcgUP+No3Bi5P7UJkPfnO7DdMhk9VZrxedZdj4 KknhP+btAXaCRskx2mXWaSF7hIPUdFIdiKXhipjt95CO70PrFvr/RMMlWaPOfFxggmSXyf aT9GmyEI3454QathFy9ueaQAZibs4Pm0f5Z2Cqpxb6UPE9a0itBq82GJPqSx/Q== 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=1780109112; 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=7+Yjo+mpzHHU1qymwUFPs3cHpM4xBJP3UONyXhMUelU=; b=QGDTr7CeDvUS+H7BxCKoHSaZwHK9jafteY8V6mg5VjoZfNSufEkeJ8vy4NoBV9nwlYqfqr 2cwjzgbM/7MHed7CkMdZJn4m5qdAPL1HCf5gcfNbigGNnwh2V+jJL5YoQZQodf4if0yDx6 LgpxVKVz0kFm7cLBips2Bz90udUZgiBeGta40d4ibrbT1I6bn0gj7cX2tIwn2G/ewT5gnt WIPodye2oF3I/97ZTnkty4esUdrIvfiRXV3Rsrs5F8dNxdMHNEFWPqyB3z0T3wBWY2fMoQ eZ0SuzGfGOjGkKKmqYLbXZoVd86YUKwKSboI58MF1FvI1ewusF7ZZc3t5ErpKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gS4MX3YK6z11R5 for ; Sat, 30 May 2026 02:45:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32b9d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 02:45:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 2fa4bdd7f9e9 - main - edk2: enable static asserts for *INT64 alignment 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: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d Auto-Submitted: auto-generated Date: Sat, 30 May 2026 02:45:12 +0000 Message-Id: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=2fa4bdd7f9e99698a6652db405c3165fdcd41c1d commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d Author: Ahmad Khalifa AuthorDate: 2026-05-30 02:40:58 +0000 Commit: Ahmad Khalifa CommitDate: 2026-05-30 02:40:58 +0000 edk2: enable static asserts for *INT64 alignment The ia32 loader is now built with -malign-double, so these should pass. Differential Revision: https://reviews.freebsd.org/D55386 --- sys/contrib/edk2/Include/Base.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/Include/Base.h index 3ae798db8429..d3342c9a6ca2 100644 --- a/sys/contrib/edk2/Include/Base.h +++ b/sys/contrib/edk2/Include/Base.h @@ -841,10 +841,8 @@ STATIC_ASSERT (ALIGNOF (INT16) == sizeof (INT16), "Alignment of INT16 does not STATIC_ASSERT (ALIGNOF (UINT16) == sizeof (UINT16), "Alignment of UINT16 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (INT32) == sizeof (INT32), "Alignment of INT32 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (UINT32) == sizeof (UINT32), "Alignment of UINT32 does not meet UEFI Specification Data Type requirements"); -#ifndef _STANDALONE STATIC_ASSERT (ALIGNOF (INT64) == sizeof (INT64), "Alignment of INT64 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (UINT64) == sizeof (UINT64), "Alignment of UINT64 does not meet UEFI Specification Data Type requirements"); -#endif STATIC_ASSERT (ALIGNOF (CHAR8) == sizeof (CHAR8), "Alignment of CHAR8 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (CHAR16) == sizeof (CHAR16), "Alignment of CHAR16 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (INTN) == sizeof (INTN), "Alignment of INTN does not meet UEFI Specification Data Type requirements"); From nobody Sat May 30 12:56:58 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 4gSKxR0hwMz6fsqf for ; Sat, 30 May 2026 12:56:59 +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 4gSKxQ6Zwmz3SY2 for ; Sat, 30 May 2026 12:56:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780145818; 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=jNAYHPVIEe0vnEIq5eNJJlcZ+3gr2sEgO4p/79o7N7A=; b=RISdCyp+iI29wM2duGoDaS7WwMTGYxXk9q8OhwdZKR0GhTCmoEsiuub3yReLyZ5MbzlHUl +jj60XzZhfKYt7qe+PGQs+1HcC3xwngedD6+GPdSiyv6oiu4TrptFtRQWd9bDH9V8hpajp 8Nhz6pW/xABuEOquhtU5vUfI0bMnPjUKrBBJ2gWqNLLbxzHGXnvnQDZYKDhOac67aJV+tA lKD6pUSEIy/5NtyKunE+DIKq5ewxR5txfjh6QbmTUAP2YzQfQ/+ByseFgdJ1o7or+pzHzD nEKQNJXIMWsM2sPFwIy0fZ41aDfcwnl5a4MLh9HmQj5myacrR2PXHTZ/2pTLgw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780145818; a=rsa-sha256; cv=none; b=FwFnv8vWRq2dGvRukthk90m/R1IaSUsHbUE4pnFJJq+MX6qJRYeN/Uvjxb6nokDFRKF7aj 50WbxIjWhbS38ftn+X2LKtCZc4zAhEo+cyvKF6y/7aesKhv6YgC65TOPFxnCxsAROCkB0L SH6mFnpnXS//WMMNDKLskLkS3S5JN0CaN+T0x3nVDwM6odTLIEM/TnE1TjpyX+lHHYIkJk vjEUAEzX9X4pMIBIi8HhzVZuZgTisLSx8eXg2dtFS+7gE/tPSvjGadtBg/srFGvu7ZBhog RT+8AI49zlOSV81ERgfLNh/D83F7AKVu8jU5Lm1JdgOgZ16jmB+sWE8PGjij8w== 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=1780145818; 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=jNAYHPVIEe0vnEIq5eNJJlcZ+3gr2sEgO4p/79o7N7A=; b=EmS3gbkHCbsbYc6LsENy5i/GrIpM8nglZDFP163Bg5BtFfvr+eEhtHL5/geyxIjSAXzMmA yJpota32vdHydM9209qljiyQ+6yUBnjRxsoEVWtFoMXBELQWJTB+yeZ+Sn9wKWW6LLMeWf zfVWX7OrLU4ZKEVGGWCjG6RYNwr7XhtI6INpgN7qArrqzmtmvilCtwSK+jQFilGRpMAC8j dIO5GLd16s3zXBtYgI1/A2i+1fgEZC4jdGcpDz21K4ej9ce9EL5XNBL9KerB4RBdd0n9bc zdsPPyW1/mA2WkeHi3GajyJwRGvuz/OClvcDt6r0dTazvgXcv51yBxT/6YgwDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSKxQ5kS6z1KTs for ; Sat, 30 May 2026 12:56:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 222f8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 12:56:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 201090678e03 - main - imgact_elf: add sysctl kern.elfXX.phnums for the number of program headers 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 201090678e033237e20d80eb29cc059e0df9a1e1 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 12:56:58 +0000 Message-Id: <6a1ade9a.222f8.4f36754a@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=201090678e033237e20d80eb29cc059e0df9a1e1 commit 201090678e033237e20d80eb29cc059e0df9a1e1 Author: Konstantin Belousov AuthorDate: 2026-05-29 14:47:31 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-30 12:56:40 +0000 imgact_elf: add sysctl kern.elfXX.phnums for the number of program headers that are accepted in the activated image or interpreter. Requested by: jhb Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57328 --- sys/kern/imgact_elf.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index e3969223c170..b889c4a14866 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -84,8 +84,6 @@ #define ELF_NOTE_ROUNDSIZE 4 #define OLD_EI_BRAND 8 -#define ELF_OFFPAGE_PHNUM 128 - /* * ELF_ABI_NAME is a string name of the ELF ABI. ELF_ABI_ID is used * to build variable names. @@ -229,6 +227,11 @@ SYSCTL_BOOL(ELF_NODE_OID, OID_AUTO, allow_wx, CTLFLAG_RWTUN, &__elfN(allow_wx), 0, "Allow pages to be mapped simultaneously writable and executable"); +static u_int __elfN(phnums) = 128; +SYSCTL_UINT(ELF_NODE_OID, OID_AUTO, phnums, + CTLFLAG_RWTUN, &__elfN(phnums), 0, + "Max number of program headers to accept"); + static const Elf_Brandinfo *elf_brand_list[MAX_BRANDS]; #define aligned(a, t) (rounddown2((u_long)(a), sizeof(t)) == (u_long)(a)) @@ -855,17 +858,14 @@ __elfN(load_file)(struct thread *td, const char *file, u_long *addr, goto fail; } - if (!aligned(imgp->image_header + hdr->e_phoff, Elf_Addr)) { + if (!aligned(imgp->image_header + hdr->e_phoff, Elf_Addr) || + hdr->e_phnum > __elfN(phnums)) { error = ENOEXEC; goto fail; } if (__elfN(phdr_in_zero_page)(hdr)) { phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); } else { - if (hdr->e_phnum > ELF_OFFPAGE_PHNUM) { - error = ENOEXEC; - goto fail; - } VOP_UNLOCK(imgp->vp); phdr = m_phdrs = malloc(hdr->e_phnum * sizeof(Elf_Phdr), M_TEMP, M_WAITOK | M_ZERO); @@ -1165,11 +1165,13 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) uprintf("PHDRS wrap\n"); return (ENOEXEC); } + if (hdr->e_phnum > __elfN(phnums)) { + uprintf("Too many program headers (%u, %u max)\n", + hdr->e_phnum, __elfN(phnums)); + return (ENOEXEC); + } if (__elfN(phdr_in_zero_page)(hdr)) { phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); - } else if (hdr->e_phnum > ELF_OFFPAGE_PHNUM) { - uprintf("Too many program headers\n"); - return (ENOEXEC); } else { VOP_UNLOCK(imgp->vp); phdr = m_phdrs = malloc(hdr->e_phnum * sizeof(Elf_Phdr), From nobody Sat May 30 13:44:23 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 4gSM081Mmlz6fxld for ; Sat, 30 May 2026 13:44:24 +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 4gSM076BJtz3Xnb for ; Sat, 30 May 2026 13:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780148663; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=65XGcvXVHO72L/g9th/+KbZ62fmGlqcVy/q+gtZbNSE=; b=oWxXBM6D/LmVItp92+vBSgLKUn75ZwHptG8YS7SD6XKVlGDJgO821eXzN398spEEdflswy Dd/cN8+97mRO+S8xCEWMFb1LXwo6+B5iGFc9+MJT3TYdjc9wnBA2xGeYORUFoYfTw89FAO 7jQ165ch3Sep3kH1DA3J/f87AqWq4coEwu1X0dYxxUAgb64pbh1A9RW2QZuklUhPKHr47d g3WfpEP2oXOXuwCrQ2oFRmXWF4p2biAtRf2EZU4I4hUVhVeUJL2hxlmERCX+4FrYfvCvkE OPinakw2pISAnSf9EUmfyQTp45BvXrDcjKdiyxN6DK4NmKuX/p4nLpzwYGwLpw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780148663; a=rsa-sha256; cv=none; b=fXb0lM+Q42SM/Q+MD4Kbfm7pbTBSEZ5x50Ee8Sd0LsO5jpcxhUdCSho6wo6YzzjiJ5o+Fg tAYGFjdRfQSWeo2jC3Wyy2djqRHhxHNWAXzKBM2vLVAKbxkPbIYowMq8RXSKOgSn+wDwt/ A0HaQWNM3R/fpfzriug7smg/7UyaqSJIqdJcKN2HD+NHTok13x3rf6t5fRYBBB/559NOYK M7vV6CiIa2PUlBFhkDcwVJb0NU5PeerXfLlIhh1231xvj0uXH2FMKqi1eyguKQALoisJet DTtVGKwbt2BlGZlsImkRMWo2QOC83uwLgmOV+Vdm3zwG6dzMYcep36zmd9fVHw== 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=1780148663; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=65XGcvXVHO72L/g9th/+KbZ62fmGlqcVy/q+gtZbNSE=; b=AK0MiwDu3o/OfG+DOtruxi+SlsfyCi+bWPttHExzRKIvG5ivVxXvPt0+v3K2WhT0y4u1HG XycEHcHvPy8q0NdANEb+kRLK+tz21/EaTa/QJDORU3QLSus9hVa9pMey44i0/WZ6G80Klh X8SaV2d5skwK438giFi3Z/59hhw3hx40AWHOrUaaEilrIYxS7dbuIsmI0PxsYbUsGIttWM pDbdV44zNs7Q2VmiTV+HiLC5GgQr1JcKlzuO1QSVA8bmHSd8I8eECJreRsqSvc0ExwQk7X y/MNSQhvhvpPTaflMzAZSqx6T+2RW43n+CAM6KQi8yLudeZy5wcp95egmlcHKQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSM075k16z1Lh9 for ; Sat, 30 May 2026 13:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30b33 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 13:44:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Faraz Vahedi From: Robert Clausecker Subject: git: 60c11e7c54d0 - main - rpcsvc: Remove obsolete bool definition from yp_prot.h 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 60c11e7c54d0128fafcea9c804c7736e2fb53e37 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 13:44:23 +0000 Message-Id: <6a1ae9b7.30b33.4b6ff05e@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=60c11e7c54d0128fafcea9c804c7736e2fb53e37 commit 60c11e7c54d0128fafcea9c804c7736e2fb53e37 Author: Faraz Vahedi AuthorDate: 2026-05-25 19:14:58 +0000 Commit: Robert Clausecker CommitDate: 2026-05-30 13:43:51 +0000 rpcsvc: Remove obsolete bool definition from yp_prot.h `yp_prot.h` has carried a SunRPC-era typedef of `bool` guarded by `BOOL_DEFINED`, but the header itself does not use it. The YP/RPC interfaces use `bool_t` for protocol booleans. Defining `bool` in a public header collides with modern C headers that provide `bool` as a macro or keyword, such as `` and C23-aware assert handling. Drop the compatibility typedef and leave `bool` definition to the consumer's language mode. Signed-off-by: Faraz Vahedi Reviewed by: fuz MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2203 --- include/rpcsvc/yp_prot.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/rpcsvc/yp_prot.h b/include/rpcsvc/yp_prot.h index 091347231c8b..d0ad15bd657c 100644 --- a/include/rpcsvc/yp_prot.h +++ b/include/rpcsvc/yp_prot.h @@ -67,11 +67,6 @@ * YPPROC_MAPLIST takes (char *), returns (struct ypmaplist *). */ -#ifndef BOOL_DEFINED -typedef u_int bool; -#define BOOL_DEFINED -#endif - /* Program and version symbols, magic numbers */ #define YPPROG ((u_long)100004) From nobody Sat May 30 13:44:24 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 4gSM091qB1z6fxsf for ; Sat, 30 May 2026 13:44:25 +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 4gSM0873gLz3Xng for ; Sat, 30 May 2026 13:44:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780148665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4CsF2V/s1573l46euyPClQnoIji7mgHslWg5oFReZY4=; b=gG9STfEvIVk3/dFNfMP1kEZ+kDmZ4cZt7XnkrfDfWiuaYs7o8Ujn9rGt7NVRHiePeOP4HE DRzFihrnBlwR6eJ4NSU1Ln0mYU6/RLcLY+yjxxBTEI/bI/yiFBUkfNBW/d55goOfvAJC+D zBFVon5DFCYtxrMA5yADP9r62a20DcWEgvBNgllk+xropJgKCLX6CrUYfBmrVon5mbkBjl pgaWx0M+Rign6gqHSZ8x+OOChRYH7L/W//8tnQwR3xh1h/m2G7aLlu1DJE1SU/Eow1aSR5 xE9mVxvxpd4wIhNQiw/BfS2kPOU16HAK1J6hYbMoJyxykO1Xf7XMiqfCwEx27Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780148665; a=rsa-sha256; cv=none; b=Y5ZVQC8z6RjKgHqtw4v/2s3VC6F3ddt4CXSBOclwCPGFVefOKWMtDcpv4uJnCfynTNbE3g IQKlnD5nh73nbSUGhMD5/0rqf6yWcvZKp7mvr4c8Uvs7VaHFoiyWMonlG8sAH9SPkuyTeC WoJnLFFjNR+/gxdSh6Uvp50rrSh2ZjlDMxopfnvLTosyKozuv8aoB9G0eWW5zfUUYHNjv/ OCX1lPGyyZuVEcy2ZgnD7qZTFfhYEXwrFw9965iuJtWUEaGOcK+arVxeWvnWTxvLrB1BCQ w+5/e3MH8nlTtmajmVtKnUB1UtZ1P66zwl5wuU7iHrMKxZ9VTH40bGHZWnQpcw== 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=1780148665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4CsF2V/s1573l46euyPClQnoIji7mgHslWg5oFReZY4=; b=eVC4vIm+r27+t6O0pvschY3lTtQPfcxJjAV7kx8cVMOqX9YGIRHjLk69DdEFs1lLUkkmDA JSilysR6Z4SBdJNWCeZWuN6ESucQRk8suVDceZIhF8a3nXNrbGqzCY+vfTp1r+8ebCBBGf hqh/wLmYfSW3T4O9Jq70o8NMFp3SAkUl+uVZBd+ATAg7DKVyv0SNjh3EOaBM5m/f/OimGr YW7kl0GmdTPxc9yRWB9hrDV1dMVa19EjEQIYfQQr+qbNbTXlJfnehnnuTWpVx1Sssr6mvQ g8QfY37irAEFF7AqqjcAy09SzU7hEUiHje+dcQLegoOgA7sNwm0YKgWypY6kVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSM086VYYz1Lcy for ; Sat, 30 May 2026 13:44:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3098c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 13:44:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Faraz Vahedi From: Robert Clausecker Subject: git: 64502126e126 - main - mdmfs: Use standard bool definition 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64502126e126476456ca2aa60b4f798ed2d0b879 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 13:44:24 +0000 Message-Id: <6a1ae9b8.3098c.2e608972@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=64502126e126476456ca2aa60b4f798ed2d0b879 commit 64502126e126476456ca2aa60b4f798ed2d0b879 Author: Faraz Vahedi AuthorDate: 2026-05-26 06:06:52 +0000 Commit: Robert Clausecker CommitDate: 2026-05-30 13:43:51 +0000 mdmfs: Use standard bool definition Include `` instead of defining a local bool enum. This avoids duplicating a standard type name and keeps the source compatible with headers that provide bool as a macro, or in case of C23 that compilers provide it as keyword. Signed-off-by: Faraz Vahedi Reviewed by: fuz MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2203 --- sbin/mdmfs/mdmfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/mdmfs/mdmfs.c b/sbin/mdmfs/mdmfs.c index cd0bf7c96143..c86a098a892d 100644 --- a/sbin/mdmfs/mdmfs.c +++ b/sbin/mdmfs/mdmfs.c @@ -49,14 +49,13 @@ #include #include #include +#include #include #include #include #include #include -typedef enum { false, true } bool; - struct mtpt_info { uid_t mi_uid; bool mi_have_uid; From nobody Sat May 30 13:44:26 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 4gSM0B1t4Hz6fxpN for ; Sat, 30 May 2026 13:44:26 +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 4gSM0B0c2Bz3XrB for ; Sat, 30 May 2026 13:44:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780148666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NivB9DzZBXm5do92stS70pHRNeoId1qTpJDNpw5WTz4=; b=u3OGk2IDITLb2jsLtP3UJuHSm68QfACymytb6njdBgJW/OuTgQfw2OP7jiRfnCzOAAaUBk 45IuekqhxCM44HACyfmtekLx3UWSoCxYqSSus/JjUdoyBcybAk+NVj/pqBcdLtmFg+4tqW 54b+WZqL5NhQ38sReldxu9ORJgAa5p8xTO12tIaGn8eJP/jws2HgY3uPtljNqDAQPNAAJm qHeLki85OFOmopfc8H+9Z3nxEH3rDvQEx15RPazuG+AtKay2bdUeOTnBaNfpBTlqO+eCp3 5Nb69IqLY/DOhMzSxP5xCMk5choEc+pVscSV8BdSiHXkwfkLpCEiYwnZjwUYNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780148666; a=rsa-sha256; cv=none; b=NwxcLY9uPcwIK5lm1cq8OPT912iD2SlY8T1giIW8jgCycty33JeqedkP6Tni6mWJFgJ+8a 9SPCbQVdfQpE8A61Z+P7DgU6B5Y0Jqodm+pmGIcaX7zI/DCCbr1jKWIROGABx2S6vHx2pX +JJBAxYlWHavEptJq0z0yn3qEL3ESYtBZ6ywbGT1nMczu/4jNTKaPi/p1T2HqCnVd/i9OD ywOvitLyQ3M/zbWgLoPhzXSkQJd4/4nXxFJsgxeQiQQBlA80Ln2xL8jXT7rq1rLpH3ZyLj IDXrX+H0tYtsQ3h6dBpKujGW28fzdM/q9H11s5rrZqnvApeFCaYcwE3Gg0LTlg== 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=1780148666; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NivB9DzZBXm5do92stS70pHRNeoId1qTpJDNpw5WTz4=; b=gxz3AtHfcL5LPMpdEcVKeo0oWc4hbMrq16Lz2NoEkZnH+pyBHls7uEZKM4D6j3RcsFGvq1 YnzFmRRpqzD7/Hikg/hIH1Fjz31GTWRL7JV2GgVXsqQ+3rGj2cz3Mxy4FqTELgxEqFveTy IZgNnwTq1mdXww0vpY3Qx7N6MGf1ZJrDnbn1QzkVV4xMpSNX/jqlIiqoZ1zNNNb3ASZhtZ b+Tmk4pSSi7aD3nYM5oErm/8gTVSkkuwQrmYbWinLmE3XrejdRrA3EG41j+LYB46KzGkwo lVi9hpK5x+WvCD5IjpTjKoF5Zl11PyBWaE2qeV5ZYiQZ1s16SecnW7tswxhTEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSM0B0CYPz1LL8 for ; Sat, 30 May 2026 13:44:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30b38 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 13:44:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Faraz Vahedi From: Robert Clausecker Subject: git: c5c7d18d0118 - main - libc: Restrict the static_assert macro to pre-C23 modes 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5c7d18d011830088a2134e1be32f610f1f3e797 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 13:44:26 +0000 Message-Id: <6a1ae9ba.30b38.52069bbf@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=c5c7d18d011830088a2134e1be32f610f1f3e797 commit c5c7d18d011830088a2134e1be32f610f1f3e797 Author: Faraz Vahedi AuthorDate: 2026-05-17 20:47:49 +0000 Commit: Robert Clausecker CommitDate: 2026-05-30 13:43:51 +0000 libc: Restrict the static_assert macro to pre-C23 modes Signed-off-by: Faraz Vahedi Reviewed by: fuz MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2203 --- include/assert.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/assert.h b/include/assert.h index a3dbe933e18f..a089d7b79915 100644 --- a/include/assert.h +++ b/include/assert.h @@ -72,8 +72,11 @@ * C++ template parameters may contain commas, even if not enclosed in * parentheses, causing the _Static_assert macro to be invoked with more * than two parameters. + * + * C23 defines static_assert and its obsolescent alternative spelling, + * _Static_assert, as keywords. */ -#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) +#if __ISO_C_VISIBLE >= 2011 && __ISO_C_VISIBLE < 2023 && !defined(__cplusplus) #define static_assert _Static_assert #endif From nobody Sat May 30 13:44:27 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 4gSM0C58RTz6fxrZ for ; Sat, 30 May 2026 13:44:27 +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 4gSM0C1bQlz3Xp5 for ; Sat, 30 May 2026 13:44:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780148667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZhIQ02VLfA8ngyS+CF1XFY+OKaceerbVMLDEA/bLTxI=; b=S/TUiXBjCm7w9U9hYpOFxhuRfEbbwcOQ0vttglB4h7tyKECfDvVlUm3AmN/zHj+yji0ZFt kYk0k87PUni00g1I7D+qsNrPKzQp453qElYKZu77BX5mFgTynIme38UL16VYSAfygQ+XJC KfodjKGd6XH3d/rFTKoM0Gxu58spYibMVhDenCJ7SHxqVs/x5ai5SN4R/BqsOO68MufKv5 EBPaqT0i89V31dhTARTLxCY0BRBHF1PSchDkb5ytmaWLWL25K5lYhCZ/tFax9i9ojYCx4V ThtfDTCE83Buv/aFp5v9bMDa0+kduPqe/XLDd9MmPrsaCJrSBZGZkkt+Za//1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780148667; a=rsa-sha256; cv=none; b=ZGChwzLiRmxsw0zS/rqRjSV3ZGojv1XFl8jiVHHD1e8q2euQzEsL+fX7hq0mBQiigzS5Ba pZk9fa0jWfBZIQ9kClH5n0Pd/p6tp0SIu/xnXblD2LjDEYpYS9SwmuwyvZ27Fnmoekfn5y 9ocd01wu9l8EFC1yk5v09wsG9Nx5Lo+sikcu7DD1QZdOBU3ZNc3+zeD8z1x2iHk5dI3ggh ZrX3he6j348nttj3pEkut9uOskej/zQETjJivP5GV28/rqdlPv+hFOKj+YwMsfIrT/LD85 xoYcFNRxLeXCBhyAnsRPACapo7G+D7DrhNA6IGqUhY/szaQqrw+HAZu1uk5M6w== 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=1780148667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZhIQ02VLfA8ngyS+CF1XFY+OKaceerbVMLDEA/bLTxI=; b=BiWxSeXPeCAjmboQnvR7yn2tnzks7QN9XQdAQACNLqoESSfVCrFTpXAKBkvJ9n4zsYyhW9 7biLrvo1vlK+u9Qo4vfc9+5MDxR4mTmsh1jfit32GVt2EmJRQPFKeVJ8KCHkpYDD5YwikE eWKT4Dmy38ej8yHuDctd9ybNAxe81JB/KJzuC9K0FzE/2rMpx/c5/vIvQcI6do+yJGrqmd tWTTEIlSZDNLp7QLUACZBcfkAOWKg6u8erIz2rbFyyTlBPPIT+Ze+0cKr3LvX04iCbHjVP gvH0juLMigLpoTZAKi41ZRStVaE1TA2J7kfo2FSRY+PPhcru/FMQG7FY7H9ulg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSM0C12M0z1LNw for ; Sat, 30 May 2026 13:44:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 31603 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 13:44:27 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Faraz Vahedi From: Robert Clausecker Subject: git: 157c184689ea - main - assert.h: Remove leading tabs for whitespace consistency 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 157c184689ea3d7b8b6bd89aff849e94f004aa0e Auto-Submitted: auto-generated Date: Sat, 30 May 2026 13:44:27 +0000 Message-Id: <6a1ae9bb.31603.7e25baf6@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=157c184689ea3d7b8b6bd89aff849e94f004aa0e commit 157c184689ea3d7b8b6bd89aff849e94f004aa0e Author: Faraz Vahedi AuthorDate: 2026-05-28 07:17:28 +0000 Commit: Robert Clausecker CommitDate: 2026-05-30 13:43:51 +0000 assert.h: Remove leading tabs for whitespace consistency Signed-off-by: Faraz Vahedi Reviewed by: fuz MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2203 --- include/assert.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/assert.h b/include/assert.h index a089d7b79915..7dd48e61c082 100644 --- a/include/assert.h +++ b/include/assert.h @@ -46,19 +46,19 @@ #undef __assert_unreachable #ifdef NDEBUG -#define assert(e) ((void)0) -#define _assert(e) ((void)0) +#define assert(e) ((void)0) +#define _assert(e) ((void)0) #if __BSD_VISIBLE -#define __assert_unreachable() __unreachable() -#endif /* __BSD_VISIBLE */ +#define __assert_unreachable() __unreachable() +#endif /* __BSD_VISIBLE */ #else -#define _assert(e) assert(e) +#define _assert(e) assert(e) -#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ +#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) #if __BSD_VISIBLE -#define __assert_unreachable() assert(0 && "unreachable segment reached") -#endif /* __BSD_VISIBLE */ +#define __assert_unreachable() assert(0 && "unreachable segment reached") +#endif /* __BSD_VISIBLE */ #endif /* NDEBUG */ #ifndef _ASSERT_H_ @@ -77,7 +77,7 @@ * _Static_assert, as keywords. */ #if __ISO_C_VISIBLE >= 2011 && __ISO_C_VISIBLE < 2023 && !defined(__cplusplus) -#define static_assert _Static_assert +#define static_assert _Static_assert #endif __BEGIN_DECLS From nobody Sat May 30 13:44: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 4gSM0D5dycz6fxpQ for ; Sat, 30 May 2026 13:44:28 +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 4gSM0D2FBxz3Xrb for ; Sat, 30 May 2026 13:44:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780148668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ptAXkj3dg3/+OzRGmX6e9UKzgYni/+io+6mQCs1Nrj8=; b=bDDQl9/xGBO9H1Qm27tS/AqwRvWTobnsJR/Zo/YzGXgDuVk8r2tSwvmsWWq+ETB5kZhmyc jcjOmgPoS0ZXHjLjkgY7LdlTm7JIoG9HJakQOg6OM1Bqh7J7ldZ1a1bdvuSmy05kBHg4Tt Frhnycdd3PW8jBmVObVuVEDTp2fFNZdnjt0cZaMvd3xPjr8iZsQdk93TZ70Nz7OWCRMVHl l/iL2Xls564OTdDIxlJn2I+psLtn3xnSDMhgWBlH5LfwdxVMIj4tZ2oon6YQV88sjURk2f h1Qn+sCAUF5JS8sOwUAOKVPkQWuUp03mCqyMG3BxVLfMsHUcNsSwQXZg3PAURQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780148668; a=rsa-sha256; cv=none; b=p6OMJ34GFCWAXY0enjm5jnkjbqZR9Ml7By0p2NhU3qY3VEWYwXt9BGlCJMMsCp05JUCdvG Vdo3u4ZLV8G1u3mUBnj5ZWew+rznj0xI6fafXR5P5vAr9w6uQC3PFHbbKgZXDKK4aUAIfr OZX9iVos4WhB48s2bncGgnt/mxH9TQcaJ5LO4jP0w/aggC8zIMwjarsoBC3REE15a27kdN q85IGSAlW14Uz/KxbPpihTsrjCsPCyazjJ8Wu+WTo8P1X3UvSEc1w7cHlgdY0w697elrEh /OayowqsdgDyEkCXhQ2UcC1wPfUyBPUd74rpJUdw22BSrOJsN4zsLjF+sW8s2Q== 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=1780148668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ptAXkj3dg3/+OzRGmX6e9UKzgYni/+io+6mQCs1Nrj8=; b=rj+TRMN5l3xRqYRyncOQ1r9FhP1vVrbpJRodzKMH2Se4E15vIYiHBcxFCV8wzmqBMWLUGf J+AsXJGALQnuDIFxStMq0za0K3uFKwnWeiNDTc5E/9RvV6bQYoJiD41ddiYrnXt94dp5dc /HmncuVaSxboSXmg74YUap/E6SHvQEH1fDULbIS2Z1T2QY2N/aUDPg1z8r0+gJsyfwliLw 6BrvE5+93Ut1IWbMZy1/lOUzZbZei0U4cHQKcwZ0rduyrvn18wPcdtGf/v+NPanIEiR0it AWtWXXfFnkNafcnmetsEeC2XQOPaYxIJaBVXf9U1eR4WBvNRu+pyZVE698cBtw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSM0D1rjxz1LhC for ; Sat, 30 May 2026 13:44:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27dc1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 13:44:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Faraz Vahedi From: Robert Clausecker Subject: git: 867b51452ea7 - main - libc: Add variadic assert in accordance with C23 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 867b51452ea78ece0b312a387e63fdbc2a11056a Auto-Submitted: auto-generated Date: Sat, 30 May 2026 13:44:28 +0000 Message-Id: <6a1ae9bc.27dc1.4cecadc6@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=867b51452ea78ece0b312a387e63fdbc2a11056a commit 867b51452ea78ece0b312a387e63fdbc2a11056a Author: Faraz Vahedi AuthorDate: 2026-05-28 07:31:29 +0000 Commit: Robert Clausecker CommitDate: 2026-05-30 13:43:51 +0000 libc: Add variadic assert in accordance with C23 Signed-off-by: Faraz Vahedi Reviewed by: fuz MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2203 --- include/assert.h | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/include/assert.h b/include/assert.h index 7dd48e61c082..159efacfa45b 100644 --- a/include/assert.h +++ b/include/assert.h @@ -46,16 +46,43 @@ #undef __assert_unreachable #ifdef NDEBUG -#define assert(e) ((void)0) -#define _assert(e) ((void)0) +#define assert(...) ((void)0) +#define _assert(...) ((void)0) #if __BSD_VISIBLE #define __assert_unreachable() __unreachable() #endif /* __BSD_VISIBLE */ #else -#define _assert(e) assert(e) - -#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ - __LINE__, #e)) +#ifdef __cplusplus +#if __cplusplus < 202002L +/* + * C++ modes prior to C++20 cannot simultaneously satisfy all three + * desirable properties of the sanitiser: + * + * Approach No double-eval Lambda support Arity check + * ----------------------------- -------------- -------------- ----------- + * sizeof(cast(expression)) yes no yes + * static_cast(expression) no yes no + * (void)bool(expression) no yes no + * + * NOTE: C++20 introduced lambdas in unevaluated contexts; see P0315R4. + * + * Since no approach satisfies all three below C++20, the least harmful + * choice is to forgo the check entirely rather than silently break one + * of the remaining guarantees. + * + */ +#define __assert_sanitize(...) ((void)0) +#else +#define __assert_sanitize(...) (void)sizeof(((bool(*)(bool))0)(__VA_ARGS__)) +#endif /* __cplusplus < 202002L */ +#else +#define __assert_sanitize(...) (void)sizeof(((_Bool(*)(_Bool))0)(__VA_ARGS__)) +#endif /* __cplusplus */ +#define assert(...) (__assert_sanitize(__VA_ARGS__), \ + (__VA_ARGS__) ? (void)0 : \ + __assert(__func__, __FILE__, \ + __LINE__, #__VA_ARGS__)) +#define _assert(...) assert(__VA_ARGS__) #if __BSD_VISIBLE #define __assert_unreachable() assert(0 && "unreachable segment reached") #endif /* __BSD_VISIBLE */ @@ -76,7 +103,8 @@ * C23 defines static_assert and its obsolescent alternative spelling, * _Static_assert, as keywords. */ -#if __ISO_C_VISIBLE >= 2011 && __ISO_C_VISIBLE < 2023 && !defined(__cplusplus) +#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) && \ + __STDC_VERSION__ < 202311L #define static_assert _Static_assert #endif From nobody Sat May 30 13:44:29 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 4gSM0F6c7Xz6fxjh for ; Sat, 30 May 2026 13:44: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 4gSM0F2jpRz3Y16 for ; Sat, 30 May 2026 13:44:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780148669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fLBl+/8Q5A2z24B3nfknaHbDl1sBjNOzd77zyz0P0X0=; b=VbKU2ZE/VSTxkC+oone2vIPDAn6rix/INbokXdk3Vo0wif+7OgMhZJsAkX/Yopr/qGLwld zzqCrqnyDWLUm0O1hyjAiPgoLPUwFn49VjiwXAnjnfUl4sER7r8cugzZ8j+BUHimEt2RmW rVr73udFvh48H6EREbhyKJlS8+tCL29wFxQS3fUi6y+D0hP4BLg5orD+eTsYBlXKfOB/y9 tQ0pFI3/CccDUcJFWQyb3IO4sICxPMmuLUpVcQVVv80dJh1MUKUs6DgLXc6BtuONgQdi2Y Prx6Ia5uPdv4aEU6y0T8jFUwsYCUQj+xcH/TdKlT6AXb4tKJudX228b5ezMOOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780148669; a=rsa-sha256; cv=none; b=BJUvVhIf+MnkizfeEF2WTA44m68fTYpYqmbHcsJdvgEv2q4kNjBEgYWBXnj3bh4ef9KnpF YgJty06JswaHnS5D3BsIJJDEc1ir72goPkLNpRsyuVA9Tf9AsHnXCM3xZU6L+QmkaaH1wA 1dvtJO6f7NxzSI3SeQJ5f1m/RX9YgKQk2VhKuVG8eOPsFIcQdx33uzZoK7w5So3ZzvP7Qf GQu6o92hrQFT8NnSGypedUxJ+7TBSRJGx5EzGv7c134Hojw/lFrml1isDHxRdZZA6ZKyB6 CQA3rBq3ZlQ6Mjit0RmkGxXU/A5UMy6xIi7RDf9J4iAuu+MzQiw6c0sy/ucjIQ== 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=1780148669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fLBl+/8Q5A2z24B3nfknaHbDl1sBjNOzd77zyz0P0X0=; b=kgdkw219Cz7XdZeeN+s8XYTt+pVtZv3SO1Ds8DAhLRb3XWuUJW0srv8g6gNUIuXQh0D8yS hvxgzN4Z9X48dkNmvAhlR0bhjzeMGC0ctpG3RrVYaPkD5Kb8sQ275K1YdInhYf192EKMkX Or8UFDO329Q6ego6ouzfP5X06JrfV78BIx2nCeZfL6WSnqplfjvBZsSPhre0P900wqtTCr TZbrhdSTt4U7vwyHzRh11797mYO/QDfz1kmFc5sF7JGQ7GN4bN30NpN0RwfqdIP66tUi7+ pRpXwugiZIfjKFC4eCImzU3AnwgKJ8UdehGXmouG7HFPqeEbBlEerGKVw1UpzA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSM0F2Gjhz1Ld1 for ; Sat, 30 May 2026 13:44:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 306a8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 13:44:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Faraz Vahedi From: Robert Clausecker Subject: git: 0fe73dcf7c32 - main - libc: Add C23 feature test macro 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0fe73dcf7c3260260afd95c3d1cfe846feb1df7c Auto-Submitted: auto-generated Date: Sat, 30 May 2026 13:44:29 +0000 Message-Id: <6a1ae9bd.306a8.19ac1d53@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=0fe73dcf7c3260260afd95c3d1cfe846feb1df7c commit 0fe73dcf7c3260260afd95c3d1cfe846feb1df7c Author: Faraz Vahedi AuthorDate: 2026-05-17 20:39:18 +0000 Commit: Robert Clausecker CommitDate: 2026-05-30 13:43:52 +0000 libc: Add C23 feature test macro Signed-off-by: Faraz Vahedi Reviewed by: fuz MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2203 --- include/assert.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/assert.h b/include/assert.h index 159efacfa45b..75d3e62e8932 100644 --- a/include/assert.h +++ b/include/assert.h @@ -88,8 +88,8 @@ #endif /* __BSD_VISIBLE */ #endif /* NDEBUG */ -#ifndef _ASSERT_H_ -#define _ASSERT_H_ +#ifndef __STDC_VERSION_ASSERT_H__ +#define __STDC_VERSION_ASSERT_H__ 202311L /* * Static assertions. In principle we could define static_assert for @@ -112,4 +112,4 @@ __BEGIN_DECLS void __assert(const char *, const char *, int, const char *) __dead2; __END_DECLS -#endif /* !_ASSERT_H_ */ +#endif /* !__STDC_VERSION_ASSERT_H__ */ From nobody Sat May 30 13:44:30 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 4gSM0G4r3nz6fxTH for ; Sat, 30 May 2026 13:44:30 +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 4gSM0G3B93z3XxP for ; Sat, 30 May 2026 13:44:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780148670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C/ZWlQCUmFSdC74yAHU/1gXgReHsQb9Wo2rj/jEzQW0=; b=facAwREq6olBnCpjh2dg/cLO1JHLOVf5ZRKTI9lU3B+A6NS36vBMoz7mY/wAnzkKzr9nYg Uz63l+MbYyeKWP3i8Niy3w8C1SXAcZ55vFGGRw4E+KOucoQ9NvDPeg5a4CvhvZvXNbHlOy wdEYlavN3nZw28OYqM/Fded6VOpvJ7GJ95Few80ya1G53kRnQ0zzZiTQ4yIsURy3kj2633 uyxdB8fcwXsQinWFTC8HJmqrEprZs/IrKStdLc0X0HxXJUcw+3EmB3p3D8oFSejtZWv8DI iA7OqPJ8stIjdWYb0o4XTwIZmrhc8whhPN33NqcTdZjONJ6VQz6cAAySehhEcg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780148670; a=rsa-sha256; cv=none; b=yulh+fQY5wHb+eqeu+YcfzwIwQKLEI5Opfyo9Xo+IHB2AttCvGb1aut0RdfJklIuxSC2y0 c0FW5XY7JpPlDADFHJZs1hVEMFnIZhjhhFE7qv9BYA7Y2TRlUr61lqiOVqdA8x+vte3/OW xgtW7hMBYJRI2+PWi5fGUHfSayAH0z01Mx/zNyqAT842b2hfbOwhhjBVXHayO+2yP1h0DO pS92cn1s+GvDhYe2q9D+frssM0Tjku31bE4qzuD5/9zODmGaHRdvow1W4wr+bToK25+umu mSr3m7gl08y+KSUOmpEr2955Nsscei2UHSZYq/zv03xFErPflQwuGfAvLqC5uA== 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=1780148670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C/ZWlQCUmFSdC74yAHU/1gXgReHsQb9Wo2rj/jEzQW0=; b=E4Fy7uCWDFKL8fuGr2H12ahJ76WQp8t4J0QEG7brVeNZxudwp3CYBLHCIMmAYKKteeC4Cb Vsn5PBCn5qTrakCosh0ZHLZC2c/MgCVJWakcvFZSWy2Vkwp6UPCXyyzEf5bHK4ak5/kZyX peC6Rux7QdPSVq2HX8rAyw9qDjpRmtGf3SewHwUGRfJGZeyzMKso3uPWNsa2nBdIcEQ0T6 4NefkzXAfVTapN7TQr0ml6qqssJAMz8SJtB+RT7Gfmw9hfTNHXMRNyEOBnypK2lxG+MNLu t6caJlfc0DU99HpoGW+eV0PZQFL+rrOa2KJMp8kUZYEEhMUAphNZDmN1cCk4Cg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSM0G2dRjz1LNy for ; Sat, 30 May 2026 13:44:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30c08 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 13:44:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Faraz Vahedi From: Robert Clausecker Subject: git: c115aad996d5 - main - assert.3: Update as per C23 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c115aad996d52f5270ccd22b27d1f34b4f0f4160 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 13:44:30 +0000 Message-Id: <6a1ae9be.30c08.1685e514@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=c115aad996d52f5270ccd22b27d1f34b4f0f4160 commit c115aad996d52f5270ccd22b27d1f34b4f0f4160 Author: Faraz Vahedi AuthorDate: 2026-05-20 07:22:19 +0000 Commit: Robert Clausecker CommitDate: 2026-05-30 13:43:52 +0000 assert.3: Update as per C23 Signed-off-by: Faraz Vahedi Reviewed by: fuz MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2203 --- share/man/man3/assert.3 | 76 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/share/man/man3/assert.3 b/share/man/man3/assert.3 index f219aa1d6743..2782ffe7de18 100644 --- a/share/man/man3/assert.3 +++ b/share/man/man3/assert.3 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 20, 2021 +.Dd May 17, 2026 .Dt ASSERT 3 .Os .Sh NAME @@ -40,15 +40,14 @@ .Sh DESCRIPTION The .Fn assert -macro tests the given -.Ar expression +macro tests the given scalar +.Ar expression , and if it is false, -the calling process is terminated. -A diagnostic message is written to +a diagnostic message is written to .Dv stderr and the function .Xr abort 3 -is called, effectively terminating the program. +is called, effectively terminating the calling process. .Pp If .Ar expression @@ -57,6 +56,22 @@ the .Fn assert macro does nothing. .Pp +In all compilation modes, +.Fn assert +is defined as a macro with an ellipsis parameter, consistent with the +C23 standard. +This allows expressions containing commas to be passed directly without +requiring an extra pair of enclosing parentheses. +Only a single scalar expression is evaluated. +Supplying multiple arguments is prohibited, and hence are top-level comma +operators. +In particular, this guards against accidentally writing +.Fn assert +in the style of +.Fn static_assert , +which would otherwise silently evaluate as always true via the comma +operator. +.Pp The .Fn assert macro @@ -73,7 +88,7 @@ may be included multiple times. Each time whether or not .Dv NDEBUG is defined determines the behavior of assert from that point forward -until the end of the unit or another include of +until the end of the unit or another inclusion of .In assert.h . .Pp The @@ -82,9 +97,9 @@ macro should only be used for ensuring the developer's expectations hold true. It is not appropriate for regular run-time error detection. .Pp -The +In pre-C23 compilation modes .Fn static_assert -macro expands to +is implemented as a macro and expands to .Fn _Static_assert , and, contrarily to .Fn assert , @@ -94,8 +109,14 @@ message including the string literal message, if provided. The initial form of the .Fn _Static_assert containing a string literal message was introduced in C11 standard, and -the other form with no string literal is to be implemented by C2x and -some compilers may lack its adoption at present. +the other form with no string literal conforms to C23 standard. +.Pp +In C23 and later, +.Fn static_assert +is a language keyword, and +.Fn _Static_assert +is provided as an obsolescent alternative spelling that should not be +used for new code and development. .Sh EXAMPLES The assertion: .Dl "assert(1 == 0);" @@ -111,7 +132,20 @@ Second, the code will disappear if .Dv NDEBUG is defined, changing the semantics of the program. .Pp -The following asserts that the size of the S structure is 16. +The following example asserts that the +.Va iov_len +member of the compound literal, reflecting the value of +.Va len , +is non-zero. +The compound literal contains a comma that is not protected by +parentheses, which the variadic +.Fn assert +macro handles transparently: +.Dl assert((struct iovec){ buf, len }.iov_len); +.Pp +The following asserts that the size of the +.Vt S +structure is 16. Otherwise, it produces a diagnostic message which points at the constraint and includes the provided string literal: .Dl "static_assert(sizeof(struct S) == 16, ""size mismatch"");" @@ -123,14 +157,26 @@ If none is provided, it only points at the constraint. The .Fn assert macro conforms to -.St -isoC-99 . +.St -isoC-2023 . .Pp The .Fn static_assert macro conforms to .St -isoC-2011 . +In +.St -isoC-2023 , +it is a language keyword; whether the macro is defined or not +depends on compilation mode. .Sh HISTORY -An +The .Nm -macro appeared in +macro first appeared in .At v7 . +Starting with +.Fx 15.2 , +it accepts a variadic argument list, allowing expressions +containing commas, such as compound literals, to be passed +without requiring extra enclosing parentheses. +This conforms to +.St -isoC-2023 , +but made available in all compilation modes. From nobody Sat May 30 13:45:45 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 4gSM1l18bVz6fy79; Sat, 30 May 2026 13:45:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gSM1k6qlDz3b9V; Sat, 30 May 2026 13:45:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780148747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hwE9kxgZN9cZsDq2KwlG6ujXyfwgRLSgwwbnPKA0Hrs=; b=WGDTLkts6xD4P7jF2x8HCu67PSUOXereyeN/K5oYccYKEjsNihI7THRXVZliDy7dTSUw2/ VRe2HD+Q3Hc8rEY5+R+E5FFuNU4UKKVbiXITnU+8GSl9Z8f5CmtmMhjD9KlXxRRSiO7pn8 6O55fG8gXERR3clhwDGxDPGVSshyyHAdG4J1MX4MB+6Yv4Snc0w6/aQwz6cS2FJdFOx3sW zSr7yzW7BPMAF4s5pKZibo3SHG7GpGVn4owDttNdopGkLRJvF5WbFlqTPnOxiuGi9tNVWJ FMKWCtzqInwcTZLoWHvlLi5cvMRD40VJJQc2Sn0HgKxDFOdBO/Y+8pHF7R19/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780148747; a=rsa-sha256; cv=none; b=YwiUV+DyUdksF743nBKq3iHMsWpLSVmw2JrF18O1JapddOU4/G5vO7o3PZWydT3CC1Z3LQ LL96UKX6SnZ/bGNn6e8YhaL+xFTLPwBX+rT8j5mtMJGH2mdIrZBtB59NOkXeX+1jVfPS9b cLwgtGYvPn8z9KijSRPVCDrGIEybdYKbj/7Y1jh6Ngm+509/SQI8vuz0FirANxSB5z1UfQ gYjUUaw2jyymux/4cYCq0WQbCnpk6zN9G7DEZX2wXZ0RAuGBTD0I/dl+xDQObOOJVd8dGJ 02t3yR8AMJOcgwMkc9ZhLc09byrjrTbHO5Q5/KFYCn6Q9Vzfk0XU0ROjEI2XvQ== 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=1780148747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hwE9kxgZN9cZsDq2KwlG6ujXyfwgRLSgwwbnPKA0Hrs=; b=iFB1bfQlxuEVSq+TyoS/VB3lgShEOJlWyvQfkdRH2MmMnWn74X6hx6fgx0AlqTxcPj+Er5 lmn/X2HyWYrl1MPmq0TIl++TAanP9moyq3YxXlCeCF+zNclhQxgPu7vZmYbDf0xL0A6Owd SqHroW8MQ9WsakBLg4EZZ3inE0ybaMsDqnPCFy0dTp4Eon//Jv0wNFUZFj4jU3Lwhqmj+R VMxdMypzs5Fi4FdEBteQ0VfP69ZDEyWKuVdpJ5C+uxeKakqX76fGzJ7b1a3ZrSey845eOa HoOGytHdSl7TuHRR8T+Tefq61NAfOUE2ur28FM1t/3KzJL3kWydx7pF9UdWBQA== Received: from [IPV6:2601:5c0:4202:5670:a80b:d4ea:2604:483] (unknown [IPv6:2601:5c0:4202:5670:a80b:d4ea:2604:483]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gSM1k4ps9z2NC; Sat, 30 May 2026 13:45:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <6c63abe2-f8d0-4b64-a3b1-1ad9e1a0a100@FreeBSD.org> Date: Sat, 30 May 2026 09:45:45 -0400 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 User-Agent: Mozilla Thunderbird Subject: Re: git: 804daf166406 - main - imgact_elf: read program headers if not contained in the first page Content-Language: en-US To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <6a18acc7.32ef9.6a0db43@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/29/26 10:39, Konstantin Belousov wrote: > On Fri, May 29, 2026 at 10:30:48AM -0400, John Baldwin wrote: >> On 5/28/26 16:59, Konstantin Belousov wrote: >>> The branch main has been updated by kib: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=804daf166406a1b0e22f93b9417b90ed7d3aa1ae >>> >>> commit 804daf166406a1b0e22f93b9417b90ed7d3aa1ae >>> Author: Konstantin Belousov >>> AuthorDate: 2026-05-28 09:06:33 +0000 >>> Commit: Konstantin Belousov >>> CommitDate: 2026-05-28 20:59:26 +0000 >>> >>> imgact_elf: read program headers if not contained in the first page >>> PR: 295629 >>> Reviewed by: markj >>> Tested by: Alex S >>> Sponsored by: The FreeBSD Foundation >>> MFC after: 1 week >>> Differential revision: https://reviews.freebsd.org/D57294 >> >> Oh well, I wish I had seen this earlier. I already had a version of this downstream in >> CheriBSD as we have a CHERI-specific case of many phdrs. I had a sysctl/tunable to control >> how many pages of phdrs were allowed which defaulted to something like 4 pages worth but >> could be more easily adjusted than the hardcoded constant here. I will see if I can upstream >> the sysctl at least. > > A sysctl should be a no-brainer, I can add it. I did not see much value > in it being tunable, the current 128 value should be enough for everything? In the changes we have downstream both in LLD and CheriBSD, we support decomposing executables and libraries into multiple compartments which results in separate .text, .data, etc. for each compartment. This results in an arbitrary number of PT_LOADs (as well as additional phdrs CHERI uses such as a PT_CHERI_PCC that is somewhat akin to PT_GNU_RELRO in that it describes properties of a region of address space). So we can indeed construct binaries with many phdrs. -- John Baldwin From nobody Sat May 30 17:09:41 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 4gSRYf1pclz6gJtJ; Sat, 30 May 2026 17:10:14 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp052.goneo.de (smtp052.goneo.de [85.220.129.60]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4gSRYd6dhjz43sl; Sat, 30 May 2026 17:10:13 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; none Received: from hub2.goneo.de (hub2.goneo.de [IPv6:2001:1640:5::8:53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp5.goneo.de (Postfix) with ESMTPS id 8A27A24006B; Sat, 30 May 2026 19:10:11 +0200 (CEST) Received: from hub2.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPS id AF5C92400C0; Sat, 30 May 2026 19:10:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1780161009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mU3E0sqO6eqcimr6COU10RXMUsfQ9lq9vRBlN76jmRI=; b=stcVC1FFsbmqybCDZERVcaG0YIS93kJrTEfjtuht1FtRmbU7Irzj8AriIK3bR2XUDpgTki 7J3Y6H924dJ5nPXZRkLDebRgMr/aaS0hnNFAtvXfkuzp3eC1TtCsZVV9g+0FpUIDiIMWng sLwPkXkSgD98RT91AC3bRnygLTKuriJcx34HYwkPvcDD/oDuGBCBrRMgoy3D4WfvVOUDjF hiHKp2gjL+2jbMmFVGTKIM/VmM3CRSGVbltnYs2/RcJJlwXd67LzZya56Coe3dmXM5+qYq kU4tk+YhpLO/evTv62rVAtTuAYuRKFjwwzQezAR0VKMeYnfKPBit+WfRVy4W4Q== Received: from thor.sb211.local (dynamic-2a02-3100-2914-f002-f829-ceb9-7bc5-38a6.310.pool.telefonica.de [IPv6:2a02:3100:2914:f002:f829:ceb9:7bc5:38a6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPSA id 672EC2400A3; Sat, 30 May 2026 19:10:09 +0200 (CEST) Date: Sat, 30 May 2026 19:09:41 +0200 From: A FreeBSD User To: Ahmad Khalifa Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 2fa4bdd7f9e9 - main - edk2: enable static asserts for *INT64 alignment Message-ID: <20260530190827.15ba6ffa@thor.sb211.local> In-Reply-To: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> References: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; amd64-portbld-freebsd16.0) 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: multipart/signed; boundary="Sig_/r5c_p4JoWm=Ug=VaTk6XtMQ"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Rspamd-UID: e855a6 X-Rspamd-UID: c4fcf6 X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:25394, ipnet:85.220.128.0/17, country:DE] X-Rspamd-Queue-Id: 4gSRYd6dhjz43sl X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated --Sig_/r5c_p4JoWm=Ug=VaTk6XtMQ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Am Tage des Herren Sat, 30 May 2026 02:45:12 +0000 Ahmad Khalifa schrieb: > The branch main has been updated by vexeduxr: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D2fa4bdd7f9e99698a6652db405= c3165fdcd41c1d >=20 > commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d > Author: Ahmad Khalifa > AuthorDate: 2026-05-30 02:40:58 +0000 > Commit: Ahmad Khalifa > CommitDate: 2026-05-30 02:40:58 +0000 >=20 > edk2: enable static asserts for *INT64 alignment > =20 > The ia32 loader is now built with -malign-double, so these should pas= s. > =20 > Differential Revision: https://reviews.freebsd.org/D55386 > --- > sys/contrib/edk2/Include/Base.h | 2 -- > 1 file changed, 2 deletions(-) >=20 > diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/Include/B= ase.h > index 3ae798db8429..d3342c9a6ca2 100644 > --- a/sys/contrib/edk2/Include/Base.h > +++ b/sys/contrib/edk2/Include/Base.h > @@ -841,10 +841,8 @@ STATIC_ASSERT (ALIGNOF (INT16) =3D=3D sizeof (INT1= 6), "Alignment of INT16 > does not STATIC_ASSERT (ALIGNOF (UINT16) =3D=3D sizeof (UINT16), "Alignm= ent of UINT16 does not > meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF = (INT32) =3D=3D sizeof > (INT32), "Alignment of INT32 does not meet UEFI Specification Data Type r= equirements"); > STATIC_ASSERT (ALIGNOF (UINT32) =3D=3D sizeof (UINT32), "Alignment of UI= NT32 does not meet UEFI > Specification Data Type requirements"); -#ifndef _STANDALONE STATIC_ASSER= T (ALIGNOF (INT64) > =3D=3D sizeof (INT64), "Alignment of INT64 does not meet UEFI Specificat= ion Data Type > requirements"); STATIC_ASSERT (ALIGNOF (UINT64) =3D=3D sizeof (UINT64), = "Alignment of UINT64 > does not meet UEFI Specification Data Type requirements"); -#endif STATIC= _ASSERT (ALIGNOF > (CHAR8) =3D=3D sizeof (CHAR8), "Alignment of CHAR8 does not meet UEFI S= pecification Data Type > requirements"); STATIC_ASSERT (ALIGNOF (CHAR16) =3D=3D sizeof (CHAR16), = "Alignment of CHAR16 > does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT = (ALIGNOF (INTN) > =3D=3D sizeof (INTN), "Alignment of INTN does not meet UEFI Specification= Data Type > requirements"); >=20 The commit seems to disturb building process and gets rogue with: [...] In file included from /usr/src/sys/contrib/edk2/Include/Uefi/UefiBaseType.h= :16: /usr/src/sys/contrib/edk2/Include/Base.h:844:16: error: static assertion fa= iled due to requirement '_Alignof(long long) =3D=3D sizeof(long long)': Alignment of IN= T64 does not meet UEFI Specification Data Type requirements 844 | STATIC_ASSERT (ALIGNOF (INT64) = =3D=3D sizeof (INT64), "Alignment of INT64 does not meet UEFI Specification Data Type requirements= "); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/sys/contrib/edk2/Include/Base= .h:778:24: note: expanded from macro 'ALIGNOF' Regards oh --=20 A FreeBSD user --Sig_/r5c_p4JoWm=Ug=VaTk6XtMQ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRQheDybVktG5eW/1Kxzvs8OqokrwUCahsZ8AAKCRCxzvs8Oqok rz4hAP9yqU+prSppICEdHlll+zLvhuFrL93v14mzLqjgT4lurwD9HCvm9b366jFl CTSGA8bktKQNvGrBVNrIwaQd1Hu/iw0= =VMWX -----END PGP SIGNATURE----- --Sig_/r5c_p4JoWm=Ug=VaTk6XtMQ-- From nobody Sat May 30 17:42:57 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 4gSSJ81bp0z6gMX3; Sat, 30 May 2026 17:43:36 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp6.goneo.de (smtp6.goneo.de [85.220.129.31]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4gSSJ65NLvz47Pd; Sat, 30 May 2026 17:43:34 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=walstatt-de.de header.s=DKIM001 header.b=B5Fdo61m; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@walstatt-de.de designates 85.220.129.31 as permitted sender) smtp.mailfrom=freebsd@walstatt-de.de Received: from hub2.goneo.de (hub2.goneo.de [85.220.129.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp6.goneo.de (Postfix) with ESMTPS id 0E3E22401D3; Sat, 30 May 2026 19:43:33 +0200 (CEST) Received: from hub2.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPS id 2D7A3240282; Sat, 30 May 2026 19:43:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1780163011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=llrmIssZZALqfrsVAjiU2YmmhhPEHNpQPd74w6D8ZvQ=; b=B5Fdo61mr7h5rx84g7Yxtczbd2qnpJpXwFFiguGoV429KcgJyRS4oCbOH/CHEK71ypylLK R7WfsX0QFrV0Zsi7RQhMJy/JAc+eYYewDoy2f6iQprSSfq7LqR564IhLU+yslC5EKGANqf /KPGBxcc5o+OtjrC8j3cPFjhzJhIBP8QoObxv1XkwKryF6gb7XL1fFlF9oXKI29OXexg/1 E+AqmHhTdhwK2R31vLQLVk6B4ozKb5Mqz6Zt7sAzqbkiZv1edr1scMvdK+yzjGSMdCjkih ta53FwnS9AZKYiM+aUl/iD40UsKgAQ9QcSlF7+ET3a5Hs21Vib9pJWkhB9GaNg== Received: from thor.sb211.local (dynamic-2a02-3100-2914-f002-f829-ceb9-7bc5-38a6.310.pool.telefonica.de [IPv6:2a02:3100:2914:f002:f829:ceb9:7bc5:38a6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPSA id D30BE24026C; Sat, 30 May 2026 19:43:30 +0200 (CEST) Date: Sat, 30 May 2026 19:42:57 +0200 From: A FreeBSD User To: Ahmad Khalifa Cc: src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 2fa4bdd7f9e9 - main - edk2: enable static asserts for *INT64 alignment Message-ID: <20260530194324.288bac33@thor.sb211.local> In-Reply-To: <20260530190827.15ba6ffa@thor.sb211.local> References: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> <20260530190827.15ba6ffa@thor.sb211.local> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; amd64-portbld-freebsd16.0) 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: multipart/signed; boundary="Sig_/+wnf1+iJfbfRfGjifu4B=wN"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Rspamd-UID: 42d773 X-Rspamd-UID: 35224f X-Spamd-Result: default: False [-5.70 / 15.00]; SIGNED_PGP(-2.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; R_DKIM_ALLOW(-0.20)[walstatt-de.de:s=DKIM001]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_SPF_ALLOW(-0.20)[+ip4:85.220.129.0/25]; RCVD_IN_DNSWL_LOW(-0.10)[85.220.129.31:from]; ASN(0.00)[asn:25394, ipnet:85.220.128.0/17, country:DE]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[walstatt-de.de]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-main@FreeBSD.org]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[walstatt-de.de:+] X-Spamd-Bar: ----- X-Rspamd-Queue-Id: 4gSSJ65NLvz47Pd --Sig_/+wnf1+iJfbfRfGjifu4B=wN Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Am Tage des Herren Sat, 30 May 2026 19:09:41 +0200 A FreeBSD User schrieb: > Am Tage des Herren Sat, 30 May 2026 02:45:12 +0000 > Ahmad Khalifa schrieb: >=20 > > The branch main has been updated by vexeduxr: > >=20 > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D2fa4bdd7f9e99698a6652db4= 05c3165fdcd41c1d > >=20 > > commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d > > Author: Ahmad Khalifa > > AuthorDate: 2026-05-30 02:40:58 +0000 > > Commit: Ahmad Khalifa > > CommitDate: 2026-05-30 02:40:58 +0000 > >=20 > > edk2: enable static asserts for *INT64 alignment > > =20 > > The ia32 loader is now built with -malign-double, so these should p= ass. > > =20 > > Differential Revision: https://reviews.freebsd.org/D55386 > > --- > > sys/contrib/edk2/Include/Base.h | 2 -- > > 1 file changed, 2 deletions(-) > >=20 > > diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/Include= /Base.h > > index 3ae798db8429..d3342c9a6ca2 100644 > > --- a/sys/contrib/edk2/Include/Base.h > > +++ b/sys/contrib/edk2/Include/Base.h > > @@ -841,10 +841,8 @@ STATIC_ASSERT (ALIGNOF (INT16) =3D=3D sizeof (IN= T16), "Alignment of > > INT16 does not STATIC_ASSERT (ALIGNOF (UINT16) =3D=3D sizeof (UINT16),= "Alignment of UINT16 > > does not meet UEFI Specification Data Type requirements"); STATIC_ASSER= T (ALIGNOF (INT32) > > =3D=3D sizeof (INT32), "Alignment of INT32 does not meet UEFI Specific= ation Data Type > > requirements"); STATIC_ASSERT (ALIGNOF (UINT32) =3D=3D sizeof (UINT32)= , "Alignment of UINT32 > > does not meet UEFI Specification Data Type requirements"); -#ifndef _ST= ANDALONE > > STATIC_ASSERT (ALIGNOF (INT64) =3D=3D sizeof (INT64), "Alignment of INT= 64 does not meet UEFI > > Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (UINT64)= =3D=3D sizeof > > (UINT64), "Alignment of UINT64 does not meet UEFI Specification Data Ty= pe requirements"); > > -#endif STATIC_ASSERT (ALIGNOF (CHAR8) =3D=3D sizeof (CHAR8), "Alignm= ent of CHAR8 does not > > meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNO= F (CHAR16) =3D=3D > > sizeof (CHAR16), "Alignment of CHAR16 does not meet UEFI Specification = Data Type > > requirements"); STATIC_ASSERT (ALIGNOF (INTN) =3D=3D sizeof (INTN), "Al= ignment of INTN does > > not meet UEFI Specification Data Type requirements"); > > =20 >=20 > The commit seems to disturb building process and gets rogue with: > [...] > In file included from /usr/src/sys/contrib/edk2/Include/Uefi/UefiBaseType= .h:16: > /usr/src/sys/contrib/edk2/Include/Base.h:844:16: error: static assertion = failed due to > requirement '_Alignof(long long) =3D=3D sizeof(long long)': Alignment of = INT64 does not meet UEFI > Specification Data Type requirements 844 | STATIC_ASSERT (ALIGNOF (INT64)= =3D=3D sizeof > (INT64), "Alignment of INT64 does not meet UEFI Specification Data Type r= equirements"); | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/sys/contrib/edk2/Include/Ba= se.h:778:24: note: > expanded from macro 'ALIGNOF' >=20 >=20 > Regards > oh The commit seems to disturb building process and gets rogue with: [...] In file included from /usr/src/sys/contrib/edk2/Include/Uefi/UefiBaseType.h= :16: /usr/src/sys/contrib/edk2/Include/Base.h:844:16: error: static assertion fa= iled due to requirement '_Alignof(long long) =3D=3D sizeof(long long)': Alignment of IN= T64 does not meet UEFI Specification Data Type requirements 844 | STATIC_ASSERT (ALIGNOF (INT64) = =3D=3D sizeof (INT64), "Alignment of INT64 does not meet UEFI Specification Data Type requirements= "); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/sys/contrib/edk2/Include/Base= .h:778:24: note: expanded from macro 'ALIGNOF' Regards oh --=20 A FreeBSD user --Sig_/+wnf1+iJfbfRfGjifu4B=wN Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRQheDybVktG5eW/1Kxzvs8OqokrwUCahshvAAKCRCxzvs8Oqok r2pIAQCSJ3C3VKNjJe0B1qZc/QvQV45jSi1xU1Kf5MjkdIZNuQEAslSkqZymiwBh wGzbKHcWTF3mLnKdhRaDGWCKlMwC7QA= =2yMP -----END PGP SIGNATURE----- --Sig_/+wnf1+iJfbfRfGjifu4B=wN-- From nobody Sat May 30 19:08:03 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 4gSV9c167wz6gTx8 for ; Sat, 30 May 2026 19:08:04 +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 4gSV9c0F5wz4JG0 for ; Sat, 30 May 2026 19:08:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780168084; 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=6adetVfl8dccVVjtRmc+SCtDFuiHd29b0LNiagwh4Bc=; b=C4z8koBk0LqRqT/VhX/JxdOhsh2EPiJ7sfhPYUWAsirMdhA3muvpQmKeTLmfM8szHN/heK xClPLFDdOwvJuy3jXPaMYRSqNIt6Hno1LIOpl8CzvgmJogr5UAqV/BO6UQKYVgPNizx/qs Dq2Cv2RsR+D4pb95ZD/ejflTLBKmh0T9H4tgqvy9tp0o3qTv0GMRYPzTUjfgq3zXbLQ+FM KYTkJSK1pkSNl+nPQwQ/0DWouZkMC6Z9I1/Tq8Klo/tOH1ayQGdKkJQ3qYanNdaFwjjf9o IyD+ZCYoDjOBFdh548+kzsv+Z/BuxbAKCj7xAEoMyx3Eb03VpGO2lR6zdfERcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780168084; a=rsa-sha256; cv=none; b=tXw39nrtJS9EcqlYcAMMYR5EVsahIeUbl33GstfkmfzLebYHJFnsC8wbDxV4ZoDSGLrcOz aCsB8bHCKjMw6nOJrS07J252URIIYmjrV3C68MW+1yN6PQlscfezbS5ty6yrXjBWnAeVtn GjKaYL8hzCjfYxEgTJf7gINR+mIumQhiVpkOUBIoBIdAcbAYPd2/C702qTTfD6cjUeWyXR YiC9bimEqvdyCnrkdtMVXEI5uuPHiF+pyzZEFuEafZVKyJbniOrLmw3vdp12Cex9otiCEj ELWbH96VHzZ+pBuxiCvMRKV+q+BallxxB++GSLdqkZ4uLOz7E3e6lTICRb5D9A== 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=1780168084; 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=6adetVfl8dccVVjtRmc+SCtDFuiHd29b0LNiagwh4Bc=; b=Zc0EyV4CQJ40G9UqUYhd2lYJDGyN/aBuuHexWOB/vHIlv/AQb7SbJZLuqKsr3nUO/QGkI5 C6+dRHA5gceHlOKzTSF1guUQTCi26tBV7ZoK1J8HQYDfm7R7GaH2uHTOs5bR6Y0uGjKD9Y qd1rvbqbR0rB10dzXyvi3zTcOdYxzFz7Zd5sVtC7jSDoJUc+Be5ZSSwNV/EAE+K8rrCu9U JuSzehb3jkZYmRq8SiucfzOyf7F38Y0ZKMzcTFmnOvbUAIbiK3UEOjrv2TxD9JePLiZhpV FanOgWu1GArzbVd+wzI36kTGk0IHEPQGlmhV50px2qNcIm0QCy0zVPnE2ff44g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSV9b6xlqz1x3 for ; Sat, 30 May 2026 19:08:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 20d6b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 19:08:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aymeric Wibo Subject: git: eda74fe47993 - main - rand(3): Normalize function ordering 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: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eda74fe47993f1d62e7c110850def6960b55291e Auto-Submitted: auto-generated Date: Sat, 30 May 2026 19:08:03 +0000 Message-Id: <6a1b3593.20d6b.6743a859@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=eda74fe47993f1d62e7c110850def6960b55291e commit eda74fe47993f1d62e7c110850def6960b55291e Author: Aymeric Wibo AuthorDate: 2026-05-30 19:00:02 +0000 Commit: Aymeric Wibo CommitDate: 2026-05-30 19:07:29 +0000 rand(3): Normalize function ordering Align ordering between NAME & SYNOPSIS sections. Obtained from: https://github.com/apple-oss-distributions/libc Sponsored by: Klara, Inc. --- lib/libc/stdlib/rand.3 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libc/stdlib/rand.3 b/lib/libc/stdlib/rand.3 index 33eaa191b4fe..200e770b6daf 100644 --- a/lib/libc/stdlib/rand.3 +++ b/lib/libc/stdlib/rand.3 @@ -29,24 +29,24 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 1, 2020 +.Dd May 30, 2026 .Dt RAND 3 .Os .Sh NAME .Nm rand , -.Nm srand , -.Nm rand_r +.Nm rand_r , +.Nm srand .Nd bad random number generator .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In stdlib.h -.Ft void -.Fn srand "unsigned seed" .Ft int .Fn rand void .Ft int .Fn rand_r "unsigned *ctx" +.Ft void +.Fn srand "unsigned seed" .Sh DESCRIPTION .Bf -symbolic The functions described in this manual page are not cryptographically From nobody Sat May 30 19:53:05 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 4gSW9Y1fnkz6gYJ4 for ; Sat, 30 May 2026 19:53:05 +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 4gSW9Y0bLmz4My9 for ; Sat, 30 May 2026 19:53:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780170785; 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=DZqSzCTHV/Sf/8yK3UzJnG99+NscfwoddmpG1EuhBkc=; b=in7J2qeiM1nmsqVM3XKfYzopz38J5XtXj7BYrZLAcxBv8G3BU0J5wsHks6l9ANT3hUDIfT vjsfdiEXuW+GZB9UbaJEp1E0CWCStHd5BLMV/93q2wk0X8agc5+iWfCxi/g17UMpnuHMFz h5cmpmdTRHC5a6OLOT0znwLsbht9DhAIjKxDN9238VQrPuiTXKjnWSVY0mQomQ4GtQRF7t 4WSd00C5qIFr+RF5Nv2JSoOGKctRKNu0PDjXV69PQ/s9cYMKIACqpFBHiGudHg3omjlAsX YBkAkJoLOF1pctWVWtkwtuZa3SRkAn3El9wiST3bfTshAcZxLgs34mRy8pw+Wg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780170785; a=rsa-sha256; cv=none; b=Y19+Dn8CP00jeFYMsfKyG1IplNyzgXxQB0mYaNt4iQgFqQuAlIZIwp5sssfO5RnzmqQrRb WvEd8u8Nc6070oNkuNtYglKULEg6ANeJu/76oyeVtGpOCR0dhpKoDM2hR5pkodskcDZp7R lhNKBdgrU0H38m5hZewyre6mOAIRz2wbL+qq1+e2fJNdP7WelS2P1HggveyB8bQ5WAiiJj g30UlFNZQqVpsIN8WLP5j30AQNfEBzVrp/9eybps8i7ydPlaiI4xj0uZKr/tGAz8idlpiT WXpWoSvHxV9aJrq8hgA5gu+JOAzXr79Ax4g+uB2W68BFEHSyXXkxbxd5L3ZAiQ== 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=1780170785; 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=DZqSzCTHV/Sf/8yK3UzJnG99+NscfwoddmpG1EuhBkc=; b=u9nSKFkXiZkzlpA8zvoRJA9NnLpdgn2e3+zsjJQFijoadEndCKJmpIx9nawGMQqUZ5pQqe UTBoeMZWy9A0C9kmMUCEKNjE8Ns6hiyof4SYy15LgZohvnk1SEuTxqIf4aJAYLMHTWUcTi +J5P/4JuLfTSI69cPZ3Dk+4s5dt7WoK1Bqlbj5lbGg9nVbbHPIpnsBd10yyFYavvh4IKlR fh7eGINxvmGsF+SnPv9nXIvH5qW2fvvwii7UqcOAks8+uGgC7kAIeKauCOdxR3I0pTSgdQ vWIGgTiaphJu2j+9g6bRsKtfm1I8dqTwvM7O/GrtB3l+vZNrTia2L71iSXez0A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSW9Y07wjz3pv for ; Sat, 30 May 2026 19:53:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27e7b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 19:53:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pawel Biernacki Subject: git: a64148e21bb4 - main - linux: Add support for PR_SET_VMA to prctl(2) 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: kaktus X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a64148e21bb4ac976345cbedbd32942f97f07cc1 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 19:53:05 +0000 Message-Id: <6a1b4021.27e7b.46004f5e@gitrepo.freebsd.org> The branch main has been updated by kaktus: URL: https://cgit.FreeBSD.org/src/commit/?id=a64148e21bb4ac976345cbedbd32942f97f07cc1 commit a64148e21bb4ac976345cbedbd32942f97f07cc1 Author: Pawel Biernacki AuthorDate: 2026-05-30 12:15:21 +0000 Commit: Pawel Biernacki CommitDate: 2026-05-30 19:52:58 +0000 linux: Add support for PR_SET_VMA to prctl(2) Implement dummy support for PR_SET_VMA with PR_SET_VMA_ANON_NAME in prctl(2). This prevents applications from receiving EINVAL when attempting to name anonymous memory regions. --- sys/compat/linux/linux_misc.c | 7 +++++++ sys/compat/linux/linux_misc.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index f89758f41ba0..eafba4f4bd19 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1835,6 +1835,13 @@ linux_prctl(struct thread *td, struct linux_prctl_args *args) linux_msg(td, "unsupported prctl PR_SET_PTRACER"); error = EINVAL; break; + case LINUX_PR_SET_VMA: + if (args->arg2 != LINUX_PR_SET_VMA_ANON_NAME) { + linux_msg(td, "unsupported prctl PR_SET_VMA attr %ju", + (uintmax_t)args->arg2); + error = EINVAL; + } + break; default: linux_msg(td, "unsupported prctl option %d", args->option); error = EINVAL; diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index 2044f23f30ee..196f9372d4bf 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -62,6 +62,8 @@ #define LINUX_PR_SET_NO_NEW_PRIVS 38 /* Set no_new_privs attribute */ #define LINUX_PR_GET_NO_NEW_PRIVS 39 /* Get no_new_privs attribute */ #define LINUX_PR_SET_PTRACER 1499557217 +#define LINUX_PR_SET_VMA 1398164801 +#define LINUX_PR_SET_VMA_ANON_NAME 0 #define LINUX_MAX_COMM_LEN 16 /* Maximum length of the process name. */ From nobody Sat May 30 21:50:17 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 4gSYmp6D9Gz6gjTp for ; Sat, 30 May 2026 21:50:18 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gSYmp5V2fz3PVr for ; Sat, 30 May 2026 21:50:18 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780177818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=40ZmJJwjffpTZkUNCztvwIr0VirfUPVGRdgoN0oTeW4=; b=IMLt7d5vILM/JtPC69JcScWYqKpb1fMubT/qa6rCUWI7zaKKlZnziJKYNy4Xr+5Zm46LW6 fPD2ubqLm+yIfHQmI8hiZsl5c4brUGUVUNG6RfsRX19XgNRVqY6vAsNpcwD1DvPyQ+Doa7 ilGQ8spm7HtkMqnSdhbJk80Qb8ag1whbQj5wAWohks6mf5uiICtLn0p0SIiei1gRMQf/vP 3wxJmyZ3AHc6dy24e6CFSxWlI0qwRxVKlhrwXA4K0sRYbumkzyBPxYDjpo+8Mq1JDHL1NN kXdCdo2VVYujeqocIqsENx9qiUttMcbc8DJxV2II1n/u9BdjFCvtG3+pTa4wdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780177818; a=rsa-sha256; cv=none; b=w95EACslhtfFZOAOU0jZuefDBqivRK5Yw1CuKEyF21Q6YlRaJh3kpWN3XXUhGueMCetFA5 9/Rc4uK3WnGSitbR758grek5eoXytLkdoo56MRLEtW/hD7tJD7YfvpIMYnSHd0j/QcwFNq 3m/mieFhJp97Ds9fDfatMBZRHTAQfLmaWlQaWFTh+svnyOOstWcrBDR6C5RF2opEd/eXli SLNiKlT/Zh5zwyR1N72XQlfAR1fUhmfiN+A6eHKUmSMMdrxkgpdgMMbbaVuX/EPI/FRLLQ Ina6dyffdv5zJPEQcI7wmrbP46xQO/b7tCyNMoDFKjswvoYcXUfJ00WAVhLHpQ== 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=1780177818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=40ZmJJwjffpTZkUNCztvwIr0VirfUPVGRdgoN0oTeW4=; b=WZHpTB2Tj6w/hOADJ/+wQtZ3Q2cAwxp7TzUUCgu53qOz7N7O4mys8eQv+sZyHdnrQnawS4 AbRdl3J2QfmkU6dWTrdWPggwoQ8JxorOopfd+gQOYvVdk+Tcoczm0akHbyD1TOuy2T0lgb SaMpthfor24SpMHDhH1gnrsuYn4Dyrqb8z6P45XTA/nJv80CIlQpLJrRpHiswdfEJ6nBtS fwhdCog3JAtYPqDO8iySdFlB5wn/4SimMN5Je5IYnCW/wqhHguPquQPQjnTYfTXvwQkmY1 +7Q4t+MEiMFhosLSJ+zqSnGsXyzEn9av9LFX57e84Ae8SwHzVkPotYTeq4yNbA== Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) (Authenticated sender: vexeduxr) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gSYmp4r21zDrb for ; Sat, 30 May 2026 21:50:18 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-36d8b644473so237274a91.3 for ; Sat, 30 May 2026 14:50:18 -0700 (PDT) X-Forwarded-Encrypted: i=1; AFNElJ842/Zmx2NExByLmKhU5nURGDFdVrREPkVeyQqXm6QK4xPqunlfdTO7EVXMsa53EsTXBzS8Ox5lLrwShQqKTc94+rMadw==@freebsd.org X-Gm-Message-State: AOJu0Yy3NyX+zqUg+T0amjAVTMCIAlqdIFe9940Qo7TpUT5SNWHa0hOV 8YqsAK3la69bcv7somKI6FLxfHlHdupjNleS5zMxkLojmmRWV1tWILzDtW3PhnRpzkubxVzBswG EM2/YbldXpcRTg/QY1JZRW7db7E7nXqk= X-Received: by 2002:a17:90b:17ce:b0:366:52fe:e749 with SMTP id 98e67ed59e1d1-36c4ff0b9c0mr4276144a91.5.1780177817616; Sat, 30 May 2026 14:50:17 -0700 (PDT) Received: from 490177373942 named unknown by gmailapi.google.com with HTTPREST; Sat, 30 May 2026 14:50:17 -0700 Received: from 490177373942 named unknown by gmailapi.google.com with HTTPREST; Sat, 30 May 2026 14:50:17 -0700 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 From: Ahmad Khalifa X-Mailer: aerc 0.21.0 References: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> <20260530190827.15ba6ffa@thor.sb211.local> In-Reply-To: <20260530190827.15ba6ffa@thor.sb211.local> Date: Sat, 30 May 2026 14:50:17 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AVHnY4K7QjBGPXdMyYyUwBVy8-RgYCctfNzlQYm9f_VIURYX6wZTn0jWYUgKcxc Message-ID: Subject: Re: git: 2fa4bdd7f9e9 - main - edk2: enable static asserts for *INT64 alignment To: A FreeBSD User Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" On Sat May 30, 2026 at 8:09 PM +0300, A FreeBSD User wrote: > Am Tage des Herren Sat, 30 May 2026 02:45:12 +0000 > Ahmad Khalifa schrieb: > >> The branch main has been updated by vexeduxr: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=2fa4bdd7f9e99698a6652db405c3165fdcd41c1d >> >> commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d >> Author: Ahmad Khalifa >> AuthorDate: 2026-05-30 02:40:58 +0000 >> Commit: Ahmad Khalifa >> CommitDate: 2026-05-30 02:40:58 +0000 >> >> edk2: enable static asserts for *INT64 alignment >> >> The ia32 loader is now built with -malign-double, so these should pass. >> >> Differential Revision: https://reviews.freebsd.org/D55386 >> --- >> sys/contrib/edk2/Include/Base.h | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/Include/Base.h >> index 3ae798db8429..d3342c9a6ca2 100644 >> --- a/sys/contrib/edk2/Include/Base.h >> +++ b/sys/contrib/edk2/Include/Base.h >> @@ -841,10 +841,8 @@ STATIC_ASSERT (ALIGNOF (INT16) == sizeof (INT16), "Alignment of INT16 >> does not STATIC_ASSERT (ALIGNOF (UINT16) == sizeof (UINT16), "Alignment of UINT16 does not >> meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (INT32) == sizeof >> (INT32), "Alignment of INT32 does not meet UEFI Specification Data Type requirements"); >> STATIC_ASSERT (ALIGNOF (UINT32) == sizeof (UINT32), "Alignment of UINT32 does not meet UEFI >> Specification Data Type requirements"); -#ifndef _STANDALONE STATIC_ASSERT (ALIGNOF (INT64) >> == sizeof (INT64), "Alignment of INT64 does not meet UEFI Specification Data Type >> requirements"); STATIC_ASSERT (ALIGNOF (UINT64) == sizeof (UINT64), "Alignment of UINT64 >> does not meet UEFI Specification Data Type requirements"); -#endif STATIC_ASSERT (ALIGNOF >> (CHAR8) == sizeof (CHAR8), "Alignment of CHAR8 does not meet UEFI Specification Data Type >> requirements"); STATIC_ASSERT (ALIGNOF (CHAR16) == sizeof (CHAR16), "Alignment of CHAR16 >> does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (INTN) >> == sizeof (INTN), "Alignment of INTN does not meet UEFI Specification Data Type >> requirements"); >> > > The commit seems to disturb building process and gets rogue with: > [...] > In file included from /usr/src/sys/contrib/edk2/Include/Uefi/UefiBaseType.h:16: > /usr/src/sys/contrib/edk2/Include/Base.h:844:16: error: static assertion failed due to > requirement '_Alignof(long long) == sizeof(long long)': Alignment of INT64 does not meet UEFI > Specification Data Type requirements 844 | STATIC_ASSERT (ALIGNOF (INT64) == sizeof (INT64), > "Alignment of INT64 does not meet UEFI Specification Data Type requirements"); | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/sys/contrib/edk2/Include/Base.h:778:24: note: > expanded from macro 'ALIGNOF' I can't reproduce with the defaults, do you have any loader related build options changed? Also, can you tell which target this failed on? Thanks. > > > Regards > oh From nobody Sat May 30 22:54:12 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 4gSbC01V8hz6gpF7 for ; Sat, 30 May 2026 22:54:36 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gSbBy6pfNz3Vpy for ; Sat, 30 May 2026 22:54:29 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-91550dfc11fso21746385a.1 for ; Sat, 30 May 2026 15:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780181664; cv=none; d=google.com; s=arc-20240605; b=fIqFK/quabV2Bo3A2buIf8CZfQvMhb8K6we0yYaijyoP5cM0poR1fbFzdQD4cZT1W8 NJJ/dp+6f92NUhSBWA0EQePIs1NWlIF3KsIvjgbJ9OBlmAfSGsiaFlr7ya2862cpiFci iJ10BCIvsFxBiqEvTlT5ZwRWgD06DnquAm4B4eHyTOyDB1vq4JA2iSHH5eldU0pV/sBV yiTLLNpxBu2uBAUYscwzNhzFTlGvrxN0sl65vumKQoIaoj9kpx+osyyV4lz1mc5Ch9Wq GgWehaYo5zn67bIfyuiitnzZlPSZJ1GKNkF3wk4+pjp69n48072nyZ8JQguPnGpIlmqW r3xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hLJKFJi/rNiW/Y3/rzcScmqc46DDbiTAekoXf7l3PXc=; fh=QtySW3gFYiDSaQ5FlVxnHc89+Ng5s5fLit2SwwMGgZ8=; b=hAJTFnAu2fbyqTUQPj6FT7ZrEgudbxtHIzRKsgmabybcoW2BMhh+EKLa++FYtqkgo3 mXvYiP+q5QAP23yp2LHyOyWjSi8Ufz8UP8OaUp1smLc9A2Dp6pK8waOwU398Mpxz7x0r LrErTUwH1hiGPz42vm+j/vMQO308adGTjmlFIEdKACe6RXQcMp94J/4/gxbYU91yRBCy uNfWvx7q7TkzKQAzYwDk4MOcHseHtfJMw7kpO2AJSRnnJ47GQ4UwL+alXg17ufNVm/aW IwDRCrm4Kt6pOQcruHsaEBznEY/ghyDMHfggTwqv10AMChQ9kANIEengdoM61KLwtx+b MewQ==; darn=freebsd.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; t=1780181664; x=1780786464; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hLJKFJi/rNiW/Y3/rzcScmqc46DDbiTAekoXf7l3PXc=; b=fUoKDgqAWyfcCN7Wx8bUeJ037vp3HREdrhwsB8j9Es5Ot2EHG6RjSYF+3rFItHvOzG tSN3R8Y3TB6iU7DlleJ4ih7zQY2nYlZHJZbMAgd4OnmaToIUhuXXLLnCG3Z/EzK+9APo JuZWQH/LP56nlPn7TUT/up4QCsLoiIcJH2FZM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780181664; x=1780786464; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hLJKFJi/rNiW/Y3/rzcScmqc46DDbiTAekoXf7l3PXc=; b=V0eou1rm4W8HHZz00W9HAyBhyabdjfLGSieWVfe4ZJkwP9ZwCsG3LnPueeaGt22/zc SweCUtGrE7RuJfju+74xOsGv8nTYIF+dD1PBQyOGeprHc5pIoeyR1BzJw+uoiG1CMd/e oUqhScrifgMwIgOHJDv5a0OMEQfc0anPv992jsk3M/2KfXCDqojowOWDi+Gmlwj+VvZo tqaLz+m3hWoP/jcWdghzMqlOPR8kg7IFU/P/I8krJStY9RIbwykjsh36y/rKkxnjZ2nn llbqumcTQi9vv3gj9t0ymCSYOM2zeaSAPTd8XFbas4xGG4Ckz7V527mrWCF5/cOGPLC6 dlYA== X-Forwarded-Encrypted: i=1; AFNElJ9g8hFwtZEpxKkIjyNbk4HGeMZGHg5NvKn+EYb0Oe6/i0OrDmQWG4vcwjs7aOOpn5jS4dlhTJB+LYccP/N2k0AyAmJz+A==@freebsd.org X-Gm-Message-State: AOJu0Yy5G54fM2pefRW6L1nkFbt/TEa3sEveOwlQQwYnNljlRmVKqhwj nvUBkQBhVM+FVj3Hl6kx5ZeJVehltTDhBpHZ1fVlpOw6yCv47b+DJZ6Xo9LCEo0k+K1AUr7/yPk DCG0eIZiek8CXOgh91NZJAYwtS0CT2BtcoMJklkdERguJgUe7uSsZog== X-Gm-Gg: Acq92OG8IPk0v1MB35r9tE0UEcleohedxFRgfm5BFzclsWPsW742wE1pNl1RMPC7CYU nPQy4Bcuba19CLdDUj+xdMlZuugwDMvAVOiG/3He6OsR1YiYq2ko3ksebdcb3LS5PVzaMeJswp8 yk6ME4detrUzc/Ewi4nmT3CeJvHqa/9/ZvdpuBa/Leki4wEMDXFkh4BD49s5MzgZ8LGA7EYw0h+ Y6QyUCg9+0DzYawIOWsjrcBy1LV5UiJZpIJdZ69kA9CO9YkzZveS9Sxwa7WaylmoaUIS++e1C24 Y01IAoRSXjYw1sRd4/ziTRLdSZlVuABHkkrK4/oD94W85PEL3K32R6Ua3n5WGIXi5qC6NjTIjX+ yqyvu7G4Kypv6rmaO32/SIRKSnDPbg6AlRMVkE1TEahm/EqO2eX24kLgoY/nh X-Received: by 2002:a05:620a:480e:b0:915:3e26:f509 with SMTP id af79cd13be357-9153e26fba2mr818481585a.43.1780181664025; Sat, 30 May 2026 15:54:24 -0700 (PDT) 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 References: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> <20260530190827.15ba6ffa@thor.sb211.local> In-Reply-To: From: Kevin Bowling Date: Sat, 30 May 2026 15:54:12 -0700 X-Gm-Features: AVHnY4Jz0qnPXCr9h-_dX59bT5qu9NjsPCyYTBRqOOeOGpyEcNRfcn0Y7mu5cYk Message-ID: Subject: Re: git: 2fa4bdd7f9e9 - main - edk2: enable static asserts for *INT64 alignment To: Ahmad Khalifa Cc: A FreeBSD User , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4gSbBy6pfNz3Vpy X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Sat, May 30, 2026 at 2:50=E2=80=AFPM Ahmad Khalifa wrote: > > On Sat May 30, 2026 at 8:09 PM +0300, A FreeBSD User wrote: > > Am Tage des Herren Sat, 30 May 2026 02:45:12 +0000 > > Ahmad Khalifa schrieb: > > > >> The branch main has been updated by vexeduxr: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D2fa4bdd7f9e99698a6652db= 405c3165fdcd41c1d > >> > >> commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d > >> Author: Ahmad Khalifa > >> AuthorDate: 2026-05-30 02:40:58 +0000 > >> Commit: Ahmad Khalifa > >> CommitDate: 2026-05-30 02:40:58 +0000 > >> > >> edk2: enable static asserts for *INT64 alignment > >> > >> The ia32 loader is now built with -malign-double, so these should = pass. > >> > >> Differential Revision: https://reviews.freebsd.org/D55386 > >> --- > >> sys/contrib/edk2/Include/Base.h | 2 -- > >> 1 file changed, 2 deletions(-) > >> > >> diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/Includ= e/Base.h > >> index 3ae798db8429..d3342c9a6ca2 100644 > >> --- a/sys/contrib/edk2/Include/Base.h > >> +++ b/sys/contrib/edk2/Include/Base.h > >> @@ -841,10 +841,8 @@ STATIC_ASSERT (ALIGNOF (INT16) =3D=3D sizeof (I= NT16), "Alignment of INT16 > >> does not STATIC_ASSERT (ALIGNOF (UINT16) =3D=3D sizeof (UINT16), "Ali= gnment of UINT16 does not > >> meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGN= OF (INT32) =3D=3D sizeof > >> (INT32), "Alignment of INT32 does not meet UEFI Specification Data Typ= e requirements"); > >> STATIC_ASSERT (ALIGNOF (UINT32) =3D=3D sizeof (UINT32), "Alignment of= UINT32 does not meet UEFI > >> Specification Data Type requirements"); -#ifndef _STANDALONE STATIC_AS= SERT (ALIGNOF (INT64) > >> =3D=3D sizeof (INT64), "Alignment of INT64 does not meet UEFI Specifi= cation Data Type > >> requirements"); STATIC_ASSERT (ALIGNOF (UINT64) =3D=3D sizeof (UINT64= ), "Alignment of UINT64 > >> does not meet UEFI Specification Data Type requirements"); -#endif STA= TIC_ASSERT (ALIGNOF > >> (CHAR8) =3D=3D sizeof (CHAR8), "Alignment of CHAR8 does not meet UEF= I Specification Data Type > >> requirements"); STATIC_ASSERT (ALIGNOF (CHAR16) =3D=3D sizeof (CHAR16= ), "Alignment of CHAR16 > >> does not meet UEFI Specification Data Type requirements"); STATIC_ASSE= RT (ALIGNOF (INTN) > >> =3D=3D sizeof (INTN), "Alignment of INTN does not meet UEFI Specificat= ion Data Type > >> requirements"); > >> > > > > The commit seems to disturb building process and gets rogue with: > > [...] > > In file included from /usr/src/sys/contrib/edk2/Include/Uefi/UefiBaseTy= pe.h:16: > > /usr/src/sys/contrib/edk2/Include/Base.h:844:16: error: static assertio= n failed due to > > requirement '_Alignof(long long) =3D=3D sizeof(long long)': Alignment o= f INT64 does not meet UEFI > > Specification Data Type requirements 844 | STATIC_ASSERT (ALIGNOF (INT6= 4) =3D=3D sizeof (INT64), > > "Alignment of INT64 does not meet UEFI Specification Data Type requirem= ents"); | > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/sys/contrib/edk2/Include/= Base.h:778:24: note: > > expanded from macro 'ALIGNOF' > > I can't reproduce with the defaults, do you have any loader related > build options changed? Maybe a transient stale rebuild artifact, I was able to get through it with -j1 somehow. > Also, can you tell which target this failed on? > > Thanks. > > > > > > > Regards > > oh > From nobody Sat May 30 23:51:42 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 4gScSt23Vnz6gtXS for ; Sat, 30 May 2026 23:51:42 +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 4gScSt1G4pz3bH7 for ; Sat, 30 May 2026 23:51:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780185102; 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=tVAfq0pxMlUGbq03UmPVzUUbCWQH49Ax7JrXmKx3w60=; b=UWNjwKtVyxBSUx4FiVEMm0rhN+k0MEbxFCSuCHtswFzjC3jkyMt/pfLF3WyKrgG6ixByoB V7FSQomQzRms7vhAlrPVxJSxSmPL2wF8Ygf198mA7kAOydk5L2N6VUHjdcy9Su7tGG77kR NczG6wiwpMkXnMa81Xe4NGkqkNgvEkbPo462ccRV2OkFhdA5WNNwpEMzSzcOgsysOfVSsq 6PZny+goX4p9okdCllFv4i9NviQgIkv4tptHkk3ICw66nZVxGo0gmELQn2DUMrS8/IoSRI m9465oh9t2zmMP9Xu20vOYTzYFIeww1d0ASNuuAhRIGn3AqfoOX4LqwHt8dEMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780185102; a=rsa-sha256; cv=none; b=GoJ8KZMF7LgLmGPUlJZaAl05nPfO/IUUb4WVaPlpT3DABzCTCevSoxzkCwiDSeArH5MzKQ YsA6lVtVX1Qrz4CQiY6fGk80cxfPnh0hM33bJO9rboafedlf6VM/O60Z4a9Lf78rPw/8pi DnLP/yY/tsuz3XcMgtiPQKHbtMvjBH/kxhRILiALqM3Cz/d2bvAbIDSohI+Rs90AXXa78l s0tar7Ae5omCsVP/Pfys9B4YK+4XR6jy0sOU5Pg8QneVMRDwffwiBHhZklyQmNG2NQw0HA vw+y5uFhWPBYGyE96//8l+OWhkv340CKyhgEtgAor683L8Cg8D+tNayYy46nxQ== 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=1780185102; 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=tVAfq0pxMlUGbq03UmPVzUUbCWQH49Ax7JrXmKx3w60=; b=TNfYCWYfglf7ZH4I8wK89YuOlH6MUxpugJnFvuzl2QrIu5jx/JQykLFuE3r4go79pi9tew mgvQJPq2ZSA+6JKc7k4n0Kuby6v3L2/m9ipTGEVp+VBJkNjBgcH1b4hPepiHi5WyYvhvMd +gN//kW4Zk+fafEEKE6iNE42nt2x6cLQq4TiGLLyJ3kOBFpF52BpjFGLkBFbJh+PwpE3Fp 69m+Q48ra3aM77kRWikZ5Z0uISQSO9qzVgWUchdW/hnMIIHMBeL00xOG0CB8xvItgUe3yQ JwMHNDKxwUwVZCNfFp1MPLlrwABJ+PUYddGKqPbqteOjHFRvbqktjWTV5hlIGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gScSt0p9tzB0k for ; Sat, 30 May 2026 23:51:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 47379 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 23:51:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 49b413c4b070 - main - rtwn/usb: add ID for D-Link DWA-121 rev B1 to rtwn RTL8188EU 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 49b413c4b07016de4ee166779386f0f99b5aac6b Auto-Submitted: auto-generated Date: Sat, 30 May 2026 23:51:42 +0000 Message-Id: <6a1b780e.47379.116f8bd9@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=49b413c4b07016de4ee166779386f0f99b5aac6b commit 49b413c4b07016de4ee166779386f0f99b5aac6b Author: Bjoern A. Zeeb AuthorDate: 2026-05-30 21:29:09 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-05-30 21:29:09 +0000 rtwn/usb: add ID for D-Link DWA-121 rev B1 to rtwn RTL8188EU Add the device ID to the usbdevs table in order to be able to use it in the rtwn/usb driver for the RTL8188EU attachment. (I adjusted the name to B1 compared to the original submission) PR: 291839 MFC after: 3 days --- sys/dev/rtwn/usb/rtwn_usb_attach.h | 1 + sys/dev/usb/usbdevs | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/rtwn/usb/rtwn_usb_attach.h b/sys/dev/rtwn/usb/rtwn_usb_attach.h index cd5485b36678..ca12480c8f19 100644 --- a/sys/dev/rtwn/usb/rtwn_usb_attach.h +++ b/sys/dev/rtwn/usb/rtwn_usb_attach.h @@ -117,6 +117,7 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8188EU) } RTWN_RTL8188EU_DEV(ABOCOM, RTL8188EU), RTWN_RTL8188EU_DEV(ASUS, USBN10NANOB1), + RTWN_RTL8188EU_DEV(DLINK, DWA121B1), RTWN_RTL8188EU_DEV(DLINK, DWA123D1), RTWN_RTL8188EU_DEV(DLINK, DWA125D1), RTWN_RTL8188EU_DEV(EDIMAX, EW7811UN_V2), diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index a6a240d62186..7a9c7431f53d 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1792,6 +1792,7 @@ product DLINK DWA182C1 0x3315 DWA-182 rev C1 product DLINK DWA180A1 0x3316 DWA-180 rev A1 product DLINK DWA172A1 0x3318 DWA-172 rev A1 product DLINK DWA131E1 0x3319 DWA-131 rev E1 +product DLINK DWA121B1 0x331b DWA-121 rev B1 product DLINK DWA182D1 0x331c DWA-182 rev D1 product DLINK DWA181A1 0x331e DWA-181 rev A1 product DLINK DWL122 0x3700 DWL-122 From nobody Sat May 30 23:51:43 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 4gScSv3yRhz6gtZB for ; Sat, 30 May 2026 23:51:43 +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 4gScSv1mJdz3bfY for ; Sat, 30 May 2026 23:51:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780185103; 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=1WAVm9Ur5pRc8Y2fA4jaKmnMBbBgin0+2WQ32Ot5VEU=; b=U1D2kyEeIZ0G05o+RmAFunh2qjkfHxrtLXtjaXZEn8UiVnXy2PMYgqAi4gF/Tk0EONYp2v RDYrSkYwCOnxc7PSnM+A3cLcHIArrWLX59Nt1Jvi2DtEGWljPxZsYBgkz0+hSDKfmlFlhF hGZeo/tkW4j7rS3vN5EvYkFPUQ/lb56+BsbG3uXekQyJoYGhKksbF6dBjqVgzYu49kGCRZ jgbgJveC7vQGpmzPgi0Iu2+gZgw2lEVkAzZYNqfk+NrtWu1yPWRkthMdewyf5j9SDSjE+v +MvRlMQkMrTyc0JqUFzAD9XB7mECvWnv8noe64f6nZd4VHIHWKmm4d15YbhMNQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780185103; a=rsa-sha256; cv=none; b=jJPFYTlVI86HmkXFdLsFilog2scE17pNLMSEvC8an2oz5VynPZg9A6WwrkTHSNRrH2HZYY vPcACweLLikauXdGqV11OSsgC2O21Jjd8lzvNvrfcNrhSFJSfDMvoZBogGW7u9hW0L89QQ x2wUeXMmBeOhPpgxV2NYGq7XNnNoo2/rnQPuL8V5ENb1aMaH4XkcljCdmhfg9nyxl3Wdrv jSUt09ktUpcA6FBW11losEk8mevLHDdwsQ7W1TQlngOUi1UpurEl9ArS6/O438dmFJZdDn F2lIK0xxTa2eF980HlbVKduVNa8e0A1gdap+kink2HDe+xNCF1yEpqvbLJoxMA== 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=1780185103; 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=1WAVm9Ur5pRc8Y2fA4jaKmnMBbBgin0+2WQ32Ot5VEU=; b=ZARPY+KWma2SyV3x3p3EpgxzfjBhZVpz5fSsLx1WGYcJrH3knxTOObbjhaVAp4Lh1zwQAM aYYazADeyDvmCvmiqMNlP6T8WZK1DkJoCeQjsZRAQEGHzN8cSw94x1pisvFExB87uODHs1 Z5jrSGRidJW8eI51yTKFUrY6cLxFB4RhNSsZsWQUXmsueDbk1qoVoA5grP5lfVmx+rbzyn HUmSAq9BLLqnpcAd2Nlkpy2q4SMMoKKv1dQBvYN2Wiqmr20/B+4JqGfJI21CjZCL6PZKVJ 4dvlNZyokY/kybTJdTchag5DFwE8jEetc+95kw4gYyUOWH862/uc/6Q5/DTyGw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gScSv1McGzBGs for ; Sat, 30 May 2026 23:51:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18192 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 23:51:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: d07460f19483 - main - LinuxKPI: 802.11 suspend/resume: fix the is_pci_dev check 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d07460f194835410b6a0e99af6b9721b872fb009 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 23:51:43 +0000 Message-Id: <6a1b780f.18192.b58df6a@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d07460f194835410b6a0e99af6b9721b872fb009 commit d07460f194835410b6a0e99af6b9721b872fb009 Author: Bjoern A. Zeeb AuthorDate: 2026-05-30 21:33:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-05-30 21:33:51 +0000 LinuxKPI: 802.11 suspend/resume: fix the is_pci_dev check Shortly before I committed the works from a year ago, jhb added a function ("is_pci_device") so that the check against the devclass does not have to be coded in every driver. Use this instead in main (and stable/15 in case the works get MFCed). At the same time this fixes the check (the old one was wrong) as we attach to the LinuxKPI 802.11 driver, e.g., iwlwifi and thus we need to check the parent of the parent and not just the parent to be of the devclass "pci" in the identify bus function. The was the first error. The second was (and this is why it worked) that we checked for == instead of != and so the wrong check became true again. Discussed with: jhb Fixes: 11d69a4558de ("LinuxKPI: 802.11: add support for s/r") MFC after: 3 days X-MFC after: ffcf5e356644 ("pci: Add is_pci_device helper function") Sponsored by: The FreeBSD Foundation --- sys/compat/linuxkpi/common/src/linuxkpi_80211_pm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linuxkpi_80211_pm.c b/sys/compat/linuxkpi/common/src/linuxkpi_80211_pm.c index c69288bd5886..cf9384bf53f2 100644 --- a/sys/compat/linuxkpi/common/src/linuxkpi_80211_pm.c +++ b/sys/compat/linuxkpi/common/src/linuxkpi_80211_pm.c @@ -13,6 +13,7 @@ #include #include +#include #include "linux_80211.h" #include @@ -139,7 +140,7 @@ lkpi_80211_pm_identify(driver_t *driver, device_t parent) return; /* Make sure this is PCI for now. */ - if (device_get_devclass(parent) == devclass_find("pci")) + if (!is_pci_device(parent)) return; if (BUS_ADD_CHILD(parent, 0, driver->name, DEVICE_UNIT_ANY) == NULL) From nobody Sat May 30 23:51:44 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 4gScSw4WsKz6gtjl for ; Sat, 30 May 2026 23:51:44 +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 4gScSw2VdWz3bfb for ; Sat, 30 May 2026 23:51:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780185104; 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=26705TwZti5b7XMvmkwEEQMSQ3fl8Lyl03vpxP5zQ+o=; b=EaKjVt26EC9TFIKSu66jCevm5WVtGMWYP/NkPXJFKwjXrf7uaKHDpYuYiaJvGIz7P58Pg7 eTnqolxn0WlFEpGOgW63izUitmpaKkKcfVSkhXQKcG435V/vm4Tb0GVM1Jve5kK+ereeD/ oiyzdyZbk6DeqsHR4OYqM195qW8fVEhmAFyi2XZtkF5bKQMFJxamOZ9kDBEKiK+4m5+0U1 v/h37bALBedPYqogoOFQf9lc62ml5SMdkDy7L1Y/kB00esk298rLUoP0hmmc7htrBd5Dlh IamTDjrietADQ7CjEYHFgJS6Qp+Dxr1SCccJNlSL/WvT4KOhXDdJKU66V3/quA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780185104; a=rsa-sha256; cv=none; b=YxJ1i+/5TyZyucFAX6dgl387snEPRyxhQvTlpMZjljiWQZ5ipoBBUlWvYuhflnZ0Rj3TqR FZCiWOx/abTXztD88rgNYYsNbyKtNR+fUhmbNgX2tfsxETW7FwyHc1m2/M9FxrBoQ4lrMb 9ic4G7ozF8BbkJQihhvJhdREicHoWE6awDnAhbhEeyi2exVS8NwHUkL6zw1Og8ZXZja9ag he05CZEdthGe2+iAjbqryH9XEmle24PnDUsUDDSNJe8ErKLMH6ewA2vxoK4ul1qW9tsYcF Te9XkMYfn1e21OBYncowRC7AVx0kEHbZgwsozL4FGR+QjbC2qBaP4iUaNckUtQ== 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=1780185104; 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=26705TwZti5b7XMvmkwEEQMSQ3fl8Lyl03vpxP5zQ+o=; b=O2jvcAQJsT3bALvcza/s+mBBPdAZBe8eJkEABjqiMFMzmbYCkSrXEQ3w1U4LIkIupwgCsy JZLPbeleYH4E3qycVYCbhkCJ6rPf76m0+wRw2tc1Nqb7I4hDdmHM6dckjatWpbVVzlnfYl irhgs0Dg8OFXXd7pENKEcheSOWuUTOHpNYp0IC83dNxLhvnAc2qmfg3EpzaYcoUVsHptll PjEhdwUY6Qmn9HjSkEEKaBAvKToIQmWkPiBvymjDi7hzVIghXo43394TTgJgaUNY7KFkzr cCH2BaZDRcHaq2IxLUKQlU4A86VCu5zk8rVm9O9F2mYFYR034xMJllf17tjAcQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gScSw24YNzBDh for ; Sat, 30 May 2026 23:51:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1910b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 30 May 2026 23:51:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: b53eab322946 - main - LinuxKPi: idr: use macros for lock idr lock operations 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b53eab322946e88fb95ea4e143d1147d3de18d04 Auto-Submitted: auto-generated Date: Sat, 30 May 2026 23:51:44 +0000 Message-Id: <6a1b7810.1910b.37c17b6e@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b53eab322946e88fb95ea4e143d1147d3de18d04 commit b53eab322946e88fb95ea4e143d1147d3de18d04 Author: Bjoern A. Zeeb AuthorDate: 2026-02-17 03:06:19 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-05-30 21:45:47 +0000 LinuxKPi: idr: use macros for lock idr lock operations Our idr implementation is using a mtx lock which in the past has already caused problems (613723bac219c). In order to make it easier to tackle the problem start by factoring out all the operations related to the idr->lock into macros as we have often done in other parts of code as well. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: wulf, emaste Differential Revision: https://reviews.freebsd.org/D55392 --- sys/compat/linuxkpi/common/src/linux_idr.c | 67 +++++++++++++++++------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_idr.c b/sys/compat/linuxkpi/common/src/linux_idr.c index 664177835c85..7e5f0d28867e 100644 --- a/sys/compat/linuxkpi/common/src/linux_idr.c +++ b/sys/compat/linuxkpi/common/src/linux_idr.c @@ -62,6 +62,13 @@ DPCPU_DEFINE_STATIC(struct linux_idr_cache, linux_idr_cache); */ static MALLOC_DEFINE(M_IDR, "idr", "Linux IDR compat"); +#define IDR_LOCK_INIT(_idr) mtx_init(&(_idr)->lock, "idr", NULL, MTX_DEF); +#define IDR_LOCK_DESTROY(_idr) mtx_destroy(&(_idr)->lock); +#define IDR_LOCK(_idr) mtx_lock(&(_idr)->lock); +#define IDR_UNLOCK(_idr) mtx_unlock(&(_idr)->lock); +#define IDR_LOCK_ASSERT(_idr) mtx_assert(&(_idr)->lock, MA_OWNED); +#define IDR_LOCK_INITALIZED(_idr) mtx_initialized(&(_idr)->lock) + static struct idr_layer * idr_preload_dequeue_locked(struct linux_idr_cache *lic) { @@ -168,7 +175,7 @@ void idr_init(struct idr *idr) { bzero(idr, sizeof(*idr)); - mtx_init(&idr->lock, "idr", NULL, MTX_DEF); + IDR_LOCK_INIT(idr); } /* Only frees cached pages. */ @@ -182,17 +189,17 @@ idr_destroy(struct idr *idr) * without a idr_init(). Check if this is the case. If we do not do this * then the mutex will panic while asserting that it is valid. */ - if (mtx_initialized(&idr->lock) == 0) + if (IDR_LOCK_INITALIZED(idr) == 0) return; idr_remove_all(idr); - mtx_lock(&idr->lock); + IDR_LOCK(idr); for (il = idr->free; il != NULL; il = iln) { iln = il->ary[0]; free(il, M_IDR); } - mtx_unlock(&idr->lock); - mtx_destroy(&idr->lock); + IDR_UNLOCK(idr); + IDR_LOCK_DESTROY(idr); } static void @@ -215,11 +222,11 @@ void idr_remove_all(struct idr *idr) { - mtx_lock(&idr->lock); + IDR_LOCK(idr); idr_remove_layer(idr->top, idr->layers - 1); idr->top = NULL; idr->layers = 0; - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); } static void * @@ -266,9 +273,9 @@ idr_remove(struct idr *idr, int id) { void *res; - mtx_lock(&idr->lock); + IDR_LOCK(idr); res = idr_remove_locked(idr, id); - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); return (res); } @@ -298,7 +305,7 @@ idr_replace(struct idr *idr, void *ptr, int id) void *res; int idx; - mtx_lock(&idr->lock); + IDR_LOCK(idr); il = idr_find_layer_locked(idr, id); idx = id & IDR_MASK; @@ -309,7 +316,7 @@ idr_replace(struct idr *idr, void *ptr, int id) res = il->ary[idx]; il->ary[idx] = ptr; } - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); return (res); } @@ -319,7 +326,7 @@ idr_find_locked(struct idr *idr, int id) struct idr_layer *il; void *res; - mtx_assert(&idr->lock, MA_OWNED); + IDR_LOCK_ASSERT(idr); il = idr_find_layer_locked(idr, id); if (il != NULL) res = il->ary[id & IDR_MASK]; @@ -333,9 +340,9 @@ idr_find(struct idr *idr, int id) { void *res; - mtx_lock(&idr->lock); + IDR_LOCK(idr); res = idr_find_locked(idr, id); - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); return (res); } @@ -345,7 +352,7 @@ idr_get_next(struct idr *idr, int *nextidp) void *res = NULL; int id = *nextidp; - mtx_lock(&idr->lock); + IDR_LOCK(idr); for (; id <= idr_max(idr); id++) { res = idr_find_locked(idr, id); if (res == NULL) @@ -353,7 +360,7 @@ idr_get_next(struct idr *idr, int *nextidp) *nextidp = id; break; } - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); return (res); } @@ -364,12 +371,12 @@ idr_pre_get(struct idr *idr, gfp_t gfp_mask) struct idr_layer *head; int need; - mtx_lock(&idr->lock); + IDR_LOCK(idr); for (;;) { need = idr->layers + 1; for (il = idr->free; il != NULL; il = il->ary[0]) need--; - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); if (need <= 0) break; for (head = NULL; need; need--) { @@ -385,7 +392,7 @@ idr_pre_get(struct idr *idr, gfp_t gfp_mask) } if (head == NULL) return (0); - mtx_lock(&idr->lock); + IDR_LOCK(idr); il->ary[0] = idr->free; idr->free = head; } @@ -435,7 +442,7 @@ idr_get_new_locked(struct idr *idr, void *ptr, int *idp) int idx; int id; - mtx_assert(&idr->lock, MA_OWNED); + IDR_LOCK_ASSERT(idr); error = -EAGAIN; /* @@ -506,9 +513,9 @@ idr_get_new(struct idr *idr, void *ptr, int *idp) { int retval; - mtx_lock(&idr->lock); + IDR_LOCK(idr); retval = idr_get_new_locked(idr, ptr, idp); - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); return (retval); } @@ -522,7 +529,7 @@ idr_get_new_above_locked(struct idr *idr, void *ptr, int starting_id, int *idp) int idx, sidx; int id; - mtx_assert(&idr->lock, MA_OWNED); + IDR_LOCK_ASSERT(idr); error = -EAGAIN; /* @@ -624,9 +631,9 @@ idr_get_new_above(struct idr *idr, void *ptr, int starting_id, int *idp) { int retval; - mtx_lock(&idr->lock); + IDR_LOCK(idr); retval = idr_get_new_above_locked(idr, ptr, starting_id, idp); - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); return (retval); } @@ -643,7 +650,7 @@ idr_alloc_locked(struct idr *idr, void *ptr, int start, int end) int error; int id; - mtx_assert(&idr->lock, MA_OWNED); + IDR_LOCK_ASSERT(idr); if (unlikely(start < 0)) return (-EINVAL); @@ -669,9 +676,9 @@ idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp_mask) { int retval; - mtx_lock(&idr->lock); + IDR_LOCK(idr); retval = idr_alloc_locked(idr, ptr, start, end); - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); return (retval); } @@ -680,13 +687,13 @@ idr_alloc_cyclic(struct idr *idr, void *ptr, int start, int end, gfp_t gfp_mask) { int retval; - mtx_lock(&idr->lock); + IDR_LOCK(idr); retval = idr_alloc_locked(idr, ptr, max(start, idr->next_cyclic_id), end); if (unlikely(retval == -ENOSPC)) retval = idr_alloc_locked(idr, ptr, start, end); if (likely(retval >= 0)) idr->next_cyclic_id = retval + 1; - mtx_unlock(&idr->lock); + IDR_UNLOCK(idr); return (retval); } From nobody Sun May 31 00:11:38 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 4gScvw5L6Dz6gwPb for ; Sun, 31 May 2026 00:11:40 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gScvw4G84z3dyX for ; Sun, 31 May 2026 00:11:40 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780186300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m2W7CY8fK+tGExhZTwemvCjiydMfOmH/1bjK4Xi1X4c=; b=U3wmx64yMJ4AQN0/hN4qK3Jq4i7b9CNRmptugIbNkDTKMTHiM1UCjQBILAkRbYAY3D3ZLC piW3v2tVfMNlMJ49trofg0I14z450vepKsaPFMSUZDwmuHZscaWfhGI+Ed2tO/B3Dtv9AD shIVASiZKnvNL8uh4Di8CrPbg5EdhH9YYwWW+T/3PYvghhDor+bi2Pxg9Kx5LflzslMhzN 2RkufrW6JqjwQn+nJPbCC2mYI0Eu6hdcsExYhqUdRti8gDnfUK5cv/5JysU/UeiifENc2N OcX1/4R6gvFT82Ir2mduFlX3shy5mpGB9TT/iFzJ5ES0IxgSEqedFgZWIzxgIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780186300; a=rsa-sha256; cv=none; b=UbWkKFNkFtHhKUys124ym4tZ7ljH7FkAjV1jVt0bOamQycLRsSgOZe6IO0lKP34BCjp6JV OYO7I0MMchqOqEFrJGERHOqaWpVIXh5WyTbjUsVUXPeiGnNHdbVYXjUgoiPZoR/eWPtk1u PkL2WhB2ZU8OuHCxdxp7jOGwpvoVnspBAfZJbfxrfXdfxPHKsXKNDKWf03h90qCMHiv0wx GXUep+O/WGCdJIanApVtY3DmSV09zmu5KzGzzFQv9CVq6y8gIL5OCa3FzWzIN5iQGj1xHh o/m82zw7dD9V/sVNtODgktB93yZ81gercwGb9mSm0cHPy6ggZykZ/HLtDSaitg== 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=1780186300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m2W7CY8fK+tGExhZTwemvCjiydMfOmH/1bjK4Xi1X4c=; b=aSysqbFwAGJo8BysEuGTclm0vIWd4uwWEvaEZJvgOVQjq4I2J3mqqOCnD1D3m9pl8fu1Gq 25urnuq4uoJ14OAzhRJeUEnXHkzUn+z8wLTtNJm46JXIE+DyNgsxHdac/3N2u/1HplmbQ0 ugwZzVgf9XoxUlZ0pe75MWyPRLoZNtzKSdDEcw9FiKPWuYXGA1XE28gxW7pYqUIrwHc4tV acH5h4tMBavQ7c7kPZK0T+Gg9UR1vLef5f0FBHz+7F3coZpA19bn7td0VeMafVRrey2hi3 giceMO6uGNeTrM3iVZSPt+D+/LyBH9qzJt9TjL8VXHNSar7su++5By89jKaldw== Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) (Authenticated sender: vexeduxr) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gScvw3GCszFwP for ; Sun, 31 May 2026 00:11:40 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-36d98b9aa9aso152811a91.3 for ; Sat, 30 May 2026 17:11:40 -0700 (PDT) X-Forwarded-Encrypted: i=1; AFNElJ9s9WuW3DGbM2Qe8qigeDCopT4jWq5r5urwPfjGbXgYlC4oVJSi1qruS/LcgvSUzEORGoSt9s5shAgbTg++7cmVeEWbfg==@freebsd.org X-Gm-Message-State: AOJu0Yy5KOD57FGsPalZVK9N+tzuE8ulXFqgO4lcSL7PyL9opltZuV4d Q0mqEHxr20QPfcY7q5oMEJwc4Lg8AJ7W9ATF/LE3VOjmvBng6I6LQwMsYrE5Y4krO8XsC/ICJhu sGH/AyKHYMqIWtkl7EROMdWA8Dpjsz68= X-Received: by 2002:a17:90b:3e8c:b0:36a:f623:83a4 with SMTP id 98e67ed59e1d1-36c684afc9fmr5278768a91.26.1780186299344; Sat, 30 May 2026 17:11:39 -0700 (PDT) Received: from 490177373942 named unknown by gmailapi.google.com with HTTPREST; Sat, 30 May 2026 17:11:38 -0700 Received: from 490177373942 named unknown by gmailapi.google.com with HTTPREST; Sat, 30 May 2026 17:11:38 -0700 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 From: Ahmad Khalifa X-Mailer: aerc 0.21.0 References: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> <20260530190827.15ba6ffa@thor.sb211.local> In-Reply-To: Date: Sat, 30 May 2026 17:11:38 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AVHnY4I-oK1lzNo4xfsnm40QuavvCzCUHrnUWUJhYdWHvqMXxC_zaTL5rhpq5IU Message-ID: Subject: Re: git: 2fa4bdd7f9e9 - main - edk2: enable static asserts for *INT64 alignment To: Kevin Bowling Cc: A FreeBSD User , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun May 31, 2026 at 1:54 AM +0300, Kevin Bowling wrote: > On Sat, May 30, 2026 at 2:50=E2=80=AFPM Ahmad Khalifa wrote: >> >> On Sat May 30, 2026 at 8:09 PM +0300, A FreeBSD User wrote: >> > Am Tage des Herren Sat, 30 May 2026 02:45:12 +0000 >> > Ahmad Khalifa schrieb: >> > >> >> The branch main has been updated by vexeduxr: >> >> >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D2fa4bdd7f9e99698a6652d= b405c3165fdcd41c1d >> >> >> >> commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d >> >> Author: Ahmad Khalifa >> >> AuthorDate: 2026-05-30 02:40:58 +0000 >> >> Commit: Ahmad Khalifa >> >> CommitDate: 2026-05-30 02:40:58 +0000 >> >> >> >> edk2: enable static asserts for *INT64 alignment >> >> >> >> The ia32 loader is now built with -malign-double, so these should= pass. >> >> >> >> Differential Revision: https://reviews.freebsd.org/D55386 >> >> --- >> >> sys/contrib/edk2/Include/Base.h | 2 -- >> >> 1 file changed, 2 deletions(-) >> >> >> >> diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/Inclu= de/Base.h >> >> index 3ae798db8429..d3342c9a6ca2 100644 >> >> --- a/sys/contrib/edk2/Include/Base.h >> >> +++ b/sys/contrib/edk2/Include/Base.h >> >> @@ -841,10 +841,8 @@ STATIC_ASSERT (ALIGNOF (INT16) =3D=3D sizeof (= INT16), "Alignment of INT16 >> >> does not STATIC_ASSERT (ALIGNOF (UINT16) =3D=3D sizeof (UINT16), "Al= ignment of UINT16 does not >> >> meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIG= NOF (INT32) =3D=3D sizeof >> >> (INT32), "Alignment of INT32 does not meet UEFI Specification Data Ty= pe requirements"); >> >> STATIC_ASSERT (ALIGNOF (UINT32) =3D=3D sizeof (UINT32), "Alignment o= f UINT32 does not meet UEFI >> >> Specification Data Type requirements"); -#ifndef _STANDALONE STATIC_A= SSERT (ALIGNOF (INT64) >> >> =3D=3D sizeof (INT64), "Alignment of INT64 does not meet UEFI Specif= ication Data Type >> >> requirements"); STATIC_ASSERT (ALIGNOF (UINT64) =3D=3D sizeof (UINT6= 4), "Alignment of UINT64 >> >> does not meet UEFI Specification Data Type requirements"); -#endif ST= ATIC_ASSERT (ALIGNOF >> >> (CHAR8) =3D=3D sizeof (CHAR8), "Alignment of CHAR8 does not meet UE= FI Specification Data Type >> >> requirements"); STATIC_ASSERT (ALIGNOF (CHAR16) =3D=3D sizeof (CHAR1= 6), "Alignment of CHAR16 >> >> does not meet UEFI Specification Data Type requirements"); STATIC_ASS= ERT (ALIGNOF (INTN) >> >> =3D=3D sizeof (INTN), "Alignment of INTN does not meet UEFI Specifica= tion Data Type >> >> requirements"); >> >> >> > >> > The commit seems to disturb building process and gets rogue with: >> > [...] >> > In file included from /usr/src/sys/contrib/edk2/Include/Uefi/UefiBaseT= ype.h:16: >> > /usr/src/sys/contrib/edk2/Include/Base.h:844:16: error: static asserti= on failed due to >> > requirement '_Alignof(long long) =3D=3D sizeof(long long)': Alignment = of INT64 does not meet UEFI >> > Specification Data Type requirements 844 | STATIC_ASSERT (ALIGNOF (INT= 64) =3D=3D sizeof (INT64), >> > "Alignment of INT64 does not meet UEFI Specification Data Type require= ments"); | >> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/sys/contrib/edk2/Include= /Base.h:778:24: note: >> > expanded from macro 'ALIGNOF' >> >> I can't reproduce with the defaults, do you have any loader related >> build options changed? > > Maybe a transient stale rebuild artifact, I was able to get through it > with -j1 somehow. Hmm, after building this a few times I do run into a race condition where the interpreter isn't done building before loader_ia32.efi. Is that what you ran into? Looks like the SUBDIR entries need to be re-ordered, that's a different issue from the one above though. > >> Also, can you tell which target this failed on? >> >> Thanks. >> >> > >> > >> > Regards >> > oh >> From nobody Sun May 31 00:56:35 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 4gSdvr5gk5z6h0jp; Sun, 31 May 2026 00:56:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gSdvr4xJ5z3l0g; Sun, 31 May 2026 00:56:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780189000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gLdHDOjn01qz0r/RV3Q0wrdWoOYIomKbOTfMXtDZrI8=; b=ZwNyxA8/vaGgpX0NTaU4FScYZ7xbCRioYZ4JencHIKVYGnLP5/wJqBeMGFQqf35mIrYa9A wpBOhHPELquKowpyPLMKqBhhzp1OCXeXBhpG+nCOLuba5UhC0bkTP+EIGRIzMTfu0qIeVh qUmzPDZTXs0cPpt9bscsUA7j9B3bbIx4KpLUHgzKn37ocqHmO0cHc6FH4uZM75TbibMZJ5 pzrIE7E1WH/dN4936wazs7l2PKYx1RE407GAkqM+M0y5PLs97IkublghBtj4Y8dWuqiSPq Kh33E3fF4c4csYIyVQLoa8uLZKAv8EsLUNzxuOxWuoHtKfzcuO4+jHW1qf4YKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780189000; a=rsa-sha256; cv=none; b=PUlFwq+KgDo5eL3ND9dIr2OfgJpJ6y48CRzlSTg+no6BONIA+1v0ml9mMvCP4SuWeqNQwf f2TrTe5Be28Pg6HNnZM1/cTpqhJX0/4QsxXbnXHOB4oMxERo0VFjtWqkK4vHQ5MdNdgJCL CDvw4MwSL0T825zGdUUnKBJbkFDbHaQdplx97dzEMUkCLrX3RZIo97q914TtMhHvRC4sny FpRVUNOutM2Cw1qE18gI+RxBivPwlEg2g0QP0OE8V6zz/nFLkIHUaUcy5KvbAj/dvRXhJM Bfj41Q61uua0dP00Ero2laG903oqgGW93T2ijdI/1eF6j9/jsSXC6dmDGMXc+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=1780189000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gLdHDOjn01qz0r/RV3Q0wrdWoOYIomKbOTfMXtDZrI8=; b=kv2WF0tga2PCH3GyvByuRMUsW96Zr5vJUEcDN/NB0Bj7GHLYpDhvGs/7U5Zh1Jvn5ejv/u PXK75AbQ+bXyyB8qZfs2eJj0nX1C+GcGcKzsWjRVqYptC1ixUdQ+Z9kpS7ZBCnTWWuyUSO 7Kavr7kYtqkb24gg73XN+kydfODZEB+H48Rjf5NBIgJyPyKNPMwd9+eJakfxOKrVoEqjik 8iU+u8wF8j8mRlyYOP+7aVycRQs0XEEvhLVY/H40s26nj15FB2NmRKnjTctLjmAtCmp6Jq cjIVUIeHesjpQWV77iuUhsqdtcvjBdxYMF2xxFOmyU7EQ1k+6gKcJX5jdHIraQ== Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (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 ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E7" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gSdvr3Rn7zJ08; Sun, 31 May 2026 00:56:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 49149A64805; Sun, 31 May 2026 00:56:11 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (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 mail.sbone.de (Postfix) with ESMTPS id 6ADFE2D029E9; Sun, 31 May 2026 00:56:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id FWr9G-Nn7N4X; Sun, 31 May 2026 00:56:35 +0000 (UTC) Received: from nv.t4-02.sbone.de (nv.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:22]) (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 mail.sbone.de (Postfix) with ESMTPSA id 51FA72D029D8; Sun, 31 May 2026 00:56:35 +0000 (UTC) Date: Sun, 31 May 2026 00:56:35 +0000 (UTC) From: "Bjoern A. Zeeb" To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 49b413c4b070 - main - rtwn/usb: add ID for D-Link DWA-121 rev B1 to rtwn RTL8188EU In-Reply-To: <6a1b780e.47379.116f8bd9@gitrepo.freebsd.org> Message-ID: <3qqoqnor-pn17-4582-545r-p7239s8oo2qr@mnoonqbm.arg> References: <6a1b780e.47379.116f8bd9@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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=US-ASCII; format=flowed On Sat, 30 May 2026, Bjoern A. Zeeb wrote: I am sorry, I lost the Author somehwere. Submitted by: (ofthecentury gmail.com) according to the PR. > The branch main has been updated by bz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=49b413c4b07016de4ee166779386f0f99b5aac6b > > commit 49b413c4b07016de4ee166779386f0f99b5aac6b > Author: Bjoern A. Zeeb > AuthorDate: 2026-05-30 21:29:09 +0000 > Commit: Bjoern A. Zeeb > CommitDate: 2026-05-30 21:29:09 +0000 > > rtwn/usb: add ID for D-Link DWA-121 rev B1 to rtwn RTL8188EU > > Add the device ID to the usbdevs table in order to be able to use > it in the rtwn/usb driver for the RTL8188EU attachment. > > (I adjusted the name to B1 compared to the original submission) > > PR: 291839 > MFC after: 3 days > --- > sys/dev/rtwn/usb/rtwn_usb_attach.h | 1 + > sys/dev/usb/usbdevs | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/sys/dev/rtwn/usb/rtwn_usb_attach.h b/sys/dev/rtwn/usb/rtwn_usb_attach.h > index cd5485b36678..ca12480c8f19 100644 > --- a/sys/dev/rtwn/usb/rtwn_usb_attach.h > +++ b/sys/dev/rtwn/usb/rtwn_usb_attach.h > @@ -117,6 +117,7 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { > { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8188EU) } > RTWN_RTL8188EU_DEV(ABOCOM, RTL8188EU), > RTWN_RTL8188EU_DEV(ASUS, USBN10NANOB1), > + RTWN_RTL8188EU_DEV(DLINK, DWA121B1), > RTWN_RTL8188EU_DEV(DLINK, DWA123D1), > RTWN_RTL8188EU_DEV(DLINK, DWA125D1), > RTWN_RTL8188EU_DEV(EDIMAX, EW7811UN_V2), > diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs > index a6a240d62186..7a9c7431f53d 100644 > --- a/sys/dev/usb/usbdevs > +++ b/sys/dev/usb/usbdevs > @@ -1792,6 +1792,7 @@ product DLINK DWA182C1 0x3315 DWA-182 rev C1 > product DLINK DWA180A1 0x3316 DWA-180 rev A1 > product DLINK DWA172A1 0x3318 DWA-172 rev A1 > product DLINK DWA131E1 0x3319 DWA-131 rev E1 > +product DLINK DWA121B1 0x331b DWA-121 rev B1 > product DLINK DWA182D1 0x331c DWA-182 rev D1 > product DLINK DWA181A1 0x331e DWA-181 rev A1 > product DLINK DWL122 0x3700 DWL-122 > > -- Bjoern A. Zeeb r15:7 From nobody Sun May 31 10:01:04 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 4gSt121lGHz6gQHr; Sun, 31 May 2026 10:01:58 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp052.goneo.de (smtp052.goneo.de [85.220.129.60]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4gSt114tSRz3ksQ; Sun, 31 May 2026 10:01:57 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; none Received: from hub2.goneo.de (hub2.goneo.de [IPv6:2001:1640:5::8:53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp5.goneo.de (Postfix) with ESMTPS id 2792A24070B; Sun, 31 May 2026 12:01:55 +0200 (CEST) Received: from hub2.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPS id 508DB2402FE; Sun, 31 May 2026 12:01:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1780221713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O1sWVLvjiocMmHT6ZhI/Lm0gakC69dUV53GADEB53Wo=; b=nbtP9S4kCQDHUsah8bjZWSARyhgnrHK6OBU8DdIA6Uj6q8wb8ryr7ivt0/pFuHGNlN0NdP yy8zteYPhQ2eWZ46rQDOPkB0E4WPPlsTNleQGF1Q+k3Eu3/+C4x0n+yRVeZynsX/Ldx7mQ kM9ucWuuu1ZiNg+0Xw5FX3GpaD+ffJivMQk9gLNPM/FWwz42D2bjJUCj/7shBFzMrZeJGH SkowEh/mVTTtc48CMmlDbfiQTXELz9xEdVckz77AmFwWBWWvIjeUJ7f0VCi9hvEoNLb5in BsfdmeMpM7mgq7+E6xOg5wajBmBCXeK/wRltWclwk9DMD//aZTYpJOUL/efpbg== Received: from thor.sb211.local (dynamic-2a02-3100-2853-b702-262e-ef0e-9cec-3228.310.pool.telefonica.de [IPv6:2a02:3100:2853:b702:262e:ef0e:9cec:3228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPSA id C0858240270; Sun, 31 May 2026 12:01:52 +0200 (CEST) Date: Sun, 31 May 2026 12:01:04 +0200 From: A FreeBSD User To: Ahmad Khalifa Cc: Kevin Bowling , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 2fa4bdd7f9e9 - main - edk2: enable static asserts for *INT64 alignment Message-ID: <20260531120131.387a9bb8@thor.sb211.local> In-Reply-To: References: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> <20260530190827.15ba6ffa@thor.sb211.local> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; amd64-portbld-freebsd16.0) 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: multipart/signed; boundary="Sig_/.qitOwY9QtA6_x.HT94VhD5"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Rspamd-UID: 9c41ab X-Rspamd-UID: b9f2a2 X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:25394, ipnet:85.220.128.0/17, country:DE] X-Rspamd-Queue-Id: 4gSt114tSRz3ksQ X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated --Sig_/.qitOwY9QtA6_x.HT94VhD5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Tage des Herren Sat, 30 May 2026 17:11:38 -0700 Ahmad Khalifa schrieb: > On Sun May 31, 2026 at 1:54 AM +0300, Kevin Bowling wrote: > > On Sat, May 30, 2026 at 2:50=E2=80=AFPM Ahmad Khalifa wrote: =20 > >> > >> On Sat May 30, 2026 at 8:09 PM +0300, A FreeBSD User wrote: =20 > >> > Am Tage des Herren Sat, 30 May 2026 02:45:12 +0000 > >> > Ahmad Khalifa schrieb: > >> > =20 > >> >> The branch main has been updated by vexeduxr: > >> >> > >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D2fa4bdd7f9e99698a665= 2db405c3165fdcd41c1d > >> >> > >> >> commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d > >> >> Author: Ahmad Khalifa > >> >> AuthorDate: 2026-05-30 02:40:58 +0000 > >> >> Commit: Ahmad Khalifa > >> >> CommitDate: 2026-05-30 02:40:58 +0000 > >> >> > >> >> edk2: enable static asserts for *INT64 alignment > >> >> > >> >> The ia32 loader is now built with -malign-double, so these shou= ld pass. > >> >> > >> >> Differential Revision: https://reviews.freebsd.org/D55386 > >> >> --- > >> >> sys/contrib/edk2/Include/Base.h | 2 -- > >> >> 1 file changed, 2 deletions(-) > >> >> > >> >> diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/Inc= lude/Base.h > >> >> index 3ae798db8429..d3342c9a6ca2 100644 > >> >> --- a/sys/contrib/edk2/Include/Base.h > >> >> +++ b/sys/contrib/edk2/Include/Base.h > >> >> @@ -841,10 +841,8 @@ STATIC_ASSERT (ALIGNOF (INT16) =3D=3D sizeof= (INT16), "Alignment of > >> >> INT16 does not STATIC_ASSERT (ALIGNOF (UINT16) =3D=3D sizeof (UINT= 16), "Alignment of > >> >> UINT16 does not meet UEFI Specification Data Type requirements"); S= TATIC_ASSERT > >> >> (ALIGNOF (INT32) =3D=3D sizeof (INT32), "Alignment of INT32 does = not meet UEFI > >> >> Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (UIN= T32) =3D=3D sizeof > >> >> (UINT32), "Alignment of UINT32 does not meet UEFI Specification Dat= a Type > >> >> requirements"); -#ifndef _STANDALONE STATIC_ASSERT (ALIGNOF (INT64)= =3D=3D sizeof (INT64), > >> >> "Alignment of INT64 does not meet UEFI Specification Data Type requ= irements"); > >> >> STATIC_ASSERT (ALIGNOF (UINT64) =3D=3D sizeof (UINT64), "Alignment= of UINT64 does not > >> >> meet UEFI Specification Data Type requirements"); -#endif STATIC_AS= SERT (ALIGNOF > >> >> (CHAR8) =3D=3D sizeof (CHAR8), "Alignment of CHAR8 does not meet = UEFI Specification Data > >> >> Type requirements"); STATIC_ASSERT (ALIGNOF (CHAR16) =3D=3D sizeof= (CHAR16), "Alignment > >> >> of CHAR16 does not meet UEFI Specification Data Type requirements")= ; STATIC_ASSERT > >> >> (ALIGNOF (INTN) =3D=3D sizeof (INTN), "Alignment of INTN does not m= eet UEFI Specification > >> >> Data Type requirements");=20 > >> > > >> > The commit seems to disturb building process and gets rogue with: > >> > [...] > >> > In file included from /usr/src/sys/contrib/edk2/Include/Uefi/UefiBas= eType.h:16: > >> > /usr/src/sys/contrib/edk2/Include/Base.h:844:16: error: static asser= tion failed due to > >> > requirement '_Alignof(long long) =3D=3D sizeof(long long)': Alignmen= t of INT64 does not > >> > meet UEFI Specification Data Type requirements 844 | STATIC_ASSERT (= ALIGNOF (INT64) > >> > =3D=3D sizeof (INT64), "Alignment of INT64 does not meet UEFI Specif= ication Data Type > >> > requirements"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> > /usr/src/sys/contrib/edk2/Include/Base.h:778:24: note: expanded from= macro 'ALIGNOF' =20 > >> > >> I can't reproduce with the defaults, do you have any loader related > >> build options changed? =20 > > > > Maybe a transient stale rebuild artifact, I was able to get through it > > with -j1 somehow. =20 >=20 > Hmm, after building this a few times I do run into a race condition > where the interpreter isn't done building before loader_ia32.efi. Is > that what you ran into? >=20 > Looks like the SUBDIR entries need to be re-ordered, that's a different > issue from the one above though. >=20 > > =20 > >> Also, can you tell which target this failed on? > >> > >> Thanks. > >> =20 > >> > > >> > > >> > Regards > >> > oh =20 > >> =20 >=20 Architecture is amd64. Most prominent changes/options in /etc/src.conf amongst non-debug flags are= in my case: WITH_BEARSSL=3D YES WITHOUT_LOADER_PXEBOOT=3D YES LOADERSIZE?=3D 555000 WITH_BHYVE_SNAPSHOT=3D YES I had to mess with the loadersize in the past since loader didn't build any= more due to some bytes of space missing ... --=20 A FreeBSD user --Sig_/.qitOwY9QtA6_x.HT94VhD5 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRQheDybVktG5eW/1Kxzvs8OqokrwUCahwG+wAKCRCxzvs8Oqok ryGQAQDohJJrTO62P64HyIrhmrEO8qRftg7mUJrl8VrxnvB2wwD/dgthQJHZOPC8 0IU14h+f70B4MjEVfsHFulu8BkMouwA= =C+pr -----END PGP SIGNATURE----- --Sig_/.qitOwY9QtA6_x.HT94VhD5-- From nobody Sun May 31 11:30:45 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 4gSvzZ6yf6z6gXkj for ; Sun, 31 May 2026 11:30:50 +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 4gSvzZ4DFQz3sP4 for ; Sun, 31 May 2026 11:30:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780227050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W2JQawv4tIlBU3pHLGHGwD0foWvtKVhhCPbgOk7rVko=; b=RCA/tAAsjimjTUw0hY16bfe2THr1FbNefmNJ9A3i39tF+0ZBt+CarEhHGWUzm9GD4kWzTW x922BvKLC+pb4HENrPJ9omL8P1OD8TmsnGKP08VTNh3sJsx667tuWoDohTO0uXXDPoBDMo UP3fQ+nvTcKipRaicGCTJgpwIVNnR8WDYfp7QkO3u/Fd9EKdr7akcly9BYbdTBBRsBJ8pC eOaPzWhYQsn1poaBXWV4l4VD0lnnNvgyRo3+anbXijjRDv/Iosuh/gW8Bn27+bUFIqAGDR 3fEHt0B4yG61Qn9yZKY9MD9QH9GMQ+3HNco8PGjJwWlGNiZKjhbhNWpQtQkZyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780227050; a=rsa-sha256; cv=none; b=IJLQy/qMEY3IfO66hqPOBy6Mij6vJZKUmK6sbXCZqb9Kqdq6iRV3qPMCGUg79FmsiVXllz CVwGu2YpNlTQgO0eTXuOmzfgvLbbi1bxQ2SXYDnoqv95vakPCudwZLIIgtcgo9ur1RCEfH flp0rk0xtAw8Ia0+iWZcsGYddDgLB0u/9edhGIqbkJ0kHKLJWKydKtSjw7WpNxaBHX3fxw YnP/+lDr9TWNsmOeq1r/3PS2TsQoy0GeObnXhxlcBfaDu+U1iRPj8yp0dmykPuBH0oOTLB qsyNOD6k4/7ym5otmRJPujgnk4ZlX+4df2u70UsGCYLXLV7okRsPfY436+iluw== 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=1780227050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W2JQawv4tIlBU3pHLGHGwD0foWvtKVhhCPbgOk7rVko=; b=kXTs6JH0o3cDSih2x8mmyFf89lNtJvSVdOLfGB+EFDywyG6ZTG9J1qmxoG6ijwgnpoPPqN vePAjHDEZCiKRu4G63WmmYTYCktCnxvmWHXf2d/h3Yktj2fzwxl3LHdYjvFDwbPvcZXv6w O39w6YN6/YVXZoD/8dFAPfcev4Srwd/I0Y6j/Cze2Vo59HpnP6Tumf5C+vJNU1Nbh9Ngeb HJHXK2XgjlPqbl6yWKa8gRBpUmrCqwJ3di7a1fT72wNtYu465XHcLW/4cxxrsPXszZ86x+ jrnvnRsab46WJ6gx5tOZXsGDpeb9mbZmJynwFY+rMSoEwZNQMZ12qyWVe75Dvg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSvzZ3CnWzqCM for ; Sun, 31 May 2026 11:30:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 43061 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 11:30:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Joshua Rogers From: Vladimir Kondratyev Subject: git: 8809ea46f105 - main - ukbd: fix SET_REPORT wValue always using report ID 0 for LED output 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: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8809ea46f105b71e87e17c46bce133860f2bf643 Auto-Submitted: auto-generated Date: Sun, 31 May 2026 11:30:45 +0000 Message-Id: <6a1c1be5.43061.2dada001@gitrepo.freebsd.org> The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=8809ea46f105b71e87e17c46bce133860f2bf643 commit 8809ea46f105b71e87e17c46bce133860f2bf643 Author: Joshua Rogers AuthorDate: 2026-05-31 11:29:15 +0000 Commit: Vladimir Kondratyev CommitDate: 2026-05-31 11:29:15 +0000 ukbd: fix SET_REPORT wValue always using report ID 0 for LED output ukbd_set_leds_callback() built the SET_REPORT control request with USETW2(req.wValue, UHID_OUTPUT_REPORT, 0) before the loop that determines the actual HID report ID from sc_id_numlock, sc_id_scrolllock, or sc_id_capslock. The data payload was already correctly prefixed with the real report ID when id != 0, but the control request's wValue told the device to set report ID 0, which does not exist on devices that use non-zero report IDs for LED output. Apple Internal Keyboard / Trackpad (0x05ac:0x0274) uses report ID 1 for LED output. The mismatch caused the device to STALL every SET_REPORT request, so the capslock LED could never be updated. Move the USETW2 call to after the LED-detection loop so that wValue carries the correct report ID. Signed-off-by: Joshua Rogers Reviewed by: wulf MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/2210 --- sys/dev/usb/input/ukbd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 104e51c082c3..d012af99fee4 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -957,13 +957,6 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error) break; sc->sc_flags &= ~UKBD_FLAG_SET_LEDS; - req.bmRequestType = UT_WRITE_CLASS_INTERFACE; - req.bRequest = UR_SET_REPORT; - USETW2(req.wValue, UHID_OUTPUT_REPORT, 0); - req.wIndex[0] = sc->sc_iface_no; - req.wIndex[1] = 0; - req.wLength[1] = 0; - memset(sc->sc_buffer, 0, UKBD_BUFFER_SIZE); id = 0; @@ -1017,11 +1010,18 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error) } else { usbd_copy_in(pc, 0, sc->sc_buffer + 1, len); } - req.wLength[0] = len; usbd_xfer_set_frame_len(xfer, 1, len); DPRINTF("len=%d, id=%d\n", len, id); + req.bmRequestType = UT_WRITE_CLASS_INTERFACE; + req.bRequest = UR_SET_REPORT; + USETW2(req.wValue, UHID_OUTPUT_REPORT, id); + req.wIndex[0] = sc->sc_iface_no; + req.wIndex[1] = 0; + req.wLength[0] = len; + req.wLength[1] = 0; + /* setup control request last */ pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_in(pc, 0, &req, sizeof(req)); From nobody Sun May 31 11:48:46 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 4gSwNJ1kk9z6gZ35 for ; Sun, 31 May 2026 11:48:48 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gSwNH6ZX4z3tgY for ; Sun, 31 May 2026 11:48:47 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780228127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dw/1mJcY2U0Epm6VOyOtBMd8QG58Fe6EcSomrLAxOcE=; b=OCEKDPRzpTOKizIAyA9GB/mKf9ExM1YMjDWRIybQFM2btUkIJfSsX6aJZs81WbOzqN4isC g8QJuWnWWP79PJGqewnWCs1DBNbdS1sRlYMTzd3MX6D7mCOwK6eKPZMic4HV9rq5Kqvm6Z LCpDPEDqmWfhk0nJk1kPV4Kzsuo5P91p1HCEQQkfWbtwsgQgJ1RZIDLAqKHAMk9RD1QC6A ZN9BTeZuewoS1RbSElx0avIS67Z5S6jSR7nGE9Y9c5jbib+8aQBNhX9X0mujS3SBWOuJQF BdohXqRhKlyoJeud7Qq558aCrtkvLKY/wAyvZyBphmTwlAC17g7p32lqwc1XHQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780228127; a=rsa-sha256; cv=none; b=myNKndQFsJIjazyVokXMwl5NUHRkzSYXZioJPa7dy5xzDkcwlsG7yj/rPEM/BCu3usgzoU kxzAaizQwNOn4h8IOA46HOguMVp1jzqNJw1WZ76aFGUAmn8UKsHJB9qN9hiyy27BYkRnl2 DSov7ZXh0hyqvo1yr//U1macpZq3UmC0grtQkrD7SeK4Ff/dQXr+yZQyh1mbk2ifa2INqt QSZj+RDYbnr0I0epZtdnbscV0vvUdrJugVdOOqyGVHj5biVyP1xPr+UB6znmQiUZeHzhbn oUkIkwlJSrBW1/jxelvEo7utKjVxbnytfIdRBOvjfAIk+4NC2s0TslCVoaqCZg== 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=1780228127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dw/1mJcY2U0Epm6VOyOtBMd8QG58Fe6EcSomrLAxOcE=; b=VzgP0pXTmo61TOm2ImxiNg2xlzkwDX3M91iea6z5ALdhiL7Nw8Eqz3yxflZgPnbJLiXFjy sDiD2044Vw6HZZui8mGH6TFwrZLwLPFmLIqFDoOG9BdkfegSvqNbvj1/c8kBT19DCUj2Wb sOlilOziosC/gG+YMdaNmIOJcNSUoZ7VVdeD8E+IEJ2ZpuhgesebRWDl/AZTvY+jyQ3lro zMdKaKp4hWww24Vh9+O23uxx7wOgL0p+nB6FquRmg38HAz/QWu2IDtN0Ki8uBC1zxRUITV nIidTw5PN1YIrMpxZLAJR22TDR4PyK7Yla34nwBdpRUTwFUYHQpEiPix1/pcyw== Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) (Authenticated sender: vexeduxr) by smtp.freebsd.org (Postfix) with ESMTPSA id 4gSwNH5VbCzngp for ; Sun, 31 May 2026 11:48:47 +0000 (UTC) (envelope-from vexeduxr@freebsd.org) Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-36ab8816a35so4252904a91.1 for ; Sun, 31 May 2026 04:48:47 -0700 (PDT) X-Forwarded-Encrypted: i=1; AFNElJ9GqWIxllfjcuI3DEiQ0aWLMKrp6OfyYC2nukP4avWy+7ms/hrXzKsPm+DvQnZg7IyOPIOaSxzTJ/g+QNMUMtsQyW4cTw==@freebsd.org X-Gm-Message-State: AOJu0Yy/psKGtoIT2194g6qP87fGh97mlK3m6sl9sQZ3BSlaq8aURh7I xANVdXzWpbpKPRvx1M4VMsA4Aah/EhjnAgBQNkFK7zAv3dljwyTmqPzsD8YgT8gGMTaezwykZup GGHZlfakfn8l6YfGqMxM32U/t0OI2Kzs= X-Received: by 2002:a17:90b:1a91:b0:368:f179:ba07 with SMTP id 98e67ed59e1d1-36c4ff708d8mr6674492a91.9.1780228126593; Sun, 31 May 2026 04:48:46 -0700 (PDT) Received: from 490177373942 named unknown by gmailapi.google.com with HTTPREST; Sun, 31 May 2026 04:48:46 -0700 Received: from 490177373942 named unknown by gmailapi.google.com with HTTPREST; Sun, 31 May 2026 04:48:46 -0700 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 From: Ahmad Khalifa X-Mailer: aerc 0.21.0 References: <6a1a4f38.32b9d.5eb5f95e@gitrepo.freebsd.org> <20260530190827.15ba6ffa@thor.sb211.local> <20260531120131.387a9bb8@thor.sb211.local> In-Reply-To: <20260531120131.387a9bb8@thor.sb211.local> Date: Sun, 31 May 2026 04:48:46 -0700 X-Gmail-Original-Message-ID: X-Gm-Features: AVHnY4Ii9RI07z0toGmHUElVl5NpeKIAUGIXSLP4ftUIEFyODjMC8CnTvCx7aRA Message-ID: Subject: Re: git: 2fa4bdd7f9e9 - main - edk2: enable static asserts for *INT64 alignment To: A FreeBSD User Cc: Kevin Bowling , Kyle Evans , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun May 31, 2026 at 1:01 PM +0300, A FreeBSD User wrote: > Am Tage des Herren Sat, 30 May 2026 17:11:38 -0700 > Ahmad Khalifa schrieb: > >> On Sun May 31, 2026 at 1:54 AM +0300, Kevin Bowling wrote: >> > On Sat, May 30, 2026 at 2:50=E2=80=AFPM Ahmad Khalifa wrote: >> >> >> >> On Sat May 30, 2026 at 8:09 PM +0300, A FreeBSD User wrote: >> >> > Am Tage des Herren Sat, 30 May 2026 02:45:12 +0000 >> >> > Ahmad Khalifa schrieb: >> >> > >> >> >> The branch main has been updated by vexeduxr: >> >> >> >> >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D2fa4bdd7f9e99698a66= 52db405c3165fdcd41c1d >> >> >> >> >> >> commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d >> >> >> Author: Ahmad Khalifa >> >> >> AuthorDate: 2026-05-30 02:40:58 +0000 >> >> >> Commit: Ahmad Khalifa >> >> >> CommitDate: 2026-05-30 02:40:58 +0000 >> >> >> >> >> >> edk2: enable static asserts for *INT64 alignment >> >> >> >> >> >> The ia32 loader is now built with -malign-double, so these sho= uld pass. >> >> >> >> >> >> Differential Revision: https://reviews.freebsd.org/D55386 >> >> >> --- >> >> >> sys/contrib/edk2/Include/Base.h | 2 -- >> >> >> 1 file changed, 2 deletions(-) >> >> >> >> >> >> diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/In= clude/Base.h >> >> >> index 3ae798db8429..d3342c9a6ca2 100644 >> >> >> --- a/sys/contrib/edk2/Include/Base.h >> >> >> +++ b/sys/contrib/edk2/Include/Base.h >> >> >> @@ -841,10 +841,8 @@ STATIC_ASSERT (ALIGNOF (INT16) =3D=3D sizeo= f (INT16), "Alignment of >> >> >> INT16 does not STATIC_ASSERT (ALIGNOF (UINT16) =3D=3D sizeof (UIN= T16), "Alignment of >> >> >> UINT16 does not meet UEFI Specification Data Type requirements"); = STATIC_ASSERT >> >> >> (ALIGNOF (INT32) =3D=3D sizeof (INT32), "Alignment of INT32 does= not meet UEFI >> >> >> Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (UI= NT32) =3D=3D sizeof >> >> >> (UINT32), "Alignment of UINT32 does not meet UEFI Specification Da= ta Type >> >> >> requirements"); -#ifndef _STANDALONE STATIC_ASSERT (ALIGNOF (INT64= ) =3D=3D sizeof (INT64), >> >> >> "Alignment of INT64 does not meet UEFI Specification Data Type req= uirements"); >> >> >> STATIC_ASSERT (ALIGNOF (UINT64) =3D=3D sizeof (UINT64), "Alignmen= t of UINT64 does not >> >> >> meet UEFI Specification Data Type requirements"); -#endif STATIC_A= SSERT (ALIGNOF >> >> >> (CHAR8) =3D=3D sizeof (CHAR8), "Alignment of CHAR8 does not meet= UEFI Specification Data >> >> >> Type requirements"); STATIC_ASSERT (ALIGNOF (CHAR16) =3D=3D sizeo= f (CHAR16), "Alignment >> >> >> of CHAR16 does not meet UEFI Specification Data Type requirements"= ); STATIC_ASSERT >> >> >> (ALIGNOF (INTN) =3D=3D sizeof (INTN), "Alignment of INTN does not = meet UEFI Specification >> >> >> Data Type requirements"); >> >> > >> >> > The commit seems to disturb building process and gets rogue with: >> >> > [...] >> >> > In file included from /usr/src/sys/contrib/edk2/Include/Uefi/UefiBa= seType.h:16: >> >> > /usr/src/sys/contrib/edk2/Include/Base.h:844:16: error: static asse= rtion failed due to >> >> > requirement '_Alignof(long long) =3D=3D sizeof(long long)': Alignme= nt of INT64 does not >> >> > meet UEFI Specification Data Type requirements 844 | STATIC_ASSERT = (ALIGNOF (INT64) >> >> > =3D=3D sizeof (INT64), "Alignment of INT64 does not meet UEFI Speci= fication Data Type >> >> > requirements"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> > /usr/src/sys/contrib/edk2/Include/Base.h:778:24: note: expanded fro= m macro 'ALIGNOF' >> >> >> >> I can't reproduce with the defaults, do you have any loader related >> >> build options changed? >> > >> > Maybe a transient stale rebuild artifact, I was able to get through it >> > with -j1 somehow. >> >> Hmm, after building this a few times I do run into a race condition >> where the interpreter isn't done building before loader_ia32.efi. Is >> that what you ran into? >> >> Looks like the SUBDIR entries need to be re-ordered, that's a different >> issue from the one above though. >> >> > >> >> Also, can you tell which target this failed on? >> >> >> >> Thanks. >> >> >> >> > >> >> > >> >> > Regards >> >> > oh >> >> >> > > Architecture is amd64. > Most prominent changes/options in /etc/src.conf amongst non-debug flags a= re in my case: > > WITH_BEARSSL=3D YES > WITHOUT_LOADER_PXEBOOT=3D YES > LOADERSIZE?=3D 555000 > WITH_BHYVE_SNAPSHOT=3D YES Ah, looks like WITH_BEARSSL triggered it. Seems like we're building the EFI bits of libsecureboot, even for the BIOS loader... I'll revert for now until I can do a deeper dive. Thanks for the report. > > I had to mess with the loadersize in the past since loader didn't build a= nymore due to some > bytes of space missing ... From nobody Sun May 31 12:16:29 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 4gSx0G0TBbz6gcJb for ; Sun, 31 May 2026 12:16:30 +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 4gSx0F74XTz3x2l for ; Sun, 31 May 2026 12:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780229790; 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=nbMz1SFsCyEtjfq4396mzuRl643egtMmFnVkVC8vQpc=; b=Qis8+1Q+SMlXHO8PF14z38GgdB3GDdA8ugD26Y+xm/DYJT+hkqBJ5bkOL+xrHNIrO+ey6J hOsC7sUvcLWV8YCB2/BJrqD+Ymqdcobi/It98fo7K7N6YRvNLyHlw5Nd6BLaCDx5NcbRHV epbZvKvI22NKTPrG7h2vHrhLSPMwOMkjrmTaaqFPUOFFjwiVrlVS5Ty0eJNEL+/cduzAdb sLu2a+q89KbuFfuW+pjXcUkfbIRwFb1SPLhUk4g83yCkpYAJ/Psy5nlbH7EUhS9J/FY1+A GM4CxkTGGtVE3zmTmKdvm3hs+btqb+CSyBLGVxux1Yn3lJOUbo0oLGzpjBfdyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780229790; a=rsa-sha256; cv=none; b=JrG29PpGeaCXL4YfOJm3TNmxCWkOmuRzZgpZ/Y4EDNBWi3l0jHQGrH6ODhOO4EFc+m1WDu Z9MpO3dfCDxZDeQxcwYZGvALBY47a7aAQNGeo/yZSG1ZNryQDdLYf484acM6odM3xhY/TO 7Mkb6MIhM/mAyPobLbBeqpYIW22pjQSw+c4IucZ9G0U3umOU0GI4BuhAsw36jzQ6osnkwM N4tmQbSel/FnXmaXMZggFJD3Q0KQT47hTmWq1hxaiQShDYcDrQmH4fSjhNEZOfA1YXiwJP vtw3aYSqMUZInKIxEjaKiVoDXQYzEvDvb7n6ssMKG3dWs6+wsGZI5pDZKxfx6A== 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=1780229790; 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=nbMz1SFsCyEtjfq4396mzuRl643egtMmFnVkVC8vQpc=; b=fHzlqQPWSy+/RiIBs5Q8e2OXKytt0bzTYWWhNqMb4DO93ogaUelOAkmVuccT1XInW3JNCZ vHSjEtyH5eyEC7JkKOagquAHVYNKb812jDPhl7+5W9ncKZzs0UONA3ANwSjbAB3zb+vA3G GEFTVtoGafgKXaknXB2UVjCeKXeRkmYjl5q3FSu2s5uy4phn2KZ7SXfdNQbTzxrlr/CWJ/ OP38y7ySrGdQIFrJQFeYsjnNJ0vMFpzYccBNrzg5aR4glaIMDm9nZpn6F2pSeh+ejajCyY 00eDiknCl85lMCithrg8KjmbjhVuR9rkls0UyU3MX7TOkuvQMFWROHDsCegCtQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSx0F6FtzzqR5 for ; Sun, 31 May 2026 12:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4593f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 12:16:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 23996d940a63 - main - stand/efi/Makefile: fix build order 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: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23996d940a63359465021277d4b2f5b569054379 Auto-Submitted: auto-generated Date: Sun, 31 May 2026 12:16:29 +0000 Message-Id: <6a1c269d.4593f.39515ed2@gitrepo.freebsd.org> The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=23996d940a63359465021277d4b2f5b569054379 commit 23996d940a63359465021277d4b2f5b569054379 Author: Ahmad Khalifa AuthorDate: 2026-05-31 00:02:06 +0000 Commit: Ahmad Khalifa CommitDate: 2026-05-31 11:48:05 +0000 stand/efi/Makefile: fix build order Move liblua32efi and ficl32efi before .WAIT, otherwise there's a race between the interpreter and the loader being built. Reported by: kbowling Discussed with: kevans Fixes: d15cc7625dde9bcb6a63ee59cccf14f3b93b15bf --- stand/efi/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stand/efi/Makefile b/stand/efi/Makefile index 5ece7eff8ef2..db4cbc1a0b1a 100644 --- a/stand/efi/Makefile +++ b/stand/efi/Makefile @@ -5,9 +5,6 @@ NO_OBJ=t SUBDIR.yes+= libefi SUBDIR.${MK_LOADER_IA32}+= libsa32efi libefi32 SUBDIR.${MK_FDT}+= fdt -SUBDIR.yes+= .WAIT - -SUBDIR.yes+= boot1 gptboot .if ${LOADER_DEFAULT_INTERP} == "lua" SUBDIR.${MK_LOADER_IA32}+= liblua32efi @@ -15,6 +12,10 @@ SUBDIR.${MK_LOADER_IA32}+= liblua32efi SUBDIR.${MK_LOADER_IA32}+= ficl32efi .endif +SUBDIR.yes+= .WAIT + +SUBDIR.yes+= boot1 gptboot + SUBDIR.${MK_FORTH}+= loader_4th SUBDIR.${MK_LOADER_LUA}+= loader_lua SUBDIR.${MK_LOADER_IA32}+= loader_ia32 From nobody Sun May 31 12:16:30 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 4gSx0H3J4Bz6fsc9 for ; Sun, 31 May 2026 12:16:31 +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 4gSx0H0YxDz3xTw for ; Sun, 31 May 2026 12:16:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780229791; 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=B/tRzGN8P/TKw61KsHVpHkF6iYd/5+UmjA8/PO7kUVE=; b=b1Xc+Wz2vAgv4dii0v5L21KGxM01sTsoQYO5Iq9uRH7MQCB9/vgH78caEjWK3PCIcKPXcv aI1Q/iswDltJkgVHe+QbRf/YoISjoConmZvPvQhp6DgvpZ8n/xUO67diGj10v/DA2hB7PV FF0jtWppIiXF5VJirvNAWkgNFQPdp5lV5N3R/LN0l2RyCqo0qWuHHIp2aLh3crjUp7b88T dsGfrlIpvH/voTYZg5Tyj+fIeM5QWZuZUe1CgjiOAlDzd3ThafqtoRGNh/cPlB08IG3vnD +YHU/an3w1fTp+8BehutcpovZW/gWwDfZhvtc+TGr4pCe8zDSXBe8jx04W097A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780229791; a=rsa-sha256; cv=none; b=wbKpytL5RKNoT7XoC+3tEr8lU1yzyithc95112c16qPzspM7Nc8TaqKtkNkY7txSP7lo8G YDLd7nToUnnzw/qGj7no97GfPfJH2Wewv2y2ZQh3XFLsO2Un0S78pGLrnHD2J798oZIjyZ vzFHJZVGrJRugLZsQ0IolUwAgLZUvg+IPMGF5beKlMcMv+aIAmpYxErGmBIfPPyp+R8JLF dlHLrOVEgibhKcToRzyUWAfrPmZWO4kxD2TrhwsIbi9saQgNsdzs5a0xguo0PUkchYfcte WqyAtBAh1rBDzd7fMovYw2jo1FiQldNi5O24UIKdnMbXLvJXTGL5FrzjH7BVYA== 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=1780229791; 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=B/tRzGN8P/TKw61KsHVpHkF6iYd/5+UmjA8/PO7kUVE=; b=Yvu9cfvGJ22haYKKUo8VQExDDiB2xvZT0dtjuomTgkbdaijm7kO7vDkV5MSUevAadmQp0M rfwoeamPXLXSCTpucrbAccfcTevune+IjUmEeBmISq0e27XMNt9sLQZ4tgM4LBp+vLFTmc 01STeMmVKqmoFwMLuJHAPtionNYVIOkCaELJHPUwz8iwqVyGyFzTV8Qz8Jsz+sZiM1e/if 8SJXEzA8R3NZDmwURdbX1BjhyHr7EgOe8fkQXKzTN/12LG292+eCf9Cb5Z06QNgTRTGvvZ QQGUCPw50v6NFpG9Wh7tFhynKWLEpp8bU+M5/xyelsac8tVuyTWUUCsJ6r+Ttg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gSx0G6cmMzrCS for ; Sun, 31 May 2026 12:16:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4701b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 12:16:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: aef014de3ff8 - main - Revert "edk2: enable static asserts for *INT64 alignment" 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: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aef014de3ff8be3ef06a45cb48a7f2386167456f Auto-Submitted: auto-generated Date: Sun, 31 May 2026 12:16:30 +0000 Message-Id: <6a1c269e.4701b.6a4308e@gitrepo.freebsd.org> The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=aef014de3ff8be3ef06a45cb48a7f2386167456f commit aef014de3ff8be3ef06a45cb48a7f2386167456f Author: Ahmad Khalifa AuthorDate: 2026-05-31 11:29:34 +0000 Commit: Ahmad Khalifa CommitDate: 2026-05-31 12:12:34 +0000 Revert "edk2: enable static asserts for *INT64 alignment" This fails when using WITH_BEARSSL. It seems like we build the EFI bits of libsecureboot (which is really just part of libsa in this case), even when building the BIOS loader. Revert for now to unbreak the build. This reverts commit 2fa4bdd7f9e99698a6652db405c3165fdcd41c1d. Reported by: freebsd@walstatt-de.de --- sys/contrib/edk2/Include/Base.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/contrib/edk2/Include/Base.h b/sys/contrib/edk2/Include/Base.h index d3342c9a6ca2..3ae798db8429 100644 --- a/sys/contrib/edk2/Include/Base.h +++ b/sys/contrib/edk2/Include/Base.h @@ -841,8 +841,10 @@ STATIC_ASSERT (ALIGNOF (INT16) == sizeof (INT16), "Alignment of INT16 does not STATIC_ASSERT (ALIGNOF (UINT16) == sizeof (UINT16), "Alignment of UINT16 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (INT32) == sizeof (INT32), "Alignment of INT32 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (UINT32) == sizeof (UINT32), "Alignment of UINT32 does not meet UEFI Specification Data Type requirements"); +#ifndef _STANDALONE STATIC_ASSERT (ALIGNOF (INT64) == sizeof (INT64), "Alignment of INT64 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (UINT64) == sizeof (UINT64), "Alignment of UINT64 does not meet UEFI Specification Data Type requirements"); +#endif STATIC_ASSERT (ALIGNOF (CHAR8) == sizeof (CHAR8), "Alignment of CHAR8 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (CHAR16) == sizeof (CHAR16), "Alignment of CHAR16 does not meet UEFI Specification Data Type requirements"); STATIC_ASSERT (ALIGNOF (INTN) == sizeof (INTN), "Alignment of INTN does not meet UEFI Specification Data Type requirements"); From nobody Sun May 31 17:19:54 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 4gT3kL3y5jz6gPGW for ; Sun, 31 May 2026 17:19:54 +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 4gT3kL3fjHz3Vx6 for ; Sun, 31 May 2026 17:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780247994; 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=L1fUFdYwtjOApX8xdaqr5/l/CSifnTiLUD55G+rCPA0=; b=Xl5WbSPGI+mXhuKPukmOQlzQ1zSC/jNSflgsH4ihI2ySOyhYSA3gB6Ktv0ctxs43ZS7n4C ryAiFJv1KX8oJgG27qwG6HUAluSEBWTMFBOMVpyDMy/+bzMO1zuI6rhl0pHaChHybIK57g 4Tk0mKmRRZXaj6J2vwnPGWrJP9tOfS/RAhyW8yigiXn7RVfkE/xK+ZJX5R3IKF0ynpcLXy 4bhF43K+MMMkBqlXMU2ZAfqdCPH1usFcO2yGyrQp+RIuzrM9xS2LauTwtAiC3JxfqeGLz7 b5r/d80keXjkOJ3cU6/FhAuBhDPj34g4J4bnyUmnDkrMQYubAdE+YandyBrLhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780247994; a=rsa-sha256; cv=none; b=E4p9UATvNJQZKBD04CNGmaP1c0xjMzw/Cw2LepCG/nvLCQxt+1vP0sS9QSfAxTbfyfZijK JCE96LXwpVgg7HjSvj1dyJz70kaYcksNDzp8xFEwY/pBUn1dST7xHVAJO2c1shj+0Tsk+q JZHnCcVr/yy0fRBy4YdiFfKN9WNEncduvZkTgQ5xcvGt7nUntTPGtdEtSqObM+4RpdgBTT zwD3iZyfPwRY/FOd/EwnK13mXNN1SLQplBuCzSgAvo5h0huD7FttqhvhuzyKV5agxTVwmr fFO3mPIyWEAabEDs/bahMuoPXi44tBb4zTYS+m4zh7jN3wfgR0C0G2z8vhTPLQ== 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=1780247994; 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=L1fUFdYwtjOApX8xdaqr5/l/CSifnTiLUD55G+rCPA0=; b=l/0VOBtZCdmnBodVCrYO3GQ3Lbcvi5i4eBZiX6cOp8BomZcsGA9B7FA/RtXQaB090SpCXb dLnpIY81CZJLALZQYCw+sGRAfUSFQXN6CWpKy7/IUCTgKzBYzBKzUCsJdM7akvFc/FB0/Y jmUmQD639MDC0SxgjOuhJqioTyaK8GsinkbcSLIvSox3D14qh17dv02uN3y1FxszYzC0Mh DgJQRrW7ABF1CM2WVIbilpX5H0ULR3CNSIC8aVdTQZb42BYimoEhR6LoxSYWKFoZQKX+Ns LbAfbVgf9TiveSaeiWlKTxNKR9ZpcaJ2XBTn1vks3lYxIS30LCkE82T4pxkozA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gT3kL2rTTz10w8 for ; Sun, 31 May 2026 17:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d173 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 17:19:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 03ca6dbdb80d - main - ntsync(4) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03ca6dbdb80da79408f135d823fbd9a00fd4f25b Auto-Submitted: auto-generated Date: Sun, 31 May 2026 17:19:54 +0000 Message-Id: <6a1c6dba.3d173.67c47bb@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=03ca6dbdb80da79408f135d823fbd9a00fd4f25b commit 03ca6dbdb80da79408f135d823fbd9a00fd4f25b Author: Konstantin Belousov AuthorDate: 2026-05-11 09:49:13 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-31 17:10:46 +0000 ntsync(4) The driver implements the ntsync interface as specified in the Linux 7.0-rc3 document Documentation/userspace-api/ntsync.rst. Only the documentation and the userspace tests (Linux' tools/testing/selftests/drivers/ntsync/ntsync.c) were used for reference. When the documentation contradicted the tests, tests behavior was implemented. One quirk is that Linux API needs to return an error from ioctl() and to copyout the modified ioctl() argument. Our generic ioctl() is not flexible enough to implement this, so the ntsync_ioctl_copyout() hack allows to copyout the ioctl parameter directly from the ioctl method, instead of relying on the ioctl infra. The FreeBSD port of the tests, that can be compiled both on FreeBSD and Linux, is available at https://github.com/kostikbel/freebsd-ntsync-test. The Linux binary compiled with the Linux test harness, cannot be run under linuxolator due to unimplemented syscalls, but the shims in freebsd-ntsync-test can be compiled on Linux and resulting Linux/glibc binary run on linuxolator to test linux compat. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57038 --- sys/dev/ntsync/ntsync.c | 1379 +++++++++++++++++++++++++++++++++++++++++++ sys/dev/ntsync/ntsync.h | 66 +++ sys/dev/ntsync/ntsyncvar.h | 119 ++++ sys/modules/Makefile | 1 + sys/modules/ntsync/Makefile | 6 + sys/sys/file.h | 1 + 6 files changed, 1572 insertions(+) diff --git a/sys/dev/ntsync/ntsync.c b/sys/dev/ntsync/ntsync.c new file mode 100644 index 000000000000..8b0984d12c75 --- /dev/null +++ b/sys/dev/ntsync/ntsync.c @@ -0,0 +1,1379 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2026 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct cdev *ntsync_cdev; +MALLOC_DEFINE(M_NTSYNC, "ntsync", "ntsync"); + +static void ntsync_free_priv(struct ntsync_priv *priv); + +/* + * Returning error from an ioctl handler prevents the generic ioctl + * code from copying out the result. Use direct access to ioctl(2) + * args to get the parameters block pointer to implement Linux + * semantic of both returning an error and updating the parameters + * block. + */ +static int +ntsync_ioctl_copyout(struct thread *td, const void *ptr, size_t sz) +{ + void *uptr; + + if (SV_PROC_ABI(td->td_proc) != SV_ABI_FREEBSD) + return (0); + uptr = (void *)(uintptr_t)td->td_sa.args[2]; + return (copyout(ptr, uptr, sz)); +} + +static bool +ntsync_wait_any(struct ntsync_wait_state *state) +{ + struct ntsync_obj *obj; + int i; + + MPASS(state->any); + NTSYNC_PRIV_ASSERT(state->owner); + + for (i = 0; i < state->obj_count; i++) { + obj = state->objs[i]; + if (obj->is_signaled(obj, state, i)) { + state->index = i; + obj->consume(obj, state, state->index); + return (true); + } + } + return (false); +} + +static bool +ntsync_wait_all_prepare(struct ntsync_wait_state *state, bool *stop) +{ + struct ntsync_obj *obj; + int alerti, i; + bool first; + + MPASS(state->all); + MPASS(state->error == 0); + MPASS(!*stop); + NTSYNC_PRIV_ASSERT(state->owner); + + alerti = state->alert_event == NULL ? 0 : 1; + first = true; + + for (i = 0; i < state->obj_count - alerti; i++) { + obj = state->objs[i]; + if (!obj->prepare(obj, state, i, stop)) + return (false); + if (*stop) { + MPASS(state->error != 0); + return (false); + } + MPASS (state->error == 0); + if (first) { + first = false; + state->index = i; + } + } + return (true); +} + +static void +ntsync_wait_all_commit(struct ntsync_wait_state *state) +{ + struct ntsync_obj *obj; + int i, alerti; + + MPASS(state->all); + NTSYNC_PRIV_ASSERT(state->owner); + alerti = state->alert_event == NULL ? 0 : 1; + + for (i = 0; i < state->obj_count - alerti; i++) { + obj = state->objs[i]; + obj->commit(obj, state, i); + } +} + +static void +ntsync_wait_link_waiters(struct ntsync_wait_state *state) +{ + struct ntsync_obj *obj; + struct ntsync_obj_waiter *waiter; + int i; + + NTSYNC_PRIV_ASSERT(state->owner); + + for (i = 0; i < state->obj_count; i++) { + obj = state->objs[i]; + waiter = &state->waiters[i]; + waiter->state = state; + TAILQ_INSERT_TAIL(&obj->waiters, waiter, link); + } +} + +static void +ntsync_wait_unlink_waiters(struct ntsync_wait_state *state) +{ + struct ntsync_obj *obj; + struct ntsync_obj_waiter *waiter; + int i; + + NTSYNC_PRIV_ASSERT(state->owner); + + for (i = 0; i < state->obj_count; i++) { + obj = state->objs[i]; + waiter = &state->waiters[i]; + TAILQ_REMOVE(&obj->waiters, waiter, link); + } +} + +static void +ntsync_wait_post_commit(struct ntsync_wait_state *state) +{ + struct ntsync_obj *obj; + int alerti, i; + + NTSYNC_PRIV_ASSERT(state->owner); + + alerti = state->alert_event == NULL ? 0 : 1; + for (i = 0; i < state->obj_count - alerti; i++) { + obj = state->objs[i]; + obj->post_commit(obj, state, i); + } +} + +static void +ntsync_wait_check_ready(struct ntsync_wait_state *state) +{ + struct ntsync_obj *ae; + int index; + bool stop; + + NTSYNC_PRIV_ASSERT(state->owner); + + if (state->ready) + return; + + if (state->all) { + stop = false; + if (ntsync_wait_all_prepare(state, &stop)) { + MPASS(!stop); + ntsync_wait_all_commit(state); + state->ready = true; + ntsync_wait_post_commit(state); + } else if (stop) { + /* skip */ + } else if (state->alert_event != NULL) { + ae = &state->alert_event->obj; + index = state->obj_count - 1; + if (ae->is_signaled(ae, state, index)) { + state->index = index; + ae->consume(ae, state, index); + ae->post_commit(ae, state, index); + state->ready = true; + } + } + } else { /* state->any */ + if (ntsync_wait_any(state)) + state->ready = true; + } +} + +/* + * Perform the wait. Errors returned through state->error still + * result in the copyout of the ntsync_wait_args after the wait, while + * errors returned as the function result do not. + */ +static int +ntsync_wait_locked(struct ntsync_wait_state *state, struct thread *td) +{ + int error; + + NTSYNC_PRIV_ASSERT(state->owner); + + for (;;) { + ntsync_wait_check_ready(state); + if (state->ready) + break; + error = msleep_sbt(state, &state->owner->lock, + PCATCH, "ntsync", state->sb, 0, + C_ABSOLUTE /* | C_HARDCLOCK XXXKIB */); + + /* + * Check state->ready before checking error from + * msleep(). If there was a wake up that set the + * readiness before us receiving a signal or timeout, + * the objects states are modified to reflect wakeup. + * Due to this, ready should result in normal return. + */ + if (state->ready) { + error = 0; + break; + } + + if (error != 0) { + if (error == EAGAIN) + error = ETIMEDOUT; + break; + } + } + return (error); +} + +static int +ntsync_wait(struct ntsync_wait_state *state, struct thread *td) +{ + int error; + + NTSYNC_PRIV_LOCK(state->owner); + ntsync_wait_link_waiters(state); + error = ntsync_wait_locked(state, td); + ntsync_wait_unlink_waiters(state); + NTSYNC_PRIV_UNLOCK(state->owner); + return (error); +} + +static void +ntsync_wakeup_waiters(struct ntsync_obj *obj) +{ + struct ntsync_obj_waiter *w; + + NTSYNC_PRIV_ASSERT(obj->owner); + + TAILQ_FOREACH(w, &obj->waiters, link) { + ntsync_wait_check_ready(w->state); + if (w->state->ready) + wakeup(w->state); + } +} + +static int +ntsync_create_obj(struct ntsync_obj *obj, struct fileops *fops, + struct ntsync_priv *priv, struct thread *td) +{ + struct file *fp; + int error, fd; + + error = falloc_noinstall(td, &fp); + if (error != 0) + return (error); + + /* + * The priv fd cannot be closed during object creation since + * it is fget-ed around ioctl. + */ + obj->owner = priv; + + TAILQ_INIT(&obj->waiters); + NTSYNC_PRIV_LOCK(priv); + MPASS(!priv->closed); + if (priv->objs_cnt == UINT_MAX) { + NTSYNC_PRIV_UNLOCK(priv); + fdrop(fp, td); + return (EMFILE); + } + priv->objs_cnt++; + NTSYNC_PRIV_UNLOCK(priv); + + finit(fp, FREAD | FWRITE, DTYPE_NTSYNC, obj, fops); + error = finstall(td, fp, &fd, 0, NULL); + if (error != 0) { + NTSYNC_PRIV_LOCK(priv); + MPASS(priv->objs_cnt > 0); + priv->objs_cnt--; + NTSYNC_PRIV_UNLOCK(priv); + } else { + td->td_retval[0] = fd; + } + fdrop(fp, td); + return (error); +} + +static void +ntsync_close_obj(struct ntsync_obj *obj, struct thread *td) +{ + struct ntsync_priv *priv; + + priv = obj->owner; + NTSYNC_PRIV_LOCK(priv); + MPASS(priv->objs_cnt > 0); + MPASS(TAILQ_EMPTY(&obj->waiters)); + priv->objs_cnt--; + NTSYNC_PRIV_UNLOCK(priv); + ntsync_free_priv(priv); +} + +static bool +ntsync_sem_is_signaled(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index) +{ + struct ntsync_obj_sem *sem; + + MPASS(obj->type == NTSYNC_OBJ_SEM); + NTSYNC_PRIV_ASSERT(obj->owner); + sem = OBJ_TO_SEM(obj); + return (sem->a.count != 0); +} + +static void +ntsync_sem_consume(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index) +{ + struct ntsync_obj_sem *sem; + + MPASS(obj->type == NTSYNC_OBJ_SEM); + NTSYNC_PRIV_ASSERT(obj->owner); + sem = OBJ_TO_SEM(obj); + MPASS(sem->a.count != 0); + sem->a.count--; +} + +static bool +ntsync_sem_prepare(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index, bool *stop) +{ + struct ntsync_obj_sem *sem; + + MPASS(obj->type == NTSYNC_OBJ_SEM); + NTSYNC_PRIV_ASSERT(obj->owner); + sem = OBJ_TO_SEM(obj); + if (sem->a.count == 0) + return (false); + sem->a1 = sem->a; + sem->a1.count--; + return (true); +} + +static void +ntsync_sem_commit(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index) +{ + struct ntsync_obj_sem *sem; + + MPASS(obj->type == NTSYNC_OBJ_SEM); + NTSYNC_PRIV_ASSERT(obj->owner); + sem = OBJ_TO_SEM(obj); + sem->a = sem->a1; +} + +static void +ntsync_sem_post_commit(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index) +{ +} + +static int +ntsync_sem_close(struct file *fp, struct thread *td) +{ + struct ntsync_obj_sem *sem; + + sem = fp->f_data; + ntsync_close_obj(&sem->obj, td); + free(sem, M_NTSYNC); + return (0); +} + +int +ntsync_sem_release(struct thread *td, struct file *fp, uint32_t *val) +{ + struct ntsync_obj *obj; + struct ntsync_obj_sem *sem; + struct ntsync_priv *priv; + uint32_t prev; + int error; + + obj = fp->f_data; + if (obj->type != NTSYNC_OBJ_SEM) + return (EINVAL); + sem = OBJ_TO_SEM(obj); + priv = obj->owner; + error = 0; + + NTSYNC_PRIV_LOCK(priv); + if (sem->a.count + *val < sem->a.count || + sem->a.count + *val > sem->a.max) { + error = EOVERFLOW; + } else { + prev = sem->a.count; + sem->a.count += *val; + if (sem->a.count != 0) + ntsync_wakeup_waiters(obj); + *val = prev; + } + NTSYNC_PRIV_UNLOCK(priv); + return (error); +} + +int +ntsync_sem_read(struct thread *td, struct file *fp, struct ntsync_sem_args *a) +{ + struct ntsync_obj *obj; + struct ntsync_obj_sem *sem; + struct ntsync_priv *priv; + + obj = fp->f_data; + if (obj->type != NTSYNC_OBJ_SEM) + return (EINVAL); + sem = OBJ_TO_SEM(obj); + priv = obj->owner; + NTSYNC_PRIV_LOCK(priv); + *a = sem->a; + NTSYNC_PRIV_UNLOCK(priv); + return (0); +} + +static int +ntsync_sem_ioctl(struct file *fp, u_long com, void *data, + struct ucred *active_cred, struct thread *td) +{ + int error; + + switch (com) { + case NTSYNC_IOC_SEM_RELEASE: + error = ntsync_sem_release(td, fp, data); + break; + case NTSYNC_IOC_SEM_READ: + error = ntsync_sem_read(td, fp, data); + break; + default: + error = ENOTTY; + break; + } + return (error); +} + +static int +ntsync_sem_stat(struct file *fp, struct stat *sbp, struct ucred *cred) +{ + struct ntsync_obj *obj; + struct ntsync_obj_sem *sem; + + MPASS(fp->f_type == DTYPE_NTSYNC); + obj = fp->f_data; + MPASS(obj->type == NTSYNC_OBJ_SEM); + sem = OBJ_TO_SEM(obj); + + memset(sbp, 0, sizeof(*sbp)); + sbp->st_mode = S_IFREG /* XXXKIB */ | S_IRUSR | S_IWUSR; + NTSYNC_PRIV_LOCK(obj->owner); + sbp->st_size = sem->a.max; + sbp->st_nlink = sem->a.count; + NTSYNC_PRIV_UNLOCK(obj->owner); + return (0); +} + +static int +ntsync_sem_fill_kinfo(struct file *fp, struct kinfo_file *kif, + struct filedesc *fdp) +{ + // XXXKIB + return (0); +} + +struct fileops ntsync_sem_fops = { + .fo_read = invfo_rdwr, + .fo_write = invfo_rdwr, + .fo_truncate = invfo_truncate, + .fo_ioctl = ntsync_sem_ioctl, + .fo_poll = invfo_poll, + .fo_kqfilter = invfo_kqfilter, + .fo_stat = ntsync_sem_stat, + .fo_close = ntsync_sem_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, + .fo_sendfile = invfo_sendfile, + .fo_fill_kinfo = ntsync_sem_fill_kinfo, + .fo_flags = DFLAG_PASSABLE, +}; + +static int +ntsync_create_sem(struct ntsync_sem_args *args, struct ntsync_priv *priv, + struct thread *td) +{ + struct ntsync_obj_sem *sem; + int error; + + if (args->count > args->max) + return (EINVAL); + + sem = malloc(sizeof(*sem), M_NTSYNC, M_WAITOK | M_ZERO); + sem->obj.type = NTSYNC_OBJ_SEM; + sem->obj.is_signaled = ntsync_sem_is_signaled; + sem->obj.consume = ntsync_sem_consume; + sem->obj.prepare = ntsync_sem_prepare; + sem->obj.commit = ntsync_sem_commit; + sem->obj.post_commit = ntsync_sem_post_commit; + sem->a = *args; + + error = ntsync_create_obj(&sem->obj, &ntsync_sem_fops, priv, td); + if (error != 0) + free(sem, M_NTSYNC); + + return (error); +} + +static bool +ntsync_mutex_can_lock(struct ntsync_obj_mutex *mutex, uint32_t nwa_owner) +{ + return (mutex->a.owner == 0 || + (mutex->a.owner == nwa_owner && mutex->a.count < UINT32_MAX) || + mutex->abandoned); +} + +static bool +ntsync_mutex_is_signaled(struct ntsync_obj *obj, + struct ntsync_wait_state *state, int index) +{ + struct ntsync_obj_mutex *mutex; + + MPASS(obj->type == NTSYNC_OBJ_MUTEX); + NTSYNC_PRIV_ASSERT(obj->owner); + mutex = OBJ_TO_MUTEX(obj); + return (ntsync_mutex_can_lock(mutex, state->nwa->owner)); +} + +static void +ntsync_mutex_consume(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index) +{ + struct ntsync_obj_mutex *mutex; + + MPASS(obj->type == NTSYNC_OBJ_MUTEX); + NTSYNC_PRIV_ASSERT(obj->owner); + mutex = OBJ_TO_MUTEX(obj); + MPASS(ntsync_mutex_can_lock(mutex, state->nwa->owner)); + if (state->nwa->owner == 0) { + state->error = EINVAL; + return; + } + if (mutex->a.owner == 0 || mutex->abandoned) + mutex->a.count = 1; + else + mutex->a.count++; + mutex->a.owner = state->nwa->owner; + if (mutex->abandoned && state->error == 0) + state->error = EOWNERDEAD; + mutex->abandoned = false; +} + +static bool +ntsync_mutex_prepare(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index, bool *stop) +{ + struct ntsync_obj_mutex *mutex; + + MPASS(obj->type == NTSYNC_OBJ_MUTEX); + NTSYNC_PRIV_ASSERT(obj->owner); + mutex = OBJ_TO_MUTEX(obj); + if (!ntsync_mutex_can_lock(mutex, state->nwa->owner)) + return (false); + if (state->nwa->owner == 0) { + state->error = EINVAL; + *stop = true; + return (false); + } + mutex->a1 = mutex->a; + if (mutex->a.owner == 0 || mutex->abandoned) + mutex->a1.count = 1; + else + mutex->a1.count++; + mutex->a1.owner = state->nwa->owner; + return (true); +} + +static void +ntsync_mutex_commit(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index) +{ + struct ntsync_obj_mutex *mutex; + + MPASS(obj->type == NTSYNC_OBJ_MUTEX); + NTSYNC_PRIV_ASSERT(obj->owner); + mutex = OBJ_TO_MUTEX(obj); + mutex->a = mutex->a1; + if (mutex->abandoned) + state->error = EOWNERDEAD; + mutex->abandoned = false; +} + +static void +ntsync_mutex_post_commit(struct ntsync_obj *obj, + struct ntsync_wait_state *state, int index) +{ +} + +static int +ntsync_mutex_close(struct file *fp, struct thread *td) +{ + struct ntsync_obj_mutex *mutex; + + mutex = fp->f_data; + ntsync_close_obj(&mutex->obj, td); + free(mutex, M_NTSYNC); + return (0); +} + +int +ntsync_mutex_unlock(struct thread *td, struct file *fp, + struct ntsync_mutex_args *a) +{ + struct ntsync_obj *obj; + struct ntsync_obj_mutex *mutex; + struct ntsync_priv *priv; + uint32_t prev; + int error; + + obj = fp->f_data; + if (obj->type != NTSYNC_OBJ_MUTEX) + return (EINVAL); + mutex = OBJ_TO_MUTEX(obj); + priv = obj->owner; + + NTSYNC_PRIV_LOCK(priv); + if (a->owner == 0) { + error = EINVAL; + } else if (a->owner != mutex->a.owner) { + error = EPERM; + } else { + error = 0; + prev = mutex->a.count; + MPASS(mutex->a.count > 0); + mutex->a.count--; + a->count = prev; + if (mutex->a.count == 0) { + mutex->a.owner = 0; + ntsync_wakeup_waiters(obj); + } + } + NTSYNC_PRIV_UNLOCK(priv); + return (error); +} + +int +ntsync_mutex_kill(struct thread *td, struct file *fp, uint32_t val) +{ + struct ntsync_obj *obj; + struct ntsync_obj_mutex *mutex; + struct ntsync_priv *priv; + int error; + + obj = fp->f_data; + if (obj->type != NTSYNC_OBJ_MUTEX) + return (EINVAL); + mutex = OBJ_TO_MUTEX(obj); + priv = obj->owner; + + NTSYNC_PRIV_LOCK(priv); + if (val == 0) { + error = EINVAL; + } else if (mutex->a.owner != val) { + error = EPERM; + } else { + error = 0; + mutex->a.owner = 0; + mutex->a.count = 0; + mutex->abandoned = true; + ntsync_wakeup_waiters(obj); + } + NTSYNC_PRIV_UNLOCK(priv); + return (error); +} + +int +ntsync_mutex_read(struct thread *td, struct file *fp, + struct ntsync_mutex_args *a, bool *doco) +{ + struct ntsync_obj *obj; + struct ntsync_obj_mutex *mutex; + struct ntsync_priv *priv; + int error; + + *doco = false; + obj = fp->f_data; + if (obj->type != NTSYNC_OBJ_MUTEX) + return (EINVAL); + mutex = OBJ_TO_MUTEX(obj); + priv = obj->owner; + error = 0; + + NTSYNC_PRIV_LOCK(priv); + *a = mutex->a; + if (mutex->abandoned) + error = EOWNERDEAD; + NTSYNC_PRIV_UNLOCK(priv); + *doco = true; + return (error); +} + +static int +ntsync_mutex_ioctl(struct file *fp, u_long com, void *data, + struct ucred *active_cred, struct thread *td) +{ + struct ntsync_mutex_args aa; + int error, error1; + bool doco; + + doco = false; + switch (com) { + case NTSYNC_IOC_MUTEX_UNLOCK: + error = ntsync_mutex_unlock(td, fp, data); + break; + case NTSYNC_IOC_MUTEX_KILL: + error = ntsync_mutex_kill(td, fp, *(uint32_t *)data); + break; + case NTSYNC_IOC_MUTEX_READ: + error = ntsync_mutex_read(td, fp, &aa, &doco); + if (doco) { + error1 = ntsync_ioctl_copyout(td, &aa, sizeof(aa)); + if (error1 != 0) + error = error1; + } + break; + default: + error = ENOTTY; + break; + } + return (error); +} + +static int +ntsync_mutex_stat(struct file *fp, struct stat *sbp, struct ucred *cred) +{ + struct ntsync_obj *obj; + struct ntsync_obj_mutex *mutex; + + MPASS(fp->f_type == DTYPE_NTSYNC); + obj = fp->f_data; + MPASS(obj->type == NTSYNC_OBJ_MUTEX); + mutex = OBJ_TO_MUTEX(obj); + + memset(sbp, 0, sizeof(*sbp)); + sbp->st_mode = S_IFREG /* XXXKIB */ | S_IRUSR | S_IWUSR; + NTSYNC_PRIV_LOCK(obj->owner); + sbp->st_size = mutex->a.owner; + sbp->st_nlink = mutex->a.count; + NTSYNC_PRIV_UNLOCK(obj->owner); + return (0); +} + +static int +ntsync_mutex_fill_kinfo(struct file *fp, struct kinfo_file *kif, + struct filedesc *fdp) +{ + // XXXKIB + return (0); +} + +struct fileops ntsync_mutex_fops = { + .fo_read = invfo_rdwr, + .fo_write = invfo_rdwr, + .fo_truncate = invfo_truncate, + .fo_ioctl = ntsync_mutex_ioctl, + .fo_poll = invfo_poll, + .fo_kqfilter = invfo_kqfilter, + .fo_stat = ntsync_mutex_stat, + .fo_close = ntsync_mutex_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, + .fo_sendfile = invfo_sendfile, + .fo_fill_kinfo = ntsync_mutex_fill_kinfo, + .fo_flags = DFLAG_PASSABLE, +}; + +static int +ntsync_create_mutex(struct ntsync_mutex_args *args, struct ntsync_priv *priv, + struct thread *td) +{ + struct ntsync_obj_mutex *mutex; + int error; + + if ((args->owner != 0 && args->count == 0) || + (args->owner == 0 && args->count != 0)) + return (EINVAL); + + mutex = malloc(sizeof(*mutex), M_NTSYNC, M_WAITOK | M_ZERO); + mutex->obj.type = NTSYNC_OBJ_MUTEX; + mutex->obj.is_signaled = ntsync_mutex_is_signaled; + mutex->obj.consume = ntsync_mutex_consume; + mutex->obj.prepare = ntsync_mutex_prepare; + mutex->obj.commit = ntsync_mutex_commit; + mutex->obj.post_commit = ntsync_mutex_post_commit; + mutex->a = *args; + mutex->abandoned = false; + + error = ntsync_create_obj(&mutex->obj, &ntsync_mutex_fops, priv, td); + if (error != 0) + free(mutex, M_NTSYNC); + + return (error); +} + +static bool +ntsync_event_is_signaled(struct ntsync_obj *obj, + struct ntsync_wait_state *state, int index) +{ + struct ntsync_obj_event *event; + + MPASS(obj->type == NTSYNC_OBJ_EVENT); + NTSYNC_PRIV_ASSERT(obj->owner); + event = OBJ_TO_EVENT(obj); + return (event->a.signaled != 0); +} + +static void +ntsync_event_consume(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index) +{ + struct ntsync_obj_event *event; + + MPASS(obj->type == NTSYNC_OBJ_EVENT); + NTSYNC_PRIV_ASSERT(obj->owner); + MPASS(ntsync_event_is_signaled(obj, state, index)); + + event = OBJ_TO_EVENT(obj); + if (event->a.manual == 0) + event->a.signaled = 0; +} + +static bool +ntsync_event_prepare(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index, bool *stop) +{ + struct ntsync_obj_event *event; + + MPASS(obj->type == NTSYNC_OBJ_EVENT); + NTSYNC_PRIV_ASSERT(obj->owner); + event = OBJ_TO_EVENT(obj); + if (!ntsync_event_is_signaled(obj, state, index)) + return (false); + event->a1 = event->a; + return (true); +} + +static void +ntsync_event_commit(struct ntsync_obj *obj, struct ntsync_wait_state *state, + int index) +{ + struct ntsync_obj_event *event; + + MPASS(obj->type == NTSYNC_OBJ_EVENT); + NTSYNC_PRIV_ASSERT(obj->owner); + event = OBJ_TO_EVENT(obj); + event->a = event->a1; + if (event->pulse && event->a.manual == 0) { + event->a.signaled = 0; + event->pulse = false; + } +} + +static void +ntsync_event_post_commit(struct ntsync_obj *obj, + struct ntsync_wait_state *state, int index) +{ + struct ntsync_obj_event *event; + + MPASS(obj->type == NTSYNC_OBJ_EVENT); + NTSYNC_PRIV_ASSERT(obj->owner); + event = OBJ_TO_EVENT(obj); + if (event->a.manual == 0) + event->a.signaled = 0; +} + +static int +ntsync_event_close(struct file *fp, struct thread *td) +{ + struct ntsync_obj_event *event; + + event = fp->f_data; + ntsync_close_obj(&event->obj, td); + free(event, M_NTSYNC); + return (0); +} + +int +ntsync_event_set(struct thread *td, struct file *fp, uint32_t *val) +{ + struct ntsync_obj *obj; + struct ntsync_obj_event *event; + struct ntsync_priv *priv; + uint32_t prev; + + obj = fp->f_data; + if (obj->type != NTSYNC_OBJ_EVENT) + return (EINVAL); + event = OBJ_TO_EVENT(obj); + priv = obj->owner; + + NTSYNC_PRIV_LOCK(priv); + prev = event->a.signaled; + event->a.signaled = 1; + ntsync_wakeup_waiters(obj); + NTSYNC_PRIV_UNLOCK(priv); + + *val = prev; + return (0); +} + +int +ntsync_event_reset(struct thread *td, struct file *fp, uint32_t *val) +{ *** 675 LINES SKIPPED *** From nobody Sun May 31 17:19:55 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 4gT3kM6rcGz6gP1Z for ; Sun, 31 May 2026 17:19:55 +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 4gT3kM3qftz3W4X for ; Sun, 31 May 2026 17:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780247995; 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=REvGbj+U9048ZnqUPTmjNp6x7JybAoRx8tI2IgYu1T8=; b=kIOnD763ShH0IvYn9ARgHGdUlp2xHzLMJm13zbY5rU9ynT+l0TymQ7oqbPb/3eY3At1YVk zjt1VvQFEnLi2O4VZF+2in/NMf7j/9HtIUyyITxjlfX2gU0N1XZE/agk4cX4sU+WxDDCFz 6hBcQGaPtrLmH6VJyx8C4kxh4dmZoMYY/OPMWu6D8VK9vgTgUzgH4HvYxz/ML05TiAsejH 0YEciEbn4A3XBFni2vTiI78AWfLAIXPTe1Mj6rZ3G/Fluf6NbUJYtLGgd92HR1db9z9yAg SZ0Cw+vxvR+MOs9eGES/pdu3Xtn9uFa+xcUJtP9Whjb48fAZW45xYrtpphSH4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780247995; a=rsa-sha256; cv=none; b=mlab4v1MM+fNtlHyGSXncCnVV7MAnj4SHAnWHD1JUnpA6U3D3EoGXSQcqh3tcRzlBKlpC6 SJG7M48dRQaTBiciLcbpIEBYbh4grHyaGMG3VpsC3100qtlGPa+Fd20QRmDtEh818wpIQ8 uTsj5IsONTa7j13JUWaXyAijXut+bO9/TEbvVNWLI1ZGDahX3xAuXW/F4hUegBQejyH+29 3NwI37rsKvWFIHuDVz7L9sW/Zkogwc1UEZ5hQYmaHGfdLXd2Vh/xQh7CY2FLfAWBA4wnBA +5cK3vS9m2nkDz7beXDE8CSrzUOtA7pqFEUBpNw4Kj4YOQ0jx2w/MsHQd2/RuQ== 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=1780247995; 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=REvGbj+U9048ZnqUPTmjNp6x7JybAoRx8tI2IgYu1T8=; b=eXcm9no5b4mADFKIy9yO6ehfrVSzj+5bJB9a1YDejCC0GRC2A5nN2kulb9KJLT0ZiD8gx0 eJu07KxeUIiVMH+gUigcnVps5FpOQKJuhF3ZYwnretsXH6bGOakrgw5HivyzM7jVn1cPlV b5xLc4cLvLhiZ6D1Nhb5n5mPKDteaCmELibOKgl3KvoD5gFU2plfXyVGSQH+YTd0T0JZ0L ZsNvbye3F/Qghp94Qi3cCnZodEg5ClNyCOt2O+H4/YR3s1KJUlfA4UkNfRxYLVW3K2666W 6CLhMSscNh8Wi4SnDZH6BxypuFqkxJ8iZe5bMvCrUiUH/ignvp/2FgEmCPAorw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gT3kM2x2hz117T for ; Sun, 31 May 2026 17:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e736 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 17:19:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0ac9aac81c40 - main - ntsync: install headers for userspace consumption 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ac9aac81c40159d561e43fc6976a866f852832b Auto-Submitted: auto-generated Date: Sun, 31 May 2026 17:19:55 +0000 Message-Id: <6a1c6dbb.3e736.c6ca4d5@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0ac9aac81c40159d561e43fc6976a866f852832b commit 0ac9aac81c40159d561e43fc6976a866f852832b Author: Konstantin Belousov AuthorDate: 2026-05-17 07:43:01 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-31 17:14:47 +0000 ntsync: install headers for userspace consumption Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57038 --- etc/mtree/BSD.include.dist | 2 ++ include/Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index ce37d803c2a9..81ea0842035c 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -235,6 +235,8 @@ mpilib .. .. + ntsync + .. nvme .. nvmf diff --git a/include/Makefile b/include/Makefile index 777529e344f2..3d83556f5238 100644 --- a/include/Makefile +++ b/include/Makefile @@ -51,7 +51,7 @@ LDIRS= geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= dev/acpica dev/agp dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ - dev/ic dev/iicbus dev/io dev/mfi dev/mmc \ + dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/ntsync \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd dev/wg \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ From nobody Sun May 31 17:19:56 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 4gT3kP0t0zz6gPBl for ; Sun, 31 May 2026 17:19: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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gT3kN42jyz3W01 for ; Sun, 31 May 2026 17:19:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780247996; 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=+v2h5CAMLgNTTFPWNkMDB2vBCUNUsfrPjfnEOe36qcE=; b=u0RMqnRiNf5UYY6x9JJEimge/TuuntJ9Mix/afD93br43SiyQ+U6VYMnlrrjw4lDDiGX9U jt1IZAsx07x0+mI9czs0k39HxeWEmNgisgYLmYEg5s8tuyYq230GkY55PpjhNlqgAH3Q8B +0VDVRpzZU/dI0ocPhDIbg4gev9GLSVjDcVKDUpAdy4UZwOG2dsVZX6NpVpvOBGl1v4dz9 VKDdHCq9D4Mispu8uqGzM8jDOtrtAkE1LdunlEvDWP2r6mEXeCgTJ4wrhtFJeZmGavMfQ/ Ikf4orUu5u9mVdDC+piysVcxi8HGsg/jsQtJuFaupF6URF9QayehDsE4uYm0EA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780247996; a=rsa-sha256; cv=none; b=r0CLAupiWTG5YzIJ2OzuUBQ5eJ9QxAF6EKNNz9l3hmqrDDlVM5oWXaquivndeZifZBKRfv qMMLpgG/zUt/00d0o5kVIeVs5D8uB4+ZfTRMGuFpRPP2lh1KV69gKO7cXt5WdFq4b08aJU NcynZKp73840ML4FfrmQttvk5SEnwH5gdfo52u+/De0pmxvt0p9yC3fXzNTqBopFaWaAvp ZRpcp5PyXOKcpYLhPEXGdF1XrJVRstVIClL7WFBMELGMipD434lc07oRUWOP3I0usYWnkM g2b0J51hFO7lycpfNqXNsdY87Yrbw/c3mFDdjxwh0M5+xAB3s5T8GMT8TiR7ew== 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=1780247996; 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=+v2h5CAMLgNTTFPWNkMDB2vBCUNUsfrPjfnEOe36qcE=; b=RnJ+1vVVFFs1s1r6m662WMn0QNuCamSLUE+nksjJ7PvGeY4Y453mlqZlCNZt+zqrmF/dmL Cvy0I5Tzk9UjCtOkybJP9JGSSJr+gakk1Pwpu5NmlOcgnYm16ASa8YerS1YVX55CrWxGR6 UfZ8U7f2u4/Dat7fZrHMvd8PVfG3VuYdFBFbhBwSNs7UMn4+MqxcYkDgHAd3Cnv+Vx1QFD XcxlAnVZQqw5o087qh/7CcunYFfaJrJvG2FEAWxq8E135YloReqdl+PnKgYJP1tzlazHj6 2G6nMW6+OKafQoluifhNhCVd7ADuWeFZIzO9jVET8YliFQMg8Wx/3WFumW71XQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gT3kN3KJzz10w9 for ; Sun, 31 May 2026 17:19:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e231 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 17:19:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d0ea3aff9065 - main - ntsync: add kinfo reporting 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d0ea3aff90655be3cdb34d86a4a97be6fc85d919 Auto-Submitted: auto-generated Date: Sun, 31 May 2026 17:19:56 +0000 Message-Id: <6a1c6dbc.3e231.8af7108@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d0ea3aff90655be3cdb34d86a4a97be6fc85d919 commit d0ea3aff90655be3cdb34d86a4a97be6fc85d919 Author: Konstantin Belousov AuthorDate: 2026-05-18 07:13:31 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-31 17:14:47 +0000 ntsync: add kinfo reporting Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57038 --- sys/dev/ntsync/ntsync.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- sys/sys/user.h | 24 ++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/sys/dev/ntsync/ntsync.c b/sys/dev/ntsync/ntsync.c index 8b0984d12c75..a7b002de7cb6 100644 --- a/sys/dev/ntsync/ntsync.c +++ b/sys/dev/ntsync/ntsync.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static struct cdev *ntsync_cdev; @@ -484,7 +485,19 @@ static int ntsync_sem_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) { - // XXXKIB + struct ntsync_obj *obj; + struct ntsync_obj_sem *sem; + + MPASS(fp->f_type == DTYPE_NTSYNC); + obj = fp->f_data; + MPASS(obj->type == NTSYNC_OBJ_SEM); + sem = OBJ_TO_SEM(obj); + + kif->kf_type = KF_TYPE_NTSYNC; + kif->kf_un.kf_ntsync.kf_ntsync_type = KF_NTSYNC_TYPE_SEM; + kif->kf_un.kf_ntsync.kf_ntsync_dev = (uintptr_t)obj->owner; + kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_sem.count = sem->a.count; + kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_sem.max = sem->a.max; return (0); } @@ -778,7 +791,21 @@ static int ntsync_mutex_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) { - // XXXKIB + struct ntsync_obj *obj; + struct ntsync_obj_mutex *mutex; + + MPASS(fp->f_type == DTYPE_NTSYNC); + obj = fp->f_data; + MPASS(obj->type == NTSYNC_OBJ_MUTEX); + mutex = OBJ_TO_MUTEX(obj); + + kif->kf_type = KF_TYPE_NTSYNC; + kif->kf_un.kf_ntsync.kf_ntsync_type = KF_NTSYNC_TYPE_MUTEX; + kif->kf_un.kf_ntsync.kf_ntsync_dev = (uintptr_t)obj->owner; + kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_mutex.owner = + mutex->a.owner; + kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_mutex.count = + mutex->a.count; return (0); } @@ -1053,7 +1080,21 @@ static int ntsync_event_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) { - // XXXKIB + struct ntsync_obj *obj; + struct ntsync_obj_event *event; + + MPASS(fp->f_type == DTYPE_NTSYNC); + obj = fp->f_data; + MPASS(obj->type == NTSYNC_OBJ_EVENT); + event = OBJ_TO_EVENT(obj); + + kif->kf_type = KF_TYPE_NTSYNC; + kif->kf_un.kf_ntsync.kf_ntsync_type = KF_NTSYNC_TYPE_EVENT; + kif->kf_un.kf_ntsync.kf_ntsync_dev = (uintptr_t)obj->owner; + kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_event.signaled = + event->a.signaled; + kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_event.manual = + event->a.manual; return (0); } diff --git a/sys/sys/user.h b/sys/sys/user.h index e1a3897cd319..75e76f622c0d 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -269,6 +269,7 @@ struct user { #define KF_TYPE_TIMERFD 14 #define KF_TYPE_INOTIFY 15 #define KF_TYPE_JAILDESC 16 +#define KF_TYPE_NTSYNC 17 #define KF_TYPE_UNKNOWN 255 #define KF_VTYPE_VNON 0 @@ -289,6 +290,11 @@ struct user { #define KF_FD_TYPE_TEXT -5 /* Text vnode */ #define KF_FD_TYPE_CTTY -6 /* Controlling terminal */ +#define KF_NTSYNC_TYPE_DEV 1 /* Not reported, reserved */ +#define KF_NTSYNC_TYPE_SEM 2 +#define KF_NTSYNC_TYPE_MUTEX 3 +#define KF_NTSYNC_TYPE_EVENT 4 + #define KF_FLAG_READ 0x00000001 #define KF_FLAG_WRITE 0x00000002 #define KF_FLAG_APPEND 0x00000004 @@ -467,6 +473,24 @@ struct kinfo_file { uint64_t kf_inotify_npending; uint64_t kf_inotify_nbpending; } kf_inotify; + struct { + uint32_t kf_ntsync_type; + uint64_t kf_ntsync_dev; + union { + struct { + uint32_t count; + uint32_t max; + } kf_ntsync_sem; + struct{ + uint32_t owner; + uint32_t count; + } kf_ntsync_mutex; + struct { + uint32_t signaled; + uint32_t manual; + } kf_ntsync_event; + } kf_ntsync_un; + } kf_ntsync; } kf_un; }; uint16_t kf_status; /* Status flags. */ From nobody Sun May 31 17:19:57 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 4gT3kQ0zqsz6gPGd for ; Sun, 31 May 2026 17:19:58 +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 4gT3kP4lBWz3W4t for ; Sun, 31 May 2026 17:19:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780247997; 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=FittZrSW2dQqKEMsdrU6aFgxnxiRBXD+KzIb36ZIt84=; b=OhGCaLUOmVfwIRiPGKo6MTxMOjIckZqaXuHyZJwMl9yAXLHDNRXfpb4wEInXbsVjlRdXl+ GK6Ra8RWyJDC0FEWIAgJQHqsXg13VYyqqgWOSSYUmkZCkcxnjlFpzHhOF6xJcDRbc9qr3Y TojBHBITkWtWXkC9xoKZUM9a//x51DPct4tqXlnfI6Z1AfJJmBFWzPSqrRXBceZcHrWfQX iBCZpb8NFbweD/SR46uXuqYugN5msma1tD0V93pJ1AlK1OW8ABe5UOL2mbwCPybCCYzd2i zeVCS88cn/P6jcZmr/asNHwxUBwUMvQv78tieJw4ILHh8P35d4AswIwe1WMRhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780247997; a=rsa-sha256; cv=none; b=ThHz2kzitRfl4fRP5hSSoY6S2ussApIJ5ZptacseqY+a1kMPGHydCALyRyJMmyRNlVII2u i1Po39qcyQiRKKb2LUjkjbn0Yfh2WaW/M56ESlLuY0mnnx1Ux2HnsnCTGYgZljE4KpaWFb /E96vSSSfRi78tTOqHIH6iAt19D+Ogec64OJl3Iu/qIJSHgCXCPkMZE4RmuREijIXcsVks MPQw6wQToD4KKS9+2Q8WpV7Zwpq/2ApmqoiujwCW/sEYwv7p6cB3J2/CRsOQZVnCTWTGS5 VVuCrdKaQz9XaU0UcxL75+wsTZYhHnCVFwxtuu/c2hd9a+pXxVGzM+c8OdnKAA== 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=1780247997; 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=FittZrSW2dQqKEMsdrU6aFgxnxiRBXD+KzIb36ZIt84=; b=x1m05oe9WhBzj1OCtpuluwcbEB4vaP8ydF7bufF95PH7fo+8TA8XCs0DoQEIzy8fWQ6h6X l4YMYxdueHk8bsfv/j6c30NbBzNr4rSK3Ds0lCPAw4NPLpZTW35ACTHZXqhBSLJFuw4LU/ eEnUvdEq8UdhWSk/2I+b9ZzCXZZd+5mHQcu7ss8wv5HzZjTZc+D9o1Ti0mRHNGONl1H+Us 6aYOEBh+4EK2dj99xL5wEQK8Og9ncaUABAXrtUEhzY1/vlQi9Kp6a2pmXAyNzIBCX1fDrg gX1gUc5if0uceW/jE3idiPyhsXs2jqLtGoH/YWemGWg/dzxo8EoFnb1rAz+lzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gT3kP4Bxgz119K for ; Sun, 31 May 2026 17:19:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3efb2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 17:19:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 510ee6698d37 - main - linux_ntsync: linux compat shim for ntsync(9) 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 510ee6698d377f4a9a4eeb08d9dc17bdc72ad5ab Auto-Submitted: auto-generated Date: Sun, 31 May 2026 17:19:57 +0000 Message-Id: <6a1c6dbd.3efb2.7c6d34dd@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=510ee6698d377f4a9a4eeb08d9dc17bdc72ad5ab commit 510ee6698d377f4a9a4eeb08d9dc17bdc72ad5ab Author: Konstantin Belousov AuthorDate: 2026-05-19 02:23:33 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-31 17:17:07 +0000 linux_ntsync: linux compat shim for ntsync(9) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57038 --- sys/dev/ntsync/linux_ntsync.c | 302 ++++++++++++++++++++++++++++++++++++++ sys/dev/ntsync/linux_ntsync.h | 62 ++++++++ sys/modules/Makefile | 1 + sys/modules/linux_ntsync/Makefile | 6 + 4 files changed, 371 insertions(+) diff --git a/sys/dev/ntsync/linux_ntsync.c b/sys/dev/ntsync/linux_ntsync.c new file mode 100644 index 000000000000..064e8c6aede9 --- /dev/null +++ b/sys/dev/ntsync/linux_ntsync.c @@ -0,0 +1,302 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2026 The FreeBSD Foundation + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +MODULE_DEPEND(linux_ntsync, linux, 1, 1, 1); +MODULE_DEPEND(linux_ntsync, ntsync, 1, 1, 1); + +static linux_ioctl_function_t linux_ntsync_ioctl; +static struct linux_ioctl_handler linux_ntsync_handler = {linux_ntsync_ioctl, + LNTSYNC_IOCTL_MIN, LNTSYNC_IOCTL_MAX}; + +static int +linux_ntsync_modevent(module_t mod __unused, int type, void *data __unused) +{ + int error; + + error = 0; + switch (type) { + case MOD_LOAD: + error = linux_ioctl_register_handler(&linux_ntsync_handler); + if (error != 0) { + printf("linux_ntsync: cannot register ioctl handler, " + "error %d\n", error); + } else if (bootverbose) + printf("linux_ntsync\n"); + break; + + case MOD_UNLOAD: + linux_ioctl_unregister_handler(&linux_ntsync_handler); + break; + + case MOD_SHUTDOWN: + break; + + default: + error = EOPNOTSUPP; + } + + return (error); +} + +DEV_MODULE(linux_ntsync, linux_ntsync_modevent, NULL); +MODULE_VERSION(linux_ntsync, 1); + +/* XXXKIB no translation of structs */ +static void +ntsync_lsa_to_sa(struct ntsync_sem_args *sa, + const struct linux_ntsync_sem_args *lsa) +{ + memcpy(sa, lsa, sizeof(*sa)); +} + +static void +ntsync_sa_to_lsa(struct linux_ntsync_sem_args *lsa, + const struct ntsync_sem_args *sa) +{ + memcpy(lsa, sa, sizeof(*lsa)); +} + +static void +ntsync_lma_to_ma(struct ntsync_mutex_args *ma, + const struct linux_ntsync_mutex_args *lma) +{ + memcpy(ma, lma, sizeof(*ma)); +} + +static void +ntsync_ma_to_lma(struct linux_ntsync_mutex_args *ma, + const struct ntsync_mutex_args *lma) +{ + memcpy(ma, lma, sizeof(*ma)); +} + +static void +ntsync_lea_to_ea(struct ntsync_event_args *ea, + const struct linux_ntsync_event_args *lea) +{ + memcpy(ea, lea, sizeof(*ea)); +} + +static void +ntsync_ea_to_lea(struct linux_ntsync_event_args *lea, + const struct ntsync_event_args *ea) +{ + memcpy(lea, ea, sizeof(*lea)); +} + +static void +ntsync_lwa_to_wa(struct ntsync_wait_args *wa, + const struct linux_ntsync_wait_args *lwa) +{ + memcpy(wa, lwa, sizeof(*wa)); +} + +static void +ntsync_wa_to_lwa(struct linux_ntsync_wait_args *lwa, + const struct ntsync_wait_args *wa) +{ + memcpy(lwa, wa, sizeof(*lwa)); +} + +static int +linux_ntsync_cdev_ioctl(struct thread *td, u_long cmd, void *data, + struct file *fp) +{ + struct cdev *dev; + struct cdevsw *dsw; + struct vnode *vp; + struct file *fpop; + int error, ref; + + if (fp->f_type != DTYPE_VNODE) + return (error = ENOIOCTL); + + vp = fp->f_vnode; + if (vp->v_type != VCHR) + return (ENOIOCTL); + dev = vp->v_rdev; + dsw = dev_refthread(dev, &ref); + if (dsw == NULL) + return (ENXIO); + if (dsw != &ntsync_cdevsw) { + error = ENOIOCTL; + } else { + fpop = td->td_fpop; + td->td_fpop = fp; + error = dsw->d_ioctl(dev, cmd, data, 0, td); + td->td_fpop = fpop; + } + dev_relthread(dev, ref); + return (error); +} + +static int +linux_ntsync_ioctl(struct thread *td, struct linux_ioctl_args *args) +{ + struct file *fp; + void *data; + struct linux_ntsync_sem_args lsa; + struct linux_ntsync_mutex_args lma; + struct linux_ntsync_event_args lea; + struct linux_ntsync_wait_args lwa; + struct ntsync_sem_args sa; + struct ntsync_mutex_args ma; + struct ntsync_event_args ea; + struct ntsync_wait_args wa; + uint32_t val; + int error, error1, lcmd; + bool doco; + + lcmd = args->cmd; + data = (void *)args->arg; + + error = fget_cap(td, args->fd, &cap_no_rights, NULL, &fp, NULL); + if (error != 0) + goto out; + + doco = false; + switch (lcmd) { + case LNTSYNC_IOC_CREATE_SEM: + error = copyin(data, &lsa, sizeof(lsa)); + ntsync_lsa_to_sa(&sa, &lsa); + if (error == 0) { + error = linux_ntsync_cdev_ioctl(td, + NTSYNC_IOC_CREATE_SEM, &sa, fp); + } + break; + case LNTSYNC_IOC_CREATE_MUTEX: + error = copyin(data, &lma, sizeof(lma)); + ntsync_lma_to_ma(&ma, &lma); + if (error == 0) { + error = linux_ntsync_cdev_ioctl(td, + NTSYNC_IOC_CREATE_MUTEX, &ma, fp); + } + break; + case LNTSYNC_IOC_CREATE_EVENT: + error = copyin(data, &lea, sizeof(lea)); + ntsync_lea_to_ea(&ea, &lea); + if (error == 0) { + error = linux_ntsync_cdev_ioctl(td, + NTSYNC_IOC_CREATE_EVENT, &ea, fp); + } + break; + case LNTSYNC_IOC_WAIT_ANY: + error = copyin(data, &lwa, sizeof(lwa)); + ntsync_lwa_to_wa(&wa, &lwa); + if (error == 0) { + error = linux_ntsync_cdev_ioctl(td, + NTSYNC_IOC_WAIT_ANY, &wa, fp); + if (error == 0 || error == EOWNERDEAD) { + ntsync_wa_to_lwa(&lwa, &wa); + error1 = copyout(&lwa, data, sizeof(lwa)); + if (error == 0) + error = error1; + } + } + break; + case LNTSYNC_IOC_WAIT_ALL: + error = copyin(data, &lwa, sizeof(lwa)); + ntsync_lwa_to_wa(&wa, &lwa); + if (error == 0) { + error = linux_ntsync_cdev_ioctl(td, + NTSYNC_IOC_WAIT_ALL, &wa, fp); + if (error == 0 || error == EOWNERDEAD) { + ntsync_wa_to_lwa(&lwa, &wa); + error1 = copyout(&lwa, data, sizeof(lwa)); + if (error == 0) + error = error1; + } + } + break; + case LNTSYNC_IOC_SEM_RELEASE: + error = copyin(data, &val, sizeof(val)); + if (error == 0) { + error = ntsync_sem_release(td, fp, &val); + if (error == 0) + error = copyout(&val, data, sizeof(val)); + } + break; + case LNTSYNC_IOC_SEM_READ: + error = ntsync_sem_read(td, fp, &sa); + if (error == 0) { + ntsync_sa_to_lsa(&lsa, &sa); + error = copyout(&lsa, data, sizeof(lsa)); + } + break; + case LNTSYNC_IOC_MUTEX_UNLOCK: + error = copyin(data, &lma, sizeof(lma)); + ntsync_lma_to_ma(&ma, &lma); + if (error == 0) { + error = ntsync_mutex_unlock(td, fp, &ma); + if (error == 0) { + ntsync_ma_to_lma(&lma, &ma); + error = copyout(&lma, data, sizeof(lma)); + } + } + break; + case LNTSYNC_IOC_MUTEX_KILL: + error = copyin(data, &val, sizeof(val)); + if (error == 0) + error = ntsync_mutex_kill(td, fp, val); + break; + case LNTSYNC_IOC_MUTEX_READ: + error = ntsync_mutex_read(td, fp, &ma, &doco); + if (doco) { + ntsync_ma_to_lma(&lma, &ma); + error1 = copyout(&lma, data, sizeof(lma)); + if (error == 0) + error = error1; + } + break; + case LNTSYNC_IOC_EVENT_SET: + error = ntsync_event_set(td, fp, &val); + if (error == 0) + error = copyout(&val, data, sizeof(val)); + break; + case LNTSYNC_IOC_EVENT_RESET: + error = ntsync_event_reset(td, fp, &val); + if (error == 0) + error = copyout(&val, data, sizeof(val)); + break; + case LNTSYNC_IOC_EVENT_PULSE: + error = ntsync_event_pulse(td, fp, &val); + if (error == 0) + error = copyout(&val, data, sizeof(val)); + break; + case LNTSYNC_IOC_EVENT_READ: + error = ntsync_event_read(td, fp, &ea); + if (error == 0) { + ntsync_ea_to_lea(&lea, &ea); + error = copyout(&lea, data, sizeof(lea)); + } + break; + default: + error = ENOTTY; + break; + } + fdrop(fp, td); +out: + return (error); +} diff --git a/sys/dev/ntsync/linux_ntsync.h b/sys/dev/ntsync/linux_ntsync.h new file mode 100644 index 000000000000..412eca00bb1e --- /dev/null +++ b/sys/dev/ntsync/linux_ntsync.h @@ -0,0 +1,62 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Kernel support for NT synchronization primitive emulation + * + * Copyright (C) 2021-2022 Elizabeth Figura + */ + +#ifndef __LINUX_NTSYNC_H +#define __LINUX_NTSYNC_H + +#include + +typedef uint32_t __u32; +typedef uint64_t __u64; + +struct linux_ntsync_sem_args { + __u32 count; + __u32 max; +}; + +struct linux_ntsync_mutex_args { + __u32 owner; + __u32 count; +}; + +struct linux_ntsync_event_args { + __u32 manual; + __u32 signaled; +}; + +#define LINUX_NTSYNC_WAIT_REALTIME 0x1 + +struct linux_ntsync_wait_args { + __u64 timeout; + __u64 objs; + __u32 count; + __u32 index; + __u32 flags; + __u32 owner; + __u32 alert; + __u32 pad; +}; + +#define LNTSYNC_IOC_CREATE_SEM 0x40084e80 +#define LNTSYNC_IOC_WAIT_ANY 0xc0284e82 +#define LNTSYNC_IOC_WAIT_ALL 0xc0284e83 +#define LNTSYNC_IOC_CREATE_MUTEX 0x40084e84 +#define LNTSYNC_IOC_CREATE_EVENT 0x40084e87 +#define LNTSYNC_IOC_SEM_RELEASE 0xc0044e81 +#define LNTSYNC_IOC_MUTEX_UNLOCK 0xc0084e85 +#define LNTSYNC_IOC_MUTEX_KILL 0x40044e86 +#define LNTSYNC_IOC_EVENT_SET 0x80044e88 +#define LNTSYNC_IOC_EVENT_RESET 0x80044e89 +#define LNTSYNC_IOC_EVENT_PULSE 0x80044e8a +#define LNTSYNC_IOC_SEM_READ 0x80084e8b +#define LNTSYNC_IOC_MUTEX_READ 0x80084e8c +#define LNTSYNC_IOC_EVENT_READ 0x80084e8d + +#define LNTSYNC_IOCTL_MIN 0x4e80 +#define LNTSYNC_IOCTL_MAX 0x4eff + +#endif diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 9b31035aa89d..13100cd3fe54 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -543,6 +543,7 @@ SUBDIR+= fdt ${MACHINE_CPUARCH} == "i386" SUBDIR+= linprocfs SUBDIR+= linsysfs +SUBDIR+= linux_ntsync .endif .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SUBDIR+= linux diff --git a/sys/modules/linux_ntsync/Makefile b/sys/modules/linux_ntsync/Makefile new file mode 100644 index 000000000000..4e186c5cdf4f --- /dev/null +++ b/sys/modules/linux_ntsync/Makefile @@ -0,0 +1,6 @@ +.PATH: ${SRCTOP}/sys/dev/ntsync + +KMOD= linux_ntsync +SRCS= linux_ntsync.c + +.include From nobody Sun May 31 17:50:52 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 4gT4Q50dDwz6gRwr for ; Sun, 31 May 2026 17:50:53 +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 4gT4Q41bC1z3Zqk for ; Sun, 31 May 2026 17:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780249852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ihmu03l+LciSEP91HwODJpk1CXwffhFN+QZ0T5A6dME=; b=yaTqpJHcG8WK7Bxbfyv/DqD3gYjBmjflQOODl7yFDoYFleK0TcDV7okIlhz1KLZ0CBNvMK glcXxGg39/AQR9CP0kQiIPgI72HzQe7kO4lHu7R3JEaYtDGoBQzkueofKqW6Qo06WH2wWU CRzfLOOQQxzmb18lU534wKnjP1Qy189qFY+vNi4vjJIX5L+Vn1xsfLVJAuzZKG/d1H/knk KK5Pm6QuJmoNoUmcLZ33UIq2Gk0j4o2QDi6jDrboipH6X9pfyJC+RSmgK+5JsW69TvF8Kq Z94rdpV2/M7BztrPm+DQFGPjQDDzbxovqAJTUqQlyficR28m60cCPpI+8mx1Ww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780249852; a=rsa-sha256; cv=none; b=oPYqINZjou/t4KImR58qugE/XNil/4GH8qyLRCVvcT5PEVgoh9tEYefgCk79FM8Qgak+Qy NoBkktRwImRLomn7qboggBMRBosYey0zP/r2Bk0qm6z8Beu5EDLg8AHGrlF3pjzpdWzPyj TTYrkqMQCk00YK6nRUFq6TNSu42LH5nAchiZmYvO/8YzCshYx0+//Z9FxrsCrCIQ1jNC0l mtm8QLOIdKLgI1cCD6lkYiofx1ARXB16aDvRyNgxhJPxy6kWApgBF0XOxvSAJbe3BGfjFB Np7JKcgPV0/mwLlrB0PLxvWIPVKrSD1MYkyUGe9G3MW1I94sshKUD1UCGCz97g== 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=1780249852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ihmu03l+LciSEP91HwODJpk1CXwffhFN+QZ0T5A6dME=; b=j5sYQTc08giUKllGaBo02FBQRGWxq7gEALY1ZXPlOOzdQoDKOyNpOcixYMOJ8+zV/9EL1l RJITO87iGOpMbvEy8d6Ex0HmeMI/Es3un4C627iuOyFu/lZ4imstvrbwANf4XTxS2lESxf ch4IqkkGaffcDbGysfVdEwqRY97e30z78+isGLkJYukgTvlQ9VE+DG+aLsakfV4/gC/wEQ 0FMomg1/yXUMqtqPW2xQYtnFizVvVuWWd/6CIo9KbL/wVjyHI6Xlt+AZyJMIruRz/+mND7 BEncLEV0PWrDN/sD64laLFvzy6pzfG6040MawgAENP8t6gXxhvG1NEliS/tyYQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gT4Q40tTrz11nr for ; Sun, 31 May 2026 17:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c20a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 17:50:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Anaelle Cazuc From: Mitchell Horne Subject: git: 03c69dd90122 - main - pmc: add sapphire rapids model 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03c69dd90122c4ffa91a749f668a2ac8fa6843a2 Auto-Submitted: auto-generated Date: Sun, 31 May 2026 17:50:52 +0000 Message-Id: <6a1c74fc.1c20a.7850f8c9@gitrepo.freebsd.org> The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=03c69dd90122c4ffa91a749f668a2ac8fa6843a2 commit 03c69dd90122c4ffa91a749f668a2ac8fa6843a2 Author: Anaelle Cazuc AuthorDate: 2026-05-28 16:28:32 +0000 Commit: Mitchell Horne CommitDate: 2026-05-31 17:50:20 +0000 pmc: add sapphire rapids model This commit adds the sapphire rapids CPU model to hwpmc_intel.c, allowing hwpmc to be used on this CPU family. Reviewed by: mhorne MFC after: 3 days Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D57263 --- sys/dev/hwpmc/hwpmc_intel.c | 4 ++++ sys/sys/pmc.h | 1 + 2 files changed, 5 insertions(+) diff --git a/sys/dev/hwpmc/hwpmc_intel.c b/sys/dev/hwpmc/hwpmc_intel.c index 942cadfae4cf..4c8d0cd2e2bd 100644 --- a/sys/dev/hwpmc/hwpmc_intel.c +++ b/sys/dev/hwpmc/hwpmc_intel.c @@ -266,6 +266,10 @@ pmc_intel_initialize(void) cputype = PMC_CPU_INTEL_EMERALD_RAPIDS; nclasses = 3; break; + case 0x8F: + cputype = PMC_CPU_INTEL_SAPPHIRE_RAPIDS; + nclasses = 3; + break; } break; } diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index 21dbf48e976b..cf0382f66af3 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -111,6 +111,7 @@ extern char pmc_cpuid[PMC_CPUID_LEN]; __PMC_CPU(INTEL_ALDERLAKEN, 0xA1, "Intel AlderlakeN") \ __PMC_CPU(INTEL_GRANITE_RAPIDS, 0xA2, "Intel Granite Rapids") \ __PMC_CPU(INTEL_METEOR_LAKE, 0xA3, "Intel Meteorlake") \ + __PMC_CPU(INTEL_SAPPHIRE_RAPIDS, 0xA4, "Intel Sapphire Rapids") \ __PMC_CPU(PPC_7450, 0x300, "PowerPC MPC7450") \ __PMC_CPU(PPC_E500, 0x340, "PowerPC e500 Core") \ __PMC_CPU(PPC_970, 0x380, "IBM PowerPC 970") \ From nobody Sun May 31 19:19:04 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 4gT6Ms0Svvz6gbcg for ; Sun, 31 May 2026 19:19:05 +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 4gT6Mr6n9Gz3lZV for ; Sun, 31 May 2026 19:19:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780255145; 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=VMp0y3VnnAfaSSX519+Rk0MTJUqb6VbMlZoBaJcCMKs=; b=vRZSOf5X+0qqIY6e5BdEbHsGRwrDG9WOXNIj0vWrzL/1VEho6/ME8nzL08N2+OJJ68cRJt IORhbLm00XVqt11HLhsKdffiYITW6oPNWc4WNj6ljRTbH8fxO/BhDPwQUYgsygKpdbZAcF 5r9dOP4nqEPB8JW74MWIu0Gb9h36ygvrS3W3jeF4q0fBF9DtcgPgECOusDaXnVxcnPRw9D mNsUCK2O5oTHCDH0O/YZZR+Jzxx1Df3+RHxDDVpHF0QM5fsVsWEvf/SlutcB6woUNMzGqE Fz9mIwijcQz4TXhd9S5B3i+gSm/EeAlo0V0SOyTayZ77ZSayuxLLas3aVm0JKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780255145; a=rsa-sha256; cv=none; b=vQ8Dovwg0rUAiA7RW6ld1IyRXUzOBE+t4Vy8LKDPQ99XGV69S5BVN9xkls22OGhdtYR8+m FkdD7lzj9lnO4LjE6Eo2rgI8pC+4X6GI7SxAVNX8atyKG9rXyL2619PIKdEVJfE+xwClSO 2gSMwK+3c9fRfo4KRJHrbH8d6cjOwD5VWn6YDVHdZmO4dEZXlvp1dkmrx3q73fhs6JaK4c oCQCKHzVqUJ8GQQK9j91KoRHyBdw65jFjBidTPRMSaTOA+CWvdtM5l91htxa3jtRuYEwPR MvD149jYE8omY77PjnCFs6T3iGnC7EdzywDWwLzjxmkcEg03JIAJ8GMKri6caw== 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=1780255145; 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=VMp0y3VnnAfaSSX519+Rk0MTJUqb6VbMlZoBaJcCMKs=; b=sIh9SHGGGp0q3OhfufaSip2ydCSg8SufQufMMgK7ANE5DoYQCo3hUZ5jvQRS4EyieJ3kOM AGDIk7mSNa/Nvi2/IG8KF/Er+QRPIWCAibMVj6K7x37KwJ8YlM3qPqgArxkXgnEIDoXQf5 ruy3QjlpUyEyWMf9lJ95aZqTY3HY0J3cH6+LCEph4FKlCfBAeMs8LABNQQRZs+tKvpiDEB Nb2e57GwHpvFAK5izeON6qNr0U5bv5iyJOJcYENEAgit31PHAFm2OgUJUecX5WAlf6SRe4 t18MwYWGew8yqIGBez9/N2mqb8E6wANZoiszdUubN9ePoaR1brMpHw+tHO8hMQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gT6Mr5qqnz14JP for ; Sun, 31 May 2026 19:19:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 218f0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 19:19:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 963a92d63b74 - main - amd64: explain in more details why the slop is needed 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 963a92d63b7443d27588fb4260bd4226f7525117 Auto-Submitted: auto-generated Date: Sun, 31 May 2026 19:19:04 +0000 Message-Id: <6a1c89a8.218f0.4e9be02f@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=963a92d63b7443d27588fb4260bd4226f7525117 commit 963a92d63b7443d27588fb4260bd4226f7525117 Author: Konstantin Belousov AuthorDate: 2026-05-31 19:15:37 +0000 Commit: Konstantin Belousov CommitDate: 2026-05-31 19:18:46 +0000 amd64: explain in more details why the slop is needed Sponsored by: The FreeBSD Foundation MFC after: 1 week --- stand/man/loader.efi.8 | 3 +++ sys/amd64/amd64/machdep.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/stand/man/loader.efi.8 b/stand/man/loader.efi.8 index 32729ff519a2..d9ee55ee192e 100644 --- a/stand/man/loader.efi.8 +++ b/stand/man/loader.efi.8 @@ -261,7 +261,10 @@ Invalid syntax and the like are silently ignored. .Ss Staging Slop The kernel must parse the firmware memory map tables to know what memory it can use. +It also needs to allocate memory for the kernel page tables. Since it must allocate memory to do this, +without overwriting important structures, +for instance the trampoline page table, .Nm ensures there's extra memory available, called .Dq slop , diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 8df4868f5312..79bef08f8a64 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1273,6 +1273,13 @@ amd64_bsp_ist_init(struct pcpu *pc) * - there is a usable memory block right after the end of the * mapped kernel and all modules/metadata, pointed to by * physfree, for early allocations + * + * The memory block after the end of the kernel is important, loader + * must ensure that no critical data structures are put there. Among + * them is the trampoline page table, which must not be overwritten by + * the allocations until pmap_bootstrap() switches %cr3 to the initial + * version of the kernel page table. Size of the block is controlled + * by the 'staging_slop' command for loader.efi. */ vm_paddr_t __nosanitizeaddress __nosanitizememory amd64_loadaddr(void) From nobody Sun May 31 19:51:30 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 4gT75H466mz6gf2m for ; Sun, 31 May 2026 19:51:31 +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 4gT75G4lknz3rNf for ; Sun, 31 May 2026 19:51:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780257090; 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=TWkDkcWZprz+eizT9eJG6d/ybuvFJklFh3znNtyKivY=; b=xfsA7Gwd3uFngXDq6Dh0G7LPcSW/nviCKnfF2QdVIoUrS76YDo3RucyuaxHx4ZjSjk4+sR iclrJm050p+iU9u5EzvOqBeGFUcGT/x15SEimI3QZG4jcuqH4aFzA5t9E+yKsbOeka/228 wESkb/AmmJoMIPhVaf6TISjxO8TK+NeJmcmLUUZ9Xbmp1S9A10cuBjIqHDJPsAhcESGSQ/ L9vbjypxQpjhpjlqWKwLYoYcrnuSVonb6PA1JF47UtMxmBMK8yWa6TdOAyIAVVwRhVQhlH yCqv5fKUQ7JlHuA1BzJx/bvR3sV71dqrhHLqmJoj5pFWSIeKF+OYr3FKyBLfbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780257090; a=rsa-sha256; cv=none; b=SQFqPFOUX38jdXkABRglEQI1/r7eBB/c7vQHoch8fkQ/TDnu8oyB/oE6yuLAjrYBvDWlaI dhmj+EQSvtMdYgOJQlZJ7PooAoV4TQtRepfrOJxcLvN6/mIUVh9nKZxZigHhq1+iGaMlcx Pp98cdIMcy6t5tBpenUDAadJDtMA2YSbbVySV/fJa3XGhJRV5AerNVQDPqomSpFOPdVgT8 sBX+j1kOIe+AJT3+9TDh0lqkRsbhl8pPDS1SPOPRIK3kUALzb0y7/alqwz56eGtBlk07a+ 5B1ul/bjHAJZDIsh/zgi5A5AMHCAS0PR7BNFz38KQs3PuhtAbdtY80vsZgm1jA== 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=1780257090; 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=TWkDkcWZprz+eizT9eJG6d/ybuvFJklFh3znNtyKivY=; b=Dot/F7U0RJflv2fz8sWsxOFEjbQjjsjrdFh8KNjijxhMesLSVRp9fiiYzr6V9cF8Xce38L TK9IeDYUob/I5+hSrwbnspDgnPVdgoJqgoNq2fXyD2JlXIOJLp8R4OQf9OqUTQnKO8pFAW /5pHJdBpGWgcz7OdxETH6ElLpqK+LxQy/aFb0hlTrT9dWT04OIGCwMW1sZSwYVYz0UBkO4 xUDfam4LqkPSmDQwdhEahFGbuwbTZ7qxr1++Tgmi62iYxHSyWDWAH0Z6baioSL1OFsPqW5 OkzzTU4ETZGxNvS2/HUDAfEj/cKlJdmhQtcEJeoOAkDwfrpu6YQylSX2s2pXpw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gT75G4MVQz157J for ; Sun, 31 May 2026 19:51:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3037a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 31 May 2026 19:51:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: 439710cf003b - main - assert.h: Revert "Remove leading tabs for whitespace consistency" 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 439710cf003b7849d2119e9a7694d7b27ab6d70f Auto-Submitted: auto-generated Date: Sun, 31 May 2026 19:51:30 +0000 Message-Id: <6a1c9142.3037a.348e36a2@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=439710cf003b7849d2119e9a7694d7b27ab6d70f commit 439710cf003b7849d2119e9a7694d7b27ab6d70f Author: Robert Clausecker AuthorDate: 2026-05-31 19:47:36 +0000 Commit: Robert Clausecker CommitDate: 2026-05-31 19:49:23 +0000 assert.h: Revert "Remove leading tabs for whitespace consistency" This reverts commit 157c184689ea3d7b8b6bd89aff849e94f004aa0e. As per style(9), a tab goes after #define. This should not have been removed. Reported by: kib Fixes: 157c184689ea3d7b8b6bd89aff849e94f004aa0e. Pull Request: https://github.com/freebsd/freebsd-src/pull/2203 --- include/assert.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/assert.h b/include/assert.h index 75d3e62e8932..f1dcf2bb180c 100644 --- a/include/assert.h +++ b/include/assert.h @@ -46,11 +46,11 @@ #undef __assert_unreachable #ifdef NDEBUG -#define assert(...) ((void)0) -#define _assert(...) ((void)0) +#define assert(e) ((void)0) +#define _assert(e) ((void)0) #if __BSD_VISIBLE -#define __assert_unreachable() __unreachable() -#endif /* __BSD_VISIBLE */ +#define __assert_unreachable() __unreachable() +#endif /* __BSD_VISIBLE */ #else #ifdef __cplusplus #if __cplusplus < 202002L @@ -71,25 +71,25 @@ * of the remaining guarantees. * */ -#define __assert_sanitize(...) ((void)0) +#define __assert_sanitize(...) ((void)0) #else -#define __assert_sanitize(...) (void)sizeof(((bool(*)(bool))0)(__VA_ARGS__)) +#define __assert_sanitize(...) (void)sizeof(((bool(*)(bool))0)(__VA_ARGS__)) #endif /* __cplusplus < 202002L */ #else -#define __assert_sanitize(...) (void)sizeof(((_Bool(*)(_Bool))0)(__VA_ARGS__)) +#define __assert_sanitize(...) (void)sizeof(((_Bool(*)(_Bool))0)(__VA_ARGS__)) #endif /* __cplusplus */ -#define assert(...) (__assert_sanitize(__VA_ARGS__), \ +#define assert(...) (__assert_sanitize(__VA_ARGS__), \ (__VA_ARGS__) ? (void)0 : \ __assert(__func__, __FILE__, \ __LINE__, #__VA_ARGS__)) -#define _assert(...) assert(__VA_ARGS__) +#define _assert(...) assert(__VA_ARGS__) #if __BSD_VISIBLE -#define __assert_unreachable() assert(0 && "unreachable segment reached") -#endif /* __BSD_VISIBLE */ +#define __assert_unreachable() assert(0 && "unreachable segment reached") +#endif /* __BSD_VISIBLE */ #endif /* NDEBUG */ #ifndef __STDC_VERSION_ASSERT_H__ -#define __STDC_VERSION_ASSERT_H__ 202311L +#define __STDC_VERSION_ASSERT_H__ 202311L /* * Static assertions. In principle we could define static_assert for @@ -105,7 +105,7 @@ */ #if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) && \ __STDC_VERSION__ < 202311L -#define static_assert _Static_assert +#define static_assert _Static_assert #endif __BEGIN_DECLS