From nobody Mon Jun 30 04:37:34 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bVtgL69NTz5ywg9; Mon, 30 Jun 2025 04:37: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bVtgL5KSkz3Wfv; Mon, 30 Jun 2025 04:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751258254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TmU+gqwOPKJtOmUOnDgiXGbeKvVm9utFyC5oI3lNyBA=; b=JIi6WETj+oy0YcfFcM0Sa6mmirMxrN6IDw/S0OEa3j/SOrO7zXA1E0dsVC+mFg2Fe8F5Ew E3tSL3quOjNfuDyz0LhpBdTJguXrHKQJUJgXB1BR5hFlokp5ztnJo5+a1A2JoowF0Gno+O SSQ93BfJYi4PRwk6b9QJ81+NQNfvHcUORdjqWMUIpVZdKoRn8UhzWgNAUSJUQvk9CS/18/ 9Qr+QZHlpIclIRwBvrxQxYUkMGJkPN2THuDWgBhcJc41HY9aiAHmKbpIMkBy8oIrId8gRk odKXs2yN9bCY7XuB4a+7g8+a9s4lPGXZUuzcdF81PpJFDqDHiRbrRWP6R6ESxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751258254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TmU+gqwOPKJtOmUOnDgiXGbeKvVm9utFyC5oI3lNyBA=; b=iPI2R+5bbQTusGvdNvaYyahowMahUvc2hmDQON74VQeE4ecrpMGL7zsS0RDeqNqq1+tyWU RVLsZHzrpWR82w6x4HdI2VBHL57IKu43J1OEtJ2r7BeovkjVMGLO+P3QPSAm70hkQ2+GiH RihBsww8dvwOIilCP21bGBd7U7t6XyHT2lelqDF4fmuOOIZsxRKvmrnKXAUBJ1GIE9CdOi boLVQ6tpdr46BCKVA6DQIWr6EWTvmU/lMtmmGBZKCh+0VT1Onqg9jA+Ao6ec3fgjz6h4lo oH337t2W8Q4T0eHUVzJB8JnLTvX1KjXcEafc7zYj472drbbWISHnP74iKXgyxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751258254; a=rsa-sha256; cv=none; b=QLj7aRtAc7TyO/LyXuY99AcmX/euN+pNaIvLmdNnH6EGCsmnp6y3GeBLvkdHGam34Adnzc kxHBv9seXHGJy3j/r/TDGy4zXR7wPLBh4VLdmSxs7TyYOBSI37rgGNteO/TTnp8n78xkc1 E3o47YnsRPY4B/GrARwQyu6UolF1DKBHGd60pZ6t+8JW1jYRko8mKOimoAgmmMPXnjI+Zc 3iowZXFkqElD2y/TiVMpECpcngg8UYeaQSzf82gtfQgolM4L3DoyVYL8kZLyvBPtYW+zFq pedhSyNMiLuoRP9tL+JlmZZwZVccXq9DCEuQg5LedYeWanDkcm/pAXlFcqSShA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bVtgL4Q9yzpdq; Mon, 30 Jun 2025 04:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U4bYRN063747; Mon, 30 Jun 2025 04:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U4bY0U063744; Mon, 30 Jun 2025 04:37:34 GMT (envelope-from git) Date: Mon, 30 Jun 2025 04:37:34 GMT Message-Id: <202506300437.55U4bY0U063744@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wolfram Schneider Subject: git: 9a26b661ac5b - stable/14 - mididumpl.1: update link to Standard MIDI-File Format Spec. 1.1, updated List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9a26b661ac5bed21364d89bb58e2836099ccce93 Auto-Submitted: auto-generated The branch stable/14 has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=9a26b661ac5bed21364d89bb58e2836099ccce93 commit 9a26b661ac5bed21364d89bb58e2836099ccce93 Author: Wolfram Schneider AuthorDate: 2025-06-23 05:36:51 +0000 Commit: Wolfram Schneider CommitDate: 2025-06-30 04:36:45 +0000 mididumpl.1: update link to Standard MIDI-File Format Spec. 1.1, updated PR: 287588 MFC after: 1 week (cherry picked from commit 27aec148ea4bfa2ccd2170ed1ccc6665aa819607) --- usr.bin/mididump/mididump.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/mididump/mididump.1 b/usr.bin/mididump/mididump.1 index 7b2bc649eb24..2f7f75d41e2d 100644 --- a/usr.bin/mididump/mididump.1 +++ b/usr.bin/mididump/mididump.1 @@ -64,7 +64,7 @@ argument corresponds to the MIDI device (e.g. .Re .Rs .%T Standard MIDI-File Format Spec. 1.1, updated -.%U https://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html +.%U https://midimusic.github.io/tech/midispec.html .Re .Rs .%T MIDI CC List for Continuous Controllers From nobody Mon Jun 30 09:54:31 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1j43PLdz60GHH; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1j36ZS8z3fBv; Mon, 30 Jun 2025 09:54:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n2PP9dkU5MxiwI/9jJUYrs4KicmW8O5l/3iVU9HfCTU=; b=XB2T7OwfsYXMrvaubjwgpv9ReNbcEjcZwNY1FSyalDutD8m0bakW08g8/qTYVElk8VgCdf dhVWDheDM7vE/y2OxiQ0HBRPVkVxAO4YcWQx25GJxkDrvGl38L9q7PUq+9qEM8VwVQykNk +WR7qWxj2Tk3OOGKgwQCRlRavNVgUcwPk/giDbRrMv9FsVl2S+MR1/vEXCQ+5XtHETRS02 Pdfwt9ZJVkz4OklLIYvFkQSYfY0hhTGz1oHKt9cfqVXRxU1GvM5i5S1+5cRMr3arN3I+Yl P9u8fLGwkH3AqXkfTJujXDfFDmFV08Xu9Y+DCNtII+6IbR33sVQFmSeb+Lma4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n2PP9dkU5MxiwI/9jJUYrs4KicmW8O5l/3iVU9HfCTU=; b=IKRqozgEeaOrGYp5KUARSJpgkdOkdJDvGR2diUgd838Eu+71mIBp3vaP1IZKOVwo7RidAl AupjXYcgJWLuPRmfUZRQ4Nv2bLkXh3fhSDrgbzrzX/E4PV0surRWBDIfNk2e+l1tSAt10z 5Ed0DGxp4cmDtAOPRB1EJTNHWrSPAFvGyUMMMeBczSeW0wRgMAy6PU+K6PXlwGEB1Yl92B 47jcKAD2v6o5RxzB6bR5hPut1Rv+5bQ+UFKYVRkzR0S2X5rCpYnLXEcbQgxE7zvZve2g9S W+pzRS9x1OKlT2eBRZwUnQ6/qzLJsBKCN1tQ6OP2MT+tbq4Z0OuRaUOChg8Gsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277271; a=rsa-sha256; cv=none; b=OdHuC1iy0XIz3VOMhCLjxpyit3ngYmhoobFnvavL+yL1v33CBItQIVikxZ/an4E391Zmm+ 4pl0BhL+IHwoR38g0p6hAHF0jTZyKksfNeYJBx1nwkQpgAKlo47xIpbnGlC2aNwQNzeodL mmAYf/lQZwN9E7mELWvELEb/wtr2q1OjqJlDZbxxDsSMWfOFUJM5gtcfWqZ1mW7hRW7ZeY 6A1QXAFJ4Tl81NjT+GzB0tDz05w5bYgdfSJrJ/qPcNUGSieoc4nas5yGPXj6R7HWNMZu2R dAbpVUAjjn2WiyOpwg+RuPWfJzIQ2HfkwGsB19QE9E64RmdeBWWSNRqP0mavvA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1j35zvZz10Yb; Mon, 30 Jun 2025 09:54:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9sVHk064212; Mon, 30 Jun 2025 09:54:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sVvw064209; Mon, 30 Jun 2025 09:54:31 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:31 GMT Message-Id: <202506300954.55U9sVvw064209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 13358e47edbc - main - pfctl: fix anchor rules with filter opts, introduce filteropts_to_rule() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13358e47edbcde3b1d3c2bdb071b908f1d2a4688 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=13358e47edbcde3b1d3c2bdb071b908f1d2a4688 commit 13358e47edbcde3b1d3c2bdb071b908f1d2a4688 Author: Kristof Provost AuthorDate: 2025-06-25 08:57:18 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:53:25 +0000 pfctl: fix anchor rules with filter opts, introduce filteropts_to_rule() Some filter options were parsed but not set on anchor rules due to missing copies of the respective struct members: $ cat pf.conf queue rq on trunk0 bandwidth 1G queue dq parent rq bandwidth 1G default anchor a set queue dq $ pfctl -vnf pf.conf | fgrep queue anchor "a" all Fix this by moving common code from `anchorrule' and `pfrule' into a new helper filteropts_to_rule(). Input from henning and benno OK henning sashan jca Obtained from: OpenBSD, kn , 27a127e0be Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 240 +++++++++++++++++++++++------------------------------ 1 file changed, 102 insertions(+), 138 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 9b89dc7642c5..ec1681e4a27d 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -424,6 +424,7 @@ int invalid_redirect(struct node_host *, sa_family_t); u_int16_t parseicmpspec(char *, sa_family_t); int kw_casecmp(const void *, const void *); int map_tos(char *string, int *); +int filteropts_to_rule(struct pfctl_rule *, struct filter_opts *); struct node_mac* node_mac_from_string(const char *); struct node_mac* node_mac_from_string_masklen(const char *, int); struct node_mac* node_mac_from_string_mask(const char *, const char *); @@ -1021,38 +1022,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto r.direction = $3; r.quick = $4.quick; r.af = $6; - r.prob = $9.prob; - r.rtableid = $9.rtableid; - r.ridentifier = $9.ridentifier; - r.pktrate.limit = $9.pktrate.limit; - r.pktrate.seconds = $9.pktrate.seconds; - r.max_pkt_size = $9.max_pkt_size; - - if ($9.tag) - if (strlcpy(r.tagname, $9.tag, - PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) { - yyerror("tag too long, max %u chars", - PF_TAG_NAME_SIZE - 1); - YYERROR; - } - if ($9.match_tag) - if (strlcpy(r.match_tagname, $9.match_tag, - PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) { - yyerror("tag too long, max %u chars", - PF_TAG_NAME_SIZE - 1); - YYERROR; - } - r.match_tag_not = $9.match_tag_not; - if (rule_label(&r, $9.label)) - YYERROR; - for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) - free($9.label[i]); - r.flags = $9.flags.b1; - r.flagset = $9.flags.b2; - if (($9.flags.b1 & $9.flags.b2) != $9.flags.b1) { - yyerror("flags always false"); - YYERROR; - } + if ($9.flags.b1 || $9.flags.b2 || $8.src_os) { for (proto = $7; proto != NULL && proto->proto != IPPROTO_TCP; @@ -1070,7 +1040,8 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto } } - r.tos = $9.tos; + if (filteropts_to_rule(&r, &$9)) + YYERROR; if ($9.keep.action) { yyerror("cannot specify state handling " @@ -1078,26 +1049,6 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto YYERROR; } - if ($9.match_tag) - if (strlcpy(r.match_tagname, $9.match_tag, - PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) { - yyerror("tag too long, max %u chars", - PF_TAG_NAME_SIZE - 1); - YYERROR; - } - r.match_tag_not = $9.match_tag_not; - if ($9.marker & FOM_PRIO) { - if ($9.prio == 0) - r.prio = PF_PRIO_ZERO; - else - r.prio = $9.prio; - } - if ($9.marker & FOM_SETPRIO) { - r.set_prio[0] = $9.set_prio[0]; - r.set_prio[1] = $9.set_prio[1]; - r.scrub_flags |= PFSTATE_SETPRIO; - } - decide_address_family($8.src.host, &r.af); decide_address_family($8.dst.host, &r.af); @@ -2417,66 +2368,11 @@ pfrule : action dir logquick interface route af proto fromto r.log = $3.log; r.logif = $3.logif; r.quick = $3.quick; - r.prob = $9.prob; - r.rtableid = $9.rtableid; - - if ($9.nodf) - r.scrub_flags |= PFSTATE_NODF; - if ($9.randomid) - r.scrub_flags |= PFSTATE_RANDOMID; - if ($9.minttl) - r.min_ttl = $9.minttl; - if ($9.max_mss) - r.max_mss = $9.max_mss; - if ($9.marker & FOM_SETTOS) { - r.scrub_flags |= PFSTATE_SETTOS; - r.set_tos = $9.settos; - } - if ($9.marker & FOM_SCRUB_TCP) - r.scrub_flags |= PFSTATE_SCRUB_TCP; - - if ($9.marker & FOM_PRIO) { - if ($9.prio == 0) - r.prio = PF_PRIO_ZERO; - else - r.prio = $9.prio; - } - if ($9.marker & FOM_SETPRIO) { - r.set_prio[0] = $9.set_prio[0]; - r.set_prio[1] = $9.set_prio[1]; - r.scrub_flags |= PFSTATE_SETPRIO; - } - - if ($9.marker & FOM_AFTO) - r.rule_flag |= PFRULE_AFTO; - r.af = $6; - if ($9.tag) - if (strlcpy(r.tagname, $9.tag, - PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) { - yyerror("tag too long, max %u chars", - PF_TAG_NAME_SIZE - 1); - YYERROR; - } - if ($9.match_tag) - if (strlcpy(r.match_tagname, $9.match_tag, - PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) { - yyerror("tag too long, max %u chars", - PF_TAG_NAME_SIZE - 1); - YYERROR; - } - r.match_tag_not = $9.match_tag_not; - if (rule_label(&r, $9.label)) - YYERROR; - for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) - free($9.label[i]); - r.ridentifier = $9.ridentifier; - r.flags = $9.flags.b1; - r.flagset = $9.flags.b2; - if (($9.flags.b1 & $9.flags.b2) != $9.flags.b1) { - yyerror("flags always false"); + + if (filteropts_to_rule(&r, &$9)) YYERROR; - } + if ($9.flags.b1 || $9.flags.b2 || $8.src_os) { for (proto = $7; proto != NULL && proto->proto != IPPROTO_TCP; @@ -2494,11 +2390,6 @@ pfrule : action dir logquick interface route af proto fromto } } - r.tos = $9.tos; - r.keep_state = $9.keep.action; - r.pktrate.limit = $9.pktrate.limit; - r.pktrate.seconds = $9.pktrate.seconds; - r.max_pkt_size = $9.max_pkt_size; o = $9.keep.options; /* 'keep state' by default on pass rules. */ @@ -2732,10 +2623,6 @@ pfrule : action dir logquick interface route af proto fromto if (r.keep_state && !statelock) r.rule_flag |= default_statelock; - if ($9.fragment) - r.rule_flag |= PFRULE_FRAGMENT; - r.allow_opts = $9.allowopts; - decide_address_family($8.src.host, &r.af); decide_address_family($8.dst.host, &r.af); @@ -2755,24 +2642,6 @@ pfrule : action dir logquick interface route af proto fromto YYERROR; } } - if ($9.queues.qname != NULL) { - if (strlcpy(r.qname, $9.queues.qname, - sizeof(r.qname)) >= sizeof(r.qname)) { - yyerror("rule qname too long (max " - "%d chars)", sizeof(r.qname)-1); - YYERROR; - } - free($9.queues.qname); - } - if ($9.queues.pqname != NULL) { - if (strlcpy(r.pqname, $9.queues.pqname, - sizeof(r.pqname)) >= sizeof(r.pqname)) { - yyerror("rule pqname too long (max " - "%d chars)", sizeof(r.pqname)-1); - YYERROR; - } - free($9.queues.pqname); - } #ifdef __FreeBSD__ r.divert.port = $9.divert.port; #else @@ -7703,3 +7572,98 @@ node_mac_from_string_mask(const char *str, const char *mask) return (m); } + +int +filteropts_to_rule(struct pfctl_rule *r, struct filter_opts *opts) +{ + r->keep_state = opts->keep.action; + r->pktrate.limit = opts->pktrate.limit; + r->pktrate.seconds = opts->pktrate.seconds; + r->prob = opts->prob; + r->rtableid = opts->rtableid; + r->ridentifier = opts->ridentifier; + r->max_pkt_size = opts->max_pkt_size; + r->tos = opts->tos; + + if (opts->nodf) + r->scrub_flags |= PFSTATE_NODF; + if (opts->randomid) + r->scrub_flags |= PFSTATE_RANDOMID; + if (opts->minttl) + r->min_ttl = opts->minttl; + if (opts->max_mss) + r->max_mss = opts->max_mss; + + if (opts->tag) + if (strlcpy(r->tagname, opts->tag, + PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) { + yyerror("tag too long, max %u chars", + PF_TAG_NAME_SIZE - 1); + return (1); + } + if (opts->match_tag) + if (strlcpy(r->match_tagname, opts->match_tag, + PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) { + yyerror("tag too long, max %u chars", + PF_TAG_NAME_SIZE - 1); + return (1); + } + r->match_tag_not = opts->match_tag_not; + + if (rule_label(r, opts->label)) + return (1); + for (int i = 0; i < PF_RULE_MAX_LABEL_COUNT; i++) + free(opts->label[i]); + + if (opts->marker & FOM_AFTO) + r->rule_flag |= PFRULE_AFTO; + if (opts->marker & FOM_SCRUB_TCP) + r->scrub_flags |= PFSTATE_SCRUB_TCP; + if (opts->marker & FOM_PRIO) { + if (opts->prio == 0) + r->prio = PF_PRIO_ZERO; + else + r->prio = opts->prio; + } + if (opts->marker & FOM_SETPRIO) { + r->set_prio[0] = opts->set_prio[0]; + r->set_prio[1] = opts->set_prio[1]; + r->scrub_flags |= PFSTATE_SETPRIO; + } + if (opts->marker & FOM_SETTOS) { + r->scrub_flags |= PFSTATE_SETTOS; + r->set_tos = opts->settos; + } + + r->flags = opts->flags.b1; + r->flagset = opts->flags.b2; + if ((opts->flags.b1 & opts->flags.b2) != opts->flags.b1) { + yyerror("flags always false"); + return (1); + } + + if (opts->queues.qname != NULL) { + if (strlcpy(r->qname, opts->queues.qname, + sizeof(r->qname)) >= sizeof(r->qname)) { + yyerror("rule qname too long (max " + "%d chars)", sizeof(r->qname)-1); + return (1); + } + free(opts->queues.qname); + } + if (opts->queues.pqname != NULL) { + if (strlcpy(r->pqname, opts->queues.pqname, + sizeof(r->pqname)) >= sizeof(r->pqname)) { + yyerror("rule pqname too long (max " + "%d chars)", sizeof(r->pqname)-1); + return (1); + } + free(opts->queues.pqname); + } + + if (opts->fragment) + r->rule_flag |= PFRULE_FRAGMENT; + r->allow_opts = opts->allowopts; + + return (0); +} From nobody Mon Jun 30 09:54:32 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1j53W0Xz60GT9; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1j46fdqz3f21; Mon, 30 Jun 2025 09:54:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ymrWkJJWAxoRq384sae9Ichg/4EQ96VMSXJpdgdyGls=; b=fj7q18CuawC1W7ivuxfUVc7c1o0L1OqA0/CM1E0MZ8bafNBBR2GqUgQ84sdr1T4+/vjqhj Q21W1zMJaMCbrmD0LqViFrQRVXx2nLZcAwryl+S7MhyBg0yjG8RbjcSNP4mu/l9qR7v4Gc ZtP3zqsVIuzqbZN74q429HJEQRHrGC2T6Ms7y8celesufYGpEfPeAkj4eMD9hRfDkqlToG OJ4lFTIrWBuEM60LRPT63uaA1QMP0SZrgfH7ceauvY19unSR3sWDMJ0dC72VKCAF7JzeF8 qcXguPrUUFjicZnkZLo+F1DZh78CJ3oUh87SzxOKAOMO0/dLnNVuIQA6hXwBGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ymrWkJJWAxoRq384sae9Ichg/4EQ96VMSXJpdgdyGls=; b=o1qdNwFo6vbI84NOoReMxJdWbL8DWGNxOtVZAOsthsPrRdcOr/WylCXbH0dBiAWyN9pn5M +TseksrjzgFjhXM20SJkEvKuCBXjurE5+JGkYBZsedf5D9KekhdV5p6NE1/hrKqVk8NcN5 0Zw5tarqv6hBPBTR6scrpo7xar4iRaz3epdZOjQBT7wPLRS3g+1T5ec8VqJ2k+qG9j/m0R crN6ier3e2DuJc1O9niOW4j/9wLytEbVAz6ydnbHDpyqcwHuFvzC+n0q5r+WnKnyK2/BGC wCuCjxg/Ecle27HdSfRl7Tl9hQwOWxXwxa5iIRac+O9bsnUReV2Rem9VQcTEFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277272; a=rsa-sha256; cv=none; b=iY16Vav91ZWDP6ifu7QPuycnH1PfbOwDqHZNRawgBmKN8iBAfASXL6xsNgnnEU9yJ8aRM4 qPP63Jia9yxD8U/fJ74Pm5aSD+kcX9VufGxFIuWmTwvrcw800Wk47iVf+LkJjtZZaXwNIh TQnOG5f/M2RcJV+j+2dVsm+puO+RMbchFRpdr8BWnA8RFhjdlWlaPgrV8Ef9Slxu/aoYyG DwI2GUeeNZmnPg+uYKJWlQfqwk2wnx0d5qaVwVatuNbch6MPT3/Psmw6sGN7756HIdg5zc Hr04rZPQ2tfNXsR8Wl1Fu5QZVEyVOk256Hp4pGDOwH2Kv92G4VysPyYYa3L97w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1j467Lfz10Yc; Mon, 30 Jun 2025 09:54:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9sWxc064257; Mon, 30 Jun 2025 09:54:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sW0Q064254; Mon, 30 Jun 2025 09:54:32 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:32 GMT Message-Id: <202506300954.55U9sW0Q064254@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 23c17bd60904 - main - pf tests: verify max-pkt-rate on anchors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23c17bd60904a4a6e02e935e11bc19301b41638d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=23c17bd60904a4a6e02e935e11bc19301b41638d commit 23c17bd60904a4a6e02e935e11bc19301b41638d Author: Kristof Provost AuthorDate: 2025-06-25 15:02:01 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:53:25 +0000 pf tests: verify max-pkt-rate on anchors Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/max_pkt_rate.sh | 65 ++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/tests/sys/netpfil/pf/max_pkt_rate.sh b/tests/sys/netpfil/pf/max_pkt_rate.sh index d1e92a64de1d..bdd140eb60dd 100644 --- a/tests/sys/netpfil/pf/max_pkt_rate.sh +++ b/tests/sys/netpfil/pf/max_pkt_rate.sh @@ -26,17 +26,8 @@ . $(atf_get_srcdir)/utils.subr -atf_test_case "basic" "cleanup" -basic_head() +common_setup() { - atf_set descr 'Basic maximum packet rate test' - atf_set require.user root -} - -basic_body() -{ - pft_init - epair=$(vnet_mkepair) ifconfig ${epair}a inet 192.0.2.2/24 up @@ -49,10 +40,10 @@ basic_body() ping -c 1 192.0.2.1 jexec alcatraz pfctl -e - pft_set_rules alcatraz \ - "block" \ - "pass in proto icmp max-pkt-rate 2/2" +} +common_test() +{ # One ping will pass atf_check -s exit:0 -o ignore \ ping -c 1 192.0.2.1 @@ -71,12 +62,60 @@ basic_body() ping -c 1 192.0.2.1 } +atf_test_case "basic" "cleanup" +basic_head() +{ + atf_set descr 'Basic maximum packet rate test' + atf_set require.user root +} + +basic_body() +{ + pft_init + + common_setup + + pft_set_rules alcatraz \ + "block" \ + "pass in proto icmp max-pkt-rate 2/2" + + common_test +} + basic_cleanup() { pft_cleanup } +atf_test_case "anchor" "cleanup" +anchor_head() +{ + atf_set descr 'maximum packet rate on anchor' + atf_set require.user root +} + +anchor_body() +{ + pft_init + + common_setup + + pft_set_rules alcatraz \ + "block" \ + "anchor \"foo\" proto icmp max-pkt-rate 2/2 {\n \ + pass \n \ + }" + + common_test +} + +anchor_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" + atf_add_test_case "anchor" } From nobody Mon Jun 30 09:54:33 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1j66rB0z60GHQ; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1j60fffz3f22; Mon, 30 Jun 2025 09:54:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JDBpPZ5v4WL1B62TZPWyu54ABJXD0d6SDtVkqwGfgA8=; b=ZQJaIOFz11ImuADJAJ3CFc0xphey03oNgGmup/4iLMgNcoJm7tSqKep+pZNXxwZ/PxRVbe WxEvOoBg8VeE9XG/SPqupcvdkiq6bwnHSswnM9KHTUHk467sYaSqbjDgde+f0dI3dpqd/y oBg0Pj3KkR9F/N9u3AbqzBfI/Tp6VFQr83RKbhrFeLf4rpwSDaHSMs+yrIQYmS7DGpK+1z 4bBmEZ2jnnKAdLplngF24Md6V/V76wpUQJz9DF3kHrUehb5isrIkb/1en8vQCIsNfPIv0k WiS0TgkKEhc8pqXHE15MpCEfu/7GG9IKTbmSrS0je3FVwcFfTIeIU6hgcIfgog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JDBpPZ5v4WL1B62TZPWyu54ABJXD0d6SDtVkqwGfgA8=; b=YdMWugB/qqlD4WQuEv6Es35BSob9gOugaFibhJMseVrTSTUrOr+Cv+VXxGwEsa36hL0DrZ 6gvtJeArd58xnBnUn4OgroxoBhUWMvfTtQ55LfMM5qk08qfEZTn8dOrMs4ty1T/uZ8sN8t Z+lP5kVgjue8te5Ku8NAa4jb8a0ic971TKZk2IVRQ5AiOHpydxO40r88SfFvH2ezw0JGdU PDkuDt0vGU4zIQoQy2evj7g6sa9WHEXKN8EbuXOL4pvb8AvTHCfHRiZ/17x4sL6ja3ty0+ 5D5wLL78XpqXCDX5qLRUwv3BsoiR5ODiyoH+P9f2ostLSBdhXl7v9VWyb6MLyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277274; a=rsa-sha256; cv=none; b=N2S2R+Tckg3jBgEGblRVSSaYyt4mMwR9JV1sNht9WySRD/n2/XN4psNb2bBA/fFd7ze3Dn 5kdSlUm34wMUEerxpFwB9JdyWIzwsOcIdPP5iUFlqHqTsDqAbt5O647OoJBdOfQBFgM60L aOeeuxyYBf2/0zMmJ3q8F4RDpg/Chgb2PG1hMLkN6nZbt7zyf5Nz8ogJTm8MvBE4RyKSrx ySM67wJhjyGq6FgK0omYG764JF+IZ4mP4GyfUhtJ7qaHhfTkxhBD6YRE5cFZW96tvQvyQW vHSHyXtJKUm/sypOUmsK45aLVTOWYWsimuvUa7TGdjUMr2vU2IG4tEfZ42jUGA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1j5711gz10Yd; Mon, 30 Jun 2025 09:54:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9sXGg064295; Mon, 30 Jun 2025 09:54:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sXEZ064292; Mon, 30 Jun 2025 09:54:33 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:33 GMT Message-Id: <202506300954.55U9sXEZ064292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e03181510de2 - main - pfctl: Add "listenrepv2" for MLDv2 Listener Reports from RFC3810 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e03181510de2a47e14cfc1206cbdbfe7b03a1515 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e03181510de2a47e14cfc1206cbdbfe7b03a1515 commit e03181510de2a47e14cfc1206cbdbfe7b03a1515 Author: Kristof Provost AuthorDate: 2025-06-26 13:13:04 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:53:26 +0000 pfctl: Add "listenrepv2" for MLDv2 Listener Reports from RFC3810 ok benno@ Obtained from: OpenBSD, jca , 42b7d0f07b Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index dbc7ff00782f..92debd6227e7 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -135,7 +135,8 @@ static const struct icmptypeent icmp6_type[] = { { "niqry", ICMP6_NI_QUERY }, { "nirep", ICMP6_NI_REPLY }, { "mtraceresp", MLD_MTRACE_RESP }, - { "mtrace", MLD_MTRACE } + { "mtrace", MLD_MTRACE }, + { "listenrepv2", MLDV2_LISTENER_REPORT }, }; static const struct icmpcodeent icmp_code[] = { From nobody Mon Jun 30 09:54:34 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1j75ByYz60GPW; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1j7179bz3fFf; Mon, 30 Jun 2025 09:54:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rv3p3/W8BaBZot3XGezX060nUiGGoX12l47TVqqDOLk=; b=UzRmgqSFkbQJgsWM3Pi5Pf6DvkgOABhtZwFbRwDS9pGh1htH7Wn481lReirCaE4TV5y2Wu 8/iZiCypq5kp43/aYeXWV3r5jkeo4NHlwCOPv1yGIPXh/tiEF1Mg1Z1woSGj4g6p/PxcTy 4N+AoGZcspCpptigy2tA/xrw3P4sLFx+Fk1YHP3T05TEmJgebwT2LbBd91Y3KKxIC8oLC5 6GdWvLG0MmiLLN1UGSzhCLQbento3hBAajyiemyfKEGAvINfMJ19boMnVoRSA2cweW3HQS w0MqwjZW+wAvJq4ui9OHsidPDec9MeQvdASe1ihffKNwWsE8lDvzo1H2SGvSeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rv3p3/W8BaBZot3XGezX060nUiGGoX12l47TVqqDOLk=; b=DFzO9kN++xfwYMZjlsVzo4Jh/ZsyypEeCqsmD4RG7T0amrdxnVNbhnzbtQjI9GAKxb2vSw w4j3tw7fyvZjv67hMZmX9b0GMnvZCLU2kMekJCJnRZdvYSPsWodqDh7L0XNqXVxTE8NuNv WA5gVBbf0P9M+BD06j747aM4rNPslHWm/ETuUFVgXcoVp66UqjHWwnOFOk0AEwAbs1r3p0 52+N715JTLcmaApgDCz56gtEWECkhu3poQy9/i7Ohbw/502qPV16soB9Hd6a7gimae+hTs IYjfw3VJubQ8AtkzKnxNBPtdUKnQbn6d71ABxBVnKaW184B8eRdpSb99s5mxrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277275; a=rsa-sha256; cv=none; b=Rkkgu5lpBbqKTuCIco5KxX7d/K2y+uAWJAbOEYqcKXvs585/uVMUb0S33fxV62P9xi4NZt 3MWwvXVYICEvAa7j0IhJM62PZDWF4Z0jJwVIq8dP2+yvHrY/XDtw3bvAa0SHGSucpUc3oz 7FG1hB9F8b068bC8syNDWpx2KOBtKwlllfPFDkQK1s4jvtiD64MRnv94VsUUI8oCTaup8q 7p2W8BDzbRwse5M4dkmqkPjahwJv8cpAalpjVijEgAegtT5IcjQO8b/zEKGEK9axUEpqzb QL9lvRYamkN1+XTECi0r2W0/6z4MM9J0sUYeWzOU1N4joSNlbiqY69+Pi4MDuA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1j70TS6z10Yf; Mon, 30 Jun 2025 09:54:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9sY9w064333; Mon, 30 Jun 2025 09:54:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sYir064329; Mon, 30 Jun 2025 09:54:34 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:34 GMT Message-Id: <202506300954.55U9sYir064329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 512f136f39c4 - main - pf.conf.5: reflect the new state limit List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 512f136f39c4423121cb72766c87acca5483276f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=512f136f39c4423121cb72766c87acca5483276f commit 512f136f39c4423121cb72766c87acca5483276f Author: Kristof Provost AuthorDate: 2025-06-26 13:38:57 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:53:26 +0000 pf.conf.5: reflect the new state limit where we were showing "set limit states 10000" make that 100k as well, and adjust adaptive.start/end as well (just like in the code) Obtained from: OpenBSD, henning , a47b29f6e6 Sponsored by: Rubicon Communications, LLC ("Netgate") --- share/man/man5/pf.conf.5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 5d802f81984f..3c9706063a65 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -27,7 +27,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 17, 2025 +.Dd June 26, 2025 .Dt PF.CONF 5 .Os .Sh NAME @@ -361,8 +361,8 @@ For example: .Bd -literal -offset indent set timeout tcp.first 120 set timeout tcp.established 86400 -set timeout { adaptive.start 6000, adaptive.end 12000 } -set limit states 10000 +set timeout { adaptive.start 60000, adaptive.end 120000 } +set limit states 100000 .Ed .Pp With 9000 state table entries, the timeout values are scaled to 50% From nobody Mon Jun 30 09:54:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1j874xcz60GHR; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1j81kxVz3dyy; Mon, 30 Jun 2025 09:54:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1bFB5lFZ+698rSMq+DQOrXY5GCNeaBnzFqxHSzGYRk8=; b=MYB61/FiytY+sEy4BhAZD+LofFs/2mfbBnT74k0ARLBxyMV/9bJswWQHQLK5RlxOUeYYSJ KFUqUREy0spugHlS8mTfF608io82yVxVGkZOEkyCCP4glIMhdAuXaqmh/rkpfxizRr5nqT WsSSabNPdh5AV3mrlrJkbuH1GftajaNmzIYY5u1l1vnGu+MInFTQ+FOKODRd4Qz4TqakqR xsAS8sexY4o86QmSbhyDrKdyS7wmUPUFcu/HKcdTjhssJZXkVzfB/XusxHHLEBgN7A1sX9 q/IYO38jcPKc7KieJ4yjDAFYD76gqU/1ETpCOePejQvT/05ar3y2dxCz6sVpCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1bFB5lFZ+698rSMq+DQOrXY5GCNeaBnzFqxHSzGYRk8=; b=PqhGkYcgsmzaoP94PxAEzMsWBVlvPkMAHiN63MvRjxCeRwJ2jhk2optL0ctZIxmZ4otxcq RF/jlckruRhYL5d3cWrpKiIRDZl6G6UdDFxqgBzxRGjCYkoQRIw0PPYdcYRyEyrLUoZkCe rFNk3ggDEBRZaAiSTIaTG5+MwUngkxKANyDTH6hRHheRgoK+p3TrvjB9T5EhZXg6/tUVaQ i+mgWlrOZWiEGtzAYpmVu9Ttz1w6sClg3iZug324iNQf77zW1SOXC0AWi5ZgJlcgLPBYBq hiBx0dq1Nk/ZlPNb0VgHZzq7XkA9en5IJZeneZMnm9upnnYZGq62C0h7rGcMfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277276; a=rsa-sha256; cv=none; b=eU9wEFKn0hsulmSFP++69dJ3tpJOzJvX4OGWbD8Sd4oYCprue39pbF5H1aYobPQKvoKyzP 8he9MhYhbp+ddbhvUZZoU3jklPt9az3aKh68E8a7mxZntD9OyS1AbGz0yCePdGtC1sQfOB XILlHomZfYkLoU9Stg185OyarrKDrLBk0kk2GD33RbHY5i2K7PtQ+kySLxiKquokggewEJ UVyLNp7D+lrLA0uVfypQXcwMLFTCvIUfDGaGLUawM61TTyoLYkUpS/pUaCPRc+qvYCMhfq 8YVYI9p56eT7TLjTyB59O9vdYzwG8CGWAt/NHVKqnOTupAb5Kd1cb7gBjSgG9A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1j818FJz10Yg; Mon, 30 Jun 2025 09:54:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9saRO064374; Mon, 30 Jun 2025 09:54:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sa1p064371; Mon, 30 Jun 2025 09:54:36 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:36 GMT Message-Id: <202506300954.55U9sa1p064371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e7be8e0026ad - main - pfctl: use __func__ rather than hardcoding function names for errors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7be8e0026adeaa4983e4f6d5493ebd0b9b4f45d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e7be8e0026adeaa4983e4f6d5493ebd0b9b4f45d commit e7be8e0026adeaa4983e4f6d5493ebd0b9b4f45d Author: Kristof Provost AuthorDate: 2025-06-26 13:48:13 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:53:26 +0000 pfctl: use __func__ rather than hardcoding function names for errors Do for most running out of memory err() what was done for most running out of memory log_warn(). i.e. ("%s", __func__) instead of manual function names and redundant verbiage about which wrapper detected the out of memory condition. ok henning@ Obtained from: OpenBSD, krw , a062aa9d6a Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 74 +++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index ec1681e4a27d..df40478b0403 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -5492,18 +5492,18 @@ expand_label_str(char *label, size_t len, const char *srch, const char *repl) char *p, *q; if ((tmp = calloc(1, len)) == NULL) - err(1, "expand_label_str: calloc"); + err(1, "%s: calloc", __func__); p = q = label; while ((q = strstr(p, srch)) != NULL) { *q = '\0'; if ((strlcat(tmp, p, len) >= len) || (strlcat(tmp, repl, len) >= len)) - errx(1, "expand_label: label too long"); + errx(1, "%s: label too long", __func__); q += strlen(srch); p = q; } if (strlcat(tmp, p, len) >= len) - errx(1, "expand_label: label too long"); + errx(1, "%s: label too long", __func__); strlcpy(label, tmp, len); /* always fits */ free(tmp); } @@ -5669,7 +5669,7 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces, memcpy(&pa, a, sizeof(struct pf_altq)); if (strlcpy(pa.ifname, interface->ifname, sizeof(pa.ifname)) >= sizeof(pa.ifname)) - errx(1, "expand_altq: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (interface->not) { yyerror("altq on ! is not supported"); @@ -5703,16 +5703,16 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces, memset(&pb, 0, sizeof(struct pf_altq)); if (strlcpy(qname, "root_", sizeof(qname)) >= sizeof(qname)) - errx(1, "expand_altq: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcat(qname, interface->ifname, sizeof(qname)) >= sizeof(qname)) - errx(1, "expand_altq: strlcat"); + errx(1, "%s: strlcat", __func__); if (strlcpy(pb.qname, qname, sizeof(pb.qname)) >= sizeof(pb.qname)) - errx(1, "expand_altq: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(pb.ifname, interface->ifname, sizeof(pb.ifname)) >= sizeof(pb.ifname)) - errx(1, "expand_altq: strlcpy"); + errx(1, "%s: strlcpy", __func__); pb.qlimit = pa.qlimit; pb.scheduler = pa.scheduler; bw.bw_absolute = pa.ifbandwidth; @@ -5727,20 +5727,20 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces, LOOP_THROUGH(struct node_queue, queue, nqueues, n = calloc(1, sizeof(struct node_queue)); if (n == NULL) - err(1, "expand_altq: calloc"); + err(1, "%s: calloc", __func__); if (pa.scheduler == ALTQT_CBQ || pa.scheduler == ALTQT_HFSC || pa.scheduler == ALTQT_FAIRQ) if (strlcpy(n->parent, qname, sizeof(n->parent)) >= sizeof(n->parent)) - errx(1, "expand_altq: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(n->queue, queue->queue, sizeof(n->queue)) >= sizeof(n->queue)) - errx(1, "expand_altq: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(n->ifname, interface->ifname, sizeof(n->ifname)) >= sizeof(n->ifname)) - errx(1, "expand_altq: strlcpy"); + errx(1, "%s: strlcpy", __func__); n->scheduler = pa.scheduler; n->next = NULL; n->tail = n; @@ -5823,10 +5823,10 @@ expand_queue(struct pf_altq *a, struct node_if *interfaces, if (strlcpy(pa.ifname, tqueue->ifname, sizeof(pa.ifname)) >= sizeof(pa.ifname)) - errx(1, "expand_queue: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(pa.parent, tqueue->parent, sizeof(pa.parent)) >= sizeof(pa.parent)) - errx(1, "expand_queue: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (eval_pfqueue(pf, &pa, &bwspec, opts)) errs++; @@ -5844,19 +5844,19 @@ expand_queue(struct pf_altq *a, struct node_if *interfaces, n = calloc(1, sizeof(struct node_queue)); if (n == NULL) - err(1, "expand_queue: calloc"); + err(1, "%s: calloc", __func__); if (strlcpy(n->parent, a->qname, sizeof(n->parent)) >= sizeof(n->parent)) - errx(1, "expand_queue strlcpy"); + errx(1, "%s strlcpy", __func__); if (strlcpy(n->queue, nq->queue, sizeof(n->queue)) >= sizeof(n->queue)) - errx(1, "expand_queue strlcpy"); + errx(1, "%s strlcpy", __func__); if (strlcpy(n->ifname, tqueue->ifname, sizeof(n->ifname)) >= sizeof(n->ifname)) - errx(1, "expand_queue strlcpy"); + errx(1, "%s strlcpy", __func__); n->scheduler = tqueue->scheduler; n->next = NULL; n->tail = n; @@ -5925,12 +5925,12 @@ expand_eth_rule(struct pfctl_eth_rule *r, char qname[PF_QNAME_SIZE]; if (strlcpy(tagname, r->tagname, sizeof(tagname)) >= sizeof(tagname)) - errx(1, "expand_eth_rule: tagname"); + errx(1, "%s: tagname", __func__); if (strlcpy(match_tagname, r->match_tagname, sizeof(match_tagname)) >= sizeof(match_tagname)) - errx(1, "expand_eth_rule: match_tagname"); + errx(1, "%s: match_tagname", __func__); if (strlcpy(qname, r->qname, sizeof(qname)) >= sizeof(qname)) - errx(1, "expand_eth_rule: qname"); + errx(1, "%s: qname", __func__); LOOP_THROUGH(struct node_if, interface, interfaces, LOOP_THROUGH(struct node_etherproto, proto, protos, @@ -5962,12 +5962,12 @@ expand_eth_rule(struct pfctl_eth_rule *r, if (strlcpy(r->tagname, tagname, sizeof(r->tagname)) >= sizeof(r->tagname)) - errx(1, "expand_eth_rule: r->tagname"); + errx(1, "%s: r->tagname", __func__); if (strlcpy(r->match_tagname, match_tagname, sizeof(r->match_tagname)) >= sizeof(r->match_tagname)) - errx(1, "expand_eth_rule: r->match_tagname"); + errx(1, "%s: r->match_tagname", __func__); if (strlcpy(r->qname, qname, sizeof(r->qname)) >= sizeof(r->qname)) - errx(1, "expand_eth_rule: r->qname"); + errx(1, "%s: r->qname", __func__); if (bridge_to) strlcpy(r->bridge_to, bridge_to, sizeof(r->bridge_to)); @@ -6101,12 +6101,12 @@ apply_redirspec(struct pfctl_pool *rpool, struct redirspec *rs) for (h = rs->host; h != NULL; h = h->next) { pa = calloc(1, sizeof(struct pf_pooladdr)); if (pa == NULL) - err(1, "expand_rule: calloc"); + err(1, "%s: calloc", __func__); pa->addr = h->addr; if (h->ifname != NULL) { if (strlcpy(pa->ifname, h->ifname, sizeof(pa->ifname)) >= sizeof(pa->ifname)) - errx(1, "expand_rule: strlcpy"); + errx(1, "%s: strlcpy", __func__); } else pa->ifname[0] = 0; TAILQ_INSERT_TAIL(&(rpool->list), pa, entries); @@ -6244,10 +6244,10 @@ expand_rule(struct pfctl_rule *r, bool keeprule, memcpy(label, r->label, sizeof(r->label)); assert(sizeof(r->label) == sizeof(label)); if (strlcpy(tagname, r->tagname, sizeof(tagname)) >= sizeof(tagname)) - errx(1, "expand_rule: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(match_tagname, r->match_tagname, sizeof(match_tagname)) >= sizeof(match_tagname)) - errx(1, "expand_rule: strlcpy"); + errx(1, "%s: strlcpy", __func__); flags = r->flags; flagset = r->flagset; keep_state = r->keep_state; @@ -6300,21 +6300,21 @@ expand_rule(struct pfctl_rule *r, bool keeprule, memcpy(r->label, label, sizeof(r->label)); if (strlcpy(r->tagname, tagname, sizeof(r->tagname)) >= sizeof(r->tagname)) - errx(1, "expand_rule: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(r->match_tagname, match_tagname, sizeof(r->match_tagname)) >= sizeof(r->match_tagname)) - errx(1, "expand_rule: strlcpy"); + errx(1, "%s: strlcpy", __func__); osrch = odsth = NULL; if (src_host->addr.type == PF_ADDR_DYNIFTL) { osrch = src_host; if ((src_host = gen_dynnode(src_host, r->af)) == NULL) - err(1, "expand_rule: calloc"); + err(1, "%s: calloc", __func__); } if (dst_host->addr.type == PF_ADDR_DYNIFTL) { odsth = dst_host; if ((dst_host = gen_dynnode(dst_host, r->af)) == NULL) - err(1, "expand_rule: calloc"); + err(1, "%s: calloc", __func__); } error += check_netmask(src_host, r->af); @@ -6767,7 +6767,7 @@ lungetc(int c) if (file->ungetpos >= file->ungetsize) { void *p = reallocarray(file->ungetbuf, file->ungetsize, 2); if (p == NULL) - err(1, "lungetc"); + err(1, "%s", __func__); file->ungetbuf = p; file->ungetsize *= 2; } @@ -6877,7 +6877,7 @@ top: } yylval.v.string = strdup(buf); if (yylval.v.string == NULL) - err(1, "yylex: strdup"); + err(1, "%s: strdup", __func__); return (STRING); case '!': next = lgetc(0); @@ -6965,7 +6965,7 @@ nodigits: *p = '\0'; if ((token = lookup(buf)) == STRING) if ((yylval.v.string = strdup(buf)) == NULL) - err(1, "yylex: strdup"); + err(1, "%s: strdup", __func__); return (token); } if (c == '\n') { @@ -7150,7 +7150,7 @@ pfctl_cmdline_symset(char *s) return (-1); if ((sym = malloc(strlen(s) - strlen(val) + 1)) == NULL) - err(1, "pfctl_cmdline_symset: malloc"); + err(1, "%s: malloc", __func__); strlcpy(sym, s, strlen(s) - strlen(val) + 1); @@ -7514,7 +7514,7 @@ node_mac_from_string(const char *str) m = calloc(1, sizeof(struct node_mac)); if (m == NULL) - err(1, "mac: calloc"); + err(1, "%s: calloc", __func__); if (sscanf(str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", &m->mac[0], &m->mac[1], &m->mac[2], &m->mac[3], &m->mac[4], From nobody Mon Jun 30 09:54:37 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1j96XWsz60GKy; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1j93wsSz3fHN; Mon, 30 Jun 2025 09:54:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CGcrY3fOXWXHipGoNmCC9gvDjZeHIGeM+KFIAaEz+ks=; b=W17HoiucHJ3CXyyrZJ/oir1gFhe/Uj+T1nKH8HxBndi7wNUNDnbZVhGHm2trMZAoM66OHv 2zGoWHFyCCChmboq3UVgRYSthHKw7IIKI3sZim8LNYOauIMzxWjnHBU3m2CA58rAgfb02k DCpCFzKkNbwnNFxk/LJE80+1Ry5Y0oknTcN0c8XqK5GD9FJdznzEPTqYpN8mffqnrrwih5 RYbaDQTCcjLjUTXEjotA/o44P6avFnxNgm+u2CXfUXwcqVgmRWV9fkXli40aNll/zY+so6 zBaa3Z1u7jL7NJUZB0IqZAJE45hMRkZboxPLly9dNgPksF3dt2/qSjiD62bCtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CGcrY3fOXWXHipGoNmCC9gvDjZeHIGeM+KFIAaEz+ks=; b=vsOgOyCnohsiKE172Ggj1/c9EjpBqUU/82s5XSEPTw6Qoj41KTjjiug7ns99rbw9JaRxT6 aoCElF1kGIDoaJ4485hA7e6I0wxGweu5z1DDKmlGrVYsuBLLdHGcN+mLxEWOGrCgmM7Ew0 nVAKe83J88QMOafpXpVozWIR/hW22kOln95b/OpQuKueuK3cyjX7nZX5DRUjCt7ia2uWd6 8fW14bfl8kmj1+kVuIx2a4d34Ft3vusSoUzoh3Jcrng4oVcZbw/EUdRK8i7EtlrXU+V5Wt zFoJ7JMIshz+3tG67AAMOSbFOBSYm4vfV26xFl3wJWQqKtOimT+u4L6prMh2VA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277277; a=rsa-sha256; cv=none; b=PaXkOxv4GycO8/8Ro/0DSvTjZBwe3IOJkbHXhzXme8FJbfM2fiBi07rsevIFnoOnoqAPzJ zdozyVn0Vlc51xRNAXyXedUyM0V8knpYeTW8YNSlI86PgnK3cwrgpF7nELfeGUHBFPIUhT U3/YswMt2x+NLE3axl/kYq+9Kt3iuaVvMzqvMp7bYV2Vdeq8Szj1z7f1cv4AMJLefxpK66 1BptCvzgW3lKH/oPPY6wvkbm3+sbnzq23IflAWxRM9U3dHJ8ZTfdsTG6CApGdvpnAuf2f+ WY8V3O2rl7Et4d9OuNIlI0YELS5UQqbBq4nLf3rCkPNr30uZukFsmcCzDRDfGA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1j92KwhzyZ1; Mon, 30 Jun 2025 09:54:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9sbs2064416; Mon, 30 Jun 2025 09:54:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sbUN064413; Mon, 30 Jun 2025 09:54:37 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:37 GMT Message-Id: <202506300954.55U9sbUN064413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 8572367b6814 - main - pf: remove STATE_LOOKUP List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8572367b6814f9a77ddac898c4589f231bcf461c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8572367b6814f9a77ddac898c4589f231bcf461c commit 8572367b6814f9a77ddac898c4589f231bcf461c Author: Kristof Provost AuthorDate: 2025-06-27 08:24:47 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:53:26 +0000 pf: remove STATE_LOOKUP the STATE_LOOKUP macro made sense ages ago. It stopped making sense when we moved most of the functionality into a function. g/c the macro and just call the function. ok mpi jca Obtained from: OpenBSD, henning , 4fc68ab0d1 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 114 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 74 insertions(+), 40 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f4d6f3dcb869..41fd8a441a05 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -386,8 +386,8 @@ static void pf_print_state_parts(struct pf_kstate *, struct pf_state_key *, struct pf_state_key *); static int pf_patch_8(struct pf_pdesc *, u_int8_t *, u_int8_t, bool); -static struct pf_kstate *pf_find_state(struct pfi_kkif *, - const struct pf_state_key_cmp *, u_int); +static int pf_find_state(struct pf_pdesc *, + const struct pf_state_key_cmp *, struct pf_kstate **); static bool pf_src_connlimit(struct pf_kstate *); static int pf_match_rcvif(struct mbuf *, struct pf_krule *); static void pf_counters_inc(int, struct pf_pdesc *, @@ -441,22 +441,6 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); #define PACKET_LOOPED(pd) ((pd)->pf_mtag && \ (pd)->pf_mtag->flags & PF_MTAG_FLAG_PACKET_LOOPED) -#define STATE_LOOKUP(k, s, pd) \ - do { \ - (s) = pf_find_state((pd->kif), (k), (pd->dir)); \ - SDT_PROBE5(pf, ip, state, lookup, pd->kif, k, (pd->dir), pd, (s)); \ - if ((s) == NULL) \ - return (PF_DROP); \ - if ((s)->rule->pktrate.limit && pd->dir == (s)->direction) { \ - if (pf_check_threshold(&(s)->rule->pktrate)) { \ - s = NULL; \ - return (PF_DROP); \ - } \ - } \ - if (PACKET_LOOPED(pd)) \ - return (PF_PASS); \ - } while (0) - static struct pfi_kkif * BOUND_IFACE(struct pf_kstate *st, struct pf_pdesc *pd) { @@ -1878,15 +1862,17 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid) * Find state by key. * Returns with ID hash slot locked on success. */ -static struct pf_kstate * -pf_find_state(struct pfi_kkif *kif, const struct pf_state_key_cmp *key, - u_int dir) +static int +pf_find_state(struct pf_pdesc *pd, const struct pf_state_key_cmp *key, + struct pf_kstate **state) { struct pf_keyhash *kh; struct pf_state_key *sk; struct pf_kstate *s; int idx; + *state = NULL; + pf_counter_u64_add(&V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); kh = &V_pf_keyhash[pf_hashkey((const struct pf_state_key *)key)]; @@ -1897,14 +1883,15 @@ pf_find_state(struct pfi_kkif *kif, const struct pf_state_key_cmp *key, break; if (sk == NULL) { PF_HASHROW_UNLOCK(kh); - return (NULL); + return (PF_DROP); } - idx = (dir == PF_IN ? PF_SK_WIRE : PF_SK_STACK); + idx = (pd->dir == PF_IN ? PF_SK_WIRE : PF_SK_STACK); /* List is sorted, if-bound states before floating ones. */ TAILQ_FOREACH(s, &sk->states[idx], key_list[idx]) - if (s->kif == V_pfi_all || s->kif == kif || s->orig_kif == kif) { + if (s->kif == V_pfi_all || s->kif == pd->kif || + s->orig_kif == pd->kif) { PF_STATE_LOCK(s); PF_HASHROW_UNLOCK(kh); if (__predict_false(s->timeout >= PFTM_MAX)) { @@ -1914,9 +1901,11 @@ pf_find_state(struct pfi_kkif *kif, const struct pf_state_key_cmp *key, * is scheduled for immediate expiry. */ PF_STATE_UNLOCK(s); - return (NULL); + SDT_PROBE5(pf, ip, state, lookup, pd->kif, + key, (pd->dir), pd, *state); + return (PF_DROP); } - return (s); + goto out; } /* Look through the other list, in case of AF-TO */ @@ -1924,7 +1913,8 @@ pf_find_state(struct pfi_kkif *kif, const struct pf_state_key_cmp *key, TAILQ_FOREACH(s, &sk->states[idx], key_list[idx]) { if (s->key[PF_SK_WIRE]->af == s->key[PF_SK_STACK]->af) continue; - if (s->kif == V_pfi_all || s->kif == kif || s->orig_kif == kif) { + if (s->kif == V_pfi_all || s->kif == pd->kif || + s->orig_kif == pd->kif) { PF_STATE_LOCK(s); PF_HASHROW_UNLOCK(kh); if (__predict_false(s->timeout >= PFTM_MAX)) { @@ -1934,15 +1924,39 @@ pf_find_state(struct pfi_kkif *kif, const struct pf_state_key_cmp *key, * is scheduled for immediate expiry. */ PF_STATE_UNLOCK(s); - return (NULL); + SDT_PROBE5(pf, ip, state, lookup, pd->kif, + key, (pd->dir), pd, NULL); + return (PF_DROP); } - return (s); + goto out; } } PF_HASHROW_UNLOCK(kh); - return (NULL); +out: + SDT_PROBE5(pf, ip, state, lookup, pd->kif, key, (pd->dir), pd, *state); + + if (s == NULL || s->timeout == PFTM_PURGE) { + if (s) + PF_STATE_UNLOCK(s); + return (PF_DROP); + } + + if ((s)->rule->pktrate.limit && pd->dir == (s)->direction) { + if (pf_check_threshold(&(s)->rule->pktrate)) { + PF_STATE_UNLOCK(s); + return (PF_DROP); + } + } + if (PACKET_LOOPED(pd)) { + PF_STATE_UNLOCK(s); + return (PF_PASS); + } + + *state = s; + + return (PF_MATCH); } /* @@ -6990,7 +7004,7 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) int copyback = 0; struct pf_state_peer *src, *dst; uint8_t psrc, pdst; - int action = PF_PASS; + int action; bzero(&key, sizeof(key)); key.af = pd->af; @@ -7000,8 +7014,11 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) key.port[pd->sidx] = pd->osport; key.port[pd->didx] = pd->odport; - STATE_LOOKUP(&key, *state, pd); + action = pf_find_state(pd, &key, state); + if (action != PF_MATCH) + return (action); + action = PF_PASS; if (pd->dir == (*state)->direction) { if (PF_REVERSED_KEY(*state, pd->af)) { src = &(*state)->dst; @@ -7473,6 +7490,7 @@ again: case SCTP_DEL_IP_ADDRESS: { struct pf_state_key_cmp key; uint8_t psrc; + int action; bzero(&key, sizeof(key)); key.af = j->pd.af; @@ -7489,8 +7507,8 @@ again: key.port[0] = j->pd.hdr.sctp.dest_port; } - sm = pf_find_state(kif, &key, j->pd.dir); - if (sm != NULL) { + action = pf_find_state(&j->pd, &key, &sm); + if (action == PF_MATCH) { PF_STATE_LOCK_ASSERT(sm); if (j->pd.dir == sm->direction) { psrc = PF_PEER_SRC; @@ -7681,7 +7699,7 @@ pf_icmp_state_lookup(struct pf_state_key_cmp *key, struct pf_pdesc *pd, struct pf_kstate **state, u_int16_t icmpid, u_int16_t type, int icmp_dir, int *iidx, int multi, int inner) { - int direction = pd->dir; + int action, direction = pd->dir; key->af = pd->af; key->proto = pd->proto; @@ -7697,7 +7715,9 @@ pf_icmp_state_lookup(struct pf_state_key_cmp *key, struct pf_pdesc *pd, if (pf_state_key_addr_setup(pd, key, multi)) return (PF_DROP); - STATE_LOOKUP(key, *state, pd); + action = pf_find_state(pd, key, state); + if (action != PF_MATCH) + return (action); if ((*state)->state_flags & PFSTATE_SLOPPY) return (-1); @@ -7908,6 +7928,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, pd2.sidx = (pd->dir == PF_IN) ? 1 : 0; pd2.didx = (pd->dir == PF_IN) ? 0 : 1; pd2.m = pd->m; + pd2.pf_mtag = pd->pf_mtag; pd2.kif = pd->kif; switch (pd->af) { #ifdef INET @@ -7992,6 +8013,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, struct pf_state_peer *src, *dst; u_int8_t dws; int copyback = 0; + int action; /* * Only the first 8 bytes of the TCP header can be @@ -8014,7 +8036,9 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, key.port[pd2.sidx] = th->th_sport; key.port[pd2.didx] = th->th_dport; - STATE_LOOKUP(&key, *state, pd); + action = pf_find_state(&pd2, &key, state); + if (action != PF_MATCH) + return (action); if (pd->dir == (*state)->direction) { if (PF_REVERSED_KEY(*state, pd->af)) { @@ -8189,6 +8213,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, } case IPPROTO_UDP: { struct udphdr *uh = &pd2.hdr.udp; + int action; if (!pf_pull_hdr(pd->m, pd2.off, uh, sizeof(*uh), NULL, reason, pd2.af)) { @@ -8206,7 +8231,9 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, key.port[pd2.sidx] = uh->uh_sport; key.port[pd2.didx] = uh->uh_dport; - STATE_LOOKUP(&key, *state, pd); + action = pf_find_state(&pd2, &key, state); + if (action != PF_MATCH) + return (action); /* translate source/destination address, if necessary */ if ((*state)->key[PF_SK_WIRE] != @@ -8318,6 +8345,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, struct sctphdr *sh = &pd2.hdr.sctp; struct pf_state_peer *src; int copyback = 0; + int action; if (! pf_pull_hdr(pd->m, pd2.off, sh, sizeof(*sh), NULL, reason, pd2.af)) { @@ -8335,7 +8363,9 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, key.port[pd2.sidx] = sh->src_port; key.port[pd2.didx] = sh->dest_port; - STATE_LOOKUP(&key, *state, pd); + action = pf_find_state(&pd2, &key, state); + if (action != PF_MATCH) + return (action); if (pd->dir == (*state)->direction) { if (PF_REVERSED_KEY(*state, pd->af)) @@ -8706,13 +8736,17 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, } #endif /* INET6 */ default: { + int action; + key.af = pd2.af; key.proto = pd2.proto; PF_ACPY(&key.addr[pd2.sidx], pd2.src, key.af); PF_ACPY(&key.addr[pd2.didx], pd2.dst, key.af); key.port[0] = key.port[1] = 0; - STATE_LOOKUP(&key, *state, pd); + action = pf_find_state(&pd2, &key, state); + if (action != PF_MATCH) + return (action); /* translate source/destination address, if necessary */ if ((*state)->key[PF_SK_WIRE] != From nobody Mon Jun 30 09:54:38 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1jC2XZNz60GHW; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1jB41yJz3f7g; Mon, 30 Jun 2025 09:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EI8mKzBMa96bKMpN+A3szOviIgqa/DHtQUIKMT57Gso=; b=HVF1RvD0m5jYvFO7OcQa1MIcO4kGKdCudmkq+PMe2uBjd8pzceb53P93NaFRn2FN/A8QOS neBWpC223qEYBrmEWyDr8sj98E1lMtSLD0tFOURuimCDFk4DL4An4MhKKi3v48tSkxMjEP PZrb+U0N18DjZ/Te1CoNPD5xPX3JzklemHf2pWUX7Oe7kLPn7FvV1NLH0OKt4u1gSyFQaP 4Bpg7EwYKJGG4H63LJhSlPYzEzu3dFLOq0vIcDFHZtcmcb9xLOoFpvkiZJN7pIjF1PC006 rBhNMrDJ+WAmDZP0Bv7sqa0oyIq7AfYhioTUBfn95095By9o8CEyQyEO/8192Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EI8mKzBMa96bKMpN+A3szOviIgqa/DHtQUIKMT57Gso=; b=J5vzotmgBr8U5oXNK7noOPh182PCVV0noyKXB/FPtMLq4hFw3SP1nDsB3jg+IqYH/37xKy 2HBFZy+L+Sy6G1te7qIoBEJwBpykdMkbCc2xnvOJOQ6NnS0AbX8cAssmVjMokt31wga1ab yJDUrlQECszNE8wB/cEKSFebBPyeFGinYF7pmneqR249RGOrT+w/50NM8kQAgrH1Nk15OH xMBhLK14RnOeg7WKDfw/RosK5j0GYQsqmciE8MH7hFz+YAtkwjZa0tgKpZIg7cB5hvhFCD tfszMo19uuG70C6k7lOV1qElE9S+1UeYivyLy+YY8wUAty2fLNktGLST2Jk6QQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277278; a=rsa-sha256; cv=none; b=S5bNy331/3Ir/+VZZnu56DnSyZck09CK3j2c1RLeDFL+va6cM0iKLmiN2T/bVa9Ja/3hGt jJmbxfJvvmggi6Z5uoHtuka7/iXOnl2ucB/rpOhupdeu3jR1Hvsueddo4lAGtj2aya1fN0 2PPiXZ3z1hVf3m/GEiQxIzoqkq3x/mqrWO1Zh/nAMiRrPwQkZ14MlzXNBCmPpjoKKXnyq1 cpHwEQ/PpAj1V7WLrpazuOh00LgQ07i8x5ktmVmEg0OKOKlJSUDO+Ia/d3DYocc8N7BuFJ FbrXChbUz8o1u/EsODTd46hxpWPkl/oYwzAP6wXtfnvE/uJE5TMQfVeBNWOwuw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1jB31ktz10SP; Mon, 30 Jun 2025 09:54:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9scp5064458; Mon, 30 Jun 2025 09:54:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sc9j064454; Mon, 30 Jun 2025 09:54:38 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:38 GMT Message-Id: <202506300954.55U9sc9j064454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d18ed24a9e9b - main - pf: trade few 'goto unlock: for 'break' in pf_test() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d18ed24a9e9b156770391afad92f32fe860a7ca9 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d18ed24a9e9b156770391afad92f32fe860a7ca9 commit d18ed24a9e9b156770391afad92f32fe860a7ca9 Author: Kristof Provost AuthorDate: 2025-06-27 08:28:05 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:53:27 +0000 pf: trade few 'goto unlock: for 'break' in pf_test() OK mpi@, OK henning@, OK jca@ Obtained from: OpenBSD, sashan , 18b958d7c9 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 41fd8a441a05..b24bbe036141 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -10593,7 +10593,7 @@ pf_test(sa_family_t af, int dir, int pflags, struct ifnet *ifp, struct mbuf **m0 use_2nd_queue = 1; action = pf_normalize_tcp(&pd); if (action == PF_DROP) - goto done; + break; action = pf_test_state(&s, &pd, &reason); if (action == PF_PASS || action == PF_AFRT) { if (V_pfsync_update_state_ptr != NULL) @@ -10642,7 +10642,7 @@ pf_test(sa_family_t af, int dir, int pflags, struct ifnet *ifp, struct mbuf **m0 case IPPROTO_SCTP: action = pf_normalize_sctp(&pd); if (action == PF_DROP) - goto done; + break; /* fallthrough */ case IPPROTO_UDP: default: @@ -10665,14 +10665,14 @@ pf_test(sa_family_t af, int dir, int pflags, struct ifnet *ifp, struct mbuf **m0 REASON_SET(&reason, PFRES_NORM); DPFPRINTF(PF_DEBUG_MISC, ("dropping IPv6 packet with ICMPv4 payload")); - goto done; + break; } if (pd.virtual_proto == IPPROTO_ICMPV6 && af != AF_INET6) { action = PF_DROP; REASON_SET(&reason, PFRES_NORM); DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping IPv4 packet with ICMPv6 payload\n")); - goto done; + break; } action = pf_test_state_icmp(&s, &pd, &reason); if (action == PF_PASS || action == PF_AFRT) { From nobody Mon Jun 30 09:54:39 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1jF0X7Zz60GRw; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1jC4dmjz3fG9; Mon, 30 Jun 2025 09:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nf+e1HFFdjTLuelB4pBTvaGfqDKssf6klBHlIIr1iqg=; b=yG8YkXwTpZV9czwEiYPtd5k1BJM6BhyOV2YXg8MUIoML7CZGkVdgEas3Z5pByCWgqTJG2E V99qUdJ4J+9cuDuQnxTOTifr9ARNjmwCaIxBzFE1htPSH06FpmX53ZUUZa11q/JxrnVUsh gmcVkQFXsoVfRqk7lVyb0dG/H//tGF10EzqtV7txw1BpSra/5muUMzYOtFdoAWgAcOtdEo vNVve642ezv+QQTWBTih2YkPAfTA2/8lK7Qm8T0BtYAmyKviUrUYtdmMMYDICqbpDUM8jt zoJSWOM9hCHDPlfHDFp4b9SvdAaAjbvGStbBTDHoc9GawtWcQ5LFQNcbObRfQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nf+e1HFFdjTLuelB4pBTvaGfqDKssf6klBHlIIr1iqg=; b=Adg9/+2VwfzAJrkS4H/8WzHqh+qh5VE0A+uajot1Xw4gREz68J6+zEBTJBPPDcQ/IOZ9AT iRp4mbaoniryjW6/5jZr5Me3FDa/Swj0fY+1HtMJlDU0m4MA5eHgIxfJNJ5jR6QQcKooqB BpASO7G1fsth4LVUV0OOOt9kJY0eOmno2DEG+z0MarqtqhVijywQAQ5yyR+64BTCWSjpaE SUQU/JBzPWYME9o1+qHU7yxx4E+ymlf66jROOgnB75iQZW3EslDOc1K0yuiPsJlX6rb56e bfy199ef1xd10S3mHddF2whF5QQo15mkoVKo+iXEj6mmqQZRD33jXD4ZJ5I7xw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277279; a=rsa-sha256; cv=none; b=yM9b+d8rhL+JIsCOMhImZ/IQsW+niFHz5JL3j5g0Kw0mF1+V8zu5JstZ4HV1F9+xjp7jlY 4hwtUWQAiCdC2jHSMgcnmzWf/Ln6ZKFflgggCQZNOGeipSAc2zIX6ksv1At93P3fpIF+kB iT5S6vzJf7DiIhfJ76vpyNl5wlLJ1k3Kfkeh9NlnEGe7F/db38b+0Pck/sI2Nd2M9Db9Iw 7SzSyoDCWPjOESDTnEFKSF6LKHcweL+VcjTX9B24Dj/4WVuVRdBS+2c0cLsv06Bb/USkoU 6pgeierwx+ybNUHn9i9MCdfir1ID/XjJfWYr8j1MNQxq5XDAHTskFLrKSk6KAQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1jC4FQZz10SQ; Mon, 30 Jun 2025 09:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9sd8P064494; Mon, 30 Jun 2025 09:54:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sdCo064491; Mon, 30 Jun 2025 09:54:39 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:39 GMT Message-Id: <202506300954.55U9sdCo064491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d8d7bd50cb88 - main - pfctl: simplify FOM_PRIO handling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8d7bd50cb887000535b9e75e2f5688b8718127f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d8d7bd50cb887000535b9e75e2f5688b8718127f commit d8d7bd50cb887000535b9e75e2f5688b8718127f Author: Kristof Provost AuthorDate: 2025-06-27 09:13:17 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:53:56 +0000 pfctl: simplify FOM_PRIO handling Obtained from: OpenBSD, kn , d114b77333 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index df40478b0403..9d2fd35ea4ee 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -7619,12 +7619,8 @@ filteropts_to_rule(struct pfctl_rule *r, struct filter_opts *opts) r->rule_flag |= PFRULE_AFTO; if (opts->marker & FOM_SCRUB_TCP) r->scrub_flags |= PFSTATE_SCRUB_TCP; - if (opts->marker & FOM_PRIO) { - if (opts->prio == 0) - r->prio = PF_PRIO_ZERO; - else - r->prio = opts->prio; - } + if (opts->marker & FOM_PRIO) + r->prio = opts->prio ? opts->prio : PF_PRIO_ZERO; if (opts->marker & FOM_SETPRIO) { r->set_prio[0] = opts->set_prio[0]; r->set_prio[1] = opts->set_prio[1]; From nobody Mon Jun 30 09:54:40 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1jF5VZJz60GS1; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1jD54cRz3fLX; Mon, 30 Jun 2025 09:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ncSlS71fePD6kk7HFec80iMvU8F6k3ZFKQ/JPZDhH2s=; b=E0DlTBu2aENiA0/DGlJkhf0LiU3J3EmNRVXQB02J67Cz5PwWw7s/z/JpFlgc78vrPLxmnb H8j8c44aMXwMeOvna60GQOFcnkBz4Oicni5B58pcn3SEUXkj89rbfxa8YCRk+ie9w0AlEl ibQ+0YyVR2S70D2uEqJ6jntZ6Eo7RdeCFKZor1nGAruo+7jBd13QR7mYB3QZTKoM+eXc3w kpVOI4FhHqkVbgHMhWH7L5HWrhozvng49HeCQfoImTv5S3aVobof+ftYpRna902CaUah2/ jyRW6qV9cXUhnujzPbmJJ+HGHAizNErvYC0SclLrjyBjaeWA3MVd4hXY3XT9tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ncSlS71fePD6kk7HFec80iMvU8F6k3ZFKQ/JPZDhH2s=; b=XLS6X20T6MvtBonT0TezUQ9X2l7aT2C0DnUxrVhxjA2yjVmzC96HbVY0kR/vJjiJmydjYz a9gx9YaW1RbUk0J9k1ET4/eR1RjBkQ6GmL6uEK232Webuz51+EOzNJetphDKBVNXLihGD7 ESdkabZ262/3WEefuG9fUVD36Dgy03BI1JbT4RqTpvU0VM3Li0k+IZyr47e2oko6oj2lth VjFsjU0KTnXW4fiS0r9tD65PyuyKtKoUl/WS4kNY2RfchzhzoG7YFtR/xZlCfkmHTmAtrQ FVhNF3a9xBVi36nGMHpMS7P8M/vek5wrC0AkEcJqond67HCQyxJhEqpFKQmVhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277280; a=rsa-sha256; cv=none; b=hBztm6tDIbeERHv1g7ARUlXnsHy1r5Z4ndSCXHy+OiEu6+ICTxVl3gSn5exwGtBLGXdUoG 5Y/3fye6l2sB9dMXkF3lWFAW9CT0RXE34jDeJrlfBEH3y5uGqtVlrsbDkMAbvKRDIyzvzl W+vTfMHG7MAw5SMLwQJ4YQcrCt8Y2vReNYKh+ZOsjhs4+2tlS1XYVJzbho4zF87RwUAVHD dToLucVp/J5jpcMvPf3qg7yl7OokZspd6mPYV85nr+VFwPdF+N1bP1/ZioW9P5kLLpUlbX dPnQANxLqmvse1J4wSWa9y6MYOFUPwoJZWG+aSZZzGUMrnelMf+y/TJfOt68qA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1jD4g0xz10Xf; Mon, 30 Jun 2025 09:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9seMk064528; Mon, 30 Jun 2025 09:54:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9se5c064525; Mon, 30 Jun 2025 09:54:40 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:40 GMT Message-Id: <202506300954.55U9se5c064525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e56247e0debc - main - pfctl: Stop checking table commands for `create' List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e56247e0debc96bb4d5082c289bb8538978d3725 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e56247e0debc96bb4d5082c289bb8538978d3725 commit e56247e0debc96bb4d5082c289bb8538978d3725 Author: Kristof Provost AuthorDate: 2025-06-27 09:17:58 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 07:54:01 +0000 pfctl: Stop checking table commands for `create' Tiny left over from 2003 when it was removed. Twist the logic by checking for `show' and `test' to make it even simpler. OK sashan henning Obtained from: OpenBSD, kn , 764778e2ff Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 8435f69e91e0..8b76b0c3fdfd 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -3183,7 +3183,7 @@ main(int argc, char *argv[]) loadopt |= PFCTL_FLAG_TABLE; tblcmdopt = NULL; } else - mode = strchr("acdefkrz", ch) ? O_RDWR : O_RDONLY; + mode = strchr("st", ch) ? O_RDONLY : O_RDWR; } else if (argc != optind) { warnx("unknown command line argument: %s ...", argv[optind]); usage(); From nobody Mon Jun 30 09:54:41 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW1jG3Ngsz60GPj; Mon, 30 Jun 2025 09:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW1jF6gRkz3fRG; Mon, 30 Jun 2025 09:54:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cVhlA7Ow4ckMxl+biPqgIJVdU9NGvqcx4/2ak2jhxNk=; b=Ii/WgS2cbpwtTrK0j9rkwuHThwHCacRNiYdP7+UwzImOlD352kXm4xrfDOnrFmBvFafLyw Sg+JcLkKJfEE8mqNhU+nltFN7cvwjODqs1aOFCw3AcTSX3B2MEe5i+VjjGmuj5PbHjtVZm 0FqyJDBtKNtjfn5fHvdo9rj4lqIBDsJSg9Xm5j8/j7a3+EHav2CCwrBlOfEdMlD81u0fXP NyMrQIYj9lWvbVz4p0HKL7CORcKLH2BJwzocbvvvldcsKaha3R5qGSp7aaHljbjrIlMP2F jC4sxlUQ7pv3Y/Xz1U54OBY0/wwLuCwD0iJ9pcJCbw3dvmCOa28BnYzEo8sLIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751277282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cVhlA7Ow4ckMxl+biPqgIJVdU9NGvqcx4/2ak2jhxNk=; b=KIC5UL9G8ZpDJALTXG/Fc1jFJH+v/HacyFqc5gkuHIz8yjO0QJ2BAJ/rxH9s6r54Ay9/V+ ZdMxZRRGkFphs522DDo1pgZs+tNa1QbDF21kutAgTeNN9o56zhA8CP5GTgggL8uB6dvLrc KQEgyo9GgLuyrNUxFBIM0lGnR6TnwlUVvTZrnxnqV0IrwH98WnDiAa5641jC08d7lvYlwo waCYq/AkJO5DRvj/pvSkDIP8Ez0Y4um9oB3VeebUF0b/wSrEJXzqud419XP8TBrep9JsYn 1lC4JqlXfvX8ULuQQQWInKeDiGh8FmVvlElUkHWZw/t74yQvEzVjIl83c0zZ3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751277282; a=rsa-sha256; cv=none; b=qJAtDkQ5oT69d+8Z9dTKHZJpUbXuxUepoUH31Ci7IrYBw9l+JWbqZ6aTIpuOtcfxybuqzO d/DZp4Z4OcbVO1m4yZexLDytN1bZ0cgof6Iy23lXYikeQHwd+ahI5p8IEcjIkMLxh0AiTQ FGB6hF4pHdOL1HtDjNMKkoHWTYE+vNV8mzSqQM31SO7yn0pVIeqjBOFAo8a0Tg8DY1TudK LwJhZn/TsSnZH3TWOWIibyIViBBr5ag/+Dl0SayItWvnKvk9IZudslgRh4rINM9WZb5h3R vWvktAzTTKzH9D3FqunypSh2DR1bD2/D07zf3zVqxEznoM4V+TeNxn3kH39TZg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW1jF64Mvz10Yh; Mon, 30 Jun 2025 09:54:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55U9sfqI064563; Mon, 30 Jun 2025 09:54:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55U9sf1W064560; Mon, 30 Jun 2025 09:54:41 GMT (envelope-from git) Date: Mon, 30 Jun 2025 09:54:41 GMT Message-Id: <202506300954.55U9sf1W064560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d1ac3e245f08 - main - wg: fix LINT-NOIP build List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d1ac3e245f084ee0637bde9a446687621358c418 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d1ac3e245f084ee0637bde9a446687621358c418 commit d1ac3e245f084ee0637bde9a446687621358c418 Author: Kristof Provost AuthorDate: 2025-06-30 09:53:02 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 09:53:02 +0000 wg: fix LINT-NOIP build Fixes: d15d610fac97df4fefed3f14b31dcfbdcec65bf9 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/dev/wg/if_wg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c index 6ad3c44dc8ff..17aedee0e6b0 100644 --- a/sys/dev/wg/if_wg.c +++ b/sys/dev/wg/if_wg.c @@ -532,10 +532,12 @@ wg_peer_get_endpoint(struct wg_peer *peer, struct wg_endpoint *e) static int wg_aip_addrinfo(struct wg_aip *aip, const void *baddr, uint8_t cidr) { +#if defined(INET) || defined(INET6) struct aip_addr *addr, *mask; addr = &aip->a_addr; mask = &aip->a_mask; +#endif switch (aip->a_af) { #ifdef INET case AF_INET: From nobody Mon Jun 30 13:34:19 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW6Zj1M3lz60Tfd; Mon, 30 Jun 2025 13:34:21 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW6Zh5bm3z3sWV; Mon, 30 Jun 2025 13:34:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751290460; h=from:from:reply-to:subject: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=fg0sMVw4el/uZXTgJ7dZi0bfJe039YkzFBnilf/y/Ew=; b=sb6nF+KCRjWlRiJcDaJw5Vlw2VtWg5owa3WpsUxvzmd0CkhY3e0tEmEdCCjH53RZp4ypLj y5IeqQ670/bA+fgXseN4e3cU5R5rGCuz72dxOpUr0zZXIf+6B1v2VsMGY+Iq4agsgUO+gX kXWvZcwbfkJlFlJEzXVhEPiaufFkbLXeouQnyUVZ5KHMYcbp9QYx3dMJTkwa/r9+o/m5ZW wuPuczS+GwyHRwZbcTUv+ImBLPMUKwWHT/PETiGb9t2qM/avT+ySovTAa9MyL6rdE4EF/p /zxyzmEa1LK27QHC7XJh+gczRa2gYf0QIOAgLGYmHiHLh8IpU2Vs27yR4EQgxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751290460; h=from:from:reply-to:subject: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=fg0sMVw4el/uZXTgJ7dZi0bfJe039YkzFBnilf/y/Ew=; b=kpJmkadfcyZhuM9Qldtpb/h77UaSx0p5C1N+GUWD+PforL8RT2GKHHHAG7I3IehPhJw0Pm oXqcovPJ/4vLIovyA3yl+USm/vN8B6vfeHHh99OvphQD/Nv18Rnw1CiycvhWad0ISgIFwJ 1hmuuokXTIxnPKevwWY/1rLQ9HjIJ/MgfKW9UkL11av2hR9TpkQERAMsyQxibmh6H5oTR2 TmmP/yyRbm5ZzZwB0Z6imndIuFC5nZojAjHe+P496WC0IQUz8TJa+VytwcrejJ4PVdnC1g l7YBT8KrCMBCrX5GXpAdphdVEAZe0JxcYP3Gs8hz3z5lEYu9xmtywgu3bUu4KQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751290460; a=rsa-sha256; cv=none; b=BVMmkgZYbH5q9AZsmHymnW6GNntuLG++zAVmaS5Z7KA1fCM4SvI3S9lluxmwLM1r0B+5Zd CiquQOYpWb2jhW1Lqk/fgIg45T0nmRj3iV+T0BshiYGjKoyywbLhgW/ceT+fN/ih28wFJe RQmZY+YYaHziIi7RANJ48W4TKY6WexgwV1oKAHAv87d0ceLwPr+nKWdDE4gh2ntc7Mhyb2 nr7HoyQx5hzKu8XPybR37ZROK6B4mScARAquERtdjHpULt53u3N6DqgiLVfqTGqD4JqdiL pUdeSpyiqFj1hWop4cFJNMuxBPI3fn5HbnDgQ/qAFXgBW+FydhvtG6w19pKjzw== Received: from [IPV6:2601:5c0:4200:b830:41cc:e0d8:c39:f14d] (unknown [IPv6:2601:5c0:4200:b830:41cc:e0d8:c39:f14d]) (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 4bW6Zh3JjTzQnm; Mon, 30 Jun 2025 13:34:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <69858708-8e73-4b70-9f33-5176fceb1b36@FreeBSD.org> Date: Mon, 30 Jun 2025 09:34:19 -0400 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: ad8d33679999 - main - mmc_xpt: use strlcpy instead of strncpy Content-Language: en-US To: Andriy Gapon , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202506270721.55R7LlB1067221@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <202506270721.55R7LlB1067221@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/27/25 03:21, Andriy Gapon wrote: > The branch main has been updated by avg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ad8d33679999c0e7f6fd2b77d2e414102bd365ec > > commit ad8d33679999c0e7f6fd2b77d2e414102bd365ec > Author: Andriy Gapon > AuthorDate: 2025-06-23 21:31:04 +0000 > Commit: Andriy Gapon > CommitDate: 2025-06-27 07:13:34 +0000 > > mmc_xpt: use strlcpy instead of strncpy > > A better practice in general. > > MFC after: 1 week > --- > sys/cam/mmc/mmc_xpt.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c > index 138f96eaaa49..4fce03004994 100644 > --- a/sys/cam/mmc/mmc_xpt.c > +++ b/sys/cam/mmc/mmc_xpt.c > @@ -1213,9 +1213,9 @@ mmc_path_inq(struct ccb_pathinq *cpi, const char *hba, > cpi->max_lun = 0; > cpi->initiator_id = 1; > cpi->maxio = maxio; > - strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); > - strncpy(cpi->hba_vid, hba, HBA_IDLEN); > - strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); > + strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); > + strlcpy(cpi->hba_vid, hba, HBA_IDLEN); > + strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); > cpi->unit_number = cam_sim_unit(sim); > cpi->bus_id = cam_sim_bus(sim); > cpi->protocol = PROTO_MMCSD; Hmm, are you sure these aren't depending on strncpy zero-padding the result out to the full length? String fields in inquiry/identity structures are often not C strings but have other requirements. (Some of them are space padded instead of \0 padded for example.) -- John Baldwin From nobody Mon Jun 30 13:50:29 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW6xM1nSnz60Vcp; Mon, 30 Jun 2025 13:50:31 +0000 (UTC) (envelope-from kevans@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW6xM18lXz3xFd; Mon, 30 Jun 2025 13:50:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751291431; h=from:from:reply-to:subject: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=/z38xtq6D+8zHaiE6rbg+V/RQ9hUT29/MFds0WkdNtM=; b=n0XMrBkqGaevKaHtA+pws9Xi4dFVAQ6fV6OQSfzfQ+PTKlYvLeiGpT6Ti7aNa9dr9COkFl TgO51FVmEdhCo94MBLCLHb1Atv2YyTPgjTa3o9CmJHAjmCypV2wzE5oTkR3hiWDGxrBX6/ NaO9GxL9hnmlCUMedNFGdN03H13nUQyOpzwZ0/pHCY+nO7KMPNVQj2zJiUVlLcstoZcVjU /IELRXAwxefW6cs9nPIxcAzzGDNvUAMZcdOc5K73lqA9fIMvwrFbQQLTnTABu4/6mnPvSZ r3vwzhygsFp/8VTckEpAejkUAyI08Z5i7sKJJSX1df/ZpIt8TKUdFrZA4ZuWsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751291431; h=from:from:reply-to:subject: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=/z38xtq6D+8zHaiE6rbg+V/RQ9hUT29/MFds0WkdNtM=; b=SquOLosdJWghXHAY0opT1ZUKz0Bc1IzcdxYf/DYJ+dCLESmzkoxmUsdtFowNFUa4ciCAxZ iI5VhEgdqQTz9ehRM9twIONQv0IsdEoEqFqakGyu2Tnh+/VArDb+4HidULbyCiZwwHSCc8 s1qSQsosGNpniPELMQLb8rtWfTfoefjkZ4aGMQVIrQD9cqMDvZqzcfs/IN8WdVz96o+52Y 1x1svsQV1KSwynKSOKTTRv+e09sB01GwwFC7bG7ATCBip5VcIyIALq9taDiDvjw5+2+M1F NSkj9LQLXYiN8sYjxL4ALOrKAv7VXUIdUUY46RLebow5ZOtDGyBq6jB4lzKo9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751291431; a=rsa-sha256; cv=none; b=oNQLplDhi3AxJr1uGcR01Eko6452AgoXPYv8RGaK9Jgwwinh49j0LEhW4CtvGJDeUbP5Zt vkcV7cAJvaH3x7oF6p9gE7u5uSelJ1nge1GZsgUW/zMMVVkf+PpC1Yu5Ubq29vAzjYIcyD EI3yJTLWjSDZKX+xCo+qxijYWSUbD6zL1sW9dazFca/EmYLy8a2mQt3k+PKgTWgURu2S7K s0p9sOH/QlZ+CJxdBQ6eGmEgCHx675PLQlWEfat2CzFjTPJVa6UUi69bFAw7U4RVBTHHg2 vRwDbelVKLnHKI3JFSIEtcT2nupdwO1BpsMgREYiYc7kjrnQTNa4SlUk+0eD1g== Received: from [10.9.4.95] (unknown [209.182.120.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 did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4bW6xL5G0czQXb; Mon, 30 Jun 2025 13:50:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <18728ca1-8d5d-4323-b85f-b2451f9465c5@FreeBSD.org> Date: Mon, 30 Jun 2025 08:50:29 -0500 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: d1ac3e245f08 - main - wg: fix LINT-NOIP build To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202506300954.55U9sf1W064560@gitrepo.freebsd.org> Content-Language: en-US From: Kyle Evans In-Reply-To: <202506300954.55U9sf1W064560@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/30/25 04:54, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d1ac3e245f084ee0637bde9a446687621358c418 > > commit d1ac3e245f084ee0637bde9a446687621358c418 > Author: Kristof Provost > AuthorDate: 2025-06-30 09:53:02 +0000 > Commit: Kristof Provost > CommitDate: 2025-06-30 09:53:02 +0000 > > wg: fix LINT-NOIP build > > Fixes: d15d610fac97df4fefed3f14b31dcfbdcec65bf9 > Sponsored by: Rubicon Communications, LLC ("Netgate") > --- Bah, thanks! From nobody Mon Jun 30 13:57:20 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW75L3L7qz60VnD; Mon, 30 Jun 2025 13:57:26 +0000 (UTC) (envelope-from avg@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW75L2Zvhz40XY; Mon, 30 Jun 2025 13:57:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751291846; h=from:from:reply-to:subject: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:autocrypt:autocrypt; bh=CreMp2hLkcWV4wBcwp//UVVPGEClt/M7lU6SXQlnRRQ=; b=k01RXT69jWJpfQvf6ky0Da7xsM8pwttamSJus2NIM+h2Y1k/rmcMlW5/TT5tT2KuySE/3z afj2eVG4CqXw8lKYz+6w7GJxNAxZoievgFQ1LeIcoABJjBAkWIzoxCt2mXUqLQR/ssBzHO BrTM0ZpbWwszqjrSgJxF23IyCJ1bJ7gTINe6hHd2sm59byytDe3yYid3U6Sr1XQ2r9DHbc d98h2AXFluYmn8rqj5tXJ+uS1cbBzenIvXE/GxGU/YFSp0iO/2seJG3Pr1npSBUBihkMNX cqQGJtoUYmAT2SookIwp4vRl9lQz2GSL2ELLS7AaCRbGbKAlqGLYnHydlbax2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751291846; h=from:from:reply-to:subject: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:autocrypt:autocrypt; bh=CreMp2hLkcWV4wBcwp//UVVPGEClt/M7lU6SXQlnRRQ=; b=yjM/TsQ17o0JcwkEzADT7PuhYsdeCL7HJMbKEMiIN8up3AXdTp1+RCaa1RcEIrDpSDccwn bUulrpSXtJuCduk/WOHxmvvvCtG2A2okge0c3ZgYaDyydwLAgI5K7dASrLp6SEUuYLuAJg +g/sRN63OectLM5T8SEfi2AhV7BrCuOxMRrQRdcBR9qPhtwQAnb+nrb21OHBKLnKldv8/X pQVelA8ygJWDHVFxE/DuVxKClku5uzq1ZYWiZgPygx90A+9zhX1IUcbUCK3CRTfOsppX83 yNf2btG6SmAs4HUwlHJNL7GCtBfOqZ+seMmFL3Mvsqn9cM7W4jjmXQ+6yp6sqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751291846; a=rsa-sha256; cv=none; b=pXYK3fORoMJqmfQ16ZPVAhSaLON4NiKOC5F+kV0tx7tcFiN/eDLq4jQ9uydJTpB9kwrC/b BgcYvYDQKID+v20gQhNCjVqgoUtO3ffZq1jUQyxny9RVTRqP23CWtoUMR3Yw5FTldnbR6H t7US4/75LAh+emJtM4ROxYxRpwA6Ra+27KVbECISv9xh/g28xfGTxZTpalhatN2OF5S8Qb UQeQQ2EuEWTwazGZR1zLG3TS0Y4u47nQJFWnJ6ZsQtbbLF8c0vnUM78ZIJliN6kLM88wM8 TcNl2ePOX0qJBdOUVXcr45RqsMqNDGUplDmWSooKnfZDZS5LZyLTwAc4INll5w== Received: from [192.168.0.88] (unknown [93.188.39.137]) (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: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4bW75K40rFzRXB; Mon, 30 Jun 2025 13:57:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Message-ID: <89e23d9e-885c-4811-886a-6c1011715679@FreeBSD.org> Date: Mon, 30 Jun 2025 16:57:20 +0300 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Andriy Gapon Subject: Re: git: ad8d33679999 - main - mmc_xpt: use strlcpy instead of strncpy To: John Baldwin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202506270721.55R7LlB1067221@gitrepo.freebsd.org> <69858708-8e73-4b70-9f33-5176fceb1b36@FreeBSD.org> Content-Language: en-US Autocrypt: addr=avg@FreeBSD.org; keydata= xsDNBGcKrHEBDADRvwQOK0b/yo4ys5cs6bOQMhEh4xtfbaZ/CU00cpPgUip3sOZCdrtMWlRC g25z97prxE9pKueZi+HXDhIPpa9xl14ghqF4oYScuJ1i18HyiOH2y5Q3Vv/TtFiSzicd3EAu QgS3jVidpgDSPDdj2Yz3UxYpZ+PuFl6nOnvCvqOFcjUlzKCyPaiN2b86l1Nscmhnc+zQ/faB erUOEFEDQbWMA5YfXi8HrbeR16hfRfGt7E0aMDlIj9FIPIq71UWMN9CimPgs4+rbNr1MAlLa z4GxSDhVYZEY5rqtCzr+PLXboRQWnaUwXl0/biw9enf17NHdYv1SNAFTX2eC4dZ3qBVI74dS PgNprm+PMfz+6Hhs/dAv+Nan5nVhg3EFIjYTiy0MnjMSq8uI0v0ykpAGAcJJ5xl6d23aLxgN 6f0z6pJRCO0hGPgU7UzvFD0MxJxmbzqdT1R51KDan1oD41b+tjl2LMBuCDCoB0U44Pu0zLdp xMfFTxCXtwIYKIUxwd28jwMAEQEAAc0eQW5kcml5IEdhcG9uIDxhdmdARnJlZUJTRC5vcmc+ wsENBBMBCAA3FiEEmXvSmjiQFHPVOpLnzDOt5NLj67sFAmcKrHEFCQeEzgACGwMECwkIBwUV CAkKCwUWAgMBAAAKCRDMM63k0uPru5tSDACFK15LLbq89RSQ6QMnjiIm1t/wYJyumb519MHu Dhzxx1lbr8oghf0RHtF6kYRLQPaW2VdToi74pRobd3CN4bhZKDLSL6WfTn17RfavDjL6Njwp KBo30CkOeYKWq1mDmo0xEoQj8cc7ybEZnus+YScZOpj8Ti4EFwhRt6SHer7YDb161IHKL8m4 MsCxpFSGEjbKj8Iul3Ri/fTOO8w14ivcuEEQIvJt4/+4YV5Az8G23wKzL/3aJ7SOT3oYGmR9 atBTmVO3DlODjM+rZLegd8SfLSPTcBTHspWE5duemIzZbEX3BP77r3Qx4Fo5Tkit3bG1XVar yPQato+sFGFEGifdE9USBQoAoOaaeZevwAWjDU0TIuCT0CUe0sKtQuNP4LRq0n9EEHOXBu9a CfdMhFUSkAZnuE7miSVwgPvoVNJ1stA37EXLN/sVsWik7wslTQ5vF81VpdGFiwoQPOe2XEKh ogcwGSnXbwv1gD4x+Gz/7Y+kFyr1NY+4/nSaeXVcS2fOwM0EZwqscgEMAMQTe6ypAmQe/TFO HqKD2hfFKdksTptKi6uEh8xIwct8G/0FBldDWXo9eu8CGr/ZrDg0/bAwJxbaLRQCMH19Gq2Y hLvZ1QK5GQJVzZKcqfxbF2LiDUTs6WkdOBIhGpdDy7p1xFrvqCGCtNFYHuGYm067EozibBSF BWAPstKu2FQuVHZNMOfs7p3OIz3Yfqu9woXDeg3/8G2qVQJINe+8EwXKlhgh4CyDbq7nAZoA kIu1SE9z9u3WI5mcNy/0dFmVUsFxBqRC3ewbvzie8tKyZ9yFOlaZPT0Y4nRBXQTI3mLZ8zQ8 mtrWK5OOmrJ02kdeO9RBXe+OMaUUWMf92ZIoBFb4HP6N+B+4N1y1OwULousfl7JRoYxA4MRL ls7E2sSoJvrEBTJB3Pc34xu8rsJ1A5V3NgN6djX8yEZYpTRkcmrBeWy/ofDqZPVqneAx0LRm eldDS9msXDW4KXODyPZ+9unvmHAcoH0xaBYaSH44CDZDQDg4LNcmbOvuu1TEXBJhjQARAQAB wsD8BBgBCAAmFiEEmXvSmjiQFHPVOpLnzDOt5NLj67sFAmcKrHMFCQeEzgACGwwACgkQzDOt 5NLj67sUCAv5AXqgWnYN9EblapMbZjkiqL8pZQ0GNqh+Pg9FwbyULxjtRTO6rD4D0IxizByb ef+neeUNyYlagt5nfKMysEr0SU/gHKCi8vyTF/63ukMrGUNGmJJxrndl5ZYKC6j6eX7twrZF L1Uvlmn6FnQ22red5kHO93fDjG4zaDIZvHfwj7kzjZ4tpC7Byinf88s14mdZeScc0PnU2hj4 UGYju/wg2FF4YxaZYhcmdTiRYY0Wx85XSMZv19pnn78sadEuRvfRd4JTmw++j1xGXeqQGWzz /CTG5/Ex9GAkQ02hZbmi236byDXoet4G8TEyOph9QFVkV9bNd0jQZaFZPGEj4PSPUYGAF7s5 xJaNGgctC3aZ7WjEv1FBoo44XCU4xcjJ1wZQUrHxRhx6TW0Jtcl0U9qfKFW30TSPo6RyiXuj X4ltWKAtjoXB8nUmEJckaz7IRu2b4pXDeazZuz5JBygUs10yJjDxh2vFQZo0KaBAPx9MZlPn gpPTjT15L8xGftEjQXF6 In-Reply-To: <69858708-8e73-4b70-9f33-5176fceb1b36@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 30/06/2025 16:34, John Baldwin wrote: > On 6/27/25 03:21, Andriy Gapon wrote: >> The branch main has been updated by avg: >> >> URL: https://cgit.FreeBSD.org/src/commit/? >> id=ad8d33679999c0e7f6fd2b77d2e414102bd365ec >> >> commit ad8d33679999c0e7f6fd2b77d2e414102bd365ec >> Author:     Andriy Gapon >> AuthorDate: 2025-06-23 21:31:04 +0000 >> Commit:     Andriy Gapon >> CommitDate: 2025-06-27 07:13:34 +0000 >> >>      mmc_xpt: use strlcpy instead of strncpy >>      A better practice in general. >>      MFC after:      1 week >> --- >>   sys/cam/mmc/mmc_xpt.c | 6 +++--- >>   1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c >> index 138f96eaaa49..4fce03004994 100644 >> --- a/sys/cam/mmc/mmc_xpt.c >> +++ b/sys/cam/mmc/mmc_xpt.c >> @@ -1213,9 +1213,9 @@ mmc_path_inq(struct ccb_pathinq *cpi, const char *hba, >>       cpi->max_lun = 0; >>       cpi->initiator_id = 1; >>       cpi->maxio = maxio; >> -    strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); >> -    strncpy(cpi->hba_vid, hba, HBA_IDLEN); >> -    strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); >> +    strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); >> +    strlcpy(cpi->hba_vid, hba, HBA_IDLEN); >> +    strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); >>       cpi->unit_number = cam_sim_unit(sim); >>       cpi->bus_id = cam_sim_bus(sim); >>       cpi->protocol = PROTO_MMCSD; > > Hmm, are you sure these aren't depending on strncpy zero-padding > the result out to the full length?  String fields in inquiry/identity > structures are often not C strings but have other requirements. > (Some of them are space padded instead of \0 padded for example.) Not sure, but using sim_vid as an example, I see strlcpy in cam_xpt and ctl_frontend_cam_sim. It seems that in context of ccb_pathinq those fields are "normal" C strings. -- Andriy Gapon From nobody Mon Jun 30 14:21:24 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d03Fhtz60XP1; Mon, 30 Jun 2025 14:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d02S33z482F; Mon, 30 Jun 2025 14:21:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IMXjFedC5hsMtHvPZCXlMuI722/a2KLSDQFDIuaRBk8=; b=mLCA8xLx5dfKnG+wQTpA+Be74Z3NwclACJsZ3gqLc4ctSSNMZ4oHxOyn/RL5lVeTLMUjw5 2FWc5ueNDqVRlsH1zaLW529Eh/zz8Ukl0YMzneDvEj+P6S7GYw1GtDFdUaMERe6GUQtRmf cvO/c3cdPavyD9OWEiBIiNiLwzK17ZKSn5v6wTyxTqYQyK+fXXKA7Kfele7mBVMJZpI3FK 4vXu8J6S16PWJRq0n7za4p6/3cklWsJknt8rwBx4tPB7fl2Mijw8P1EdCx1+zs529veoCy kEu3iUm6muuLztoE5I2YGepjT+tjMTLMyjUFCiPdHFf5KOrv555R5Y6YixRx3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IMXjFedC5hsMtHvPZCXlMuI722/a2KLSDQFDIuaRBk8=; b=m87XNWE4cG5m8nVL7qssMqhSEouIeLIUkat0brUsXBLngULd7sQItCknrdhhJdBxCwj7TB 7vcTFVEjMR9T/ja4tfXoS96PUxS7qMxXuEykd+2Tffo8d5Rs8OFJRu3boVSOdiVJGsBvKN a5WTbs7sJ4w1GNaJaGnWAyUVnh8cLDLRwdsKqg6VXfsvTXNCJWx0GylepDMNyKkWjYiJox yN0Pfr5X3T0Tno6cKXxe3HoAqsWyDzOVst7NZ1Vf9aMEEnAMA26PYrKqjZRKFFHQI3ZgKo PisSzGH4IVxkINomcVWNP0xTh2gb36nSS2U7uLANi/AE48srctWepXRrjqH26g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293284; a=rsa-sha256; cv=none; b=R7gwVbfGdi7ac0ISxz1DvkWZfoy92TD1leGdZaV4ngacdPWfmmi5KV/yvjs0aomUvUMdzL WwLL3PtleK5LI2s217DJrGvWP/Tkh7GVW/t50++Bi3ZAIuHtksb+x9Nq5H7/JeaJ3NFKr9 a4j74aDQ2oQI7vd1R7T7qiUSsb+1UyOC/wdaDGlltFu2UA+7P6a/kmhvytC5Oax1e3IaES I/QkFN9L4nfrBpQ/47iyROuGnpdlpLOxRU1SHYqu33pgAWcd/8MtHWnhFrbCBWpFLHptmS Hbn/u7ntUHXsndLvTfhQ3sHDkH0uvF0hUMlrVaS6J0lUG7rO+UlIb4f0CIl1yw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d01sbdz178H; Mon, 30 Jun 2025 14:21:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELOoW074995; Mon, 30 Jun 2025 14:21:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELOH2074992; Mon, 30 Jun 2025 14:21:24 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:24 GMT Message-Id: <202506301421.55UELOH2074992@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3feafab4a34c - stable/14 - namei: Make stackable filesystems check harder for jail roots List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3feafab4a34c95209cd4fc3e6224c324efc056f3 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3feafab4a34c95209cd4fc3e6224c324efc056f3 commit 3feafab4a34c95209cd4fc3e6224c324efc056f3 Author: Mark Johnston AuthorDate: 2025-05-23 12:52:24 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:30 +0000 namei: Make stackable filesystems check harder for jail roots Suppose a process has its cwd pointing to a nullfs directory, where the lower directory is also visible in the jail's filesystem namespace. Suppose that the lower directory vnode is moved out from under the nullfs mount. The nullfs vnode still shadows the lower vnode, and dotdot lookups relative to that directory will instantiate new nullfs vnodes outside of the nullfs mountpoint, effectively shadowing the lower filesystem. This phenomenon can be abused to escape a chroot, since the nullfs vnodes instantiated by these dotdot lookups defeat the root vnode check in vfs_lookup(), which uses vnode pointer equality to test for the process root. Fix this by extending nullfs and unionfs to perform the same check, exploiting the fact that the passed componentname is embedded in a nameidata structure to avoid changing the VOP_LOOKUP interface. That is, add a flag to indicate that containerof can be used to get the full nameidata structure, and perform the root vnode check on the lower vnode when performing a dotdot lookup. PR: 262180 Reviewed by: olce, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50418 (cherry picked from commit 7587f6d4840f8d363e457cddc14c184cf1fe7cc1) --- sys/fs/nullfs/null_vnops.c | 28 ++++++++++++++++++---------- sys/fs/unionfs/union_vnops.c | 21 +++++++++++++++++++++ sys/kern/vfs_cache.c | 11 +---------- sys/kern/vfs_lookup.c | 41 ++++++++++++++++++++++++++++++----------- sys/sys/namei.h | 5 ++++- 5 files changed, 74 insertions(+), 32 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index f2c426d41f61..41915da7f13c 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -407,17 +407,25 @@ null_lookup(struct vop_lookup_args *ap) /* * Renames in the lower mounts might create an inconsistent - * configuration where lower vnode is moved out of the - * directory tree remounted by our null mount. Do not try to - * handle it fancy, just avoid VOP_LOOKUP() with DOTDOT name - * which cannot be handled by VOP, at least passing over lower - * root. + * configuration where lower vnode is moved out of the directory tree + * remounted by our null mount. + * + * Do not try to handle it fancy, just avoid VOP_LOOKUP() with DOTDOT + * name which cannot be handled by the VOP. */ - if ((ldvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) != 0) { - KASSERT((dvp->v_vflag & VV_ROOT) == 0, - ("ldvp %p fl %#x dvp %p fl %#x flags %#jx", - ldvp, ldvp->v_vflag, dvp, dvp->v_vflag, (uintmax_t)flags)); - return (ENOENT); + if ((flags & ISDOTDOT) != 0) { + struct nameidata *ndp; + + if ((ldvp->v_vflag & VV_ROOT) != 0) { + KASSERT((dvp->v_vflag & VV_ROOT) == 0, + ("ldvp %p fl %#x dvp %p fl %#x flags %#jx", + ldvp, ldvp->v_vflag, dvp, dvp->v_vflag, + (uintmax_t)flags)); + return (ENOENT); + } + ndp = vfs_lookup_nameidata(cnp); + if (ndp != NULL && vfs_lookup_isroot(ndp, ldvp)) + return (ENOENT); } /* diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 7618e2575819..01378b06ba55 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -78,6 +78,21 @@ VNASSERT(((vp)->v_op == &unionfs_vnodeops), vp, \ ("%s: non-unionfs vnode", __func__)) +static bool +unionfs_lookup_isroot(struct componentname *cnp, struct vnode *dvp) +{ + struct nameidata *ndp; + + if (dvp == NULL) + return (false); + if ((dvp->v_vflag & VV_ROOT) != 0) + return (true); + ndp = vfs_lookup_nameidata(cnp); + if (ndp == NULL) + return (false); + return (vfs_lookup_isroot(ndp, dvp)); +} + static int unionfs_lookup(struct vop_cachedlookup_args *ap) { @@ -128,6 +143,12 @@ unionfs_lookup(struct vop_cachedlookup_args *ap) if (LOOKUP != nameiop && udvp == NULLVP) return (EROFS); + if (unionfs_lookup_isroot(cnp, udvp) || + unionfs_lookup_isroot(cnp, ldvp)) { + error = ENOENT; + goto unionfs_lookup_return; + } + if (udvp != NULLVP) { dtmpvp = udvp; if (ldvp != NULLVP) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index e25efe2986b2..2c2e18640a76 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5185,7 +5185,6 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) struct componentname *cnp; struct namecache *ncp; struct vnode *dvp; - struct prison *pr; u_char nc_flag; ndp = fpl->ndp; @@ -5197,15 +5196,7 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) /* * XXX this is racy the same way regular lookup is */ - for (pr = cnp->cn_cred->cr_prison; pr != NULL; - pr = pr->pr_parent) - if (dvp == pr->pr_root) - break; - - if (dvp == ndp->ni_rootdir || - dvp == ndp->ni_topdir || - dvp == rootvnode || - pr != NULL) { + if (vfs_lookup_isroot(ndp, dvp)) { fpl->tvp = dvp; fpl->tvp_seqc = vn_seqc_read_any(dvp); if (seqc_in_modify(fpl->tvp_seqc)) { diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index b7f751a364ce..1d303fecf493 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -612,12 +612,12 @@ namei(struct nameidata *ndp) } #endif ndp->ni_cnd.cn_cred = td->td_ucred; - KASSERT(ndp->ni_resflags == 0, ("%s: garbage in ni_resflags: %x\n", + KASSERT(ndp->ni_resflags == 0, ("%s: garbage in ni_resflags: %x", __func__, ndp->ni_resflags)); KASSERT(cnp->cn_cred && td->td_proc, ("namei: bad cred/proc")); KASSERT((cnp->cn_flags & NAMEI_INTERNAL_FLAGS) == 0, - ("namei: unexpected flags: %" PRIx64 "\n", - cnp->cn_flags & NAMEI_INTERNAL_FLAGS)); + ("namei: unexpected flags: %#jx", + (uintmax_t)(cnp->cn_flags & NAMEI_INTERNAL_FLAGS))); if (cnp->cn_flags & NOCACHE) KASSERT(cnp->cn_nameiop != LOOKUP, ("%s: NOCACHE passed with LOOKUP", __func__)); @@ -863,6 +863,30 @@ bad: return (error); } +struct nameidata * +vfs_lookup_nameidata(struct componentname *cnp) +{ + if ((cnp->cn_flags & NAMEILOOKUP) == 0) + return (NULL); + return (__containerof(cnp, struct nameidata, ni_cnd)); +} + +/* + * Would a dotdot lookup relative to dvp cause this lookup to cross a jail or + * chroot boundary? + */ +bool +vfs_lookup_isroot(struct nameidata *ndp, struct vnode *dvp) +{ + for (struct prison *pr = ndp->ni_cnd.cn_cred->cr_prison; pr != NULL; + pr = pr->pr_parent) { + if (dvp == pr->pr_root) + return (true); + } + return (dvp == ndp->ni_rootdir || dvp == ndp->ni_topdir || + dvp == rootvnode); +} + /* * FAILIFEXISTS handling. * @@ -1021,7 +1045,6 @@ vfs_lookup(struct nameidata *ndp) char *lastchar; /* location of the last character */ struct vnode *dp = NULL; /* the directory we are searching */ struct vnode *tdp; /* saved dp */ - struct prison *pr; size_t prev_ni_pathlen; /* saved ndp->ni_pathlen */ int docache; /* == 0 do not cache last component */ int wantparent; /* 1 => wantparent or lockparent flag */ @@ -1207,13 +1230,9 @@ dirloop: goto bad; } for (;;) { - for (pr = cnp->cn_cred->cr_prison; pr != NULL; - pr = pr->pr_parent) - if (dp == pr->pr_root) - break; - bool isroot = dp == ndp->ni_rootdir || - dp == ndp->ni_topdir || dp == rootvnode || - pr != NULL; + bool isroot; + + isroot = vfs_lookup_isroot(ndp, dp); if (__predict_false(isroot && (ndp->ni_lcf & (NI_LCF_STRICTREL | NI_LCF_STRICTREL_KTR)) != 0)) { if ((ndp->ni_lcf & NI_LCF_STRICTREL_KTR) != 0) diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 3db7b8e13749..5e9a5bf4a699 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -152,6 +152,7 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, #define LOCKSHARED 0x0100 /* Shared lock leaf */ #define NOFOLLOW 0x0000 /* do not follow symbolic links (pseudo) */ #define RBENEATH 0x100000000ULL /* No escape, even tmp, from start dir */ +#define NAMEILOOKUP 0x200000000ULL /* cnp is embedded in nameidata */ #define MODMASK 0xf000001ffULL /* mask of operational modifiers */ /* @@ -248,7 +249,7 @@ do { \ NDINIT_PREFILL(_ndp); \ NDINIT_DBG(_ndp); \ _ndp->ni_cnd.cn_nameiop = op; \ - _ndp->ni_cnd.cn_flags = flags; \ + _ndp->ni_cnd.cn_flags = (flags) | NAMEILOOKUP; \ _ndp->ni_segflg = segflg; \ _ndp->ni_dirp = namep; \ _ndp->ni_dirfd = dirfd; \ @@ -285,6 +286,8 @@ do { \ int namei(struct nameidata *ndp); int vfs_lookup(struct nameidata *ndp); +bool vfs_lookup_isroot(struct nameidata *ndp, struct vnode *dvp); +struct nameidata *vfs_lookup_nameidata(struct componentname *cnp); int vfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, bool refstart); From nobody Mon Jun 30 14:21:25 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d172khz60XBr; Mon, 30 Jun 2025 14:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d1347sz48Jq; Mon, 30 Jun 2025 14:21:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OMrftG6Fwggx0Ptl30a6QW88W66iGXBPRSNUZRSvFEI=; b=bRYNCD7gZFuYhQpuE1MP1eNdEkDsgfl9IrGDaZYQTZ76RnQc4CMb7xcNmK+BuX0AEE4U4y AYDK8mtgZ7oan6ZF4S5h6l289d+5CeLLrzdoXNCKCa+nZ7SIARKZfMkbAxdQZ4oMb60OmX K0f6XEc/rGDFJyj0vyf6GXpxc7d/GLzKm09SO6ZWRpy69jAB+rtI3xyxEO24F7pbgiWiws UoggScoPkJw8U4ONQIu6P2IHnN1tiCL9xL0Zlh1E0wl1leYvHhcw4dSk7+SV1AzVyoznJK mHf6H0PJ53W5lhOU8Hv1cOAjSAJNTKk4Byi8JKaUP26q0BonmX41TCxJp/b/ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OMrftG6Fwggx0Ptl30a6QW88W66iGXBPRSNUZRSvFEI=; b=e2FbhUgXCE+1ADJrJBa52B/qnNpVFUgBwO2B70B4RCxBxs2EH7xTNh9KMBW1EY3s8Cs8rt 0lPcYrdM9cfO++rg7mwJhwEQ+DQUEPoezX4avhoaqnWP5jfvB0MYscOJtWflZXc65pAU/i 2XG1N049EkYt+maajPIVEOqUZqICxjzmSiNaSazSLWg3btevmnKbn3w1n8Efvrvnxh2nYF 2kviclWdqBJr6cEezLbgcAbJ34oTVcwx1xjyTHpbZBtlrGIQHg/hucUqAya8WOLlnnv8BZ XEqt0QkroFu8kUXTkVIVmg9V8kPYLnP+vOdmiey89ArXZFokL5fUcnCc/fOVEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293285; a=rsa-sha256; cv=none; b=cC3mpVEtV5qBrUw6nz34JcUIxyfn1tlntRBY+DW1IEKw/JmUMmUwYmcDmHSgp2N60gRDng GKw5k8KpkQ81DccssVddgQanLd8DSqhl4Q58Aaw33vVQuvnlNcNcz6/1Wp5Wp+X5pOmpG1 P2XIV+2ILMu/9DbKcdOLm8GXCWSUvKNfo41dgEBttyfGhQvY8pbTfapY0pxc8IuNmmqDuC tO6nu1bFe0ViY3agdQ6JYUUp06zmLf0759hVqeagidCSHVgHhAUbt4TkCx4CkEgz9gjtee giNV4mNSUvQvpn92acCojqONzCozvVVJo1q/8HPVYMZCIaybrUtH/ucfT+/+uw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d12Sc9z175h; Mon, 30 Jun 2025 14:21:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELPDi075705; Mon, 30 Jun 2025 14:21:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELP6R075690; Mon, 30 Jun 2025 14:21:25 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:25 GMT Message-Id: <202506301421.55UELP6R075690@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3f4efe392b70 - stable/14 - namei: Remove a now-unused variable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3f4efe392b7039686057838d723a2d43ae144be5 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3f4efe392b7039686057838d723a2d43ae144be5 commit 3f4efe392b7039686057838d723a2d43ae144be5 Author: Mark Johnston AuthorDate: 2025-05-23 15:35:05 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:30 +0000 namei: Remove a now-unused variable Reported by: bapt Fixes: 7587f6d4840f ("namei: Make stackable filesystems check harder for jail roots") (cherry picked from commit 14ec281a09d7818def2083ef0c3e28f8101f4268) --- sys/kern/vfs_cache.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 2c2e18640a76..47f0893dab27 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5182,16 +5182,14 @@ static int __noinline cache_fplookup_dotdot(struct cache_fpl *fpl) { struct nameidata *ndp; - struct componentname *cnp; struct namecache *ncp; struct vnode *dvp; u_char nc_flag; ndp = fpl->ndp; - cnp = fpl->cnp; dvp = fpl->dvp; - MPASS(cache_fpl_isdotdot(cnp)); + MPASS(cache_fpl_isdotdot(fpl->cnp)); /* * XXX this is racy the same way regular lookup is From nobody Mon Jun 30 14:21:26 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d25td5z60X7K; Mon, 30 Jun 2025 14:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d23ptfz4869; Mon, 30 Jun 2025 14:21:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fDyRnRGOKD1lkDLcQXJLkhj4qRyS7ZUbL7NtFchL5f0=; b=ikh4WP8zS3cpZUvt5EBUYCRW2TiSqfo7N6PYbv6OwJl5JMwyZXSOQefQu6TUstWnKUC+SQ 9I1FhXcZwISQz2GLnxxbbGLB4upVyLlSQadbd+7Q6xIDvEba0pAIzbN4Uflt0Rq2WWTLWj KZyemDObSbq15hifs/ruqlOHUkWh5nXgwbr+w0akrTxM428vO/UhLxAhP4Y4OlFWb8PKJb WZFlrfVM+CVeisEqoSa92Opp8zr/2Dkbs3M7I5Am/yP6EoW3cqwst1msv9ggVOE2jJT6VX KBfiyhrQHRJS9+ZXSujlLsPt0fTZm4pIvXKDoVa4C1Rmm0GNuDaU6lig3YnvvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fDyRnRGOKD1lkDLcQXJLkhj4qRyS7ZUbL7NtFchL5f0=; b=gh/EYEyL3t7uTjAoYtKh4VnCred//JDdmlXIqK7BfkXmpOscE4gGjqMucYTelvp5rKWv39 HaWTdnBeOC2xRNrOOBkYXTRW+IZnrMd5dEDUwuXLbA0AbmCF6SroL30Q2fA2uCXDc4ne/k Wcc/7DOQnHf/H7h1tOQ2Z38xcXDyH/B7cPpZdG2ajk3OFOUmSQ/vSRcedwC6/LGLgzq+65 AORpdHJ7wH7LyriYQ7CYQIggxrYUW4yei2BdbG5dcUJXHGiv/rm1dBmu3/dfNRQ+8jocLS TN2M2SDADeiDId5Uf+7dpII/2FWaU7espQVcsxeQ8ZTKpQMw8q9OxKQtSfB5YA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293286; a=rsa-sha256; cv=none; b=Xdlz4AibLocVUebdihwvBK8EuUGG1WSxxyskUjODPeXGV+joHpYwv0r6niKBt4dDxPpOmk rdh22iX8lH2hQqN1BLWRYP/M25FyjlvfFDi6ukC0+e7urkc4541HZAd/O+4NNfcnJPzzsM uEP5ed37Wj5v7bo9PPyInPpRgrPQxzVzMWLR497CS3pGhXANScmejudUB6NmzDVrgHB6+6 GDZ3a4cRcFIEjaNrkmN0OLsC3MwSoYy3cclvqvRIH0waU91nlPt7UWP+jMUCJgMazkNuzC PFMnndJxsd/Q0CaNEl2e9YXuznAKTHoCukfTnksRAE0n6ETFdDQncePSlxZ4aw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d23Nv9z178J; Mon, 30 Jun 2025 14:21:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELQWw076111; Mon, 30 Jun 2025 14:21:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELQYa076108; Mon, 30 Jun 2025 14:21:26 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:26 GMT Message-Id: <202506301421.55UELQYa076108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 031cd548775c - stable/14 - vfs cache: Add NAMEILOOKUP to the whitelist of fastpath lookup flags List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 031cd548775c26314e6ae9cad35b01c5ab1aea6c Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=031cd548775c26314e6ae9cad35b01c5ab1aea6c commit 031cd548775c26314e6ae9cad35b01c5ab1aea6c Author: Mark Johnston AuthorDate: 2025-05-27 13:27:49 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:30 +0000 vfs cache: Add NAMEILOOKUP to the whitelist of fastpath lookup flags Otherwise the lockless name lookup path is inadvertently disabled since NAMEILOOKUP isn't recognized. Reviewed by: olce, kib Fixes: 7587f6d4840f ("namei: Make stackable filesystems check harder for jail roots") Differential Revision: https://reviews.freebsd.org/D50532 (cherry picked from commit f4158953007f557061d91f99d2374d48d8376cc6) --- sys/kern/vfs_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 47f0893dab27..3942371c0962 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4369,7 +4369,7 @@ cache_fpl_terminated(struct cache_fpl *fpl) (NC_NOMAKEENTRY | NC_KEEPPOSENTRY | LOCKLEAF | LOCKPARENT | WANTPARENT | \ FAILIFEXISTS | FOLLOW | EMPTYPATH | LOCKSHARED | ISRESTARTED | WILLBEDIR | \ ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2 | NOCAPCHECK | OPENREAD | \ - OPENWRITE | WANTIOCTLCAPS) + OPENWRITE | WANTIOCTLCAPS | NAMEILOOKUP) #define CACHE_FPL_INTERNAL_CN_FLAGS \ (ISDOTDOT | MAKEENTRY | ISLASTCN) From nobody Mon Jun 30 14:21:27 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d35QVkz60X7L; Mon, 30 Jun 2025 14:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d34NPgz48Kh; Mon, 30 Jun 2025 14: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=1751293287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rtYkXFCN1i2+gbWbgkU+SGqOvDJZ2/fCpD7cNXxLapU=; b=lIEBezHcbKasps/3E6U31HBFzTA1/jrm/al9sfctaAOPZl19sDFzci83fcWGvFI7PNnGcH O+Kr6m6JSVyn9+HqCDdF3p+vzZh7OYA0otlDhUpyT7vA2aoDUuWjpKWkJdHBYPoMYrvLKk 8N8fvSeEexiqjTWNNkN1UqaMePz8qn8kKuOt1qGIR4VDQGoi/o0N76pYL2PvXp2pj8/7C5 r5Nr/IUI8QZyMkeT02GimInR3MNX+X76PvJ0s0iVrqLJYYZ1sNXp1cZN13+RvuayCBJWgI 1Lq5Uvlj7ulufOXFbPXvwmhaAD65lXtBiPId+MPtoWww0vpqxIwVaAVNvSTyPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rtYkXFCN1i2+gbWbgkU+SGqOvDJZ2/fCpD7cNXxLapU=; b=u2bXdHSPFtkM+MWTF0st0bn4mScIIECohrm3IWQJ1UZ3vOkBOMd0eEGr2+2LZK9rqdka1I EuGBBojUF7rB8Y7RsHHbUEuTntLsQjmIMA+YGKs6bQeFhqr4qkcWPJFBVxaMz3dnRffBFa iYygMqqAnFtA5APYyg0wv+RqqfhzRL61gROdEJzSRsVDjx5ZHjgw8WTvdWLfR1DW9OyKKu PnNpo/bXVsYhxFxtNSbvf6epHYP8njsd4D3kHJ9IGWc/IvmeQll8gU0isJdtG51u2ku29v FY5dS4Fg0frmZyDAF8kSS9b+HWCUGs4OYbcsbZNJ9RkXOn80og+RsHfJVm3v3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293287; a=rsa-sha256; cv=none; b=gkIna0xS/szJsNkiVFg8qQvhSpsWmmKxUPOlzB9xElKomXnWAW6ahI2sHVCEyEdAx1j0Sx zUwaW4ydsadwQjj8uarAND+ues3W68imzsFCcrYAojlavL+yKXPVDCsGmHfpzfgUImWppJ yGBRy8IZz9Sdmxv2qcZ4NVYefNgkXCACav94tumP9z/ND4ppdjtN1An5WUcT8SOOc2SzP4 CI1vjKpGW4puu/57cNvwuPmj+aZN9VzbtwalGWXrtj9HGsuifVHPWFgm0L1ygZ0On2Kv5l Xe1WTL0RIPUjW72RVucjebFz7Xh7fCw7uOr3jfm8pI9LVCrH+JIFxQvvah3X5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d33vvRz179C; Mon, 30 Jun 2025 14:21:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELR3h076144; Mon, 30 Jun 2025 14:21:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELRpd076141; Mon, 30 Jun 2025 14:21:27 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:27 GMT Message-Id: <202506301421.55UELRpd076141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a66767844690 - stable/14 - vfs: Don't clobber namei flags in vn_open_cred() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a66767844690dfd82e14df2d22bd9bc40e46546b Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a66767844690dfd82e14df2d22bd9bc40e46546b commit a66767844690dfd82e14df2d22bd9bc40e46546b Author: Mark Johnston AuthorDate: 2025-05-28 13:35:24 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:30 +0000 vfs: Don't clobber namei flags in vn_open_cred() Otherwise NAMEILOOKUP is cleared. More generally it seems quite surprising that the flags set by vn_open_cred() callers are not automatically preserved. Modify open2nameif() such that it takes already-set namei flags into account. Reviewed by: olce, kib Fixes: 7587f6d4840f ("namei: Make stackable filesystems check harder for jail roots") Differential Revision: https://reviews.freebsd.org/D50531 (cherry picked from commit e05e33041c252dc236939683c01ca4b7b083562c) --- sys/kern/vfs_vnops.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index c447ceea1634..c3666ca99c26 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -197,11 +197,11 @@ vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp) } static uint64_t -open2nameif(int fmode, u_int vn_open_flags) +open2nameif(int fmode, u_int vn_open_flags, uint64_t cn_flags) { uint64_t res; - res = ISOPEN | LOCKLEAF; + res = ISOPEN | LOCKLEAF | cn_flags; if ((fmode & O_RESOLVE_BENEATH) != 0) res |= RBENEATH; if ((fmode & O_EMPTY_PATH) != 0) @@ -210,12 +210,17 @@ open2nameif(int fmode, u_int vn_open_flags) res |= OPENREAD; if ((fmode & FWRITE) != 0) res |= OPENWRITE; + if ((fmode & O_NOFOLLOW) != 0) + res &= ~FOLLOW; if ((vn_open_flags & VN_OPEN_NOAUDIT) == 0) res |= AUDITVNODE1; + else + res &= ~AUDITVNODE1; if ((vn_open_flags & VN_OPEN_NOCAPCHECK) != 0) res |= NOCAPCHECK; if ((vn_open_flags & VN_OPEN_WANTIOCTLCAPS) != 0) res |= WANTIOCTLCAPS; + return (res); } @@ -247,7 +252,9 @@ restart: return (EINVAL); else if ((fmode & (O_CREAT | O_DIRECTORY)) == O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; - ndp->ni_cnd.cn_flags = open2nameif(fmode, vn_open_flags); + ndp->ni_cnd.cn_flags = open2nameif(fmode, vn_open_flags, + ndp->ni_cnd.cn_flags); + /* * Set NOCACHE to avoid flushing the cache when * rolling in many files at once. @@ -256,8 +263,8 @@ restart: * exist despite NOCACHE. */ ndp->ni_cnd.cn_flags |= LOCKPARENT | NOCACHE | NC_KEEPPOSENTRY; - if ((fmode & O_EXCL) == 0 && (fmode & O_NOFOLLOW) == 0) - ndp->ni_cnd.cn_flags |= FOLLOW; + if ((fmode & O_EXCL) != 0) + ndp->ni_cnd.cn_flags &= ~FOLLOW; if ((vn_open_flags & VN_OPEN_INVFS) == 0) bwillwrite(); if ((error = namei(ndp)) != 0) @@ -325,9 +332,8 @@ restart: } } else { ndp->ni_cnd.cn_nameiop = LOOKUP; - ndp->ni_cnd.cn_flags = open2nameif(fmode, vn_open_flags); - ndp->ni_cnd.cn_flags |= (fmode & O_NOFOLLOW) != 0 ? NOFOLLOW : - FOLLOW; + ndp->ni_cnd.cn_flags = open2nameif(fmode, vn_open_flags, + ndp->ni_cnd.cn_flags); if ((fmode & FWRITE) == 0) ndp->ni_cnd.cn_flags |= LOCKSHARED; if ((error = namei(ndp)) != 0) From nobody Mon Jun 30 14:21:28 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d46Tfmz60XTg; Mon, 30 Jun 2025 14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d45DRsz4805; Mon, 30 Jun 2025 14:21:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293288; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ei2F4rPJR/WByS3+1PVisg/o9nJFFfgh1VxFPrywxHY=; b=OPkiN3ZZIoK4bT7onKgqGaXT3KK1/d5kVBqVvSW8hBYoLGtsEwKx5pCyXn8BJPZp/uBvUZ 4fI33KbclhmGon6R4Z7RWNnrSBZ2hvTd68TUbE8UuEavgPaxc9HriXLz83zD1qKfLaj/w3 SZX5H0QQn6RslA83Xf3aArM38HklyUJoL+hY2ROtG1zxYabknpbNI9bF4pIT6uKAW4RDUg hwmtOhMclEFnyKj8A8OuoeUFcvw/rRxlTVy7wgqhvBPtuEMmhcyWavdYgTHRF2+ajqgn/c kvhOOKOLyX89/9al/J4/1ZgxzuJ8WU9WshIhlaWyG0EHc5KTY4k/QStCbgkIww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293288; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ei2F4rPJR/WByS3+1PVisg/o9nJFFfgh1VxFPrywxHY=; b=XHyBUyNGqvzygZ33LgTxFjlU8fcwvJcUK59IS8V9gi6hVRnKvdtP98VqK8X4JuAzC8duf4 hfeemR8qCE36nlgDX1VKYDx/LgedRkt+k9jEpYfW9wfdHF2+UR57ngE33rjgGQqVp9ILFk rOc1ZqJDGU1MN+o5iPJYO4+1dp+GTsKKLvmSnMqAI2Tx7DWXBUIsCn2KpjCu4cW7ibP0IM +lUyK09NwCPY6HXtwQMaKLYYDSwz9nukJWPcgckdACE7lOuWe+bKCOEkqg25H3dBJJ7jBr wLkJ+7S01AXsIXD03VpMZE51RfSie4GQI+IQ6MSpyVep+GdA1lQgUzbPsjKVAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293288; a=rsa-sha256; cv=none; b=Bh6VCj9M/ukLic93wDbaGGIWp7RhFBEuUMlwx9AhrDla2iRAKAobHZpQ/8pqal4v3dGKL8 8TVhIdLrJw+MMkE2cVFyXDPBqt510yIF0M3O859ev8/X1fGMgML9vorhSC8wBzAsqCgQqz T5uqRMKrrW3AgGZ8B51QRknRhIiV9v7nlzxvWrBVlHm0tewY+LWvl/Y7bYs//uTXtrv5AP Q0H6nLxf7cTtF8NmK5g+6lQ5MkaIr/dL6KfMbtu1CO8ppN6F1J4vKlbdmA5/qEcSr0udXd mF6fQC5DA7OhsbVI34TN8qEOKh0OwNqGeq93eyQWc0uU/u0nR5yOxlMGcpa6qQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d44rXlz16qM; Mon, 30 Jun 2025 14:21:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELS5m076184; Mon, 30 Jun 2025 14:21:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELSx8076181; Mon, 30 Jun 2025 14:21:28 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:28 GMT Message-Id: <202506301421.55UELSx8076181@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 53963866f708 - stable/14 - namei: clear internal flags in NDREINIT() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 53963866f7088dd96f6d56169e6b4fb899277306 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=53963866f7088dd96f6d56169e6b4fb899277306 commit 53963866f7088dd96f6d56169e6b4fb899277306 Author: Konstantin Belousov AuthorDate: 2025-05-28 21:51:42 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:30 +0000 namei: clear internal flags in NDREINIT() same as it is done for NDRESTART() Fixes: e05e33041c252 Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation (cherry picked from commit 58b2bd33aff71c0268d99d63e9c83f6544d3beb3) --- sys/sys/namei.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 5e9a5bf4a699..7033e5469240 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -265,6 +265,7 @@ do { \ filecaps_free(&_ndp->ni_filecaps); \ _ndp->ni_resflags = 0; \ _ndp->ni_startdir = NULL; \ + _ndp->ni_cnd.cn_flags &= ~NAMEI_INTERNAL_FLAGS; \ } while (0) #define NDPREINIT(ndp) do { \ From nobody Mon Jun 30 14:21:29 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d62y9pz60X2b; Mon, 30 Jun 2025 14:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d56T4xz48Rl; Mon, 30 Jun 2025 14:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U0/HzoZMhXPphqZNiWnbAs+XoQQ3pEyQPE7If7VFGAw=; b=pxpuWDVK+wCOK3w18YNngw0WRopHejkOGyWYjilMBRVp6vnqHJTCKM5rto3Vj1uEpuKH8Y LqL/c58kW2bUMLdd7Y5R9H037dwmLjXaRkdBi8r945WO01G2Td4UvdVEF6G62mvGB9/8So 7YR173HNatPbeOkJ//Z55OCPNhQ0SRafK0tN9B0kuYZiW6tlrngGBbLzzPbEQ+cBWyWImI ixJ0ZhLDnLo2UaRL6upW0EMJOSO7a94bZpObrlQuhXRsJPNg9yBCqoozczn4OfIBul/Ymq iGzw1ByUEFd/0vFsKLGVfredWMB07CRCg9fvrp/+TCTCcoUmK7LofctpvhdTFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U0/HzoZMhXPphqZNiWnbAs+XoQQ3pEyQPE7If7VFGAw=; b=rVTfFPiWY+YdnsMY3RrLva7knTU0xGMZYcarS/VsumuWT4jdhKIofZADqHfp6aMwqgVcuk yf1Ft9Y3NHaB4sNXh/+NpSCPwuM6toZlam8LLgfoFZ3FwyocvFUIaqtz/JHvXa+bIq3du0 4We5LfVLg4R+YdsVWFTBz/N/1b6/VSI8amxDdSQDT3bLc7A8XvmqPkF0r6XGmEuTLBIqiI SuVMC0fFIN6BwkVjTFOnCjaQyzgd0rybWRqU0AIBRXJ72ApFylgQ6LH/KxMaAsYVU9PziW NPTY7nCIQiVH9RSwKliZz4/VArFIKCIBbXtUr+I0743gngz9iOTX1gKFNCoHDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293290; a=rsa-sha256; cv=none; b=FLz7ha7ZUwaTT6u/RIcOhGLDLOQXJ1vrtX3UG6x9v5la3KoVQFxd7cpjeDqzifeb85xTdT F4yezO6e3EXp5MjNaMKgpljJDgDv6STL2W5556nbxSR2NHk1Nal6xOvHQIiQ/CFZruYfp4 1YCI3TKi1zF4oWBXx4atsV+SaaYyaoS7uEttN29jqGXzKThQmRfSpVaxMZiiPf6dl/Ex7V QT8ZpuxqazjCTqXWc7auRmIHg46Xjol7jWOJ6MrYfs/0V+YabdfuHMn515JBL7OxMxjAHZ CojGvLzHDU1DDvvNvOEZ9ner1OhdxncZTQQOHAnLyk3D4D1UwcChUwAUsWXgEA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d55Tmhz175j; Mon, 30 Jun 2025 14:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELTS4076220; Mon, 30 Jun 2025 14:21:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELTF3076217; Mon, 30 Jun 2025 14:21:29 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:29 GMT Message-Id: <202506301421.55UELTF3076217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f56b66f1260a - stable/14 - tests: Add a regression test for commit 7587f6d4840f8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f56b66f1260a33e49c65bbc05213ec8267978a93 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f56b66f1260a33e49c65bbc05213ec8267978a93 commit f56b66f1260a33e49c65bbc05213ec8267978a93 Author: Mark Johnston AuthorDate: 2025-05-28 15:28:36 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:30 +0000 tests: Add a regression test for commit 7587f6d4840f8 Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50533 (cherry picked from commit a5dac34f6e98c47bd7cb1946e39cc45432e167a8) --- tests/sys/kern/Makefile | 2 + tests/sys/kern/jail_lookup_root.c | 171 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 173 insertions(+) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index 46977bedef98..89c993a39dc7 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -19,6 +19,7 @@ ATF_TESTS_C+= kern_descrip_test # One test modifies the maxfiles limit, which can cause spurious test failures. TEST_METADATA.kern_descrip_test+= is_exclusive="true" ATF_TESTS_C+= fdgrowtable_test +ATF_TESTS_C+= jail_lookup_root ATF_TESTS_C+= kill_zombie .if ${MK_OPENSSL} != "no" ATF_TESTS_C+= ktls_test @@ -71,6 +72,7 @@ PROGS+= coredump_phnum_helper PROGS+= pdeathsig_helper PROGS+= sendfile_helper +LIBADD.jail_lookup_root+= jail util CFLAGS.sys_getrandom+= -I${SRCTOP}/sys/contrib/zstd/lib LIBADD.sys_getrandom+= zstd LIBADD.sys_getrandom+= c diff --git a/tests/sys/kern/jail_lookup_root.c b/tests/sys/kern/jail_lookup_root.c new file mode 100644 index 000000000000..609f86ac4c66 --- /dev/null +++ b/tests/sys/kern/jail_lookup_root.c @@ -0,0 +1,171 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Mark Johnston + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +static void +build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, + size_t len) +{ + int i; + + if (*iovlen < 0) + return; + i = *iovlen; + *iov = realloc(*iov, sizeof **iov * (i + 2)); + if (*iov == NULL) { + *iovlen = -1; + return; + } + (*iov)[i].iov_base = strdup(name); + (*iov)[i].iov_len = strlen(name) + 1; + i++; + (*iov)[i].iov_base = val; + if (len == (size_t)-1) { + if (val != NULL) + len = strlen(val) + 1; + else + len = 0; + } + (*iov)[i].iov_len = (int)len; + *iovlen = ++i; +} + +static void +free_iovec(struct iovec **iov, int *iovlen) +{ + int i; + + for (i = 0; i < *iovlen; i += 2) + free((*iov)[i].iov_base); + free(*iov); +} + +static void +mkdir_checked(const char *dir, mode_t mode) +{ + int error; + + error = mkdir(dir, mode); + ATF_REQUIRE_MSG(error == 0 || errno == EEXIST, + "mkdir %s: %s", dir, strerror(errno)); +} + +static void __unused +mount_nullfs(const char *dir, const char *target) +{ + struct iovec *iov; + char errmsg[1024]; + int error, iovlen; + + iov = NULL; + iovlen = 0; + + build_iovec(&iov, &iovlen, __DECONST(char *, "fstype"), + __DECONST(char *, "nullfs"), (size_t)-1); + build_iovec(&iov, &iovlen, __DECONST(char *, "fspath"), + __DECONST(char *, target), (size_t)-1); + build_iovec(&iov, &iovlen, __DECONST(char *, "from"), + __DECONST(char *, dir), (size_t)-1); + build_iovec(&iov, &iovlen, __DECONST(char *, "errmsg"), + errmsg, sizeof(errmsg)); + + errmsg[0] = '\0'; + error = nmount(iov, iovlen, 0); + ATF_REQUIRE_MSG(error == 0, "nmount: %s", + errmsg[0] != '\0' ? errmsg : strerror(errno)); + + free_iovec(&iov, &iovlen); +} + +ATF_TC_WITH_CLEANUP(jail_root); +ATF_TC_HEAD(jail_root, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(jail_root, tc) +{ + int error, fd, jid; + + mkdir_checked("./root", 0755); + mkdir_checked("./root/a", 0755); + mkdir_checked("./root/b", 0755); + mkdir_checked("./root/a/c", 0755); + + jid = jail_setv(JAIL_CREATE | JAIL_ATTACH, + "name", "nullfs_jail_root_test", + "allow.mount", "true", + "allow.mount.nullfs", "true", + "enforce_statfs", "1", + "path", "./root", + "persist", NULL, + NULL); + ATF_REQUIRE_MSG(jid >= 0, "jail_setv: %s", jail_errmsg); + + mount_nullfs("/a", "/b"); + + error = chdir("/b/c"); + ATF_REQUIRE(error == 0); + + error = rename("/a/c", "/c"); + ATF_REQUIRE(error == 0); + + /* Descending to the jail root should be ok. */ + error = chdir(".."); + ATF_REQUIRE(error == 0); + + /* Going beyond the root will trigger an error. */ + error = chdir(".."); + ATF_REQUIRE_ERRNO(ENOENT, error != 0); + fd = open("..", O_RDONLY | O_DIRECTORY); + ATF_REQUIRE_ERRNO(ENOENT, fd < 0); +} +ATF_TC_CLEANUP(jail_root, tc) +{ + struct statfs fs; + fsid_t fsid; + int error, jid; + + error = statfs("./root/b", &fs); + if (error != 0) + err(1, "statfs ./b"); + fsid = fs.f_fsid; + error = statfs("./root", &fs); + if (error != 0) + err(1, "statfs ./root"); + if (fsid.val[0] != fs.f_fsid.val[0] || + fsid.val[1] != fs.f_fsid.val[1]) { + error = unmount("./root/b", 0); + if (error != 0) + err(1, "unmount ./root/b"); + } + + jid = jail_getid("nullfs_jail_root_test"); + if (jid >= 0) { + error = jail_remove(jid); + if (error != 0) + err(1, "jail_remove"); + } +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, jail_root); + return (atf_no_error()); +} From nobody Mon Jun 30 14:21:30 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d75451z60XCS; Mon, 30 Jun 2025 14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d672K4z48WS; Mon, 30 Jun 2025 14:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yu/IsirxCx3hudaSaa/yJLTW29yQo7YuNwgQgMfapkA=; b=yH/dn7xy/d6dQBTIPXeGfkiuUVUMF7L6ciblLg3wK48G2w42VYlLU09sgiXXXvxaISippK tQ0am1p2rKiQQnLY/K72mF16VPdYQtQZQ/wnV1igS7a/5ZSrSb+eAOeulRTblcvQ+FmHXZ aVHvdbQJSMU2tIvmxZZmV5HTSvwJJYueD5RtnXYeVuygK7CsEmvaiwBEfcMbpDVq6brStJ Lw5Xe5/sMX/XwBnRO0BNg090n5f9SrBCtGfXscCHyGXaw+h4KaAM6gWEIog2JipMAKHjr/ OacTXsnFNFiEiSpKjHpERmm4y7qHGODDCyMeBbczdd4KPogUCUn25ipaOhQzfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yu/IsirxCx3hudaSaa/yJLTW29yQo7YuNwgQgMfapkA=; b=WxJaTmrhh4peGY/75b1id+8CP0z5DkJT0oRq92I75S/xg18f2ryjv9V60ZItcJo8g1eTlA rWDcZq1zV0r/c5fFL/c8+wygkxrn+f+xvPBCN5i6q0vr4j1fbxgnh5WtRWzS1+PdIvBcmu H3OJpyi4vhgMRbgOIz60pUJjMeOBdOoqGvkl0Du/u0U+vbbpRaWdXRqTmll2q7c2+X/q8l 9uutxASvbuOrfL6cbx9KKPPhHbg09olvmU42cP1uQdP/f2BQ3HT8lEw4gczlCF6BG+bfeI PhZMQ/GepvbbZQj36LWPHW9jD7UvPy+E74p8xqJCRk6xXK4wxVLwOkSlMBmjrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293291; a=rsa-sha256; cv=none; b=ZCPoPi5uiNmT8OWWh1sDc+Pn4n4mlqPVtjwTkeCyF/kBzvD11R3dGKc7Nki0fO2MkvAorQ AXhy+sGUk+4eQFZuhk5/3nqnf6K1CnVyOTslEo6lJ+hYEXNgV1ly4MPGnZWLTlPZ+AA0Nq Kz1+e1wcNKjFU1H+UWJ3Uy7M06FdU7YHO+h7Z3eNvlZ0OiaHxV4dCuW4vbC7Xszk2MHXs0 tYzo3AmuwmPnuQcBCsxEAtYZFS2bXfnFjloUz6OAMlGtbjDAVDCMOYgrTN4+/Iu4W2gu5x gn3IG8x2B9VV9j1aqdCGqUlwh1yxwPw8pdpugQ7mkAbdKOiOaAHWc8uQj5U0RQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d66Q04z178L; Mon, 30 Jun 2025 14:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELUJK076254; Mon, 30 Jun 2025 14:21:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELU0s076251; Mon, 30 Jun 2025 14:21:30 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:30 GMT Message-Id: <202506301421.55UELU0s076251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 336fec57a6cc - stable/14 - linux: Fix usage of ptrace(PT_GET_SC_ARGS) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 336fec57a6cc0a4ee58ed9a094905ad4ad7030fe Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=336fec57a6cc0a4ee58ed9a094905ad4ad7030fe commit 336fec57a6cc0a4ee58ed9a094905ad4ad7030fe Author: Mark Johnston AuthorDate: 2025-06-13 19:03:03 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:30 +0000 linux: Fix usage of ptrace(PT_GET_SC_ARGS) The native handler expects the argument to be a pointer to an array of 8 syscall arguments, whereas the emulation provided an array that holds up to 6. Handle this by adding a new range of Linuxulator-specific ptrace commands. In particular, introduce PTLINUX_GET_SC_ARGS, which always copies exactly six arguments. This fixes the problem and removes the hack of checking the target thread ABI to decide whether to apply a Linux-specific quirk to PT_GET_SC_ARGS. Reviewed by: kib MFC after: 2 weeks Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50758 (cherry picked from commit 48a656c588f9fb995b9c524b57dd5febd9f69168) --- sys/compat/freebsd32/freebsd32_misc.c | 3 +++ sys/compat/linux/linux_ptrace.c | 18 ++++-------------- sys/kern/sys_process.c | 27 +++++++++++++++++++++------ sys/sys/ptrace.h | 8 ++++++++ 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index a8331897316d..951d9c28b7f1 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1177,6 +1177,9 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) pscr_args[i] = pscr_args32[i]; r.sr.pscr_args = pscr_args; break; + case PTLINUX_FIRST ... PTLINUX_LAST: + error = EINVAL; + break; default: addr = uap->addr; break; diff --git a/sys/compat/linux/linux_ptrace.c b/sys/compat/linux/linux_ptrace.c index 421760eab2a9..0dbfd2177122 100644 --- a/sys/compat/linux/linux_ptrace.c +++ b/sys/compat/linux/linux_ptrace.c @@ -386,21 +386,11 @@ linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, if (lwpinfo.pl_flags & PL_FLAG_SCE) { si.op = LINUX_PTRACE_SYSCALL_INFO_ENTRY; si.entry.nr = lwpinfo.pl_syscall_code; - /* - * The use of PT_GET_SC_ARGS there is special, - * implementation of PT_GET_SC_ARGS for Linux-ABI - * callers emulates Linux bug which strace(1) depends - * on: at initialization it tests whether ptrace works - * by calling close(2), or some other single-argument - * syscall, _with six arguments_, and then verifies - * whether it can fetch them all using this API; - * otherwise it bails out. - */ - error = kern_ptrace(td, PT_GET_SC_ARGS, pid, - &si.entry.args, sizeof(si.entry.args)); + error = kern_ptrace(td, PTLINUX_GET_SC_ARGS, pid, + si.entry.args, sizeof(si.entry.args)); if (error != 0) { - linux_msg(td, "PT_GET_SC_ARGS failed with error %d", - error); + linux_msg(td, + "PT_LINUX_GET_SC_ARGS failed with error %d", error); return (error); } } else if (lwpinfo.pl_flags & PL_FLAG_SCX) { diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 4d1d0ef21a15..f81013ffb842 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -696,6 +696,9 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) break; r.sr.pscr_args = pscr_args; break; + case PTLINUX_FIRST ... PTLINUX_LAST: + error = EINVAL; + break; default: addr = uap->addr; break; @@ -1172,7 +1175,9 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) break; case PT_GET_SC_ARGS: - CTR1(KTR_PTRACE, "PT_GET_SC_ARGS: pid %d", p->p_pid); + case PTLINUX_GET_SC_ARGS: + CTR2(KTR_PTRACE, "%s: pid %d", req == PT_GET_SC_ARGS ? + "PT_GET_SC_ARGS" : "PT_LINUX_GET_SC_ARGS", p->p_pid); if (((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) == 0 && td2->td_sa.code == 0) #ifdef COMPAT_FREEBSD32 @@ -1182,11 +1187,21 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) error = EINVAL; break; } - bzero(addr, sizeof(td2->td_sa.args)); - /* See the explanation in linux_ptrace_get_syscall_info(). */ - bcopy(td2->td_sa.args, addr, SV_PROC_ABI(td->td_proc) == - SV_ABI_LINUX ? sizeof(td2->td_sa.args) : - td2->td_sa.callp->sy_narg * sizeof(syscallarg_t)); + if (req == PT_GET_SC_ARGS) { + bzero(addr, sizeof(td2->td_sa.args)); + bcopy(td2->td_sa.args, addr, td2->td_sa.callp->sy_narg * + sizeof(syscallarg_t)); + } else { + /* + * Emulate a Linux bug which which strace(1) depends on: + * at initialization it tests whether ptrace works by + * calling close(2), or some other single-argument + * syscall, _with six arguments_, and then verifies + * whether it can fetch them all using this API; + * otherwise it bails out. + */ + bcopy(td2->td_sa.args, addr, 6 * sizeof(syscallarg_t)); + } break; case PT_GET_SC_RET: diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h index 3cce2c088f0b..85c6b2d5366a 100644 --- a/sys/sys/ptrace.h +++ b/sys/sys/ptrace.h @@ -89,8 +89,16 @@ #define PT_SC_REMOTE 44 /* Execute a syscall */ #define PT_FIRSTMACH 64 /* for machine-specific requests */ +#define PT_LASTMACH 127 #include /* machine-specific requests, if any */ +#ifdef _KERNEL +/* Space for Linux ptrace emulation. */ +#define PTLINUX_FIRST 128 +#define PTLINUX_LAST 191 +#define PTLINUX_GET_SC_ARGS (PTLINUX_FIRST + 0) +#endif + /* Events used with PT_GET_EVENT_MASK and PT_SET_EVENT_MASK */ #define PTRACE_EXEC 0x0001 #define PTRACE_SCE 0x0002 From nobody Mon Jun 30 14:21:31 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d84NqDz60X2f; Mon, 30 Jun 2025 14:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d80zctz4874; Mon, 30 Jun 2025 14:21:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5UJh35miaTTS63BrYPz2VpW/B10/bUlO8NslMDTkBko=; b=s2wjkFSfLcpkiXlWivKD7B1Gsuiu9DtKnWb92RfbHBuLZvHuL8+pwS18yL5UtBTeMfs5qQ 2nKqVciNXFOHHPHGagnN3PPcm6yw16UI0ITGUFagCtn2AaR25OMr63WM+iOEksO02fhElf BP7W9L+kquDD2gNkLZY0mpSfyuZI7VdXh9/7/7Frgu3Tl9EmzR545n2NFKTDHxJnJtT4y1 Tnyulbr2aGQR8uO9+W2mf7Mzu4/g9vVJUun2x/3x6RjYn27dk8OE64nSl1/1gIWjKL5GUJ HjKDRVHNMOVAhSkispNvICYAeaVR2uag/w0NINGwiRhPs9EfLqGMT/sRUWqTMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5UJh35miaTTS63BrYPz2VpW/B10/bUlO8NslMDTkBko=; b=b8T6c9FXnN8GqxWZKCg5/ig7kPGdhdTIe4fn4pBqZbw3ZrlH/hPiHbkBqgSJE8BX4UfPmX cipmb4PuCfaWF/ax7fBumTD9918RwGcabPJPTLD2qHT2F7ZJz1Cu1vy3erLGYIu//FK+rE oMerMyFPEr/r5ZXuj4N931zXZCJD54fqX0sYsNUmx4bA6AQEX/hlMY49fZ2tA3mgc/bEmW D2tQqt8poXVNM6ZtJpb8jn5ZHCyxIqyfRkHY4O9/pBmgyXklRJnSw5DRgonxKIxglVzAL+ 6lZvLjvjqOjVs40deT/i93gw/7flBJpLBUZ76WZ0zRHFvuUGICP9O8MD+F/Gyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293292; a=rsa-sha256; cv=none; b=PYn5aM57QDK0wtkVD1GXDWG9/xPFoDr6nzSQPPI30vdqC+Tk3gfgTvTVjOfhyfGk/7HKJq sbN4ePyh/S6O6suqDJJOcyD1t4aGtJSbGyLSi7Npqb7Rp39W1Tn1iMlG8QwGjP78zK52Dw X922aozSkjjOfVvbF4JSm0+NMTfP9VLToegSxqKfgVlsp7PC3t31oQUZgWbVX+H4pRrGLY 1TBn6sO1eugqehCcLYGPQxslLrtR9Sdyt61B6Dl4aw1bx486BfWK48BY2oQfbreIGnxxlK SDSv4/BDsmJMu/jFgYugfq7AgaPRlQ8dULHMdrF2+Fd9RK+3k01fTrFwFEEtDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d80Fsqz175k; Mon, 30 Jun 2025 14:21:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELVrX076288; Mon, 30 Jun 2025 14:21:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELVqE076285; Mon, 30 Jun 2025 14:21:31 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:31 GMT Message-Id: <202506301421.55UELVqE076285@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3230a622ac08 - stable/14 - ptrace: Rename the internal command range constants List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3230a622ac083b5d2a24184c7c0495963a735a41 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3230a622ac083b5d2a24184c7c0495963a735a41 commit 3230a622ac083b5d2a24184c7c0495963a735a41 Author: Mark Johnston AuthorDate: 2025-06-16 01:53:57 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:30 +0000 ptrace: Rename the internal command range constants No functional change intended. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50866 (cherry picked from commit ee609560ad2a5fa7cacf06a3879987e118588625) --- sys/compat/freebsd32/freebsd32_misc.c | 2 +- sys/kern/sys_process.c | 2 +- sys/sys/ptrace.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 951d9c28b7f1..c147c9cf1dd1 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1177,7 +1177,7 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) pscr_args[i] = pscr_args32[i]; r.sr.pscr_args = pscr_args; break; - case PTLINUX_FIRST ... PTLINUX_LAST: + case PTINTERNAL_FIRST ... PTINTERNAL_LAST: error = EINVAL; break; default: diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index f81013ffb842..a33e3fa4b73c 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -696,7 +696,7 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) break; r.sr.pscr_args = pscr_args; break; - case PTLINUX_FIRST ... PTLINUX_LAST: + case PTINTERNAL_FIRST ... PTINTERNAL_LAST: error = EINVAL; break; default: diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h index 85c6b2d5366a..bb492f60a8ed 100644 --- a/sys/sys/ptrace.h +++ b/sys/sys/ptrace.h @@ -93,10 +93,10 @@ #include /* machine-specific requests, if any */ #ifdef _KERNEL -/* Space for Linux ptrace emulation. */ -#define PTLINUX_FIRST 128 -#define PTLINUX_LAST 191 -#define PTLINUX_GET_SC_ARGS (PTLINUX_FIRST + 0) +/* Space for ptrace commands not exposed directly to userspace. */ +#define PTINTERNAL_FIRST 128 +#define PTINTERNAL_LAST 191 +#define PTLINUX_GET_SC_ARGS (PTINTERNAL_FIRST + 0) #endif /* Events used with PT_GET_EVENT_MASK and PT_SET_EVENT_MASK */ From nobody Mon Jun 30 14:21:33 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7d95C85z60X7d; Mon, 30 Jun 2025 14:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7d922Wpz48Yx; Mon, 30 Jun 2025 14:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BWo5s/dk/JmOpnw05zWlm1cFfKQEXc9DyNUk4Cq+frg=; b=PjdYPcHkzyzfWPE/IgrEb9sL8jNV17A7Ou+jCnpqpZz4wgwHcHhmouEL8AYAVJ8Ex/w/5z J3UvvrdPmStEht8b2IeHmeAIHHr1TDBl4H+imXwP1HfUG8Q9WhnPgRsht/lHhQPCIgklJB gN948XXM4s18jA/VS+nuayH1a0BcUAEyMg95xBvJpMwJ+1RaqMfwplYBRzJpQSMSbNy063 usgbEulQpqb5V5dZHBl4qq7n1U5CwYx+5Ox9WYPHMWhKUDBFaJJBGL2yqDoIK74WoD2JSW /sOD7Sbpqp9q9O299JErzEiH5UvBUR6K6veYCWu0yDOua51e2Alj/+gQxg5JHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BWo5s/dk/JmOpnw05zWlm1cFfKQEXc9DyNUk4Cq+frg=; b=HkScyXoGbshpbFAF8Mo1Di0UJMJudiFX1qReElvf/zzeo962azaBdOumeZRJAc6/ylrEQI t+il3t4t45kcHKE8TGiKFfoXyPnPg4WyYnqqx8bUyjf+6brB6phhh1+xf6ViVQo61+hGVy FaRDhTB8Ubbxx+jwmSC+9M/QrUIcA03bmTG+8QIB+90uxw/n4oDIT1IrusA1zLVQMKIlue zyRQl8pPRVV4+swikzDziQi0mn8CAa1IL24imxjfXTilKofHTwG10oowLg2eWSpJlirXBd medBk8NgdGF/+5wPh170oUzsP7P8YCncIyW1CBbCDZo+KPqTkgoyv+3GgmcIXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293293; a=rsa-sha256; cv=none; b=IcibOcBzj7dIB2CHIQVnUQiUmkJLrPRrZKGjLq7gQU36b3kPRaaXQupnfLwg5J/9nPquxo /P6L19tGTn8l+VJ3hvAA0DpEzGbuhkaokYeTSJA51YQAlDHKzvWVTOHIombBBhiCczZdDq /oZLhH4y13abP+h/kaK+dp7Iu3y6dFNGF9Hw8hTrr/iYz+22ai2VmbYEN2DH9OctYxX8Ki wYKyhiCK+8tLqu8UEYgI9ie08kH1sIq4kwyzeRYYLG4T0hPLGS5shNEaBgoq1RWMkhl+NR D8zpMQZYZWwpdsZXJDB9q2Lo9bxgpW66Iai5d8Bo/YWviLlVi5UTdRSAWEbLCg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7d90wKfz178N; Mon, 30 Jun 2025 14:21:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELX7Z076324; Mon, 30 Jun 2025 14:21:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELXuU076321; Mon, 30 Jun 2025 14:21:33 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:33 GMT Message-Id: <202506301421.55UELXuU076321@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fc03742b2512 - stable/14 - gve: Add support for 4k RX Buffers when using DQO queue formats List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fc03742b2512127a403b7624b49ce4a94fd26244 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fc03742b2512127a403b7624b49ce4a94fd26244 commit fc03742b2512127a403b7624b49ce4a94fd26244 Author: Vee Agarwal AuthorDate: 2025-06-13 17:52:25 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:31 +0000 gve: Add support for 4k RX Buffers when using DQO queue formats This change adds support for using 4K RX Buffers when using DQO queue formats when a boot-time tunable flag is set to true by the user. When this flag is enabled, the driver will use 4K RX Buffer size either when HW LRO is enabled or mtu > 2048. Signed-off-by: Vee Agarwal Reviewed by: markj, ziaee MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50786 (cherry picked from commit 71702df6126226b31dc3ec66459388e32b993be1) --- share/man/man4/gve.4 | 8 ++++++++ sys/dev/gve/gve.h | 20 ++++++++++++++++++++ sys/dev/gve/gve_adminq.c | 5 ++++- sys/dev/gve/gve_dqo.h | 8 ++++++-- sys/dev/gve/gve_main.c | 30 +++++++++++++++++++++++++++--- sys/dev/gve/gve_rx_dqo.c | 26 +++++++++++++++----------- sys/dev/gve/gve_sysctl.c | 4 ++++ 7 files changed, 84 insertions(+), 17 deletions(-) diff --git a/share/man/man4/gve.4 b/share/man/man4/gve.4 index a94951415d61..67f834badd9d 100644 --- a/share/man/man4/gve.4 +++ b/share/man/man4/gve.4 @@ -230,6 +230,14 @@ The default value is 0, which means hardware LRO is enabled by default. The software LRO stack in the kernel is always used. This sysctl variable needs to be set before loading the driver, using .Xr loader.conf 5 . +.It Va hw.gve.allow_4k_rx_buffers +Setting this boot-time tunable to 1 enables support for 4K RX Buffers. +The default value is 0, which means 2K RX Buffers will be used. +4K RX Buffers are only supported on DQO_RDA and DQO_QPL queue formats. +When enabled, 4K RX Buffers will be used either when HW LRO is enabled +or mtu is greated than 2048. +This sysctl variable needs to be set before loading the driver, using +.Xr loader.conf 5 . .It Va dev.gve.X.num_rx_queues and dev.gve.X.num_tx_queues Run-time tunables that represent the number of currently used RX/TX queues. The default value is the max number of RX/TX queues the device can support. diff --git a/sys/dev/gve/gve.h b/sys/dev/gve/gve.h index 48e9a371df21..dd432dc0eb45 100644 --- a/sys/dev/gve/gve.h +++ b/sys/dev/gve/gve.h @@ -65,6 +65,7 @@ #define ADMINQ_SIZE PAGE_SIZE #define GVE_DEFAULT_RX_BUFFER_SIZE 2048 +#define GVE_4K_RX_BUFFER_SIZE_DQO 4096 /* Each RX bounce buffer page can fit two packet buffers. */ #define GVE_DEFAULT_RX_BUFFER_OFFSET (PAGE_SIZE / 2) @@ -84,6 +85,11 @@ static MALLOC_DEFINE(M_GVE, "gve", "gve allocations"); +_Static_assert(MCLBYTES == GVE_DEFAULT_RX_BUFFER_SIZE, + "gve: bad MCLBYTES length"); +_Static_assert(MJUMPAGESIZE >= GVE_4K_RX_BUFFER_SIZE_DQO, + "gve: bad MJUMPAGESIZE length"); + struct gve_dma_handle { bus_addr_t bus_addr; void *cpu_addr; @@ -633,6 +639,7 @@ struct gve_priv { /* The index of tx queue that the timer service will check on its next invocation */ uint16_t check_tx_queue_idx; + uint16_t rx_buf_size_dqo; }; static inline bool @@ -666,6 +673,18 @@ gve_is_qpl(struct gve_priv *priv) priv->queue_format == GVE_DQO_QPL_FORMAT); } +static inline bool +gve_is_4k_rx_buf(struct gve_priv *priv) +{ + return (priv->rx_buf_size_dqo == GVE_4K_RX_BUFFER_SIZE_DQO); +} + +static inline bus_size_t +gve_rx_dqo_mbuf_segment_size(struct gve_priv *priv) +{ + return (gve_is_4k_rx_buf(priv) ? MJUMPAGESIZE : MCLBYTES); +} + /* Defined in gve_main.c */ void gve_schedule_reset(struct gve_priv *priv); int gve_adjust_tx_queues(struct gve_priv *priv, uint16_t new_queue_cnt); @@ -746,6 +765,7 @@ bool gve_timestamp_valid(int64_t *timestamp_sec); /* Systcl functions defined in gve_sysctl.c */ extern bool gve_disable_hw_lro; +extern bool gve_allow_4k_rx_buffers; extern char gve_queue_format[8]; extern char gve_version[8]; void gve_setup_sysctl(struct gve_priv *priv); diff --git a/sys/dev/gve/gve_adminq.c b/sys/dev/gve/gve_adminq.c index 3415d2fa4b60..9b59570a2af4 100644 --- a/sys/dev/gve/gve_adminq.c +++ b/sys/dev/gve/gve_adminq.c @@ -296,7 +296,6 @@ gve_adminq_create_rx_queue(struct gve_priv *priv, uint32_t queue_index) .ntfy_id = htobe32(rx->com.ntfy_id), .queue_resources_addr = htobe64(qres_dma->bus_addr), .rx_ring_size = htobe16(priv->rx_desc_cnt), - .packet_buffer_size = htobe16(GVE_DEFAULT_RX_BUFFER_SIZE), }; if (gve_is_gqi(priv)) { @@ -308,6 +307,8 @@ gve_adminq_create_rx_queue(struct gve_priv *priv, uint32_t queue_index) htobe32(queue_index); cmd.create_rx_queue.queue_page_list_id = htobe32((rx->com.qpl)->id); + cmd.create_rx_queue.packet_buffer_size = + htobe16(GVE_DEFAULT_RX_BUFFER_SIZE); } else { cmd.create_rx_queue.queue_page_list_id = htobe32(GVE_RAW_ADDRESSING_QPL_ID); @@ -320,6 +321,8 @@ gve_adminq_create_rx_queue(struct gve_priv *priv, uint32_t queue_index) cmd.create_rx_queue.enable_rsc = !!((if_getcapenable(priv->ifp) & IFCAP_LRO) && !gve_disable_hw_lro); + cmd.create_rx_queue.packet_buffer_size = + htobe16(priv->rx_buf_size_dqo); } return (gve_adminq_execute_cmd(priv, &cmd)); diff --git a/sys/dev/gve/gve_dqo.h b/sys/dev/gve/gve_dqo.h index 212bfa1a6ad3..542f8ff7d888 100644 --- a/sys/dev/gve/gve_dqo.h +++ b/sys/dev/gve/gve_dqo.h @@ -59,8 +59,6 @@ */ #define GVE_RX_DQO_MIN_PENDING_BUFS 128 -#define GVE_DQ_NUM_FRAGS_IN_PAGE (PAGE_SIZE / GVE_DEFAULT_RX_BUFFER_SIZE) - /* * gve_rx_qpl_buf_id_dqo's 11 bit wide buf_id field limits the total * number of pages per QPL to 2048. @@ -330,4 +328,10 @@ struct gve_rx_compl_desc_dqo { _Static_assert(sizeof(struct gve_rx_compl_desc_dqo) == 32, "gve: bad dqo desc struct length"); + +static inline uint8_t +gve_get_dq_num_frags_in_page(struct gve_priv *priv) +{ + return (PAGE_SIZE / priv->rx_buf_size_dqo); +} #endif /* _GVE_DESC_DQO_H_ */ diff --git a/sys/dev/gve/gve_main.c b/sys/dev/gve/gve_main.c index 2abd9d1aa698..10197a8e15f8 100644 --- a/sys/dev/gve/gve_main.c +++ b/sys/dev/gve/gve_main.c @@ -35,7 +35,7 @@ #define GVE_DRIVER_VERSION "GVE-FBSD-1.3.4\n" #define GVE_VERSION_MAJOR 1 #define GVE_VERSION_MINOR 3 -#define GVE_VERSION_SUB 4 +#define GVE_VERSION_SUB 5 #define GVE_DEFAULT_RX_COPYBREAK 256 @@ -382,12 +382,27 @@ gve_adjust_ring_sizes(struct gve_priv *priv, uint16_t new_desc_cnt, bool is_rx) return (0); } +static int +gve_get_dqo_rx_buf_size(struct gve_priv *priv, uint16_t mtu) +{ + /* + * Use 4k buffers only if mode is DQ, 4k buffers flag is on, + * and either hw LRO is enabled or mtu is greater than 2048 + */ + if (!gve_is_gqi(priv) && gve_allow_4k_rx_buffers && + (!gve_disable_hw_lro || mtu > GVE_DEFAULT_RX_BUFFER_SIZE)) + return (GVE_4K_RX_BUFFER_SIZE_DQO); + + return (GVE_DEFAULT_RX_BUFFER_SIZE); +} + static int gve_set_mtu(if_t ifp, uint32_t new_mtu) { struct gve_priv *priv = if_getsoftc(ifp); const uint32_t max_problem_range = 8227; const uint32_t min_problem_range = 7822; + uint16_t new_rx_buf_size = gve_get_dqo_rx_buf_size(priv, new_mtu); int err; if ((new_mtu > priv->max_mtu) || (new_mtu < ETHERMIN)) { @@ -402,9 +417,10 @@ gve_set_mtu(if_t ifp, uint32_t new_mtu) * in throughput. */ if (!gve_is_gqi(priv) && !gve_disable_hw_lro && - new_mtu >= min_problem_range && new_mtu <= max_problem_range) { + new_mtu >= min_problem_range && new_mtu <= max_problem_range && + new_rx_buf_size != GVE_4K_RX_BUFFER_SIZE_DQO) { device_printf(priv->dev, - "Cannot set to MTU to %d within the range [%d, %d] while hardware LRO is enabled\n", + "Cannot set to MTU to %d within the range [%d, %d] while HW LRO is enabled and not using 4k RX Buffers\n", new_mtu, min_problem_range, max_problem_range); return (EINVAL); } @@ -414,6 +430,13 @@ gve_set_mtu(if_t ifp, uint32_t new_mtu) if (bootverbose) device_printf(priv->dev, "MTU set to %d\n", new_mtu); if_setmtu(ifp, new_mtu); + /* Need to re-alloc RX queues if RX buffer size changed */ + if (!gve_is_gqi(priv) && + new_rx_buf_size != priv->rx_buf_size_dqo) { + gve_free_rx_rings(priv, 0, priv->rx_cfg.num_queues); + priv->rx_buf_size_dqo = new_rx_buf_size; + gve_alloc_rx_rings(priv, 0, priv->rx_cfg.num_queues); + } } else { device_printf(priv->dev, "Failed to set MTU to %d\n", new_mtu); } @@ -1064,6 +1087,7 @@ gve_attach(device_t dev) if (err != 0) goto abort; + priv->rx_buf_size_dqo = gve_get_dqo_rx_buf_size(priv, priv->max_mtu); err = gve_alloc_rings(priv); if (err != 0) goto abort; diff --git a/sys/dev/gve/gve_rx_dqo.c b/sys/dev/gve/gve_rx_dqo.c index 11b2c7ea0c55..cf914913da09 100644 --- a/sys/dev/gve/gve_rx_dqo.c +++ b/sys/dev/gve/gve_rx_dqo.c @@ -140,15 +140,17 @@ gve_rx_alloc_ring_dqo(struct gve_priv *priv, int i) return (0); } + bus_size_t max_seg_size = gve_rx_dqo_mbuf_segment_size(priv); + err = bus_dma_tag_create( bus_get_dma_tag(priv->dev), /* parent */ 1, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MCLBYTES, /* maxsize */ + max_seg_size, /* maxsize */ 1, /* nsegments */ - MCLBYTES, /* maxsegsize */ + max_seg_size, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockarg */ @@ -317,7 +319,8 @@ gve_rx_post_new_mbuf_dqo(struct gve_rx_ring *rx, int how) } SLIST_REMOVE_HEAD(&rx->dqo.free_bufs, slist_entry); - buf->mbuf = m_getcl(how, MT_DATA, M_PKTHDR); + bus_size_t segment_size = gve_rx_dqo_mbuf_segment_size(rx->com.priv); + buf->mbuf = m_getjcl(how, MT_DATA, M_PKTHDR, segment_size); if (__predict_false(!buf->mbuf)) { err = ENOMEM; counter_enter(); @@ -325,7 +328,7 @@ gve_rx_post_new_mbuf_dqo(struct gve_rx_ring *rx, int how) counter_exit(); goto abort_with_buf; } - buf->mbuf->m_len = MCLBYTES; + buf->mbuf->m_len = segment_size; err = bus_dmamap_load_mbuf_sg(rx->dqo.buf_dmatag, buf->dmamap, buf->mbuf, segs, &nsegs, BUS_DMA_NOWAIT); @@ -371,7 +374,7 @@ gve_rx_post_qpl_buf_dqo(struct gve_rx_ring *rx, struct gve_rx_buf_dqo *buf, bus_dmamap_sync(page_dma_handle->tag, page_dma_handle->map, BUS_DMASYNC_PREREAD); desc->buf_addr = htole64(page_dma_handle->bus_addr + - frag_num * GVE_DEFAULT_RX_BUFFER_SIZE); + frag_num * rx->com.priv->rx_buf_size_dqo); buf->num_nic_frags++; gve_rx_advance_head_dqo(rx); @@ -430,7 +433,7 @@ gve_rx_post_new_dqo_qpl_buf(struct gve_rx_ring *rx) } gve_rx_post_qpl_buf_dqo(rx, buf, buf->next_idx); - if (buf->next_idx == GVE_DQ_NUM_FRAGS_IN_PAGE - 1) + if (buf->next_idx == gve_get_dq_num_frags_in_page(rx->com.priv) - 1) buf->next_idx = 0; else buf->next_idx++; @@ -742,7 +745,7 @@ gve_get_cpu_addr_for_qpl_buf(struct gve_rx_ring *rx, int page_idx = buf - rx->dqo.bufs; void *va = rx->com.qpl->dmas[page_idx].cpu_addr; - va = (char *)va + (buf_frag_num * GVE_DEFAULT_RX_BUFFER_SIZE); + va = (char *)va + (buf_frag_num * rx->com.priv->rx_buf_size_dqo); return (va); } @@ -753,15 +756,16 @@ gve_rx_add_clmbuf_to_ctx(struct gve_rx_ring *rx, { void *va = gve_get_cpu_addr_for_qpl_buf(rx, buf, buf_frag_num); struct mbuf *mbuf; + bus_size_t segment_size = gve_rx_dqo_mbuf_segment_size(rx->com.priv); if (ctx->mbuf_tail == NULL) { - mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + mbuf = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, segment_size); if (mbuf == NULL) return (ENOMEM); ctx->mbuf_head = mbuf; ctx->mbuf_tail = mbuf; } else { - mbuf = m_getcl(M_NOWAIT, MT_DATA, 0); + mbuf = m_getjcl(M_NOWAIT, MT_DATA, 0, segment_size); if (mbuf == NULL) return (ENOMEM); ctx->mbuf_tail->m_next = mbuf; @@ -809,7 +813,7 @@ gve_rx_add_extmbuf_to_ctx(struct gve_rx_ring *rx, page_idx = buf - rx->dqo.bufs; page = rx->com.qpl->pages[page_idx]; page_addr = rx->com.qpl->dmas[page_idx].cpu_addr; - va = (char *)page_addr + (buf_frag_num * GVE_DEFAULT_RX_BUFFER_SIZE); + va = (char *)page_addr + (buf_frag_num * rx->com.priv->rx_buf_size_dqo); /* * Grab an extra ref to the page so that gve_mextadd_free @@ -855,7 +859,7 @@ gve_rx_dqo_qpl(struct gve_priv *priv, struct gve_rx_ring *rx, } buf = &rx->dqo.bufs[buf_id]; if (__predict_false(buf->num_nic_frags == 0 || - buf_frag_num > GVE_DQ_NUM_FRAGS_IN_PAGE - 1)) { + buf_frag_num > gve_get_dq_num_frags_in_page(priv) - 1)) { device_printf(priv->dev, "Spurious compl for buf id %d on rxq %d " "with buf_frag_num %d and num_nic_frags %d, issuing reset\n", buf_id, rx->com.id, buf_frag_num, buf->num_nic_frags); diff --git a/sys/dev/gve/gve_sysctl.c b/sys/dev/gve/gve_sysctl.c index 661f61918853..a3874cc921ee 100644 --- a/sys/dev/gve/gve_sysctl.c +++ b/sys/dev/gve/gve_sysctl.c @@ -37,6 +37,10 @@ bool gve_disable_hw_lro = false; SYSCTL_BOOL(_hw_gve, OID_AUTO, disable_hw_lro, CTLFLAG_RDTUN, &gve_disable_hw_lro, 0, "Controls if hardware LRO is used"); +bool gve_allow_4k_rx_buffers = false; +SYSCTL_BOOL(_hw_gve, OID_AUTO, allow_4k_rx_buffers, CTLFLAG_RDTUN, + &gve_allow_4k_rx_buffers, 0, "Controls if 4K RX Buffers are allowed"); + char gve_queue_format[8]; SYSCTL_STRING(_hw_gve, OID_AUTO, queue_format, CTLFLAG_RD, &gve_queue_format, 0, "Queue format being used by the iface"); From nobody Mon Jun 30 14:21:34 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW7dB6lWjz60X2g; Mon, 30 Jun 2025 14:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW7dB2F68z48jX; Mon, 30 Jun 2025 14:21:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ivLLIaMCh2RSXl2cOGePKrwjtiV0QW2DU6Krm1zJGEI=; b=DbTUxLVUOGC9DX5h584x+6OtTDENowds1dl1h/j+nPrDUTFOw9hLo334MCMVxPb1ZnfhZv EiTYatn7tw8SPjrauOi9QimvS3XY14lAznE/lIGJy6aCw1rsuQV6whObstIPL7SSAsY42D 3ecwHjVbez9P8tagJZC2oN7opp5UIkQTQeU9UTarksMd+wcoBLq/CRb0rIGl1UVMFsQs4b lbzmsQNlPZCFweBh7giv1TASQsNbPjxoxMOSk7DRF6QmRQyF2VVZvh8DsZf/UoKUwucK3C 1a1Krfzh+QHoHITgHm3QHFuyiodE2YKoC/7KghZyeaS58sZsz1BMXpBsGhAzuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751293294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ivLLIaMCh2RSXl2cOGePKrwjtiV0QW2DU6Krm1zJGEI=; b=OzOClGkvaosZtliEggxQtXRRUnheYCQdc94IetyOGUj8KfRIMf20dtbbbs3N4nfmhNBVO5 wCZ7dyIFtAfqeN7XjcUA/lsDrE2I+xF4Kq6VBqjwGoD0gQd073CEkwBwcuyzi1HVzt42+C aOAjjUz6Gp81tSUAoHRszDZoAwWjZZxDaZXnndgRXjOtXqvHFF0+MbbzQiqawwdWuXhdPJ mK7QvOYbVL1edw9zUlgrDi3HSLN5n65nPBAH+mM3ZFOQK0crBO1cIOYFVH2Qc7sMwk9tBZ VYVhE5aTTkx1anCQKHZhnoScLck9ksEV/QvQwMPtwGv4T1J75darcPJhC3akIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751293294; a=rsa-sha256; cv=none; b=NcgCD4lorwCn9By07u9u7/cjKcoXIVqYpv5VJ2hSU+jSbpqgQAxBG0nLd2lceveP1eEbFv N0OACZOunZlk3akaItoU6gjQFxqwTVg8qKBXc2Vqt7XgEi11lT5euH6x3SUmo7SLEoVyrS ab17qZ2gu9Z59D2T4D4kfgiJpxCc82tod4mtZvuy2cKabqFReZysr+aA0Ho1Vo/SgKZHSD LoVJIBQqjJTVEcQZvIkWk32VgGaiMxh2//qGJaTJuRPCIQvxyBUQI+ZwH7LA8qSqhfap3I I1DbJN0G0OXLReVYvD4uxnbMJ9mBdZjaGs+qcbMOsHfwHkfS/HuqJwCp3PLBCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW7dB1f7bz16dg; Mon, 30 Jun 2025 14:21:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UELYeu076364; Mon, 30 Jun 2025 14:21:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UELYqo076361; Mon, 30 Jun 2025 14:21:34 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:21:34 GMT Message-Id: <202506301421.55UELYqo076361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: c6e0defd489f - stable/14 - gve: Relax a static assertion List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c6e0defd489fb139e753435ccb7ecb722e9ae499 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c6e0defd489fb139e753435ccb7ecb722e9ae499 commit c6e0defd489fb139e753435ccb7ecb722e9ae499 Author: Mark Johnston AuthorDate: 2025-06-14 12:17:49 +0000 Commit: Mark Johnston CommitDate: 2025-06-30 14:19:31 +0000 gve: Relax a static assertion It's okay if MCLBYTES is larger than the default receive buffer size. Fixes: 71702df61262 ("gve: Add support for 4k RX Buffers when using DQO queue formats") (cherry picked from commit 3b4bc5d70e1c2066fcb6e8535941258c88999fa2) --- sys/dev/gve/gve.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/gve/gve.h b/sys/dev/gve/gve.h index dd432dc0eb45..64c2a0481817 100644 --- a/sys/dev/gve/gve.h +++ b/sys/dev/gve/gve.h @@ -85,7 +85,7 @@ static MALLOC_DEFINE(M_GVE, "gve", "gve allocations"); -_Static_assert(MCLBYTES == GVE_DEFAULT_RX_BUFFER_SIZE, +_Static_assert(MCLBYTES >= GVE_DEFAULT_RX_BUFFER_SIZE, "gve: bad MCLBYTES length"); _Static_assert(MJUMPAGESIZE >= GVE_4K_RX_BUFFER_SIZE_DQO, "gve: bad MJUMPAGESIZE length"); From nobody Mon Jun 30 14:53:50 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8LR5yWhz60Ylj; Mon, 30 Jun 2025 14:53: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8LR2DH3z4Qj7; Mon, 30 Jun 2025 14:53:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7jnOh2/MDhsfkQL+xF1sTpQ/uMdsKKd6erojj0nCZgA=; b=u3EU19J2aexQdOxyYyH4g5IHDmpBiWUn2Q/bXKsU64zWwW8YHjllo4tI99QUC9tfE5jgJJ nqLuqz6NAQDvslON6WvBxTcRhWzDsaWOEOZpRTYtVuXmCTvddaM9lRl40jI9X9Cjs6x+fc 9CiOoqJcKPOnqkadPH1ho6OyKH1XxaKHJ8BjvA9OoXmb2MRBJfA0Q1KLudKG+RwUiA1xGT JNq9Ax/aL1KACnQj42wVisnp2999KqwV5HCQSkVBPQRvGCR/jmDe0jl3tybgtfwC4Ay1E0 uHfjfzQkvjS+hCNuMcAGoKkY3fofqqzMZ83i+LquvStTfybK6Z+oz81L1/FrgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7jnOh2/MDhsfkQL+xF1sTpQ/uMdsKKd6erojj0nCZgA=; b=tA1JFYzGmfzZZa/hq9ONWXYdrUj+F3vHkKTa8M2ga2pHw627laL2gKe3JNatf9wFrJ7v8q zfK6fRezp/kZLCfBgkkx9QOxO/E8wDDMGF6I7UvvytnUhPFmESo5rBIakc7macOdR/T5pA IeTvGPBp7ql04tx4TitbRQUtA5kJnk6uz1hRyFBCvQdGap4r7rCz5GVlPljFmdSOw0JnsT Q2jnkDI5VuxUr3iY4FAbgZ91Pd9Xi1Wo+QVmUpcrh8gtyUXUrRqohti3JufB6k1EwW4pip 2qX4JpATNDJKgs78v2O8vxtu55JBhU4FhFS6n/tQ/o7gB2MIozeDUGTdkZ/LKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295231; a=rsa-sha256; cv=none; b=RY/ud7i/9/IDmuhXf51433fJ2RFjiDNQ749xJVmmi41NWlO97dSw2L4nA1yWWtXPt8Nn+g HcKVvu05StRLVJK361h55SN/CPxZHyWOZkHUtplCTK/CrWNwi+2VTvupxH7IrIuJvj+FLn HmQUS4U7jki0xbU+AnBz0st2CjfXGjTbTLPGQ9MTSNiqbX3kJmIw+cJfvtN9zrK0ueMhIM hZcPM9850RKzOZF9IyYHymxH5sEiGcSp6D8V+Rbg/70C8R8wR5mg8ICfZpqN4t5/jVi174 yEcHSi6QZG4IOWyyUE1dDuXz0RRoDae+Up21I+NxKG8/6B+Q7UnhFfW6MOE+PA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8LR0WChz17gg; Mon, 30 Jun 2025 14:53:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UEroG8035527; Mon, 30 Jun 2025 14:53:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UEro8u035524; Mon, 30 Jun 2025 14:53:50 GMT (envelope-from git) Date: Mon, 30 Jun 2025 14:53:50 GMT Message-Id: <202506301453.55UEro8u035524@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 50e733f19b37 - main - nfscl: Use delegation ACE when mounted with nocto List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50e733f19b37421a64045e131766ad79d08497a4 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=50e733f19b37421a64045e131766ad79d08497a4 commit 50e733f19b37421a64045e131766ad79d08497a4 Author: Rick Macklem AuthorDate: 2025-06-30 14:51:01 +0000 Commit: Rick Macklem CommitDate: 2025-06-30 14:51:01 +0000 nfscl: Use delegation ACE when mounted with nocto For NFSv4.1/4.2, there is an ACE in the delegation reply. Without this patch, this ACE is ignored by the NFSv4 client. This patch enables use of the ACE to avoid the need for Access RPCs when the "nocto" option is specified. This requires a NFSv4.1/4.2 server that does not reply with a bogus ACE that is too generous w.r.t. access permissions. Note that the recent commit 0d51adee3072 added use of the NFSv4 ACL for generation of the ACE in the reply. This patch might be needed for this client change to work correctly if NFSv4 ACLs are being used on the NFSv4.1/4.2 exported file systems. This only affects NFSv4 mounts with the "nocto" mount option and only if NFSv4 servers are issuing delegations with ACEs that specify access. Some NFSv4 servers, such as the Linux knfsd reply with ACEs that do not allow any access, so this patch has no effect for them. --- sys/fs/nfs/nfs_commonacl.c | 2 +- sys/fs/nfs/nfs_var.h | 1 + sys/fs/nfsclient/nfs_clstate.c | 51 ++++++++++++++++++++++++++++++++++++++++++ sys/fs/nfsclient/nfs_clvnops.c | 12 ++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfs_commonacl.c b/sys/fs/nfs/nfs_commonacl.c index 69afa8d41712..bba1d8821a9b 100644 --- a/sys/fs/nfs/nfs_commonacl.c +++ b/sys/fs/nfs/nfs_commonacl.c @@ -65,7 +65,7 @@ nfsrv_dissectace(struct nfsrv_descript *nd, struct acl_entry *acep, goto nfsmout; } else if (len == 0) { /* Netapp filers return a 0 length who for nil users */ - acep->ae_tag = ACL_UNDEFINED_TAG; + acep->ae_tag = ACL_EVERYONE; /* Avoid panics. */ acep->ae_id = ACL_UNDEFINED_ID; acep->ae_perm = (acl_perm_t)0; acep->ae_entry_type = ACL_ENTRY_TYPE_DENY; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index f59a898369e8..3b6c1ec90c06 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -658,6 +658,7 @@ void nfscl_freelayout(struct nfscllayout *); void nfscl_freeflayout(struct nfsclflayout *); void nfscl_freedevinfo(struct nfscldevinfo *); int nfscl_layoutcommit(vnode_t, NFSPROC_T *); +int nfscl_delegacecheck(struct vnode *, accmode_t, struct ucred *); void nfscl_startdelegrecall(struct nfsclclient *, struct nfsfh *); /* nfs_clport.c */ diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index fe3682ae437e..1ae5ed1a75ca 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -5953,6 +5953,57 @@ tryagain: return (0); } +/* + * Check access against a delegation ace. + * Return EINVAL for any case where the check cannot be completed. + */ +int +nfscl_delegacecheck(struct vnode *vp, accmode_t accmode, struct ucred *cred) +{ + struct nfsclclient *clp; + struct nfscldeleg *dp; + struct nfsnode *np; + struct nfsmount *nmp; + struct acl *aclp; + int error; + + np = VTONFS(vp); + nmp = VFSTONFS(vp->v_mount); + if (!NFSHASNFSV4(nmp) || !NFSHASNFSV4N(nmp) || vp->v_type != VREG) + return (EINVAL); + NFSLOCKMNT(nmp); + if ((nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0) { + NFSUNLOCKMNT(nmp); + return (EINVAL); + } + NFSUNLOCKMNT(nmp); + aclp = acl_alloc(M_WAITOK); + NFSLOCKCLSTATE(); + clp = nfscl_findcl(nmp); + if (clp == NULL) { + NFSUNLOCKCLSTATE(); + acl_free(aclp); + return (EINVAL); + } + dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len); + if (dp != NULL && (dp->nfsdl_flags & (NFSCLDL_RECALL | + NFSCLDL_DELEGRET)) == 0) { + memcpy(&aclp->acl_entry[0], &dp->nfsdl_ace, + sizeof(struct acl_entry)); + NFSUNLOCKCLSTATE(); + aclp->acl_cnt = 1; + error = vaccess_acl_nfs4(vp->v_type, np->n_vattr.na_uid, + np->n_vattr.na_gid, aclp, accmode, cred); + acl_free(aclp); + if (error == 0 || error == EACCES) + return (error); + } else { + NFSUNLOCKCLSTATE(); + acl_free(aclp); + } + return (EINVAL); +} + /* * Start the recall of a delegation. Called for CB_RECALL and REMOVE * when nlink == 0 after the REMOVE. diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 84046cdb503e..0049d7edca33 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -480,6 +480,18 @@ nfs_access(struct vop_access_args *ap) break; } } + + /* + * For NFSv4, check for a delegation with an Allow ACE, to see + * if that permits access. + */ + if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOCTO) != 0) { + error = nfscl_delegacecheck(vp, ap->a_accmode, ap->a_cred); + if (error == 0) + return (error); + error = 0; + } + /* * For nfs v3 or v4, check to see if we have done this recently, and if * so return our cached result instead of making an ACCESS call. From nobody Mon Jun 30 15:00:48 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8VT37B7z60YvK; Mon, 30 Jun 2025 15:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8VS6kPGz3DBN; Mon, 30 Jun 2025 15:00:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zsywpc5tkDBxXbeLKQN6HIM6dM3P9cPIvDnDDTlrWfE=; b=ISztBWhpj2v6I+ViFZqaZQtrr2/gUCsh0gL4FbtaZJt3ZWtEWhEyW95mf5zTBb+6WRaeVZ 4NFmtFcO8//47FmHNIQY/gpWTGA/LZIZVzyup4g4fFuA1DGoS30Jp47ABB1cZaYDDduj42 E/D++5Wm0VAo/1qlDc7M11ru147lS581aN4xbJ8uMuNP1u92GKLDucR0BRtYYSyyybwAUX zxjyK1gxePWNeCOfKUxCfW9srtyGYnZujI4lI92HiEoVgrlnUCwiOLhGLuuR0WCCF4NBYP kPuNe/7fBrMaZ4P100qUOv2VUTLE0/HIaYXIq08Rz4RXjPE3sQgCXtqE7SGNBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zsywpc5tkDBxXbeLKQN6HIM6dM3P9cPIvDnDDTlrWfE=; b=dXaxcOj3qEjn1GX909xYCMc5ryXhzuMSQzRQ+OIaTeFsBffNbEGW94+UaDFxKqqKuxbgO7 LS42ItkHw6/Jkwocxt9sFpdA198ooCjR+mqVLAPbv02kDs3/EkJqjVVAWTMxhuTouSMDFl ZhNhI1yfDxuYkM6QRmQlnN9iHXqVPYOBooE3GLUV3CumNBjQucmCuEABISTz/sYMI7+Dov huEziG2PR/OlMhWnl5+DSuypNMPZkqch9GjCVBIvLuJdE3/WEMcG3l5myx1fhUHda+0Kit ZGWxFMaGjBeO3gysx53NIVqT1/I+mqbcbPpfbBEJuYfa1d/h4JF/yt5WNkQqBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295649; a=rsa-sha256; cv=none; b=YoPZLz7utRgZ3+aFB7lUeIqqAeO9QVd0b3f1x4T0UpG6ZOvGijkSoLERPUlz//6nlYH0q0 94U7ooqC3nmyS/YIDsOUt0dr9bWqcZS1WMscSFi+wWLrY2ChxZDPewfphQLKt99zlzJ95Z up5BhABcJiKqsck+3jP15ls8ie9qBGhogIST2O7nxwe2/QfT2aznWHoEbLT4Kc48xx5eCk EBiqGW6o0l0KrXRJaxfF/hYvz6ojkuwC8Enq2BstJzCXsmLDFBO0dD7yZ7i9PuXGgiAMDw 8hgrZm2Oapw1fQjoH9RXvAPNecc02b31h3XjbMis1kt4LTcbB+Aor8a/gKBaUw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8VS63F1z17k5; Mon, 30 Jun 2025 15:00:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UF0mP4047440; Mon, 30 Jun 2025 15:00:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0mF5047437; Mon, 30 Jun 2025 15:00:48 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:48 GMT Message-Id: <202506301500.55UF0mF5047437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: b728aaa12cbe - main - pfctl: Simplify getaddrinfo() error handling List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b728aaa12cbe92eb21e40231e81ac3b6b0b55c40 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b728aaa12cbe92eb21e40231e81ac3b6b0b55c40 commit b728aaa12cbe92eb21e40231e81ac3b6b0b55c40 Author: Kristof Provost AuthorDate: 2025-06-27 09:27:14 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:27 +0000 pfctl: Simplify getaddrinfo() error handling `error' is not used so drop it and jump to the end. OK sashan Obtained from: OpenBSD, kn , da7f49d74e Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 92debd6227e7..c475eab0de91 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1968,8 +1968,7 @@ host_dns(const char *s, int v4mask, int v6mask, int numeric) { struct addrinfo hints, *res0, *res; struct node_host *n, *h = NULL; - int error, noalias = 0; - int got4 = 0, got6 = 0; + int noalias = 0, got4 = 0, got6 = 0; char *p, *ps; if ((ps = strdup(s)) == NULL) @@ -1983,11 +1982,8 @@ host_dns(const char *s, int v4mask, int v6mask, int numeric) hints.ai_socktype = SOCK_STREAM; /* DUMMY */ if (numeric) hints.ai_flags = AI_NUMERICHOST; - error = getaddrinfo(ps, NULL, &hints, &res0); - if (error) { - free(ps); - return (h); - } + if (getaddrinfo(ps, NULL, &hints, &res0) != 0) + goto error; for (res = res0; res; res = res->ai_next) { if (res->ai_family != AF_INET && @@ -2035,6 +2031,7 @@ host_dns(const char *s, int v4mask, int v6mask, int numeric) } } freeaddrinfo(res0); +error: free(ps); return (h); From nobody Mon Jun 30 15:00:49 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8VV3t3Kz60ZMX; Mon, 30 Jun 2025 15:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8VV00H6z3DX0; Mon, 30 Jun 2025 15:00:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zxkAjRZB19nRQJpu4LBvLHTqMNCPZZRxTbyYKPMflac=; b=jJcUimTGwM5uIYd9PlZS7dlh08i+bkCglY6KoR7bX4Bi1f6vffpw64wmFBq6FyD6o4QG/n pQSbFgLYOA9pfgauMnibMToutT1vxfJbo3uzbnqvbWwcCQAwjXePQP75V66Fcm7ou1R1q7 15FK2Rl4FiMp7enyo9rdXwBnOJj3Ji05LUPOrNpifR3pyOMaFjigYPlaWPUdi3tq9WlT9F LSOFvJKeuW+IFF57ceF0UAJ4L14gZLVYSry6G1QXLfkwy2b6B8F0J74kaAN86J0U5Jb9nE 3baEYKnnEnbsxJRuiGaG0rx05m6eK+la94gKPu9Z4QIq5Eljpf02ydkjgJ7scw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zxkAjRZB19nRQJpu4LBvLHTqMNCPZZRxTbyYKPMflac=; b=gnXfg8U7hm1ArN+kxSUAH9IvO0fC9+ZUJgwBQLKJ1oPgtJKVYvhikxMtGpYhdfqQ4V0vpJ MgVX7lJjxuLsxl+qk6uxD2lZ45zIF/caPNO+DR81BNT/71ysfoRLre4Yhc3j0zx4v/fWS5 7rAFfDxg1v188YBKs8r4lQycxlLekOF7vPAiysYsfgjs2MZp3PsHvBkNAOU3JGiif52xxs gfWQ5a/CzxZ3UH+L4Lvie00n9i4jvVUYBurN27dMsmEpwdVx1MoLM8lSDLCCthQX0WmVjt 6k6vFj/nJAJY1725mm41+JSpZ3IPNM8ckDPz3Fguhbr3UHCExj9oHXEx65KV+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295650; a=rsa-sha256; cv=none; b=gPaaqXCdzeJLm/3Toc+GjLyeocbitudZ4T8ijHbnRVWL6i8ZYkeeK0DrwYFmpDDjdMP3Km VTvvsg6a0LCq2uc7qFfCQ/p8aaUEd1TeX48OZzy6wk7BAwp8Kw0sjDmCnVei8wTmWFvbnC rbRBvsS6irfUNz/EDl1JIfQz2iagjD2nEm+s5XAna/+Rn36eP3QjUyGo38c2McOaPjgGq+ GfMESqsf2sYNMcabaQTfKrnxeZJNHIHOZ9Ebji0ZiB+U7XfkeKt65dU1oTndqBRt5r/bl8 NTclwAc4zYOQuy77MULUezUiTXAaxj71V7XZceOVMG7TasAdjwLJj0uJEFaqew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8VT6hrWz17Nj; Mon, 30 Jun 2025 15:00:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UF0nqa047474; Mon, 30 Jun 2025 15:00:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0nuL047471; Mon, 30 Jun 2025 15:00:49 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:49 GMT Message-Id: <202506301500.55UF0nuL047471@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 466ac79e47fe - main - pfctl: Move duplicate code into new helper print_addr_str() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 466ac79e47fe6d486956096ae6724fdfd5776c39 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=466ac79e47fe6d486956096ae6724fdfd5776c39 commit 466ac79e47fe6d486956096ae6724fdfd5776c39 Author: Kristof Provost AuthorDate: 2025-06-27 09:40:31 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:27 +0000 pfctl: Move duplicate code into new helper print_addr_str() This simply puts the wiggle around inet_ntop() from four into one location. OK benno Obtained from: OpenBSD, kn , 88d4e2f324 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pf_print_state.c | 34 ++++++++++++++++------------------ sbin/pfctl/pfctl.h | 1 + sbin/pfctl/pfctl_parser.c | 9 +-------- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 1d2fa45cd9d7..821c0745748a 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -85,31 +85,18 @@ print_addr(struct pf_addr_wrap *addr, sa_family_t af, int verbose) printf("<%s>", addr->v.tblname); return; case PF_ADDR_RANGE: { - char buf[48]; + print_addr_str(af, &addr->v.a.addr); + printf(" - "); + print_addr_str(af, &addr->v.a.mask); - if (inet_ntop(af, &addr->v.a.addr, buf, sizeof(buf)) == NULL) - printf("?"); - else - printf("%s", buf); - if (inet_ntop(af, &addr->v.a.mask, buf, sizeof(buf)) == NULL) - printf(" - ?"); - else - printf(" - %s", buf); break; } case PF_ADDR_ADDRMASK: if (PF_AZERO(&addr->v.a.addr, AF_INET6) && PF_AZERO(&addr->v.a.mask, AF_INET6)) printf("any"); - else { - char buf[48]; - - if (inet_ntop(af, &addr->v.a.addr, buf, - sizeof(buf)) == NULL) - printf("?"); - else - printf("%s", buf); - } + else + print_addr_str(af, &addr->v.a.addr); break; case PF_ADDR_NOROUTE: printf("no-route"); @@ -133,6 +120,17 @@ print_addr(struct pf_addr_wrap *addr, sa_family_t af, int verbose) } } +void +print_addr_str(sa_family_t af, struct pf_addr *addr) +{ + static char buf[48]; + + if (inet_ntop(af, addr, buf, sizeof(buf)) == NULL) + printf("?"); + else + printf("%s", buf); +} + void print_name(struct pf_addr *addr, sa_family_t af) { diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index f4a033971865..ab24ec7174ec 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -120,6 +120,7 @@ void pfaltq_store(struct pf_altq *); char *rate2str(double); void print_addr(struct pf_addr_wrap *, sa_family_t, int); +void print_addr_str(sa_family_t, struct pf_addr *); void print_host(struct pf_addr *, u_int16_t p, sa_family_t, int); void print_seq(struct pfctl_state_peer *); void print_state(struct pfctl_state *, int); diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index c475eab0de91..89960efa3ca1 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1233,15 +1233,8 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer if (PF_AZERO(&r->divert.addr, r->af)) { printf(" divert-reply"); } else { - /* XXX cut&paste from print_addr */ - char buf[48]; - printf(" divert-to "); - if (inet_ntop(r->af, &r->divert.addr, buf, - sizeof(buf)) == NULL) - printf("?"); - else - printf("%s", buf); + print_addr_str(r->af, &r->divert.addr); printf(" port %u", ntohs(r->divert.port)); } #endif From nobody Mon Jun 30 15:00:50 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8VW2Z5zz60ZQ7; Mon, 30 Jun 2025 15:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8VW10Vdz3DPp; Mon, 30 Jun 2025 15:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=humh2lk5eqdYSdtahnNxFUqmj4MZyRw4kJxvTaIv5os=; b=GHoXP2tW43VbsNcYKqlg92xWOvGGaZGvHw4GUJhWfORsmVo/w8NvqlV9p1WH6XWP373ktP TO4/iHIkzx42PM985FUrUtGHUIAnu8hKKJWwrfRSJHRRZxF3Dfy/eT1efo4nq5bDe3AFYs u/bTr2nbjgDnxfBedXfDnSvAbAuGTpi/Etvi2KchLQz0ZEVSAY/A5DwtaS/P5VhPvIhhGS 37ViaAfBDHVtb+x8ZTrHMAVojPE4otMiNlAPpzYkwUbIvD3fLkeeWaQcW+2CXcAaavnuzd 2IhFjEFiV3oAVr7/+02RAcoopIdX9TKJYBwb2r8vPCqKd9pj4kvKCjjz9Rtb4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=humh2lk5eqdYSdtahnNxFUqmj4MZyRw4kJxvTaIv5os=; b=ZW/+u+WH+UK7Avf8DaQOSnYjfkV2JBRJNO6BrFo3VqYqEkF/LHu5/cIyB6hNeuNU9vJni0 kyLhqkVwqMJBFLE3Hf+IQgYt0DbWORMjbQ4IxR9BZdCn6BX++5MzbOlvC9RsRpeFD7NJpy 34dUTsYUz04CLZ5jc6kbXo4cKhhmXlIMpK2iIFze26Wm/E0hqKCUxyDrUjiNQqc7QXkrHQ WBWjnguxx+Vmo2U/TKFuWJ822r150WEJNiB3OzIuecYdp3G4mgeq0w9nBNlPu7q/g9Kiks hbgJBZEarl9jM9mVgP/+d1zdlpj/l9ja6Gj3j2yvtcx/mmrBT0pIB/EHmBIepw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295651; a=rsa-sha256; cv=none; b=x7cavq7lDo53JaiAuKm5zg3ZZN6x+jb1tVzklgSnPgAOfAXiWPHlCxJMhC6WT9SsT5ylrm HKoYMvR9z2F2EI/lsuvFj+KfAcMOtR4DwJszwaFb7f2rBBZHTre9XPTjXXsySuBkFX+Eox WFFTkZc5QA16QvFQUyH69iZOg4NLWuYawGLHVypcbz8Wb3TvX9y7D7ZLfLnGSCsZrVwVPe 9I5c/Yyr/C25LkObDCCi02mVUFKOQ7T3zPdx9V/NeKbCjQO4l9RGNnALcDlCZkAzy9U5iQ YJrZZzsUn2vmlsyUE707ybQpBOzKCyMDRUlMnWKC4QyRv3gLKDaXtGFcpZe+/g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8VW0X5Kz17k7; Mon, 30 Jun 2025 15:00:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UF0oSv047508; Mon, 30 Jun 2025 15:00:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0ox1047505; Mon, 30 Jun 2025 15:00:50 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:50 GMT Message-Id: <202506301500.55UF0ox1047505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7b82e3620367 - main - pfctl: Use strtonum in host() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b82e362036763498734ec6ceb74f512c2c05d81 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7b82e362036763498734ec6ceb74f512c2c05d81 commit 7b82e362036763498734ec6ceb74f512c2c05d81 Author: Kristof Provost AuthorDate: 2025-06-27 09:48:22 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:27 +0000 pfctl: Use strtonum in host() This is simpler than checking three cases for `q' and gives nicer error messages. While here, use `v6mask' as maximum netmask instead of hardcoding it. OK sashan Obtained from: OpenBSD, kn , e351e6cba3 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 89960efa3ca1..71731652e4af 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1803,13 +1803,14 @@ struct node_host * host(const char *s, int opts) { struct node_host *h = NULL; - int mask, v4mask, v6mask, cont = 1; - char *p, *q, *ps; + int mask, v4mask, v6mask = 128, cont = 1; + char *p, *ps; + const char *errstr; if ((p = strrchr(s, '/')) != NULL) { - mask = strtol(p+1, &q, 0); - if (!q || *q || mask > 128 || q == (p+1)) { - fprintf(stderr, "invalid netmask '%s'\n", p); + mask = strtonum(p+1, 0, v6mask, &errstr); + if (errstr) { + fprintf(stderr, "netmask is %s: %s\n", errstr, p); return (NULL); } if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) From nobody Mon Jun 30 15:00:52 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8VX4Smnz60ZKd; Mon, 30 Jun 2025 15:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8VX2G9Fz3DRx; Mon, 30 Jun 2025 15:00:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U9UvVWh7Ie1CWSXRCFNtW4m5BoiLQyXf8/gWBOLsCAQ=; b=lELuMWFPY4CokGi/nRs+HA1yVe5PZA4Ot4EGif2q/8DVEghTaYgLN9XXqCIIfRxgfeWAZS 7Ozri7cSAtYHG0xuAaWHv+SG8BgFT71CUB3nSjToDzCVeuCEuGuYQ3vYLZmWX/YE1YagmL 1hdYpKj2lXDAIlTJxsjdwNS2hoxW2bpFfjtKyPMe4iFMEc3jCjG6jgbUNztBjIDxG1kTlj elCHutC1nUGqDklOPfqglBQSDu1+g3HKQuATgea3R4J8R0reHgMf3m6d5MbZ6Yca4uRYFZ glR2v2qBP80ET2UOvwShzYgLYTUCUKBIFMTBSOHp0QH7uV7Qzf5DoeF3AmPzgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U9UvVWh7Ie1CWSXRCFNtW4m5BoiLQyXf8/gWBOLsCAQ=; b=LyquabCwl1v6LFrWd6BOpZ+2A9cB3er0xrWpfe9A+frJjcpD42fsq/Lk580s4k+YpEP589 SemnXixZXRE7Ulva49vrGg1ykuRfrNPV3q4ap9qklcOFO88KjUL6d9jG4m0u/qDw2N7efF lc1+X29Ispj0HkrHlj68wai3OgTqEuwSOzEXWnqMvRdi/q/gy6/b+BsKSnHsOMy2u4JCVp XGWAmbwVd/NhpAhnMeC4swXkEg+vV0CWWzywzDagxYSlmj8WfBZXiNWjx6uKFUr23R0EE0 yvRUjG0EVD4pr7iyIua2fyI1k8XJHrvzUoY+dh73jeathuFb+EoXYTl9605P4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295652; a=rsa-sha256; cv=none; b=qG3HkiPr79akQOJRXo0oy4z1INn/sl3zfmcVu08WXGm1igcBczIKF+4JsfTLtHRYMw+V5g PqLKkfLUwsBnZrdNbBWUkrOKERE/8RQs7TDkfWKlzW6diLOfZoMImigSdfQKW4QDU4DLez 7f/ZTpUzwmPP2TU/+VJ6EN2H2ADs4r9hsDHpUq6782+XBkppQcG5EWs25Vpk0KsXH9/h2I DbMiykYaMb5whXQo5tmEYpwgHWNBsK6FbRFWvidLtwyOxSvOf3upXZoL7iWjJL4tsZiaB/ GJCydO67KBuPZVKs+mLoSav2Gf5FgOgVlOnEWXkaVeUV7/fjkeJYqnmRQAUnlA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8VX1Tpgz1865; Mon, 30 Jun 2025 15:00:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UF0qg0047543; Mon, 30 Jun 2025 15:00:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0qLU047540; Mon, 30 Jun 2025 15:00:52 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:52 GMT Message-Id: <202506301500.55UF0qLU047540@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5d9877ba8f5a - main - pfctl: Simplify host() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d9877ba8f5a4f7311c9b84b973a583650d161ee Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5d9877ba8f5a4f7311c9b84b973a583650d161ee commit 5d9877ba8f5a4f7311c9b84b973a583650d161ee Author: Kristof Provost AuthorDate: 2025-06-27 12:08:03 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:27 +0000 pfctl: Simplify host() Get rid of the `cont' flag, zap obvious comments, add error label. OK benno sashan Obtained from: OpenBSD, kn , a98f6f5f17 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 71731652e4af..67b63ebf8229 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -74,7 +74,7 @@ void print_fromto(struct pf_rule_addr *, pf_osfp_t, struct pf_rule_addr *, sa_family_t, u_int8_t, int, int); int ifa_skip_if(const char *filter, struct node_host *p); -struct node_host *host_if(const char *, int, int *); +struct node_host *host_if(const char *, int); struct node_host *host_v4(const char *, int); struct node_host *host_v6(const char *, int); struct node_host *host_dns(const char *, int, int, int); @@ -1803,7 +1803,7 @@ struct node_host * host(const char *s, int opts) { struct node_host *h = NULL; - int mask, v4mask, v6mask = 128, cont = 1; + int mask, v4mask, v6mask = 128; char *p, *ps; const char *errstr; @@ -1811,7 +1811,7 @@ host(const char *s, int opts) mask = strtonum(p+1, 0, v6mask, &errstr); if (errstr) { fprintf(stderr, "netmask is %s: %s\n", errstr, p); - return (NULL); + goto error; } if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) err(1, "host: malloc"); @@ -1825,34 +1825,21 @@ host(const char *s, int opts) mask = -1; } - /* IPv4 address? */ - if (cont && (h = host_v4(s, mask)) != NULL) - cont = 0; - - /* IPv6 address? */ - if (cont && (h = host_v6(ps, v6mask)) != NULL) - cont = 0; - - /* interface with this name exists? */ - /* expensive with thousands of interfaces - prioritze IPv4/6 check */ - if (cont && (h = host_if(ps, mask, &cont)) != NULL) - cont = 0; - - /* dns lookup */ - if (cont && (h = host_dns(ps, v4mask, v6mask, - (opts & PF_OPT_NODNS))) != NULL) - cont = 0; - free(ps); - - if (h == NULL || cont == 1) { + if ((h = host_v4(s, mask)) == NULL && + (h = host_v6(ps, v6mask)) == NULL && + (h = host_if(ps, mask)) == NULL && + (h = host_dns(ps, v4mask, v6mask, (opts & PF_OPT_NODNS))) == NULL) { fprintf(stderr, "no IP address found for %s\n", s); - return (NULL); + goto error; } + +error: + free(ps); return (h); } struct node_host * -host_if(const char *s, int mask, int *cont) +host_if(const char *s, int mask) { struct node_host *n, *h = NULL; char *p, *ps; @@ -1874,7 +1861,6 @@ host_if(const char *s, int mask, int *cont) return (NULL); } *p = '\0'; - *cont = 0; } if (flags & (flags - 1) & PFI_AFLAG_MODEMASK) { /* Yep! */ fprintf(stderr, "illegal combination of interface modifiers\n"); From nobody Mon Jun 30 15:00:53 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8VY6WBJz60ZQB; Mon, 30 Jun 2025 15:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8VY2NLFz3DZc; Mon, 30 Jun 2025 15:00:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hvMApV/dyhnPgKvnuB6cFOz270hnJckYbUyuqByQWr0=; b=PKQYYjliTPD6TC8Xa9LZcexop3iAW73Ybf3WVEAFKcb20SzbHJke1niNU4XaMrv2pCCk67 yhArWzkrjaK8+1NCjdXsn8mxXwdBUAbbFi+Sr//wHeR4yL1mnAPgVYkBzJjD4pVNMNFmPq q4udXv5wqxNdIPyyrqy6voC90gbP8DDHXFu5UJ8tun0ZnD9ljiCSPJMhMCXqjwEbfid+vi PtAWYpudflxld6+HS91ZcJ9+yFVVAq2kpI+xM2lhAJz4zblZJN8lKYJR4f0oiGQvgYCOKu jvtKMtzqFL/B004900W2889+PYy8VjOxLyjowa2ACbFqkH+8wh0F1De4NWQXBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hvMApV/dyhnPgKvnuB6cFOz270hnJckYbUyuqByQWr0=; b=EVcgBgnIUBwZmPlXpdIMucM9V6VEKRohSUfa+xBu5TPs2GMaDAJoQeqFs2ReZpCdhnlhFW FeUKJ0SQC3rorHYGMYT1/Ekzu0+R8kFqkDJRanFoU+GHY1z+dIdKaiiR6EEwK5RyVJjabL WE5kPYDqiocaTczsQanyDkMNO4/EJ7fG2cuT7tSHt6Q5UwrZKIW5Oj0DYgnRHQDsQWIqJ+ skh3Ld0QX53ZHuCWH8yZ785cAkNhvsQGN35g1QgNWwOSkAEUWlyiyDuxZuZ+jPaOtNKx4Y DTO4XcLg2TpsvOo7IcPqXBMSDxQ/0vqr2Nu/ypQIwKLZs/EoIFz7wKvoYWkbcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295653; a=rsa-sha256; cv=none; b=BUZSoWtwjqs5suB7tjIZIwW0/9lE+Db0Ppsss3mpfKePw0c3R/tdYCqULAXGkCUC3mRDvk 4ryZeO/522AL5gOMDpDWgwfraxX/Y+W4nlBpdEB+S0Wp89mhEqurIUZ/1TW8ptegF5HiFJ IUX02ns4UauO5AS3ui5kEPuXd/4/+4FA61NqLL9kOS/RFVm+BMLkvpwSqXyIb1ngkkESn9 XU6kYFgM5B37byyoaUDFR2qyayzft+uKRk8jTl6DDb5KeQs63UBbO3TmPPkRkSQ5jcrKKP pRMeKtWR+3MVLnGiz4LchUSsVZq+sRb+weB2g+J9kqJZ94Gs/8YF2a2//+egpg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8VY1z2Bz17cX; Mon, 30 Jun 2025 15:00:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UF0r5t047585; Mon, 30 Jun 2025 15:00:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0rBI047582; Mon, 30 Jun 2025 15:00:53 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:53 GMT Message-Id: <202506301500.55UF0rBI047582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a59e7964d58a - main - pfctl: Zap v4mask and v6mask in host() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a59e7964d58a07bfb570c540a72bf805678034fe Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a59e7964d58a07bfb570c540a72bf805678034fe commit a59e7964d58a07bfb570c540a72bf805678034fe Author: Kristof Provost AuthorDate: 2025-06-27 12:15:18 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:28 +0000 pfctl: Zap v4mask and v6mask in host() Simply defer checks whether a mask has been specified to where it's set in host_*(); this is to reduce address family specific code. OK sashan Obtained from: OpenBSD, kn , 17e25e9423 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 67b63ebf8229..d3017bbd2568 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -77,7 +77,7 @@ int ifa_skip_if(const char *filter, struct node_host *p); struct node_host *host_if(const char *, int); struct node_host *host_v4(const char *, int); struct node_host *host_v6(const char *, int); -struct node_host *host_dns(const char *, int, int, int); +struct node_host *host_dns(const char *, int, int); const char * const tcpflags = "FSRPAUEWe"; @@ -1803,12 +1803,12 @@ struct node_host * host(const char *s, int opts) { struct node_host *h = NULL; - int mask, v4mask, v6mask = 128; + int mask = -1; char *p, *ps; const char *errstr; if ((p = strrchr(s, '/')) != NULL) { - mask = strtonum(p+1, 0, v6mask, &errstr); + mask = strtonum(p+1, 0, 128, &errstr); if (errstr) { fprintf(stderr, "netmask is %s: %s\n", errstr, p); goto error; @@ -1816,19 +1816,15 @@ host(const char *s, int opts) if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) err(1, "host: malloc"); strlcpy(ps, s, strlen(s) - strlen(p) + 1); - v4mask = v6mask = mask; } else { if ((ps = strdup(s)) == NULL) err(1, "host: strdup"); - v4mask = 32; - v6mask = 128; - mask = -1; } if ((h = host_v4(s, mask)) == NULL && - (h = host_v6(ps, v6mask)) == NULL && + (h = host_v6(ps, mask)) == NULL && (h = host_if(ps, mask)) == NULL && - (h = host_dns(ps, v4mask, v6mask, (opts & PF_OPT_NODNS))) == NULL) { + (h = host_dns(ps, mask, (opts & PF_OPT_NODNS))) == NULL) { fprintf(stderr, "no IP address found for %s\n", s); goto error; } @@ -1877,7 +1873,7 @@ host_if(const char *s, int mask) /* interface with this name exists */ h = ifa_lookup(ps, flags); for (n = h; n != NULL && mask > -1; n = n->next) - set_ipmask(n, mask); + set_ipmask(n, mask > -1 ? mask : 128); } free(ps); @@ -1944,7 +1940,7 @@ host_v6(const char *s, int mask) } struct node_host * -host_dns(const char *s, int v4mask, int v6mask, int numeric) +host_dns(const char *s, int mask, int numeric) { struct addrinfo hints, *res0, *res; struct node_host *n, *h = NULL; @@ -1990,7 +1986,7 @@ host_dns(const char *s, int v4mask, int v6mask, int numeric) &((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr, sizeof(struct in_addr)); - set_ipmask(n, v4mask); + set_ipmask(n, mask > -1 ? mask : 32); } else { memcpy(&n->addr.v.a.addr, &((struct sockaddr_in6 *) @@ -1999,7 +1995,7 @@ host_dns(const char *s, int v4mask, int v6mask, int numeric) n->ifindex = ((struct sockaddr_in6 *) res->ai_addr)->sin6_scope_id; - set_ipmask(n, v6mask); + set_ipmask(n, mask > -1 ? mask : 128); } n->next = NULL; n->tail = n; From nobody Mon Jun 30 15:00:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8Vb0Dcnz60ZVZ; Mon, 30 Jun 2025 15:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8VZ3XK4z3DX5; Mon, 30 Jun 2025 15:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B9Q5smaq57EGjOEpqtlAiCTb4mAq1SxJthLl3FqBVfE=; b=jOOlnV0feO4dRPnNryztxKu1uEWdlaj7D2lT/DypWY0vF24XG/abNGtmYDwKdyKoeJ/i3y i0vufo/7k7/CifJdfoLe2B1SWJ8cKbING+eWZQSjDQ0a5CHu03Ua8A8GA4AtH1IVd35Gcx eTF3Csl7606lR13Y/CPgfku/Svvk4L7NQZpD53c446viWV6fQA/qyQ/cZX/YSPXSjoQAyn IekJ34l6qcFTzzL/UBDa/V4oHiewRymKykCETVDzM9Eitu9Rl7x+ZIV7NmVKrQ0EIgj1N7 c0KtYsPTY8emsxZFggmFZG8dtUAswickesY92BVYd2U/V8LVb5ch6++18c36Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B9Q5smaq57EGjOEpqtlAiCTb4mAq1SxJthLl3FqBVfE=; b=VTCD/Nx31TjoMEIjV1+XgtaDLD5UTzSaUdr39fOXO8VLke+CgCMGZT3hAoLHC1wUzjsPhS xvxaZJKylKOUhGYQLGutBdZuvSzT1HCVnNHfzzdzzrZHe+t8f4MJjOzAihZR1njVH4nrl+ sIpZovi4QSp+2IxbAn2faPazloEni1xAhCJo82MzMJdQnmOmYWtWfRG83ZtJWDx4oZjxtP Ph0et0/RrMnDqjBAsUn6CsUuQTrPOU1lsJBQ+27MuTCYqyvUp47H6BzWLWtuXCljPqJvPA mJr7gGaL5fWGrRo67o1rR5vRLn7tIBreQtwPasSmKrM9Vm0o4n1bbEPY0Xaxaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295654; a=rsa-sha256; cv=none; b=GalLJvHnPObQ4nVJf3n98dhHN7qmOeScVH63Y2igXiy4Z4hetwluRZ5noJi77Z4nZAK7MF pbCursz+Z9040H35y80aJ+yh2AB4OJ4kXvaCnuYP/S67Nl99MisP+iV64PolDb0DhYTEws gWnyKeHnmS79uK44K/8pNln34wJ6aihi4V6NEINnN7eer3YKTQBI1pwtoWzGgoqoQ5UZAZ txYOLROx5Kn/RTUw5lXUDIQnu9zDXnupw0vc7tt66ydk+EoB6JlRCQeLk5GTB6dCw1kai+ 9coeGGvBMzLtEPTcaBxKquYgCTmVtDLnDYSUuhM0UZu1+aSu9z8foWC0mNBbYA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8VZ2xyyz17k9; Mon, 30 Jun 2025 15:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UF0sFm047620; Mon, 30 Jun 2025 15:00:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0scN047617; Mon, 30 Jun 2025 15:00:54 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:54 GMT Message-Id: <202506301500.55UF0scN047617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: eb6c2218fe64 - main - pfctl: Zap bits in host_v4(), use mask parameter List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb6c2218fe64451dff6bedde092b7a04db753a9c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=eb6c2218fe64451dff6bedde092b7a04db753a9c commit eb6c2218fe64451dff6bedde092b7a04db753a9c Author: Kristof Provost AuthorDate: 2025-06-27 12:17:23 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:28 +0000 pfctl: Zap bits in host_v4(), use mask parameter This avoids a duplicate strrchr() call and makes the function consistent with host_v6() regarding mask handling. While here, use the destination's size in memcpy instead of hardcoding its type. OK sashan Obtained from: OpenBSD, kn , a7ede25358 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index d3017bbd2568..0c5f184106cd 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1885,11 +1885,10 @@ host_v4(const char *s, int mask) { struct node_host *h = NULL; struct in_addr ina; - int bits = 32; - memset(&ina, 0, sizeof(struct in_addr)); - if (strrchr(s, '/') != NULL) { - if ((bits = inet_net_pton(AF_INET, s, &ina, sizeof(ina))) == -1) + memset(&ina, 0, sizeof(ina)); + if (mask > -1) { + if (inet_net_pton(AF_INET, s, &ina, sizeof(ina)) == -1) return (NULL); } else { if (inet_pton(AF_INET, s, &ina) != 1) @@ -1902,7 +1901,7 @@ host_v4(const char *s, int mask) h->ifname = NULL; h->af = AF_INET; h->addr.v.a.addr.addr32[0] = ina.s_addr; - set_ipmask(h, bits); + set_ipmask(h, mask > -1 ? mask : 32); h->next = NULL; h->tail = h; From nobody Mon Jun 30 15:00:55 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8Vc5wh0z60ZQL; Mon, 30 Jun 2025 15:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8Vb63rSz3DQ5; Mon, 30 Jun 2025 15:00:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295655; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uzlQwMrnpK/0MCCgIuXHf0d7PGcn5sRnqGfHO4Y7Nfo=; b=OBS36vW0K0tNuvuIliC3o30Hz7nPknwhpO3eHsyLDYvwVahWDVD28zp/hcThN+Hz411lsI NvT4vkcsBFZDEmkT4wSKkKnAEy63H9jKdiWgKF5xHtCp4qKBI2Mc5pCxI3bINxXI0RLdCh oiWqGYOr6uTmw2/1eu6D+HNqPoGgYzgHzZ6GZxBmFoFkj64OsQ+zolODyPoz3TXS4iNeQq Jq4cTBdcgJnYmgnBevhfmBUz4hsVUX0GlfKvW8sR70t725dDGbEJHrGy/ViCbK8SUBntMi MhN/kvPXLR1SqFvGlH+88sUEoM5k/SDEfmPOFWUHNynC5fjpmbfyjBC1FOM/CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295655; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uzlQwMrnpK/0MCCgIuXHf0d7PGcn5sRnqGfHO4Y7Nfo=; b=bxlLZZpwHDfBp0Ak6lfrE/2YfF1LHu/Opf85NIiCmFBzsm85ldXlhEPxt5F4yJ8mOFWK+T EsMZKU2QxB1WuvXoDg238cYAgAa6WCcc+stqG8f4vgcehJPIg5LxJXTO5dVL1qXodNcWAF 6RhgqBY242fYAYoCAI/eCyLsTlNpgBT8u5ZkGc0aH7ye+AeWQGVBF1XWXBKeBpaLnBdbw0 YV0WbWc9XiRWNyDh07lCaf2D9eU/9HQxcR8edE7/+/w9QS1oDyKk+jxlrce8MGVthwqfid /DnsUNbtnwZoDrGqDNz6C/KuWQrG5m8M+bA7K8Nv7agHj7+uOL738cP7uHvPow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295655; a=rsa-sha256; cv=none; b=GUnS/77u8+mgozZ64ziOhmyV8u723H4VVIl/0Ta+N8zeuzPn3r0wNDAPOzJsrbHJj4JTE4 M93r7rFZdiUJT8caY91QrAkhPmd3YSzHLyRkV2qGzGG/vXE2v0d8phIKbkDnqITxI4TtPT 0SB2VunTkFdFaq5RgJ48f7HsiF7WjV/UqTVD43FKONbSuKCwYu7hTVWvR/Y1sIWHa44kpq TMSbQDKjgSeoXvWzawQiUxhEyMCCdSAIh4QI1ssZXx8/ZirxDzP/frfI4D6VtgrsMhRLhL 7K15NK5CDpWDbiUx8CYpCvuuQZ0ULXwB1dlguAuW+dkStLyFsZNEFBmrwtwvCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8Vb3rdXz17cY; Mon, 30 Jun 2025 15:00:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UF0tIK047654; Mon, 30 Jun 2025 15:00:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0tNF047651; Mon, 30 Jun 2025 15:00:55 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:55 GMT Message-Id: <202506301500.55UF0tNF047651@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e790bcd784c9 - main - pfctl: Use error label in host_if() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e790bcd784c995f7aa8f730d1de1b6c5de5872b2 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e790bcd784c995f7aa8f730d1de1b6c5de5872b2 commit e790bcd784c995f7aa8f730d1de1b6c5de5872b2 Author: Kristof Provost AuthorDate: 2025-06-27 12:23:34 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:28 +0000 pfctl: Use error label in host_if() This brings it in line with host() and host_dns(). OK sashan miko Obtained from: OpenBSD, kn , d127311405 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 0c5f184106cd..d903b592b1ac 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1852,22 +1852,18 @@ host_if(const char *s, int mask) flags |= PFI_AFLAG_PEER; else if (!strcmp(p+1, "0")) flags |= PFI_AFLAG_NOALIAS; - else { - free(ps); - return (NULL); - } + else + goto error; *p = '\0'; } if (flags & (flags - 1) & PFI_AFLAG_MODEMASK) { /* Yep! */ fprintf(stderr, "illegal combination of interface modifiers\n"); - free(ps); - return (NULL); + goto error; } if ((flags & (PFI_AFLAG_NETWORK|PFI_AFLAG_BROADCAST)) && mask > -1) { fprintf(stderr, "network or broadcast lookup, but " "extra netmask given\n"); - free(ps); - return (NULL); + goto error; } if (ifa_exists(ps) || !strncmp(ps, "self", IFNAMSIZ)) { /* interface with this name exists */ @@ -1876,6 +1872,7 @@ host_if(const char *s, int mask) set_ipmask(n, mask > -1 ? mask : 128); } +error: free(ps); return (h); } From nobody Mon Jun 30 15:00:56 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8Vd3dDQz60ZFL; Mon, 30 Jun 2025 15:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bW8Vc6kptz3DGy; Mon, 30 Jun 2025 15:00:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HcqQxJfkUmQNmgk2DODvggreup/UFPhP0kw+VeOtDBo=; b=W5ahxi2va0W+/W5MDI+mwsuUD5LDifFk+QkZv6UvQUnsiKLnrusi30hobZVGjuw7BhO+0i 3HNGdD/o0+64n4q/p0W+28P5AlyT7SKLAAhWhD5iEzoyMqQc+08rpXjB8bxAPIf8/0gDc4 qzOSI3cS/MV6mgBYSydTiDLwMcUKDCXZF1l8Qli9z2Unqkb5kGdqsK9JroFG9S6PSbZSdx hvw9ZVL/WW/CS352pDISoD6MnKr1yeBD4aUWESULkC+SruqaaLzumYIFojYSSbXmywj7y/ 3AhY4/ir2C4/mKYeneo2XJa4lhHqxgasSG7KZB3FX6e+n0+twyPc/Kqj0Pj9Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751295657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HcqQxJfkUmQNmgk2DODvggreup/UFPhP0kw+VeOtDBo=; b=eMMsMyJ/cQGwiZzeXFQAk6QTySkSslC38m0RyFY6jKc4Xz/fG8FdGhG+zn+xSHVmbOAP78 fyWFQAuDH9RJqC1JQkme6kPXoRegLYuRdKiQLg4hGfzs8Y0BuSOkQyjYPioFavITdS8eFN VfcQjDFl2hcv7j4ciXKXtXLCL73rHekGmg++8Rvo8FDn7smlCRIZr0lfI00v/RWsOFDTg5 T0dSBktKyYEBrDNHkP4olIHb3HjJAQeAMGYTwzbw0bm/4wlIg484gedOXFITbil40BG09X J5yKNPAl9GUGhMsUBp6/CWexkvTOf8tyyQLl+JRP+ScuUTZYwwogosGXQRaKjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751295657; a=rsa-sha256; cv=none; b=INYBOikEhPNR233R2pkh+iMjh2MA3UwENVpjVlXjO2M4libQ2t18TU8cgkjJ3cFvV3tfOL mI/ut+GYUycpBqnFBXXXt9SCUkZuu4rOv7/IqrdDXwhTuaZpdYi4XFHkXH2MXsyHordTZO uO/vbVdGurDYQXxe4AylbIWBWMIw/w4qJriP2YO6dbbhddr3HqsiQV7k1bZTiGnlctJM5k ZzmgmAY4o7yI6i24X2z85gyVwCeM4kK5xCuVXfE8VnNF5CXNszmCiYNUegh7y5FAASM3YS w65fOjiXobYSMOt85BwPIf4JAWOEJadBxbyXY0o+PvxFYEJ99qSebWWPy1Jo5w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bW8Vc4QJdz17gn; Mon, 30 Jun 2025 15:00:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UF0uGZ047689; Mon, 30 Jun 2025 15:00:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UF0udK047686; Mon, 30 Jun 2025 15:00:56 GMT (envelope-from git) Date: Mon, 30 Jun 2025 15:00:56 GMT Message-Id: <202506301500.55UF0udK047686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5c0eb439cfad - main - pfctl: Move AF-specific mask logic from callers into set_ipmask() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c0eb439cfadac1e59ff96abbf26fe6bb15ec58d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5c0eb439cfadac1e59ff96abbf26fe6bb15ec58d commit 5c0eb439cfadac1e59ff96abbf26fe6bb15ec58d Author: Kristof Provost AuthorDate: 2025-06-27 12:27:28 +0000 Commit: Kristof Provost CommitDate: 2025-06-30 15:00:28 +0000 pfctl: Move AF-specific mask logic from callers into set_ipmask() Instead of doing the same dance with every caller, check for user provided mask or address familiy specific maximum inside the function itself. Feedback and OK claudio Obtained from: OpenBSD, kn , c04427dd30 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 35 +++++++++++++++++++---------------- sbin/pfctl/pfctl_parser.h | 2 +- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index d903b592b1ac..439c75b7c98f 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1323,14 +1323,20 @@ parse_flags(char *s) } void -set_ipmask(struct node_host *h, u_int8_t b) +set_ipmask(struct node_host *h, int bb) { struct pf_addr *m, *n; int i, j = 0; + uint8_t b; m = &h->addr.v.a.mask; memset(m, 0, sizeof(*m)); + if (bb == -1) + b = h->af == AF_INET ? 32 : 128; + else + b = bb; + while (b >= 32) { m->addr32[j++] = 0xffffffff; b -= 32; @@ -1751,16 +1757,13 @@ ifa_lookup(char *ifa_name, int flags) if (flags & PFI_AFLAG_NETWORK) set_ipmask(n, unmask(&p->addr.v.a.mask, n->af)); else { - if (n->af == AF_INET) { - if (p->ifa_flags & IFF_LOOPBACK && - p->ifa_flags & IFF_LINK1) - memcpy(&n->addr.v.a.mask, - &p->addr.v.a.mask, - sizeof(struct pf_addr)); - else - set_ipmask(n, 32); - } else - set_ipmask(n, 128); + if (n->af == AF_INET && + p->ifa_flags & IFF_LOOPBACK && + p->ifa_flags & IFF_LINK1) + memcpy(&n->addr.v.a.mask, &p->addr.v.a.mask, + sizeof(struct pf_addr)); + else + set_ipmask(n, -1); } n->ifindex = p->ifindex; n->ifname = strdup(p->ifname); @@ -1868,8 +1871,9 @@ host_if(const char *s, int mask) if (ifa_exists(ps) || !strncmp(ps, "self", IFNAMSIZ)) { /* interface with this name exists */ h = ifa_lookup(ps, flags); - for (n = h; n != NULL && mask > -1; n = n->next) - set_ipmask(n, mask > -1 ? mask : 128); + if (mask > -1) + for (n = h; n != NULL; n = n->next) + set_ipmask(n, mask); } error: @@ -1898,7 +1902,7 @@ host_v4(const char *s, int mask) h->ifname = NULL; h->af = AF_INET; h->addr.v.a.addr.addr32[0] = ina.s_addr; - set_ipmask(h, mask > -1 ? mask : 32); + set_ipmask(h, mask); h->next = NULL; h->tail = h; @@ -1982,7 +1986,6 @@ host_dns(const char *s, int mask, int numeric) &((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr, sizeof(struct in_addr)); - set_ipmask(n, mask > -1 ? mask : 32); } else { memcpy(&n->addr.v.a.addr, &((struct sockaddr_in6 *) @@ -1991,8 +1994,8 @@ host_dns(const char *s, int mask, int numeric) n->ifindex = ((struct sockaddr_in6 *) res->ai_addr)->sin6_scope_id; - set_ipmask(n, mask > -1 ? mask : 128); } + set_ipmask(n, mask); n->next = NULL; n->tail = n; if (h == NULL) diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 45d9ebc45bc9..8ab331561c7d 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -361,7 +361,7 @@ struct pf_timeout { extern const struct pf_timeout pf_timeouts[]; -void set_ipmask(struct node_host *, u_int8_t); +void set_ipmask(struct node_host *, int); int check_netmask(struct node_host *, sa_family_t); int unmask(struct pf_addr *, sa_family_t); struct node_host *gen_dynnode(struct node_host *, sa_family_t); From nobody Mon Jun 30 15:19:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bW8vv17Phz60b32 for ; Mon, 30 Jun 2025 15:19:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (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 4bW8vt68zpz3MJx for ; Mon, 30 Jun 2025 15:19:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-b2c4331c50eso4513746a12.3 for ; Mon, 30 Jun 2025 08:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1751296760; x=1751901560; 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=4fsmROK+u7UogCOPW4Z11QIMTRmrceRgAlKNxcSsniE=; b=xpHcM27yKKds7mcRj4mks/46of8ZhVRIU7GK2KPbQYUaWVDHxPIGbjFzubpnim+/q/ GI5OMGykXqAu9Sll5oWIYe6fOk4xHcCGosJHfDs/AVWlXFtcoXjoMCNQ+f0Ln4D5duBQ ZYMzBjmaOJ3Zz5yYXULISspm5lhJwlzI+iha0IEYhTiim1BZ78HQU7WoX8Wcdxm+BhEo XYbTCEOwzbTeBIIzCe5HnF85f2XS4twpaPhWV/FauWw/07rv2AvYQ5pios2u7akLFamb 7kQ7YKeU9Ip3wvKNYMXK0LeUkk6dkaB48ry/HblJf972n8JPFOzTcWcrVgQ0CLEgQ2lW T+bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751296760; x=1751901560; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4fsmROK+u7UogCOPW4Z11QIMTRmrceRgAlKNxcSsniE=; b=giPvwHxY575xjVqiP+/qkW6ekoZqG12bBd8wW1RG6Ap8rOD64SgCwdkoSStrLntmdG gj9KOMeJJqrM5Kooe/zbQOVcZ7e6DwAVoI0WYoW/uuqv3Nns4Na5lxiQ0bTPueyoueJ4 aU34XReCIYpU6lOX3ZzTdziYZiIHDim3V2NhhAOKviTpzmtAN21Wqciyz1O7CDF+Mszb SiXCnL66X7Cq2+dxK31BBgsxz9ICtYOSr1d8tc5b4tXeq5okEUEKsW8HS6FfEYP1WHf2 Y2r9bv3bqEvvWF8E2Hd1d8QJFqzcebzK9dOJdTUEwhgdoipKCklUlScmHGCagyg2tZBW ++3A== X-Forwarded-Encrypted: i=1; AJvYcCUiYYO1fXL3j+Ukusx5XnwGG9kc7mQ3wuMnevMTsQ4tpyDyhvMWpa+HokV/Wec5jrIraK/RDpjzvAWJikfxl8K3dWvV@freebsd.org X-Gm-Message-State: AOJu0YyW1XO2fw5xTGlWK1RTkXlSSBT87WLavQA7M/cCA8F+CCJ8NTjA QrLtiaJY3as6sRO7pn3cG2/1184TpR2YxEjEXHZMUfsvZqEPz/4tKhwbEtgjmiAndYvIqx/dzDE qEB5afXOvYIVxiAc1i8b8YYVUKOC7jWBJhQ2NI3BFKGVxCulAh0RERuMllA== X-Gm-Gg: ASbGnctgCjkjJatLIt6zcGb59MyI+akGga0y2AaL3kVpFHwpPQKzU1c70pMhfv8aphD n/7RxriIR79VLhibd5WefeMQt7fERohwOzbd/sBCeDd9eM7QgtMKqFdKh4dkHUojxgzGocyrbTF Cyg7v3d3j0VeKHNG/rOK8KsGjBDBKZucZMwsXcd4tkde0VhTi1UeTEFQ== X-Google-Smtp-Source: AGHT+IH1sMWw0q3I8Kc+KoOJClTF7+tmJMBnS0BE2SSyKNQ9shVQt2lwW8mjrauEcRpUQ7flp5rLDGzxenr7oJdJ4f4= X-Received: by 2002:a17:90b:5251:b0:311:ea13:2e6a with SMTP id 98e67ed59e1d1-318c9225eb1mr18095360a91.13.1751296760163; Mon, 30 Jun 2025 08:19:20 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202506270721.55R7LlB1067221@gitrepo.freebsd.org> <69858708-8e73-4b70-9f33-5176fceb1b36@FreeBSD.org> <89e23d9e-885c-4811-886a-6c1011715679@FreeBSD.org> In-Reply-To: <89e23d9e-885c-4811-886a-6c1011715679@FreeBSD.org> From: Warner Losh Date: Mon, 30 Jun 2025 09:19:08 -0600 X-Gm-Features: Ac12FXzz8AtGj1r0IOPA4oyYsXSoHh4-MoiIkzmOgH8u_59ONzbnUPiCPCQkRGc Message-ID: Subject: Re: git: ad8d33679999 - main - mmc_xpt: use strlcpy instead of strncpy To: Andriy Gapon Cc: John Baldwin , 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-Rspamd-Queue-Id: 4bW8vt68zpz3MJx X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] On Mon, Jun 30, 2025 at 7:57=E2=80=AFAM Andriy Gapon wrot= e: > > On 30/06/2025 16:34, John Baldwin wrote: > > On 6/27/25 03:21, Andriy Gapon wrote: > >> The branch main has been updated by avg: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/? > >> id=3Dad8d33679999c0e7f6fd2b77d2e414102bd365ec > >> > >> commit ad8d33679999c0e7f6fd2b77d2e414102bd365ec > >> Author: Andriy Gapon > >> AuthorDate: 2025-06-23 21:31:04 +0000 > >> Commit: Andriy Gapon > >> CommitDate: 2025-06-27 07:13:34 +0000 > >> > >> mmc_xpt: use strlcpy instead of strncpy > >> A better practice in general. > >> MFC after: 1 week > >> --- > >> sys/cam/mmc/mmc_xpt.c | 6 +++--- > >> 1 file changed, 3 insertions(+), 3 deletions(-) > >> > >> diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c > >> index 138f96eaaa49..4fce03004994 100644 > >> --- a/sys/cam/mmc/mmc_xpt.c > >> +++ b/sys/cam/mmc/mmc_xpt.c > >> @@ -1213,9 +1213,9 @@ mmc_path_inq(struct ccb_pathinq *cpi, const char= *hba, > >> cpi->max_lun =3D 0; > >> cpi->initiator_id =3D 1; > >> cpi->maxio =3D maxio; > >> - strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); > >> - strncpy(cpi->hba_vid, hba, HBA_IDLEN); > >> - strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); > >> + strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); > >> + strlcpy(cpi->hba_vid, hba, HBA_IDLEN); > >> + strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); > >> cpi->unit_number =3D cam_sim_unit(sim); > >> cpi->bus_id =3D cam_sim_bus(sim); > >> cpi->protocol =3D PROTO_MMCSD; > > > > Hmm, are you sure these aren't depending on strncpy zero-padding > > the result out to the full length? String fields in inquiry/identity > > structures are often not C strings but have other requirements. > > (Some of them are space padded instead of \0 padded for example.) > > Not sure, but using sim_vid as an example, I see strlcpy in cam_xpt and > ctl_frontend_cam_sim. It seems that in context of ccb_pathinq those fiel= ds are > "normal" C strings. You should really get changes like this reviewed. "seems like" is not a good enough reason to do this. In fact, it's a terrible reason in the CAM code. There are places that the strncpy use is intentional and you will screw things up if you use strlcpy. Too many fixed width fields in old-school storage devices that reflected into different APIs, sadly. A better reason that it's 'right' is that all but 3 other places in the tree use strlcpy for this field. The field will be NUL padded, in practice, since CCBs tend to be zero'd before use (though path_inq often is done with stack storage without the usual init). And a quick look shows that we don't use dev_name, hba_vid or sim_vid as a fixed width field anywhere but the 'compat' code that copies the whole thing and doesn't care. We never use any of these three fields in the kernel for anything, apart from filling them in. We do use them in camcontrol (and similar 3rd party programs) to report them to the user as strings. There's other places it looks like they get injected into geom attributes, also C strings. A look at history shows 4195c7de2471d intentionally changed them, and that change was reviewed. It also has the reasons why it's OK in it. So from that perspective, this is a good change. The reasons listed there are sound (though it's too equivocal: these fields were always NUL terminated except when the string was the exact length of the field, which we didn't do anywhere, but that's not important). An even better question is: shouldn't a change like this have checked the other 4 places, and changed them as well? If it's wrong in one place, it might be wrong elsewhere. Or looking elsewhere would confirm or deny that this was intentional for some reason. But there's another consideration that 4195c7de2471d didn't think through that I have just thought of... Warner From nobody Mon Jun 30 20:00:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWH8l1RBGz5ysDY; Mon, 30 Jun 2025 20:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWH8k6FZcz3gHb; Mon, 30 Jun 2025 20:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751313654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7nwqwBi0HwHjLW2f1vG3BYWrlC3KRCioRIhVfZNs0+U=; b=YPhdLRKJRSVENknmqErESy/JuMaPuuAKzyc4Q7gde8UuSoYHRQi+YQ+D/KC1Lm0uuAVS2Q GO9SZRetR9qTLfmkolnGV9//iT+ElQFeNngLzGxgVX4rt9Wg8LWM4/kVFf1cUgrnStDvZ1 A6XXrqa2Zee+VjPfjQ5AdfhrIIJ/kyILoCH8zulryI05tGe5m4z6LRKrwzguGCi8lKRk0e Sk9kw18WYXwpNJx6xZTuXDCnZZ0IK42jNkGPJl54A3ExtKOrtamlBkgsHhXFFlBMmpbl6y YghRKJeWEK04glub1BEOxT6ge9UCa6dcLiw7DJEQGGhWAbF0zIsBDIdGd9ZhJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751313654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7nwqwBi0HwHjLW2f1vG3BYWrlC3KRCioRIhVfZNs0+U=; b=lOuvG0OxnfYxju00YmdDTDC+VV4dfdbQhTCivvvvCE8rKVesdL6R/qdrs0I5WOkoe1EiAq 1NvjIqteHYEAj8T1G/thESfz9G+CUpIIMUcl9qrQBBShzN4PxB0VxbiDOQWvmviBDLvjRG eV5Cx9JhSqCroOjtKoBFv/FfXM93OxtVdl73CkdjsjXbJ1R5n3QT1sA3G79f3ZTStWB41T GjZ0qFtGB30crJNdpeuykbovRFYB7f4DSdrriBpvi27PwoeAELTIt/YKkNROfB7iP0PXmp zWiud7nGhD893S5f3N72TA3OuZMhpDiQFGcgpusUnfFZq1D0v+XuOrfcMULcmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751313654; a=rsa-sha256; cv=none; b=LkJQH+I7LGZ5sqovJe/rnLpFa4qiKDuKnYavijWZjIGmMSpzAK8y9yDLRtLK/CQr5fQ4CW NOuoM3pYFZjNxlzB8vG0l0vB9gtx4WC9inSv2UauHByPZmuHhl6wYTGxmyKV08GPAhX2hq 3G2II2XyhVUpjh+6Yzum9sU7bezxl4acTR07SPXiwA4jNxhA1K3/N9ZDIpOLzjH0fYS6Zq wzXErGCtjEC2okyTgZ4TEyFcekx/J7PdNPzfhx7rWzwavufeUU7Z9WeOZ1QhMDDvWB1gCa NkWqlNaIBaEPaHlpbgHdJYwY7lVA1LIoP3ZHN5snnMMPc5gqGNxdqRzJ3Y92lw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWH8k5pGNz1H62; Mon, 30 Jun 2025 20:00:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UK0s4n018432; Mon, 30 Jun 2025 20:00:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UK0s3V018429; Mon, 30 Jun 2025 20:00:54 GMT (envelope-from git) Date: Mon, 30 Jun 2025 20:00:54 GMT Message-Id: <202506302000.55UK0s3V018429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: d8c5c513e1cb - main - param.h: Bump __FreeBSD_version for NFS api changes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8c5c513e1cbca329a75fa6ea5f5064c3a1d78b2 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d8c5c513e1cbca329a75fa6ea5f5064c3a1d78b2 commit d8c5c513e1cbca329a75fa6ea5f5064c3a1d78b2 Author: Rick Macklem AuthorDate: 2025-06-30 19:58:01 +0000 Commit: Rick Macklem CommitDate: 2025-06-30 19:58:01 +0000 param.h: Bump __FreeBSD_version for NFS api changes Commits 171f66b0c2ca and 8e2a90ac8089 changed the internal api between nfscommon.ko and the other nfs modules. Bump __FreeBSD_version to 1500049 for this. All NFS related modules must be rebuilt from up-to-date sources. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index b9849390c844..f1bf874cb5fd 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -74,7 +74,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1500048 +#define __FreeBSD_version 1500049 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Mon Jun 30 20:06:28 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWHH83kx7z5ysFm; Mon, 30 Jun 2025 20:06: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWHH82J27z3jry; Mon, 30 Jun 2025 20: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=1751313988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m/8auya4FosDHcdUyr7ZDH3t/IeLEUHw0gbuRi9JLfI=; b=ia73G+WLi/xEC5V5zt6ooy0eOjWFc8Den9ZwGv+UZfOFNvg1QbAfelh857CiOdrf2mM5DY ZfGCJTcNOpvV7qVuh+xstXw812Wd29FRrXUSixFSWrOkenyXONKBOPbHN1lewE2iWfyoXo 2U2i7orP80uJIYYRXpBxyt7T8lijygqL8EVF7UGEj4fhXytnaCDmQrAcn9+VuThxiUY5jV a41G9Ve6wM9VsPhaabqkh7KDMHwQ1xTt5rNyzauM6mL1h+977Teu6lG2lOjKoQK8pVT6hy KakieVytYtTascKaNy29fRtq74aNJyLqDabJ4q9N2x7LVOIh4VCxa0iUs5WkCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751313988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m/8auya4FosDHcdUyr7ZDH3t/IeLEUHw0gbuRi9JLfI=; b=Y2QK3POT+0WTtF92HOr5QfV0I7wLovJYTw+1ky7n1EC31AC7YXBz05EVK2DYg+EDdOsjk9 avtLq6Z0xbfylFTqvdlE2Leutrn55xCT8BO9bNzocVzv1lGOgXxtEQlWiKtOPJAGMtQ5zZ RF3+awXs+HOOBhJsh5lHlNXOsmXy1QLgIpplm23w7/CuOhoWnPDcmpo0AaMWSfJDBB0XLn 0wrN7MnqzrzO2CHkQjZTQOlgbrCn3r9IvVof3KdlCzAJoegL5tVluFF/vXxPwosyGfTmnh d9HbX9lYQfRpO0uSY1RBrE26B2IIhJb/+/0f5+yblWeQAyZ/tUVomRN5wJENZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751313988; a=rsa-sha256; cv=none; b=OdVzeBNIDIXRaV+Zqow+JujMWSGnj3PP4FBvUplJBvKL0/fB+VoEtTo2gkkHufxhAHzO86 UvbqIzSuzPfKkvAVUiQwFhd5X7sXTUDG7SNEC5qDWO8zAHmoie9TTJbHMTnCNjYWPYe6kk FL9ByHu02homxbnaECfzVUe1KZ5hDSHQSpsZPe0pX+oBA7MYMGYTzABhAzS381/tsx934g l2YZcNtvSAHQ9z3HeA7p48MmXM+2KVH4u9lF5xwJHJBwcGkSaqKV8ISXQs+TklMlAKceGG rI4pjFriQ+7hGtM+z4/lvQMMOAk3NVnwu4NG3012Q23xaK6BuHMeCebjofH5EQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWHH81Xg9z1HXL; Mon, 30 Jun 2025 20:06:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UK6Swu023433; Mon, 30 Jun 2025 20:06:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UK6ScN023430; Mon, 30 Jun 2025 20:06:28 GMT (envelope-from git) Date: Mon, 30 Jun 2025 20:06:28 GMT Message-Id: <202506302006.55UK6ScN023430@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 1b832d5d8cc6 - main - UPDATING: Add an entry for commits 171f66b0c2ca and 8e2a90ac8089 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b832d5d8cc6a24d6fa8691397bafc077b0c4b88 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1b832d5d8cc6a24d6fa8691397bafc077b0c4b88 commit 1b832d5d8cc6a24d6fa8691397bafc077b0c4b88 Author: Rick Macklem AuthorDate: 2025-06-30 20:03:14 +0000 Commit: Rick Macklem CommitDate: 2025-06-30 20:03:14 +0000 UPDATING: Add an entry for commits 171f66b0c2ca and 8e2a90ac8089 --- UPDATING | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/UPDATING b/UPDATING index fb4f1234a62f..9b3cd1b90909 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20250630: + Commits 171f66b0c2ca and 8e2a90ac8089 changed the internal + api between nfscommon.ko and the other nfs modules. + Bump __FreeBSD_version to 1500049 for this. + All NFS related modules must be rebuilt from up-to-date + sources. + 20250625: "make delete-old" will now remove the Forth bootloader entirely if the system is built with WITHOUT_FORTH. From nobody Mon Jun 30 20:20:35 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWHbR5TyCz5ytGY; Mon, 30 Jun 2025 20:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWHbR47w1z3rG0; Mon, 30 Jun 2025 20:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751314835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zWFWPEBj/aExAg/UrEMAp3SKrbL1CRtjMNy/5JjAN8U=; b=AZHtkH1O8xoJ3+CTuKQjRPpSOGMpt2YPt4CMKFcauJOAWSH5Bh9kp9F8ng1xX61dA7QHMn dGTvDhWaen+NDDFbIHoyshRqokFQZl/svQpyvbPOWYK9Jh8SOEKR4Rdhn1S2ltOweRtEjn m56ZVkXx8gXccuhl1VHuTrOwoFNdda/kTs2N6imG/3C6ypi/zuL5O+ypRBaL5eCm0bsdFG XxuJJihFm6SlaW2yJXgNp+mN71fEzONZxlDzhjkW+RWoFoN1BALZtuRQwezqiF5YN0c7J3 p2qy7lnym/4yETIPLHM2f9SonJmJW8BTBStZW1gXs2oowmURh37kRdAyoJe8UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751314835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zWFWPEBj/aExAg/UrEMAp3SKrbL1CRtjMNy/5JjAN8U=; b=XyLqhgIk8hGVe7SMiXSMjKqKU0BFSkpAo0gcV0Uk/N0HGHoOykZh3dZg82JqdN14VZP2k1 AKo1pd5GXJgioyfPCetjAgtu59sX2MwUzUgNVuWyt8xQAwnKLRFGyWngUJTsNUJ3Do+3TI w3/PSwdX5WK45nt+WB3d8JEvaXFADjL0mjiIJ26rehyMSv8lfS4t6xtnc074Ql2nzx0n4E OL/zbQJZ56L6x19zh6ScP0Nao0/1iWChOSshySTM9qjPhnSgriJH5iwDesm4HxCqb9MjiX 7NMWGXrPLBaPu5jyy2gPsMfpnX0Q9zdAjKobp3ngZErno1fNylJzXndgo4MkDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751314835; a=rsa-sha256; cv=none; b=x2jtzIKj0tjBQSIdBc/vb2prtNmlDH5DFG12TfEwYvh/BWflqbjIes5VSQZ5oY6sZ00hzU KF12xtDE0Niqpk11/RyAwMhknJuHV+pe1ILnRJ6sz6ffFmbBgEjCYAAwvYyTI5jGW76FDa t3nUuSUzm/+HmnLou46VjJ8V7J11yjovPMIr6sAlymDbXS6GFClmLcutcqbZRCmDLFB5Eg qabQ34XjaEiZuU0YzZh8kmYWFDVmcEXrp2EnbuOaonIH6vc4L5EqtgDe55FxhT+IgR5Uax kAd0dSJ9PBuw8vvdxVn/8NzEFdBVc8dLbsxSRGGuMahnsrgJOLHCdeZMHnkAow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWHbR3dBMz1JFk; Mon, 30 Jun 2025 20:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UKKZRw052463; Mon, 30 Jun 2025 20:20:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UKKZAc052460; Mon, 30 Jun 2025 20:20:35 GMT (envelope-from git) Date: Mon, 30 Jun 2025 20:20:35 GMT Message-Id: <202506302020.55UKKZAc052460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 039fedc441cc - main - RELNOTES: Add an entry for recent "nocto" changes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 039fedc441cc3e5b4c40d75ca862385a3a6bd926 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=039fedc441cc3e5b4c40d75ca862385a3a6bd926 commit 039fedc441cc3e5b4c40d75ca862385a3a6bd926 Author: Rick Macklem AuthorDate: 2025-06-30 20:17:38 +0000 Commit: Rick Macklem CommitDate: 2025-06-30 20:17:38 +0000 RELNOTES: Add an entry for recent "nocto" changes --- RELNOTES | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RELNOTES b/RELNOTES index 133d68f87df0..4933c8392552 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,15 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +50e733f19b37, 171f66b0c2ca: + These commits helped improve utilization of NFSv4.1/4.2 + delegations. The changes are only used when the NFSv4 + mount uses the "nocto" mount option and requires an + up-to-date NFSv4.1/4.2 server with delegations enabled. + For example: For a FreeBSD kernel build with both src + and obj NFSv4 mounted, the total RPC count dropped from + 5461286 to 945643, with a 20% drop in elapsed time. + cd240957d7ba Making a connection to INADDR_ANY (i.e., using INADDR_ANY as an alias for localhost) is now disabled by default. This functionality can be From nobody Mon Jun 30 23:21:32 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWMcD3sXkz605Ll; Mon, 30 Jun 2025 23:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWMcD3M4pz3lDB; Mon, 30 Jun 2025 23:21:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751325692; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CQkrRXY4djWFT6vlYxcvv3er+5Bh9aO+Ye/AqrTKqgY=; b=sfZypQL9wpcvRYerLrpWR5WyM+Ne1ApqMwISACrdILFzXSZXjK2F6rs+KcHRP5vJ6CKi6I YzAps1VKSyynzFIUQrhhcR6aErmRMXa8LCUyzEeT7jn5s985MzoCfaf/xuZKcXN/v8A9Hq NKHsSKFNI9fHguoTQsmm3zsZ+a9IS3nHKDumIkZS20NaogmqEsZ33CAghHrHsQQi1Nc2go NS4dYaQ5a0W1vpQwIA50GjKAQlw4EXd5jQa3qh5LJzsBTB2A6BHeAy7EdulrsXlxxcE1Ob 0uCh3VdLjfSfL52tHidDbKu1dds+cPADF/Z7Z4cJCnc0UzAanDt1BTZ4fiEHuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751325692; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CQkrRXY4djWFT6vlYxcvv3er+5Bh9aO+Ye/AqrTKqgY=; b=f0G0707iLb/BWref4KLzsaSfzJNaNOugargS0eR0kArDZuuLt4vdP6RmR6gVp1lXG72aR0 MGSfCIQPOkyNgX+TT25ZNkCxKcJcTz4Xc9bl1LmL+I8dfO6i2DXSF7sw4XfSsy2NvMAQrA MeQ8/Cdg7ZHe7Fd8m1t+pNXd2YCde54FXbzhUDsO1DBF8h3uKoKONAy7BKbck3MUG+qsi7 fJbyX2tPJtvN216oNLpc9kn3sOPLbUmGxotrXgf/rbtLmo0L/5flIdataEanecSDmV91EK 1n1HVgfHdxNufnHGfpGUWg4a+ofdrTB884hs2wfr76ggcgbh0hxCEOO+MNml9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751325692; a=rsa-sha256; cv=none; b=Ke5CNN0qqr1IH80lPu2yExRcjiwU+4rmN8a95tqlWMlKL1sLRcgVw6a7ADvDGPl0w1A1UR 9eDIwZiOWWlTHQ17RXcbRPJY3oBOAFkV4SE2o3LdudxXhpv3yQAWMx6MMD5lQ5mAxVlQEo B0UXI+a5O4nn40V//b7/JPSqjjexe0mVNtE+UdWg8FC20fZkOjHr+86qaftcy/S0feX3Mo t11b8/zLbHlJVvtFXUijEk3g69QNudMoBaWpg201sT+KscVc5lf9ixmYrv/ZTbIUocp7VN 9FeF/ZoaJOv2vUUxSwHXPQV26oTtyFXoDr3YvLvyi2woMxDFYfg073dz1rve1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWMcD2xGVz1Nmr; Mon, 30 Jun 2025 23:21:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55UNLWDG098495; Mon, 30 Jun 2025 23:21:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55UNLWme098491; Mon, 30 Jun 2025 23:21:32 GMT (envelope-from git) Date: Mon, 30 Jun 2025 23:21:32 GMT Message-Id: <202506302321.55UNLWme098491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lexi Winter Subject: git: fbaab1373280 - stable/13 - contrib/llvm-project: fix clang crash compiling modules List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fbaab13732809e02dc30e9aef15fac230aed4464 Auto-Submitted: auto-generated The branch stable/13 has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=fbaab13732809e02dc30e9aef15fac230aed4464 commit fbaab13732809e02dc30e9aef15fac230aed4464 Author: Lexi Winter AuthorDate: 2025-06-25 17:12:02 +0000 Commit: Lexi Winter CommitDate: 2025-06-30 22:27:40 +0000 contrib/llvm-project: fix clang crash compiling modules clang++ may crash when compiling certain C++20 modules. Backport the fix from LLVM upstream. This fixes LLVM bug 102684: https://github.com/llvm/llvm-project/issues/102684. PR: 287803 MFC after: 3 days Obtained from: https://github.com/llvm/llvm-project/pull/102855 Reviewed by: kevans, dim Approved by: kevans (mentor) Differential Revision: https://reviews.freebsd.org/D51041 (cherry picked from commit 55dfaeae8e9aa95f0b724d90ad2423ca1b623142) --- .../include/clang/Frontend/MultiplexConsumer.h | 1 + .../Serialization/ASTDeserializationListener.h | 2 + .../clang/include/clang/Serialization/ASTReader.h | 3 + .../clang/include/clang/Serialization/ASTWriter.h | 1 + .../clang/lib/Frontend/MultiplexConsumer.cpp | 5 ++ .../clang/lib/Serialization/ASTReader.cpp | 91 +++++++++++++++++----- .../clang/lib/Serialization/ASTWriter.cpp | 6 ++ 7 files changed, 91 insertions(+), 18 deletions(-) diff --git a/contrib/llvm-project/clang/include/clang/Frontend/MultiplexConsumer.h b/contrib/llvm-project/clang/include/clang/Frontend/MultiplexConsumer.h index e49e3392d1f3..3a7670d7a51a 100644 --- a/contrib/llvm-project/clang/include/clang/Frontend/MultiplexConsumer.h +++ b/contrib/llvm-project/clang/include/clang/Frontend/MultiplexConsumer.h @@ -36,6 +36,7 @@ public: void MacroRead(serialization::MacroID ID, MacroInfo *MI) override; void TypeRead(serialization::TypeIdx Idx, QualType T) override; void DeclRead(GlobalDeclID ID, const Decl *D) override; + void PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) override; void SelectorRead(serialization::SelectorID iD, Selector Sel) override; void MacroDefinitionRead(serialization::PreprocessedEntityID, MacroDefinitionRecord *MD) override; diff --git a/contrib/llvm-project/clang/include/clang/Serialization/ASTDeserializationListener.h b/contrib/llvm-project/clang/include/clang/Serialization/ASTDeserializationListener.h index 1d81a9ae3fe2..ea96faa07c19 100644 --- a/contrib/llvm-project/clang/include/clang/Serialization/ASTDeserializationListener.h +++ b/contrib/llvm-project/clang/include/clang/Serialization/ASTDeserializationListener.h @@ -45,6 +45,8 @@ public: virtual void TypeRead(serialization::TypeIdx Idx, QualType T) { } /// A decl was deserialized from the AST file. virtual void DeclRead(GlobalDeclID ID, const Decl *D) {} + /// A predefined decl was built during the serialization. + virtual void PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) {} /// A selector was read from the AST file. virtual void SelectorRead(serialization::SelectorID iD, Selector Sel) {} /// A macro definition was read from the AST file. diff --git a/contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h b/contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h index 671520a3602b..82f32e843d63 100644 --- a/contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h +++ b/contrib/llvm-project/clang/include/clang/Serialization/ASTReader.h @@ -1541,6 +1541,9 @@ private: std::pair translateTypeIDToIndex(serialization::TypeID ID) const; + /// Get a predefined Decl from ASTContext. + Decl *getPredefinedDecl(PredefinedDeclIDs ID); + public: /// Load the AST file and validate its contents against the given /// Preprocessor. diff --git a/contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h b/contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h index 700f0ad00111..10a50b711043 100644 --- a/contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h +++ b/contrib/llvm-project/clang/include/clang/Serialization/ASTWriter.h @@ -869,6 +869,7 @@ private: void IdentifierRead(serialization::IdentifierID ID, IdentifierInfo *II) override; void MacroRead(serialization::MacroID ID, MacroInfo *MI) override; void TypeRead(serialization::TypeIdx Idx, QualType T) override; + void PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) override; void SelectorRead(serialization::SelectorID ID, Selector Sel) override; void MacroDefinitionRead(serialization::PreprocessedEntityID ID, MacroDefinitionRecord *MD) override; diff --git a/contrib/llvm-project/clang/lib/Frontend/MultiplexConsumer.cpp b/contrib/llvm-project/clang/lib/Frontend/MultiplexConsumer.cpp index 651c55aeed54..2158d176d189 100644 --- a/contrib/llvm-project/clang/lib/Frontend/MultiplexConsumer.cpp +++ b/contrib/llvm-project/clang/lib/Frontend/MultiplexConsumer.cpp @@ -58,6 +58,11 @@ void MultiplexASTDeserializationListener::DeclRead(GlobalDeclID ID, Listeners[i]->DeclRead(ID, D); } +void MultiplexASTDeserializationListener::PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) { + for (size_t i = 0, e = Listeners.size(); i != e; ++i) + Listeners[i]->PredefinedDeclBuilt(ID, D); +} + void MultiplexASTDeserializationListener::SelectorRead( serialization::SelectorID ID, Selector Sel) { for (size_t i = 0, e = Listeners.size(); i != e; ++i) diff --git a/contrib/llvm-project/clang/lib/Serialization/ASTReader.cpp b/contrib/llvm-project/clang/lib/Serialization/ASTReader.cpp index 29aec144aec1..2d8f5a801f0e 100644 --- a/contrib/llvm-project/clang/lib/Serialization/ASTReader.cpp +++ b/contrib/llvm-project/clang/lib/Serialization/ASTReader.cpp @@ -7741,7 +7741,10 @@ SourceLocation ASTReader::getSourceLocationForDeclID(GlobalDeclID ID) { return Loc; } -static Decl *getPredefinedDecl(ASTContext &Context, PredefinedDeclIDs ID) { +Decl *ASTReader::getPredefinedDecl(PredefinedDeclIDs ID) { + assert(ContextObj && "reading predefined decl without AST context"); + ASTContext &Context = *ContextObj; + Decl *NewLoaded = nullptr; switch (ID) { case PREDEF_DECL_NULL_ID: return nullptr; @@ -7750,54 +7753,106 @@ static Decl *getPredefinedDecl(ASTContext &Context, PredefinedDeclIDs ID) { return Context.getTranslationUnitDecl(); case PREDEF_DECL_OBJC_ID_ID: - return Context.getObjCIdDecl(); + if (Context.ObjCIdDecl) + return Context.ObjCIdDecl; + NewLoaded = Context.getObjCIdDecl(); + break; case PREDEF_DECL_OBJC_SEL_ID: - return Context.getObjCSelDecl(); + if (Context.ObjCSelDecl) + return Context.ObjCSelDecl; + NewLoaded = Context.getObjCSelDecl(); + break; case PREDEF_DECL_OBJC_CLASS_ID: - return Context.getObjCClassDecl(); + if (Context.ObjCClassDecl) + return Context.ObjCClassDecl; + NewLoaded = Context.getObjCClassDecl(); + break; case PREDEF_DECL_OBJC_PROTOCOL_ID: - return Context.getObjCProtocolDecl(); + if (Context.ObjCProtocolClassDecl) + return Context.ObjCProtocolClassDecl; + NewLoaded = Context.getObjCProtocolDecl(); + break; case PREDEF_DECL_INT_128_ID: - return Context.getInt128Decl(); + if (Context.Int128Decl) + return Context.Int128Decl; + NewLoaded = Context.getInt128Decl(); + break; case PREDEF_DECL_UNSIGNED_INT_128_ID: - return Context.getUInt128Decl(); + if (Context.UInt128Decl) + return Context.UInt128Decl; + NewLoaded = Context.getUInt128Decl(); + break; case PREDEF_DECL_OBJC_INSTANCETYPE_ID: - return Context.getObjCInstanceTypeDecl(); + if (Context.ObjCInstanceTypeDecl) + return Context.ObjCInstanceTypeDecl; + NewLoaded = Context.getObjCInstanceTypeDecl(); + break; case PREDEF_DECL_BUILTIN_VA_LIST_ID: - return Context.getBuiltinVaListDecl(); + if (Context.BuiltinVaListDecl) + return Context.BuiltinVaListDecl; + NewLoaded = Context.getBuiltinVaListDecl(); + break; case PREDEF_DECL_VA_LIST_TAG: - return Context.getVaListTagDecl(); + if (Context.VaListTagDecl) + return Context.VaListTagDecl; + NewLoaded = Context.getVaListTagDecl(); + break; case PREDEF_DECL_BUILTIN_MS_VA_LIST_ID: - return Context.getBuiltinMSVaListDecl(); + if (Context.BuiltinMSVaListDecl) + return Context.BuiltinMSVaListDecl; + NewLoaded = Context.getBuiltinMSVaListDecl(); + break; case PREDEF_DECL_BUILTIN_MS_GUID_ID: + // ASTContext::getMSGuidTagDecl won't create MSGuidTagDecl conditionally. return Context.getMSGuidTagDecl(); case PREDEF_DECL_EXTERN_C_CONTEXT_ID: - return Context.getExternCContextDecl(); + if (Context.ExternCContext) + return Context.ExternCContext; + NewLoaded = Context.getExternCContextDecl(); + break; case PREDEF_DECL_MAKE_INTEGER_SEQ_ID: - return Context.getMakeIntegerSeqDecl(); + if (Context.MakeIntegerSeqDecl) + return Context.MakeIntegerSeqDecl; + NewLoaded = Context.getMakeIntegerSeqDecl(); + break; case PREDEF_DECL_CF_CONSTANT_STRING_ID: - return Context.getCFConstantStringDecl(); + if (Context.CFConstantStringTypeDecl) + return Context.CFConstantStringTypeDecl; + NewLoaded = Context.getCFConstantStringDecl(); + break; case PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID: - return Context.getCFConstantStringTagDecl(); + if (Context.CFConstantStringTagDecl) + return Context.CFConstantStringTagDecl; + NewLoaded = Context.getCFConstantStringTagDecl(); + break; case PREDEF_DECL_TYPE_PACK_ELEMENT_ID: - return Context.getTypePackElementDecl(); + if (Context.TypePackElementDecl) + return Context.TypePackElementDecl; + NewLoaded = Context.getTypePackElementDecl(); + break; } - llvm_unreachable("PredefinedDeclIDs unknown enum value"); + + assert(NewLoaded && "Failed to load predefined decl?"); + + if (DeserializationListener) + DeserializationListener->PredefinedDeclBuilt(ID, NewLoaded); + + return NewLoaded; } unsigned ASTReader::translateGlobalDeclIDToIndex(GlobalDeclID GlobalID) const { @@ -7814,7 +7869,7 @@ Decl *ASTReader::GetExistingDecl(GlobalDeclID ID) { assert(ContextObj && "reading decl with no AST context"); if (ID < NUM_PREDEF_DECL_IDS) { - Decl *D = getPredefinedDecl(*ContextObj, (PredefinedDeclIDs)ID); + Decl *D = getPredefinedDecl((PredefinedDeclIDs)ID); if (D) { // Track that we have merged the declaration with ID \p ID into the // pre-existing predefined declaration \p D. diff --git a/contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp b/contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp index cb63dec92e33..e907ddb88949 100644 --- a/contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp +++ b/contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp @@ -6757,6 +6757,12 @@ void ASTWriter::TypeRead(TypeIdx Idx, QualType T) { StoredIdx = Idx; } +void ASTWriter::PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) { + assert(D->isCanonicalDecl() && "predefined decl is not canonical"); + DeclIDs[D] = LocalDeclID(ID); + PredefinedDecls.insert(D); +} + void ASTWriter::SelectorRead(SelectorID ID, Selector S) { // Always keep the highest ID. See \p TypeRead() for more information. SelectorID &StoredID = SelectorIDs[S]; From nobody Tue Jul 1 07:02:57 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWYrf1lddz60WZS; Tue, 01 Jul 2025 07:02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWYrd4B1Pz443n; Tue, 01 Jul 2025 07:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751353377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V0mJ8IEcHRvVEwfg9Rvsuu2xy4/woo5+ZDq1Ah4wZQg=; b=iYvme0sDQo9XFxwml3ayHzeuv2qawdwQinlteK2K8F9cbae0oBp3/Wjy8rSyyZjfRNpog2 eh0mDUtkt+R3owiP4RUXARujGMBRfD7vic5T9zHkuDVRqTF8gL2IigkODd1uOqIfcYGEyw P/hFgi5WraeJh0ohZvRQcJpiLwqKq6wslFndccf3fmbpC/rIKOJ26JUPWEFSD0830NKm7T 4Cu4GaARFlcgHRdovCsXwJZimAkpNzUyTFhKRK4cQcHKDZ23NSygzLnQeU1njZYiFQSzVL 8fJ1eFy7tnt6nui+ob2T9iNyqw3tHlEx1H+lIgA3dEcZpihp391tnd6zjIg/xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751353377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V0mJ8IEcHRvVEwfg9Rvsuu2xy4/woo5+ZDq1Ah4wZQg=; b=NzU2axnRw7ZkvP+uquvtV1MQudhBLDJIj57eAJx3kgzhe1wrU4owZRt/hqIATB1KNmOmur ON28ChhyYImUhq8XoofemzmgquJEbfHOjTfHggH0EwDIm8HuQghRLETU0vLsrzt1mLY0H6 VDspTSx1E/msFM5exSblZ6qBg4kExg7lQu3QDOOiVxoVeLnQCfMdSQ+gyPP0CqL1aaW7Gu /JiSoGMQTNxC9b5U3Z9OGzMVNdNuDNTY6zw2COQhDgvbXg56g0OiNl22XeZpwvr7KCk7LA porsj4UHeicSmW0Gbbi7r3xjaZJVmUe2NPUq2nzfynxQ8L0FYSSMHgHKTARIGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751353377; a=rsa-sha256; cv=none; b=VcHUZhPFTFAMUbyUumbrOtaJcQLfmSWKkvfSwL3QLCsHTkD6BYP78Sa+t4RSLmYz4gh4/2 UsHeMb+FAk2BqXM6niKG8QVLdyyNj0XBibOm6RdOnrfz6LePMp0hIgSA3x3Ve1KxnEiZWz p8VQ2TfZ4WQye4cts+/hirMGCA/H6bHJZXrm3db/2RCoMv4Tlff8V4MaYDCjduX5ofc9Lh Kv+quMkj0ziLqPgPltipQztZTkSGUcq4jdteyihPwDyKMC0Dwpy4qht7mpjW4D46IMpj+G hgyJKziKiUG1TDVezRGqJBP18nErj29P0ut2vy9HGm2Lce098GAKXPUV+gzPDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWYrd3ktBz8Xp; Tue, 01 Jul 2025 07:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56172vaJ066865; Tue, 1 Jul 2025 07:02:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56172vSx066862; Tue, 1 Jul 2025 07:02:57 GMT (envelope-from git) Date: Tue, 1 Jul 2025 07:02:57 GMT Message-Id: <202507010702.56172vSx066862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: e0f7e7324884 - main - tcp: remove an invalid KASSERT List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0f7e732488476dc02ec771a5831715fbd7ca51a Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=e0f7e732488476dc02ec771a5831715fbd7ca51a commit e0f7e732488476dc02ec771a5831715fbd7ca51a Author: Michael Tuexen AuthorDate: 2025-07-01 07:00:24 +0000 Commit: Michael Tuexen CommitDate: 2025-07-01 07:00:24 +0000 tcp: remove an invalid KASSERT Since TCP endpoints in the TIME-WAIT state are no longer special, allow them to be switched over to the default stack. Reported by: syzbot+902d31bb0e68a1e8c088@syzkaller.appspotmail.com Reviewed by: cc MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D51090 --- sys/netinet/tcp_subr.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index bbcd20b715ba..cd42a67294a6 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1032,10 +1032,6 @@ tcp_default_fb_init(struct tcpcb *tp, void **ptr) /* We don't use the pointer */ *ptr = NULL; - KASSERT(tp->t_state < TCPS_TIME_WAIT, - ("%s: connection %p in unexpected state %d", __func__, tp, - tp->t_state)); - /* Make sure we get no interesting mbuf queuing behavior */ /* All mbuf queue/ack compress flags should be off */ tcp_lro_features_off(tp); From nobody Tue Jul 1 10:07:03 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWdx410Mjz60gcC; Tue, 01 Jul 2025 10:07: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWdx35mprz3wQH; Tue, 01 Jul 2025 10:07:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751364423; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IdytzxlOh9/ruwy2LJpomJzgHfbwVW+bYvD6z4eKSoc=; b=ekY3xUqUL94VnhGJrmNVwEYYgbC4muPVKo2U+bylumu2liX6QYReUWXEPd8MV8qvhg68pc Gw0ufrST58cLOm49kGLRPHSyI3ICM6SXLQ2h1C/kJmf2wLDpMN298w4jLuuaGbntVM+beH HVv7IzeaRtlX0rQ5/r6gSjUUXvCVffkyo0sWzcR+L0bbEwgIIDv5ecBVZ4h1s6HkShPdPr Dl6pV224Y79wzYQwiZK+oFWIDXm2obGf5pJpZQ6ltkvXO7Oiz7pbpZJ/M5LE1zbsDjWnsx IXmJkdlSLieRy81QstJD/rX8aSxSfylKpwcLCuYTNhdTXHvmoHtOsd/NxnsRyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751364423; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IdytzxlOh9/ruwy2LJpomJzgHfbwVW+bYvD6z4eKSoc=; b=cRhJmj7bGzp/oGlHnSVYHIaPVPnYEaJzG7Pax2brj82+UGqpX088gr992P69Iv1M0NeFQn WLbO1HqOI0P8fvjDfMX+3o69gVAoet4Ll7uErxUv4WmCQSH8FM42oyJMfSz6zX/OhUkNFz vzYyXSR+EF5a4JEkoPG4W/WBLh7aGQAF9aB20epqb6EGOK+rMSLAcLUKp8pGyrYiZ2Otzh LHOUwZKw6Da+ei7BcFSeYFwIGS5VW4pTtikXzd7riXQkk2KWKl2PVARTbi0D5FLGyd1eCo tzMphziWEngOX718+7FMQin34qU2q63l3ygEhXxUrAJveBbdYzqi9ENvIyGoxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751364423; a=rsa-sha256; cv=none; b=v2CJjokXq9exlgEOIBnietnOgTet+7WFu+rEjjSIx1nQcCxeiNYHE1EPUT21oGo5XHYxJQ agdpYXGI3f58bf1ZQ0mtr2GWNo9bwDbJhuHoPxCkq4EbzKRDE3PYGtFUX71t1R+OdZV+IO H+NdPioHwQPWZSaaE1bYrfedTO5KmHZcNCQkEWA4bUpkaAamF9NVaNKl/kDseP8Idf4z4q eHGEjP/xdgJxRS6wTW96lyXypAGi9O8w2ZeOP86waXdkXcdXfD5rR7ry0N3TvslqkUF+T+ w/SfZP6vkLzJFpjyi2Elwha/6XdtUuWZOC72mDxYHoGtUtfO6RtDT0bsVNW+/g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWdx35DNSzTkw; Tue, 01 Jul 2025 10:07:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 561A73fd005496; Tue, 1 Jul 2025 10:07:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 561A733d005493; Tue, 1 Jul 2025 10:07:03 GMT (envelope-from git) Date: Tue, 1 Jul 2025 10:07:03 GMT Message-Id: <202507011007.561A733d005493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ronald Klop Subject: git: 83b08f402641 - main - fix parallel execution of swapon tests List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ronald X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83b08f40264177ecf03fce808474815816f9846f Auto-Submitted: auto-generated The branch main has been updated by ronald: URL: https://cgit.FreeBSD.org/src/commit/?id=83b08f40264177ecf03fce808474815816f9846f commit 83b08f40264177ecf03fce808474815816f9846f Author: Siva Mahadevan AuthorDate: 2025-07-01 09:57:29 +0000 Commit: Ronald Klop CommitDate: 2025-07-01 10:06:27 +0000 fix parallel execution of swapon tests And apparantly the CI env already has an md device so be relaxed about which md device is added. PR: 186252 Reported by: markj Fixes: 1ee33e3a578c35ff0e8ef5db87a8005f1f99546a "swapon: parse md.eli device for encrypted swapfile from fstab" Pull Request: https://github.com/freebsd/freebsd-src/pull/1747 --- sbin/swapon/tests/swapon_test.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sbin/swapon/tests/swapon_test.sh b/sbin/swapon/tests/swapon_test.sh index 3c4286cd6815..b6d31ecaeed0 100755 --- a/sbin/swapon/tests/swapon_test.sh +++ b/sbin/swapon/tests/swapon_test.sh @@ -32,8 +32,8 @@ attach_mdX_body() { # if the swapfile is too small (like 1k) then mdconfig hangs looking up the md atf_check -s exit:0 -x "truncate -s 10k swapfile" - atf_check -s exit:0 -o save:fstab.out -x "echo 'md3 none swap sw,file=swapfile 0 0'" - atf_check -s exit:0 -o match:"swapon: adding /dev/md3 as swap device" -x "swapon -F fstab.out -a" + atf_check -s exit:0 -o save:fstab.out -x "echo 'md31 none swap sw,file=swapfile 0 0'" + atf_check -s exit:0 -o match:"swapon: adding /dev/md31 as swap device" -x "swapon -F fstab.out -a" } attach_mdX_cleanup() { @@ -50,8 +50,8 @@ attach_dev_mdX_body() { # if the swapfile is too small (like 1k) then mdconfig hangs looking up the md atf_check -s exit:0 -x "truncate -s 10k swapfile" - atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md3 none swap sw,file=swapfile 0 0'" - atf_check -s exit:0 -o match:"swapon: adding /dev/md3 as swap device" -x "swapon -F fstab.out -a" + atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md32 none swap sw,file=swapfile 0 0'" + atf_check -s exit:0 -o match:"swapon: adding /dev/md32 as swap device" -x "swapon -F fstab.out -a" } attach_dev_mdX_cleanup() { @@ -62,14 +62,14 @@ attach_dev_mdX_cleanup() atf_test_case attach_md cleanup attach_md_head() { - atf_set "descr" "mdX device should attach" + atf_set "descr" "md device should attach" } attach_md_body() { # if the swapfile is too small (like 1k) then mdconfig hangs looking up the md atf_check -s exit:0 -x "truncate -s 10k swapfile" atf_check -s exit:0 -o save:fstab.out -x "echo 'md none swap sw,file=swapfile 0 0'" - atf_check -s exit:0 -o match:"swapon: adding /dev/md0 as swap device" -x "swapon -F fstab.out -a" + atf_check -s exit:0 -o match:"swapon: adding /dev/md[0-9][0-9]* as swap device" -x "swapon -F fstab.out -a" } attach_md_cleanup() { @@ -87,7 +87,7 @@ attach_dev_md_body() # if the swapfile is too small (like 1k) then mdconfig hangs looking up the md atf_check -s exit:0 -x "truncate -s 10k swapfile" atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md none swap sw,file=swapfile 0 0'" - atf_check -s exit:0 -o match:"swapon: adding /dev/md0 as swap device" -x "swapon -F fstab.out -a" + atf_check -s exit:0 -o match:"swapon: adding /dev/md[0-9][0-9]* as swap device" -x "swapon -F fstab.out -a" } attach_dev_md_cleanup() { @@ -104,8 +104,8 @@ attach_mdX_eli_body() { # if the swapfile is too small (like 1k) then mdconfig hangs looking up the md atf_check -s exit:0 -x "truncate -s 10k swapfile" - atf_check -s exit:0 -o save:fstab.out -x "echo 'md3.eli none swap sw,file=swapfile 0 0'" - atf_check -s exit:0 -o match:"swapon: adding /dev/md3.eli as swap device" -x "swapon -F fstab.out -a" + atf_check -s exit:0 -o save:fstab.out -x "echo 'md33.eli none swap sw,file=swapfile 0 0'" + atf_check -s exit:0 -o match:"swapon: adding /dev/md33.eli as swap device" -x "swapon -F fstab.out -a" } attach_mdX_eli_cleanup() { @@ -122,8 +122,8 @@ attach_dev_mdX_eli_body() { # if the swapfile is too small (like 1k) then mdconfig hangs looking up the md atf_check -s exit:0 -x "truncate -s 10k swapfile" - atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md3.eli none swap sw,file=swapfile 0 0'" - atf_check -s exit:0 -o match:"swapon: adding /dev/md3.eli as swap device" -x "swapon -F fstab.out -a" + atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md34.eli none swap sw,file=swapfile 0 0'" + atf_check -s exit:0 -o match:"swapon: adding /dev/md34.eli as swap device" -x "swapon -F fstab.out -a" } attach_dev_mdX_eli_cleanup() { @@ -141,7 +141,7 @@ attach_md_eli_body() # if the swapfile is too small (like 1k) then mdconfig hangs looking up the md atf_check -s exit:0 -x "truncate -s 10k swapfile" atf_check -s exit:0 -o save:fstab.out -x "echo 'md.eli none swap sw,file=swapfile 0 0'" - atf_check -s exit:0 -o match:"swapon: adding /dev/md0.eli as swap device" -x "swapon -F fstab.out -a" + atf_check -s exit:0 -o match:"swapon: adding /dev/md[0-9][0-9]*.eli as swap device" -x "swapon -F fstab.out -a" } attach_md_eli_cleanup() { @@ -159,7 +159,7 @@ attach_dev_md_eli_body() # if the swapfile is too small (like 1k) then mdconfig hangs looking up the md atf_check -s exit:0 -x "truncate -s 10k swapfile" atf_check -s exit:0 -o save:fstab.out -x "echo '/dev/md.eli none swap sw,file=swapfile 0 0'" - atf_check -s exit:0 -o match:"swapon: adding /dev/md0.eli as swap device" -x "swapon -F fstab.out -a" + atf_check -s exit:0 -o match:"swapon: adding /dev/md[0-9][0-9]*.eli as swap device" -x "swapon -F fstab.out -a" } attach_dev_md_eli_cleanup() { From nobody Tue Jul 1 12:29:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWj5v4t8Zz60LS5; Tue, 01 Jul 2025 12:29: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWj5v1G87z3wB1; Tue, 01 Jul 2025 12:29:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751372995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UP0tmPYGu0fZMuLVeALqeJ3snRZPplVNLxkF4nENf5U=; b=jhpT/MIUDWrD95kla3WmM5kgdEt4hyPFrom0qwWISw3PaVypICaGR7HIqLE7FNbTTaeZ06 Ln/KEZ8XFzmTlHAGtBFQkS5AdtgeB8s5vDd9eteVQJdi+5IHheyz8SwzGwZyHzj9j4rjzH 024vc/VD77E6w6zvejoo/LWaadlLwSGtW7MCGtbUtPv4OFTl7IgiIdXwAYPOkzj6VPCQ7/ uA6s93+uLoCfIvngS/dYFDmrdFXQt06an6+fl0pBBCNvmbimjv45rmdhqbeFJImpiVvOCL kJpRzg6Ge04WsvdArbU4ac5nuS+2YjK2igrd02ydneaPaSql8Fp8klep3y8UJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751372995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UP0tmPYGu0fZMuLVeALqeJ3snRZPplVNLxkF4nENf5U=; b=On6kwCJ8hspx03g2KhQyPXzvU9Xzj+P4Op55GvuUEuSyfMkWuOD57Q6lBLuj4E4VgotPGW 8y5qPGATsyo9vEE5a61Ppxa2bDlq/3oE50TbZ4k/Dq8ZIxesGiy3gkJ+w49jUQeUbNnGT6 objsC8FFEd8ue1XOh91KgHMTRwKJ/oN3aAfjp9uAHDqc41edg4Vxd2YFBdC0zPd7tjLxjP pzBWiXst2nuDK6Zrd7vEvo6MvIKCBw7dwa5G7Ooe+nM7fxLOdUmUQUYIjyiyiIzDfbngB3 dY/50pixR2arBtQaa4PVPGsFuJXHuZH11rX4gPYpafqRThxfwx0B/hTDPvT4Vg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751372995; a=rsa-sha256; cv=none; b=eUknzMy3VtFom2I6ltT9MHXgQzdAaRC21J6X02SLorO+fQEgXqRVsG0qltmAq0iwlPMRhO Nu9ptHZ7QrcY77GGmaOwRexYLNsSmmxuUr4ebCmi5RycV+eiuhB+74byZYOFsgvR3s2JA0 yUDueDhIDmjhVHVYJ1g5kYFBIQHk2MWOjCwNr2M+rBJnGUpxvVuqJMzm8wclKfGoT0Zsas P2bZ32Pak+3pNfweY6wSaHzfuIebqyLF5+w/WKcsV9keXPQpb+PFNq1+ydOzMxdqLXjlXd bQ5/7UzgSNxvzZkUBml7xYbQapra6bsneLv1TLuiAKzdDzxwctjfgfSMCOkEHA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWj5v0N76zbDs; Tue, 01 Jul 2025 12:29:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 561CTspJ068812; Tue, 1 Jul 2025 12:29:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 561CTs2F068809; Tue, 1 Jul 2025 12:29:54 GMT (envelope-from git) Date: Tue, 1 Jul 2025 12:29:54 GMT Message-Id: <202507011229.561CTs2F068809@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 5d0cf80f4501 - main - Makefile.inc1: Always have which succeed List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d0cf80f4501fb297bc546b624a0e527040a1843 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5d0cf80f4501fb297bc546b624a0e527040a1843 commit 5d0cf80f4501fb297bc546b624a0e527040a1843 Author: Andrew Turner AuthorDate: 2025-06-28 01:55:41 +0000 Commit: Andrew Turner CommitDate: 2025-06-28 01:55:59 +0000 Makefile.inc1: Always have which succeed In bootstrap-tools we search for some tools to copy into the obj tree. If the tool is missing in the host environment then the '[ ! -e ... ]' check will fail as which will print ' not found'. There is an issue that which will also return an error so we never get to the check and don't print the error message. As which outputs an invalid path on failure we can just add || true to ensure make continues. Reviewed by: kevans Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D51075 --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index e7b1a2d7acb9..d366be09f497 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2758,7 +2758,7 @@ ${_bt}-links: .PHONY .for _tool in ${_bootstrap_tools_links} ${_bt}-link-${_tool}: .PHONY @rm -f "${WORLDTMP}/legacy/bin/${_tool}"; \ - source_path=`which ${_tool}`; \ + source_path=`which ${_tool} || true`; \ if [ ! -e "$${source_path}" ] ; then \ echo "Cannot find host tool '${_tool}'"; false; \ fi; \ From nobody Tue Jul 1 13:18:28 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWkB063ysz60NXc; Tue, 01 Jul 2025 13:18:32 +0000 (UTC) (envelope-from avg@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWkB04Gyrz4M8b; Tue, 01 Jul 2025 13:18:32 +0000 (UTC) (envelope-from avg@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751375912; 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:autocrypt:autocrypt; bh=KQjZo7m/Fboka2h/Cm6t4xKsS0+nhrdwVFzIoN7cT/A=; b=ScHz8Ek64oNux7fudojHZXXTFusQcwCZxCRRmgI3XHjEh6jfFH8Ms52amchJx44DWjT/Ap +nyqGcHQst0jM8HP6yc5K70lNMMSwAIcIHX/IH2GKM5XfkSc5Pgpw9I5wedpL7Ak4WpW7D jEs7kIaDo2Nm2GD/GCoNJ1Ns2x5rZqDUd5EkCeGqRdGPQ6aMVt/2uUj+KolzJSIGTkN7rQ 3dLEmJDcXBM8Ke7rQOBVFkQN1IJoaemy57RzENTDlykN0FSNV+MqXw+Kzm/KjlGRbM8XkP JkcW+FwHjxgMF5TwNhW/MpqFMY4AZcbgGOJ+3fQOY6V5UaGASDUPKh2q9Ah38w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751375912; 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:autocrypt:autocrypt; bh=KQjZo7m/Fboka2h/Cm6t4xKsS0+nhrdwVFzIoN7cT/A=; b=SZFps3CLQx46gLfRAg5FB3GYKT7yMx1YnRNHMpU1J9/5RelTO/t5VPoOMktKJPGobyLW2i aDyG26d8GAqyKvxoDQz0zhwKx3IHAZFeCQcpOQuk8gFzY70hLjN3DM0nqm4MJPVF5VnIfY SqnoO852nEgVM1Iqi743WKXGellzDo1E4DsS4rEAfEIrg4eW32pM50NcRqpTno883FPFUR rxTyg4BaRnt7kwaTHuFaO2RoKUvTLJmeZ/O5Emr1Ik80CDQYa9dmbROyNIEjNxKgv2AAMD pMogtxj9Ue7xaibC7fuIhzyxsW04q998a73jzrXf2hlnfIdupa25oMgz6oAJMA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751375912; a=rsa-sha256; cv=none; b=k53l1JgaLaY24qFwntafjxVijzbpU3ZLLlGvzt5HwSiq2VkT82FRt609hALxX9PjYVYDXy SP/Do8JDzXjdM8k6me0a1G8o6oTjfUdMDLtdqqzqQaeMzyOdTQMa5ZdX82uN62SqGz1ETr 33+L/DahtZdrkankAT5AAXGQ5iGsY0FZjS7KJ8DD+jit1eztoJiKZtsFHExo8EbEhwirMl GFHRUp5RPrmmUePESUlwBDpF20sCSjq2/abKJ2KfJ4ZDzG+9mTCpPtVFiNQmGC7eS1M4mJ sRr86xVVeiVffolkAdG62Iv/ysLFUzM5jXCwt46pcj+MNLM1G9hLAYf9SWXbeg== Received: from [192.168.0.88] (unknown [93.188.39.137]) (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: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4bWk9z5bBgz1Cd4; Tue, 01 Jul 2025 13:18:31 +0000 (UTC) (envelope-from avg@freebsd.org) Message-ID: <04134894-a3a4-43b1-ab92-f8947e046d30@freebsd.org> Date: Tue, 1 Jul 2025 16:18:28 +0300 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Andriy Gapon Subject: Re: git: ad8d33679999 - main - mmc_xpt: use strlcpy instead of strncpy To: Warner Losh Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202506270721.55R7LlB1067221@gitrepo.freebsd.org> <69858708-8e73-4b70-9f33-5176fceb1b36@FreeBSD.org> <89e23d9e-885c-4811-886a-6c1011715679@FreeBSD.org> Content-Language: en-US Autocrypt: addr=avg@freebsd.org; keydata= xsDNBGcKrHEBDADRvwQOK0b/yo4ys5cs6bOQMhEh4xtfbaZ/CU00cpPgUip3sOZCdrtMWlRC g25z97prxE9pKueZi+HXDhIPpa9xl14ghqF4oYScuJ1i18HyiOH2y5Q3Vv/TtFiSzicd3EAu QgS3jVidpgDSPDdj2Yz3UxYpZ+PuFl6nOnvCvqOFcjUlzKCyPaiN2b86l1Nscmhnc+zQ/faB erUOEFEDQbWMA5YfXi8HrbeR16hfRfGt7E0aMDlIj9FIPIq71UWMN9CimPgs4+rbNr1MAlLa z4GxSDhVYZEY5rqtCzr+PLXboRQWnaUwXl0/biw9enf17NHdYv1SNAFTX2eC4dZ3qBVI74dS PgNprm+PMfz+6Hhs/dAv+Nan5nVhg3EFIjYTiy0MnjMSq8uI0v0ykpAGAcJJ5xl6d23aLxgN 6f0z6pJRCO0hGPgU7UzvFD0MxJxmbzqdT1R51KDan1oD41b+tjl2LMBuCDCoB0U44Pu0zLdp xMfFTxCXtwIYKIUxwd28jwMAEQEAAc0eQW5kcml5IEdhcG9uIDxhdmdARnJlZUJTRC5vcmc+ wsENBBMBCAA3FiEEmXvSmjiQFHPVOpLnzDOt5NLj67sFAmcKrHEFCQeEzgACGwMECwkIBwUV CAkKCwUWAgMBAAAKCRDMM63k0uPru5tSDACFK15LLbq89RSQ6QMnjiIm1t/wYJyumb519MHu Dhzxx1lbr8oghf0RHtF6kYRLQPaW2VdToi74pRobd3CN4bhZKDLSL6WfTn17RfavDjL6Njwp KBo30CkOeYKWq1mDmo0xEoQj8cc7ybEZnus+YScZOpj8Ti4EFwhRt6SHer7YDb161IHKL8m4 MsCxpFSGEjbKj8Iul3Ri/fTOO8w14ivcuEEQIvJt4/+4YV5Az8G23wKzL/3aJ7SOT3oYGmR9 atBTmVO3DlODjM+rZLegd8SfLSPTcBTHspWE5duemIzZbEX3BP77r3Qx4Fo5Tkit3bG1XVar yPQato+sFGFEGifdE9USBQoAoOaaeZevwAWjDU0TIuCT0CUe0sKtQuNP4LRq0n9EEHOXBu9a CfdMhFUSkAZnuE7miSVwgPvoVNJ1stA37EXLN/sVsWik7wslTQ5vF81VpdGFiwoQPOe2XEKh ogcwGSnXbwv1gD4x+Gz/7Y+kFyr1NY+4/nSaeXVcS2fOwM0EZwqscgEMAMQTe6ypAmQe/TFO HqKD2hfFKdksTptKi6uEh8xIwct8G/0FBldDWXo9eu8CGr/ZrDg0/bAwJxbaLRQCMH19Gq2Y hLvZ1QK5GQJVzZKcqfxbF2LiDUTs6WkdOBIhGpdDy7p1xFrvqCGCtNFYHuGYm067EozibBSF BWAPstKu2FQuVHZNMOfs7p3OIz3Yfqu9woXDeg3/8G2qVQJINe+8EwXKlhgh4CyDbq7nAZoA kIu1SE9z9u3WI5mcNy/0dFmVUsFxBqRC3ewbvzie8tKyZ9yFOlaZPT0Y4nRBXQTI3mLZ8zQ8 mtrWK5OOmrJ02kdeO9RBXe+OMaUUWMf92ZIoBFb4HP6N+B+4N1y1OwULousfl7JRoYxA4MRL ls7E2sSoJvrEBTJB3Pc34xu8rsJ1A5V3NgN6djX8yEZYpTRkcmrBeWy/ofDqZPVqneAx0LRm eldDS9msXDW4KXODyPZ+9unvmHAcoH0xaBYaSH44CDZDQDg4LNcmbOvuu1TEXBJhjQARAQAB wsD8BBgBCAAmFiEEmXvSmjiQFHPVOpLnzDOt5NLj67sFAmcKrHMFCQeEzgACGwwACgkQzDOt 5NLj67sUCAv5AXqgWnYN9EblapMbZjkiqL8pZQ0GNqh+Pg9FwbyULxjtRTO6rD4D0IxizByb ef+neeUNyYlagt5nfKMysEr0SU/gHKCi8vyTF/63ukMrGUNGmJJxrndl5ZYKC6j6eX7twrZF L1Uvlmn6FnQ22red5kHO93fDjG4zaDIZvHfwj7kzjZ4tpC7Byinf88s14mdZeScc0PnU2hj4 UGYju/wg2FF4YxaZYhcmdTiRYY0Wx85XSMZv19pnn78sadEuRvfRd4JTmw++j1xGXeqQGWzz /CTG5/Ex9GAkQ02hZbmi236byDXoet4G8TEyOph9QFVkV9bNd0jQZaFZPGEj4PSPUYGAF7s5 xJaNGgctC3aZ7WjEv1FBoo44XCU4xcjJ1wZQUrHxRhx6TW0Jtcl0U9qfKFW30TSPo6RyiXuj X4ltWKAtjoXB8nUmEJckaz7IRu2b4pXDeazZuz5JBygUs10yJjDxh2vFQZo0KaBAPx9MZlPn gpPTjT15L8xGftEjQXF6 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 30/06/2025 18:19, Warner Losh wrote: > You should really get changes like this reviewed. "seems like" is not > a good enough reason to do this. In fact, it's a terrible reason in > the CAM code. There are places that the strncpy use is intentional and > you will screw things up if you use strlcpy. Too many fixed width > fields in old-school storage devices that reflected into different > APIs, sadly. That's a very good advice. I did forget that CAM and CAM-related code is a bit more magic and special than most of FreeBSD code. strncpy -> strlcpy looked like a "no brainer" as I did not spot anything special about those fields. Lesson learned. > A better reason that it's 'right' is that all but 3 other places in > the tree use strlcpy for this field. The field will be NUL padded, in > practice, since CCBs tend to be zero'd before use (though path_inq > often is done with stack storage without the usual init). And a quick > look shows that we don't use dev_name, hba_vid or sim_vid as a fixed > width field anywhere but the 'compat' code that copies the whole thing > and doesn't care. We never use any of these three fields in the kernel > for anything, apart from filling them in. We do use them in camcontrol > (and similar 3rd party programs) to report them to the user as > strings. There's other places it looks like they get injected into > geom attributes, also C strings. > > A look at history shows 4195c7de2471d intentionally changed them, and > that change was reviewed. It also has the reasons why it's OK in it. > So from that perspective, this is a good change. The reasons listed > there are sound (though it's too equivocal: these fields were always > NUL terminated except when the string was the exact length of the > field, which we didn't do anywhere, but that's not important). > > An even better question is: shouldn't a change like this have checked > the other 4 places, and changed them as well? If it's wrong in one > place, it might be wrong elsewhere. Or looking elsewhere would confirm > or deny that this was intentional for some reason. > > But there's another consideration that 4195c7de2471d didn't think > through that I have just thought of... -- Andriy Gapon From nobody Tue Jul 1 13:24:03 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWkJM5wxjz60PBZ; Tue, 01 Jul 2025 13:24: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWkJM3gKZz4Pl9; Tue, 01 Jul 2025 13:24:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751376243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yFrdAmwWUpvDRGD3C89otd8z/TMqzPuF6bGe99qpMoQ=; b=NolU7TV1F5PqYAJgYLeLsjlAdca3jjsIssSqGcUCbQlhiL2jZGAESYj9rcTXZppJhMDVgF CXHZgy0TLDH6LJ5CYv18JtW8DiPmP+pfwwL6q46F387lk0aZAxrZMm2R77gHzVaHXk7uUt eM0gVuAfMIdptNxP+GnQST/Z985n2ieHKE7aQhDygw2iQwKGxJOJxpMYcfo2FGZQxPRCQT oDLG9Jv49kfT7ob5Gcfhu9DJv3jwYejLrqZzQVdB0txwcMBtlstZyC6s41ztcp3GaA5RH1 8lBLuNkbRmrulwxePAO27gtDS4J+8nvGl768KhaurFWp4yKHhzmrvzYZKFOGkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751376243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yFrdAmwWUpvDRGD3C89otd8z/TMqzPuF6bGe99qpMoQ=; b=QVrt0qRV4ILSop8btN/QO6f3zMtWguR1bwjY0sZTxlIdTvyB1X5wIIa/kSaiNS7KsRHiWt 2m9LNrowspzhfoQXXplOGmMgYIl8eWqZoemYwPOetfC/9F3c/eJJAiJlH81b64+7Duq1L2 C1AHB4ynt9wjCa4/sA4JhVd/4OwLpuPIkkN4j5NFcYiMmW35QkeKWn5rbFZft/2DCp3Rm9 gI77sbUld4IkSnUyHV34HDz2BVixTdThm04l7N8oO/Tk1UDKE1IgKT7bde67WBK8dy25IU bC+NmZky95um/DnGRkH+T0Hx5m8UGnUk3i5IqRZWd05TgmUtx52BFJAIXoYpVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751376243; a=rsa-sha256; cv=none; b=aOMWF+P0GUq/SngfF4CP0giykIRkboZD64NS18sxbAR5C1PPyvTyx1AHhNVxFAz7gs/5J8 HFZaQQtRDaoPPU583fv0TwAPRtZHc+aEKSWbDDfmPyz2FLdNn1KiixZkJZoPuqHYp7UJOl +CyHt9R/imB8jKcNy5koJV/9A0eEECGIXugdUrEFtwUB09cwv/jWrbQOoUAuqokd0O/te3 Sk7oea0EVClNRXcTwqxL5UczPAbb2MfNxnToGR41jvF+qv/cb+KmTEfirfFCasAyVyFLp8 w0r54duOkbahQlCl0C1MR0ikyfzCuP6TgqU7sOZsLbQsQyHvNJYms5Pwtx1b3A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWkJM3D4gzcBT; Tue, 01 Jul 2025 13:24:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 561DO3LB080331; Tue, 1 Jul 2025 13:24:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 561DO30x080328; Tue, 1 Jul 2025 13:24:03 GMT (envelope-from git) Date: Tue, 1 Jul 2025 13:24:03 GMT Message-Id: <202507011324.561DO30x080328@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: b1b17432aa1b - main - ifconfig_netlink.c: optimise non-listing case List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1b17432aa1be670564161232d110461a5dde4ce Auto-Submitted: auto-generated The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=b1b17432aa1be670564161232d110461a5dde4ce commit b1b17432aa1be670564161232d110461a5dde4ce Author: Alexander V. Chernikov AuthorDate: 2025-07-01 13:16:57 +0000 Commit: Eugene Grosbein CommitDate: 2025-07-01 13:16:57 +0000 ifconfig_netlink.c: optimise non-listing case This change produced by melifaro and the commit is concerted with him as he is pretty busy IRL these days. The change restores performance of /sbin/ifconfig utility for non-listing case after it switched from rtsock to netlink(4) API in FreeBSD 14+. PR: 287872 MFC-after: 2 weeks --- sbin/ifconfig/ifconfig_netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c index c1e6b7be587f..b5badfd585b8 100644 --- a/sbin/ifconfig/ifconfig_netlink.c +++ b/sbin/ifconfig/ifconfig_netlink.c @@ -141,7 +141,7 @@ struct ifmap { * Memory is allocated using snl temporary buffers */ static struct ifmap * -prepare_ifmap(struct snl_state *ss) +prepare_ifmap(struct snl_state *ss, const char *ifname) { struct snl_writer nw = {}; @@ -149,6 +149,8 @@ prepare_ifmap(struct snl_state *ss) struct nlmsghdr *hdr = snl_create_msg_request(&nw, RTM_GETLINK); hdr->nlmsg_flags |= NLM_F_DUMP; snl_reserve_msg_object(&nw, struct ifinfomsg); + if (ifname != NULL) + snl_add_msg_attr_string(&nw, IFLA_IFNAME, ifname); if (! (hdr = snl_finalize_msg(&nw)) || !snl_send_message(ss, hdr)) return (NULL); @@ -455,7 +457,7 @@ list_interfaces_nl(struct ifconfig_args *args) nl_init_socket(&ss); - struct ifmap *ifmap = prepare_ifmap(&ss); + struct ifmap *ifmap = prepare_ifmap(&ss, args->ifname); struct iface **sorted_ifaces = snl_allocz(&ss, ifmap->count * sizeof(void *)); for (uint32_t i = 0, num = 0; i < ifmap->size; i++) { if (ifmap->ifaces[i] != NULL) { From nobody Tue Jul 1 14:05:29 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWlDS6ckhz60R5s for ; Tue, 01 Jul 2025 14:05:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (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 4bWlDR3WFrz3f4G for ; Tue, 01 Jul 2025 14:05:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20230601.gappssmtp.com header.s=20230601 header.b=FwyPcDiZ; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::52d) smtp.mailfrom=wlosh@bsdimp.com; dmarc=none Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-b31d8dd18cbso7156702a12.3 for ; Tue, 01 Jul 2025 07:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1751378741; x=1751983541; 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=knBibJhH4/RtVbcCsa07CREGI+NJdEkpSY1UyzEdwT8=; b=FwyPcDiZyO0QZzKi4qGIEpvRChLpG+bY6ky1720W3obwNSq4vVwern0CLo1zJt0iYf bniL3xggMUIldouikCfsu7S8L/V82K09Obgz34S0IYORIwgBEHtUBb7jkhTCekT836zv M8RNYuxBNTuTD41ouuo4WavQ4lX0QfPXeUchWO08Rw4Z6WTa1/iURWsbd46rhoGrB/ZA 3+fBxCg81Dnag47+VH9pztQ29R9PETph8OdopSEvKFnax964PdmSUhumSrIqFDcVWvNr lCs0J5++gV/lVX/iK7DbSPDvzEC7atbtdRUiEwqtAASS9HWJ28+15UnhTafksMSn4jEq bl2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751378741; x=1751983541; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=knBibJhH4/RtVbcCsa07CREGI+NJdEkpSY1UyzEdwT8=; b=nXrU6mjLAYhULlJeshjQpXp2a2iEorYWRDB1DHNo5AcVUab9AIL89WeCoGEBNW6JGV N+/c2E0343BiOgk5EhDje/pX8GbbsI8n9uQ7KDb3+qcdrKXVYDCDtogEsiQvzHqz67vG 1VGcLK3/Qkjv/U8SyjZYuCTJJHK8d8jdmuwVYlieUmxFoNbsy9i1Q/jdBFVb+KDZ1z0k rsMeZvbX3UoFo4U9WXuaJT/mCObGXbkvg74Tuwg8i8g8qJB9pU5YHqpgbBBIh+SFLglz uqjdbzQ9yOR+Q/XNXtuZOo6tqznsqtFVY9+7PWZaozgZ3wz5OtxSPwvj7Xf8M+o5IOBG za2w== X-Forwarded-Encrypted: i=1; AJvYcCWT6P3FSQWKo1cAFxkDkBnMa8BaHS2frLjJBFNKQ0gFI4PaJGJeRnJqK7WjmIiIRS/gz7uX9JbgdnGUK/iycoa8VcFw@freebsd.org X-Gm-Message-State: AOJu0YwVdOGGMg9VVLwv6aLxrqpLkYLmjAQlVBSUs+YKpicjj20lKGzL Z/0WZKNRDNibZjtQHqE77p0lnO9qTqH9qaJvJRvNqUffDn7QJBjWf97OmS2WlCOI+jjBj3cRjv5 K2tE4z4ucfWBnWer7CQT58T62JwhM5l3rFTQV1bFT3bW4lQ5Ha7Kbj+4= X-Gm-Gg: ASbGncuE+NhNtCd/HB1Xek40XU8GJp3mDR8TYWCLW+M/u353hhED0lV4vJvUrY1PmYv Yu4zgOgyEdrOWO6tNlXfYvkPsLQy7ZYZZAYpUhCbrhkXdbxPgMfGHcubC0tF9JT3HuBZX55LEIh MOMHbcLF+cxKm+6mDIgyxeV6gr+te5y28CLzYj9Pg0rhE= X-Google-Smtp-Source: AGHT+IHtSPYvdQSAHsUrcB/JM3h3DWMkilopCMlxuwajvdEfWgMqZmAsqSJFnMx+swoH9tW3fOGYhM6dRlVvV64C7mQ= X-Received: by 2002:a17:90a:da90:b0:314:2939:efdc with SMTP id 98e67ed59e1d1-318c8fef561mr25263951a91.13.1751378740603; Tue, 01 Jul 2025 07:05:40 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202506270721.55R7LlB1067221@gitrepo.freebsd.org> <69858708-8e73-4b70-9f33-5176fceb1b36@FreeBSD.org> <89e23d9e-885c-4811-886a-6c1011715679@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Tue, 1 Jul 2025 08:05:29 -0600 X-Gm-Features: Ac12FXyu7m-yTrMne66ssJfoPhOOxQbCkqET3Nvy3rEnN1crH90IzqxA00NB_Mw Message-ID: Subject: Re: git: ad8d33679999 - main - mmc_xpt: use strlcpy instead of strncpy To: Andriy Gapon Cc: John Baldwin , 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 [-0.14 / 15.00]; NEURAL_HAM_SHORT(-0.99)[-0.991]; NEURAL_SPAM_MEDIUM(0.93)[0.925]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20230601.gappssmtp.com:s=20230601]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-0.08)[-0.077]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MISSING_XM_UA(0.00)[]; DMARC_NA(0.00)[bsdimp.com]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::52d:from]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; R_SPF_NA(0.00)[no SPF record]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20230601.gappssmtp.com:+] X-Rspamd-Queue-Id: 4bWlDR3WFrz3f4G X-Spamd-Bar: / On Mon, Jun 30, 2025 at 9:19=E2=80=AFAM Warner Losh wrote: > But there's another consideration that 4195c7de2471d didn't think > through that I have just thought of... It turns out not to be an issue because ccbs are always initialized when these fields are used. Warner From nobody Tue Jul 1 14:19:44 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWlXd6cvwz60S80; Tue, 01 Jul 2025 14:19: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWlXc5LQHz3sDw; Tue, 01 Jul 2025 14:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751379584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=offdHl/dWIuVM+e3Ks0JdWWuC0Oe/g6cjCG6J/8WC/4=; b=v/y+Qde/lfgnNwz0VKURCVeLBbh5T9gNtIHbcaLIUtfICMapU8fWQu44qzxTBpTYXtBd87 pga2s/8pW8aYlSBnAO12MS9p77mcE/HNshNanw8AYDavZaCiE176rPGV+oBXzjZSGj+nzl iEwzc2Ptle+/qjlOnTdTfNXkRkZcLzuNal2Wtikq4yNYu1H42+i064gPbCv3rEkMgJKhWk yWxIiIvV06mfiao1s9TgsuZRNO7mH3ywd5K99EmIbs584Heh4yP1lAKoc600e0D+kWGtOR sRVmIJcjhEWckyStxzZxkjhc/SSl7BwCbOSiy4B34Z7ATtu/fxk6fjn+hpDWWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751379584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=offdHl/dWIuVM+e3Ks0JdWWuC0Oe/g6cjCG6J/8WC/4=; b=kxR5xRaXyT/pBPrhnHWn2LWGvobmxAhYQAd6zM3ewk0GTIqBS6lW7xz40ww++gj+OYHeEb fBKo8ChDzS6J7dPAHcqGQA6sKZCmWIc5IVGGk5YLIQnZbA+CKfxvo7DEr/lQSMYrrYPKRM mTKUG2v6gTDlZmDL5st809HMe/IB3ICEJgk8+YSaJ3V0SGs9X55cMkS/WiQvkJk+QV3mJK Zf1aDarYVuQ8hkH2KWiNYuBvuPxaRs1VgSORCVM147E8FImkG4c6fslqrFHgNUbBeJfuYk GdYo9aIru1w30izHOiLK1BkJ4J1C5OfOtPDSjXBHzv2kX/rC/a5F2db5teO9BQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751379584; a=rsa-sha256; cv=none; b=FURk02CuIFsgjng4hFUl5CJvpcDX+nkosYRUnQjh3PaaBhHFwmTUigptKBwUEaiTJHa/1p yOPAgp4u7NXlkXKARei8UL3SKTmpWGbJqENyWOiwD2sdbUZ9dJCIbbv26LPKf8zRVoUTos wLpsxTh94uYe1qdMoJax2fmLRp6DFyuTwb8PJaT1Wc1dsavVVGBYJyPuM1vLb86k6PeI4C EBYx7q0bmwxMzUHX6VeDHTV/TJtiF7PrrWaC6083kxqGEiKFUC30HWactZ2sus+SzH7Ajy PfGxYODZC5rLFoLH/Lxa6IweC7sdIPDxt1/4FSJTOBMp3FWId7bBmIfFE8RYZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWlXc48Gyzdp5; Tue, 01 Jul 2025 14:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 561EJiZR077364; Tue, 1 Jul 2025 14:19:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 561EJirm077361; Tue, 1 Jul 2025 14:19:44 GMT (envelope-from git) Date: Tue, 1 Jul 2025 14:19:44 GMT Message-Id: <202507011419.561EJirm077361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 6d3bc576abbd - main - libexec/rc: improve performance of pccard_ether script List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d3bc576abbd84f736d917f5bfec4e3fe7e6c125 Auto-Submitted: auto-generated The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=6d3bc576abbd84f736d917f5bfec4e3fe7e6c125 commit 6d3bc576abbd84f736d917f5bfec4e3fe7e6c125 Author: Eugene Grosbein AuthorDate: 2025-07-01 14:13:10 +0000 Commit: Eugene Grosbein CommitDate: 2025-07-01 14:13:10 +0000 libexec/rc: improve performance of pccard_ether script Replace "ifconfig -ul" with "ifconfig -n" because netlink-enabled /sbin/ifconfig utility has sub-optimal performance for listing. Combined with the commit b1b17432aa1be670564161232d110461a5dde4ce, these changes mostly eliminate performance regression of the command "service devd start" for a system having hundreds of network interfaces created before devd starts, after FreeBSD 14+ switched /sbin/ifconfig to netlink(4) PR: 287872 MFC-after: 2 weeks --- libexec/rc/network.subr | 20 ++++++++++++++++++++ libexec/rc/pccard_ether | 17 +++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/libexec/rc/network.subr b/libexec/rc/network.subr index 931fbec19a60..2113a3f66f0f 100644 --- a/libexec/rc/network.subr +++ b/libexec/rc/network.subr @@ -653,6 +653,26 @@ ifexists() ${IFCONFIG_CMD} -n $1 > /dev/null 2>&1 } +# ifisup if +# Returns 0 if the interface exists and UP, +# returns 1 if the interface exists and not UP, +# returns 2 otherwise. +ifisup() +{ + local _if + + [ -z "$1" ] && return 1 + _if="$1" + + set -- $(${IFCONFIG_CMD} -n ${_if} 2>/dev/null) + case "$1$2" in + ${_if}:*']*) return 0 ;; + ${_if}:*) return 1 ;; + esac + + return 2 +} + # ipv4_up if # add IPv4 addresses to the interface $if ipv4_up() diff --git a/libexec/rc/pccard_ether b/libexec/rc/pccard_ether index 7ca58f210085..957983e55a8e 100755 --- a/libexec/rc/pccard_ether +++ b/libexec/rc/pccard_ether @@ -69,16 +69,17 @@ checkauto() pccard_ether_start() { - ifexists $ifn || exit 1 - - if [ -z "$rc_force" ]; then - for uif in `ifconfig -ul`; do - if [ "${uif}" = "${ifn}" ]; then - # Interface is already up, so ignore it. + ifisup $ifn + case $? in + 0) # Interface is already up, so ignore it. + if [ -z "$rc_force"]; then exit 0 fi - done - fi + ;; + 2) # Interface does not exist. + exit 1 + ;; + esac /etc/rc.d/netif quietstart $ifn From nobody Tue Jul 1 14:35:44 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWlv46Nltz60TM3; Tue, 01 Jul 2025 14:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWlv42Kjkz418n; Tue, 01 Jul 2025 14:35:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751380544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+7NuxFjRzsKobEAtq9mJxD6dEwDeDluGTUVl0QhFl0E=; b=E1YsK/NuO0F+n7edejRpoy8yIaVRm73sVmXZN7CMoV/L4oo9UhMdKGn21meUikxCoB4ve4 sUuPkUYs0XYtJFU/PNzeL2K/PSf91cfKXH6dhp55aZTL9X9ufuyd4tssHMTz505KpoQt/M GNUxhRbretXR0xujIsXa15Fjcrf4ZMxVJt5eccT3VnGf18vtKmOd5M0X1J/DoVZNlA9s6c Tu54fD01I9oauImWlW4APKG8Bt36I3d3gRJ9PurpgTqhZsEkDZ4lNrT8aP+cCDjQJ4evQh cm89Y9WbeXhXiPDFhJjEEwfhoCJKLht7UbHmEZdVyj8dc02Lnvg2Qv/ZyUM8CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751380544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+7NuxFjRzsKobEAtq9mJxD6dEwDeDluGTUVl0QhFl0E=; b=E0T3Nsl/u+EIjDfCBqVsHsfArxQMjMlFQsYrrQGdi8+FS80hpfI7FT1aFXaIZZK6h0xjp4 JIVJ4Jv8/bpJd5XtHDtLypWkWyXYEQmgdM3EGdZ089LVowoDivBMixVsHiAYk1i755Bhvh +qxSWcraKgP+dZK2U1oFN4rw4y2LcewvDVjnkqnBr88BkcWNKTSCqFpMV9T5Vs5ng4/rPM 82JCrVhO4ar54KEy4REPW+UE2M7XgsqupKDZPoseEoOSraJd1MeqGfcXIfv3QOeOiACfYe HeFgfihs246FnEO3q7TtKFlYKhdxveGk7m246I8fdEWER9Qlr0N+ExSAZg2sWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751380544; a=rsa-sha256; cv=none; b=Y6YwecmxGWPWeDDBcUMq5ucN7TaLSbq+9NZfTlxKcoo3/2qquAYPidefhBjLAqaoXrygHA e3TKSOArlyq+s+jyI/Y1PryKfcs472DblT0ay65A/foJBToXyNdOANRrW+K+kH6Nf2Ovel voMWY/2CMx37W7woDLgqCJCvJ7OmDdU2ZJ6Cq5G/cCtcgFbViz8sMfkbQOnwfDFU6YkHt4 D++Wu/IWHSPwGTDc5ike0pFH6+K7Cw7TdHkUqOIOeqk7YWiUB/Mo7OZ5ljepbOB3R3p2lo 6W6d93zCY0BdyBHZAkdcNVWUBkxlpiwpougWWiGleBlhH1mZWYjuFlv1ephBFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWlv41NFLzfTF; Tue, 01 Jul 2025 14:35:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 561EZiFT014141; Tue, 1 Jul 2025 14:35:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 561EZiIW014138; Tue, 1 Jul 2025 14:35:44 GMT (envelope-from git) Date: Tue, 1 Jul 2025 14:35:44 GMT Message-Id: <202507011435.561EZiIW014138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 24e8ed535ff6 - main - network.subr: correct return code in case of bad call to ifisup() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24e8ed535ff673b9ea751c3d3b2a68ef0a29b0e2 Auto-Submitted: auto-generated The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=24e8ed535ff673b9ea751c3d3b2a68ef0a29b0e2 commit 24e8ed535ff673b9ea751c3d3b2a68ef0a29b0e2 Author: Eugene Grosbein AuthorDate: 2025-07-01 14:33:19 +0000 Commit: Eugene Grosbein CommitDate: 2025-07-01 14:33:19 +0000 network.subr: correct return code in case of bad call to ifisup() This is rather cosmetic correction. PR: 287872 MFC-after: 2 weeks X-MFC-With: 6d3bc576abbd84f736d917f5bfec4e3fe7e6c125 --- libexec/rc/network.subr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/network.subr b/libexec/rc/network.subr index 2113a3f66f0f..5e4f2c1f39a0 100644 --- a/libexec/rc/network.subr +++ b/libexec/rc/network.subr @@ -661,7 +661,7 @@ ifisup() { local _if - [ -z "$1" ] && return 1 + [ -z "$1" ] && return 2 _if="$1" set -- $(${IFCONFIG_CMD} -n ${_if} 2>/dev/null) From nobody Tue Jul 1 15:15:29 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWmmx4ZbFz60WfT; Tue, 01 Jul 2025 15:15: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWmmx21x1z3Ks6; Tue, 01 Jul 2025 15:15:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751382929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1g6HpYGreH+UT3WTYUj5+0tMhUR0yyjuVR21fRLc1AE=; b=WtZIS1w4y4NZ91aMOaxHe6T57Eyw1/RikRUBXnRM9RvRihzgixwrX7pIBSseR53rhqWGyz QNvI4eemtMhifdJo6KR1fWdFxxdO7YoHATwSXM9ZGxH5XDaZtJ5Ok1tzorD4ZiKkuNZ/43 K3BkHveOeFgRIo9mVDPYDz4G+HYWELumTv2/Pt0dyMmwXD78vct2tcOsy44cvJ7251gc2u mSUpn9inWud4dMD7hnvwYhpsX+JFAlDwC4TPgPgqpsHOEipnWxYrOqy6HkQ6AeCeZIyo4q Rzl2OCtl/jdm9y3G0tHeMasClTkbD0L2IgSSgIqLuCITqmVP5yQvO4jO/Uzvww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751382929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1g6HpYGreH+UT3WTYUj5+0tMhUR0yyjuVR21fRLc1AE=; b=vbshR/8JV8KJ/hteLziV/TjKRQ4UzbjNDXdgKEA8xs84u/Tq3yygJD5kN4+mJwoHUQMDpi jucK3BTntVQ7gxY8li6IbDtar0pVmuUy9NSlTxBCh2DUpIqiVdrxcvDr9oYEJwRvBask5h +v8gnHngQ8dD+6qDVhm+vqmlZyMhxpjvtOSaKvKQ/+f1GQ8ijx3iZVcKaUNiR+d+cXN176 pZj3fH+ESlsEphGQ5vuBenAfZhJAdt2scbmNOgTwgPNCJ/JwPsbRD+QRxqEtIwp37kGAzB 10NJrUP70b/b3Fv+3pCDutH9MKXwYar0YYOUri3RmLqOpEho1mkNWtySgIhR6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751382929; a=rsa-sha256; cv=none; b=Z8yDtLJ64kRpCeNSUE+KP44dPWEAPTAnI5Od9PO/8y0ruADzx2AnoTnaX6TlYAqXzhgrnq 8WHbkUXzZ//WulGgk2e3mNhfmxph8AuGtqfEsKgehSZ51YShuAlV5KzEMWuTfnDlnQgfd9 3Q7oGpkYU5qEOKM9vbXU7VlqHJsWL+V5NHy2la71waiAKrWHH0G+SJg0I9sLBUIKfVfbZF ByJIkhBrnXf70cgrgLpIMLcYJOID8iuUk6z5its2pAIo5z3WLqtQJyl/mv98Hy3ZOCAgRh 1H3byLg4pSvuZQeHoz8Qc0AzEs2x2nfQmoQkdP+jpi5T/YciG9jOFP1W0TWkDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWmmx1VGFzg6k; Tue, 01 Jul 2025 15:15:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 561FFTfs089203; Tue, 1 Jul 2025 15:15:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 561FFTbw089200; Tue, 1 Jul 2025 15:15:29 GMT (envelope-from git) Date: Tue, 1 Jul 2025 15:15:29 GMT Message-Id: <202507011515.561FFTbw089200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 89dbe1dd2f1d - main - fcntl.h: Add O_XATTR for Solaris compatibility List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 89dbe1dd2f1d37e1b369d1910f12ff737857f070 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=89dbe1dd2f1d37e1b369d1910f12ff737857f070 commit 89dbe1dd2f1d37e1b369d1910f12ff737857f070 Author: Rick Macklem AuthorDate: 2025-07-01 15:12:42 +0000 Commit: Rick Macklem CommitDate: 2025-07-01 15:12:42 +0000 fcntl.h: Add O_XATTR for Solaris compatibility Commit 2ec2ba7e231d added O_NAMEDATTR for support of the Solaris style extended attribute mechanism. This patch adds O_XATTR as a synonym so that software that has Solaris extended attribute support can be built easily. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51099 --- sys/sys/fcntl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index 9329ecc29c47..dd9fccf5cf38 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -141,6 +141,7 @@ typedef __pid_t pid_t; #if __BSD_VISIBLE #define O_EMPTY_PATH 0x02000000 #define O_NAMEDATTR 0x04000000 /* NFSv4 named attributes */ +#define O_XATTR O_NAMEDATTR /* Solaris compatibility */ #endif /* From nobody Tue Jul 1 19:17:56 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWt8h3bBWz60nM5; Tue, 01 Jul 2025 19: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWt8h2ksKz3Y6g; Tue, 01 Jul 2025 19: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=1751397476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f+bYM1KLRy6M0IKU+9SJ7BOoVVO/jbvOXiJX96ZE6Xw=; b=bKWCRFzlgkhP5kzYu7DeihnlIHt6yxJAgjkRya2/3KsmdyIJIoZHRyc3heF6QRGRekrrc2 mmM096iaadOnh4rZddTKLY23Q2jlXutIydJcUJeMRO6zcadUANygBxWsNVAiH9qgwIUGIp QxHCKhyip/Lb+BK85T4HvFCjW9m8ufHibXy+1zwwCHQtFi6emoGbmCUNqD23GMUb06JH/h w9eOrrl5GrsPtnS0O71+ATRQaG4qvdlmGSFdwOTDWARmyN2Eihgz6d2FQEGK6UHZY8xlax Vom9VmL+gSM3EbBhpZkA6yso6gxmTqPHMgOxlHb1aeNHZ/nfTft5yeIrkymtow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751397476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f+bYM1KLRy6M0IKU+9SJ7BOoVVO/jbvOXiJX96ZE6Xw=; b=Ajt2GWaVuOLLJFuncpL1Yz7LfsieNEiBnUeTiAzJfMOrbNSipR7JFkzJU0EIlXgz/AGUVT D5MXw2tj2AlR3d9g6edeZPqBXP4OmPwBDl9Wv66C5Vfc89IXm86OIQ/VcZBTx0VEBYzt2w +Xi7V74sMLluuxvRBwgqZPUUnzEgOL84f3vxPHBdPyDtWQxl+7kqMY9Bp1LfLDTNivt1h5 yKBVAGHSrnyDi+5b3kxGTm9FcLpTiuRY0K8zcAt5gVStXxADHyl6FJZkRjTRqebN7rPAUs 7qMR44ANvcY/+h9ys6UQ/2eAVj7HnnGXjilde5bIFbMngOOQZo3qAelQRvEj6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751397476; a=rsa-sha256; cv=none; b=m+L/buLMsw6iVbQYSZh2wbEx0F30UugfT2HXM4r0PG8vkwL8/sBsdBk5UCgKhpEqak2u+a yftrfkxxqdh10PGKOUrSAzhCcQ99LgTZcW7c2pl5wcTNysNJCvZAo22zUYOwA+SHpt4eCu 4LC5mhLanTw7ySQ3Xc7JfKHTecekMm3TVEoMKgU3lbHOk5bb0FE7GeVSYvxwntn80L0Zu4 2d2s03zW1ait6clP0/5MTxA9JWbDavVRJPo2pguwMH8fpn3/pSS0bOFRoDaChxxvz2vxnC Cxv6g7oGZEUpDhQFLCVg1CA2ZpXDx2ZuyhMe4o52cTiDoHQ6naWVBLn7QHX2kw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWt8h23dLznQw; Tue, 01 Jul 2025 19:17:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 561JHufa040979; Tue, 1 Jul 2025 19:17:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 561JHud5040976; Tue, 1 Jul 2025 19:17:56 GMT (envelope-from git) Date: Tue, 1 Jul 2025 19:17:56 GMT Message-Id: <202507011917.561JHud5040976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Renato Botelho Subject: git: e690b6519ae7 - main - bectl: Print activate message in a single line List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: garga X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e690b6519ae70921b084d5df0e707abaf848d795 Auto-Submitted: auto-generated The branch main has been updated by garga: URL: https://cgit.FreeBSD.org/src/commit/?id=e690b6519ae70921b084d5df0e707abaf848d795 commit e690b6519ae70921b084d5df0e707abaf848d795 Author: Renato Botelho AuthorDate: 2025-07-01 19:14:16 +0000 Commit: Renato Botelho CommitDate: 2025-07-01 19:16:28 +0000 bectl: Print activate message in a single line When -t parameter is used, bectl prints a complementary message "for next boot" on a second line. Change it to print entire message on a single line. Reviewed by: kevans MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D49439 --- sbin/bectl/bectl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sbin/bectl/bectl.c b/sbin/bectl/bectl.c index 2ed365f93ad3..95715b34336b 100644 --- a/sbin/bectl/bectl.c +++ b/sbin/bectl/bectl.c @@ -158,13 +158,15 @@ bectl_cmd_activate(int argc, char *argv[]) /* activate logic goes here */ if ((err = be_activate(be, argv[0], temp)) != 0) /* XXX TODO: more specific error msg based on err */ - printf("Did not successfully activate boot environment %s\n", + printf("Did not successfully activate boot environment %s", argv[0]); else - printf("Successfully activated boot environment %s\n", argv[0]); + printf("Successfully activated boot environment %s", argv[0]); if (temp) - printf("for next boot\n"); + printf(" for next boot"); + + printf("\n"); return (err); } From nobody Tue Jul 1 22:22:02 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bWyF63Kncz60yC4; Tue, 01 Jul 2025 22:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bWyF62b5lz3HCH; Tue, 01 Jul 2025 22:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751408522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OK8zR9CoAn+fP2JUQNS14Bjbu1NTYDPP2GdQUUiACDk=; b=erQp0tdSAJiNjXheqTY2f+s0aCikvLfXZ6loM8xLCWV8WGGC4vfdnJ7hGnf3dh1t/Kuocy CexJWGNmAUzHazZfVtPzTw41VvIYfB4q8tOIDWIxhGa2rjXhObykWy2uuxt+Ml3tpVSdo+ 9Kdp2Kd8r9Pg7o6MxX+LhL3UBYu+pZt4BQYdEuuEPAXzpre4lh24Fq+Ub9H8ljnPRWYxoE 5fs/vAIHuXV2/G+v45p17HJk4Q9ZGjuX1Pq2xIy+ykQDLolm1aM7CU2dsRbDF2h13aB6GP sGOe25FFP5ogciflU5s3hUk3gal8bL03vDIGoXOI5fFsScbYm4Qs0XFvpfMeJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751408522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OK8zR9CoAn+fP2JUQNS14Bjbu1NTYDPP2GdQUUiACDk=; b=fcxm+5eBJLa/KwGWpghlHuakL5yq3gLA1doFiKzX1pBhQUXVSab2tX3LxWaDU4lM6T4meO FOByd82ozwnWoev7wIu8oQX8rGEeVgXObICQynfXIJ3UuA3sxjGTon5KKXuPk29H/BWJ1d 6KgM89umfEx72yf9R5cOE+DDhHDhZsaurLXiC2uYiv33OiGKnVzEImuvOVUBeA5yauRUHm /qjAGlhPRiBYGmGxiZ79R59R0V+KUoOKAiAk2O4sL6iHNF3wOUNAu2DHCbQ69OhJg6w1Nu 76JPwhfcTSZ0SluC5G/pZ8WGZfi2VLPIHRteXFw0QLk2vFgBnIR39tyfgbYk3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751408522; a=rsa-sha256; cv=none; b=JnAe8WKcNcrYWBU29uuA9EmAsndjVmXLTyoLBEUYWI8RD4Nj6QlQ+wOQbGn+Zr/aGxDz9C trlqzNR23m0e7E3QVX6N+gj4zylN5cSH9FV/i+q1wIQmgo5om9ApU5avgw3DyU4H01dYbX 2JyDmSv+xVihvI4rMxLbbV2cPjQCoYBsSVU8KEckqB1J64M1O44Yg41JufxfwTDAP1Tj4n C8NBJN6BYBwKO0Di8ydQqt34o4fz/FV8Y2NUDNpzIjscSS50HncDJoWYHGPlIYGvq6Vn7W Q4tvwS53oNwC62z5UowctmuYPFfgM3EYIOLUE5C4kWifXQvFY3chieM/5zU9sw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bWyF629mVzt6F; Tue, 01 Jul 2025 22:22:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 561MM2M8093032; Tue, 1 Jul 2025 22:22:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 561MM2Ao093029; Tue, 1 Jul 2025 22:22:02 GMT (envelope-from git) Date: Tue, 1 Jul 2025 22:22:02 GMT Message-Id: <202507012222.561MM2Ao093029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 65bc8e9192dd - main - pf.4: Add pf_enable to SYNOPSIS List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 65bc8e9192dd19bca3ed89586a23a74cd449f7b2 Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=65bc8e9192dd19bca3ed89586a23a74cd449f7b2 commit 65bc8e9192dd19bca3ed89586a23a74cd449f7b2 Author: Alexander Ziaee AuthorDate: 2025-07-01 17:09:14 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-01 22:19:28 +0000 pf.4: Add pf_enable to SYNOPSIS MFC after: 3 days Reviewed by: Pau Amma Reviewed by: Felix Johnson Differential Revision: https://reviews.freebsd.org/D51117 --- share/man/man4/pf.4 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/man/man4/pf.4 b/share/man/man4/pf.4 index eca7914472d6..422600a6fa44 100644 --- a/share/man/man4/pf.4 +++ b/share/man/man4/pf.4 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 6, 2024 +.Dd July 1, 2025 .Dt PF 4 .Os .Sh NAME @@ -37,6 +37,10 @@ .Cd "options PF_DEFAULT_TO_DROP" .Pp In +.Xr rc.conf 5 : +.Cd pf_enable="YES" +.Pp +In .Xr loader.conf 5 : .Cd net.pf.states_hashsize .Cd net.pf.source_nodes_hashsize From nobody Wed Jul 2 04:17:30 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bX67H3tdcz61JRW for ; Wed, 02 Jul 2025 04:17: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bX67H1kxxz422K; Wed, 02 Jul 2025 04:17:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751429851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FAZhLoJ+a2RoOsrwhs8l/+FDj2AZBpM3wLhfc75Ao6E=; b=Z5+wchw3BhD6mW7b9tobmPmqsFMcTbqVFVe/fobpveVQIdrBGxgT3R8acBNfI+wam1pZQ9 9crdw8XM8k2Ydsxp3GepWcm0Oo14EZnxd9ZzhCNIakeJIrPKPxruRi16hWHhqAgRkIZ8WM bpEsn8tym+v7i8tO8GydGVNosTPs5kL2/jbnIRWihITSA7nSJbSk9qbmXq1KZSKjjugUG6 4sk38+ZhdnbLpY//ktj6IdogBUbel6BFgVkO7QAckkCDn8jIJNKe0few5GHi93XC2ah6Xx piRCgILDSTPHQB2P7S6+eOi8KR6LA2Z3aAl81kiEkG8Fj6QDhmn7q5kQlTSo5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751429851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FAZhLoJ+a2RoOsrwhs8l/+FDj2AZBpM3wLhfc75Ao6E=; b=FvBmiqhCcI67DS49O3y2DiK/JtpU/ntvLei2a2+JAytJj0zOyFYoIhR7LDOQ7tGUTfYgRM 8zluGme1e048bCbM9UJ4C/QENhRBqkfOtXpA3aQj+RDxR15ltFoyp5MpFb61EcTP0ggZRr YfGSVKxVo8AJDO7wVztAFeVqz2jts34ug+ESf0T6uaPqK21MYNPjzLRtuKbQSkqYQ6sZZI gVleYzeTbto2ih4Zr8n4M6CUmuF95xsROj7AsvrKMU7eIfMR2FWVKpdaYQ0dnhnxdikf3j 8Wyjfl9nAWeIl0XIMJIsp+x4CtLKxVJQWdJGEvvzIV4sH7Nlbz2piI5/hiZslQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751429851; a=rsa-sha256; cv=none; b=a4zB77c1ZNW5KSTpqtfIHlmIUEsMtESfgIWgA/OOP+TC+gbjQR9Ax9ykviofvcn6JCUti8 H+7wPUsoICyRctrFczCRu4TC6FWeSWJVDuYKgsBfNSbUPi8krRvwndPSAH555b4tEU1Mct CDM/gyaajSb5/5+pwNiFQNqrd5pkBzFtqXeGnjHtOdpKtyhrGbOLdraIPlXhvxGNMGj1Ra ZDPo4C/ZfThRPDE3pz4MD9geSR5oVmP1eN5mR4XLNRMfvvmyXGNiPYapEEx7Q9oa9SZuhd 4fzDufxU7cMiWB+nH8QEzBfK+M13zrjK24Low/VJHo3FGXFzTd/qH6RmYOI23g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bX67H0nqtz13gt; Wed, 02 Jul 2025 04:17:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5624HUPi056255; Wed, 2 Jul 2025 04:17:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5624HUma056252; Wed, 2 Jul 2025 04:17:30 GMT (envelope-from git) Date: Wed, 2 Jul 2025 04:17:30 GMT Message-Id: <202507020417.5624HUma056252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Li-Wen Hsu Subject: git: 769f62d270f2 - internal/admin - Welcome ShengYi Hung (aokblast) as a src committer List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: 769f62d270f22120290ccad720241f176d10d423 Auto-Submitted: auto-generated The branch internal/admin has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=769f62d270f22120290ccad720241f176d10d423 commit 769f62d270f22120290ccad720241f176d10d423 Author: Li-Wen Hsu AuthorDate: 2025-07-02 04:16:59 +0000 Commit: Li-Wen Hsu CommitDate: 2025-07-02 04:16:59 +0000 Welcome ShengYi Hung (aokblast) as a src committer ShengYi has been contributing to the project in many areas for a long time. To shorten the time needed to merge his patches, the best way is to let him handle them himself. Thanks to Mark Johnston for being the co-mentor. Approved by: srcmgr --- access | 1 + mentors | 1 + 2 files changed, 2 insertions(+) diff --git a/access b/access index 4e5225a61264..8a670fce98f4 100644 --- a/access +++ b/access @@ -26,6 +26,7 @@ allanjude ambrisko andrew antoine +aokblast arichardson asiciliano asomers diff --git a/mentors b/mentors index 89cb4b5493f4..768abcd2e96f 100644 --- a/mentors +++ b/mentors @@ -10,6 +10,7 @@ # Mentee Mentor Optional comment 0mp markj Co-mentor: christos, bnovkov afedorov vmaffione Co-mentor: jhb +aokblast lwhsu Co-mentor: markj brd allanjude Co-mentor: bapt bryanv grehan def oshogbo From nobody Wed Jul 2 05:10:33 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bX7JT64VBz61M8v; Wed, 02 Jul 2025 05:10: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bX7JT5VrDz3SX1; Wed, 02 Jul 2025 05:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751433033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8tnRs6yW/gt97Tes7Hs3ekKbDb14uv/Lntge1apa+vo=; b=ToPaw8Vz4LWjXcFp/ZOg8i+Iav38ScClWLjB7Aubnr0azc23oOBLPIvPG6qVcpN2cizTV5 tSKyzUWNNJpUqZnK2iXMCG9UD/fcK0oSkYngdH9K/uPPOIIcKcbACz9fXRrwtT28zQSBtb 7s/2z2zwxBcBmMjyOAY5g1QuILR9jJMynX/Rc69NBWsmMJA6vishIuybrsZJ8TJUKkFQ5g PkTz8mkgqMrAM9oXrcb7YLrBK7Kq5Rmm06/b+ef+LuYPk1h0V3xp7kQ/CTbZv6bdWrBoQl H5F3a2ztd6g1d3HCoAjHwGptpV3HMiINze1crCKMxgBv0Sv0COba32oobrqGnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751433033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8tnRs6yW/gt97Tes7Hs3ekKbDb14uv/Lntge1apa+vo=; b=r5riZ2j9NQzwsH12APCpO+Vj686nYW02w49v3syC0AZ+dO2btVoDLidfbq12VOdJhti9eo fr1WdUOtIsG5UhaFHxCyY3U6Mr9einmx52VbyWcPLvGdPcy/UY9KreTHC5Z8dcKiPDJGYO t7LM8gi/wcrQluxR5jkhYOk/W9/wUY7an+E4DQaWd306F4gp8XoHGKZEum0ukqycC0v+Yz LQwBb6P34F/lgTj6zUNapN2mHYHNizM1L7rZe/xPWstXQDHWRa4Xp+4amaIC2MQ09Vj6M4 4Rl67QRF6wQr/K8SYDFbwJrT0NglcUGsDcQwwN+VCCt9pVz6mU0kRdPXgGmcsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751433033; a=rsa-sha256; cv=none; b=wrP36upJLQE+kCm+BO7OZ1B22/Rz/D9IkWiR/qz71KlEbOjR93ymNIB2ZcINL7Vyh5dPAN ezkiqTAytihVg8kKrrYvrM21bezNequ7SAU2ULyrehw/Z+/K6rP7BUzwpCHYTH+aIe5KBD jHpOFeTUq690/YStofpM7LvVQyu3qNzRJHwTZXE7WsMM3VHReFe8ekL6wHqRugtAU49mY4 9CfPu6NDTe9DiMGb/jjR4cwBvPhXbpu5+FqvThB5I1MDuODvC874X4tfbdasmU/0GXC5Zy Q1uo0s52ZCYKU1sa9sq0JWjVo7aVm0MhsitRdnMVC2rc6ety+TXsuqn9Kde4Hw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bX7JT56Pmz1522; Wed, 02 Jul 2025 05:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5625AXxX059689; Wed, 2 Jul 2025 05:10:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5625AXkg059686; Wed, 2 Jul 2025 05:10:33 GMT (envelope-from git) Date: Wed, 2 Jul 2025 05:10:33 GMT Message-Id: <202507020510.5625AXkg059686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 119fb2a288a4 - main - sh(1): Do not interpret chdir to "" as equivalent to chdir with no argument List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 119fb2a288a48b566f5b2c195edfdb980f876d76 Auto-Submitted: auto-generated The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=119fb2a288a48b566f5b2c195edfdb980f876d76 commit 119fb2a288a48b566f5b2c195edfdb980f876d76 Author: Xin LI AuthorDate: 2025-07-02 05:09:29 +0000 Commit: Xin LI CommitDate: 2025-07-02 05:09:29 +0000 sh(1): Do not interpret chdir to "" as equivalent to chdir with no argument A script that does the following: cd "${dir}" || exit 1 would incorrectly remain in the current directory when `${dir}` is an empty string under the current implementation. This behavior, while historical, is potentially dangerous, as it is likely not what the script author intended. Change the command to treat an empty string as an error and emit a diagnostic message to standard error, as required by IEEE Std 1003.1-2024. PR: standards/287440 Test Plan: kyua test bin/sh Relnotes: yes Differential Revision: https://reviews.freebsd.org/D50974 --- bin/sh/cd.c | 2 -- bin/sh/tests/builtins/Makefile | 1 + bin/sh/tests/builtins/cd12.0 | 3 +++ bin/sh/tests/builtins/cd12.0.stderr | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/sh/cd.c b/bin/sh/cd.c index b908c4320c04..6f97bff3c9f0 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -99,8 +99,6 @@ cdcmd(int argc __unused, char **argv __unused) if ((dest = *argptr) == NULL && (dest = bltinlookup("HOME", 1)) == NULL) error("HOME not set"); - if (*dest == '\0') - dest = "."; if (dest[0] == '-' && dest[1] == '\0') { dest = bltinlookup("OLDPWD", 1); if (dest == NULL) diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile index ac959b17c639..7fdecb23c817 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -52,6 +52,7 @@ ${PACKAGE}FILES+= cd8.0 ${PACKAGE}FILES+= cd9.0 cd9.0.stdout ${PACKAGE}FILES+= cd10.0 ${PACKAGE}FILES+= cd11.0 +${PACKAGE}FILES+= cd12.0 cd12.0.stderr ${PACKAGE}FILES+= command1.0 ${PACKAGE}FILES+= command2.0 ${PACKAGE}FILES+= command3.0 diff --git a/bin/sh/tests/builtins/cd12.0 b/bin/sh/tests/builtins/cd12.0 new file mode 100644 index 000000000000..34bc053afd1e --- /dev/null +++ b/bin/sh/tests/builtins/cd12.0 @@ -0,0 +1,3 @@ +(cd /bin) || exit 1 +cd "" && exit 1 +exit 0 diff --git a/bin/sh/tests/builtins/cd12.0.stderr b/bin/sh/tests/builtins/cd12.0.stderr new file mode 100644 index 000000000000..cce88588b909 --- /dev/null +++ b/bin/sh/tests/builtins/cd12.0.stderr @@ -0,0 +1 @@ +cd: : No such file or directory From nobody Wed Jul 2 08:27:10 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXCgM0hCFz604dg; Wed, 02 Jul 2025 08:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXCgL5fnRz3Z7H; Wed, 02 Jul 2025 08:27:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MDLLuhRYJ5mDLBSGatOSaM4+awt+XBpk2crzCHQ6q3A=; b=XlX/8xSatW99qkjYvOSrOPER5H5zUTzA9OWbCZT64JRIlZZikmFBrdLlptj8vqGR7/ACq7 +vArUB0GNd0HOD3lvOjFkxYvpccImEEqFCbTwemOhkoRmwdN6NemS4wQ6ar0bj5Liq5gom y9iD2Q2t3/OGIWHEpNOOntmri2CgcM8tAo2roVDbpNQ5Y4UcEMJ6Xg3zv9IFRPbXIU+6ws kvAtQtUlGGklZreL+Be+07jZ8HCje686CvZACopk2MPthI6rkeq+aOFhrEwNhfObpUpqTs AG2DDPji+Ewxa6NqadBAUA/BavtLX/vpEbu96IfRhqPkDIXiLNNPpwGTbcQ+HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MDLLuhRYJ5mDLBSGatOSaM4+awt+XBpk2crzCHQ6q3A=; b=v2rTvvOb3wgEmOWi8mek/UbqfBYo2gGDmR+wBs8NkTY2H46j46iUnI88WHGwNQ+PGwmpBk 7h/tKkDNAuiGkkdIlns1OuXTSJ2g6xRM/jkmRELQVsPfvkDed0UgcsQSEJW/IhrQP3LdwO V6zKyXVAQcsV2ufI9TkgxsW+ngr7zAdDVtD//Bm8ByvfEdhyinevlbtGSg0NQDhzl9liRn OL1VByEmccvZWt/Y0RaYnTBZVJ9gGyRnSu+2G+ixoQr5ScauPZYSCiXxRj8s2qv1jTk9/k oB+zlr2NXFVBU9PJAXtpIxuZhGysMKStcUb1m1tKK0TGDJ7VpXWamMLPPz67fg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751444830; a=rsa-sha256; cv=none; b=SUVpkycGYIx6r5UHBucWNWNBMvsNExTssW5NjZz4t9ex29OCZe37rHWWnHZfeH5cMehWXS Aq0WTDDICeUCrID31nS9L3CwbUYRVsI2ijqtv6RBRvXeTAddJCQBpYjS4NLu+5robiO28c 8pU84yO9Fu3bb/2h4JysduExKCVpU3QTgx3xciTetXOeVRDDCV0b7ILgci/97BE6LsNPip G/GJsnG4CoKUbCjZNv9jaya5rtm9ePoTgnkcELy/Aeb55sRMswFfa4sCsozXPCnzis5x5S aE6kMq4t9V6Ze0aLDPpo9V/1z7PZ3uLjTtngK9imwan//7q0Y7ED97ku0IiZWA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXCgL5B3cz1BVK; Wed, 02 Jul 2025 08:27:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5628RAQi025488; Wed, 2 Jul 2025 08:27:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5628RAUf025485; Wed, 2 Jul 2025 08:27:10 GMT (envelope-from git) Date: Wed, 2 Jul 2025 08:27:10 GMT Message-Id: <202507020827.5628RAUf025485@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: f0cf95809b40 - main - pfctl: Fill netmask AF-independently in print_host() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f0cf95809b407b4a8e81beed1642f27b0810ce44 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f0cf95809b407b4a8e81beed1642f27b0810ce44 commit f0cf95809b407b4a8e81beed1642f27b0810ce44 Author: Kristof Provost AuthorDate: 2025-06-27 12:30:11 +0000 Commit: Kristof Provost CommitDate: 2025-07-02 07:40:52 +0000 pfctl: Fill netmask AF-independently in print_host() Instead of masking the host address in two different ways, just fill it no matter the address family. In case of AF_INET, setting the extra 96 bit does not hurt. While here, stop resetting `af' for no reason and move up the variable declaration. OK benno sashan Obtained from: OpenBSD, kn , 53f568abff Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pf_print_state.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 821c0745748a..433d1d4e0b7b 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -167,19 +167,14 @@ print_name(struct pf_addr *addr, sa_family_t af) void print_host(struct pf_addr *addr, u_int16_t port, sa_family_t af, int opts) { + struct pf_addr_wrap aw; + if (opts & PF_OPT_USEDNS) print_name(addr, af); else { - struct pf_addr_wrap aw; - memset(&aw, 0, sizeof(aw)); aw.v.a.addr = *addr; - if (af == AF_INET) - aw.v.a.mask.addr32[0] = 0xffffffff; - else { - memset(&aw.v.a.mask, 0xff, sizeof(aw.v.a.mask)); - af = AF_INET6; - } + memset(&aw.v.a.mask, 0xff, sizeof(aw.v.a.mask)); print_addr(&aw, af, opts & PF_OPT_VERBOSE2); } From nobody Wed Jul 2 08:27:11 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXCgN46pLz604gq; Wed, 02 Jul 2025 08:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXCgM71f5z3ZB0; Wed, 02 Jul 2025 08:27:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HRoN4p7o7a62z5tffzBKvUMZ1xFU6pteoVvxqwRg368=; b=rcp0cSxw4rARA1wmGqhGz0MxRJGXmmUmonyyL/0dRuN0Kb+Rwc3wPU+FrXc8+PBM6vGjwH ObzBfNRS4luANzuSrCY8t7uzJlNvetLzpxdyNXow/6UP8gz/6kzYZcbC3cu84TtmN3QC8r D7WGP/GdOJvQHjFifNYlJRVDoOA3IxQwpFQw7cIFBIE+aWPn8So25Vrw8bJ4z3IRvGQ51W wi4tReotYgXhTqZO6viKT2NGvnlt/Ut1rwZtYdO3x7XC4zeyKgIIiA8wl+HcaEVw5P888h 8JWEEaplr+Ufa2mquQhUgMt7prx3zK1c450/dAmywhtm3XlkyiQQ+b3sjug/KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HRoN4p7o7a62z5tffzBKvUMZ1xFU6pteoVvxqwRg368=; b=UThuCD7ctUlF/O+MbwyVeBMklwipMHDQYPa7ciXL5Zarf39Yh01aNBZXWNuDUzSvEKUenf dok13xHpH/yX+Y4MhuDZEvCCZo+qCxV6qsqy6tb6Q7zCS/DpL/uRO3GHU5I2ReJ0pnQFhy oGc2lhSr+/kG+5QVvPA2HAfqNDjMeYRhp5t8IBfJBPNbusrViUnYOS3y8F0E+rsatB5YNq uU0P+PivaLLlWFiyuVcqyS41yUvuH2tZOdWHD3sxuJKN6lH+RtBqdpNtokzVMql6CKgRyH wC6ZSq0nlqh6NvZQDZaNOI8iJ8Ml6Ee+o8dP2Qd8qSjwxPYpuqNZCUqs56vBaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751444832; a=rsa-sha256; cv=none; b=ZJm1WGQQFhMHZdltCNHH8Z2j5nej2CAEh5faR0y+Rri7CP6e5Ncr+B43B39EPDX00XkfOg p2avxbYwBBLEKQrGjJweAB9N+lV1X3D9qn/ghvztRjzJ2529h5dmNrQaVB8ZwkG/RPKA71 LchcApzzMR05QUEre47C8OM0LvxFyC6mhbSQ2WW2YlzEQwhcDn5+t3O96aX0eONezfiBZ0 Zw9UqeQi7L5NVvUJdFf1dvKqxRwe9+CyTUgBQI5rPUIt2+uysYY8tQmXsQLufbgksJK5yH turAlf9cyW9ikOxdLKOQsTHje3wdJD2BS5XF/vhpfWFffXx0qAsvMYreYJ/Liw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXCgM66Q1z1BGJ; Wed, 02 Jul 2025 08:27:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5628RBx7025520; Wed, 2 Jul 2025 08:27:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5628RBSR025517; Wed, 2 Jul 2025 08:27:11 GMT (envelope-from git) Date: Wed, 2 Jul 2025 08:27:11 GMT Message-Id: <202507020827.5628RBSR025517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fb48e6d71b1f - main - pfctl: Remove unused af argument from unmask() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb48e6d71b1fa9085245ceb251d7442f460e58e1 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fb48e6d71b1fa9085245ceb251d7442f460e58e1 commit fb48e6d71b1fa9085245ceb251d7442f460e58e1 Author: Kristof Provost AuthorDate: 2025-06-27 12:33:09 +0000 Commit: Kristof Provost CommitDate: 2025-07-02 07:40:53 +0000 pfctl: Remove unused af argument from unmask() This has been unused for years. While here, zap the duplicate function signature from pfctl.h (already present in pfctl_parser.h); spotted by sashan, thanks. OK sashan Obtained from: OpenBSD, kn , f0bb6ca5dd Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 6 +++--- sbin/pfctl/pf_print_state.c | 4 ++-- sbin/pfctl/pfctl.h | 1 - sbin/pfctl/pfctl_optimize.c | 10 +++++----- sbin/pfctl/pfctl_parser.c | 8 ++++---- sbin/pfctl/pfctl_parser.h | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 9d2fd35ea4ee..f05e5608ba9d 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -3640,9 +3640,9 @@ host : STRING { if (b->af != e->af || b->addr.type != PF_ADDR_ADDRMASK || e->addr.type != PF_ADDR_ADDRMASK || - unmask(&b->addr.v.a.mask, b->af) != + unmask(&b->addr.v.a.mask) != (b->af == AF_INET ? 32 : 128) || - unmask(&e->addr.v.a.mask, e->af) != + unmask(&e->addr.v.a.mask) != (e->af == AF_INET ? 32 : 128) || b->next != NULL || b->not || e->next != NULL || e->not) { @@ -5551,7 +5551,7 @@ expand_label_addr(const char *name, char *label, size_t len, sa_family_t af, sizeof(a)) == NULL) snprintf(tmp, sizeof(tmp), "?"); else { - bits = unmask(&addr->addr.v.a.mask, af); + bits = unmask(&addr->addr.v.a.mask); if ((af == AF_INET && bits < 32) || (af == AF_INET6 && bits < 128)) snprintf(tmp, sizeof(tmp), diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index 433d1d4e0b7b..d0882b04f5f6 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -113,7 +113,7 @@ print_addr(struct pf_addr_wrap *addr, sa_family_t af, int verbose) if (addr->type != PF_ADDR_RANGE && !(PF_AZERO(&addr->v.a.addr, AF_INET6) && PF_AZERO(&addr->v.a.mask, AF_INET6))) { - int bits = unmask(&addr->v.a.mask, af); + int bits = unmask(&addr->v.a.mask); if (bits < (af == AF_INET ? 32 : 128)) printf("/%d", bits); @@ -450,7 +450,7 @@ print_state(struct pfctl_state *s, int opts) } int -unmask(struct pf_addr *m, sa_family_t af) +unmask(struct pf_addr *m) { int i = 31, j = 0, b = 0; u_int32_t tmp; diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index ab24ec7174ec..5abd5ddcdf8f 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -124,7 +124,6 @@ void print_addr_str(sa_family_t, struct pf_addr *); void print_host(struct pf_addr *, u_int16_t p, sa_family_t, int); void print_seq(struct pfctl_state_peer *); void print_state(struct pfctl_state *, int); -int unmask(struct pf_addr *, sa_family_t); int pfctl_cmdline_symset(char *); int pfctl_add_trans(struct pfr_buffer *, int, const char *); diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index b4ffcbebb1bb..b58bace326c2 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -1267,7 +1267,7 @@ add_opt_table(struct pfctl *pf, struct pf_opt_tbl **tbl, sa_family_t af, #ifdef OPT_DEBUG DEBUG("<%s> adding %s/%d", (*tbl)->pt_name, inet_ntop(af, &node_host.addr.v.a.addr, buf, sizeof(buf)), - unmask(&node_host.addr.v.a.mask, af)); + unmask(&node_host.addr.v.a.mask)); #endif /* OPT_DEBUG */ if (append_addr_host((*tbl)->pt_buf, &node_host, 0, 0)) { @@ -1602,8 +1602,8 @@ exclude_supersets(struct pfctl_rule *super, struct pfctl_rule *sub) sub->src.addr.type == PF_ADDR_ADDRMASK && super->src.neg == sub->src.neg && super->af == sub->af && - unmask(&super->src.addr.v.a.mask, super->af) < - unmask(&sub->src.addr.v.a.mask, sub->af) && + unmask(&super->src.addr.v.a.mask) < + unmask(&sub->src.addr.v.a.mask) && super->src.addr.v.a.addr.addr32[0] == (sub->src.addr.v.a.addr.addr32[0] & super->src.addr.v.a.mask.addr32[0]) && @@ -1630,8 +1630,8 @@ exclude_supersets(struct pfctl_rule *super, struct pfctl_rule *sub) sub->dst.addr.type == PF_ADDR_ADDRMASK && super->dst.neg == sub->dst.neg && super->af == sub->af && - unmask(&super->dst.addr.v.a.mask, super->af) < - unmask(&sub->dst.addr.v.a.mask, sub->af) && + unmask(&super->dst.addr.v.a.mask) < + unmask(&sub->dst.addr.v.a.mask) && super->dst.addr.v.a.addr.addr32[0] == (sub->dst.addr.v.a.addr.addr32[0] & super->dst.addr.v.a.mask.addr32[0]) && diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 439c75b7c98f..401404865986 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1367,7 +1367,7 @@ check_netmask(struct node_host *h, sa_family_t af) if (af == AF_INET && (m->addr32[1] || m->addr32[2] || m->addr32[3])) { fprintf(stderr, "netmask %u invalid for IPv4 address\n", - unmask(m, AF_INET6)); + unmask(m)); return (1); } } @@ -1392,7 +1392,7 @@ gen_dynnode(struct node_host *h, sa_family_t af) /* fix up netmask */ m = &n->addr.v.a.mask; - if (af == AF_INET && unmask(m, AF_INET6) > 32) + if (af == AF_INET && unmask(m) > 32) set_ipmask(n, 32); return (n); @@ -1755,7 +1755,7 @@ ifa_lookup(char *ifa_name, int flags) memcpy(&n->addr.v.a.addr, &p->addr.v.a.addr, sizeof(struct pf_addr)); if (flags & PFI_AFLAG_NETWORK) - set_ipmask(n, unmask(&p->addr.v.a.mask, n->af)); + set_ipmask(n, unmask(&p->addr.v.a.mask)); else { if (n->af == AF_INET && p->ifa_flags & IFF_LOOPBACK && @@ -2055,7 +2055,7 @@ append_addr_host(struct pfr_buffer *b, struct node_host *n, int test, int not) bzero(&addr, sizeof(addr)); addr.pfra_not = n->not ^ not; addr.pfra_af = n->af; - addr.pfra_net = unmask(&n->addr.v.a.mask, n->af); + addr.pfra_net = unmask(&n->addr.v.a.mask); switch (n->af) { case AF_INET: addr.pfra_ip4addr.s_addr = n->addr.v.a.addr.addr32[0]; diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 8ab331561c7d..91c0f655e008 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -363,7 +363,7 @@ extern const struct pf_timeout pf_timeouts[]; void set_ipmask(struct node_host *, int); int check_netmask(struct node_host *, sa_family_t); -int unmask(struct pf_addr *, sa_family_t); +int unmask(struct pf_addr *); struct node_host *gen_dynnode(struct node_host *, sa_family_t); void ifa_load(void); unsigned int ifa_nametoindex(const char *); From nobody Wed Jul 2 08:27:12 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXCgP1dvqz604dk; Wed, 02 Jul 2025 08:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXCgP03Rpz3ZRZ; Wed, 02 Jul 2025 08:27:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UaepyVyBInXOuGeVHmcMn+xnEtYRwtmQX6SrOpGFp80=; b=B05Op5ASHqImSf2kHmZexnnyFMDGT2POC1Eluk8Xc/h3ZdmBCPe5CimJRkD6nifmkN7Yr/ kGUoDTdydgJzzxiRMzCNtksgCqJFYAlC0s37o21arfK4SwC+ehNC1Z3bQnvKId1dfOBH7R RionUCXwE7doS7sn0EhTQvqILwHFRRTWXSKfUEaVnrv8gWX6ZXbDdIokhZXrVvfYT2CJ7C fv49sC1yLP63aJjltE4lwmhY4dkaEclXh6hTf7M5yAteeEVUlwq8XvMzf3WIJ7Df43MUkd pEn4TX3nhlX4N1j44Txa8qp8Mt3y2TpqjqSr8+5EhoG+X+yGBAStBX2nK25ptQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UaepyVyBInXOuGeVHmcMn+xnEtYRwtmQX6SrOpGFp80=; b=Pik8jt/1d5PI14ZfxjaKFAeooX/HvKCUdEHs+NO4J6WIpVvonBUip3os/21r/5hvDVBxn1 iAJuuC/gOgXGBq37zSnSDZMomXf1h98FyoXTNFsmYXzf28ax2eBCKNuYm3BYqsMe/xlKXA D04d+APqdjV9cI2S4cu7JKeyrnWkqCdoKTPt0PDI6hQFs8B0GZTX94mQKN5n6L1InCGgWZ x92GJAGEoUtOjvmVDweB82Snld0c+d/lMGImGQEQTyY7Hm79NkFQFmIA4buRprWHZFIuA1 L74JaX97XFMJvtGewQ+5u33EpRGUBhG6/dzlRVi0LjejocvgjJLNOu/sQ9+1TA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751444833; a=rsa-sha256; cv=none; b=w+5+865HdpYKXszOv7SsQQZxLpzw6mViy3pCQAscyy8ksg+5ZD3xUwuMZ5NdL+Ax5+szEk 88yyZcDKn5gC+dxmUYJYybPQqZZsXOTVSiEyl9tTnIDCav6zM+6tvxix38KKMer2wcOGyw HkOF8VoDiSrUY6p8YW0FfqeT+8fFkf2LoYFxuZFy30VkdCRYNXyuBC/FOyS8bFcrf9iqsk 5I9Cod14Km8Edt0C/VIWHIB0/Q6rXgw/G54IBFp0oVPm+4w0yv5q16PWTDR57lOmXzhzT+ UXimURrw7pfuxWODA9E7hxbCo5P+pRCgcp9J2QWaxZeDvDK1US/b+dNgd728Vw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXCgN6mTQz1BVL; Wed, 02 Jul 2025 08:27:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5628RCPl025552; Wed, 2 Jul 2025 08:27:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5628RC3j025549; Wed, 2 Jul 2025 08:27:12 GMT (envelope-from git) Date: Wed, 2 Jul 2025 08:27:12 GMT Message-Id: <202507020827.5628RC3j025549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 080e8cad4362 - main - pfctl: Make print_hostname() less AF-specific List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 080e8cad436207a3c09a3c32460e0a0dc7b0a999 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=080e8cad436207a3c09a3c32460e0a0dc7b0a999 commit 080e8cad436207a3c09a3c32460e0a0dc7b0a999 Author: Kristof Provost AuthorDate: 2025-06-27 12:35:35 +0000 Commit: Kristof Provost CommitDate: 2025-07-02 07:40:53 +0000 pfctl: Make print_hostname() less AF-specific Reduce differences address families and replace strlcpy() with simpler if/else logic as done in print_addr_str(). OK sashan Obtained from: OpenBSD, kn , 7fdc021ee4 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pf_print_state.c | 48 ++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/sbin/pfctl/pf_print_state.c b/sbin/pfctl/pf_print_state.c index d0882b04f5f6..5abdc2de419d 100644 --- a/sbin/pfctl/pf_print_state.c +++ b/sbin/pfctl/pf_print_state.c @@ -134,34 +134,28 @@ print_addr_str(sa_family_t af, struct pf_addr *addr) void print_name(struct pf_addr *addr, sa_family_t af) { - char host[NI_MAXHOST]; - - strlcpy(host, "?", sizeof(host)); - switch (af) { - case AF_INET: { - struct sockaddr_in sin; - - memset(&sin, 0, sizeof(sin)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - sin.sin_addr = addr->v4; - getnameinfo((struct sockaddr *)&sin, sin.sin_len, - host, sizeof(host), NULL, 0, NI_NOFQDN); - break; - } - case AF_INET6: { - struct sockaddr_in6 sin6; - - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_len = sizeof(sin6); - sin6.sin6_family = AF_INET6; - sin6.sin6_addr = addr->v6; - getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len, - host, sizeof(host), NULL, 0, NI_NOFQDN); - break; - } + struct sockaddr_storage ss; + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; + char host[NI_MAXHOST]; + + memset(&ss, 0, sizeof(ss)); + ss.ss_family = af; + if (ss.ss_family == AF_INET) { + sin = (struct sockaddr_in *)&ss; + sin->sin_len = sizeof(*sin); + sin->sin_addr = addr->v4; + } else { + sin6 = (struct sockaddr_in6 *)&ss; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_addr = addr->v6; } - printf("%s", host); + + if (getnameinfo((struct sockaddr *)&ss, ss.ss_len, host, sizeof(host), + NULL, 0, NI_NOFQDN) != 0) + printf("?"); + else + printf("%s", host); } void From nobody Wed Jul 2 08:27:14 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXCgQ6Rcyz604D3; Wed, 02 Jul 2025 08:27:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXCgQ1GJJz3Z83; Wed, 02 Jul 2025 08:27:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ALTZr2IJJCg847SIugbTYjFrBb0urLLYwrOUhd4DGeo=; b=rsxsYXap2mqSq6EEhO5k4ZeQbEesZWTwMb3d9ciiQORMj6G+2r0jsQgwdLaPlLrCisdKFH mNVoht3u7Ihaj9A9SdLCYcbpDAAKqm1j0f2GJnLTQV4yPD0EeQSSrzBes95HDJkSTi4SMz f90Mbu0lp5MIvGlsolR6Kqz/pj+/BCfxBjplm/4xnAS9o3/rOICb+KxuUFF4b9Lj8s0Khn 5r+1hknygweo9klLlfXlFXgGtzYZJnWmlmszFMh1rdJ2nikki4AsdN08OlrkDeYT7dnB9f HNwhSYdi3CSTzkYjBsfVWA0fc5vtNSDUYOP1okSE5VbbxuA6+7A+izV6FD+Ihg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ALTZr2IJJCg847SIugbTYjFrBb0urLLYwrOUhd4DGeo=; b=K8LfPsFIYEWMbAZ73D8oMZniTZPGihted5eXKqyxCqo3lPpx73rD/uBS4t0CxOHIpFeCLw Cad/5/W8uVtow0HRs7OYqZ3taUdSs66Ta8VVUlTRC/2Om+ISCQjBWWTIwdSBXKbDLnZYcw DSmVjVh3pXyQzleD9Ao3BK5KaffMwjohBNsvfbq7LE0+osrkRzQ1CN4rg/Hw/VYr7zRA5x AM4+dewaiHXxvNpR5BjI1QnzcqMmo93Wts5UoDx3fzKHj8Je/R5PwA51EoOzuaaTzDz5N9 hj13fxzIhp+o4SMFwPGBBi2J6QeHlQ5ZirGeb2UyoAhohutpm6mRre46J3iCSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751444834; a=rsa-sha256; cv=none; b=jhpNa8NIKC2jApFsOOymmF594XopxNqGm4dk2pIyC3seqrGfTKFBGhBcS6khIv8bDsgxHo GegZhhVsT4z7FeKPYQWMnLUGMENsPla1QaE5T58sLLNF0UHSCPdeZN+4rh0OPMq7CJ8rTf RwPV4x4m5dm5LyNO85E1ATlz0EUKWJRumQb8FIRowxvwLmafkEe5p9RHlP+2LPL0DyvVx2 9AMxd9tsI/d/OFT4ZUDJDb66rzuWHg/Errrn+ThrJKsx33n+0oKraPAEs1D9c1XIOyvBdx vSHPxwfWVTxTxm933/7mc4T+HtnwBxjt38NPqIjRwQhLtG8ZxZUA24b2iL/qpg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXCgQ0sj1z1B89; Wed, 02 Jul 2025 08:27:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5628REjq025584; Wed, 2 Jul 2025 08:27:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5628REVM025581; Wed, 2 Jul 2025 08:27:14 GMT (envelope-from git) Date: Wed, 2 Jul 2025 08:27:14 GMT Message-Id: <202507020827.5628REVM025581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 35f70f6a33ff - main - pfctl: Remove wildcard address on loopack remnants List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35f70f6a33ff9651974878ff9290dbb97d5f7888 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=35f70f6a33ff9651974878ff9290dbb97d5f7888 commit 35f70f6a33ff9651974878ff9290dbb97d5f7888 Author: Kristof Provost AuthorDate: 2025-06-27 12:40:21 +0000 Commit: Kristof Provost CommitDate: 2025-07-02 07:40:53 +0000 pfctl: Remove wildcard address on loopack remnants henning@ removed this functionality years ago, see the share/man/man4/lo.4 revision 1.27. OK jca claudio Obtained from: OpenBSD, kn , 436479f1d8 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 401404865986..871a18ca6c28 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1756,15 +1756,8 @@ ifa_lookup(char *ifa_name, int flags) sizeof(struct pf_addr)); if (flags & PFI_AFLAG_NETWORK) set_ipmask(n, unmask(&p->addr.v.a.mask)); - else { - if (n->af == AF_INET && - p->ifa_flags & IFF_LOOPBACK && - p->ifa_flags & IFF_LINK1) - memcpy(&n->addr.v.a.mask, &p->addr.v.a.mask, - sizeof(struct pf_addr)); - else - set_ipmask(n, -1); - } + else + set_ipmask(n, -1); n->ifindex = p->ifindex; n->ifname = strdup(p->ifname); From nobody Wed Jul 2 08:27:15 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXCgR3sS2z604k4; Wed, 02 Jul 2025 08:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXCgR1Zcdz3ZLN; Wed, 02 Jul 2025 08:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VAeBmX1BNijua9rxEtLRPMJIcG4OybqaxiTRrAIyCa8=; b=cjjig199gN3DoNwexS2RMf6bfSZr6am9OVavi9B9f6BVF8xfkjzuyGBNVVZ6yEB22BGfXp UZ5zvWB7VNSDbY+19a1rIYuwdGrtw/ywmG0fgYRew8RVX15eEBlE3cm6rvEzkbgUnnuAvb ickwQyY7iQAj1qjcL7OI1d1/GY4x8d3F8VmEfXn2akPI2X4Fi/MLnlT9uWq3Z8NaqMTRve oNA1kQzNU2qc1WpnPvEEChAIg4IvN2i0qW4YqKxzDNc/O1U1i8D+ebPfud2ZFBLWrNqOLn T6NegUWhIbkGToshbB9sN9uSVQd/d3/MmYcdkDhgZCTFC6wa58onMV19AeYXgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VAeBmX1BNijua9rxEtLRPMJIcG4OybqaxiTRrAIyCa8=; b=vzvu1/SghrRHBXphImuvQDqazwQj08Ay2vy4xJ4wlN5rPikGKU6H/NaNHXbGtbgG3ynXXC meVUe9iqlpCKiffX8HjK+0ScKQ9mw3Gts+QAa+BFQlXVGYWcul3hD0sRSH5caXfQXYlEP8 vJOi1uSo8Ky1gDwm1hyTHO9TCVc4wz5RhUoUNPvQS9izAdX2AAjUoexfRDNN/VxgbEh22s ztP+BjwqsBUQ6OQrHjvmHkIuTbPAVKAicsKjXxjtmSqDZmWx5t9niUYlqtIXgbK4VJPXiN 5XCA4l3nh65a3fSChav9k8FsJ+lsz05GRJk6LqN7wOjVrkPiQqq4dLbvRiF7/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751444835; a=rsa-sha256; cv=none; b=eNsMGFuYOSn93lqMIxVYFdfBwtZqnCT1rUFVXRsgmfIS0gUemrC8V/9e8XoNBQZOFjM6dy 9xkuG1P2pG82FlTLIDsShh+0mC2BxQgh/dxR2zNdUwv0Ke/Tqely4vPDXZcfLS0XCFwdhK gHGvbnIWWjFfkrJRY1/qRxHwI7R4QjnTajAvqYQp+4h97j2mpSE5o24eOCwbmtfQ7NV1JH /hX3Q5jx+xCziZ62rGQYQhP7SSHLeLrCKWfSTJ+ftcPrjjXQ0goexe3ey3lj6ZFaN2Qnjr 5e5ylkkH5oUI1px42opbcEe6IZkbXT41eBcmIiic3fpRyoFiM8R+VS9+R6Jv5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXCgR19lxz1B4n; Wed, 02 Jul 2025 08:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5628RFv8025616; Wed, 2 Jul 2025 08:27:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5628RFO9025614; Wed, 2 Jul 2025 08:27:15 GMT (envelope-from git) Date: Wed, 2 Jul 2025 08:27:15 GMT Message-Id: <202507020827.5628RFO9025614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: dd2d7ba6f338 - main - pfctl: Fix function name in error messages by using __func__ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd2d7ba6f338925af00883220a03d86c4e9d0307 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dd2d7ba6f338925af00883220a03d86c4e9d0307 commit dd2d7ba6f338925af00883220a03d86c4e9d0307 Author: Kristof Provost AuthorDate: 2025-06-27 12:43:54 +0000 Commit: Kristof Provost CommitDate: 2025-07-02 07:40:53 +0000 pfctl: Fix function name in error messages by using __func__ Obtained from: OpenBSD, kn , 91a155f4b6 Obtained from: OpenBSD, kn , f79f34e142 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.c | 22 +++++++++++----------- sbin/pfctl/pfctl_parser.c | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 8b76b0c3fdfd..926c18ee5dbc 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -2252,8 +2252,8 @@ int pfctl_rules(int dev, char *filename, int opts, int optimize, char *anchorname, struct pfr_buffer *trans) { -#define ERR(x) do { warn(x); goto _error; } while(0) -#define ERRX(x) do { warnx(x); goto _error; } while(0) +#define ERR(...) do { warn(__VA_ARGS__); goto _error; } while(0) +#define ERRX(...) do { warnx(__VA_ARGS__); goto _error; } while(0) struct pfr_buffer *t, buf; struct pfioc_altq pa; @@ -2288,10 +2288,10 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, memset(&pf, 0, sizeof(pf)); memset(&trs, 0, sizeof(trs)); if ((path = calloc(1, MAXPATHLEN)) == NULL) - ERRX("pfctl_rules: calloc"); + ERRX("%s: calloc", __func__); if (strlcpy(trs.pfrt_anchor, anchorname, sizeof(trs.pfrt_anchor)) >= sizeof(trs.pfrt_anchor)) - ERRX("pfctl_rules: strlcpy"); + ERRX("%s: strlcpy", __func__); pf.dev = dev; pf.h = pfh; pf.opts = opts; @@ -2300,16 +2300,16 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, /* non-brace anchor, create without resolving the path */ if ((pf.anchor = calloc(1, sizeof(*pf.anchor))) == NULL) - ERRX("pfctl_rules: calloc"); + ERRX("%s: calloc", __func__); rs = &pf.anchor->ruleset; pf_init_ruleset(rs); rs->anchor = pf.anchor; if (strlcpy(pf.anchor->path, anchorname, sizeof(pf.anchor->path)) >= sizeof(pf.anchor->path)) - errx(1, "pfctl_rules: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(pf.anchor->name, anchorname, sizeof(pf.anchor->name)) >= sizeof(pf.anchor->name)) - errx(1, "pfctl_rules: strlcpy"); + errx(1, "%s: strlcpy", __func__); pf.astack[0] = pf.anchor; @@ -2322,14 +2322,14 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, /* Set up ethernet anchor */ if ((pf.eanchor = calloc(1, sizeof(*pf.eanchor))) == NULL) - ERRX("pfctl_rules: calloc"); + ERRX("%s: calloc", __func__); if (strlcpy(pf.eanchor->path, anchorname, sizeof(pf.eanchor->path)) >= sizeof(pf.eanchor->path)) - errx(1, "pfctl_rules: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(pf.eanchor->name, anchorname, sizeof(pf.eanchor->name)) >= sizeof(pf.eanchor->name)) - errx(1, "pfctl_rules: strlcpy"); + errx(1, "%s: strlcpy", __func__); ethrs = &pf.eanchor->ruleset; pf_init_eth_ruleset(ethrs); @@ -2343,7 +2343,7 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, * loaded at parse time. */ if (pfctl_ruleset_trans(&pf, anchorname, pf.anchor, true)) - ERRX("pfctl_rules"); + ERRX("%s", __func__); if (pf.loadopt & PFCTL_FLAG_ETH) pf.eth_ticket = pfctl_get_ticket(t, PF_RULESET_ETH, anchorname); if (altqsupport && (pf.loadopt & PFCTL_FLAG_ALTQ)) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 871a18ca6c28..6b47d75f77f3 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1483,7 +1483,7 @@ ifa_load(void) continue; n = calloc(1, sizeof(struct node_host)); if (n == NULL) - err(1, "address: calloc"); + err(1, "%s: calloc", __func__); n->af = ifa->ifa_addr->sa_family; n->ifa_flags = ifa->ifa_flags; #ifdef __KAME__ @@ -1540,7 +1540,7 @@ ifa_load(void) ifa->ifa_addr)->sdl_index; } if ((n->ifname = strdup(ifa->ifa_name)) == NULL) - err(1, "ifa_load: strdup"); + err(1, "%s: strdup", __func__); n->next = NULL; n->tail = n; if (h == NULL) @@ -1743,7 +1743,7 @@ ifa_lookup(char *ifa_name, int flags) got6 = 1; n = calloc(1, sizeof(struct node_host)); if (n == NULL) - err(1, "address: calloc"); + err(1, "%s: calloc", __func__); n->af = p->af; if (flags & PFI_AFLAG_BROADCAST) memcpy(&n->addr.v.a.addr, &p->bcast, From nobody Wed Jul 2 08:27:16 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXCgS705wz604Vl; Wed, 02 Jul 2025 08:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXCgS3KKQz3ZFP; Wed, 02 Jul 2025 08:27:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QaNk0dbU4N1uFcqJlHnZ3o6J3PezR41v6oCQcGfioU0=; b=kHqU5MeY80AZhn26Jpr/dOC7ge0u74YfqwuRUemnW8Go88UpaBp42DD3AfKv6ziSEGVQa5 D6RoP8eQ46zoIOk8hECwd9rJ7NonqR5EldRIwd/boM3kBQM/DelJ5m3xaJbLORUCtJtprB u9SeQooBaImuinMMad+Yo6SlWVjFTP8veydGJw5oZuw6l4qWJWGhW0zReYVL00iO0woKQ8 s+5xj2Dz0gK9cA9v5WxaEOePkbdObSxpTD8PA/Q11UgMYam5/7eWwtm0YkBsKEOSHMbBWt dP4N78C2Ga9ByfVazHgWbRyy/jHUo5G2h6nf3Roudp8/xJ4vujoGzHZepytDYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QaNk0dbU4N1uFcqJlHnZ3o6J3PezR41v6oCQcGfioU0=; b=TpzYxEFw/eUaWn7LgOdpEVNoy+21x7tZ3PrBKvNm4KIQUOlOs77Fxqlbjb2Mp21Q/z0Asm B1+Qg0vLxmBhoenwdtZcORH6HfqJxwsW+IymkS/SnTo7fogV/qLXZ+zWITJsS4amxlCIdl etYgNFjosC4mdjnyrd89xpwtETzICogqXq9fMwf8gFDQy8pR6M1mD3dDBE15ZWcekPrDZh K8AddVV9hBDQRerHtfmJ3kP84JNsK8GlkjBK+FpZQRX8T9EudY7ddQI55GY1aEciXR7E0y wLlaGGvuYEZ+7RCumTAkCM8womxxeRNfinQZjD9c3yApAobc0VkCSnqBEb8i2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751444836; a=rsa-sha256; cv=none; b=g9HMkVBbpG919SPxRBy1IKlGLxQP6Jlg+ZYjG+nsUvWA/oLqAHNXUOmVyCYUY0MqkBv9cC cUP2+8an4EJfv7AmO2MwN8JgwhxzNJBZWogCXExWZOyXoJ91toqfmotdWbiQsk/mtg7WHd ZftOVkM9Llrv/CMR3rEEAsnP9yoqhCkDXd142wdvOvdVgG577KLevpXAzbYp8qwtDq32iC eV2SgiAK3AyjJnHu5XARKJ9083ElGKQVGIn0ecS/Bzroe5jiDwCNrSvpsmrdfPUpExJLoT 1jNT/B0kmfTeDaAfUzCJybfGBEj6lI2Xk7hUntYZRuKjHnsGPIUttfG9DKBRzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXCgS2PPTz1BPB; Wed, 02 Jul 2025 08:27:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5628RG49025655; Wed, 2 Jul 2025 08:27:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5628RGUi025652; Wed, 2 Jul 2025 08:27:16 GMT (envelope-from git) Date: Wed, 2 Jul 2025 08:27:16 GMT Message-Id: <202507020827.5628RGUi025652@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 725e65580a0e - main - pfctl: Error out early on bad anchor usage List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 725e65580a0ec14992f41c93dba78c181de179d3 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=725e65580a0ec14992f41c93dba78c181de179d3 commit 725e65580a0ec14992f41c93dba78c181de179d3 Author: Kristof Provost AuthorDate: 2025-06-27 14:21:09 +0000 Commit: Kristof Provost CommitDate: 2025-07-02 07:40:53 +0000 pfctl: Error out early on bad anchor usage `pfctl -a foo' would do nothing with the non-existent anchor and exit 0. This implements behaviour as documented in pfctl(8): -a anchor Apply flags -f, -F, and -s only to the rules in the specified anchor. While here, hoist a duplicate "_" check by using the more mnemonic `mode'. OK henning sashan Obtained from: OpenBSD, kn , 574cdb686a Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 926c18ee5dbc..79076fc69776 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -3198,6 +3198,15 @@ main(int argc, char *argv[]) if (anchoropt != NULL) { int len = strlen(anchoropt); + if (mode == O_RDONLY && showopt == NULL) { + warnx("anchors apply to -f, -F and -s only"); + usage(); + } + if (mode == O_RDWR && + (anchoropt[0] == '_' || strstr(anchoropt, "/_") != NULL)) + errx(1, "anchor names beginning with '_' cannot " + "be modified from the command line"); + if (len >= 1 && anchoropt[len - 1] == '*') { if (len >= 2 && anchoropt[len - 2] == '/') anchoropt[len - 2] = '\0'; @@ -3329,10 +3338,6 @@ main(int argc, char *argv[]) } if (clearopt != NULL) { - if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL) - errx(1, "anchor names beginning with '_' cannot " - "be modified from the command line"); - switch (*clearopt) { case 'e': pfctl_flush_eth_rules(dev, opts, anchorname); @@ -3423,9 +3428,6 @@ main(int argc, char *argv[]) error = 1; if (rulesopt != NULL) { - if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL) - errx(1, "anchor names beginning with '_' cannot " - "be modified from the command line"); if (pfctl_rules(dev, rulesopt, opts, optimize, anchorname, NULL)) error = 1; From nobody Wed Jul 2 08:27:17 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXCgT6S5tz604dp; Wed, 02 Jul 2025 08:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXCgT3mMQz3ZSH; Wed, 02 Jul 2025 08:27:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LX5ggjcVnaegE88UlVz+VnBBJqqUotX/7hgU60bR2Ws=; b=E6VyHoprHbe+i3HPE5H+m/o/ZrVo3SvnY/Ta0VUHVNzJbeUO5aXPbYaRBPrc4HcWb1psze KXQYWMB8zucpLfzJms7SzUnbPq6cZo2Da2LsR01/s531SYUJDpJZorsfxQu1xEyQqheMFG eZDbXmqkOlagS84/SOCWtOPSAGPf47EUb9voC/8MMlegEh0AHA1tC7Cnvfzx7rEXpV9XPs DnY+GZI0wWsMlmDio+28Z1lQxK22X7v9VFWgNAG/ihnFH7yv5T94hCypFvHLX4vRLY98C9 Q6TauBtPxQfUS8j2zpjVepfQPn5GmlKE1AQOZMYnf2/D4Ta5UV81d4pRDkqgeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LX5ggjcVnaegE88UlVz+VnBBJqqUotX/7hgU60bR2Ws=; b=WK/e1rI3D85brnCFJTIx2nPtN3bIpuuDMlnrqWdRqBp7dGdCJw9b0PqhSLef9phxU2WhHa riOkPrtjtcZywz0H7RhgW/YOOvBRkMFi3jY95jNQ0easbB8AIB/CurtfU9dFkbQUuweL6d w68kH2RqdeKGqEYw715BDynsQ003DVWoiLXzo//x+61pNZv7LAKN0UyfDb6SGerN76cDHA S8M4THMynDeCZt1DsWQ41llagA7jaXZwoQLZflBuWOT04vCLnXfeSeNQrVY4ywxVbRnTYu QNljvp1T+hB4TVdVa8iay8WPwuTurAYS8iYlnpWmpMCHmTr+dQhP78Js2SLLgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751444837; a=rsa-sha256; cv=none; b=yuxRnWNwExKK1x164MWaJt9dvrJfBMmB6/dF+F9jenjEi2hMEw2z8GR/Ual3ztTHVY8mpJ 1oAj+wkEruOTyIVCR0AMzXulWnSF28jVexXlv1Oy5yGGXJNV6A7uJ46gLOrwZ13EWZS4Q9 XkzLrvhCKHWroqdu3BQ/0k399bVjMxgkFsO0wcc4LLOd1TiESJDo/nSuYXzLaVCERLnKP5 xKH7hkzanhr5CedkfXccItOqMrwCR3+ZbtwyZjR48Sj35tmu8TW6Ud/LoMwmX9hfJlgToK UKAa8KbDLk9j7/5vFvg1Tr7/ggpxYNY3bvhw8UwTzFCdD+y+llP5yBg1RP/h8g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXCgT3N3cz1BVM; Wed, 02 Jul 2025 08:27:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5628RHAB025688; Wed, 2 Jul 2025 08:27:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5628RHoE025685; Wed, 2 Jul 2025 08:27:17 GMT (envelope-from git) Date: Wed, 2 Jul 2025 08:27:17 GMT Message-Id: <202507020827.5628RHoE025685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5c9b1c7e5f27 - main - pfctl: Allocate path only when needed, use __func__ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c9b1c7e5f271a18ed07b595240b487509bdcac3 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5c9b1c7e5f271a18ed07b595240b487509bdcac3 commit 5c9b1c7e5f271a18ed07b595240b487509bdcac3 Author: Kristof Provost AuthorDate: 2025-06-27 14:25:53 +0000 Commit: Kristof Provost CommitDate: 2025-07-02 07:40:54 +0000 pfctl: Allocate path only when needed, use __func__ Obtained from: OpenBSD, kn , e56235b48a Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 79076fc69776..21befd3ca697 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -3192,8 +3192,6 @@ main(int argc, char *argv[]) if (loadopt == 0) loadopt = ~0; - if ((path = calloc(1, MAXPATHLEN)) == NULL) - errx(1, "pfctl: calloc"); memset(anchorname, 0, sizeof(anchorname)); if (anchoropt != NULL) { int len = strlen(anchoropt); @@ -3247,6 +3245,9 @@ main(int argc, char *argv[]) if (pfctl_disable(dev, opts)) error = 1; + if ((path = calloc(1, MAXPATHLEN)) == NULL) + errx(1, "%s: calloc", __func__); + if (showopt != NULL) { switch (*showopt) { case 'A': From nobody Wed Jul 2 10:02:21 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXFn9733kz60C4P; Wed, 02 Jul 2025 10:02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXFn95rn6z496b; Wed, 02 Jul 2025 10:02:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751450541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jiWX6DTjcTbzgOZ6K7BTKkgMRNoog8CjfR+783xz9p0=; b=ZavJT7XR4mUheNSaV2YEolA4E1g57zawJGcT2Okbw82MdQZL0HWbAGfwswV4SuSC1s/WzT vZ1SkekMNLCBn6tdYgpY60C/a7sxTx3Z43usOztpPzteoDhuaqACLbc6E+YeQZNTpMuA5x lvismlhVgeU1eaPruUZhVvvwndVzRS2wQ7rGKQrVbAQQD4Ho3ihHQ/YpRx1cYiZcg77heH Tg3ufJGTlD51SYy+j7CUV5SLINDXd6dOoOwnnYDUUmlQ7h/Sbg/7bzfJJgIKBR+IPWhK3z koauNX8xppkJXA8pOj7/2JGkJ5DoPRm5lWNVLMsVNl/CAGnKcSt9AzIMm2+WwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751450541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jiWX6DTjcTbzgOZ6K7BTKkgMRNoog8CjfR+783xz9p0=; b=U7wfZXw3FVLSnMYR4t0gQpT3m80xremWzfSmSAndPLtiNUP/BogQAv23S7f2sOZj9TAwZc dFzWYtBh1aGmIac4CxGPQjZLpQxd7dZo1g1aNzwxCL+VExX/YfARmsN2UEhcyoF/ULvnL8 iFnFzkIdp9nOYd8aYENB3IPfYi5nol0c9DtA4qbIiB6T+uU1IV6N5I7tQNgFh5UTgKSI49 zdeWYnuodHFl337DH7PH0y55GzPKneY6ohGK8cHbLsOpuIAjCPbrDFBHlS49BeKWFjlzZV 89STmxqyV5u/YV5BaIa75GJaM/8rcQkmLdKiquUySPBY6/fxjc1jdlF8rcBE7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751450541; a=rsa-sha256; cv=none; b=UD/lsU0h/Cf9dl5/0Zlr+W0tI43OsodETyisr6RsGqgyAj7hPZJQ0stQUCxW1ZshkBLYzK CJc6neoBEo/zWJ04vE1cEtbV/a/SK+WjvLfjLrJW0W6/L8l4FNEyYgCnr/Yn5kcbESaXQ5 UcF6fyuipoR2ClYWoxd6BWlwD9kL98QV2AWFicquHIPYFMH/YGGcLodMk6alR0F/JrwYIy w3UzxS/cOLigxJjtUhcMFHBfMNWOaxWxifVvDafGGwvJZjh8f2SS3XgYW1sbEBn1fCODYk cihC4jsNyZIDkPYiX/7QNroWBKR7cjO1ICY1vihf2qX44rGSlF9kWHTF/pD/UA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXFn95PwbzK0; Wed, 02 Jul 2025 10:02:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562A2LG3012139; Wed, 2 Jul 2025 10:02:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562A2LAt012136; Wed, 2 Jul 2025 10:02:21 GMT (envelope-from git) Date: Wed, 2 Jul 2025 10:02:21 GMT Message-Id: <202507021002.562A2LAt012136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: e80cb2254414 - main - arm64: Export the pointer auth ID fields List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e80cb2254414018d41b00004fe7c7ccf828e0fbc Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e80cb2254414018d41b00004fe7c7ccf828e0fbc commit e80cb2254414018d41b00004fe7c7ccf828e0fbc Author: Andrew Turner AuthorDate: 2025-06-28 01:58:01 +0000 Commit: Andrew Turner CommitDate: 2025-07-02 09:49:01 +0000 arm64: Export the pointer auth ID fields Set the pointer authentication ID fields and HWCAPs for userspace when it is present. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D50982 --- sys/arm64/arm64/identcpu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 123aeeb090dd..49b4b25b51bb 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -1029,9 +1029,9 @@ static const struct mrs_field id_aa64isar1_fields[] = { id_aa64isar1_sb, id_aa64isar1_sb_caps), MRS_FIELD_HWCAP(ID_AA64ISAR1, FRINTTS, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar1_frintts, id_aa64isar1_frintts_caps), - MRS_FIELD_HWCAP(ID_AA64ISAR1, GPI, false, MRS_LOWER, 0, + MRS_FIELD_HWCAP(ID_AA64ISAR1, GPI, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar1_gpi, id_aa64isar1_gpi_caps), - MRS_FIELD_HWCAP(ID_AA64ISAR1, GPA, false, MRS_LOWER, 0, + MRS_FIELD_HWCAP(ID_AA64ISAR1, GPA, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar1_gpa, id_aa64isar1_gpa_caps), MRS_FIELD_HWCAP(ID_AA64ISAR1, LRCPC, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar1_lrcpc, id_aa64isar1_lrcpc_caps), @@ -1039,9 +1039,9 @@ static const struct mrs_field id_aa64isar1_fields[] = { id_aa64isar1_fcma, id_aa64isar1_fcma_caps), MRS_FIELD_HWCAP(ID_AA64ISAR1, JSCVT, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar1_jscvt, id_aa64isar1_jscvt_caps), - MRS_FIELD_HWCAP(ID_AA64ISAR1, API, false, MRS_LOWER, 0, + MRS_FIELD_HWCAP(ID_AA64ISAR1, API, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar1_api, id_aa64isar1_api_caps), - MRS_FIELD_HWCAP(ID_AA64ISAR1, APA, false, MRS_LOWER, 0, + MRS_FIELD_HWCAP(ID_AA64ISAR1, APA, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar1_apa, id_aa64isar1_apa_caps), MRS_FIELD_HWCAP(ID_AA64ISAR1, DPB, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar1_dpb, id_aa64isar1_dpb_caps), @@ -1146,9 +1146,9 @@ static const struct mrs_field id_aa64isar2_fields[] = { id_aa64isar2_pac_frac), MRS_FIELD(ID_AA64ISAR2, BC, false, MRS_LOWER, 0, id_aa64isar2_bc), MRS_FIELD(ID_AA64ISAR2, MOPS, false, MRS_LOWER, 0, id_aa64isar2_mops), - MRS_FIELD_HWCAP(ID_AA64ISAR2, APA3, false, MRS_LOWER, 0, + MRS_FIELD_HWCAP(ID_AA64ISAR2, APA3, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar2_apa3, id_aa64isar2_apa3_caps), - MRS_FIELD_HWCAP(ID_AA64ISAR2, GPA3, false, MRS_LOWER, 0, + MRS_FIELD_HWCAP(ID_AA64ISAR2, GPA3, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar2_gpa3, id_aa64isar2_gpa3_caps), MRS_FIELD_HWCAP(ID_AA64ISAR2, RPRES, false, MRS_LOWER, MRS_USERSPACE, id_aa64isar2_rpres, id_aa64isar2_rpres_caps), From nobody Wed Jul 2 10:02:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXFnC0Xb6z60Bbx; Wed, 02 Jul 2025 10:02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXFnB6ZJvz497T; Wed, 02 Jul 2025 10:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751450542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OshVBVWoEI6VnWzGPcGStWu/A9mFXeeRmnVU8Flhq40=; b=lwXpeZZmPZUGdzVPpKzxfuhnGJC/G9vwtVoIuHikQkQ0TOPUCKn9zHumDYUnWLmnoK4/BE DYrE1mdTLYLrpuvI1G1tDatDvMbejvjGigSARIV3v7xZOus/iiDsNLCg13Ep5Hs9sYeOPa PRXebO7qvO3yPFaz93pO1aC6YOiCqmPNVIQumZZmOrFTvspyI/uIYmEo720JKfekIinPEX tpogL4m7Uf8vhIk8SNZEBMYBAO4Gf4K3VpQhNdlAs9q6hUvZxV1rPhAeZteVRMDt1U6NzE O2MHIyE5jR1TQuWjfHAfyz7G877XlewcjV1x4wPrkWdIrinE7aGY9QBXQz96wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751450542; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OshVBVWoEI6VnWzGPcGStWu/A9mFXeeRmnVU8Flhq40=; b=cPw12afwaWEukFo8UIGJM9MjFpHF3Q2OxZRxZ/SrvCANyJgJ46YCg5MkK5A5rjyqgCf8wF 5KRTri+ez26JoFytZ8CjnqDXPyt2AdCJA81IFyHmEcuOB9X0JjzmMp3t6JzzjSkjoPqxi/ HRrWe+f3nBK8aEGDUcSJB0XpCBzXeDDMT8Gy22qALAro/Hiv//POc2xf3SfmR4ulib+qI3 sDBIzHx5o/a9JfMYOybvOi7T/t2CmGZPsPp+QKaK5hyFz9ST/QqTH63Rz2cw+TgOde949s FtNDryKeYODxpa9KKwqylQCKd2J98HI2K1GgR5bQX9QeyH4qstTWIaewRo3XBw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751450542; a=rsa-sha256; cv=none; b=RUtOJNGcpgq+psjnpntVrQAzruTEWrA9ZZUyKKghbP1XrwaoqymEoBqvxoEn27nr9OgdyS ExB1w3LuikRCB9WtIkMn9elBKS0niWOjubqKTZM/ImrcEaV3BXhLd1dV6B+xuG78qMUapt adP/47mZFKpG/iBgXQ88r0DptoMkbbUzHKtQ7LTXDMcsKAZc/8BnTf6JByTooHYCLJu3A6 8zUgimsa4pTPfAFy1eobXwEzWrnZKUXKJjlBYSY4ZWsmoMZaKlABui5IUQnm+RP0Aru5kW dtcwSBvDhyF+eqVawygYZi/O8KBZchc9LuMjrlHIFNgHg+tolOafChUJp12Vwg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXFnB60xHzGd; Wed, 02 Jul 2025 10:02:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562A2MgQ012177; Wed, 2 Jul 2025 10:02:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562A2MrA012174; Wed, 2 Jul 2025 10:02:22 GMT (envelope-from git) Date: Wed, 2 Jul 2025 10:02:22 GMT Message-Id: <202507021002.562A2MrA012174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 51da2dd34416 - main - arm64: Fix a typo List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51da2dd3441640636a80d4c8b0500d78be80959a Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=51da2dd3441640636a80d4c8b0500d78be80959a commit 51da2dd3441640636a80d4c8b0500d78be80959a Author: Andrew Turner AuthorDate: 2025-06-28 01:59:24 +0000 Commit: Andrew Turner CommitDate: 2025-07-02 09:49:01 +0000 arm64: Fix a typo Sponsored by: Arm Ltd --- sys/arm64/arm64/ptrauth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/arm64/ptrauth.c b/sys/arm64/arm64/ptrauth.c index a943220d66cd..767b7e115479 100644 --- a/sys/arm64/arm64/ptrauth.c +++ b/sys/arm64/arm64/ptrauth.c @@ -110,7 +110,7 @@ ptrauth_check(const struct cpu_feat *feat __unused, u_int midr __unused) */ /* - * The QARMA5 or implementation efined algorithms are reported in + * The QARMA5 or implementation defined algorithms are reported in * ID_AA64ISAR1_EL1. */ if (get_kernel_reg(ID_AA64ISAR1_EL1, &isar)) { From nobody Wed Jul 2 10:02:23 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXFnD2nYxz60Bmx; Wed, 02 Jul 2025 10:02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXFnD0Fgnz48pk; Wed, 02 Jul 2025 10:02:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751450544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OeL7Akn26Xgb09X4tDQC7xkeebQiem2hZ6X+Nf+3klc=; b=Y8ToMQ3uvfSNvyMiIASHXz8SlEBFkkeAGGKsfaa/J91QTmuuSEOczd2MVGbKsooDLUv0HA TVNo4R4yy3FqiPw8UF5HyG+Z2K2I2AHPOxv07gLi03VcD8zwH6pibxHzZ8Bfu1y9ZnzOz0 +Iwhol4WSPe9utYXAErywPCutebbDhbrd6BANcg+FUMVaJ4V84JDfDs0j5Ir3Vvm3M5GcM 88eupdrsIFY2u0UqOlz1SVMok78dT9knCluwItcDLLz9mjTREQ9Og6Spufa5jICjyMl52J fqo96k5GidV+zqd0P8LV0IZw9xRxogn5dq5PXtZGo2oJIua5MrgM4aS79rTVxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751450544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OeL7Akn26Xgb09X4tDQC7xkeebQiem2hZ6X+Nf+3klc=; b=ReMQH7yueOkNyvsNDc2XQ8epR1/xOwkgZRovw92RMki/dWF96TWbzD/8A+OALKM69333QY t35yJaMl6lfGHWQpo85SXFTkNCXpecOA77dOIfg1QT3C4mbTi7dMSBPwcnSUmyvpOso4BJ UCEoDiK3p7lzTFGnWIgdf0R5x2NdXSWYuI0XRJHmmCqDcgDScsZhQKJNV+re4ZRfMjsk/O KDF8iyymxxZHIsO2ZFaKolHtWHRH46aAa4v8iYGWSNWGn4ndiWZqAQRbIWhQJQ6NLDFOxJ AJNS1KpjX6vnTgRB2stZN1ETWh96/a3/0MZRW3R9T31iV3OstavsXTdfrYd/KQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751450544; a=rsa-sha256; cv=none; b=c+mJv2RtZeRK0pLTeVSkJCqLtlzK00k9C+Ok+FDPHNnem4RXt0MvLyLtUBW8Xt3QZBITE7 qVdLk3YXAXkv1zyOfN4hmJ41tS3ok6XkCPTPcH5msw4p/uxYenPCPFm659zxVrfMgacFte YY6oTy5d6ZSXRaAbDel3O1kiefYqW6TeyEnDbIxKIXIunrVC4l98Wa+ac3uhiFCBl+PfRX QHAUGWBzkZCI3wQCe2lMCkLFeDALZASpgtCS8aYvgd6ibHRIOctCsK0tV9eRgfc3PUvi9e gl8/R9vE+E7FCJvQfiaj3blSVcBSXJhoUh9Mj5191aXmYj7/zcaBCxGf4lxZgg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXFnC6y34zK4; Wed, 02 Jul 2025 10:02:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562A2Nrq012210; Wed, 2 Jul 2025 10:02:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562A2NJr012207; Wed, 2 Jul 2025 10:02:23 GMT (envelope-from git) Date: Wed, 2 Jul 2025 10:02:23 GMT Message-Id: <202507021002.562A2NJr012207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: eba385011bfe - main - arm64: Use CHECK_CPU_FEAT to check for VHE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eba385011bfed4c7b536eb22913dff979f36f128 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=eba385011bfed4c7b536eb22913dff979f36f128 commit eba385011bfed4c7b536eb22913dff979f36f128 Author: Andrew Turner AuthorDate: 2025-07-02 09:49:15 +0000 Commit: Andrew Turner CommitDate: 2025-07-02 09:49:15 +0000 arm64: Use CHECK_CPU_FEAT to check for VHE Now we have a macro to check if a feature is supported in an ID register we can use it to see if VHE is supported. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D51102 --- sys/arm64/arm64/locore.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index 2f549a527f43..3c75feaa685b 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -373,9 +373,8 @@ LENTRY(enter_kernel_el) ldr x2, =INIT_SCTLR_EL1 msr sctlr_el1, x2 - /* Check if the E2H flag is set */ - tst x4, #HCR_E2H - b.eq .Lno_vhe + /* Check for VHE */ + CHECK_CPU_FEAT(x2, ID_AA64MMFR1, VH, .Lno_vhe) /* * The kernel will be running in EL2, route exceptions here rather From nobody Wed Jul 2 10:02:24 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXFnF2Td5z60Bmy; Wed, 02 Jul 2025 10:02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXFnF0mc0z49BB; Wed, 02 Jul 2025 10:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751450545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uZKkIDvrAj0lhUmrpNRa1YLE9huO7sUh2Ka4O95ARsI=; b=AHTtPgNCFtt1HciCDNMZFuPuQAo9ZnIfSs6GhmuD/Y998T8qdBbxxv6s/x+J6ts9GTd80D 3fL7HmAVpPKYlIyhF0A3dCHbV8MYp9ZezYi+TuFQDkjgQZ3degFKLAqceCxqNah5N6oa/s 1kk4HpJzddkJiJqY1iFoUqXtvqyzfpvJ7xq7u3FkARX0lEaPSJY21078Qc8b7GBhspoAeC pMV2GhGKvnl1FD6L7TJY9wfBxIWRqgvffz5kOtzMI8eM6wBiTAwRw5lI7CkQ0NfMdpC8cj UmlK8FNtw731ohdLcMfFDdrPd20h1r6YIOnxXviQsDD4rnZeD5nLm1sDDYfSkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751450545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uZKkIDvrAj0lhUmrpNRa1YLE9huO7sUh2Ka4O95ARsI=; b=uu3P9FTiehh1Nd34tT6Uo25e+bD7L5mzCFmgdxT2gL8B3N+ZSwHN7M8g07ppYWHaEcuBzu uifpDfhz2lN5xvn4cv8lzCc0k12l0j0eR61PdchZn4Mf+qEoQl/8lE8P82eW5kbGX5fUFT Ro81D1ZP0eHGIhhkLqadUlzruqg4MKwfVqftSd3mLOjHVILLA3t7h0wJpZZ63j+E5jE8xQ bDWMfw5MURhiBXB8+huFkl2RfducFMzORG+KUibzUPBJMvOg41aOCQDcAxhoKtuZ8x68is K8Dc7uB3fqdr1HJn65fiE2DR8TY3kD3/HpCcRTDT8zIEjTuFRFUpZlS+BmYFfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751450545; a=rsa-sha256; cv=none; b=PaaQTVLla/ygghnzelQx8E5lDIdV2sbS0jslkmcoMMSSjhgLF4l7XeB3SjglXswC2s6bvL +hfLLwQjX158UaIAQ72OYeDtcHkYPT8TwraMTppO5fXiks5+Tdy4uNnxLV4Gm7NrsGJyDy J39WuxN8Xe/LB7pFrWsg6whAFTeiZ1ZT0MwTeAaTq4NCE7WWuyNZWz9pUDWoYGwqVqgX+c j4Le6kDbhVU/ZMShfJiGrpUslpZlkYmRVcL59y1yoUvs+MVWdGNbfCjEFQC/iMBnkx92Y5 eUI2ctN0ZoSjaowuZYMbym9ibdH4szmfDZnalCyFPN0Z1z7HmjJx1xnRGv5n2g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXFnF0KthzGf; Wed, 02 Jul 2025 10:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562A2O9p012244; Wed, 2 Jul 2025 10:02:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562A2OsT012241; Wed, 2 Jul 2025 10:02:24 GMT (envelope-from git) Date: Wed, 2 Jul 2025 10:02:24 GMT Message-Id: <202507021002.562A2OsT012241@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 0e0576700fbe - main - arm64: Only set HCR_EL2.E2H when VHE is supported List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e0576700fbeb7c765095132a43410d3e35c1a80 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=0e0576700fbeb7c765095132a43410d3e35c1a80 commit 0e0576700fbeb7c765095132a43410d3e35c1a80 Author: Andrew Turner AuthorDate: 2025-07-02 09:49:24 +0000 Commit: Andrew Turner CommitDate: 2025-07-02 09:49:24 +0000 arm64: Only set HCR_EL2.E2H when VHE is supported When VHE isn't implemented then the HCR_EL2.E2H field should be 0. Move setting it to the VHE path of the early boot code so it is only set when supported. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D51103 --- sys/arm64/arm64/locore.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index 3c75feaa685b..bb323dbafd85 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -354,7 +354,7 @@ LENTRY(enter_kernel_el) isb /* Configure the Hypervisor */ - ldr x2, =(HCR_RW | HCR_APK | HCR_API | HCR_E2H) + ldr x2, =(HCR_RW | HCR_APK | HCR_API) msr hcr_el2, x2 /* Stash value of HCR_EL2 for later */ @@ -380,7 +380,8 @@ LENTRY(enter_kernel_el) * The kernel will be running in EL2, route exceptions here rather * than EL1. */ - orr x4, x4, #(HCR_TGE) + orr x4, x4, #HCR_E2H + orr x4, x4, #HCR_TGE msr hcr_el2, x4 isb From nobody Wed Jul 2 10:23:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXGF159JGz60D9V; Wed, 02 Jul 2025 10:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXGF13nQ6z3KZY; Wed, 02 Jul 2025 10: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=1751451781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Mi4QPZU13XWRyikz5t/BwgXxGkF2oFQast/jzWR+d10=; b=gvIDfybK3kWt8lDsIKwSVd62pVZeS72VIO+Pzc0j14IhZ6ZiOc/NnUAMC6BhWAURkkYlzn 8NC8/rMawlLMJRnCr8grHUKe7d5jiYITPGZx1ItJkT1lT0B6wsYDCiFnlFN8PkOb6W5o2i +W0wvcrLLEEuLENy4XNvz6Du8lxAkaHpPYoDEP9D8P6jQffS4mhlShehMZnlR+Kk/RsbwQ vjqHlKRPeNTUAN063QWoE66LOgRGdMtTVIqN8M+wUG8d5C0k3eg2IzKPLYupJmS4zksjVd 8zIRBsXpZhUlx3fDtrdFh6GR6jw79M6eAmwepBtp+jmA6eR65DD2ReGjZtk8bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751451781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Mi4QPZU13XWRyikz5t/BwgXxGkF2oFQast/jzWR+d10=; b=wufek0SfxcDjRsuxru4QdFhFAM5SrfA9cKJ0LYNZDvZoNs6W13ZAuDzJJtGpT4PRpcwoI+ pgcs8o/GGPN9ARqzzz9dz+B2XAHS5atKW26A1n80H4jMVBcQfm08TFccT//IbBtzXEjWSl VvRRJ0CyZhY3fuoXRXU+2wAz41XWTWY9KGokl/IrBkEn5dwuikZNtfjfsDCZdPKcWVsQXa g4ZC98EdYnbhcfpiJaEDcRtlg/VPe3p55nSmkQeyOlLQXHtTA0g4YQUW9vcfHegY5xzbVh 17faaMK7UFmYXGH3diLn7dhbpHn25qRBZIAQKi1tfMp5STreeqFu46H3uETsLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751451781; a=rsa-sha256; cv=none; b=pBFOf2M2JrQR/Enotx3HNB42I4wdT4x9c8I/4Ti3mSwsU/+duZMapx3OeQc+qlBmnC8ZUt qdsfGsym8Cyo5KdB7TrBjmG7i3TWT71YByBhAvWSn6I/2+scPbLt3XbMQY83MG2QPAoGRT JgLga0bluGGfxYMRotznqiRXIEiS5UxOXtUDBy21qGRdj4aJy/IQEdPS5P8GGgr1ufsSg6 vxELD/tsXDwmeAH153GMIdZpCgC09RfDrMe02v1IM7aEcuZyUp2DndTdHpS3rixUvSAud3 R3gEyezVT0dyCrC2uzlIFuG4ayEgM7aVQ/FFLqQ+D4MA1gpq27v7CxT9fSZ6LQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXGF139Hqz1YP; Wed, 02 Jul 2025 10:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562AN17w050082; Wed, 2 Jul 2025 10:23:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562AN1IR050079; Wed, 2 Jul 2025 10:23:01 GMT (envelope-from git) Date: Wed, 2 Jul 2025 10:23:01 GMT Message-Id: <202507021023.562AN1IR050079@gitrepo.freebsd.org> 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=B8rgrav?= Subject: git: eb439266b433 - main - cp: Don't rely on FTS_DP to keep track of depth. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb439266b433241cec9cbef44328b16056bd6ff7 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=eb439266b433241cec9cbef44328b16056bd6ff7 commit eb439266b433241cec9cbef44328b16056bd6ff7 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-02 10:22:05 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-02 10:22:28 +0000 cp: Don't rely on FTS_DP to keep track of depth. In normal operation, we get an FTS_D entry when we enter a directory and a matching FTS_DP entry when we leave it. However, if an error occurs either changing to or reading a directory, we may get an FTS_D entry followed by FTS_DNR or even FTS_ERR instead. Since FTS_ERR can also occur for non-directory entries, the only reliable way to keep track of when we leave a directory is to compare fts_level to our own depth counter. This fixes a rare assertion when attempting to recursively copy a directory tree containing a directory which is either not readable or not searchable. While here, also add a test case for directory loops. Fixes: 82fc0d09e8625 Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D51096 --- bin/cp/cp.c | 54 ++++++++++++++++++++---------------- bin/cp/tests/cp_test.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 23 deletions(-) diff --git a/bin/cp/cp.c b/bin/cp/cp.c index 94a22c1cccc5..7e97715c3ef4 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -270,10 +270,9 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat) FTS *ftsp; FTSENT *curr; char *recpath = NULL, *sep; - int atflags, dne, badcp, len, rval; + int atflags, dne, badcp, len, level, rval; mode_t mask, mode; bool beneath = Rflag && type != FILE_TO_FILE; - bool skipdp = false; /* * Keep an inverted copy of the umask, for use in correcting @@ -305,6 +304,7 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat) to.dir = -1; } + level = FTS_ROOTLEVEL; if ((ftsp = fts_open(argv, fts_options, NULL)) == NULL) err(1, "fts_open"); for (badcp = rval = 0; @@ -315,6 +315,20 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat) case FTS_NS: case FTS_DNR: case FTS_ERR: + if (level > curr->fts_level) { + /* leaving a directory; remove its name from to.path */ + if (type == DIR_TO_DNE && + curr->fts_level == FTS_ROOTLEVEL) { + /* this is actually our created root */ + } else { + while (to.end > to.path && *to.end != '/') + to.end--; + assert(strcmp(to.end + (*to.end == '/'), + curr->fts_name) == 0); + *to.end = '\0'; + } + level--; + } warnc(curr->fts_errno, "%s", curr->fts_path); badcp = rval = 1; continue; @@ -335,14 +349,6 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat) strlcpy(rootname, curr->fts_name, sizeof(rootname)); } - /* - * If we FTS_SKIP while handling FTS_D, we will - * immediately get FTS_DP for the same directory. - * If this happens before we've appended the name - * to to.path, we need to remember not to perform - * the reverse operation. - */ - skipdp = true; /* we must have a destination! */ if (type == DIR_TO_DNE && curr->fts_level == FTS_ROOTLEVEL) { @@ -410,7 +416,7 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat) } to.end += len; } - skipdp = false; + level++; /* * We're on the verge of recursing on ourselves. * Either we need to stop right here (we knowingly @@ -477,18 +483,19 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat) rval = 1; } } - /* are we leaving a directory we failed to enter? */ - if (skipdp) - continue; - /* leaving a directory; remove its name from to.path */ - if (type == DIR_TO_DNE && - curr->fts_level == FTS_ROOTLEVEL) { - /* this is actually our created root */ - } else { - while (to.end > to.path && *to.end != '/') - to.end--; - assert(strcmp(to.end + (*to.end == '/'), curr->fts_name) == 0); - *to.end = '\0'; + if (level > curr->fts_level) { + /* leaving a directory; remove its name from to.path */ + if (type == DIR_TO_DNE && + curr->fts_level == FTS_ROOTLEVEL) { + /* this is actually our created root */ + } else { + while (to.end > to.path && *to.end != '/') + to.end--; + assert(strcmp(to.end + (*to.end == '/'), + curr->fts_name) == 0); + *to.end = '\0'; + } + level--; } continue; default: @@ -638,6 +645,7 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat) if (vflag && !badcp) (void)printf("%s -> %s%s\n", curr->fts_path, to.base, to.path); } + assert(level == FTS_ROOTLEVEL); if (errno) err(1, "fts_read"); (void)fts_close(ftsp); diff --git a/bin/cp/tests/cp_test.sh b/bin/cp/tests/cp_test.sh index d5268ed4c4c9..64f917bf9c5f 100755 --- a/bin/cp/tests/cp_test.sh +++ b/bin/cp/tests/cp_test.sh @@ -618,6 +618,76 @@ to_root_cleanup() (dst=$(cat dst) && rm "/$dst") 2>/dev/null || true } +atf_test_case dirloop +dirloop_head() +{ + atf_set "descr" "Test cycle detection when recursing" +} +dirloop_body() +{ + mkdir -p src/a src/b + ln -s ../b src/a + ln -s ../a src/b + atf_check \ + -s exit:1 \ + -e match:"src/a/b/a: directory causes a cycle" \ + -e match:"src/b/a/b: directory causes a cycle" \ + cp -r src dst + atf_check test -d dst + atf_check test -d dst/a + atf_check test -d dst/b + atf_check test -d dst/a/b + atf_check test ! -e dst/a/b/a + atf_check test -d dst/b/a + atf_check test ! -e dst/b/a/b +} + +atf_test_case unrdir +unrdir_head() +{ + atf_set "descr" "Test handling of unreadable directories" +} +unrdir_body() +{ + for d in a b c ; do + mkdir -p src/$d + echo "$d" >src/$d/f + done + chmod 0 src/b + atf_check \ + -s exit:1 \ + -e match:"^cp: src/b: Permission denied" \ + cp -R src dst + atf_check test -d dst/a + atf_check cmp src/a/f dst/a/f + atf_check test -d dst/b + atf_check test ! -e dst/b/f + atf_check test -d dst/c + atf_check cmp src/c/f dst/c/f +} + +atf_test_case unrfile +unrdir_head() +{ + atf_set "descr" "Test handling of unreadable files" +} +unrfile_body() +{ + mkdir src + for d in a b c ; do + echo "$d" >src/$d + done + chmod 0 src/b + atf_check \ + -s exit:1 \ + -e match:"^cp: src/b: Permission denied" \ + cp -R src dst + atf_check test -d dst + atf_check cmp src/a dst/a + atf_check test ! -e dst/b + atf_check cmp src/c dst/c +} + atf_init_test_cases() { atf_add_test_case basic @@ -656,4 +726,7 @@ atf_init_test_cases() atf_add_test_case to_link_outside atf_add_test_case dstmode atf_add_test_case to_root + atf_add_test_case dirloop + atf_add_test_case unrdir + atf_add_test_case unrfile } From nobody Wed Jul 2 10:23:02 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXGF26nF7z60DS1; Wed, 02 Jul 2025 10: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXGF24Vm0z3KTh; Wed, 02 Jul 2025 10: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=1751451782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2FakSNPYP+Oc3qj2Fm5T6mK2B/n6ILBef9M7VfoVw0M=; b=gfA4liwYN18ajGbHI+tYEx0q3bhjNZ/q1e5bUTo8jw2yrlkn0ix808uMLtRdwiA230MiP4 ovBuBqHUXGjcs76Go/iz4/u/E8/5GKfgR8NorKV47oCHGRByOj7mNmSMhXtDtZ/V8lQrY+ ncGQlMMYkdcOWWBYrb+J9TnUjVzYi5/4MfzVfl5xCAomfZEFok+JlDu4ec/dfzie2YS7P1 A6ypOdQwkfxPWdCp07RAnAYZRSsUcGTdpm0lm8uelUW6PVW1RcWy/e88sZqtvNF2/fIZx+ nFr9MOA9ubcvu0GNPrDMrW+ee3LGGL7OcDxX+oeXiMwUqAnpLIC9r2ArXWzQng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751451782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2FakSNPYP+Oc3qj2Fm5T6mK2B/n6ILBef9M7VfoVw0M=; b=xWeaLoz1wJNXaUWl4PHuMeTr60XTPpVFtWRj3eDS6LJJwKQHHmFe9kLL2pZHl+FE+K3SBn O/A3RtvQRJM1vGJMI2Q5ZU3txwqZRdJuG/ajH4XE3KckoNU9q4TO0pb1fn0Eblk5JUlknz f/TXCzqFFvjooaolao/QAd0z6C/ls0vUJSqDmWtueuLMe24J/XS18gaPdT639mTBLDssgI BVJ6yyQx8TzB9McdlaZSfRVhfh6+9vbJRIn5Qeo3ksQIk/2+mHN5QTfH3czcuOWumFjbVZ dNQoWaosMeFHWhpGDtZ28T2CwHO8Md0+NXoFLyb245ABDSedrxbPhN7UKm6C8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751451782; a=rsa-sha256; cv=none; b=rEViYP+HiKY2xcQ1n8b51VJYj6ODBd1TTDG/z92vTafNGgFzQmBpb24WUIUSuFwZi3HVjw 4c66eVgr40H6lXI/JOmHrrc/sfemx6Hu1+HyStbcpT3IoFF4WZEnOTq2DQ2d5gVHcIoekV FNfe/SDuUOXCXw+njtEtc+N2zafK9t2JCzCjbNd23TO8vS0cTfTkxNmjGGfnAn+1ynxEYx inT8fCa3SVc6G7cEp730Yad7Qvm52W70cDRMxkQnpNeDp+CkMTgBqQ4aF2GWMUZzIXi3aE Ny4aq+u0HpMzEUF4CXpor7izzQuf6mKzlHQA47jGe/H2eDWVc3yhRbhnMq/8WQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXGF2460yz12y; Wed, 02 Jul 2025 10:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562AN26S050119; Wed, 2 Jul 2025 10:23:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562AN2X5050116; Wed, 2 Jul 2025 10:23:02 GMT (envelope-from git) Date: Wed, 2 Jul 2025 10:23:02 GMT Message-Id: <202507021023.562AN2X5050116@gitrepo.freebsd.org> 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=B8rgrav?= Subject: git: bc624c973536 - main - fts: Clarify what FTS_DNR is used for. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc624c9735364ba68ee6975864110a5fee5e3b16 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=bc624c9735364ba68ee6975864110a5fee5e3b16 commit bc624c9735364ba68ee6975864110a5fee5e3b16 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-02 10:22:11 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-02 10:22:29 +0000 fts: Clarify what FTS_DNR is used for. Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D51097 --- lib/libc/gen/fts.3 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libc/gen/fts.3 b/lib/libc/gen/fts.3 index 0c32bb0ebdb6..5860d1be1a1e 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 7, 2025 +.Dd June 30, 2025 .Dt FTS 3 .Os .Sh NAME @@ -180,6 +180,12 @@ by one of the other values. .It Dv FTS_DNR A directory which cannot be read. +This immediately follows +.Dv FTS_D , +in place of +.Dv FTS_DP , +when the directory could not be entered, or could be entered but not +read. This is an error return, and the .Fa fts_errno field will be set to indicate what caused the error. From nobody Wed Jul 2 10:23:03 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXGF41bdrz60DCC; Wed, 02 Jul 2025 10: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXGF362tWz3KdB; Wed, 02 Jul 2025 10: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=1751451783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kb4g0S4eQvUzvGC3zItcsMzq9gPmC4EpCm4h9ZHVgyA=; b=jF/Kx1CTGf924ooQLLs585DGqxEUoHHlbLQPrRBWx4nGBhk4vX7siYgSv3M6WeIikeOPr1 F1iYUI1eHnbrR0zUHpUyudrzvkp4FK/q4BS4zisQB5eJGCYIsf4RM37SjJp1Mn6QThUh0B dkbMjcg7vvX0TgXzCT0z7T9RZpqf4YNKep+/KJ38iDsvtWobeAVKBqO64GZ9TPtNL/yylU QUjOGDVQ06Nzt8SwiW0nGsz4omnqdhysokYBhwzwjNtkwF9lrvk04Kuo46gxvYHcynAda9 T+y/kXpB5fyNw9E/WlGZ2awTFqHpGLgBvQ/H8zfIEapAyMtkiuzgc7ONS1ZZfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751451783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kb4g0S4eQvUzvGC3zItcsMzq9gPmC4EpCm4h9ZHVgyA=; b=WNeUcvWwSwH6LPYpPaWZbNfP0XBj2p//AKxNHN64YI8fiTpz3rS+mS/++RR+ma6R61FHkF eYZAY/Ulh4D1JultcYTKUxHqxULK3kEobS+1TYvrL2iPD6jGTb0NsH3aizCY5XGhG5u9VU jHu41PVNpcKHm0AgPcLkZlTtif1adppCnIHlzExc/CH3+89uo9CsPf7r54MPxCQ7scjZRU hGKyR/uHyy+v8LfsUx5nMT97AvgJ6P/hS7hhX5RRuJARcuJ4dQ6SWZ9YlaLU2aMZ3jR4m9 BPPuzKZMIIzNADoA6tiIqL9chbyDn4Zrjgh8WQ7Ame3lCYM2xnf8A/TCjUTNzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751451783; a=rsa-sha256; cv=none; b=q7upgo1jWuZpjuHA5aDXxld95RrkRpa3Q/NVOgFlti6+6cc3ac7tb8afTmGnVsbs7/VgB7 +VplUWV/6X8MBCKb22A1rFZbBBeVpLdUzKhociHmgrN4+jBGBZn16N3+obQByehvtQeMG7 0P00FXB+/zLDAhC/+tGQmG9sT/C6fWuim68qLy7nuOrOTRHlVM+jpuGF1q4ZDAvPa76DsN wpxyQ7LoeWnfk42r+7w9xwhsa8/9FmwAYjXT8JCqhKaRCFYW6wKw1UoiKHTkeIhFI0Fcp7 aCLlhRCuj0Fa+jnGd7Pw5XeNaur8Kt0DrK/KYC0eXOt9YNkTATtscKqZ/TeMDw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXGF35L2qz1HF; Wed, 02 Jul 2025 10:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562AN3bo050165; Wed, 2 Jul 2025 10:23:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562AN3rQ050162; Wed, 2 Jul 2025 10:23:03 GMT (envelope-from git) Date: Wed, 2 Jul 2025 10:23:03 GMT Message-Id: <202507021023.562AN3rQ050162@gitrepo.freebsd.org> 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=B8rgrav?= Subject: git: 8d02b7190d3b - main - fts: Add test cases for unreadable directories. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d02b7190d3b926118fafc6a70a80676c349e186 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=8d02b7190d3b926118fafc6a70a80676c349e186 commit 8d02b7190d3b926118fafc6a70a80676c349e186 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-02 10:22:16 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-02 10:22:29 +0000 fts: Add test cases for unreadable directories. Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D51098 --- lib/libc/tests/gen/Makefile | 9 ++++ lib/libc/tests/gen/fts_misc_test.c | 78 ++++++++++++++++++++++++++++++++ lib/libc/tests/gen/fts_options_test.c | 84 +++++------------------------------ lib/libc/tests/gen/fts_test.h | 81 +++++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+), 72 deletions(-) diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile index b7df4b1d037b..a967ad5ddf91 100644 --- a/lib/libc/tests/gen/Makefile +++ b/lib/libc/tests/gen/Makefile @@ -10,6 +10,7 @@ ATF_TESTS_C+= fpclassify2_test .if ${COMPILER_FEATURES:Mblocks} ATF_TESTS_C+= fts_blocks_test .endif +ATF_TESTS_C+= fts_misc_test ATF_TESTS_C+= fts_options_test ATF_TESTS_C+= ftw_test ATF_TESTS_C+= getentropy_test @@ -104,6 +105,14 @@ TEST_METADATA.setdomainname_test+= is_exclusive=true TESTS_SUBDIRS= execve TESTS_SUBDIRS+= posix_spawn +# Tests that require address sanitizer +.if ${COMPILER_FEATURES:Masan} +.for t in scandir_test realpath2_test +CFLAGS.${t}.c+= -fsanitize=address +LDFLAGS.${t}+= -fsanitize=address +.endfor +.endif + # Tests that require blocks support .for t in fts_blocks_test glob_blocks_test scandir_blocks_test CFLAGS.${t}.c+= -fblocks diff --git a/lib/libc/tests/gen/fts_misc_test.c b/lib/libc/tests/gen/fts_misc_test.c new file mode 100644 index 000000000000..91640078f63c --- /dev/null +++ b/lib/libc/tests/gen/fts_misc_test.c @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 2025 Klara, Inc. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "fts_test.h" + +ATF_TC(fts_unrdir); +ATF_TC_HEAD(fts_unrdir, tc) +{ + atf_tc_set_md_var(tc, "descr", "unreadable directories"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(fts_unrdir, tc) +{ + ATF_REQUIRE_EQ(0, mkdir("dir", 0755)); + ATF_REQUIRE_EQ(0, mkdir("dir/unr", 0100)); + ATF_REQUIRE_EQ(0, mkdir("dir/unx", 0400)); + fts_test(tc, &(struct fts_testcase){ + (char *[]){ "dir", NULL }, + FTS_PHYSICAL, + (struct fts_expect[]){ + { FTS_D, "dir", "dir" }, + { FTS_D, "unr", "unr" }, + { FTS_DNR, "unr", "unr" }, + { FTS_D, "unx", "unx" }, + { FTS_DP, "unx", "unx" }, + { FTS_DP, "dir", "dir" }, + { 0 } + }, + }); +} + +ATF_TC(fts_unrdir_nochdir); +ATF_TC_HEAD(fts_unrdir_nochdir, tc) +{ + atf_tc_set_md_var(tc, "descr", "unreadable directories (nochdir)"); + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} +ATF_TC_BODY(fts_unrdir_nochdir, tc) +{ + ATF_REQUIRE_EQ(0, mkdir("dir", 0755)); + ATF_REQUIRE_EQ(0, mkdir("dir/unr", 0100)); + ATF_REQUIRE_EQ(0, mkdir("dir/unx", 0400)); + fts_test(tc, &(struct fts_testcase){ + (char *[]){ "dir", NULL }, + FTS_PHYSICAL | FTS_NOCHDIR, + (struct fts_expect[]){ + { FTS_D, "dir", "dir" }, + { FTS_D, "unr", "dir/unr" }, + { FTS_DNR, "unr", "dir/unr" }, + { FTS_D, "unx", "dir/unx" }, + { FTS_DP, "unx", "dir/unx" }, + { FTS_DP, "dir", "dir" }, + { 0 } + }, + }); +} + +ATF_TP_ADD_TCS(tp) +{ + fts_check_debug(); + ATF_TP_ADD_TC(tp, fts_unrdir); + ATF_TP_ADD_TC(tp, fts_unrdir_nochdir); + return (atf_no_error()); +} diff --git a/lib/libc/tests/gen/fts_options_test.c b/lib/libc/tests/gen/fts_options_test.c index c80474b70ac7..fc3015138a49 100644 --- a/lib/libc/tests/gen/fts_options_test.c +++ b/lib/libc/tests/gen/fts_options_test.c @@ -15,17 +15,7 @@ #include -struct fts_expect { - int fts_info; - const char *fts_name; - const char *fts_accpath; -}; - -struct fts_testcase { - char **paths; - int fts_options; - struct fts_expect *fts_expect; -}; +#include "fts_test.h" static char *all_paths[] = { "dir", @@ -37,20 +27,12 @@ static char *all_paths[] = { NULL }; -/* shorter name for dead links */ -#define FTS_DL FTS_SLNONE - -/* are we being debugged? */ -static bool debug; - /* * Prepare the files and directories we will be inspecting. */ static void fts_options_prepare(const struct atf_tc *tc) { - debug = !getenv("__RUNNING_INSIDE_ATF_RUN") && - isatty(STDERR_FILENO); ATF_REQUIRE_EQ(0, mkdir("dir", 0755)); ATF_REQUIRE_EQ(0, close(creat("file", 0644))); ATF_REQUIRE_EQ(0, close(creat("dir/file", 0644))); @@ -60,49 +42,6 @@ fts_options_prepare(const struct atf_tc *tc) ATF_REQUIRE_EQ(0, symlink("noent", "dead")); } -/* - * Lexical order for reproducability. - */ -static int -fts_options_compar(const FTSENT * const *a, const FTSENT * const *b) -{ - return (strcmp((*a)->fts_name, (*b)->fts_name)); -} - -/* - * Run FTS with the specified paths and options and verify that it - * produces the expected result in the correct order. - */ -static void -fts_options_test(const struct atf_tc *tc, const struct fts_testcase *fts_tc) -{ - FTS *fts; - FTSENT *ftse; - const struct fts_expect *expect = fts_tc->fts_expect; - long level = 0; - - fts = fts_open(fts_tc->paths, fts_tc->fts_options, fts_options_compar); - ATF_REQUIRE_MSG(fts != NULL, "fts_open(): %m"); - while ((ftse = fts_read(fts)) != NULL && expect->fts_name != NULL) { - if (expect->fts_info == FTS_DP) - level--; - if (debug) { - fprintf(stderr, "%2ld %2d %s\n", level, - ftse->fts_info, ftse->fts_name); - } - ATF_CHECK_STREQ(expect->fts_name, ftse->fts_name); - ATF_CHECK_STREQ(expect->fts_accpath, ftse->fts_accpath); - ATF_CHECK_INTEQ(expect->fts_info, ftse->fts_info); - ATF_CHECK_INTEQ(level, ftse->fts_level); - if (expect->fts_info == FTS_D) - level++; - expect++; - } - ATF_CHECK_EQ(NULL, ftse); - ATF_CHECK_EQ(NULL, expect->fts_name); - ATF_REQUIRE_EQ_MSG(0, fts_close(fts), "fts_close(): %m"); -} - ATF_TC(fts_options_logical); ATF_TC_HEAD(fts_options_logical, tc) { @@ -111,7 +50,7 @@ ATF_TC_HEAD(fts_options_logical, tc) ATF_TC_BODY(fts_options_logical, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_LOGICAL, (struct fts_expect[]){ @@ -162,7 +101,7 @@ ATF_TC_BODY(fts_options_logical_nostat, tc) */ atf_tc_expect_fail("FTS_LOGICAL nullifies FTS_NOSTAT"); fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_LOGICAL | FTS_NOSTAT, (struct fts_expect[]){ @@ -203,7 +142,7 @@ ATF_TC_HEAD(fts_options_logical_seedot, tc) ATF_TC_BODY(fts_options_logical_seedot, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_LOGICAL | FTS_SEEDOT, (struct fts_expect[]){ @@ -252,7 +191,7 @@ ATF_TC_HEAD(fts_options_physical, tc) ATF_TC_BODY(fts_options_physical, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_PHYSICAL, (struct fts_expect[]){ @@ -278,7 +217,7 @@ ATF_TC_HEAD(fts_options_physical_nochdir, tc) ATF_TC_BODY(fts_options_physical_nochdir, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_PHYSICAL | FTS_NOCHDIR, (struct fts_expect[]){ @@ -304,7 +243,7 @@ ATF_TC_HEAD(fts_options_physical_comfollow, tc) ATF_TC_BODY(fts_options_physical_comfollow, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_PHYSICAL | FTS_COMFOLLOW, (struct fts_expect[]){ @@ -333,7 +272,7 @@ ATF_TC_HEAD(fts_options_physical_comfollowdir, tc) ATF_TC_BODY(fts_options_physical_comfollowdir, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_PHYSICAL | FTS_COMFOLLOWDIR, (struct fts_expect[]){ @@ -362,7 +301,7 @@ ATF_TC_HEAD(fts_options_physical_nostat, tc) ATF_TC_BODY(fts_options_physical_nostat, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_PHYSICAL | FTS_NOSTAT, (struct fts_expect[]){ @@ -388,7 +327,7 @@ ATF_TC_HEAD(fts_options_physical_nostat_type, tc) ATF_TC_BODY(fts_options_physical_nostat_type, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_PHYSICAL | FTS_NOSTAT_TYPE, (struct fts_expect[]){ @@ -414,7 +353,7 @@ ATF_TC_HEAD(fts_options_physical_seedot, tc) ATF_TC_BODY(fts_options_physical_seedot, tc) { fts_options_prepare(tc); - fts_options_test(tc, &(struct fts_testcase){ + fts_test(tc, &(struct fts_testcase){ all_paths, FTS_PHYSICAL | FTS_SEEDOT, (struct fts_expect[]){ @@ -440,6 +379,7 @@ ATF_TC_BODY(fts_options_physical_seedot, tc) ATF_TP_ADD_TCS(tp) { + fts_check_debug(); ATF_TP_ADD_TC(tp, fts_options_logical); ATF_TP_ADD_TC(tp, fts_options_logical_nostat); ATF_TP_ADD_TC(tp, fts_options_logical_seedot); diff --git a/lib/libc/tests/gen/fts_test.h b/lib/libc/tests/gen/fts_test.h new file mode 100644 index 000000000000..b3f15050f265 --- /dev/null +++ b/lib/libc/tests/gen/fts_test.h @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 2025 Klara, Inc. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef FTS_TEST_H_INCLUDED +#define FTS_TEST_H_INCLUDED + +struct fts_expect { + int fts_info; + const char *fts_name; + const char *fts_accpath; +}; + +struct fts_testcase { + char **paths; + int fts_options; + struct fts_expect *fts_expect; +}; + +/* shorter name for dead links */ +#define FTS_DL FTS_SLNONE + +/* are we being debugged? */ +static bool fts_test_debug; + +/* + * Set debug flag if appropriate. + */ +static void +fts_check_debug(void) +{ + fts_test_debug = !getenv("__RUNNING_INSIDE_ATF_RUN") && + isatty(STDERR_FILENO); +} + +/* + * Lexical order for reproducability. + */ +static int +fts_lexical_compar(const FTSENT * const *a, const FTSENT * const *b) +{ + return (strcmp((*a)->fts_name, (*b)->fts_name)); +} + +/* + * Run FTS with the specified paths and options and verify that it + * produces the expected result in the correct order. + */ +static void +fts_test(const struct atf_tc *tc, const struct fts_testcase *fts_tc) +{ + FTS *fts; + FTSENT *ftse; + const struct fts_expect *expect = fts_tc->fts_expect; + long level = 0; + + fts = fts_open(fts_tc->paths, fts_tc->fts_options, fts_lexical_compar); + ATF_REQUIRE_MSG(fts != NULL, "fts_open(): %m"); + while ((ftse = fts_read(fts)) != NULL && expect->fts_name != NULL) { + if (expect->fts_info == FTS_DP || expect->fts_info == FTS_DNR) + level--; + if (fts_test_debug) { + fprintf(stderr, "%2ld %2d %s\n", level, + ftse->fts_info, ftse->fts_name); + } + ATF_CHECK_STREQ(expect->fts_name, ftse->fts_name); + ATF_CHECK_STREQ(expect->fts_accpath, ftse->fts_accpath); + ATF_CHECK_INTEQ(expect->fts_info, ftse->fts_info); + ATF_CHECK_INTEQ(level, ftse->fts_level); + if (expect->fts_info == FTS_D) + level++; + expect++; + } + ATF_CHECK_EQ(NULL, ftse); + ATF_CHECK_EQ(NULL, expect->fts_name); + ATF_REQUIRE_EQ_MSG(0, fts_close(fts), "fts_close(): %m"); +} + +#endif /* FTS_TEST_H_INCLUDED */ From nobody Wed Jul 2 10:23:04 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXGF53B4Jz60DHj; Wed, 02 Jul 2025 10:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXGF507QQz3Kfn; Wed, 02 Jul 2025 10:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751451785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=awgxKdp1OqMMSVKF5mfsOCQ/9T4wAuUGR15C2vWt4L8=; b=a0EaN8Jvc6aIJhmHnQ/H95q6r8q/OLuTgbpoF0tmqjjxfb2PCAtDyzbQspZhJrk7xh8k5z l/NdAwoa14y8iJoqzRj3ZSo31vnDG2Uu0X06vpGaGbT7aRC/CqhISRWl4+66VcU6wqbamp DxV4fG21H3+jc4VWH5l2m3MyO6MRVGnafuhkvR8468kAHJdX0AX6w5KVD91UOJQWbF4OP8 lwL/FSHLLXu0hyXn74OhTIxx/ZoBvZAjD7BS3ff8YmoQCqJoWP2/OjJLPxE2cvswlt+voN u9XPtB9zpYwyPpzUlZk74bSurZ2njKA9j661mstomx1cCEIy6OoXKuBHaU9m5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751451785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=awgxKdp1OqMMSVKF5mfsOCQ/9T4wAuUGR15C2vWt4L8=; b=csmjED2BKfoZiYT0UrfA0gUGwZD0C8V69pNAmvFVyg5K4PT99kJBDXjeIyhhQk3qNA8JbS qQ7tHP0aVUX5bTO8OaFGVJtqpnr0uo/Me1gLpK+QqWVNDx/oSALJCFpxBumhTQwhuVE/qF 6kbxiM5UKsyrrYzChADTirtCzrXzJqv4gMyEYpWhIWeKBEGNCAUtaTiu2huw7Xc6ZW+isG biYCqT41T2ufnFXLbGU7s3X/MUGTKxYn0Gn1HXpGiJNs3vS2I1CviYBzg1zgHp7SFfpo0o i2FevBV4GjeNjgRxB9iqZ9b76z+qmdOPYi3ZseBQRdxTwilLhC06KQl4kDiBKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751451785; a=rsa-sha256; cv=none; b=nhzTO33AdMs2KMZkvPLb7g4PvMQ9dGD8T7H6DflHVp0FzsOG/S8yP2ss7PDFLZ/P3054Yc Shsdi5dQATEZny9uDXfyuDfXuLjWzOY1NQPXcdW3ZItXTsPXc3nYTozgX/E1uYDqOdWIHe JrY6jH2HwzBuCTp50f9DMi0yass8aNPmTQrhlqlgPIETtJ2ixZG9PPKLD0uxiqyyb4X6BM VX3ju5otodcHk/YgISaWIER2/Zm1kJNrsti3RGGXuJ9u+Q/1EZ09+FI/YejGhND8FLfd27 kpVoREBjQDL3NMgzUIqToyI4JDKtibPYr7yo8GrzhZWLdVeatT+hPRuwjxYYTg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXGF460Myz1HG; Wed, 02 Jul 2025 10:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562AN4w0050204; Wed, 2 Jul 2025 10:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562AN403050201; Wed, 2 Jul 2025 10:23:04 GMT (envelope-from git) Date: Wed, 2 Jul 2025 10:23:04 GMT Message-Id: <202507021023.562AN403050201@gitrepo.freebsd.org> 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=B8rgrav?= Subject: git: 5e96f4006d2e - main - opendir: Simplify is_unionstack(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e96f4006d2e5f165531a53b6c1393a1c7604f42 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=5e96f4006d2e5f165531a53b6c1393a1c7604f42 commit 5e96f4006d2e5f165531a53b6c1393a1c7604f42 Author: Dag-Erling Smørgrav AuthorDate: 2025-07-02 10:22:21 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-02 10:22:29 +0000 opendir: Simplify is_unionstack(). Sponsored by: Klara, Inc. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51118 --- lib/libc/gen/opendir2.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/libc/gen/opendir2.c b/lib/libc/gen/opendir2.c index 30a9030693e4..b9ac23e6d9fd 100644 --- a/lib/libc/gen/opendir2.c +++ b/lib/libc/gen/opendir2.c @@ -243,20 +243,18 @@ _filldir(DIR *dirp, bool use_current_pos) return (true); } +/* + * Return true if the file descriptor is associated with a file from a + * union file system or from a file system mounted with the union flag. + */ static bool is_unionstack(int fd) { - int unionstack; - - unionstack = _fcntl(fd, F_ISUNIONSTACK, 0); - if (unionstack != -1) - return (unionstack); - /* - * Should not happen unless running on a kernel without the op, - * but no use rendering the system useless in such a case. + * This call shouldn't fail, but if it does, just assume that the + * answer is no. */ - return (0); + return (_fcntl(fd, F_ISUNIONSTACK, 0) > 0); } /* From nobody Wed Jul 2 13:09:59 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXKxg511Cz60Pfd; Wed, 02 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXKxg4KgJz3k9s; Wed, 02 Jul 2025 13:09:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751461799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qCqAy0L8yDeSUJQ9/aWvCklvjnATywdkxOzXnbl43M0=; b=lnmVRZkSCJWZA0JfBuASTlD3zXdQEXhGkXYtyS76/s5JQ++Urt5BiRGMAB35fxfAVQs1YP lubLsUygXYNrxuvBs2amojN+OcmlUg0aNJUmmjJ/8RNRJcEigzg73tMtUuScQPRrlA98/H OOPATF998jnD2dw6bv/ExOMuX9xvd6yxNvSMblSufDzHByiA+hnuhuL/Nk5uDh1rf3gyJp P7HYZ20eAh6uNa+mQFV7aIPUrJbWaYwZAFS3yx7P7Dnp3Ex8vKb+x6fjcqkFn5lHnb98lt pt+8yocAQUiXLKODjxs7IvsCtnOMgmGRuBeiY9JSUiLjn3O/7t+arSDEVEXjaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751461799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qCqAy0L8yDeSUJQ9/aWvCklvjnATywdkxOzXnbl43M0=; b=MOJGtOr3fa2Kwysh+hYuyR7tazqPAQTmYajY6iPX07Nl/6RxbRVB9+Bctr/ti9TzPYJiFl X8gxdVyp9WP+SzFfu8YxJbRKGBYV76u80fp20WCXdVn+qksi67UaCCy3WjD/c3bZjOM37y mIyef9QorcxCuz0fgQb943aYnz3NQpkovXogswH+JOSAie1+kKts5FOhwoBipQYAbqZgbP SFNFkY6mxTGpN5LEk2vfI+UEzki6LXrEZFbAyXNXIoyqbh5LiPeGRe2WVIPi+wYMmhXF3s p8nyhxvZOrF1n9SswUl++kmBu4c/nKhLTlbHu4qiVny6DVrD5cHaTqlhJ139xQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751461799; a=rsa-sha256; cv=none; b=iU7dDsmnHvRZi68X3tfjOxWkayWIkgs+RVrL2UbTvHfY7u+cjJpRxlf+V5D1K6L7ejcgW2 Zc6XuEeT0dMP5N6hw5zO/fLypHBmvIeCqnA+KERDSmPy4M/dOYTjsznRgJNJjQssMVzpDw 2v+RMjSS96/YTjK5csI8IBWtsJucvR+JemwcdheelxyRFvxzaMuMp4EVUg5bC8e8t6mz5F mbsc4pu77ZFlYDOw8P/4TpvNy+Vg2qPrryU84urcl/0cZl1fIP/R/94xI1e1SleabSNpbp NblkQ6unomcimu6da6VqxZbfR4acQl2P2yNR6phKv60fnYa57OqdeQiwk+Sm8g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXKxg3p4gz535; Wed, 02 Jul 2025 13:09:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562D9xRC053047; Wed, 2 Jul 2025 13:09:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562D9xIL053044; Wed, 2 Jul 2025 13:09:59 GMT (envelope-from git) Date: Wed, 2 Jul 2025 13:09:59 GMT Message-Id: <202507021309.562D9xIL053044@gitrepo.freebsd.org> 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=B8rgrav?= Subject: git: c9fcffff6c59 - main - cp: Fix typo in test case. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c9fcffff6c596b56484ce58b89850c5fef45acdc Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=c9fcffff6c596b56484ce58b89850c5fef45acdc commit c9fcffff6c596b56484ce58b89850c5fef45acdc Author: Dag-Erling Smørgrav AuthorDate: 2025-07-02 13:09:04 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-07-02 13:09:04 +0000 cp: Fix typo in test case. Fixes: eb439266b433 Sponsored by: Klara, Inc. --- bin/cp/tests/cp_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cp/tests/cp_test.sh b/bin/cp/tests/cp_test.sh index 64f917bf9c5f..1d2cd4292459 100755 --- a/bin/cp/tests/cp_test.sh +++ b/bin/cp/tests/cp_test.sh @@ -667,7 +667,7 @@ unrdir_body() } atf_test_case unrfile -unrdir_head() +unrfile_head() { atf_set "descr" "Test handling of unreadable files" } From nobody Wed Jul 2 13:41:56 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXLfY0y4sz60QsX; Wed, 02 Jul 2025 13:41: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXLfX4vjNz3m7p; Wed, 02 Jul 2025 13:41:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751463716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LSM1wgM8hilfDPOpQA2fTkwyB283Z1A42ue9gzH3mr0=; b=qSC5bhE//VrlhoFo8MYNUoWmcgmcotH/LMnpWIuolb16faUpU1H5LQ5u09TVOq6lbc9HAU NxKmcadarBTrqGh7BPuOMSxYpaEJoJgpH83R/A3GokAPhOKCRWYET5jsbdRT2OVlaEU6Da 7vBua7k4PWQ7vRlAazfDioUVwtnwgzpF3CWQGa14UbkNyD46aYYO0iyBGIwCkOjG4LBn2l nAlsxjAwUvMLktxLABSJWokg/Nhps/aKeW26AIUQCek2Q0sIHgLNrqApbleGvbt5UTpjA3 /5LHykeCJNJ1tVbSQKMtHzxz+TmYnxug1L0y3s+WiiczC4gy0K3V4uvWTBSK6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751463716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LSM1wgM8hilfDPOpQA2fTkwyB283Z1A42ue9gzH3mr0=; b=If/Pa9UUkOs2Nl/CO0IyVmAzfFrrAXujjm2JlRY6GCSWZq2yin/OhlwY+gDeI5cqPtkpFH HFBMpIPfngvl8Bem2JQetrPdSUiheC1gmnw5ZeY+7TDU1ykMur+PmwWlweWrDM3oiwyACB fYjMokJVhfNLQeFTfBMbsTdqwiLY9fSSAE2o2hKH7u/zbeLyfs6P/nh2abt/VRV6xowwr7 FldN90s3o+EbFxeUEY2/euO4o5bzWvnaVvTSM768YgjIY+GLNEQuZzJBAwfR8r5quvNk9Z uiYFOJ4+ji8Jl33eeNgbPRDVR0C7bWBJd3mWIhkYguJzvwf0Z1CIAreLNtknqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751463716; a=rsa-sha256; cv=none; b=TWlZ61y0tXW+rDWmtlxBW7vhJbYwgnbrYC+4kTB46wbj7nUGrzDaHl0tdBpDXIeZhPBnYo ElYePb8DYf3+lnIJ6dfnwfLWTnjXuJcExlJ2CYwR2e/bTUw2yr9Zqgo4wBMFc+1gW9Vxv7 2SybNSA5WKVIADDvz+9ZvJ95yFE+jaErJt3847RyXrSIicB8eqoM+GjwYxLYoNQNy/Dcuw yyaUcJvn89MD1KMxCYpDTLh/xD1OTaSaFpkaQ/QWybtS2Dl3NyIGw3i6vSTm3pdi5YXBiH x7fm6LP7wQWbIfM/R7bQ6ss/bQX8bIQoAW8e0DbrykG2u7jORki45VvjJ7MMyg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXLfX4V27z6cx; Wed, 02 Jul 2025 13:41:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562DfuGM023671; Wed, 2 Jul 2025 13:41:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562DfuEh023668; Wed, 2 Jul 2025 13:41:56 GMT (envelope-from git) Date: Wed, 2 Jul 2025 13:41:56 GMT Message-Id: <202507021341.562DfuEh023668@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: aefae931820f - main - linker: Improve handling of ifuncs when fetching symbol metadata List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aefae931820fe1e93a318552968510298c7941a0 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=aefae931820fe1e93a318552968510298c7941a0 commit aefae931820fe1e93a318552968510298c7941a0 Author: Mark Johnston AuthorDate: 2025-07-02 13:34:47 +0000 Commit: Mark Johnston CommitDate: 2025-07-02 13:34:47 +0000 linker: Improve handling of ifuncs when fetching symbol metadata When looking up symbol values, we map ifunc symbols to the value returned by the resolver. However, the returned symbol size is still that of the resolver. Be consistent and provide the size of the implementation symbol as well. This fixes an inconsistency in dtrace's FBT provider, which enumerates all function symbols and disassembles their values, using the symbol size as the bound for the disassembly loop. In particular, for ifuncs, we were not creating return probes. Reviewed by: kib MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D50683 --- sys/kern/link_elf.c | 38 ++++++++++++++++++++++++++++++++++---- sys/kern/link_elf_obj.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 53af1e164980..bbebadc4c395 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -1628,6 +1628,30 @@ link_elf_lookup_debug_symbol_ctf(linker_file_t lf, const char *name, return (i < ef->ddbsymcnt ? link_elf_ctf_get_ddb(lf, lc) : ENOENT); } +static void +link_elf_ifunc_symbol_value(linker_file_t lf, caddr_t *valp, size_t *sizep) +{ + c_linker_sym_t sym; + elf_file_t ef; + const Elf_Sym *es; + caddr_t val; + long off; + + val = *valp; + ef = (elf_file_t)lf; + + /* Provide the value and size of the target symbol, if available. */ + val = ((caddr_t (*)(void))val)(); + if (link_elf_search_symbol(lf, val, &sym, &off) == 0 && off == 0) { + es = (const Elf_Sym *)sym; + *valp = (caddr_t)ef->address + es->st_value; + *sizep = es->st_size; + } else { + *valp = val; + *sizep = 0; + } +} + static int link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, linker_symval_t *symval, bool see_local) @@ -1635,6 +1659,7 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, elf_file_t ef; const Elf_Sym *es; caddr_t val; + size_t size; ef = (elf_file_t)lf; es = (const Elf_Sym *)sym; @@ -1644,9 +1669,11 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, symval->name = ef->strtab + es->st_name; val = (caddr_t)ef->address + es->st_value; if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) - val = ((caddr_t (*)(void))val)(); + link_elf_ifunc_symbol_value(lf, &val, &size); + else + size = es->st_size; symval->value = val; - symval->size = es->st_size; + symval->size = size; return (0); } return (ENOENT); @@ -1668,6 +1695,7 @@ link_elf_debug_symbol_values(linker_file_t lf, c_linker_sym_t sym, elf_file_t ef = (elf_file_t)lf; const Elf_Sym *es = (const Elf_Sym *)sym; caddr_t val; + size_t size; if (link_elf_symbol_values1(lf, sym, symval, true) == 0) return (0); @@ -1678,9 +1706,11 @@ link_elf_debug_symbol_values(linker_file_t lf, c_linker_sym_t sym, symval->name = ef->ddbstrtab + es->st_name; val = (caddr_t)ef->address + es->st_value; if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) - val = ((caddr_t (*)(void))val)(); + link_elf_ifunc_symbol_value(lf, &val, &size); + else + size = es->st_size; symval->value = val; - symval->size = es->st_size; + symval->size = size; return (0); } return (ENOENT); diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 02fd4caffcd9..3d18aed2b1c0 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -1510,6 +1510,30 @@ link_elf_lookup_debug_symbol_ctf(linker_file_t lf, const char *name, return (link_elf_ctf_get_ddb(lf, lc)); } +static void +link_elf_ifunc_symbol_value(linker_file_t lf, caddr_t *valp, size_t *sizep) +{ + c_linker_sym_t sym; + elf_file_t ef; + const Elf_Sym *es; + caddr_t val; + long off; + + val = *valp; + ef = (elf_file_t)lf; + + /* Provide the value and size of the target symbol, if available. */ + val = ((caddr_t (*)(void))val)(); + if (link_elf_search_symbol(lf, val, &sym, &off) == 0 && off == 0) { + es = (const Elf_Sym *)sym; + *valp = (caddr_t)ef->address + es->st_value; + *sizep = es->st_size; + } else { + *valp = val; + *sizep = 0; + } +} + static int link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, linker_symval_t *symval, bool see_local) @@ -1517,6 +1541,7 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, elf_file_t ef; const Elf_Sym *es; caddr_t val; + size_t size; ef = (elf_file_t) lf; es = (const Elf_Sym*) sym; @@ -1527,9 +1552,11 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, symval->name = ef->ddbstrtab + es->st_name; val = (caddr_t)es->st_value; if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) - val = ((caddr_t (*)(void))val)(); + link_elf_ifunc_symbol_value(lf, &val, &size); + else + size = es->st_size; symval->value = val; - symval->size = es->st_size; + symval->size = size; return (0); } return (ENOENT); From nobody Wed Jul 2 13:43:31 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXLhM52K1z60S3Q; Wed, 02 Jul 2025 13:43: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXLhM3gsHz3mwK; Wed, 02 Jul 2025 13:43:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751463811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PkpqIFUZrl+ZJACNrx8xrOuHgHEugpiecjqg6KCZcMU=; b=l/6WXJI6A6/wNooisdhqomfwp8bf7Ssc4v3guTSvd0vbzLXjfrqVlozI0HiX0Svig2Q++6 TWM18f0R1Su2f83CFMsAWXhRMnOH4rgd0H+gMzxOb+1F8SpLYalbY/PO6f0hIMhfoXmCfH JGhXevHvn9bU9XJQp+qD4HnNOSCDD2/+kQWVX5TiIDEHe+9sWThLiKQDOn1oFLed5w0sHq UgicZmMYwZ2T0cMS5/IWgIPT9qNR1UxTJfJ/q6Di8Zb2l41LBMUmMxW2Br26WX7tSYoCQM x7fDM1EOMQ5YJldVCZE/uTjC32f1fjqMjojVFLM1wVXaLThVdh6FxV68eqg1gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751463811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PkpqIFUZrl+ZJACNrx8xrOuHgHEugpiecjqg6KCZcMU=; b=leFDIFgA8r0Q/lBv9SS+hDXlj4FUU60OKQ4U5Zm/mRkB0D3Uc+HJW71CmHyE9jHf9rNCP/ 3KlV02yozT4RAVGvC1xj56EnJKNC8nEPWhdkExYRwtCngC2JEwlQptgTPC2TmzouR8ip+Q 4hERWhBZNir++kpTGN1rqaCQBC816cIBTRynVlgb9b+97D2D0G9KWpl6tI2xbug7GK1+B1 CUyHLWq4W4SN1cZwCEEBnqFpF+94emZZ2yGrPojfy+t/dpset1k7/1+jUKtwRXelehZkX9 usT30Zsw2eo+7aStSD4iwvXli1uA7E2xnMHuBjOkimG7lJRt5cyvHUDVQDwlZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751463811; a=rsa-sha256; cv=none; b=cmYY7Z0YH03cal6SMiLHoHoHB4ysmYoZNrigCy+nBWK/RYcPwlN0cANs51Imhh94j8YnsM 487OXBfxYLWXZuHBpOOfo9bUGcPe2JHFX5db6+tZwSrzQPQUSp/9ove47Dt7UpLAAaAODM FiCXdA1V6IJJF37NBRhPymKSgAzEZ7g2cl7sVcEwffyzDID/D29TgTPdxIffhgv3yFus60 hJ+S4DPTW+07vd+v1maaKcPbMhFGY2xEYM5v+FpKUbpPVOGYPi08xpqGvKsub/4+MWhmIq 00O+RCHNMMl/qELt8AjNHN6ZWJY/HlTDvUc7AF+sX3LV9saUqa8Fg6pgypB7mQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXLhM379jz6rY; Wed, 02 Jul 2025 13:43:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562DhVwg025521; Wed, 2 Jul 2025 13:43:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562DhV7m025518; Wed, 2 Jul 2025 13:43:31 GMT (envelope-from git) Date: Wed, 2 Jul 2025 13:43:31 GMT Message-Id: <202507021343.562DhV7m025518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3d4a61a10bb7 - main - git-arc: Try harder to get the author name and email out of phab List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d4a61a10bb7a921cee7a06696034e36fb221b95 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3d4a61a10bb7a921cee7a06696034e36fb221b95 commit 3d4a61a10bb7a921cee7a06696034e36fb221b95 Author: Mark Johnston AuthorDate: 2025-07-02 13:42:42 +0000 Commit: Mark Johnston CommitDate: 2025-07-02 13:42:42 +0000 git-arc: Try harder to get the author name and email out of phab When patching, we use the querydiffs endpoint to get a name and email for the revision's author. It's possible that this info isn't recorded, in which case the results after post-processing are just "null". However, if the diff has multiple revisions, the endpoint returns an entry for each one, some of which may contain author info, others not. So, the deleted code which tries to filter out "null" isn't sufficient, since the value in question might be something like "\nnull". Try to make this filtering a bit smarter to avoid generating incorrect author info. Reviewed by: jlduran Reported by: des MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51065 --- tools/tools/git/git-arc.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index b49721159799..d953a30cb90d 100644 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -582,17 +582,10 @@ patch_commit() echo '{"revisionIDs": [ '"${diff#D}"' ]}' | \ arc_call_conduit -- differential.querydiffs | jq -r '.response | flatten | .[]' > "$diff_data" - author_addr=$(jq -r ".authorEmail?" "$diff_data" | sort -u) - author_name=$(jq -r ".authorName?" "$diff_data" | sort -u) - - # JSON will return "null" when a field is not populated. - # Turn this string into an empty one. - if [ "$author_addr" = "null" ]; then - author_addr="" - fi - if [ "$author_name" = "null" ]; then - author_name="" - fi + # If the differential revision has multiple revisions, just take the first + # non-null value we get. + author_addr=$(jq -r ".authorEmail?" "$diff_data" | grep -v '^null$' | head -n 1) + author_name=$(jq -r ".authorName?" "$diff_data" | grep -v '^null$' | head -n 1) author=$(find_author "$user_addr" "$user_name" "$author_addr" "$author_name") From nobody Wed Jul 2 14:38:04 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXMvK10wmz60VXr; Wed, 02 Jul 2025 14:38: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXMvJ6nCwz3rL7; Wed, 02 Jul 2025 14:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751467085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/E1V7t50etchXa5B46Vj9ENNbe3qXRZx3uVL1jWJHGg=; b=e6jx2KgMR5Gcs5JJpQtgtOP3vmKy/DMcKf8tShyYcNvjDcllnuuFSITXod6zEescbg1e5k 1P3aIF4ILBJ8NGcqAa9XRspYrrJL4BYL2SNTLCqqItSTNLk3yjbY/194kf6dHNPAOy7XcD XTMGOyjH9nFvm0Qkwnr0nPZMcv2KELVlqrqBXztHLMWbBuyydI1mgOx0y3PwLmgVCQA7xW HfboqS3T40Gdb2qE8xHaYUlJxO5yiQJoGOjzMYesMtdXp0ZHghpf6YQwQXgynBqGNlDJTN QzlhJvtIxAdjVWQvl01uzO8A6FlB49JubQSe36tJYlQknDMbQm+IQX6oZlBu0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751467085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/E1V7t50etchXa5B46Vj9ENNbe3qXRZx3uVL1jWJHGg=; b=rKTiL0WL3CtgutJ4aTojXPhIkYJ8XDfH+XeUAbuTjT5xOrPOrU/nkmn/cgfF/IeNngXUIa u1YayqqfZLsBVd3zysMTkAScxb5GB9612ScY5lMuWS5a6MQEOF0wi5yTOkdcnAV8+99M52 Kl8gn5p0s3sOrvX2RoJGjm7238aOxybubfFqVXWyznR0V+NPtuDXEYBl2FwNgONVABzl4Q YNj/Z475tc3AsiHqyscBXGv03yQByAXCYYibCkWDRmtNEZ0rTrNnwlnmx51+tOCBDQzCOc PBPqttZrlKmVrigbUHmXDN+rDqDsX4TDnqhHxBIJBWIWBalKTU7HL1AMvtSEVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751467085; a=rsa-sha256; cv=none; b=Ksp61Ec/5hu9wagBK5VEbibIPsfvurjjcBqqgVxHjO/IcoZpzIP+uOvg2EfHkRazr5KjB2 Uf/uinkyXOMCxHRacFOjWWBCITs8R2UhK2Hll6Ug7rGqQo+nHeckajhqEcilbAx353T4Xx kLsOne9cz6ku6y8A/gduDzDbHUvt0QEDC05oLt3QJxCv/OuZo4q2mMZAmrWDGXkMVghKep RhQWwNqojvQjnmIO9V5KrMLUPNfUdZGUad8ygy48eB7/R7c0krMD6adyTB2uCVlAA3wLlt z1jyjb9rFJVLb01xv1hE/DxHchQ2CkUqhIGUVOpsyl8lsdQXqMJgIBX6LgD6Iw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXMvJ64KTz7bn; Wed, 02 Jul 2025 14:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562Ec4Wl021168; Wed, 2 Jul 2025 14:38:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562Ec4m9021165; Wed, 2 Jul 2025 14:38:04 GMT (envelope-from git) Date: Wed, 2 Jul 2025 14:38:04 GMT Message-Id: <202507021438.562Ec4m9021165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 3f6ba5c1d15c - main - files: Fix builds without "options UFS_ACL" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f6ba5c1d15cf2592e12a6befa4ca77742534555 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3f6ba5c1d15cf2592e12a6befa4ca77742534555 commit 3f6ba5c1d15cf2592e12a6befa4ca77742534555 Author: Rick Macklem AuthorDate: 2025-07-02 14:33:20 +0000 Commit: Rick Macklem CommitDate: 2025-07-02 14:35:34 +0000 files: Fix builds without "options UFS_ACL" Commit 50e733f19b37 broke kernel builds without "options UFS_ACL". This patch fixes it. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D51131 Fixes: 50e733f19b37 ("nfscl: Use delegation ACE when mounted with nocto") --- sys/conf/files | 2 +- sys/fs/nfsclient/nfs_clport.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index 84fae3c00ea6..75ee10be5896 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3865,7 +3865,7 @@ kern/sched_ule.c optional sched_ule kern/serdev_if.m standard kern/stack_protector.c standard \ compile-with "${NORMAL_C:N-fstack-protector*}" -kern/subr_acl_nfs4.c optional ufs_acl | zfs +kern/subr_acl_nfs4.c optional ufs_acl | zfs | nfscl kern/subr_acl_posix1e.c optional ufs_acl kern/subr_asan.c optional kasan \ compile-with "${NOSAN_C:N-fstack-protector*}" diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index ce7221c133cf..b25d967982a1 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1489,3 +1489,4 @@ MODULE_DEPEND(nfscl, nfscommon, 1, 1, 1); MODULE_DEPEND(nfscl, krpc, 1, 1, 1); MODULE_DEPEND(nfscl, nfssvc, 1, 1, 1); MODULE_DEPEND(nfscl, xdr, 1, 1, 1); +MODULE_DEPEND(nfscl, acl_nfs4, 1, 1, 1); From nobody Wed Jul 2 15:33:14 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXP6z071fz60Yxn; Wed, 02 Jul 2025 15:33: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXP6y70pfz3x22; Wed, 02 Jul 2025 15:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751470394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YCDp7YCZEuv9BguaqqXIluevGkUpfBmgEZu9VxxM+XQ=; b=XPdtRdcEesgVlxfTWd0EzvftmlWmMNFkY9PA0GPaTF5VBXiqnx+vdAFjqkwqTiWBTIHwPe Fy+Z3q2RkqWKHj8/qGaRWeaLsH1JcWY2i4g4d8saUQnj1HS6tw2+Cn4OuB8tqCZoOAMjKv /iKqYEiUM2YBpVuTEmQxk2NvmvLGkXcITrc7wJcMlWHa1+LZAC2ILXcOczM2o/lgsW4Vfs edrrzJdgofiGzMZe9AXmAGVYTkzYqEjmi4zTp7vw/7Po8pf26mibtT5EM0h4+LTHxPYjm5 rijFw/ZZ68Qj9amjPuFL2EYKYmx5y+iDWGp5s98Rau2CxfLNN7SJwiVrIu+WHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751470394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YCDp7YCZEuv9BguaqqXIluevGkUpfBmgEZu9VxxM+XQ=; b=OUJ7QVU8RtdaCjEq9562/x6eUyoiOv069RFSpmcFHlEPPakx/2GE5BCzUeq5OxNIKBlTgW 8jAy3JILUhzhuD2ofsItGuhWxVpVt9Yfguo6Pvr8shISviGtZjtzvS1iOsKCpP02xUjU5u skIH5XID2fnpWMGEpXyZyuVczlm5mtfbse36966z+P/CH5bJQmpZXsNj2i67aeg8LpRd2N TKXmlOSHLDq5eMzfpMh7T72VmRQqTU38HLkskPb+8Ouy0DWaaKUhLN4+9E8myIHT7FZ82n lQhZNJY5riJzRODYkhS7PbEifc42OfXiR5umATdrlZc+WXLerp4ZygZz9HLFYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751470394; a=rsa-sha256; cv=none; b=JSyXqa47sG0ydrnlo1yJx6KTYxJBnQJkjjen3APib7KjY5jYuD+HnGK4qyqIHON/EZt+DE TtJz3sh/oxP5HRZdUt7GiZxInA+0xxEfbjSRxbXTGneO6u8WdhXnBXdwz+gF1nvetzLllp Rq15ZxjVdPO72IHYhLks1t5V4wmo0zofte16HXzRpOzrkoVljgAUXrZ07GKUlQPcjYyX52 KkfCujPjojv1dRyrSLtu6eBc+nNXsgj+hfpFqbK7AFnLG0Udfdssr921ED1vjzVDvONgY5 w7a6uzE34v/Kti7848a/tDYRDn0R3bOJl6JUKACP/+0MikeLsf6FBQDAUj7oXw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXP6y6YJcz9KV; Wed, 02 Jul 2025 15:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562FXEEs032342; Wed, 2 Jul 2025 15:33:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562FXEKk032339; Wed, 2 Jul 2025 15:33:14 GMT (envelope-from git) Date: Wed, 2 Jul 2025 15:33:14 GMT Message-Id: <202507021533.562FXEKk032339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e91022168101 - main - md(4): move type-specific data under union List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e91022168101867664e08b4de1f3f09ed4af231c Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e91022168101867664e08b4de1f3f09ed4af231c commit e91022168101867664e08b4de1f3f09ed4af231c Author: Konstantin Belousov AuthorDate: 2025-07-02 13:08:56 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-02 15:32:58 +0000 md(4): move type-specific data under union This way it is clear which type uses which members. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D51127 --- sys/dev/md/md.c | 263 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 155 insertions(+), 108 deletions(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 800684e9e63b..b842d4f2fd8e 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -264,25 +264,40 @@ struct md_s { struct g_provider *pp; int (*start)(struct md_s *sc, struct bio *bp); struct devstat *devstat; - bool candelete; - - /* MD_MALLOC related fields */ - struct indir *indir; - uma_zone_t uma; - - /* MD_PRELOAD related fields */ - u_char *pl_ptr; - size_t pl_len; - - /* MD_VNODE related fields */ - struct vnode *vnode; - char file[PATH_MAX]; - char label[PATH_MAX]; struct ucred *cred; - vm_offset_t kva; + char label[PATH_MAX]; + bool candelete; - /* MD_SWAP related fields */ - vm_object_t object; + union { + /* MD_MALLOC related fields */ + struct { + struct indir *indir; + uma_zone_t uma; + } s_malloc; + + /* MD_PRELOAD related fields */ + struct { + u_char *pl_ptr; + size_t pl_len; + char name[PATH_MAX]; + } s_preload; + + /* MD_VNODE related fields */ + struct { + struct vnode *vnode; + char file[PATH_MAX]; + vm_offset_t kva; + } s_vnode; + + /* MD_SWAP related fields */ + struct { + vm_object_t object; + } s_swap; + + /* MD_NULL */ + struct { + } s_null; + }; }; static struct indir * @@ -324,7 +339,7 @@ destroy_indir(struct md_s *sc, struct indir *ip) if (ip->shift) destroy_indir(sc, (struct indir*)(ip->array[i])); else if (ip->array[i] > 255) - uma_zfree(sc->uma, (void *)(ip->array[i])); + uma_zfree(sc->s_malloc.uma, (void *)(ip->array[i])); } del_indir(ip); } @@ -675,10 +690,10 @@ mdstart_malloc(struct md_s *sc, struct bio *bp) secno = bp->bio_offset / sc->sectorsize; error = 0; while (nsec--) { - osp = s_read(sc->indir, secno); + osp = s_read(sc->s_malloc.indir, secno); if (bp->bio_cmd == BIO_DELETE) { if (osp != 0) - error = s_write(sc->indir, secno, 0); + error = s_write(sc->s_malloc.indir, secno, 0); } else if (bp->bio_cmd == BIO_READ) { if (osp == 0) { if (notmapped) { @@ -743,10 +758,12 @@ mdstart_malloc(struct md_s *sc, struct bio *bp) } if (i == sc->sectorsize) { if (osp != uc) - error = s_write(sc->indir, secno, uc); + error = s_write(sc->s_malloc.indir, + secno, uc); } else { if (osp <= 255) { - sp = (uintptr_t)uma_zalloc(sc->uma, + sp = (uintptr_t)uma_zalloc( + sc->s_malloc.uma, md_malloc_wait ? M_WAITOK : M_NOWAIT); if (sp == 0) { @@ -767,7 +784,8 @@ mdstart_malloc(struct md_s *sc, struct bio *bp) bcopy(dst, (void *)sp, sc->sectorsize); } - error = s_write(sc->indir, secno, sp); + error = s_write(sc->s_malloc.indir, + secno, sp); } else { if (notmapped) { error = md_malloc_move_ma(&m, @@ -790,7 +808,7 @@ mdstart_malloc(struct md_s *sc, struct bio *bp) error = EOPNOTSUPP; } if (osp > 255) - uma_zfree(sc->uma, (void*)osp); + uma_zfree(sc->s_malloc.uma, (void*)osp); if (error != 0) break; secno++; @@ -848,7 +866,7 @@ mdstart_preload(struct md_s *sc, struct bio *bp) { uint8_t *p; - p = sc->pl_ptr + bp->bio_offset; + p = sc->s_preload.pl_ptr + bp->bio_offset; switch (bp->bio_cmd) { case BIO_READ: if ((bp->bio_flags & BIO_VLIST) != 0) { @@ -888,7 +906,7 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) bool mapped; td = curthread; - vp = sc->vnode; + vp = sc->s_vnode.vnode; piov = NULL; ma_offs = bp->bio_ma_offset; off = bp->bio_offset; @@ -922,8 +940,8 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) case BIO_DELETE: if (sc->candelete) { error = vn_deallocate(vp, &off, &len, 0, - sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred, - NOCRED); + sc->flags & MD_ASYNC ? 0 : IO_SYNC, + sc->cred, NOCRED); bp->bio_resid = len; return (error); } @@ -963,8 +981,10 @@ unmapped_step: KASSERT(iolen > 0, ("zero iolen")); KASSERT(npages <= atop(maxphys + PAGE_SIZE), ("npages %d too large", npages)); - pmap_qenter(sc->kva, &bp->bio_ma[atop(ma_offs)], npages); - aiov.iov_base = (void *)(sc->kva + (ma_offs & PAGE_MASK)); + pmap_qenter(sc->s_vnode.kva, &bp->bio_ma[atop(ma_offs)], + npages); + aiov.iov_base = (void *)(sc->s_vnode.kva + (ma_offs & + PAGE_MASK)); aiov.iov_len = iolen; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; @@ -998,7 +1018,7 @@ unmapped_step: POSIX_FADV_DONTNEED); if (mapped) { - pmap_qremove(sc->kva, npages); + pmap_qremove(sc->s_vnode.kva, npages); if (error == 0) { len -= iolen; bp->bio_resid -= iolen; @@ -1052,20 +1072,21 @@ mdstart_swap(struct md_s *sc, struct bio *bp) lastend = (bp->bio_offset + bp->bio_length - 1) % PAGE_SIZE + 1; rv = VM_PAGER_OK; - vm_object_pip_add(sc->object, 1); + vm_object_pip_add(sc->s_swap.object, 1); for (i = bp->bio_offset / PAGE_SIZE; i <= lastp; i++) { len = ((i == lastp) ? lastend : PAGE_SIZE) - offs; - m = vm_page_grab_unlocked(sc->object, i, VM_ALLOC_SYSTEM); + m = vm_page_grab_unlocked(sc->s_swap.object, i, + VM_ALLOC_SYSTEM); if (bp->bio_cmd == BIO_READ) { if (vm_page_all_valid(m)) rv = VM_PAGER_OK; else - rv = vm_pager_get_pages(sc->object, &m, 1, - NULL, NULL); + rv = vm_pager_get_pages(sc->s_swap.object, + &m, 1, NULL, NULL); if (rv == VM_PAGER_ERROR) { - VM_OBJECT_WLOCK(sc->object); + VM_OBJECT_WLOCK(sc->s_swap.object); vm_page_free(m); - VM_OBJECT_WUNLOCK(sc->object); + VM_OBJECT_WUNLOCK(sc->s_swap.object); break; } else if (rv == VM_PAGER_FAIL) { /* @@ -1092,12 +1113,12 @@ mdstart_swap(struct md_s *sc, struct bio *bp) if (len == PAGE_SIZE || vm_page_all_valid(m)) rv = VM_PAGER_OK; else - rv = vm_pager_get_pages(sc->object, &m, 1, - NULL, NULL); + rv = vm_pager_get_pages(sc->s_swap.object, + &m, 1, NULL, NULL); if (rv == VM_PAGER_ERROR) { - VM_OBJECT_WLOCK(sc->object); + VM_OBJECT_WLOCK(sc->s_swap.object); vm_page_free(m); - VM_OBJECT_WUNLOCK(sc->object); + VM_OBJECT_WUNLOCK(sc->s_swap.object); break; } else if (rv == VM_PAGER_FAIL) pmap_zero_page(m); @@ -1118,12 +1139,12 @@ mdstart_swap(struct md_s *sc, struct bio *bp) if (len == PAGE_SIZE || vm_page_all_valid(m)) rv = VM_PAGER_OK; else - rv = vm_pager_get_pages(sc->object, &m, 1, - NULL, NULL); - VM_OBJECT_WLOCK(sc->object); + rv = vm_pager_get_pages(sc->s_swap.object, + &m, 1, NULL, NULL); + VM_OBJECT_WLOCK(sc->s_swap.object); if (rv == VM_PAGER_ERROR) { vm_page_free(m); - VM_OBJECT_WUNLOCK(sc->object); + VM_OBJECT_WUNLOCK(sc->s_swap.object); break; } else if (rv == VM_PAGER_FAIL) { vm_page_free(m); @@ -1139,7 +1160,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) m = NULL; } } - VM_OBJECT_WUNLOCK(sc->object); + VM_OBJECT_WUNLOCK(sc->s_swap.object); } if (m != NULL) { /* @@ -1159,7 +1180,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) offs = 0; ma_offs += len; } - vm_object_pip_wakeup(sc->object); + vm_object_pip_wakeup(sc->s_swap.object); return (rv != VM_PAGER_ERROR ? 0 : ENOSPC); } @@ -1354,18 +1375,18 @@ mdcreate_malloc(struct md_s *sc, struct md_req *mdr) if (mdr->md_fwheads != 0) sc->fwheads = mdr->md_fwheads; sc->flags = mdr->md_options & (MD_COMPRESS | MD_FORCE | MD_RESERVE); - sc->indir = dimension(sc->mediasize / sc->sectorsize); - sc->uma = uma_zcreate(sc->name, sc->sectorsize, NULL, NULL, NULL, NULL, - 0x1ff, 0); + sc->s_malloc.indir = dimension(sc->mediasize / sc->sectorsize); + sc->s_malloc.uma = uma_zcreate(sc->name, sc->sectorsize, NULL, NULL, + NULL, NULL, 0x1ff, 0); if (mdr->md_options & MD_RESERVE) { off_t nsectors; nsectors = sc->mediasize / sc->sectorsize; for (u = 0; u < nsectors; u++) { - sp = (uintptr_t)uma_zalloc(sc->uma, (md_malloc_wait ? - M_WAITOK : M_NOWAIT) | M_ZERO); + sp = (uintptr_t)uma_zalloc(sc->s_malloc.uma, + (md_malloc_wait ? M_WAITOK : M_NOWAIT) | M_ZERO); if (sp != 0) - error = s_write(sc->indir, u, sp); + error = s_write(sc->s_malloc.indir, u, sp); else error = ENOMEM; if (error != 0) @@ -1393,7 +1414,7 @@ mdsetcred(struct md_s *sc, struct ucred *cred) * Horrible kludge to establish credentials for NFS XXX. */ - if (sc->vnode) { + if (sc->type == MD_VNODE && sc->s_vnode.vnode != NULL) { struct uio auio; struct iovec aiov; @@ -1408,9 +1429,9 @@ mdsetcred(struct md_s *sc, struct ucred *cred) auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_SYSSPACE; auio.uio_resid = aiov.iov_len; - vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY); - error = VOP_READ(sc->vnode, &auio, 0, sc->cred); - VOP_UNLOCK(sc->vnode); + vn_lock(sc->s_vnode.vnode, LK_EXCLUSIVE | LK_RETRY); + error = VOP_READ(sc->s_vnode.vnode, &auio, 0, sc->cred); + VOP_UNLOCK(sc->s_vnode.vnode); free(tmpbuf, M_TEMP); } return (error); @@ -1427,11 +1448,12 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td) fname = mdr->md_file; if (mdr->md_file_seg == UIO_USERSPACE) { - error = copyinstr(fname, sc->file, sizeof(sc->file), NULL); + error = copyinstr(fname, sc->s_vnode.file, + sizeof(sc->s_vnode.file), NULL); if (error != 0) return (error); } else if (mdr->md_file_seg == UIO_SYSSPACE) - strlcpy(sc->file, fname, sizeof(sc->file)); + strlcpy(sc->s_vnode.file, fname, sizeof(sc->s_vnode.file)); else return (EDOOFUS); @@ -1441,7 +1463,7 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td) */ flags = FREAD | ((mdr->md_options & MD_READONLY) ? 0 : FWRITE) \ | ((mdr->md_options & MD_VERIFY) ? O_VERIFY : 0); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->file); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->s_vnode.file); error = vn_open(&nd, &flags, 0, NULL); if (error != 0) return (error); @@ -1481,17 +1503,17 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td) MD_VERIFY | MD_MUSTDEALLOC); if (!(flags & FWRITE)) sc->flags |= MD_READONLY; - sc->vnode = nd.ni_vp; + sc->s_vnode.vnode = nd.ni_vp; error = mdsetcred(sc, td->td_ucred); if (error != 0) { - sc->vnode = NULL; + sc->s_vnode.vnode = NULL; vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY); nd.ni_vp->v_vflag &= ~VV_MD; goto bad; } - sc->kva = kva_alloc(maxphys + PAGE_SIZE); + sc->s_vnode.kva = kva_alloc(maxphys + PAGE_SIZE); return (0); bad: VOP_UNLOCK(nd.ni_vp); @@ -1535,23 +1557,30 @@ mddestroy(struct md_s *sc, struct thread *td) msleep(sc->procp, &sc->queue_mtx, PRIBIO, "mddestroy", hz / 10); mtx_unlock(&sc->queue_mtx); mtx_destroy(&sc->queue_mtx); - if (sc->vnode != NULL) { - vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY); - sc->vnode->v_vflag &= ~VV_MD; - VOP_UNLOCK(sc->vnode); - (void)vn_close(sc->vnode, sc->flags & MD_READONLY ? + switch (sc->type) { + case MD_VNODE: + vn_lock(sc->s_vnode.vnode, LK_EXCLUSIVE | LK_RETRY); + sc->s_vnode.vnode->v_vflag &= ~VV_MD; + VOP_UNLOCK(sc->s_vnode.vnode); + (void)vn_close(sc->s_vnode.vnode, sc->flags & MD_READONLY ? FREAD : (FREAD|FWRITE), sc->cred, td); + kva_free(sc->s_vnode.kva, maxphys + PAGE_SIZE); + break; + case MD_SWAP: + vm_object_deallocate(sc->s_swap.object); + break; + case MD_MALLOC: + destroy_indir(sc, sc->s_malloc.indir); + uma_zdestroy(sc->s_malloc.uma); + break; + case MD_PRELOAD: + case MD_NULL: + break; + default: + __assert_unreachable(); } if (sc->cred != NULL) crfree(sc->cred); - if (sc->object != NULL) - vm_object_deallocate(sc->object); - if (sc->indir) - destroy_indir(sc, sc->indir); - if (sc->uma) - uma_zdestroy(sc->uma); - if (sc->kva) - kva_free(sc->kva, maxphys + PAGE_SIZE); LIST_REMOVE(sc, list); free_unr(md_uh, sc->unit); @@ -1576,13 +1605,14 @@ mdresize(struct md_s *sc, struct md_req *mdr) oldpages = OFF_TO_IDX(sc->mediasize); newpages = OFF_TO_IDX(mdr->md_mediasize); if (newpages < oldpages) { - VM_OBJECT_WLOCK(sc->object); - vm_object_page_remove(sc->object, newpages, 0, 0); + VM_OBJECT_WLOCK(sc->s_swap.object); + vm_object_page_remove(sc->s_swap.object, newpages, + 0, 0); swap_release_by_cred(IDX_TO_OFF(oldpages - newpages), sc->cred); - sc->object->charge = IDX_TO_OFF(newpages); - sc->object->size = newpages; - VM_OBJECT_WUNLOCK(sc->object); + sc->s_swap.object->charge = IDX_TO_OFF(newpages); + sc->s_swap.object->size = newpages; + VM_OBJECT_WUNLOCK(sc->s_swap.object); } else if (newpages > oldpages) { res = swap_reserve_by_cred(IDX_TO_OFF(newpages - oldpages), sc->cred); @@ -1590,7 +1620,7 @@ mdresize(struct md_s *sc, struct md_req *mdr) return (ENOMEM); if ((mdr->md_options & MD_RESERVE) || (sc->flags & MD_RESERVE)) { - error = swap_pager_reserve(sc->object, + error = swap_pager_reserve(sc->s_swap.object, oldpages, newpages - oldpages); if (error < 0) { swap_release_by_cred( @@ -1599,10 +1629,10 @@ mdresize(struct md_s *sc, struct md_req *mdr) return (EDOM); } } - VM_OBJECT_WLOCK(sc->object); - sc->object->charge = IDX_TO_OFF(newpages); - sc->object->size = newpages; - VM_OBJECT_WUNLOCK(sc->object); + VM_OBJECT_WLOCK(sc->s_swap.object); + sc->s_swap.object->charge = IDX_TO_OFF(newpages); + sc->s_swap.object->size = newpages; + VM_OBJECT_WUNLOCK(sc->s_swap.object); } break; default: @@ -1643,13 +1673,13 @@ mdcreate_swap(struct md_s *sc, struct md_req *mdr, struct thread *td) sc->fwsectors = mdr->md_fwsectors; if (mdr->md_fwheads != 0) sc->fwheads = mdr->md_fwheads; - sc->object = vm_pager_allocate(OBJT_SWAP, NULL, PAGE_SIZE * npage, - VM_PROT_DEFAULT, 0, td->td_ucred); - if (sc->object == NULL) + sc->s_swap.object = vm_pager_allocate(OBJT_SWAP, NULL, + PAGE_SIZE * npage, VM_PROT_DEFAULT, 0, td->td_ucred); + if (sc->s_swap.object == NULL) return (ENOMEM); sc->flags = mdr->md_options & (MD_FORCE | MD_RESERVE); if (mdr->md_options & MD_RESERVE) { - if (swap_pager_reserve(sc->object, 0, npage) < 0) { + if (swap_pager_reserve(sc->s_swap.object, 0, npage) < 0) { error = EDOM; goto finish; } @@ -1657,8 +1687,8 @@ mdcreate_swap(struct md_s *sc, struct md_req *mdr, struct thread *td) error = mdsetcred(sc, td->td_ucred); finish: if (error != 0) { - vm_object_deallocate(sc->object); - sc->object = NULL; + vm_object_deallocate(sc->s_swap.object); + sc->s_swap.object = NULL; } return (error); } @@ -1856,10 +1886,13 @@ kern_mdquery_locked(struct md_req *mdr) if (error != 0) return (error); } - if (sc->type == MD_VNODE || - (sc->type == MD_PRELOAD && mdr->md_file != NULL)) - error = copyout(sc->file, mdr->md_file, - strlen(sc->file) + 1); + if (sc->type == MD_VNODE) { + error = copyout(sc->s_vnode.file, mdr->md_file, + strlen(sc->s_vnode.file) + 1); + } else if (sc->type == MD_PRELOAD && mdr->md_file != NULL) { + error = copyout(sc->s_preload.name, mdr->md_file, + strlen(sc->s_preload.name) + 1); + } return (error); } @@ -2011,11 +2044,12 @@ md_preloaded(u_char *image, size_t length, const char *name) return; sc->mediasize = length; sc->sectorsize = DEV_BSIZE; - sc->pl_ptr = image; - sc->pl_len = length; + sc->s_preload.pl_ptr = image; + sc->s_preload.pl_len = length; sc->start = mdstart_preload; if (name != NULL) - strlcpy(sc->file, name, sizeof(sc->file)); + strlcpy(sc->s_preload.name, name, + sizeof(sc->s_preload.name)); #ifdef MD_ROOT if (sc->unit == 0) { #ifndef ROOTDEVNAME @@ -2127,9 +2161,14 @@ g_md_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, sbuf_printf(sb, " fs %ju", (uintmax_t) mp->fwsectors); sbuf_printf(sb, " l %ju", (uintmax_t) mp->mediasize); sbuf_printf(sb, " t %s", type); - if ((mp->type == MD_VNODE && mp->vnode != NULL) || - (mp->type == MD_PRELOAD && mp->file[0] != '\0')) - sbuf_printf(sb, " file %s", mp->file); + if (mp->type == MD_VNODE && + mp->s_vnode.vnode != NULL) + sbuf_printf(sb, " file %s", mp->s_vnode.file); + if (mp->type == MD_PRELOAD && + mp->s_preload.name[0] != '\0') { + sbuf_printf(sb, " file %s", + mp->s_preload.name); + } sbuf_printf(sb, " label %s", mp->label); } else { sbuf_printf(sb, "%s%d\n", indent, @@ -2154,15 +2193,23 @@ g_md_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, "read-only"); sbuf_printf(sb, "%s%s\n", indent, type); - if ((mp->type == MD_VNODE && mp->vnode != NULL) || - (mp->type == MD_PRELOAD && mp->file[0] != '\0')) { + if (mp->type == MD_VNODE) { + if (mp->s_vnode.vnode != NULL) { + sbuf_printf(sb, "%s", indent); + g_conf_printf_escaped(sb, "%s", + mp->s_vnode.file); + sbuf_printf(sb, "\n"); + } + sbuf_printf(sb, "%s%s\n", indent, + (mp->flags & MD_CACHE) == 0 ? "off": "on"); + } + if (mp->type == MD_PRELOAD && + mp->s_preload.name[0] != '\0') { sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", mp->file); + g_conf_printf_escaped(sb, "%s", + mp->s_preload.name); sbuf_printf(sb, "\n"); } - if (mp->type == MD_VNODE) - sbuf_printf(sb, "%s%s\n", indent, - (mp->flags & MD_CACHE) == 0 ? "off": "on"); sbuf_printf(sb, "%s\n"); From nobody Wed Jul 2 16:32:43 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXQRc0hq6z60dr2; Wed, 02 Jul 2025 16:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXQRc03jmz44Jt; Wed, 02 Jul 2025 16:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751473964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bTNuNl8EsMASob5kWyU5ayc67NfwxyZdf0jMmhUmmJM=; b=aDzx4Yko3N/fxt0IyC/2oSuY5WY0x1SY7tAO1C6jRhy6vFDcd7fkWoQHxjrs+onhx0Jo9h rIo382i5xiSSMIOc9wwMGJEcdRYfmXE1sMYM/tAWGS1o7/S/Mfy1XP5prsCcUaI0wydKil YzSpg99lyQp4JvUIu1Ub0E/3uvmcHqRSQPkgKinrqJZTpfvOqifQ5beXIA5JAYh8NFvw4Z rXPuViAyPiQQ44hff8O/5AVDK5FN0uIXqd4WIXNtXFu5sVZ4ppWmMAX+ewFspQc4Qxg6hE fRbYzwJJLTi5BxYnTlaV5jBNyftqo+vdoDM9a5OK2zDLWGIVEuKTHNqhvi0gCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751473964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bTNuNl8EsMASob5kWyU5ayc67NfwxyZdf0jMmhUmmJM=; b=S+Juve5K2M/1j0Fx42wsSNZIvZ26fq71MRZRs+x5gMwMpejKki5p3KbvnDq7o96cvD1wgl DZOb642R17VvsTgR8K5drKEurFT30OCW94E2OLIxd5t7NaGkZJ67IcBlE4TZzwv27CaLQm ggdUPGGRQ8Pb225kuLjN17dUyP8c+mpW6y6mr7yS3lJnTNAeDWt/rGQh2e9ffaM9UWzgSk LAkbAeIZU+V1DaM94zLMA+9XEnCMS5rGsAjd++WJOs8RQEJOBE8BhC7L7y8TGrDBd+GbK5 4dYDsh7QGv7/vO9L5xeJgkMltd90qdp5kis34Ew4zI6QWwcO9ApW1BoSYG6jIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751473964; a=rsa-sha256; cv=none; b=De140rvos7aAdOxOUJ/fDH1D45yrNH21dFNBkIuz7PRXfvbPwCSQvDG7HMWGkebAzHxW1m nBZCqfALD4XPzTOPb/1DBhgw6OvPu9IW2oOvV/nCh/hRyTnUxYXK6ckH84vmuRdblk+t/f 8/taM0DXdW64TQq5n6zPFtcoFqAEjPzKIv03gVUrGA71LEAF+y6m051AmK733CFvoaow9z vLiyzqyIlPRcNwE8VQd3FhEDaoKZAjIZEZmGGbd6rkLeuty+PwyGGewRFUyJh1M1tw+zJ6 cAwz77MTKFuf7fiuswdZDoOxsfQCV91rFlTyGv+NV/Y30XKKfmq13DfRRFXh7w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXQRb6mn2zC2B; Wed, 02 Jul 2025 16:32:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562GWhlt046924; Wed, 2 Jul 2025 16:32:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562GWhm8046921; Wed, 2 Jul 2025 16:32:43 GMT (envelope-from git) Date: Wed, 2 Jul 2025 16:32:43 GMT Message-Id: <202507021632.562GWhm8046921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3e041faa828a - main - savecore/tests: Serialize the livedump test List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e041faa828a359ef0b91b5203eed5ab2c11e42d Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e041faa828a359ef0b91b5203eed5ab2c11e42d commit 3e041faa828a359ef0b91b5203eed5ab2c11e42d Author: Mark Johnston AuthorDate: 2025-07-02 15:04:25 +0000 Commit: Mark Johnston CommitDate: 2025-07-02 16:30:46 +0000 savecore/tests: Serialize the livedump test It assumes that the output of kldstat doesn't change over the course of the test, but this isn't true with parallel tests enabled. MFC after: 2 weeks --- sbin/savecore/tests/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sbin/savecore/tests/Makefile b/sbin/savecore/tests/Makefile index 81e6b8ce2667..7ec3c9aeedcc 100644 --- a/sbin/savecore/tests/Makefile +++ b/sbin/savecore/tests/Makefile @@ -1,3 +1,6 @@ ATF_TESTS_SH= livedump_test log_test +# The test fails if any kernel modules are loaded while the test is running. +TEST_METADATA.livedump_test+= is_exclusive=true + .include From nobody Wed Jul 2 16:40:14 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXQcH1FwFz60f3H; Wed, 02 Jul 2025 16:40: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXQcG75YTz44Z6; Wed, 02 Jul 2025 16:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751474415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vd1bExKkYKaI+vuu9TH7mUVGbbAXt2ZAOELM4qkeWvM=; b=YDJhYmLUO9pRSTg3YXUt0TRReLj9Khdx4D/azuIkob9ocOqbyvmpbbHRsERd+PsrUJfJOh eF/SF+LEfgwTeEmnpK73Rhgxq4/BVeMdu7EVvnNV+Tcmf1htWTVRXiydnNJXJYgtiYQsq0 ixKeBhaCxM5F2fUQOhj/6sQyR4guY3c1anWV3P7WkKI24I5S1hqpfZqkDtZ3mkWcNtk3PO RcZxn16M+aSP5tI14YmxameLPTdN9b7xGpKyR790DmouDpl7eN2VdGlY39R0ayb4qgqxMV yt1/x+ewMKrP4ge6trQE2HkYKg7sukviwQQeK4unW/5xliFvPy81GeM+dFW4Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751474415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vd1bExKkYKaI+vuu9TH7mUVGbbAXt2ZAOELM4qkeWvM=; b=Ct6ncPYOM+HuQYUFhsNOv7tLGir9s0kKaCyHIMkSSdiHMtiazqzm/86m5X4RwUV5prS8ev UltujvpHtLzxdZAsZfTn1gHs0ZAKXIwcvPIKnGpIijTdVNFiWwkIqMmxRqKysa12jpEL9O 57CwiuTwhNNPQFAAZspymnUhXupHHnM7vpU4aLzIn5UPtf1XQ/ayAnVlrg8S8YEArmZqxk AGqmGjkh2AWNJls0r63H1wwlxtVYJGeNDqdiaRIDCKQSOmJEmfQQj3WgT1ac98hLI2g0l1 HM33CM22jhpuTZeObftvCVqIWXCOxcxjXNeecCxnrk718cO04jC8sv63NJIDPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751474415; a=rsa-sha256; cv=none; b=Z/KbzAdSdy3SRcvhST3CM8WSMHO49QcQahyp5MXX9twMhFZpQOnurpJ4t8Az7B+mdH6WN8 DPN5gQ9a7HPIvub3ufOrqC1yOUXMrAEIygUowGzg+3b4845Ei+D9cLVoGgmWMgeV6oYmQ8 gvjGqHep9jsGtOLNjxDeXebBA8P80lsfH+acmQ1itASBzkv9d11tGoAlzhhCUNfrA88ded X2pMr5bA2oOMLqAeqLTHkjy5eb6sDra4G1ZtL2IG7fjFtsTHJPv0S2dXf1SKnLTII49dgn eSaqOGBS/SuWgdtM0mFWpN65ITYKtVglSoj2cbQTTvSroQUpfsLyVEV12/a4Og== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXQcG6DJ1zBrX; Wed, 02 Jul 2025 16:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562GeEkp055979; Wed, 2 Jul 2025 16:40:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562GeEsW055973; Wed, 2 Jul 2025 16:40:14 GMT (envelope-from git) Date: Wed, 2 Jul 2025 16:40:14 GMT Message-Id: <202507021640.562GeEsW055973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 1b06e0b889f8 - main - Revert "src/Makefile: log real/user/system time for build targets" List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b06e0b889f82046bd2ed6acb54fed00313b0b90 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=1b06e0b889f82046bd2ed6acb54fed00313b0b90 commit 1b06e0b889f82046bd2ed6acb54fed00313b0b90 Author: Brooks Davis AuthorDate: 2025-07-02 16:39:26 +0000 Commit: Brooks Davis CommitDate: 2025-07-02 16:39:26 +0000 Revert "src/Makefile: log real/user/system time for build targets" This broke `make makeman` by unconditionally adding output to all top level targets. Lacking an obvious and trivial workaround, it makes sense to back it out and rethink. This reverts commit afa70490ee779646fa0e936801cb28795580bf01. PR: 287274 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51119 --- Makefile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d600eb69ed4b..4afec2a80c60 100644 --- a/Makefile +++ b/Makefile @@ -376,22 +376,13 @@ buildworld: upgrade_checks kernel-toolchain: upgrade_checks .endif -# we need the system time(1) command, not from the shell -time_cmd= /usr/bin/time - -# mktemp(1) is not portable -mktemp_cmd= mktemp /tmp/_time-logging-XXXXXXXXX - # # Handle the user-driven targets, using the source relative mk files. # tinderbox toolchains kernel-toolchains: .MAKE ${TGTS}: .PHONY .MAKE - ${_+_}@cd ${.CURDIR}; _time_tmp=$$(${mktemp_cmd}); \ - ${time_cmd} -o $${_time_tmp} -p env ${_MAKE} ${.TARGET}; \ - echo ">>> Time spent on target ${.TARGET}: $$(tr '\n' ' ' < $${_time_tmp})"; \ - rm -f $${_time_tmp} + ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} # The historic default "all" target creates files which may cause stale # or (in the cross build case) unlinkable results. Fail with an error From nobody Wed Jul 2 18:09:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXSZr4F0pz60lGs; Wed, 02 Jul 2025 18:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXSZr3w0sz3DyC; Wed, 02 Jul 2025 18:09:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751479748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ScF/lsmId1ZN/e60UtvjXacyHwrcS8L5b9ogZ9M/vKs=; b=NNE8VHY7hDc73l0GVdPb66ExAd14cvBImg4cldynm07ZNCTnOQwdSzlC9BniBr9pi8Gehw gtRxunD2dvQxniKGLOhwZHf6SflWLzO12Upk6aVhENZZlFHTFCmeF8VBb4WxZd9CCcd1oP KDJgFjmhom6gBCEDcNRJeq65+j1wlYR3leukpPUWE1V1V1idc6DZwTqH9FR5E8IV+4aYbS Vk6LAE7ROiY/iAJOE9bsshJdfH5wCAho43rmBTOWxZLizjOqxtbDWyOw/O/VbgpruhFMa4 ttHwPNad3il6inS3RwUu2VXXjlD8CZyPHpTWgN3P4BS2Mv3X/h58FYgt8uZcMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751479748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ScF/lsmId1ZN/e60UtvjXacyHwrcS8L5b9ogZ9M/vKs=; b=SfsQZzCRYX9YFT8JmR0D3ukZDcTe1TXdA+UKsePy1AdcNYj7ykqXoRLDSqUdsOvhMahLI2 RCKbiTcxclUTvsdcYtS9Dn1D+sVyrJ5CufLYxvHZtjspA22cSbPd/dViH6E0dUD3Xg4L5F MXvCdxcc/XOJAQXOE2sOnnE3DavNrC/duUTAwMeHpkzxllQmQ79WXeXCKKDPnYtony5Fhx 7lhTH4GqnNWhL9AgP+3WL4szgDwJBr8GhpGgPZeWkpJa6Np+KW+6dA++aU2hK8NfTnxFz4 7VYAZY8JzY9cG3YU2qFKdn8m5lxeuCH7onfMlg3/sRmwaRepHaPcZyzNa8lPFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751479748; a=rsa-sha256; cv=none; b=AMKEaKrebQrVzErlxflRAH9VbJ9Bl2Q20XaSEcgPOyimcLwC+K3uUGEPuNZdOiTEEudXzU jF8WpnPrrvBeZsomS6463y9YcEJ2RFi4H40qhzyOJXHqE/PcpHrm7rd5wc9ubgcSHKD/l4 NoJRwShu/W2uEmFIw2mWvjd/vShrqnfK5+aj98+CkmJZwVZM4Yu6OoKulrnMA4IKFLJHVJ ag90xn/fe1TOD4oDqZauR+1CO1CTXtkAYCXst+o4t9dEdiAN4JMFt2JcxLO1jExNrHcoZ9 N3hBRZEn3f5YSZXzloUqdszvjjZCALp7jHFEdqh2s3uuIFhs060fmGEJ3s0MtA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXSZr2wjfzVVF; Wed, 02 Jul 2025 18:09:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562I98WQ020631; Wed, 2 Jul 2025 18:09:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562I98r0020627; Wed, 2 Jul 2025 18:09:08 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:09:08 GMT Message-Id: <202507021809.562I98r0020627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 257b9d0755b2 - stable/14 - contrib/llvm-project: re-add clang/tools/clang-scan-deps List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 257b9d0755b29fc06d00900efb47f5f90f7fbd61 Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=257b9d0755b29fc06d00900efb47f5f90f7fbd61 commit 257b9d0755b29fc06d00900efb47f5f90f7fbd61 Author: Dimitry Andric AuthorDate: 2025-06-25 17:19:51 +0000 Commit: Dimitry Andric CommitDate: 2025-07-02 18:08:46 +0000 contrib/llvm-project: re-add clang/tools/clang-scan-deps This is in preparation for adding it as an optional tool in base. MFC after: 1 week (cherry picked from commit 7ed1628066eaf55b86f35af86efe804508201cc8) --- contrib/llvm-project/FREEBSD-Xlist | 3 +- .../clang/tools/clang-scan-deps/ClangScanDeps.cpp | 1055 ++++++++++++++++++++ .../clang/tools/clang-scan-deps/Opts.td | 42 + 3 files changed, 1098 insertions(+), 2 deletions(-) diff --git a/contrib/llvm-project/FREEBSD-Xlist b/contrib/llvm-project/FREEBSD-Xlist index 45cd2c1d6f46..43fa40070f5d 100644 --- a/contrib/llvm-project/FREEBSD-Xlist +++ b/contrib/llvm-project/FREEBSD-Xlist @@ -129,7 +129,7 @@ clang/tools/clang-offload-packager/ clang/tools/clang-refactor/ clang/tools/clang-rename/ clang/tools/clang-repl/ -clang/tools/clang-scan-deps/ +clang/tools/clang-scan-deps/CMakeLists.txt clang/tools/clang-shlib/ clang/tools/diag-build/ clang/tools/diagtool/ @@ -805,7 +805,6 @@ llvm/tools/llvm-bcanalyzer/CMakeLists.txt llvm/tools/llvm-c-test/ llvm/tools/llvm-cat/ llvm/tools/llvm-cfi-verify/ -llvm/tools/llvm-cgdata/ llvm/tools/llvm-config/ llvm/tools/llvm-cov/CMakeLists.txt llvm/tools/llvm-cvtres/ diff --git a/contrib/llvm-project/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/contrib/llvm-project/clang/tools/clang-scan-deps/ClangScanDeps.cpp new file mode 100644 index 000000000000..867df19c863f --- /dev/null +++ b/contrib/llvm-project/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -0,0 +1,1055 @@ +//===- ClangScanDeps.cpp - Implementation of clang-scan-deps --------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "clang/Driver/Compilation.h" +#include "clang/Driver/Driver.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Frontend/TextDiagnosticPrinter.h" +#include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/DependencyScanning/DependencyScanningService.h" +#include "clang/Tooling/DependencyScanning/DependencyScanningTool.h" +#include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h" +#include "clang/Tooling/JSONCompilationDatabase.h" +#include "clang/Tooling/Tooling.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileUtilities.h" +#include "llvm/Support/Format.h" +#include "llvm/Support/JSON.h" +#include "llvm/Support/LLVMDriver.h" +#include "llvm/Support/Program.h" +#include "llvm/Support/Signals.h" +#include "llvm/Support/TargetSelect.h" +#include "llvm/Support/ThreadPool.h" +#include "llvm/Support/Threading.h" +#include "llvm/Support/Timer.h" +#include "llvm/TargetParser/Host.h" +#include +#include +#include + +#include "Opts.inc" + +using namespace clang; +using namespace tooling::dependencies; + +namespace { + +using namespace llvm::opt; +enum ID { + OPT_INVALID = 0, // This is not an option ID. +#define OPTION(...) LLVM_MAKE_OPT_ID(__VA_ARGS__), +#include "Opts.inc" +#undef OPTION +}; + +#define PREFIX(NAME, VALUE) \ + constexpr llvm::StringLiteral NAME##_init[] = VALUE; \ + constexpr llvm::ArrayRef NAME( \ + NAME##_init, std::size(NAME##_init) - 1); +#include "Opts.inc" +#undef PREFIX + +const llvm::opt::OptTable::Info InfoTable[] = { +#define OPTION(...) LLVM_CONSTRUCT_OPT_INFO(__VA_ARGS__), +#include "Opts.inc" +#undef OPTION +}; + +class ScanDepsOptTable : public llvm::opt::GenericOptTable { +public: + ScanDepsOptTable() : GenericOptTable(InfoTable) { + setGroupedShortOptions(true); + } +}; + +enum ResourceDirRecipeKind { + RDRK_ModifyCompilerPath, + RDRK_InvokeCompiler, +}; + +static std::string OutputFileName = "-"; +static ScanningMode ScanMode = ScanningMode::DependencyDirectivesScan; +static ScanningOutputFormat Format = ScanningOutputFormat::Make; +static ScanningOptimizations OptimizeArgs; +static std::string ModuleFilesDir; +static bool EagerLoadModules; +static unsigned NumThreads = 0; +static std::string CompilationDB; +static std::string ModuleName; +static std::vector ModuleDepTargets; +static bool DeprecatedDriverCommand; +static ResourceDirRecipeKind ResourceDirRecipe; +static bool Verbose; +static bool PrintTiming; +static llvm::BumpPtrAllocator Alloc; +static llvm::StringSaver Saver{Alloc}; +static std::vector CommandLine; + +#ifndef NDEBUG +static constexpr bool DoRoundTripDefault = true; +#else +static constexpr bool DoRoundTripDefault = false; +#endif + +static bool RoundTripArgs = DoRoundTripDefault; + +static void ParseArgs(int argc, char **argv) { + ScanDepsOptTable Tbl; + llvm::StringRef ToolName = argv[0]; + llvm::opt::InputArgList Args = + Tbl.parseArgs(argc, argv, OPT_UNKNOWN, Saver, [&](StringRef Msg) { + llvm::errs() << Msg << '\n'; + std::exit(1); + }); + + if (Args.hasArg(OPT_help)) { + Tbl.printHelp(llvm::outs(), "clang-scan-deps [options]", "clang-scan-deps"); + std::exit(0); + } + if (Args.hasArg(OPT_version)) { + llvm::outs() << ToolName << '\n'; + llvm::cl::PrintVersionMessage(); + std::exit(0); + } + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_mode_EQ)) { + auto ModeType = + llvm::StringSwitch>(A->getValue()) + .Case("preprocess-dependency-directives", + ScanningMode::DependencyDirectivesScan) + .Case("preprocess", ScanningMode::CanonicalPreprocessing) + .Default(std::nullopt); + if (!ModeType) { + llvm::errs() << ToolName + << ": for the --mode option: Cannot find option named '" + << A->getValue() << "'\n"; + std::exit(1); + } + ScanMode = *ModeType; + } + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_format_EQ)) { + auto FormatType = + llvm::StringSwitch>(A->getValue()) + .Case("make", ScanningOutputFormat::Make) + .Case("p1689", ScanningOutputFormat::P1689) + .Case("experimental-full", ScanningOutputFormat::Full) + .Default(std::nullopt); + if (!FormatType) { + llvm::errs() << ToolName + << ": for the --format option: Cannot find option named '" + << A->getValue() << "'\n"; + std::exit(1); + } + Format = *FormatType; + } + + std::vector OptimizationFlags = + Args.getAllArgValues(OPT_optimize_args_EQ); + OptimizeArgs = ScanningOptimizations::None; + for (const auto &Arg : OptimizationFlags) { + auto Optimization = + llvm::StringSwitch>(Arg) + .Case("none", ScanningOptimizations::None) + .Case("header-search", ScanningOptimizations::HeaderSearch) + .Case("system-warnings", ScanningOptimizations::SystemWarnings) + .Case("vfs", ScanningOptimizations::VFS) + .Case("canonicalize-macros", ScanningOptimizations::Macros) + .Case("all", ScanningOptimizations::All) + .Default(std::nullopt); + if (!Optimization) { + llvm::errs() + << ToolName + << ": for the --optimize-args option: Cannot find option named '" + << Arg << "'\n"; + std::exit(1); + } + OptimizeArgs |= *Optimization; + } + if (OptimizationFlags.empty()) + OptimizeArgs = ScanningOptimizations::Default; + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_module_files_dir_EQ)) + ModuleFilesDir = A->getValue(); + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_o)) + OutputFileName = A->getValue(); + + EagerLoadModules = Args.hasArg(OPT_eager_load_pcm); + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_j)) { + StringRef S{A->getValue()}; + if (!llvm::to_integer(S, NumThreads, 0)) { + llvm::errs() << ToolName << ": for the -j option: '" << S + << "' value invalid for uint argument!\n"; + std::exit(1); + } + } + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_compilation_database_EQ)) + CompilationDB = A->getValue(); + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_module_name_EQ)) + ModuleName = A->getValue(); + + for (const llvm::opt::Arg *A : Args.filtered(OPT_dependency_target_EQ)) + ModuleDepTargets.emplace_back(A->getValue()); + + DeprecatedDriverCommand = Args.hasArg(OPT_deprecated_driver_command); + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_resource_dir_recipe_EQ)) { + auto Kind = + llvm::StringSwitch>(A->getValue()) + .Case("modify-compiler-path", RDRK_ModifyCompilerPath) + .Case("invoke-compiler", RDRK_InvokeCompiler) + .Default(std::nullopt); + if (!Kind) { + llvm::errs() << ToolName + << ": for the --resource-dir-recipe option: Cannot find " + "option named '" + << A->getValue() << "'\n"; + std::exit(1); + } + ResourceDirRecipe = *Kind; + } + + PrintTiming = Args.hasArg(OPT_print_timing); + + Verbose = Args.hasArg(OPT_verbose); + + RoundTripArgs = Args.hasArg(OPT_round_trip_args); + + if (const llvm::opt::Arg *A = Args.getLastArgNoClaim(OPT_DASH_DASH)) + CommandLine.assign(A->getValues().begin(), A->getValues().end()); +} + +class SharedStream { +public: + SharedStream(raw_ostream &OS) : OS(OS) {} + void applyLocked(llvm::function_ref Fn) { + std::unique_lock LockGuard(Lock); + Fn(OS); + OS.flush(); + } + +private: + std::mutex Lock; + raw_ostream &OS; +}; + +class ResourceDirectoryCache { +public: + /// findResourceDir finds the resource directory relative to the clang + /// compiler being used in Args, by running it with "-print-resource-dir" + /// option and cache the results for reuse. \returns resource directory path + /// associated with the given invocation command or empty string if the + /// compiler path is NOT an absolute path. + StringRef findResourceDir(const tooling::CommandLineArguments &Args, + bool ClangCLMode) { + if (Args.size() < 1) + return ""; + + const std::string &ClangBinaryPath = Args[0]; + if (!llvm::sys::path::is_absolute(ClangBinaryPath)) + return ""; + + const std::string &ClangBinaryName = + std::string(llvm::sys::path::filename(ClangBinaryPath)); + + std::unique_lock LockGuard(CacheLock); + const auto &CachedResourceDir = Cache.find(ClangBinaryPath); + if (CachedResourceDir != Cache.end()) + return CachedResourceDir->second; + + std::vector PrintResourceDirArgs{ClangBinaryName}; + if (ClangCLMode) + PrintResourceDirArgs.push_back("/clang:-print-resource-dir"); + else + PrintResourceDirArgs.push_back("-print-resource-dir"); + + llvm::SmallString<64> OutputFile, ErrorFile; + llvm::sys::fs::createTemporaryFile("print-resource-dir-output", + "" /*no-suffix*/, OutputFile); + llvm::sys::fs::createTemporaryFile("print-resource-dir-error", + "" /*no-suffix*/, ErrorFile); + llvm::FileRemover OutputRemover(OutputFile.c_str()); + llvm::FileRemover ErrorRemover(ErrorFile.c_str()); + std::optional Redirects[] = { + {""}, // Stdin + OutputFile.str(), + ErrorFile.str(), + }; + if (llvm::sys::ExecuteAndWait(ClangBinaryPath, PrintResourceDirArgs, {}, + Redirects)) { + auto ErrorBuf = llvm::MemoryBuffer::getFile(ErrorFile.c_str()); + llvm::errs() << ErrorBuf.get()->getBuffer(); + return ""; + } + + auto OutputBuf = llvm::MemoryBuffer::getFile(OutputFile.c_str()); + if (!OutputBuf) + return ""; + StringRef Output = OutputBuf.get()->getBuffer().rtrim('\n'); + + Cache[ClangBinaryPath] = Output.str(); + return Cache[ClangBinaryPath]; + } + +private: + std::map Cache; + std::mutex CacheLock; +}; + +} // end anonymous namespace + +/// Takes the result of a dependency scan and prints error / dependency files +/// based on the result. +/// +/// \returns True on error. +static bool +handleMakeDependencyToolResult(const std::string &Input, + llvm::Expected &MaybeFile, + SharedStream &OS, SharedStream &Errs) { + if (!MaybeFile) { + llvm::handleAllErrors( + MaybeFile.takeError(), [&Input, &Errs](llvm::StringError &Err) { + Errs.applyLocked([&](raw_ostream &OS) { + OS << "Error while scanning dependencies for " << Input << ":\n"; + OS << Err.getMessage(); + }); + }); + return true; + } + OS.applyLocked([&](raw_ostream &OS) { OS << *MaybeFile; }); + return false; +} + +static llvm::json::Array toJSONSorted(const llvm::StringSet<> &Set) { + std::vector Strings; + for (auto &&I : Set) + Strings.push_back(I.getKey()); + llvm::sort(Strings); + return llvm::json::Array(Strings); +} + +// Technically, we don't need to sort the dependency list to get determinism. +// Leaving these be will simply preserve the import order. +static llvm::json::Array toJSONSorted(std::vector V) { + llvm::sort(V); + + llvm::json::Array Ret; + for (const ModuleID &MID : V) + Ret.push_back(llvm::json::Object( + {{"module-name", MID.ModuleName}, {"context-hash", MID.ContextHash}})); + return Ret; +} + +static llvm::json::Array +toJSONSorted(llvm::SmallVector &LinkLibs) { + llvm::sort(LinkLibs, [](const Module::LinkLibrary &lhs, + const Module::LinkLibrary &rhs) { + return lhs.Library < rhs.Library; + }); + + llvm::json::Array Ret; + for (const Module::LinkLibrary &LL : LinkLibs) + Ret.push_back(llvm::json::Object( + {{"link-name", LL.Library}, {"isFramework", LL.IsFramework}})); + return Ret; +} + +// Thread safe. +class FullDeps { +public: + FullDeps(size_t NumInputs) : Inputs(NumInputs) {} + + void mergeDeps(StringRef Input, TranslationUnitDeps TUDeps, + size_t InputIndex) { + mergeDeps(std::move(TUDeps.ModuleGraph), InputIndex); + + InputDeps ID; + ID.FileName = std::string(Input); + ID.ContextHash = std::move(TUDeps.ID.ContextHash); + ID.FileDeps = std::move(TUDeps.FileDeps); + ID.ModuleDeps = std::move(TUDeps.ClangModuleDeps); + ID.DriverCommandLine = std::move(TUDeps.DriverCommandLine); + ID.Commands = std::move(TUDeps.Commands); + + assert(InputIndex < Inputs.size() && "Input index out of bounds"); + assert(Inputs[InputIndex].FileName.empty() && "Result already populated"); + Inputs[InputIndex] = std::move(ID); + } + + void mergeDeps(ModuleDepsGraph Graph, size_t InputIndex) { + std::vector NewMDs; + { + std::unique_lock ul(Lock); + for (const ModuleDeps &MD : Graph) { + auto I = Modules.find({MD.ID, 0}); + if (I != Modules.end()) { + I->first.InputIndex = std::min(I->first.InputIndex, InputIndex); + continue; + } + auto Res = Modules.insert(I, {{MD.ID, InputIndex}, std::move(MD)}); + NewMDs.push_back(&Res->second); + } + // First call to \c getBuildArguments is somewhat expensive. Let's call it + // on the current thread (instead of the main one), and outside the + // critical section. + for (ModuleDeps *MD : NewMDs) + (void)MD->getBuildArguments(); + } + } + + bool roundTripCommand(ArrayRef ArgStrs, + DiagnosticsEngine &Diags) { + if (ArgStrs.empty() || ArgStrs[0] != "-cc1") + return false; + SmallVector Args; + for (const std::string &Arg : ArgStrs) + Args.push_back(Arg.c_str()); + return !CompilerInvocation::checkCC1RoundTrip(Args, Diags); + } + + // Returns \c true if any command lines fail to round-trip. We expect + // commands already be canonical when output by the scanner. + bool roundTripCommands(raw_ostream &ErrOS) { + IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions{}; + TextDiagnosticPrinter DiagConsumer(ErrOS, &*DiagOpts); + IntrusiveRefCntPtr Diags = + CompilerInstance::createDiagnostics(&*DiagOpts, &DiagConsumer, + /*ShouldOwnClient=*/false); + + for (auto &&M : Modules) + if (roundTripCommand(M.second.getBuildArguments(), *Diags)) + return true; + + for (auto &&I : Inputs) + for (const auto &Cmd : I.Commands) + if (roundTripCommand(Cmd.Arguments, *Diags)) + return true; + + return false; + } + + void printFullOutput(raw_ostream &OS) { + // Skip sorting modules and constructing the JSON object if the output + // cannot be observed anyway. This makes timings less noisy. + if (&OS == &llvm::nulls()) + return; + + // Sort the modules by name to get a deterministic order. + std::vector ModuleIDs; + for (auto &&M : Modules) + ModuleIDs.push_back(M.first); + llvm::sort(ModuleIDs); + + using namespace llvm::json; + + Array OutModules; + for (auto &&ModID : ModuleIDs) { + auto &MD = Modules[ModID]; + Object O{{"name", MD.ID.ModuleName}, + {"context-hash", MD.ID.ContextHash}, + {"file-deps", toJSONSorted(MD.FileDeps)}, + {"clang-module-deps", toJSONSorted(MD.ClangModuleDeps)}, + {"clang-modulemap-file", MD.ClangModuleMapFile}, + {"command-line", MD.getBuildArguments()}, + {"link-libraries", toJSONSorted(MD.LinkLibraries)}}; + OutModules.push_back(std::move(O)); + } + + Array TUs; + for (auto &&I : Inputs) { + Array Commands; + if (I.DriverCommandLine.empty()) { + for (const auto &Cmd : I.Commands) { + Object O{ + {"input-file", I.FileName}, + {"clang-context-hash", I.ContextHash}, + {"file-deps", I.FileDeps}, + {"clang-module-deps", toJSONSorted(I.ModuleDeps)}, + {"executable", Cmd.Executable}, + {"command-line", Cmd.Arguments}, + }; + Commands.push_back(std::move(O)); + } + } else { + Object O{ + {"input-file", I.FileName}, + {"clang-context-hash", I.ContextHash}, + {"file-deps", I.FileDeps}, + {"clang-module-deps", toJSONSorted(I.ModuleDeps)}, + {"executable", "clang"}, + {"command-line", I.DriverCommandLine}, + }; + Commands.push_back(std::move(O)); + } + TUs.push_back(Object{ + {"commands", std::move(Commands)}, + }); + } + + Object Output{ + {"modules", std::move(OutModules)}, + {"translation-units", std::move(TUs)}, + }; + + OS << llvm::formatv("{0:2}\n", Value(std::move(Output))); + } + +private: + struct IndexedModuleID { + ModuleID ID; + + // FIXME: This is mutable so that it can still be updated after insertion + // into an unordered associative container. This is "fine", since this + // field doesn't contribute to the hash, but it's a brittle hack. + mutable size_t InputIndex; + + bool operator==(const IndexedModuleID &Other) const { + return ID == Other.ID; + } + + bool operator<(const IndexedModuleID &Other) const { + /// We need the output of clang-scan-deps to be deterministic. However, + /// the dependency graph may contain two modules with the same name. How + /// do we decide which one to print first? If we made that decision based + /// on the context hash, the ordering would be deterministic, but + /// different across machines. This can happen for example when the inputs + /// or the SDKs (which both contribute to the "context" hash) live in + /// different absolute locations. We solve that by tracking the index of + /// the first input TU that (transitively) imports the dependency, which + /// is always the same for the same input, resulting in deterministic + /// sorting that's also reproducible across machines. + return std::tie(ID.ModuleName, InputIndex) < + std::tie(Other.ID.ModuleName, Other.InputIndex); + } + + struct Hasher { + std::size_t operator()(const IndexedModuleID &IMID) const { + return llvm::hash_value(IMID.ID); + } + }; + }; + + struct InputDeps { + std::string FileName; + std::string ContextHash; + std::vector FileDeps; + std::vector ModuleDeps; + std::vector DriverCommandLine; + std::vector Commands; + }; + + std::mutex Lock; + std::unordered_map + Modules; + std::vector Inputs; +}; + +static bool handleTranslationUnitResult( + StringRef Input, llvm::Expected &MaybeTUDeps, + FullDeps &FD, size_t InputIndex, SharedStream &OS, SharedStream &Errs) { + if (!MaybeTUDeps) { + llvm::handleAllErrors( + MaybeTUDeps.takeError(), [&Input, &Errs](llvm::StringError &Err) { + Errs.applyLocked([&](raw_ostream &OS) { + OS << "Error while scanning dependencies for " << Input << ":\n"; + OS << Err.getMessage(); + }); + }); + return true; + } + FD.mergeDeps(Input, std::move(*MaybeTUDeps), InputIndex); + return false; +} + +static bool handleModuleResult( + StringRef ModuleName, llvm::Expected &MaybeModuleGraph, + FullDeps &FD, size_t InputIndex, SharedStream &OS, SharedStream &Errs) { + if (!MaybeModuleGraph) { + llvm::handleAllErrors(MaybeModuleGraph.takeError(), + [&ModuleName, &Errs](llvm::StringError &Err) { + Errs.applyLocked([&](raw_ostream &OS) { + OS << "Error while scanning dependencies for " + << ModuleName << ":\n"; + OS << Err.getMessage(); + }); + }); + return true; + } + FD.mergeDeps(std::move(*MaybeModuleGraph), InputIndex); + return false; +} + +class P1689Deps { +public: + void printDependencies(raw_ostream &OS) { + addSourcePathsToRequires(); + // Sort the modules by name to get a deterministic order. + llvm::sort(Rules, [](const P1689Rule &A, const P1689Rule &B) { + return A.PrimaryOutput < B.PrimaryOutput; + }); + + using namespace llvm::json; + Array OutputRules; + for (const P1689Rule &R : Rules) { + Object O{{"primary-output", R.PrimaryOutput}}; + + if (R.Provides) { + Array Provides; + Object Provided{{"logical-name", R.Provides->ModuleName}, + {"source-path", R.Provides->SourcePath}, + {"is-interface", R.Provides->IsStdCXXModuleInterface}}; + Provides.push_back(std::move(Provided)); + O.insert({"provides", std::move(Provides)}); + } + + Array Requires; + for (const P1689ModuleInfo &Info : R.Requires) { + Object RequiredInfo{{"logical-name", Info.ModuleName}}; + if (!Info.SourcePath.empty()) + RequiredInfo.insert({"source-path", Info.SourcePath}); + Requires.push_back(std::move(RequiredInfo)); + } + + if (!Requires.empty()) + O.insert({"requires", std::move(Requires)}); + + OutputRules.push_back(std::move(O)); + } + + Object Output{ + {"version", 1}, {"revision", 0}, {"rules", std::move(OutputRules)}}; + + OS << llvm::formatv("{0:2}\n", Value(std::move(Output))); + } + + void addRules(P1689Rule &Rule) { + std::unique_lock LockGuard(Lock); + Rules.push_back(Rule); + } + +private: + void addSourcePathsToRequires() { + llvm::DenseMap ModuleSourceMapper; + for (const P1689Rule &R : Rules) + if (R.Provides && !R.Provides->SourcePath.empty()) + ModuleSourceMapper[R.Provides->ModuleName] = R.Provides->SourcePath; + + for (P1689Rule &R : Rules) { + for (P1689ModuleInfo &Info : R.Requires) { + auto Iter = ModuleSourceMapper.find(Info.ModuleName); + if (Iter != ModuleSourceMapper.end()) + Info.SourcePath = Iter->second; + } + } + } + + std::mutex Lock; + std::vector Rules; +}; + +static bool +handleP1689DependencyToolResult(const std::string &Input, + llvm::Expected &MaybeRule, + P1689Deps &PD, SharedStream &Errs) { + if (!MaybeRule) { + llvm::handleAllErrors( + MaybeRule.takeError(), [&Input, &Errs](llvm::StringError &Err) { + Errs.applyLocked([&](raw_ostream &OS) { + OS << "Error while scanning dependencies for " << Input << ":\n"; + OS << Err.getMessage(); + }); + }); + return true; + } + PD.addRules(*MaybeRule); + return false; +} + +/// Construct a path for the explicitly built PCM. +static std::string constructPCMPath(ModuleID MID, StringRef OutputDir) { + SmallString<256> ExplicitPCMPath(OutputDir); + llvm::sys::path::append(ExplicitPCMPath, MID.ContextHash, + MID.ModuleName + "-" + MID.ContextHash + ".pcm"); + return std::string(ExplicitPCMPath); +} + +static std::string lookupModuleOutput(const ModuleID &MID, ModuleOutputKind MOK, + StringRef OutputDir) { + std::string PCMPath = constructPCMPath(MID, OutputDir); + switch (MOK) { + case ModuleOutputKind::ModuleFile: + return PCMPath; + case ModuleOutputKind::DependencyFile: + return PCMPath + ".d"; + case ModuleOutputKind::DependencyTargets: + // Null-separate the list of targets. + return join(ModuleDepTargets, StringRef("\0", 1)); + case ModuleOutputKind::DiagnosticSerializationFile: + return PCMPath + ".diag"; + } + llvm_unreachable("Fully covered switch above!"); +} + +static std::string getModuleCachePath(ArrayRef Args) { + for (StringRef Arg : llvm::reverse(Args)) { + Arg.consume_front("/clang:"); + if (Arg.consume_front("-fmodules-cache-path=")) + return std::string(Arg); + } + SmallString<128> Path; + driver::Driver::getDefaultModuleCachePath(Path); + return std::string(Path); +} + +/// Attempts to construct the compilation database from '-compilation-database' +/// or from the arguments following the positional '--'. +static std::unique_ptr +getCompilationDatabase(int argc, char **argv, std::string &ErrorMessage) { + ParseArgs(argc, argv); + + if (!(CommandLine.empty() ^ CompilationDB.empty())) { + llvm::errs() << "The compilation command line must be provided either via " + "'-compilation-database' or after '--'."; + return nullptr; + } + + if (!CompilationDB.empty()) + return tooling::JSONCompilationDatabase::loadFromFile( + CompilationDB, ErrorMessage, + tooling::JSONCommandLineSyntax::AutoDetect); + + llvm::IntrusiveRefCntPtr Diags = + CompilerInstance::createDiagnostics(new DiagnosticOptions); + driver::Driver TheDriver(CommandLine[0], llvm::sys::getDefaultTargetTriple(), + *Diags); + TheDriver.setCheckInputsExist(false); + std::unique_ptr C( + TheDriver.BuildCompilation(CommandLine)); + if (!C || C->getJobs().empty()) + return nullptr; + + auto Cmd = C->getJobs().begin(); + auto CI = std::make_unique(); + CompilerInvocation::CreateFromArgs(*CI, Cmd->getArguments(), *Diags, + CommandLine[0]); + if (!CI) + return nullptr; + + FrontendOptions &FEOpts = CI->getFrontendOpts(); + if (FEOpts.Inputs.size() != 1) { + llvm::errs() + << "Exactly one input file is required in the per-file mode ('--').\n"; + return nullptr; + } + + // There might be multiple jobs for a compilation. Extract the specified + // output filename from the last job. + auto LastCmd = C->getJobs().end(); + LastCmd--; + if (LastCmd->getOutputFilenames().size() != 1) { + llvm::errs() + << "Exactly one output file is required in the per-file mode ('--').\n"; + return nullptr; + } + StringRef OutputFile = LastCmd->getOutputFilenames().front(); + + class InplaceCompilationDatabase : public tooling::CompilationDatabase { + public: + InplaceCompilationDatabase(StringRef InputFile, StringRef OutputFile, + ArrayRef CommandLine) + : Command(".", InputFile, {}, OutputFile) { + for (auto *C : CommandLine) + Command.CommandLine.push_back(C); + } + + std::vector + getCompileCommands(StringRef FilePath) const override { + if (FilePath != Command.Filename) + return {}; + return {Command}; + } + + std::vector getAllFiles() const override { + return {Command.Filename}; + } + + std::vector + getAllCompileCommands() const override { + return {Command}; + } + + private: + tooling::CompileCommand Command; + }; + + return std::make_unique( + FEOpts.Inputs[0].getFile(), OutputFile, CommandLine); +} + +int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) { + llvm::InitializeAllTargetInfos(); + std::string ErrorMessage; + std::unique_ptr Compilations = + getCompilationDatabase(argc, argv, ErrorMessage); + if (!Compilations) { + llvm::errs() << ErrorMessage << "\n"; + return 1; + } + + llvm::cl::PrintOptionValues(); + + // Expand response files in advance, so that we can "see" all the arguments + // when adjusting below. + Compilations = expandResponseFiles(std::move(Compilations), + llvm::vfs::getRealFileSystem()); + + Compilations = inferTargetAndDriverMode(std::move(Compilations)); + + Compilations = inferToolLocation(std::move(Compilations)); + + // The command options are rewritten to run Clang in preprocessor only mode. + auto AdjustingCompilations = + std::make_unique( + std::move(Compilations)); + ResourceDirectoryCache ResourceDirCache; + + AdjustingCompilations->appendArgumentsAdjuster( + [&ResourceDirCache](const tooling::CommandLineArguments &Args, + StringRef FileName) { + std::string LastO; + bool HasResourceDir = false; + bool ClangCLMode = false; + auto FlagsEnd = llvm::find(Args, "--"); + if (FlagsEnd != Args.begin()) { + ClangCLMode = + llvm::sys::path::stem(Args[0]).contains_insensitive("clang-cl") || + llvm::is_contained(Args, "--driver-mode=cl"); + + // Reverse scan, starting at the end or at the element before "--". + auto R = std::make_reverse_iterator(FlagsEnd); + auto E = Args.rend(); + // Don't include Args[0] in the iteration; that's the executable, not + // an option. + if (E != R) + E--; + for (auto I = R; I != E; ++I) { + StringRef Arg = *I; + if (ClangCLMode) { + // Ignore arguments that are preceded by "-Xclang". + if ((I + 1) != E && I[1] == "-Xclang") + continue; + if (LastO.empty()) { + // With clang-cl, the output obj file can be specified with + // "/opath", "/o path", "/Fopath", and the dash counterparts. + // Also, clang-cl adds ".obj" extension if none is found. + if ((Arg == "-o" || Arg == "/o") && I != R) + LastO = I[-1]; // Next argument (reverse iterator) + else if (Arg.starts_with("/Fo") || Arg.starts_with("-Fo")) + LastO = Arg.drop_front(3).str(); + else if (Arg.starts_with("/o") || Arg.starts_with("-o")) + LastO = Arg.drop_front(2).str(); + + if (!LastO.empty() && !llvm::sys::path::has_extension(LastO)) + LastO.append(".obj"); + } + } + if (Arg == "-resource-dir") + HasResourceDir = true; + } + } + tooling::CommandLineArguments AdjustedArgs(Args.begin(), FlagsEnd); + // The clang-cl driver passes "-o -" to the frontend. Inject the real + // file here to ensure "-MT" can be deduced if need be. + if (ClangCLMode && !LastO.empty()) { + AdjustedArgs.push_back("/clang:-o"); + AdjustedArgs.push_back("/clang:" + LastO); + } + + if (!HasResourceDir && ResourceDirRecipe == RDRK_InvokeCompiler) { + StringRef ResourceDir = + ResourceDirCache.findResourceDir(Args, ClangCLMode); + if (!ResourceDir.empty()) { + AdjustedArgs.push_back("-resource-dir"); + AdjustedArgs.push_back(std::string(ResourceDir)); + } + } + AdjustedArgs.insert(AdjustedArgs.end(), FlagsEnd, Args.end()); + return AdjustedArgs; + }); + + SharedStream Errs(llvm::errs()); + + std::optional FileOS; + llvm::raw_ostream &ThreadUnsafeDependencyOS = [&]() -> llvm::raw_ostream & { + if (OutputFileName == "-") + return llvm::outs(); + + if (OutputFileName == "/dev/null") + return llvm::nulls(); + + std::error_code EC; + FileOS.emplace(OutputFileName, EC); + if (EC) { + llvm::errs() << "Failed to open output file '" << OutputFileName + << "': " << llvm::errorCodeToError(EC) << '\n'; + std::exit(1); + } + return *FileOS; + }(); + SharedStream DependencyOS(ThreadUnsafeDependencyOS); + + std::vector Inputs = + AdjustingCompilations->getAllCompileCommands(); + + std::atomic HadErrors(false); + std::optional FD; + P1689Deps PD; + + std::mutex Lock; + size_t Index = 0; + auto GetNextInputIndex = [&]() -> std::optional { + std::unique_lock LockGuard(Lock); + if (Index < Inputs.size()) + return Index++; + return {}; + }; + + if (Format == ScanningOutputFormat::Full) + FD.emplace(ModuleName.empty() ? Inputs.size() : 0); + + auto ScanningTask = [&](DependencyScanningService &Service) { + DependencyScanningTool WorkerTool(Service); + + llvm::DenseSet AlreadySeenModules; + while (auto MaybeInputIndex = GetNextInputIndex()) { + size_t LocalIndex = *MaybeInputIndex; + const tooling::CompileCommand *Input = &Inputs[LocalIndex]; *** 167 LINES SKIPPED *** From nobody Wed Jul 2 18:19:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXSpH6Csmz60lhN; Wed, 02 Jul 2025 18:19:03 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta003.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXSpH0w82z3Fq8; Wed, 02 Jul 2025 18:19:03 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; none Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTPS id WzjGu2rT69JM2X22wuo5OS; Wed, 02 Jul 2025 18:19:02 +0000 Received: from spqr.komquats.com ([70.66.136.217]) by cmsmtp with ESMTPSA id X22uuBpE6WX70X22vuOFNX; Wed, 02 Jul 2025 18:19:02 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=d71WygjE c=1 sm=1 tr=0 ts=68657816 a=h7br+8Ma+Xn9xscxy5znUg==:117 a=h7br+8Ma+Xn9xscxy5znUg==:17 a=kj9zAlcOel0A:10 a=Wb1JkmetP80A:10 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=YxBL1-UpAAAA:8 a=2iICc9-xHh8ik1-XWVkA:9 a=CjuIK1q_8ugA:10 a=LK5xJRSDVpKd5WXXoEvA:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 819806D; Wed, 02 Jul 2025 11:19:00 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id 667C5380; Wed, 02 Jul 2025 11:19:00 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mark Johnston cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: aefae931820f - main - linker: Improve handling of ifuncs when fetching symbol metadata In-reply-to: <202507021341.562DfuEh023668@gitrepo.freebsd.org> References: <202507021341.562DfuEh023668@gitrepo.freebsd.org> Comments: In-reply-to Mark Johnston message dated "Wed, 02 Jul 2025 13:41:56 +0000." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 02 Jul 2025 11:19:00 -0700 Message-Id: <20250702181900.667C5380@slippy.cwsent.com> X-CMAE-Envelope: MS4xfLzmP1HZtRyjGXy7y2uowVq2oAwKmdjQwtveShQj20RhNoZP3dCHtoyQdhAwCee05fNmgrhDYXBoAvHxqBTH5br9xycBIs3WY0FkbgjT08ZOqfcUgALz nAT2LcRC4r3hT48qJyvS7ZFgSrvUspQjDQJs9TX812Lpe8/fAw9xnxKArFz6toqKjBgYhw1ZXZctbwGKuimbSamX7+kIES5oI3K8wQfhd87Nu17JaFOGmPCb vv1CDRw8thfJmELPC2l5vi67HojsTDXFFvZ3k/NKFuXywcInXxnuVOlnD+EKOjGuPTvB1Z3Z4/qic4dP7tvVTaIVcYdtW572SnLts+u1iTc= X-Rspamd-Queue-Id: 4bXSpH0w82z3Fq8 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US] In message <202507021341.562DfuEh023668@gitrepo.freebsd.org>, Mark Johnston wri tes: > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=aefae931820fe1e93a31855296851029 > 8c7941a0 > > commit aefae931820fe1e93a318552968510298c7941a0 > Author: Mark Johnston > AuthorDate: 2025-07-02 13:34:47 +0000 > Commit: Mark Johnston > CommitDate: 2025-07-02 13:34:47 +0000 > > linker: Improve handling of ifuncs when fetching symbol metadata > > When looking up symbol values, we map ifunc symbols to the value > returned by the resolver. However, the returned symbol size is still > that of the resolver. Be consistent and provide the size of the > implementation symbol as well. > > This fixes an inconsistency in dtrace's FBT provider, which enumerates > all function symbols and disassembles their values, using the symbol > size as the bound for the disassembly loop. In particular, for ifuncs, > we were not creating return probes. > > Reviewed by: kib > MFC after: 2 weeks > Sponsored by: Innovate UK > Differential Revision: https://reviews.freebsd.org/D50683 > --- > sys/kern/link_elf.c | 38 ++++++++++++++++++++++++++++++++++---- > sys/kern/link_elf_obj.c | 31 +++++++++++++++++++++++++++++-- > 2 files changed, 63 insertions(+), 6 deletions(-) > > diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c > index 53af1e164980..bbebadc4c395 100644 > --- a/sys/kern/link_elf.c > +++ b/sys/kern/link_elf.c > @@ -1628,6 +1628,30 @@ link_elf_lookup_debug_symbol_ctf(linker_file_t lf, con > st char *name, > return (i < ef->ddbsymcnt ? link_elf_ctf_get_ddb(lf, lc) : ENOENT); > } > > +static void > +link_elf_ifunc_symbol_value(linker_file_t lf, caddr_t *valp, size_t *sizep) > +{ > + c_linker_sym_t sym; > + elf_file_t ef; > + const Elf_Sym *es; > + caddr_t val; > + long off; > + > + val = *valp; > + ef = (elf_file_t)lf; > + > + /* Provide the value and size of the target symbol, if available. */ > + val = ((caddr_t (*)(void))val)(); > + if (link_elf_search_symbol(lf, val, &sym, &off) == 0 && off == 0) { > + es = (const Elf_Sym *)sym; > + *valp = (caddr_t)ef->address + es->st_value; > + *sizep = es->st_size; > + } else { > + *valp = val; > + *sizep = 0; > + } > +} > + > static int > link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, > linker_symval_t *symval, bool see_local) > @@ -1635,6 +1659,7 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sym_ > t sym, > elf_file_t ef; > const Elf_Sym *es; > caddr_t val; > + size_t size; > > ef = (elf_file_t)lf; > es = (const Elf_Sym *)sym; > @@ -1644,9 +1669,11 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sym > _t sym, > symval->name = ef->strtab + es->st_name; > val = (caddr_t)ef->address + es->st_value; > if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) > - val = ((caddr_t (*)(void))val)(); > + link_elf_ifunc_symbol_value(lf, &val, &size); > + else > + size = es->st_size; > symval->value = val; > - symval->size = es->st_size; > + symval->size = size; > return (0); > } > return (ENOENT); > @@ -1668,6 +1695,7 @@ link_elf_debug_symbol_values(linker_file_t lf, c_linker > _sym_t sym, > elf_file_t ef = (elf_file_t)lf; > const Elf_Sym *es = (const Elf_Sym *)sym; > caddr_t val; > + size_t size; > > if (link_elf_symbol_values1(lf, sym, symval, true) == 0) > return (0); > @@ -1678,9 +1706,11 @@ link_elf_debug_symbol_values(linker_file_t lf, c_linke > r_sym_t sym, > symval->name = ef->ddbstrtab + es->st_name; > val = (caddr_t)ef->address + es->st_value; > if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) > - val = ((caddr_t (*)(void))val)(); > + link_elf_ifunc_symbol_value(lf, &val, &size); > + else > + size = es->st_size; > symval->value = val; > - symval->size = es->st_size; > + symval->size = size; > return (0); > } > return (ENOENT); > diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c > index 02fd4caffcd9..3d18aed2b1c0 100644 > --- a/sys/kern/link_elf_obj.c > +++ b/sys/kern/link_elf_obj.c > @@ -1510,6 +1510,30 @@ link_elf_lookup_debug_symbol_ctf(linker_file_t lf, con > st char *name, > return (link_elf_ctf_get_ddb(lf, lc)); > } > > +static void > +link_elf_ifunc_symbol_value(linker_file_t lf, caddr_t *valp, size_t *sizep) > +{ > + c_linker_sym_t sym; > + elf_file_t ef; > + const Elf_Sym *es; > + caddr_t val; > + long off; > + > + val = *valp; > + ef = (elf_file_t)lf; > + > + /* Provide the value and size of the target symbol, if available. */ > + val = ((caddr_t (*)(void))val)(); > + if (link_elf_search_symbol(lf, val, &sym, &off) == 0 && off == 0) { > + es = (const Elf_Sym *)sym; > + *valp = (caddr_t)ef->address + es->st_value; > + *sizep = es->st_size; > + } else { > + *valp = val; > + *sizep = 0; > + } > +} > + > static int > link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, > linker_symval_t *symval, bool see_local) > @@ -1517,6 +1541,7 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sym_ > t sym, > elf_file_t ef; > const Elf_Sym *es; > caddr_t val; > + size_t size; > > ef = (elf_file_t) lf; > es = (const Elf_Sym*) sym; > @@ -1527,9 +1552,11 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sym > _t sym, > symval->name = ef->ddbstrtab + es->st_name; > val = (caddr_t)es->st_value; > if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) > - val = ((caddr_t (*)(void))val)(); > + link_elf_ifunc_symbol_value(lf, &val, &size); > + else > + size = es->st_size; > symval->value = val; > - symval->size = es->st_size; > + symval->size = size; > return (0); > } > return (ENOENT); > This commit may have caused a panic loading linux.ko. #0 __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:57 #1 doadump (textdump=textdump@entry=1) at /opt/src/git-src/sys/kern/kern_shutdown.c:399 #2 0xffffffff806fad1e in kern_reboot (howto=260) at /opt/src/git-src/sys/kern/kern_shutdown.c:519 #3 0xffffffff806fb247 in vpanic (fmt=0xffffffff80b2e000 "%s", ap=ap@entry=0xfffffe008c8e2450) at /opt/src/git-src/sys/kern/kern_shutdown.c:974 #4 0xffffffff806fb073 in panic (fmt=) at /opt/src/git-src/sys/kern/kern_shutdown.c:887 #5 0xffffffff80aa8e7a in trap_fatal (frame=, eva=) at /opt/src/git-src/sys/amd64/amd64/trap.c:974 #6 0xffffffff80aa8e7a in trap_pfault (frame=0xfffffe008c8e24d0, usermode=false, signo=, ucode=) #7 #8 fbt_provide_module_function (lf=lf@entry=0xfffff80126035900, symindx=symindx@entry=753, symval=symval@entry=0xfffffe008c8e25f0, opaque=opaque@entry=0xfffffe008c8e2640) at /opt/src/git-src/sys/cddl/dev/fbt/x86/fbt_isa.c:205 #9 0xffffffff80ac870d in link_elf_each_function_nameval ( file=0xfffff80126035900, callback=0xffffffff81d916a0 , opaque=0xfffffe008c8e2640) at /opt/src/git-src/sys/kern/link_elf_obj.c:1 685 --Type for more, q to quit, c to continue without paging--c #10 0xffffffff81d9035f in fbt_provide_module (arg=, lf=0xfffff80126035900) at /opt/src/git-src/sys/cddl/dev/fbt/fbt.c:221 #11 0xffffffff81cc87fb in dtrace_module_loaded (ctl=0xfffff80126035900) at /opt/src/git-src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrac e.c:16709 #12 dtrace_kld_load (arg=, lf=0xfffff80126035900) at /opt/src/git-src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrac e.c:16894 #13 0xffffffff806c4ecb in linker_load_file ( filename=0xfffff80054e6d500 "/boot/kernel/linux.ko", result=) at /opt/src/git-src/sys/kern/kern_linker.c:518 #14 linker_load_module (kldname=kldname@entry=0x0, modname=0xfffff8005437c800 "linux", parent=parent@entry=0x0, verinfo=verinfo@entry=0x0, lfpp=lfpp@entry=0xfffffe008c8e2da0) at /opt/src/git-src/sys/kern/kern_linker.c:2292 #15 0xffffffff806c69f5 in kern_kldload (td=td@entry=0xfffff8005ce3c780, file=file@entry=0xfffff8005437c800 "linux", fileid=fileid@entry=0xfffffe008c8e2de4) at /opt/src/git-src/sys/kern/kern_linker.c:1236 #16 0xffffffff806c6b09 in sys_kldload (td=0xfffff8005ce3c780, uap=0xfffff8005ce3cba8) at /opt/src/git-src/sys/kern/kern_linker.c:1259 #17 0xffffffff80aa97d6 in syscallenter (td=0xfffff8005ce3c780) at /opt/src/git-src/sys/amd64/amd64/../../kern/subr_syscall.c:193 #18 amd64_syscall (td=0xfffff8005ce3c780, traced=0) at /opt/src/git-src/sys/amd64/amd64/trap.c:1215 #19 #20 0x00000ce63ecf8c3a in ?? () -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e**(i*pi)+1=0 From nobody Wed Jul 2 18:21:18 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXSrv3L0Jz60lhj; Wed, 02 Jul 2025 18:21: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXSrv0XHQz3FbB; Wed, 02 Jul 2025 18:21:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lRIgg8GLJV1+fezRc3DyeucnGwLReeLsWreROzWXW28=; b=RI9qf16z2wnH9/byhS/e//e3WcMXHDjjmNwcVReWUNjxNyzc1RKKal3k+XXfajE6phRVox 2jEKlvOw21HPlOSySGRPTb16hLx8xjqQBuJtAVcRS5CZI0qyf+eF0H40EHfnGsgwoWSH5P 8tm8r4y78gT0nTH49z1AAU630pmRoXSj/3T3quEV4M+6T6s17hJBHe7mIQeJA6xZ7YiyC6 Q6VzIvsXWqk3TUmU2UjKShI/boamuw4g3hfLsf0a3V8xFNixzfkjZ2Hi90A6B639UxEGK3 g6wcziKnReCrQ4LRPFydeQcFyG1dxvkS9GN90EL5Flh1UsOZB5AWv/olfqbJ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lRIgg8GLJV1+fezRc3DyeucnGwLReeLsWreROzWXW28=; b=Mfl2GBSTCGG8GMsXEhyvJd+8QfJRkJKK6KGyC6wP7nWWm3Tuooz8LQo6rLIAUbmsRqlqyb msnkcwfocGEIqmgT8N3vVZpA0HaYHLBcBZhFiqU091sqJ/oTUApU4htFV1Wh1W34FG1dPo Eq9aZzOlOBW4fHqSMkbj+aJEe7kEtaWAiWP2c4WM/QDK+uBcc8BS22+9o3L/N6GdXAyEL0 bu6Mk9qV/f6SYSBfPkEzBgLQIMasvMDWXhXamwH4atTBnVE3qpILyREdvhSvomSFn42ERM EiXXtoZsfeKsMqNgtuvnyLDnsZyIzbhZL70hrg95D9AdTl4eG/DAhVRBL2zGKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480479; a=rsa-sha256; cv=none; b=GvLd5ewqp0PNiQwuYfAhaZURWBBJS9mk7C9AY3IAcnQCNHPDPe5/7LAidEOChk6r3HUwem efgF7pJNCO/nnSYrXIeDYo7trV3nSfQaEihVpQKX/5LeEWioQmPVk1tPNNLWc3rVnQ4rAc eNeGtjJ+HjN7sE+64ImnWi1fAzeaNJROXohYf9epAkqTmyE6DeKrqr4PM5tNzXRbFptr4Z mXQLUL/8lfEyfYjuCsCF87oszNtkHYlwmg1LNcVBWNroqzk8j/PNzgvhEKqndqmOcjZsj1 OwyLT+cEK2US4NayoWxr4ueoAilDM1Ucynp88SUBmX9OdxzSz2uwsacQqBhfzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXSrt6hJnzVbh; Wed, 02 Jul 2025 18:21:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ILIsE049151; Wed, 2 Jul 2025 18:21:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ILII6049148; Wed, 2 Jul 2025 18:21:18 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:21:18 GMT Message-Id: <202507021821.562ILII6049148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: f82159545a3c - stable/13 - contrib/llvm-project: re-add clang/tools/clang-scan-deps List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f82159545a3c38e507542002290036a0cf4920ac Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=f82159545a3c38e507542002290036a0cf4920ac commit f82159545a3c38e507542002290036a0cf4920ac Author: Dimitry Andric AuthorDate: 2025-06-25 17:19:51 +0000 Commit: Dimitry Andric CommitDate: 2025-07-02 18:08:51 +0000 contrib/llvm-project: re-add clang/tools/clang-scan-deps This is in preparation for adding it as an optional tool in base. MFC after: 1 week (cherry picked from commit 7ed1628066eaf55b86f35af86efe804508201cc8) --- contrib/llvm-project/FREEBSD-Xlist | 3 +- .../clang/tools/clang-scan-deps/ClangScanDeps.cpp | 1055 ++++++++++++++++++++ .../clang/tools/clang-scan-deps/Opts.td | 42 + 3 files changed, 1098 insertions(+), 2 deletions(-) diff --git a/contrib/llvm-project/FREEBSD-Xlist b/contrib/llvm-project/FREEBSD-Xlist index 45cd2c1d6f46..43fa40070f5d 100644 --- a/contrib/llvm-project/FREEBSD-Xlist +++ b/contrib/llvm-project/FREEBSD-Xlist @@ -129,7 +129,7 @@ clang/tools/clang-offload-packager/ clang/tools/clang-refactor/ clang/tools/clang-rename/ clang/tools/clang-repl/ -clang/tools/clang-scan-deps/ +clang/tools/clang-scan-deps/CMakeLists.txt clang/tools/clang-shlib/ clang/tools/diag-build/ clang/tools/diagtool/ @@ -805,7 +805,6 @@ llvm/tools/llvm-bcanalyzer/CMakeLists.txt llvm/tools/llvm-c-test/ llvm/tools/llvm-cat/ llvm/tools/llvm-cfi-verify/ -llvm/tools/llvm-cgdata/ llvm/tools/llvm-config/ llvm/tools/llvm-cov/CMakeLists.txt llvm/tools/llvm-cvtres/ diff --git a/contrib/llvm-project/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/contrib/llvm-project/clang/tools/clang-scan-deps/ClangScanDeps.cpp new file mode 100644 index 000000000000..867df19c863f --- /dev/null +++ b/contrib/llvm-project/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -0,0 +1,1055 @@ +//===- ClangScanDeps.cpp - Implementation of clang-scan-deps --------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "clang/Driver/Compilation.h" +#include "clang/Driver/Driver.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Frontend/TextDiagnosticPrinter.h" +#include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/DependencyScanning/DependencyScanningService.h" +#include "clang/Tooling/DependencyScanning/DependencyScanningTool.h" +#include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h" +#include "clang/Tooling/JSONCompilationDatabase.h" +#include "clang/Tooling/Tooling.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileUtilities.h" +#include "llvm/Support/Format.h" +#include "llvm/Support/JSON.h" +#include "llvm/Support/LLVMDriver.h" +#include "llvm/Support/Program.h" +#include "llvm/Support/Signals.h" +#include "llvm/Support/TargetSelect.h" +#include "llvm/Support/ThreadPool.h" +#include "llvm/Support/Threading.h" +#include "llvm/Support/Timer.h" +#include "llvm/TargetParser/Host.h" +#include +#include +#include + +#include "Opts.inc" + +using namespace clang; +using namespace tooling::dependencies; + +namespace { + +using namespace llvm::opt; +enum ID { + OPT_INVALID = 0, // This is not an option ID. +#define OPTION(...) LLVM_MAKE_OPT_ID(__VA_ARGS__), +#include "Opts.inc" +#undef OPTION +}; + +#define PREFIX(NAME, VALUE) \ + constexpr llvm::StringLiteral NAME##_init[] = VALUE; \ + constexpr llvm::ArrayRef NAME( \ + NAME##_init, std::size(NAME##_init) - 1); +#include "Opts.inc" +#undef PREFIX + +const llvm::opt::OptTable::Info InfoTable[] = { +#define OPTION(...) LLVM_CONSTRUCT_OPT_INFO(__VA_ARGS__), +#include "Opts.inc" +#undef OPTION +}; + +class ScanDepsOptTable : public llvm::opt::GenericOptTable { +public: + ScanDepsOptTable() : GenericOptTable(InfoTable) { + setGroupedShortOptions(true); + } +}; + +enum ResourceDirRecipeKind { + RDRK_ModifyCompilerPath, + RDRK_InvokeCompiler, +}; + +static std::string OutputFileName = "-"; +static ScanningMode ScanMode = ScanningMode::DependencyDirectivesScan; +static ScanningOutputFormat Format = ScanningOutputFormat::Make; +static ScanningOptimizations OptimizeArgs; +static std::string ModuleFilesDir; +static bool EagerLoadModules; +static unsigned NumThreads = 0; +static std::string CompilationDB; +static std::string ModuleName; +static std::vector ModuleDepTargets; +static bool DeprecatedDriverCommand; +static ResourceDirRecipeKind ResourceDirRecipe; +static bool Verbose; +static bool PrintTiming; +static llvm::BumpPtrAllocator Alloc; +static llvm::StringSaver Saver{Alloc}; +static std::vector CommandLine; + +#ifndef NDEBUG +static constexpr bool DoRoundTripDefault = true; +#else +static constexpr bool DoRoundTripDefault = false; +#endif + +static bool RoundTripArgs = DoRoundTripDefault; + +static void ParseArgs(int argc, char **argv) { + ScanDepsOptTable Tbl; + llvm::StringRef ToolName = argv[0]; + llvm::opt::InputArgList Args = + Tbl.parseArgs(argc, argv, OPT_UNKNOWN, Saver, [&](StringRef Msg) { + llvm::errs() << Msg << '\n'; + std::exit(1); + }); + + if (Args.hasArg(OPT_help)) { + Tbl.printHelp(llvm::outs(), "clang-scan-deps [options]", "clang-scan-deps"); + std::exit(0); + } + if (Args.hasArg(OPT_version)) { + llvm::outs() << ToolName << '\n'; + llvm::cl::PrintVersionMessage(); + std::exit(0); + } + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_mode_EQ)) { + auto ModeType = + llvm::StringSwitch>(A->getValue()) + .Case("preprocess-dependency-directives", + ScanningMode::DependencyDirectivesScan) + .Case("preprocess", ScanningMode::CanonicalPreprocessing) + .Default(std::nullopt); + if (!ModeType) { + llvm::errs() << ToolName + << ": for the --mode option: Cannot find option named '" + << A->getValue() << "'\n"; + std::exit(1); + } + ScanMode = *ModeType; + } + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_format_EQ)) { + auto FormatType = + llvm::StringSwitch>(A->getValue()) + .Case("make", ScanningOutputFormat::Make) + .Case("p1689", ScanningOutputFormat::P1689) + .Case("experimental-full", ScanningOutputFormat::Full) + .Default(std::nullopt); + if (!FormatType) { + llvm::errs() << ToolName + << ": for the --format option: Cannot find option named '" + << A->getValue() << "'\n"; + std::exit(1); + } + Format = *FormatType; + } + + std::vector OptimizationFlags = + Args.getAllArgValues(OPT_optimize_args_EQ); + OptimizeArgs = ScanningOptimizations::None; + for (const auto &Arg : OptimizationFlags) { + auto Optimization = + llvm::StringSwitch>(Arg) + .Case("none", ScanningOptimizations::None) + .Case("header-search", ScanningOptimizations::HeaderSearch) + .Case("system-warnings", ScanningOptimizations::SystemWarnings) + .Case("vfs", ScanningOptimizations::VFS) + .Case("canonicalize-macros", ScanningOptimizations::Macros) + .Case("all", ScanningOptimizations::All) + .Default(std::nullopt); + if (!Optimization) { + llvm::errs() + << ToolName + << ": for the --optimize-args option: Cannot find option named '" + << Arg << "'\n"; + std::exit(1); + } + OptimizeArgs |= *Optimization; + } + if (OptimizationFlags.empty()) + OptimizeArgs = ScanningOptimizations::Default; + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_module_files_dir_EQ)) + ModuleFilesDir = A->getValue(); + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_o)) + OutputFileName = A->getValue(); + + EagerLoadModules = Args.hasArg(OPT_eager_load_pcm); + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_j)) { + StringRef S{A->getValue()}; + if (!llvm::to_integer(S, NumThreads, 0)) { + llvm::errs() << ToolName << ": for the -j option: '" << S + << "' value invalid for uint argument!\n"; + std::exit(1); + } + } + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_compilation_database_EQ)) + CompilationDB = A->getValue(); + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_module_name_EQ)) + ModuleName = A->getValue(); + + for (const llvm::opt::Arg *A : Args.filtered(OPT_dependency_target_EQ)) + ModuleDepTargets.emplace_back(A->getValue()); + + DeprecatedDriverCommand = Args.hasArg(OPT_deprecated_driver_command); + + if (const llvm::opt::Arg *A = Args.getLastArg(OPT_resource_dir_recipe_EQ)) { + auto Kind = + llvm::StringSwitch>(A->getValue()) + .Case("modify-compiler-path", RDRK_ModifyCompilerPath) + .Case("invoke-compiler", RDRK_InvokeCompiler) + .Default(std::nullopt); + if (!Kind) { + llvm::errs() << ToolName + << ": for the --resource-dir-recipe option: Cannot find " + "option named '" + << A->getValue() << "'\n"; + std::exit(1); + } + ResourceDirRecipe = *Kind; + } + + PrintTiming = Args.hasArg(OPT_print_timing); + + Verbose = Args.hasArg(OPT_verbose); + + RoundTripArgs = Args.hasArg(OPT_round_trip_args); + + if (const llvm::opt::Arg *A = Args.getLastArgNoClaim(OPT_DASH_DASH)) + CommandLine.assign(A->getValues().begin(), A->getValues().end()); +} + +class SharedStream { +public: + SharedStream(raw_ostream &OS) : OS(OS) {} + void applyLocked(llvm::function_ref Fn) { + std::unique_lock LockGuard(Lock); + Fn(OS); + OS.flush(); + } + +private: + std::mutex Lock; + raw_ostream &OS; +}; + +class ResourceDirectoryCache { +public: + /// findResourceDir finds the resource directory relative to the clang + /// compiler being used in Args, by running it with "-print-resource-dir" + /// option and cache the results for reuse. \returns resource directory path + /// associated with the given invocation command or empty string if the + /// compiler path is NOT an absolute path. + StringRef findResourceDir(const tooling::CommandLineArguments &Args, + bool ClangCLMode) { + if (Args.size() < 1) + return ""; + + const std::string &ClangBinaryPath = Args[0]; + if (!llvm::sys::path::is_absolute(ClangBinaryPath)) + return ""; + + const std::string &ClangBinaryName = + std::string(llvm::sys::path::filename(ClangBinaryPath)); + + std::unique_lock LockGuard(CacheLock); + const auto &CachedResourceDir = Cache.find(ClangBinaryPath); + if (CachedResourceDir != Cache.end()) + return CachedResourceDir->second; + + std::vector PrintResourceDirArgs{ClangBinaryName}; + if (ClangCLMode) + PrintResourceDirArgs.push_back("/clang:-print-resource-dir"); + else + PrintResourceDirArgs.push_back("-print-resource-dir"); + + llvm::SmallString<64> OutputFile, ErrorFile; + llvm::sys::fs::createTemporaryFile("print-resource-dir-output", + "" /*no-suffix*/, OutputFile); + llvm::sys::fs::createTemporaryFile("print-resource-dir-error", + "" /*no-suffix*/, ErrorFile); + llvm::FileRemover OutputRemover(OutputFile.c_str()); + llvm::FileRemover ErrorRemover(ErrorFile.c_str()); + std::optional Redirects[] = { + {""}, // Stdin + OutputFile.str(), + ErrorFile.str(), + }; + if (llvm::sys::ExecuteAndWait(ClangBinaryPath, PrintResourceDirArgs, {}, + Redirects)) { + auto ErrorBuf = llvm::MemoryBuffer::getFile(ErrorFile.c_str()); + llvm::errs() << ErrorBuf.get()->getBuffer(); + return ""; + } + + auto OutputBuf = llvm::MemoryBuffer::getFile(OutputFile.c_str()); + if (!OutputBuf) + return ""; + StringRef Output = OutputBuf.get()->getBuffer().rtrim('\n'); + + Cache[ClangBinaryPath] = Output.str(); + return Cache[ClangBinaryPath]; + } + +private: + std::map Cache; + std::mutex CacheLock; +}; + +} // end anonymous namespace + +/// Takes the result of a dependency scan and prints error / dependency files +/// based on the result. +/// +/// \returns True on error. +static bool +handleMakeDependencyToolResult(const std::string &Input, + llvm::Expected &MaybeFile, + SharedStream &OS, SharedStream &Errs) { + if (!MaybeFile) { + llvm::handleAllErrors( + MaybeFile.takeError(), [&Input, &Errs](llvm::StringError &Err) { + Errs.applyLocked([&](raw_ostream &OS) { + OS << "Error while scanning dependencies for " << Input << ":\n"; + OS << Err.getMessage(); + }); + }); + return true; + } + OS.applyLocked([&](raw_ostream &OS) { OS << *MaybeFile; }); + return false; +} + +static llvm::json::Array toJSONSorted(const llvm::StringSet<> &Set) { + std::vector Strings; + for (auto &&I : Set) + Strings.push_back(I.getKey()); + llvm::sort(Strings); + return llvm::json::Array(Strings); +} + +// Technically, we don't need to sort the dependency list to get determinism. +// Leaving these be will simply preserve the import order. +static llvm::json::Array toJSONSorted(std::vector V) { + llvm::sort(V); + + llvm::json::Array Ret; + for (const ModuleID &MID : V) + Ret.push_back(llvm::json::Object( + {{"module-name", MID.ModuleName}, {"context-hash", MID.ContextHash}})); + return Ret; +} + +static llvm::json::Array +toJSONSorted(llvm::SmallVector &LinkLibs) { + llvm::sort(LinkLibs, [](const Module::LinkLibrary &lhs, + const Module::LinkLibrary &rhs) { + return lhs.Library < rhs.Library; + }); + + llvm::json::Array Ret; + for (const Module::LinkLibrary &LL : LinkLibs) + Ret.push_back(llvm::json::Object( + {{"link-name", LL.Library}, {"isFramework", LL.IsFramework}})); + return Ret; +} + +// Thread safe. +class FullDeps { +public: + FullDeps(size_t NumInputs) : Inputs(NumInputs) {} + + void mergeDeps(StringRef Input, TranslationUnitDeps TUDeps, + size_t InputIndex) { + mergeDeps(std::move(TUDeps.ModuleGraph), InputIndex); + + InputDeps ID; + ID.FileName = std::string(Input); + ID.ContextHash = std::move(TUDeps.ID.ContextHash); + ID.FileDeps = std::move(TUDeps.FileDeps); + ID.ModuleDeps = std::move(TUDeps.ClangModuleDeps); + ID.DriverCommandLine = std::move(TUDeps.DriverCommandLine); + ID.Commands = std::move(TUDeps.Commands); + + assert(InputIndex < Inputs.size() && "Input index out of bounds"); + assert(Inputs[InputIndex].FileName.empty() && "Result already populated"); + Inputs[InputIndex] = std::move(ID); + } + + void mergeDeps(ModuleDepsGraph Graph, size_t InputIndex) { + std::vector NewMDs; + { + std::unique_lock ul(Lock); + for (const ModuleDeps &MD : Graph) { + auto I = Modules.find({MD.ID, 0}); + if (I != Modules.end()) { + I->first.InputIndex = std::min(I->first.InputIndex, InputIndex); + continue; + } + auto Res = Modules.insert(I, {{MD.ID, InputIndex}, std::move(MD)}); + NewMDs.push_back(&Res->second); + } + // First call to \c getBuildArguments is somewhat expensive. Let's call it + // on the current thread (instead of the main one), and outside the + // critical section. + for (ModuleDeps *MD : NewMDs) + (void)MD->getBuildArguments(); + } + } + + bool roundTripCommand(ArrayRef ArgStrs, + DiagnosticsEngine &Diags) { + if (ArgStrs.empty() || ArgStrs[0] != "-cc1") + return false; + SmallVector Args; + for (const std::string &Arg : ArgStrs) + Args.push_back(Arg.c_str()); + return !CompilerInvocation::checkCC1RoundTrip(Args, Diags); + } + + // Returns \c true if any command lines fail to round-trip. We expect + // commands already be canonical when output by the scanner. + bool roundTripCommands(raw_ostream &ErrOS) { + IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions{}; + TextDiagnosticPrinter DiagConsumer(ErrOS, &*DiagOpts); + IntrusiveRefCntPtr Diags = + CompilerInstance::createDiagnostics(&*DiagOpts, &DiagConsumer, + /*ShouldOwnClient=*/false); + + for (auto &&M : Modules) + if (roundTripCommand(M.second.getBuildArguments(), *Diags)) + return true; + + for (auto &&I : Inputs) + for (const auto &Cmd : I.Commands) + if (roundTripCommand(Cmd.Arguments, *Diags)) + return true; + + return false; + } + + void printFullOutput(raw_ostream &OS) { + // Skip sorting modules and constructing the JSON object if the output + // cannot be observed anyway. This makes timings less noisy. + if (&OS == &llvm::nulls()) + return; + + // Sort the modules by name to get a deterministic order. + std::vector ModuleIDs; + for (auto &&M : Modules) + ModuleIDs.push_back(M.first); + llvm::sort(ModuleIDs); + + using namespace llvm::json; + + Array OutModules; + for (auto &&ModID : ModuleIDs) { + auto &MD = Modules[ModID]; + Object O{{"name", MD.ID.ModuleName}, + {"context-hash", MD.ID.ContextHash}, + {"file-deps", toJSONSorted(MD.FileDeps)}, + {"clang-module-deps", toJSONSorted(MD.ClangModuleDeps)}, + {"clang-modulemap-file", MD.ClangModuleMapFile}, + {"command-line", MD.getBuildArguments()}, + {"link-libraries", toJSONSorted(MD.LinkLibraries)}}; + OutModules.push_back(std::move(O)); + } + + Array TUs; + for (auto &&I : Inputs) { + Array Commands; + if (I.DriverCommandLine.empty()) { + for (const auto &Cmd : I.Commands) { + Object O{ + {"input-file", I.FileName}, + {"clang-context-hash", I.ContextHash}, + {"file-deps", I.FileDeps}, + {"clang-module-deps", toJSONSorted(I.ModuleDeps)}, + {"executable", Cmd.Executable}, + {"command-line", Cmd.Arguments}, + }; + Commands.push_back(std::move(O)); + } + } else { + Object O{ + {"input-file", I.FileName}, + {"clang-context-hash", I.ContextHash}, + {"file-deps", I.FileDeps}, + {"clang-module-deps", toJSONSorted(I.ModuleDeps)}, + {"executable", "clang"}, + {"command-line", I.DriverCommandLine}, + }; + Commands.push_back(std::move(O)); + } + TUs.push_back(Object{ + {"commands", std::move(Commands)}, + }); + } + + Object Output{ + {"modules", std::move(OutModules)}, + {"translation-units", std::move(TUs)}, + }; + + OS << llvm::formatv("{0:2}\n", Value(std::move(Output))); + } + +private: + struct IndexedModuleID { + ModuleID ID; + + // FIXME: This is mutable so that it can still be updated after insertion + // into an unordered associative container. This is "fine", since this + // field doesn't contribute to the hash, but it's a brittle hack. + mutable size_t InputIndex; + + bool operator==(const IndexedModuleID &Other) const { + return ID == Other.ID; + } + + bool operator<(const IndexedModuleID &Other) const { + /// We need the output of clang-scan-deps to be deterministic. However, + /// the dependency graph may contain two modules with the same name. How + /// do we decide which one to print first? If we made that decision based + /// on the context hash, the ordering would be deterministic, but + /// different across machines. This can happen for example when the inputs + /// or the SDKs (which both contribute to the "context" hash) live in + /// different absolute locations. We solve that by tracking the index of + /// the first input TU that (transitively) imports the dependency, which + /// is always the same for the same input, resulting in deterministic + /// sorting that's also reproducible across machines. + return std::tie(ID.ModuleName, InputIndex) < + std::tie(Other.ID.ModuleName, Other.InputIndex); + } + + struct Hasher { + std::size_t operator()(const IndexedModuleID &IMID) const { + return llvm::hash_value(IMID.ID); + } + }; + }; + + struct InputDeps { + std::string FileName; + std::string ContextHash; + std::vector FileDeps; + std::vector ModuleDeps; + std::vector DriverCommandLine; + std::vector Commands; + }; + + std::mutex Lock; + std::unordered_map + Modules; + std::vector Inputs; +}; + +static bool handleTranslationUnitResult( + StringRef Input, llvm::Expected &MaybeTUDeps, + FullDeps &FD, size_t InputIndex, SharedStream &OS, SharedStream &Errs) { + if (!MaybeTUDeps) { + llvm::handleAllErrors( + MaybeTUDeps.takeError(), [&Input, &Errs](llvm::StringError &Err) { + Errs.applyLocked([&](raw_ostream &OS) { + OS << "Error while scanning dependencies for " << Input << ":\n"; + OS << Err.getMessage(); + }); + }); + return true; + } + FD.mergeDeps(Input, std::move(*MaybeTUDeps), InputIndex); + return false; +} + +static bool handleModuleResult( + StringRef ModuleName, llvm::Expected &MaybeModuleGraph, + FullDeps &FD, size_t InputIndex, SharedStream &OS, SharedStream &Errs) { + if (!MaybeModuleGraph) { + llvm::handleAllErrors(MaybeModuleGraph.takeError(), + [&ModuleName, &Errs](llvm::StringError &Err) { + Errs.applyLocked([&](raw_ostream &OS) { + OS << "Error while scanning dependencies for " + << ModuleName << ":\n"; + OS << Err.getMessage(); + }); + }); + return true; + } + FD.mergeDeps(std::move(*MaybeModuleGraph), InputIndex); + return false; +} + +class P1689Deps { +public: + void printDependencies(raw_ostream &OS) { + addSourcePathsToRequires(); + // Sort the modules by name to get a deterministic order. + llvm::sort(Rules, [](const P1689Rule &A, const P1689Rule &B) { + return A.PrimaryOutput < B.PrimaryOutput; + }); + + using namespace llvm::json; + Array OutputRules; + for (const P1689Rule &R : Rules) { + Object O{{"primary-output", R.PrimaryOutput}}; + + if (R.Provides) { + Array Provides; + Object Provided{{"logical-name", R.Provides->ModuleName}, + {"source-path", R.Provides->SourcePath}, + {"is-interface", R.Provides->IsStdCXXModuleInterface}}; + Provides.push_back(std::move(Provided)); + O.insert({"provides", std::move(Provides)}); + } + + Array Requires; + for (const P1689ModuleInfo &Info : R.Requires) { + Object RequiredInfo{{"logical-name", Info.ModuleName}}; + if (!Info.SourcePath.empty()) + RequiredInfo.insert({"source-path", Info.SourcePath}); + Requires.push_back(std::move(RequiredInfo)); + } + + if (!Requires.empty()) + O.insert({"requires", std::move(Requires)}); + + OutputRules.push_back(std::move(O)); + } + + Object Output{ + {"version", 1}, {"revision", 0}, {"rules", std::move(OutputRules)}}; + + OS << llvm::formatv("{0:2}\n", Value(std::move(Output))); + } + + void addRules(P1689Rule &Rule) { + std::unique_lock LockGuard(Lock); + Rules.push_back(Rule); + } + +private: + void addSourcePathsToRequires() { + llvm::DenseMap ModuleSourceMapper; + for (const P1689Rule &R : Rules) + if (R.Provides && !R.Provides->SourcePath.empty()) + ModuleSourceMapper[R.Provides->ModuleName] = R.Provides->SourcePath; + + for (P1689Rule &R : Rules) { + for (P1689ModuleInfo &Info : R.Requires) { + auto Iter = ModuleSourceMapper.find(Info.ModuleName); + if (Iter != ModuleSourceMapper.end()) + Info.SourcePath = Iter->second; + } + } + } + + std::mutex Lock; + std::vector Rules; +}; + +static bool +handleP1689DependencyToolResult(const std::string &Input, + llvm::Expected &MaybeRule, + P1689Deps &PD, SharedStream &Errs) { + if (!MaybeRule) { + llvm::handleAllErrors( + MaybeRule.takeError(), [&Input, &Errs](llvm::StringError &Err) { + Errs.applyLocked([&](raw_ostream &OS) { + OS << "Error while scanning dependencies for " << Input << ":\n"; + OS << Err.getMessage(); + }); + }); + return true; + } + PD.addRules(*MaybeRule); + return false; +} + +/// Construct a path for the explicitly built PCM. +static std::string constructPCMPath(ModuleID MID, StringRef OutputDir) { + SmallString<256> ExplicitPCMPath(OutputDir); + llvm::sys::path::append(ExplicitPCMPath, MID.ContextHash, + MID.ModuleName + "-" + MID.ContextHash + ".pcm"); + return std::string(ExplicitPCMPath); +} + +static std::string lookupModuleOutput(const ModuleID &MID, ModuleOutputKind MOK, + StringRef OutputDir) { + std::string PCMPath = constructPCMPath(MID, OutputDir); + switch (MOK) { + case ModuleOutputKind::ModuleFile: + return PCMPath; + case ModuleOutputKind::DependencyFile: + return PCMPath + ".d"; + case ModuleOutputKind::DependencyTargets: + // Null-separate the list of targets. + return join(ModuleDepTargets, StringRef("\0", 1)); + case ModuleOutputKind::DiagnosticSerializationFile: + return PCMPath + ".diag"; + } + llvm_unreachable("Fully covered switch above!"); +} + +static std::string getModuleCachePath(ArrayRef Args) { + for (StringRef Arg : llvm::reverse(Args)) { + Arg.consume_front("/clang:"); + if (Arg.consume_front("-fmodules-cache-path=")) + return std::string(Arg); + } + SmallString<128> Path; + driver::Driver::getDefaultModuleCachePath(Path); + return std::string(Path); +} + +/// Attempts to construct the compilation database from '-compilation-database' +/// or from the arguments following the positional '--'. +static std::unique_ptr +getCompilationDatabase(int argc, char **argv, std::string &ErrorMessage) { + ParseArgs(argc, argv); + + if (!(CommandLine.empty() ^ CompilationDB.empty())) { + llvm::errs() << "The compilation command line must be provided either via " + "'-compilation-database' or after '--'."; + return nullptr; + } + + if (!CompilationDB.empty()) + return tooling::JSONCompilationDatabase::loadFromFile( + CompilationDB, ErrorMessage, + tooling::JSONCommandLineSyntax::AutoDetect); + + llvm::IntrusiveRefCntPtr Diags = + CompilerInstance::createDiagnostics(new DiagnosticOptions); + driver::Driver TheDriver(CommandLine[0], llvm::sys::getDefaultTargetTriple(), + *Diags); + TheDriver.setCheckInputsExist(false); + std::unique_ptr C( + TheDriver.BuildCompilation(CommandLine)); + if (!C || C->getJobs().empty()) + return nullptr; + + auto Cmd = C->getJobs().begin(); + auto CI = std::make_unique(); + CompilerInvocation::CreateFromArgs(*CI, Cmd->getArguments(), *Diags, + CommandLine[0]); + if (!CI) + return nullptr; + + FrontendOptions &FEOpts = CI->getFrontendOpts(); + if (FEOpts.Inputs.size() != 1) { + llvm::errs() + << "Exactly one input file is required in the per-file mode ('--').\n"; + return nullptr; + } + + // There might be multiple jobs for a compilation. Extract the specified + // output filename from the last job. + auto LastCmd = C->getJobs().end(); + LastCmd--; + if (LastCmd->getOutputFilenames().size() != 1) { + llvm::errs() + << "Exactly one output file is required in the per-file mode ('--').\n"; + return nullptr; + } + StringRef OutputFile = LastCmd->getOutputFilenames().front(); + + class InplaceCompilationDatabase : public tooling::CompilationDatabase { + public: + InplaceCompilationDatabase(StringRef InputFile, StringRef OutputFile, + ArrayRef CommandLine) + : Command(".", InputFile, {}, OutputFile) { + for (auto *C : CommandLine) + Command.CommandLine.push_back(C); + } + + std::vector + getCompileCommands(StringRef FilePath) const override { + if (FilePath != Command.Filename) + return {}; + return {Command}; + } + + std::vector getAllFiles() const override { + return {Command.Filename}; + } + + std::vector + getAllCompileCommands() const override { + return {Command}; + } + + private: + tooling::CompileCommand Command; + }; + + return std::make_unique( + FEOpts.Inputs[0].getFile(), OutputFile, CommandLine); +} + +int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) { + llvm::InitializeAllTargetInfos(); + std::string ErrorMessage; + std::unique_ptr Compilations = + getCompilationDatabase(argc, argv, ErrorMessage); + if (!Compilations) { + llvm::errs() << ErrorMessage << "\n"; + return 1; + } + + llvm::cl::PrintOptionValues(); + + // Expand response files in advance, so that we can "see" all the arguments + // when adjusting below. + Compilations = expandResponseFiles(std::move(Compilations), + llvm::vfs::getRealFileSystem()); + + Compilations = inferTargetAndDriverMode(std::move(Compilations)); + + Compilations = inferToolLocation(std::move(Compilations)); + + // The command options are rewritten to run Clang in preprocessor only mode. + auto AdjustingCompilations = + std::make_unique( + std::move(Compilations)); + ResourceDirectoryCache ResourceDirCache; + + AdjustingCompilations->appendArgumentsAdjuster( + [&ResourceDirCache](const tooling::CommandLineArguments &Args, + StringRef FileName) { + std::string LastO; + bool HasResourceDir = false; + bool ClangCLMode = false; + auto FlagsEnd = llvm::find(Args, "--"); + if (FlagsEnd != Args.begin()) { + ClangCLMode = + llvm::sys::path::stem(Args[0]).contains_insensitive("clang-cl") || + llvm::is_contained(Args, "--driver-mode=cl"); + + // Reverse scan, starting at the end or at the element before "--". + auto R = std::make_reverse_iterator(FlagsEnd); + auto E = Args.rend(); + // Don't include Args[0] in the iteration; that's the executable, not + // an option. + if (E != R) + E--; + for (auto I = R; I != E; ++I) { + StringRef Arg = *I; + if (ClangCLMode) { + // Ignore arguments that are preceded by "-Xclang". + if ((I + 1) != E && I[1] == "-Xclang") + continue; + if (LastO.empty()) { + // With clang-cl, the output obj file can be specified with + // "/opath", "/o path", "/Fopath", and the dash counterparts. + // Also, clang-cl adds ".obj" extension if none is found. + if ((Arg == "-o" || Arg == "/o") && I != R) + LastO = I[-1]; // Next argument (reverse iterator) + else if (Arg.starts_with("/Fo") || Arg.starts_with("-Fo")) + LastO = Arg.drop_front(3).str(); + else if (Arg.starts_with("/o") || Arg.starts_with("-o")) + LastO = Arg.drop_front(2).str(); + + if (!LastO.empty() && !llvm::sys::path::has_extension(LastO)) + LastO.append(".obj"); + } + } + if (Arg == "-resource-dir") + HasResourceDir = true; + } + } + tooling::CommandLineArguments AdjustedArgs(Args.begin(), FlagsEnd); + // The clang-cl driver passes "-o -" to the frontend. Inject the real + // file here to ensure "-MT" can be deduced if need be. + if (ClangCLMode && !LastO.empty()) { + AdjustedArgs.push_back("/clang:-o"); + AdjustedArgs.push_back("/clang:" + LastO); + } + + if (!HasResourceDir && ResourceDirRecipe == RDRK_InvokeCompiler) { + StringRef ResourceDir = + ResourceDirCache.findResourceDir(Args, ClangCLMode); + if (!ResourceDir.empty()) { + AdjustedArgs.push_back("-resource-dir"); + AdjustedArgs.push_back(std::string(ResourceDir)); + } + } + AdjustedArgs.insert(AdjustedArgs.end(), FlagsEnd, Args.end()); + return AdjustedArgs; + }); + + SharedStream Errs(llvm::errs()); + + std::optional FileOS; + llvm::raw_ostream &ThreadUnsafeDependencyOS = [&]() -> llvm::raw_ostream & { + if (OutputFileName == "-") + return llvm::outs(); + + if (OutputFileName == "/dev/null") + return llvm::nulls(); + + std::error_code EC; + FileOS.emplace(OutputFileName, EC); + if (EC) { + llvm::errs() << "Failed to open output file '" << OutputFileName + << "': " << llvm::errorCodeToError(EC) << '\n'; + std::exit(1); + } + return *FileOS; + }(); + SharedStream DependencyOS(ThreadUnsafeDependencyOS); + + std::vector Inputs = + AdjustingCompilations->getAllCompileCommands(); + + std::atomic HadErrors(false); + std::optional FD; + P1689Deps PD; + + std::mutex Lock; + size_t Index = 0; + auto GetNextInputIndex = [&]() -> std::optional { + std::unique_lock LockGuard(Lock); + if (Index < Inputs.size()) + return Index++; + return {}; + }; + + if (Format == ScanningOutputFormat::Full) + FD.emplace(ModuleName.empty() ? Inputs.size() : 0); + + auto ScanningTask = [&](DependencyScanningService &Service) { + DependencyScanningTool WorkerTool(Service); + + llvm::DenseSet AlreadySeenModules; + while (auto MaybeInputIndex = GetNextInputIndex()) { + size_t LocalIndex = *MaybeInputIndex; + const tooling::CompileCommand *Input = &Inputs[LocalIndex]; *** 167 LINES SKIPPED *** From nobody Wed Jul 2 18:25:53 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXSyF1nqPz60lr8; Wed, 02 Jul 2025 18:25:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta004.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXSyD4cdxz3GdM; Wed, 02 Jul 2025 18:25:56 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of cy.schubert@cschubert.com designates 3.97.99.33 as permitted sender) smtp.mailfrom=cy.schubert@cschubert.com; dmarc=permerror reason="p tag has invalid value: quarantine rua=mailto:p[ostmaster@cschubert.com" header.from=cschubert.com (policy=permerror) Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227]) by cmsmtp with ESMTPS id X1ywucVG85MqyX29buX4R3; Wed, 02 Jul 2025 18:25:55 +0000 Received: from spqr.komquats.com ([70.66.136.217]) by cmsmtp with ESMTPSA id X29auNoocJhBPX29buCVlP; Wed, 02 Jul 2025 18:25:55 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=QY3Fvdbv c=1 sm=1 tr=0 ts=686579b3 a=h7br+8Ma+Xn9xscxy5znUg==:117 a=h7br+8Ma+Xn9xscxy5znUg==:17 a=kj9zAlcOel0A:10 a=Wb1JkmetP80A:10 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=YxBL1-UpAAAA:8 a=c5oBaWCnqlhLl9_hoNcA:9 a=CjuIK1q_8ugA:10 a=LK5xJRSDVpKd5WXXoEvA:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 17D737F; Wed, 02 Jul 2025 11:25:54 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id F0431281; Wed, 02 Jul 2025 11:25:53 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mark Johnston cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: aefae931820f - main - linker: Improve handling of ifuncs when fetching symbol metadata Comments: In-reply-to Cy Schubert message dated "Wed, 02 Jul 2025 11:19:00 -0700." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 02 Jul 2025 11:25:53 -0700 Message-Id: <20250702182553.F0431281@slippy.cwsent.com> X-CMAE-Envelope: MS4xfE7QseIP9fyypDmiLgW3m33H7FyI6h56sY6Q6eNz/mcAJLWD7WlqjBwFEzRYMqwzeOwAy/5EVFRa/1BdO5E6A7N6BMWc2Va+9/GQPKww6FGod15fGENH zF1tBBBnkUflBZnxdicfphXCYxYtqK10T/ja/UsAoJ9ZWlMFoqjB5vKiw5Vqu1ccjFPJ6i7Aoa5IBtzaKNSZMHkvcJAxo4IjmLFtpSJAt4H/hOR/Z4vA29sn z7KgQsP2eTrnAnfx0vUlZxZ+dsSwzOFKYis5aJXR7s6Cx+k+01LSN/qZjIQO3DfTsuoOFdjrnH8DSsZP9Qa36oCP7cvNiEnjpGH7PvphauQ= X-Spamd-Result: default: False [2.25 / 15.00]; FAKE_REPLY(1.00)[]; NEURAL_SPAM_LONG(0.99)[0.994]; NEURAL_SPAM_MEDIUM(0.94)[0.936]; NEURAL_HAM_SHORT(-0.78)[-0.779]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:3.97.99.32/31]; RCVD_IN_DNSWL_LOW(-0.10)[3.97.99.33:from]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; RCVD_COUNT_THREE(0.00)[4]; R_DKIM_NA(0.00)[]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DMARC_BAD_POLICY(0.00)[cschubert.com : p tag has invalid value: quarantine rua=mailto:p[ostmaster@cschubert.com]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org,dev-commits-src-all@freebsd.org]; REPLYTO_EQ_FROM(0.00)[] X-Rspamd-Queue-Id: 4bXSyD4cdxz3GdM X-Spamd-Bar: ++ Cy Schubert writes: > In message <202507021341.562DfuEh023668@gitrepo.freebsd.org>, Mark Johnston > wri > tes: > > The branch main has been updated by markj: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=aefae931820fe1e93a318552968510 > 29 > > 8c7941a0 > > > > commit aefae931820fe1e93a318552968510298c7941a0 > > Author: Mark Johnston > > AuthorDate: 2025-07-02 13:34:47 +0000 > > Commit: Mark Johnston > > CommitDate: 2025-07-02 13:34:47 +0000 > > > > linker: Improve handling of ifuncs when fetching symbol metadata > > > > When looking up symbol values, we map ifunc symbols to the value > > returned by the resolver. However, the returned symbol size is still > > that of the resolver. Be consistent and provide the size of the > > implementation symbol as well. > > > > This fixes an inconsistency in dtrace's FBT provider, which enumerates > > all function symbols and disassembles their values, using the symbol > > size as the bound for the disassembly loop. In particular, for ifuncs, > > we were not creating return probes. > > > > Reviewed by: kib > > MFC after: 2 weeks > > Sponsored by: Innovate UK > > Differential Revision: https://reviews.freebsd.org/D50683 > > --- > > sys/kern/link_elf.c | 38 ++++++++++++++++++++++++++++++++++---- > > sys/kern/link_elf_obj.c | 31 +++++++++++++++++++++++++++++-- > > 2 files changed, 63 insertions(+), 6 deletions(-) > > > > diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c > > index 53af1e164980..bbebadc4c395 100644 > > --- a/sys/kern/link_elf.c > > +++ b/sys/kern/link_elf.c > > @@ -1628,6 +1628,30 @@ link_elf_lookup_debug_symbol_ctf(linker_file_t lf, c > on > > st char *name, > > return (i < ef->ddbsymcnt ? link_elf_ctf_get_ddb(lf, lc) : ENOENT); > > } > > > > +static void > > +link_elf_ifunc_symbol_value(linker_file_t lf, caddr_t *valp, size_t *sizep > ) > > +{ > > + c_linker_sym_t sym; > > + elf_file_t ef; > > + const Elf_Sym *es; > > + caddr_t val; > > + long off; > > + > > + val = *valp; > > + ef = (elf_file_t)lf; > > + > > + /* Provide the value and size of the target symbol, if available. */ > > + val = ((caddr_t (*)(void))val)(); > > + if (link_elf_search_symbol(lf, val, &sym, &off) == 0 && off == 0) { > > + es = (const Elf_Sym *)sym; > > + *valp = (caddr_t)ef->address + es->st_value; > > + *sizep = es->st_size; > > + } else { > > + *valp = val; > > + *sizep = 0; > > + } > > +} > > + > > static int > > link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, > > linker_symval_t *symval, bool see_local) > > @@ -1635,6 +1659,7 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sy > m_ > > t sym, > > elf_file_t ef; > > const Elf_Sym *es; > > caddr_t val; > > + size_t size; > > > > ef = (elf_file_t)lf; > > es = (const Elf_Sym *)sym; > > @@ -1644,9 +1669,11 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_s > ym > > _t sym, > > symval->name = ef->strtab + es->st_name; > > val = (caddr_t)ef->address + es->st_value; > > if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) > > - val = ((caddr_t (*)(void))val)(); > > + link_elf_ifunc_symbol_value(lf, &val, &size); > > + else > > + size = es->st_size; > > symval->value = val; > > - symval->size = es->st_size; > > + symval->size = size; > > return (0); > > } > > return (ENOENT); > > @@ -1668,6 +1695,7 @@ link_elf_debug_symbol_values(linker_file_t lf, c_link > er > > _sym_t sym, > > elf_file_t ef = (elf_file_t)lf; > > const Elf_Sym *es = (const Elf_Sym *)sym; > > caddr_t val; > > + size_t size; > > > > if (link_elf_symbol_values1(lf, sym, symval, true) == 0) > > return (0); > > @@ -1678,9 +1706,11 @@ link_elf_debug_symbol_values(linker_file_t lf, c_lin > ke > > r_sym_t sym, > > symval->name = ef->ddbstrtab + es->st_name; > > val = (caddr_t)ef->address + es->st_value; > > if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) > > - val = ((caddr_t (*)(void))val)(); > > + link_elf_ifunc_symbol_value(lf, &val, &size); > > + else > > + size = es->st_size; > > symval->value = val; > > - symval->size = es->st_size; > > + symval->size = size; > > return (0); > > } > > return (ENOENT); > > diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c > > index 02fd4caffcd9..3d18aed2b1c0 100644 > > --- a/sys/kern/link_elf_obj.c > > +++ b/sys/kern/link_elf_obj.c > > @@ -1510,6 +1510,30 @@ link_elf_lookup_debug_symbol_ctf(linker_file_t lf, c > on > > st char *name, > > return (link_elf_ctf_get_ddb(lf, lc)); > > } > > > > +static void > > +link_elf_ifunc_symbol_value(linker_file_t lf, caddr_t *valp, size_t *sizep > ) > > +{ > > + c_linker_sym_t sym; > > + elf_file_t ef; > > + const Elf_Sym *es; > > + caddr_t val; > > + long off; > > + > > + val = *valp; > > + ef = (elf_file_t)lf; > > + > > + /* Provide the value and size of the target symbol, if available. */ > > + val = ((caddr_t (*)(void))val)(); > > + if (link_elf_search_symbol(lf, val, &sym, &off) == 0 && off == 0) { > > + es = (const Elf_Sym *)sym; > > + *valp = (caddr_t)ef->address + es->st_value; > > + *sizep = es->st_size; > > + } else { > > + *valp = val; > > + *sizep = 0; > > + } > > +} > > + > > static int > > link_elf_symbol_values1(linker_file_t lf, c_linker_sym_t sym, > > linker_symval_t *symval, bool see_local) > > @@ -1517,6 +1541,7 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_sy > m_ > > t sym, > > elf_file_t ef; > > const Elf_Sym *es; > > caddr_t val; > > + size_t size; > > > > ef = (elf_file_t) lf; > > es = (const Elf_Sym*) sym; > > @@ -1527,9 +1552,11 @@ link_elf_symbol_values1(linker_file_t lf, c_linker_s > ym > > _t sym, > > symval->name = ef->ddbstrtab + es->st_name; > > val = (caddr_t)es->st_value; > > if (ELF_ST_TYPE(es->st_info) == STT_GNU_IFUNC) > > - val = ((caddr_t (*)(void))val)(); > > + link_elf_ifunc_symbol_value(lf, &val, &size); > > + else > > + size = es->st_size; > > symval->value = val; > > - symval->size = es->st_size; > > + symval->size = size; > > return (0); > > } > > return (ENOENT); > > > > This commit may have caused a panic loading linux.ko. > > #0 __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:57 > #1 doadump (textdump=textdump@entry=1) > at /opt/src/git-src/sys/kern/kern_shutdown.c:399 > #2 0xffffffff806fad1e in kern_reboot (howto=260) > at /opt/src/git-src/sys/kern/kern_shutdown.c:519 > #3 0xffffffff806fb247 in vpanic (fmt=0xffffffff80b2e000 "%s", > ap=ap@entry=0xfffffe008c8e2450) > at /opt/src/git-src/sys/kern/kern_shutdown.c:974 > #4 0xffffffff806fb073 in panic (fmt=) > at /opt/src/git-src/sys/kern/kern_shutdown.c:887 > #5 0xffffffff80aa8e7a in trap_fatal (frame=, > eva=) at /opt/src/git-src/sys/amd64/amd64/trap.c:974 > #6 0xffffffff80aa8e7a in trap_pfault (frame=0xfffffe008c8e24d0, > usermode=false, signo=, ucode=) > #7 > #8 fbt_provide_module_function (lf=lf@entry=0xfffff80126035900, > symindx=symindx@entry=753, symval=symval@entry=0xfffffe008c8e25f0, > opaque=opaque@entry=0xfffffe008c8e2640) > at /opt/src/git-src/sys/cddl/dev/fbt/x86/fbt_isa.c:205 > #9 0xffffffff80ac870d in link_elf_each_function_nameval ( > file=0xfffff80126035900, > callback=0xffffffff81d916a0 , > opaque=0xfffffe008c8e2640) at /opt/src/git-src/sys/kern/link_elf_obj.c:1 > 685 > --Type for more, q to quit, c to continue without paging--c > #10 0xffffffff81d9035f in fbt_provide_module (arg=, > lf=0xfffff80126035900) at /opt/src/git-src/sys/cddl/dev/fbt/fbt.c:221 > #11 0xffffffff81cc87fb in dtrace_module_loaded (ctl=0xfffff80126035900) > at /opt/src/git-src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrac > e.c:16709 > #12 dtrace_kld_load (arg=, lf=0xfffff80126035900) > at /opt/src/git-src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrac > e.c:16894 > #13 0xffffffff806c4ecb in linker_load_file ( > filename=0xfffff80054e6d500 "/boot/kernel/linux.ko", > result=) at /opt/src/git-src/sys/kern/kern_linker.c:518 > #14 linker_load_module (kldname=kldname@entry=0x0, > modname=0xfffff8005437c800 "linux", parent=parent@entry=0x0, > verinfo=verinfo@entry=0x0, lfpp=lfpp@entry=0xfffffe008c8e2da0) > at /opt/src/git-src/sys/kern/kern_linker.c:2292 > #15 0xffffffff806c69f5 in kern_kldload (td=td@entry=0xfffff8005ce3c780, > file=file@entry=0xfffff8005437c800 "linux", > fileid=fileid@entry=0xfffffe008c8e2de4) > at /opt/src/git-src/sys/kern/kern_linker.c:1236 > #16 0xffffffff806c6b09 in sys_kldload (td=0xfffff8005ce3c780, > uap=0xfffff8005ce3cba8) at /opt/src/git-src/sys/kern/kern_linker.c:1259 > #17 0xffffffff80aa97d6 in syscallenter (td=0xfffff8005ce3c780) > at /opt/src/git-src/sys/amd64/amd64/../../kern/subr_syscall.c:193 > #18 amd64_syscall (td=0xfffff8005ce3c780, traced=0) > at /opt/src/git-src/sys/amd64/amd64/trap.c:1215 > #19 > #20 0x00000ce63ecf8c3a in ?? () Confirmed. kldload linux causes the panic. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e**(i*pi)+1=0 From nobody Wed Jul 2 18:27:44 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT0J5MNbz60m7n; Wed, 02 Jul 2025 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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT0J4rGxz3H0J; Wed, 02 Jul 2025 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=1751480864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i4refpiXSW4kGmM9j9xXhCjWgzom0tIJDUVtJz28U90=; b=xcy1k65dMKVDq0qhkLlhvBDhbEzZhLMkgAzPVKLZhIOF7dn2gsHZBOHWlxXyt9z2vYg8lv 2ol+sCgAowGJpDW51vsfboSixPDuvl/vbw59BR0jYztJaxTgabovXgWRpExlhal6keKBYj XFrJYlf5CViEBXL0LulrYrJhqDYPfsIUFvoRJw4zbILx5UCej/SPB/iluebbGHAtl7cgP3 Lq+9R0e1MGbZhfhhJeIX3SGiqDTDbNitYmoAA9FdkqFk4QuyjH/2LK8vPhp7PaijSeOv/g 9+T8EP4opV24hVWVVI3FUAb1BazFZxr+g4FphKnWgOfBN18y0nrfCTK+zp9dRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i4refpiXSW4kGmM9j9xXhCjWgzom0tIJDUVtJz28U90=; b=bxv6PYX+uzFc8wUmktfaJKdtOGbWc/X/0OCtGw4EyH3xaWJx1kJVE45PKTRDzWdxwMRedi YU+WDqDRtNuSdLEZ2eaIQ1CLj7QxyOyZQ5mHVNqbfw/5r+Td6oVjed61ogg9lkOMmMrGbK mTyoeAaJBy+8Txx/KRWQscFiPdduclPvzNFx+9GdYZdTlcT7inzyvy3DSeMUc1exLCZKeO jraRXODqqn9WTT/+8cjFHRu8IFyl6B7Y9FxL5saM/fWY6Dr2ApJWMoiUpmeO5jJVD1g+bb 0DZK7F/rIhTBpcF32zWkfjiOm+KAAmdZHadi5lAKwY//ckU6KQ5xSobB6R1yBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480864; a=rsa-sha256; cv=none; b=Xz711H1fz+VGez5Du4sib+gWelQaz91jyqsaf1HQI8soHUAfaVI3wTQ0LKu1vXGjsTn9GM V/UugIGOAeYzhpRYH8+3sFEI6jLe+fM+aV+4E5EBTYxLwkIA9b3mJpfyMLeMMPhGJ7d45P oIhlH7Jzt+oXwtEkk1mQOLDMiQKlLZ92AmK/NnN16s6I2I8azrXxmQWiwvaKzOo/IsStHn WAyAvpNsjcw5/uFVV4bM1qdQjEGV4G/jZV7SsrInGFK+Cyy6tN6BFVVOh7MRzf77wosTXz Pnt7kq1czVjp4waYvxRsg3T/0oKWFpV73wKYgJhsIh+xErQH3ecKJtFcpKdWjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT0J3nNkzW9T; Wed, 02 Jul 2025 18:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562IRiBJ056990; Wed, 2 Jul 2025 18:27:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562IRiCE056987; Wed, 2 Jul 2025 18:27:44 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:27:44 GMT Message-Id: <202507021827.562IRiCE056987@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: cb24a62cd75b - releng/14.3 - Fix corruption in ZFS replication streams from encrypted datasets. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.3 X-Git-Reftype: branch X-Git-Commit: cb24a62cd75b582c53f5bd600650bddd09a0ee89 Auto-Submitted: auto-generated The branch releng/14.3 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=cb24a62cd75b582c53f5bd600650bddd09a0ee89 commit cb24a62cd75b582c53f5bd600650bddd09a0ee89 Author: Gordon Tetlow AuthorDate: 2025-07-02 05:51:38 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:51:38 +0000 Fix corruption in ZFS replication streams from encrypted datasets. From the upstream pull request merges: #17340 b144b160b Fix 2 bugs in non-raw send with encryption Obtained from: OpenZFS Approved by: so Security: FreeBSD-EN-25:10.zfs --- sys/contrib/openzfs/module/zfs/dmu_send.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/dmu_send.c b/sys/contrib/openzfs/module/zfs/dmu_send.c index 30d2ca5d6aa2..716b1b1f778c 100644 --- a/sys/contrib/openzfs/module/zfs/dmu_send.c +++ b/sys/contrib/openzfs/module/zfs/dmu_send.c @@ -2669,8 +2669,8 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, } if (fromsnap != 0) { - err = dsl_dataset_hold_obj_flags(dspp.dp, fromsnap, dsflags, - FTAG, &fromds); + err = dsl_dataset_hold_obj(dspp.dp, fromsnap, FTAG, &fromds); + if (err != 0) { dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG); dsl_pool_rele(dspp.dp, FTAG); @@ -2722,7 +2722,7 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, kmem_free(dspp.fromredactsnaps, dspp.numfromredactsnaps * sizeof (uint64_t)); - dsl_dataset_rele(dspp.to_ds, FTAG); + dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG); return (err); } From nobody Wed Jul 2 18:27:45 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT0K6SgRz60m9j; Wed, 02 Jul 2025 18:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT0K3yfRz3HBl; Wed, 02 Jul 2025 18:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Au7KYU3IJRqh2eUsgKphjANPJ2BVE2xHes+S9/xKTsQ=; b=loWLloOWUg8XXH+qh/3HU0ikeChxrEuU5j4e4K4LJbqVFX9JScLQgu2vgCHtWj4bcjAonF qbDC7AcFQfxWV7vkBMZ1gT5IFJcKGyzaP+I1nGp9UDI1pxigBLeBb0SjytOcxjCUIAJb7l 3fSjyeQ5OAJDKCpORie8UkESOGCRJRBiFEwVIQjFTCOlKDO1jk5tgqpekjWDornQ8s/ltT 6lbXFnBJdx0rAqfyhcY1eScg0cPRpOYw/vRNVZzbg38Z/G15THCwkIh9msLpbWpdvZt/SD 8Fo0r9qzEIvWADtTmzHNsNP3lW6dP4c7Ru+rWis5RhJ5fd26Pi6Qc5KzmOvm/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Au7KYU3IJRqh2eUsgKphjANPJ2BVE2xHes+S9/xKTsQ=; b=YiSKK8mdEAKvZkFpMuUREdtmOXvTkL2uSB7kJ01JN1JU4KBvoXOtOVYzyL2ASghhSFNW9m JgYUMMI9khL/+pN16P6CsLP7Gno1OS3rxRGc57a63BckjlCNyVnRWoeFOPtyG5ff3DKbiZ FfOJIWH/Rur/6XPWowuBobndC1UApw+tTcgV4/bKk+brtgMy/JmCMkqq8am74x5MP3ktC9 IgYnyMcsImMTdu9Iw9I83Gbdwjiey2RpeQJ8LNcvRXCqRjGkhawnoVs2J0DQWODXNwRW0f hPoKZGB0tCxMkRS/jPcOgkRrSjH/3CHTbPMjogmdMqVjKg68lFS+QjJHSnnNgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480865; a=rsa-sha256; cv=none; b=BsKDiCDeNhxZvsmXKVAeL/KKnyyOVtpNoYOifQ0I4LCSQlVaEWHaES1m3NMfMJVACGReap oZTsr9hX6797gdZzyqoKK7BWPYAKIoMNj4m06+oeoE+Nd5sh0rFLxcMdY9m0I37vy0xl/K KMJBxh+ZqTGfRt40BG18kGWKromGmO4yB6gaJklX7LlkvxGwDaKw3jfobBjHwPm1ZZmXqd wF664NRqK3ivPWQO4YGEAIjVk5uWJx0EdPIpx5r4cspVL1Hqmvn1YJrLfnU+N9rzkAknRD eZ2yz8YyKZz9yUaNSvUnNSfgctsqf2RBA69QD7ds3AfIEKP4T//FS0Um2pS18Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT0K2mKKzWTZ; Wed, 02 Jul 2025 18:27:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562IRjvL057029; Wed, 2 Jul 2025 18:27:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562IRjv5057026; Wed, 2 Jul 2025 18:27:45 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:27:45 GMT Message-Id: <202507021827.562IRjv5057026@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 2ea99b8ed142 - releng/14.3 - Add UPDATING entries and bump version. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.3 X-Git-Reftype: branch X-Git-Commit: 2ea99b8ed14208286ec3c8d6ccc997537c13d195 Auto-Submitted: auto-generated The branch releng/14.3 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=2ea99b8ed14208286ec3c8d6ccc997537c13d195 commit 2ea99b8ed14208286ec3c8d6ccc997537c13d195 Author: Gordon Tetlow AuthorDate: 2025-07-02 06:04:23 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 06:04:23 +0000 Add UPDATING entries and bump version. Approved by: so --- UPDATING | 5 +++++ sys/conf/newvers.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 75c40967a1ae..5a2bcdd07615 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,11 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20250702: + 14.3-RELEASE-p1 EN-25:10.zfs + + Fix corruption in ZFS replication streams from encrypted datasets [EN-25:10.zfs] + 20250610: 14.3-RELEASE. diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index f3815c0d9b16..b27ca22487d2 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -53,7 +53,7 @@ TYPE="FreeBSD" REVISION="14.3" -BRANCH="RELEASE" +BRANCH="RELEASE-p1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Wed Jul 2 18:28:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT0m758Jz60m80; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT0m6Q8Pz3HhS; Wed, 02 Jul 2025 18:28:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KAJSX3sZwGEBiH0L1LjZmWmtsVWOsB4Eus8RZORQE/s=; b=YjFPmZ8gGpGZust96Pg2ggMHhoEWCZBo1qU1g5xBaJT1GlRHKDHZfbTrwgrqCFb+xUfrqU 6PatbZNlQKb3isTs0O3wVjPlLyVBuWDOSqfxK7bYwHMAf0cwP7WfEGcQ14PKQudyVOAyx4 NntW4AP1o+BY1UQSBGcl4m2aW8UkqDeRf7729POWZWTpWBJPpFbBrAHesA6jI6y/D4Bxky 9iJLi/mKp8faU/KJTqyhah9JHQEI3Nqpjo6Xc++uj09grtTERusqGpiZfr1sZ+6F3j/OKa tZ0jiNAUnWpnrovFAXNQWpkPatIZtsS6gynU+cGdqR/WvJ36v0OaeQkyiDXaIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KAJSX3sZwGEBiH0L1LjZmWmtsVWOsB4Eus8RZORQE/s=; b=wnYRnKt9DvYoJkTg8yd1r30gPdHuWKyTuVUuvuTT1dcNsGm4kG4MWvkX4naMRaGw2YEBVl RxWrdlm2f+hNasLQiSQwWaWpfojKvw4bEVrwKl14bwCaVkvzS2G3wczafJlpEq20/V3MHz feaNcmSnlVVUHuV+GqcuZN5cbnDjM1/0b+v19wwWfrvqiKSCfqm4iF/vz0vxQqurIQEFvO sYy6smWhf+uxBS4S85hPD5nqehCfhJTaujPhD6LUj6j+x6H+9h5j3KxpUssqcHXfhNmNoD CWZyKsOUe5IYwgOKwwb5D+Z23p7rwZgX+M5TMxuoSa3lj5k4rWqopzvuIPHdVg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480888; a=rsa-sha256; cv=none; b=B08OORDfxowgIcef3a8fgAkvPlb+N6W7B6tz2/tQfM/B/MCY+ZweV8225pS55M/sbxCAkg 0hSCVy/dlHKfk1w0ZK2oy1wszjxtXeHzCogy2XQ34kQAWfo6UBo1v9tZfXNM+Th722xt3X eRmA457RrhpWH74/vF/ON48+8Tj60H5ZET2wbROgnM7k8chwyPgAm5eB56iz8WoZSoGUA5 AUjwP1YCdV92m+j0NCRKuWQxKfA3kQpxUKYsS/4pSSLvacxilITEeG6pbYgf+uNPRb0P0x BC0RGqhd3PwxnV5uFXSlSYGSkVBEmRGo6bWyf8RxqlBtCghQ7L46xadIQr+C1A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT0m5nxjzVsH; Wed, 02 Jul 2025 18:28:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562IS8Pv057324; Wed, 2 Jul 2025 18:28:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562IS8FI057321; Wed, 2 Jul 2025 18:28:08 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:08 GMT Message-Id: <202507021828.562IS8FI057321@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 89a2823e17e5 - releng/14.2 - libc: allow __cxa_atexit handlers to be added during __cxa_finalize List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.2 X-Git-Reftype: branch X-Git-Commit: 89a2823e17e5e86b03516b89bfde88f2077c6da0 Auto-Submitted: auto-generated The branch releng/14.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=89a2823e17e5e86b03516b89bfde88f2077c6da0 commit 89a2823e17e5e86b03516b89bfde88f2077c6da0 Author: Aurélien Croc de Suray AuthorDate: 2025-04-05 00:47:53 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:46:14 +0000 libc: allow __cxa_atexit handlers to be added during __cxa_finalize science/dlib-cpp reveals an interesting scenario that works fine on other platforms but not on FreeBSD; notably, it ends up creating a new global object from some destructor which is called during __cxa_finalize. This breaks when libdlib is dlopen()ed and then subsequently dlclose()ed, as we never end up invoking the created object's dtor until program exit when the shlib is already unmapped. Fix it by noting when we're in the middle of __cxa_finalize for a dso, and then restarting the search if __cxa_atexit() was called in the middle somewhere. We wait until we've processed the initial set before starting over and processing the newly added handlers as if it were a complete set of handlers added during runtime. The alternative is calling them as they're added to maintain a LIFO in terms of total ordering, but in theory a constructor could add another global object that also needs to be destroyed, and that object needs to be destroyed after the one that constructed it to avoid creating unexpected lifetime issues. This manifests in the pdlib PHP extension for dlib crashing, see [0]. [0] https://github.com/goodspb/pdlib/issues/39 PR: 285870 Reviewed by: kevans (also supplied commit message) Approved by: so Security: FreeBSD-EN-25:09.libc (cherry picked from commit 23427c8e1fedb9fc68ad0bd27a59c7ffd2b3008c) (cherry picked from commit c43ae65b4b89be422cdcd399a7abc44f6db4b298) --- lib/libc/stdlib/atexit.c | 61 ++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c index b2c10ca4cca5..6468b9ff0a62 100644 --- a/lib/libc/stdlib/atexit.c +++ b/lib/libc/stdlib/atexit.c @@ -38,6 +38,7 @@ static char sccsid[] = "@(#)atexit.c 8.2 (Berkeley) 7/3/94"; #include "namespace.h" #include #include +#include #include #include #include @@ -59,6 +60,8 @@ _Block_copy(void*); #define ATEXIT_FN_CXA 2 static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER; +static void *current_finalize_dso = NULL; +static bool call_finalize_again = false; #define _MUTEX_LOCK(x) if (__isthreaded) _pthread_mutex_lock(x) #define _MUTEX_UNLOCK(x) if (__isthreaded) _pthread_mutex_unlock(x) @@ -118,6 +121,9 @@ atexit_register(struct atexit_fn *fptr) __atexit = p; } p->fns[p->ind++] = *fptr; + if (current_finalize_dso != NULL && + current_finalize_dso == fptr->fn_dso) + call_finalize_again = true; _MUTEX_UNLOCK(&atexit_mutex); return 0; } @@ -211,33 +217,38 @@ __cxa_finalize(void *dso) } _MUTEX_LOCK(&atexit_mutex); - for (p = __atexit; p; p = p->next) { - for (n = p->ind; --n >= 0;) { - if (p->fns[n].fn_type == ATEXIT_FN_EMPTY) - continue; /* already been called */ - fn = p->fns[n]; - if (dso != NULL && dso != fn.fn_dso) { - /* wrong DSO ? */ - if (!has_phdr || global_exit || - !__elf_phdr_match_addr(&phdr_info, - fn.fn_ptr.cxa_func)) - continue; + current_finalize_dso = dso; + do { + call_finalize_again = false; + for (p = __atexit; p; p = p->next) { + for (n = p->ind; --n >= 0;) { + if (p->fns[n].fn_type == ATEXIT_FN_EMPTY) + continue; /* already been called */ + fn = p->fns[n]; + if (dso != NULL && dso != fn.fn_dso) { + /* wrong DSO ? */ + if (!has_phdr || global_exit || + !__elf_phdr_match_addr(&phdr_info, + fn.fn_ptr.cxa_func)) + continue; + } + /* + Mark entry to indicate that this particular + handler has already been called. + */ + p->fns[n].fn_type = ATEXIT_FN_EMPTY; + _MUTEX_UNLOCK(&atexit_mutex); + + /* Call the function of correct type. */ + if (fn.fn_type == ATEXIT_FN_CXA) + fn.fn_ptr.cxa_func(fn.fn_arg); + else if (fn.fn_type == ATEXIT_FN_STD) + fn.fn_ptr.std_func(); + _MUTEX_LOCK(&atexit_mutex); } - /* - Mark entry to indicate that this particular handler - has already been called. - */ - p->fns[n].fn_type = ATEXIT_FN_EMPTY; - _MUTEX_UNLOCK(&atexit_mutex); - - /* Call the function of correct type. */ - if (fn.fn_type == ATEXIT_FN_CXA) - fn.fn_ptr.cxa_func(fn.fn_arg); - else if (fn.fn_type == ATEXIT_FN_STD) - fn.fn_ptr.std_func(); - _MUTEX_LOCK(&atexit_mutex); } - } + } while (call_finalize_again); + current_finalize_dso = NULL; _MUTEX_UNLOCK(&atexit_mutex); if (dso == NULL) _MUTEX_DESTROY(&atexit_mutex); From nobody Wed Jul 2 18:28:09 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT0p34myz60mLc; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT0p0lmlz3HhT; Wed, 02 Jul 2025 18:28:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XoGc6qhIwkefrRmp1pVXsHPyVtDIPbqTM97OcAvLi8U=; b=tBVFQj8/3kzT+v4qIVStkn5pddkFdZrf4JbZE7t2nxTF/uwB1dgf6GQvspqypmP12TxyaT fxgCGxt0RxGaRKq04GT7jCWxRSpkhWpFaspgGULlScMp8yUYLWYqfxXlr2ntrOyfSb0Xyu U08vZwmfFCAzNrjgZVlDGk4fLkaXKo5c0kixoJ0mK4eLlolbIqClQ2xBoDadjj9Gi7XGcH yd2SlOofe2LF908G2KGqdBy6xaTPxIIG7I3Kn3nKSuyS8i/NCbD/A6jbgRPZ2vXEtEiEkE JlmdlRbKqPscWbrBk8+6YkooA+kfxqjtGagNivGghZfn7kXfePOXronJXaVl7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XoGc6qhIwkefrRmp1pVXsHPyVtDIPbqTM97OcAvLi8U=; b=mHIUGeqR0e4NZ9Qd6SMhI09p1Ctlqlsq+NruTqw83v9drK2YBCi+AhfpwI5JHYLuRt8dQA 03otzvM6N0dEvE4TpXhBD0kJS5TS6+LDDjMukuR8avUsa8VR19C2wgDU4EL4ZDM4r7aH83 Cc/bgIAa4e1AbrLomAbeEQQSHAakFXza/77G7VaEPIVnIM4b4ZC/acX25gLd76zMZq0ga4 nlovROj4Jx7Y0CGHxnrDXhG7NKCeS2uJKGW22sZQOTY+w9Xr2EiuflwLlSB+RVhx1pvT5r PfHJuIGx60CO09ul52uCY9dmQOge2iDO61iY4W/kr46P0qd+mZ72KhAJ3hJLpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480890; a=rsa-sha256; cv=none; b=e3t/fyrF52zBdT5Deo9CnzaqajR8VFZzpW/yQMnq5xFHv89svja+cxCi2fkwyCzPCUk8KT Dc2QDUtOx5zcfbAiUbWjBU1iMoh586Ddb6n7OTA4ZuH4UJIj6jDKcy8CqXASqAOqzytj51 PvfOHrr3i8yWc7XXV1VKq/wCmu1YkqPtT7OMWB9zcQ0jReXfHDHyac2n4x3DfYMfTbUMoO 9K70haJoiATnbQrRMCVHZSWmb4xIQm/ASaJCh6VD535PrAIueaNiP2vF/OOo7uufOVBonB PMxllxkBC2faO1ieEj24RJ8mWurTDCq0ju7nnPKFpazvWXBSGvro5uo23oKhlQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT0p00C4zWGl; Wed, 02 Jul 2025 18:28:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562IS9sh057358; Wed, 2 Jul 2025 18:28:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562IS9CW057355; Wed, 2 Jul 2025 18:28:09 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:09 GMT Message-Id: <202507021828.562IS9CW057355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: c5feebf38389 - releng/14.2 - Fix corruption in ZFS replication streams from encrypted datasets. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.2 X-Git-Reftype: branch X-Git-Commit: c5feebf38389901b4b22ac94244ce33e9e6234ca Auto-Submitted: auto-generated The branch releng/14.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=c5feebf38389901b4b22ac94244ce33e9e6234ca commit c5feebf38389901b4b22ac94244ce33e9e6234ca Author: Gordon Tetlow AuthorDate: 2025-07-02 05:51:04 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:51:04 +0000 Fix corruption in ZFS replication streams from encrypted datasets. From the upstream pull request merges: #17340 b144b160b Fix 2 bugs in non-raw send with encryption Obtained from: OpenZFS Approved by: so Security: FreeBSD-EN-25:10.zfs --- sys/contrib/openzfs/module/zfs/dmu_send.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/dmu_send.c b/sys/contrib/openzfs/module/zfs/dmu_send.c index 37c68528bf95..23ab482941e7 100644 --- a/sys/contrib/openzfs/module/zfs/dmu_send.c +++ b/sys/contrib/openzfs/module/zfs/dmu_send.c @@ -2669,8 +2669,8 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, } if (fromsnap != 0) { - err = dsl_dataset_hold_obj_flags(dspp.dp, fromsnap, dsflags, - FTAG, &fromds); + err = dsl_dataset_hold_obj(dspp.dp, fromsnap, FTAG, &fromds); + if (err != 0) { dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG); dsl_pool_rele(dspp.dp, FTAG); @@ -2722,7 +2722,7 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, kmem_free(dspp.fromredactsnaps, dspp.numfromredactsnaps * sizeof (uint64_t)); - dsl_dataset_rele(dspp.to_ds, FTAG); + dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG); return (err); } From nobody Wed Jul 2 18:28:10 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT0q3qLwz60lyq; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT0q1Xwqz3HXp; Wed, 02 Jul 2025 18:28:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qUoIu0bVSf/+Va/qbnLGGAYYAlfU5Nt2oBvID60+7E0=; b=uN0InLvgBj2pvSnky2iFaTCH9hgD/yjAqN3gpke7Azqcct9A9qBovzTLM3F2MRywZb+OlJ RgRoqWrLKtWoM36Sn7F18a5KlYvMSO7OqHE+97LivHlBIvGRLNU7KlPdNMrerf3KiS28uB mn2ZmYZHTYak004zUe7myKXjDME+ijfKMbKUq0lLF3Hv0qggv0caGDDhJywM7CpcLQ3T2j YLHlTXo15yg4Bx6ZrJfEuZsC0frCXHAiG2qFLhpX86JCGKjZkyBURc6NGAUmw7wNry/1bV uGUnr0ygn2tYgy1qTrWMdmgUMTxbAG8E4zyhwE2eP+pCRUUdBpIHIyrjr2kS1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qUoIu0bVSf/+Va/qbnLGGAYYAlfU5Nt2oBvID60+7E0=; b=n4IoSDCshekzEROt70wxofR+YO5K8okWVWhAh/duY2ieax3F5z9Hpi4w2uwijAbO0qAa2M /nzq3Sl1PXOy8Qz/nl/y8TldhI6PsbfVeSHYWLnXdica/68z2xp4CqeoMfjuypemNzy+bI DuxtV0MaFPPadgU9RAygwgtUC1WqG7IJ29E9MT5zEtsGD/27SnfmcqLeOXDQ42O8ESH8aO CG6cWOjr7ccYtz3uihjsLzQ13fzjINimVF/e8IeHIYVUBL4eypjA1t+umMfbvt5vw71884 zDc9N+lDWNpCR0LHyo+m0iemt3acDbNikDwoRsd/B95kRCrTTGTJ1Mac1bYtew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480891; a=rsa-sha256; cv=none; b=E/91XesFg5lczaQgRSvSeD2RQmQPrafwFo1teHvxFo1q/92L5ozu2ya1lsWreDDwr+fVTH nb6HMYim650eAT0TClQpac1otvOZHGNXdANmtFz/XSkVKdd8lJNq5xw6sAkdWaQmzd+iLV Tb2njnizyllZu4K7YHpWMczMZ1wkfOWOLBaASCG8wofaLwKbg1jPHtMB+xTTi3CKe45JXl 8jKnBNoJVOOkbS+aJOHQlQ/D2qBQJCWDuwEnFqfU7C1c0o+VMRTfXS1l3pJLPXb3zZ4V0R FNVCaDgCPUhsKrRbjMUHKU56v0XDLU2cLS7shzN8K3wkJbtJre8ihlSGiK1Aqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT0q0fcSzWGQ; Wed, 02 Jul 2025 18:28:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISAlg057391; Wed, 2 Jul 2025 18:28:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISAPY057388; Wed, 2 Jul 2025 18:28:10 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:10 GMT Message-Id: <202507021828.562ISAPY057388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 89104be0ddae - releng/14.2 - ena: Fix misconfiguration when requesting regular LLQ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.2 X-Git-Reftype: branch X-Git-Commit: 89104be0ddae36c250d2a4d923f7e042e69748ff Auto-Submitted: auto-generated The branch releng/14.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=89104be0ddae36c250d2a4d923f7e042e69748ff commit 89104be0ddae36c250d2a4d923f7e042e69748ff Author: David Arinzon AuthorDate: 2025-04-22 10:54:18 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:54:18 +0000 ena: Fix misconfiguration when requesting regular LLQ Patch 0a33c047a443 introduced new values to hw.ena.force_large_llq_header. The default value of 2 means no preference, while 0 and 1 act as the previous false and true respectively, which allowed forcefully setting regular or large LLQ. There are 2 ways to force the driver to select regular LLQ: 1. Setting hw.ena.force_large_llq_header = 0 via sysctl. 2. Turning on ena express, which makes the recommendation by the FW to be regular LLQ. When the device supports large LLQ but the driver is forced to regular LLQ, llq_config->llq_ring_entry_size_value is never initialized and since it is a variable allocated on the stack, it stays garbage. Since this variable is involved in calculating max_entries_in_tx_burst, it could cause the maximum burst size to be zero. This causes the driver to ignore the real maximum burst size of the device, leading to driver resets in devices that have a maximum burst size (Nitro v4 and on. see [1] for more information). In case the garbage value is 0, the calculation of max_entries_in_tx_burst divides by 0 and causes kernel panic. The patch modifies the logic to take into account all use-cases and ensure that the relevant fields are properly initialized. [1]: https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html Fixes: 0a33c047a443 ("ena: Support LLQ entry size recommendation from device") Sponsored by: Amazon, Inc. Differential Revision: https://reviews.freebsd.org/D50040 Approved by: so Security: FreeBSD-EN-25:11.ena (cherry picked from commit 56c45700f2ae15755358f2da8266247613c564df) (cherry picked from commit 3f4a674a8ee430dec7c72c45ffe759eabefa7a1f) --- sys/dev/ena/ena.c | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index e9d4530e9085..67f669343808 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -2759,22 +2759,41 @@ static inline void ena_set_llq_configurations(struct ena_llq_configurations *llq_config, struct ena_admin_feature_llq_desc *llq, struct ena_adapter *adapter) { + bool use_large_llq; + llq_config->llq_header_location = ENA_ADMIN_INLINE_HEADER; llq_config->llq_stride_ctrl = ENA_ADMIN_MULTIPLE_DESCS_PER_ENTRY; llq_config->llq_num_decs_before_header = ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_2; - if ((llq->entry_size_ctrl_supported & ENA_ADMIN_LIST_ENTRY_SIZE_256B) != 0) { - if ((ena_force_large_llq_header == ENA_LLQ_HEADER_SIZE_POLICY_LARGE) || - (ena_force_large_llq_header == ENA_LLQ_HEADER_SIZE_POLICY_DEFAULT && - llq->entry_size_recommended == ENA_ADMIN_LIST_ENTRY_SIZE_256B)) { - llq_config->llq_ring_entry_size = - ENA_ADMIN_LIST_ENTRY_SIZE_256B; - llq_config->llq_ring_entry_size_value = 256; - adapter->llq_policy = ENA_ADMIN_LIST_ENTRY_SIZE_256B; - } + + switch (ena_force_large_llq_header) + { + case ENA_LLQ_HEADER_SIZE_POLICY_REGULAR: + use_large_llq = false; + break; + case ENA_LLQ_HEADER_SIZE_POLICY_LARGE: + use_large_llq = true; + break; + case ENA_LLQ_HEADER_SIZE_POLICY_DEFAULT: + use_large_llq = + (llq->entry_size_recommended == ENA_ADMIN_LIST_ENTRY_SIZE_256B); + break; + default: + use_large_llq = false; + ena_log(adapter->pdev, WARN, + "force_large_llq_header should have values [0-2]\n"); + break; + } + + if (!(llq->entry_size_ctrl_supported & ENA_ADMIN_LIST_ENTRY_SIZE_256B)) + use_large_llq = false; + + if (use_large_llq) { + llq_config->llq_ring_entry_size = ENA_ADMIN_LIST_ENTRY_SIZE_256B; + llq_config->llq_ring_entry_size_value = 256; + adapter->llq_policy = ENA_ADMIN_LIST_ENTRY_SIZE_256B; } else { - llq_config->llq_ring_entry_size = - ENA_ADMIN_LIST_ENTRY_SIZE_128B; + llq_config->llq_ring_entry_size = ENA_ADMIN_LIST_ENTRY_SIZE_128B; llq_config->llq_ring_entry_size_value = 128; adapter->llq_policy = ENA_ADMIN_LIST_ENTRY_SIZE_128B; } From nobody Wed Jul 2 18:28:12 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT0r5Jtdz60mJK; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT0r2KCQz3Hbp; Wed, 02 Jul 2025 18:28:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5f6mRTVD/fqwtlJaLgjZWYDISCVvx5m2ckuo+7HWJQA=; b=QDNjqz4wNmFULRCZYWOZHCN4GxTuaQaB51S28yiaN+0P+5LtoAtPFv3lxF3jfOogEJ24YL +3Ao9AJCXX5gfYddP2ctqhMfZdNDTN1KwWAkGHVwyKZu/JRWa/BmaWl270y9zhApphJ+mU ZBKr3TTWCzVQEkYuijG/gcjsDHde1frpnplP49hmwzlFzzeKEnDPpOVxqnfczfxMiIOa9C yKi+J3o1fOP1MiPvedVpI+VGovdwwt8GyPyO5/cYxMZYiUObyXupF5J13QiCNqJ2Oa37Te QixpKWjzivLWXMO3JkGBUvPdtCPoz+aR4pcz3IxAKLVJ+tH2A/s9B4u2K8F9MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5f6mRTVD/fqwtlJaLgjZWYDISCVvx5m2ckuo+7HWJQA=; b=R4wqO8WD5EgY03xFMvh9GqkXCxbcCoWNcK1OxD23WVA3S3MM4U5VTqDSYo4p+8Txgpk2ON T+M53MycM6jJPo3+T1Cr24WbmVBik8h9U1xbDdfFbIxNByC5k2LHXwaxGHW4j83+KRA37L FwCrzS2iCz3l9lXUajduaf4lr/tIW0kH4CA5UeL+8iumJb4WYBO0WqBEsxceplw/MzbxmS NxgOlkgPCCYRZgQOARNCBxOASiveR/Wz8VjETHdf3hWVjH0GW9iMY5ROO7ktkYvuw1ucsM gvlib43+BvP0Gr/bupXoAdnhKZJu4M4UAfztpHhEUTsyGXNDqMbnCydQNBhO6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480892; a=rsa-sha256; cv=none; b=xYGxjQ54ODW4xKcbTkVsBM8WruRKkeVlgFezAQQVaCkFZt6lTXXnNmyC742XvqwboJ4+ZO zBSeQboaWvwk+pZIcfnkWGqCkt1yOHB8d/ohdMOfp2AHYCXVsB1pLEt4GxZ/6i9KRxHghc MhVTQ0jTDa2SvaQpnWOa562/u1/qLVuPSocOgt6iym9NRht2xvwtDHkt5uRVu1VQljKyin x41GGyxYiZhlbHyub+rNYpkXp6VZFPZFj+bVzm6tandBV14hFz4NvIwKHmloc6nProso3n T08fwQ2B1eXJdQq1B5RdHJqjtqYk/nj4RHS0Ly1o+j1soYxty9U1faydiAlT+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT0r1ZkXzWTd; Wed, 02 Jul 2025 18:28:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISCgB057423; Wed, 2 Jul 2025 18:28:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISCRX057420; Wed, 2 Jul 2025 18:28:12 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:12 GMT Message-Id: <202507021828.562ISCRX057420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: ca1f7650a80d - releng/14.2 - ena: Bump driver version to v2.8.1 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.2 X-Git-Reftype: branch X-Git-Commit: ca1f7650a80da2e84f7ba0393d3a1a20872b7e6a Auto-Submitted: auto-generated The branch releng/14.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=ca1f7650a80da2e84f7ba0393d3a1a20872b7e6a commit ca1f7650a80da2e84f7ba0393d3a1a20872b7e6a Author: Arthur Kiyanovski AuthorDate: 2025-04-25 17:19:32 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:54:35 +0000 ena: Bump driver version to v2.8.1 Approved by: so Security: FreeBSD-EN-25:11.ena (cherry picked from commit 59b30c1a864ee8a22c2e9912301cb88674f714c9) (cherry picked from commit a1685d25601ee7abfaf6d6a993932ae3318e070e) --- sys/dev/ena/ena.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index 06bdfad97ed4..3b01605b4ba7 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -39,7 +39,7 @@ #define ENA_DRV_MODULE_VER_MAJOR 2 #define ENA_DRV_MODULE_VER_MINOR 8 -#define ENA_DRV_MODULE_VER_SUBMINOR 0 +#define ENA_DRV_MODULE_VER_SUBMINOR 1 #define ENA_DRV_MODULE_NAME "ena" From nobody Wed Jul 2 18:28:13 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT0s4vh3z60mHS; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT0s3HRXz3Hhx; Wed, 02 Jul 2025 18:28:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KHBaHR64nuXKbZzp7G/IrmYqMjuftqttobecWJmxXOU=; b=N7XN8yG8wOv5stVR+bViUdaf7ZvrbPE88QL8VQAAso9nfMhjaJKRihVAYbY91bOFr3GFlg BshdFlmG00PGihsv7qF7NPTK7ZJbnAfNYIYzNzRJLPRGDF4bghJp1SB37/0rFmg9KWciFo 0Ce/gI91EfnISCq7YSSun9GppgTp522+oyXMHKkkBX6LT4WOb6/9erfrQHHYZir49alJN/ qZ00SATetpe7IXHJU+O3TljVtXsrFcLGqboPIt5sh3PHETwBkulIKy5tZerTUSqHRByl5u k1X1HZNM3B9aQT59oxEo9S679rcI5Lu73YUw2xt6OXAVmKZgCB+odrZ1ZtfaBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KHBaHR64nuXKbZzp7G/IrmYqMjuftqttobecWJmxXOU=; b=phs2MmaiDaA0OjcPEU8AXENqHE4rvAbEfkUvSVI6elPuXAbtu5ifeEBg3K0WAdg/cK44g5 FuAK3H7pIfWooW14tI2GBEGeKnUEub+e0iHCnCC8aHcz6INHqZR70E96w/R0QvcuqKsi9g c5JdprFCcx1vvpvy6nqzPBOhZMFpAXW5Scm05Zs3tfsJBj/tq9GTDt7Em6sDfjf7LM3CrH JhDkAaJnVwEHoUQku6MZCmjm9gyIl2UTSZ46VohbV70yJPAvkBLO4tJKfMCjxXw5y/bGks 4+QZoD6Mvbz0BM0FLMPa9Y1DxoZYHtkzrWkQetmJ66eDo1/AlgN2O89xCTMYpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480893; a=rsa-sha256; cv=none; b=uYVX4LZvwf9OaxbT7YIQk168eShtt/7CCetx12YrMrQ6laUW5FUdX6zOdRPaptaNZGudxr IJnAiYXBDKo3MgPQZnDpD9SlYx7CoX+sm0RBAazoqp4TCRy1ZYOVujHFH4kaalts8pwxI6 uK0TkrNkiW7usq0whZfpoodY3bWYXTqotBftdx5154UVJRZtIdAflj0IwAUgKOfgZsMaKD qI4p6Pw3/fvaKa+LokuACv9zD3jDUe6pXhNTKflcj20zmkE4h3qSTbnLtihYeiCjPoKwV2 dUjg5r7boK9tE41P5L2N+JKCbCCupdaHULsnhYoCDv3xtDa6WrALzSojuyLS3w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT0s2HKBzWTf; Wed, 02 Jul 2025 18:28:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISDgc057455; Wed, 2 Jul 2025 18:28:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISDUs057452; Wed, 2 Jul 2025 18:28:13 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:13 GMT Message-Id: <202507021828.562ISDUs057452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 49b07b94662b - releng/14.2 - Fix Use-after-free in multi-threaded xz decoder. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.2 X-Git-Reftype: branch X-Git-Commit: 49b07b94662b92edb6d8de1e997fa805ac8d2b7c Auto-Submitted: auto-generated The branch releng/14.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=49b07b94662b92edb6d8de1e997fa805ac8d2b7c commit 49b07b94662b92edb6d8de1e997fa805ac8d2b7c Author: Gordon Tetlow AuthorDate: 2025-07-02 05:56:35 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:56:35 +0000 Fix Use-after-free in multi-threaded xz decoder. Approved by: so Security: FreeBSD-SA-25:06.xz Security: CVE-2025-31115 --- contrib/xz/src/liblzma/common/stream_decoder_mt.c | 104 +++++++++++----------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/contrib/xz/src/liblzma/common/stream_decoder_mt.c b/contrib/xz/src/liblzma/common/stream_decoder_mt.c index 76212b46da32..6bbbe53b5e32 100644 --- a/contrib/xz/src/liblzma/common/stream_decoder_mt.c +++ b/contrib/xz/src/liblzma/common/stream_decoder_mt.c @@ -24,15 +24,10 @@ typedef enum { THR_IDLE, /// Decoding is in progress. - /// Main thread may change this to THR_STOP or THR_EXIT. + /// Main thread may change this to THR_IDLE or THR_EXIT. /// The worker thread may change this to THR_IDLE. THR_RUN, - /// The main thread wants the thread to stop whatever it was doing - /// but not exit. Main thread may change this to THR_EXIT. - /// The worker thread may change this to THR_IDLE. - THR_STOP, - /// The main thread wants the thread to exit. THR_EXIT, @@ -347,27 +342,6 @@ worker_enable_partial_update(void *thr_ptr) } -/// Things do to at THR_STOP or when finishing a Block. -/// This is called with thr->mutex locked. -static void -worker_stop(struct worker_thread *thr) -{ - // Update memory usage counters. - thr->coder->mem_in_use -= thr->in_size; - thr->in_size = 0; // thr->in was freed above. - - thr->coder->mem_in_use -= thr->mem_filters; - thr->coder->mem_cached += thr->mem_filters; - - // Put this thread to the stack of free threads. - thr->next = thr->coder->threads_free; - thr->coder->threads_free = thr; - - mythread_cond_signal(&thr->coder->cond); - return; -} - - static MYTHREAD_RET_TYPE worker_decoder(void *thr_ptr) { @@ -398,17 +372,6 @@ next_loop_unlocked: return MYTHREAD_RET_VALUE; } - if (thr->state == THR_STOP) { - thr->state = THR_IDLE; - mythread_mutex_unlock(&thr->mutex); - - mythread_sync(thr->coder->mutex) { - worker_stop(thr); - } - - goto next_loop_lock; - } - assert(thr->state == THR_RUN); // Update progress info for get_progress(). @@ -473,8 +436,7 @@ next_loop_unlocked: } // Either we finished successfully (LZMA_STREAM_END) or an error - // occurred. Both cases are handled almost identically. The error - // case requires updating thr->coder->thread_error. + // occurred. // // The sizes are in the Block Header and the Block decoder // checks that they match, thus we know these: @@ -482,16 +444,30 @@ next_loop_unlocked: assert(ret != LZMA_STREAM_END || thr->out_pos == thr->block_options.uncompressed_size); - // Free the input buffer. Don't update in_size as we need - // it later to update thr->coder->mem_in_use. - lzma_free(thr->in, thr->allocator); - thr->in = NULL; - mythread_sync(thr->mutex) { + // Block decoder ensures this, but do a sanity check anyway + // because thr->in_filled < thr->in_size means that the main + // thread is still writing to thr->in. + if (ret == LZMA_STREAM_END && thr->in_filled != thr->in_size) { + assert(0); + ret = LZMA_PROG_ERROR; + } + if (thr->state != THR_EXIT) thr->state = THR_IDLE; } + // Free the input buffer. Don't update in_size as we need + // it later to update thr->coder->mem_in_use. + // + // This step is skipped if an error occurred because the main thread + // might still be writing to thr->in. The memory will be freed after + // threads_end() sets thr->state = THR_EXIT. + if (ret == LZMA_STREAM_END) { + lzma_free(thr->in, thr->allocator); + thr->in = NULL; + } + mythread_sync(thr->coder->mutex) { // Move our progress info to the main thread. thr->coder->progress_in += thr->in_pos; @@ -511,7 +487,20 @@ next_loop_unlocked: && thr->coder->thread_error == LZMA_OK) thr->coder->thread_error = ret; - worker_stop(thr); + // Return the worker thread to the stack of available + // threads only if no errors occurred. + if (ret == LZMA_STREAM_END) { + // Update memory usage counters. + thr->coder->mem_in_use -= thr->in_size; + thr->coder->mem_in_use -= thr->mem_filters; + thr->coder->mem_cached += thr->mem_filters; + + // Put this thread to the stack of free threads. + thr->next = thr->coder->threads_free; + thr->coder->threads_free = thr; + } + + mythread_cond_signal(&thr->coder->cond); } goto next_loop_lock; @@ -545,17 +534,22 @@ threads_end(struct lzma_stream_coder *coder, const lzma_allocator *allocator) } +/// Tell worker threads to stop without doing any cleaning up. +/// The clean up will be done when threads_exit() is called; +/// it's not possible to reuse the threads after threads_stop(). +/// +/// This is called before returning an unrecoverable error code +/// to the application. It would be waste of processor time +/// to keep the threads running in such a situation. static void threads_stop(struct lzma_stream_coder *coder) { for (uint32_t i = 0; i < coder->threads_initialized; ++i) { + // The threads that are in the THR_RUN state will stop + // when they check the state the next time. There's no + // need to signal coder->threads[i].cond. mythread_sync(coder->threads[i].mutex) { - // The state must be changed conditionally because - // THR_IDLE -> THR_STOP is not a valid state change. - if (coder->threads[i].state != THR_IDLE) { - coder->threads[i].state = THR_STOP; - mythread_cond_signal(&coder->threads[i].cond); - } + coder->threads[i].state = THR_IDLE; } } @@ -1562,6 +1556,10 @@ stream_decode_mt(void *coder_ptr, const lzma_allocator *allocator, } // Return if the input didn't contain the whole Block. + // + // NOTE: When we updated coder->thr->in_filled a few lines + // above, the worker thread might by now have finished its + // work and returned itself back to the stack of free threads. if (coder->thr->in_filled < coder->thr->in_size) { assert(*in_pos == in_size); return LZMA_OK; @@ -1949,7 +1947,7 @@ stream_decoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator, // accounting from scratch, too. Changes in filter and block sizes may // affect number of threads. // - // FIXME? Reusing should be easy but unlike the single-threaded + // Reusing threads doesn't seem worth it. Unlike the single-threaded // decoder, with some types of input file combinations reusing // could leave quite a lot of memory allocated but unused (first // file could allocate a lot, the next files could use fewer From nobody Wed Jul 2 18:28:14 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT0v1fLbz60m87; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT0t5S8fz3Hl2; Wed, 02 Jul 2025 18:28:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D9Un2YN98ugRw0Nt5Tn74LRzFFY9EIQEVcGX/oIFUxk=; b=RideYJmGatRL4ZoIU9ugd9C+gqMUjFe63fGAEGIv+BrwGD4qKKFdwYpsQ8CG1ul/mkr3b8 D9Fq26WiCnLc5f9YZ7bxYSffFRFeaqCtJbB+OMT9RGNE3sAJI0by8vFpW2vLqgmR8UbWeC KBPyrfuoDrixnCUHy3vn58GrKBidLp0+diDFYuRHZslgOHuuy0sp2xbxUtS/JT13qNL1sJ X120bA7TmIjyAspkVqCxfrPoPoHoYxRjzFki3XtpTqPMib5Tl6yvopZTG/33ukDa8YOZPL TZQJcf1JQTtDQbTs84AqKFwR8WyxzFJ6LyFE9WTT5Q2mTjVTmhDeQ9IvabVjEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D9Un2YN98ugRw0Nt5Tn74LRzFFY9EIQEVcGX/oIFUxk=; b=nSQxM+PWBsOSZIzCswBr3NFDLtsudrl6CX4Pj/xXUZizvhdfRA0QT0Igf27HP6c3lL89Yx xapT9xmnHStt3dPe6sFNdvDAPlajWbVyBkVOOlSNKwGYOJO6SVjPWbTsYZs+caYRrbu2/u cuCqG8e89l7nlzw5s++V/LxVBCFD11ngyNqMhMichse67Ne6Zpu57cRCBZPJv+aEUs5Jf4 Ss0KvRMsmVX5094WwL5xZF+qlg0/oBK3aTybnQHL5POuwPuvWFpsaXCxZVkLnzbqjFsr/p DTw2KyZDvbBLSCaN8XFA4rf8WvLZ4nnVWQ6Gh96xFt7pDNQWlb9l558h92gyvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480894; a=rsa-sha256; cv=none; b=dXSS/ppYkT4yf62cfDjOrnwjQhkhrjGBaq/Ito0WFt6a+pG0fFRJmKEuLiseZuOcA2JKEN EpCOrXLkQOqknk6jZiosM46WFDHfThu27Ek86Pc/vxXQNVHfSFmeUiJvGW0wKEbtOlOLUO M3r8rsICLSOPGZy9KOrIw/Jc4nlhytrQ2WTkndakzfRDOy0siluucwUJvkta8zREAHoKr1 e0wDQNCGpE1d1/kt2R14YovCygf5vyDXaMMZZDMvM4V4ft1EO0uN2ijMv2UZiRAIWNL2Cw LeLGVciZDPOAYUVD81gQKTG6No0s+q/h4aaRtSEUfN6NvUygIY/l4suaAhTMCQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT0t3DvGzVpJ; Wed, 02 Jul 2025 18:28:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISEOF057494; Wed, 2 Jul 2025 18:28:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISEOD057491; Wed, 2 Jul 2025 18:28:14 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:14 GMT Message-Id: <202507021828.562ISEOD057491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: d9352700f935 - releng/14.2 - Add UPDATING entries and bump version. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.2 X-Git-Reftype: branch X-Git-Commit: d9352700f9357aa170c1e4dc144537998ec66025 Auto-Submitted: auto-generated The branch releng/14.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=d9352700f9357aa170c1e4dc144537998ec66025 commit d9352700f9357aa170c1e4dc144537998ec66025 Author: Gordon Tetlow AuthorDate: 2025-07-02 06:03:15 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 06:03:15 +0000 Add UPDATING entries and bump version. Approved by: so --- UPDATING | 14 ++++++++++++++ sys/conf/newvers.sh | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index ea92e6a45454..f48519c38c75 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,20 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20250702: + 14.2-RELEASE-p4 EN-25:09.libc + EN-25:10.zfs + EN-25:11.ena + SA-25:06.xz + + Fix dynamically-loaded C++ libraries crashing at exit [EN-25:09.libc] + + Fix corruption in ZFS replication streams from encrypted datasets [EN-25:10.zfs] + + Fix ena resets and kernel panic on Nitro v4 or newer instances [EN-25:11.ena] + + Fix use-after-free in multi-threaded xz decoder [SA-25:06.xz] + 20250410: 14.2-RELEASE-p3 EN-25:04.tzdata EN-25:05.expat diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 71869e91f186..5feaa7fab80b 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -53,7 +53,7 @@ TYPE="FreeBSD" REVISION="14.2" -BRANCH="RELEASE-p3" +BRANCH="RELEASE-p4" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Wed Jul 2 18:28:28 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT183hKcz60m5h; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT182SNQz3JB2; Wed, 02 Jul 2025 18:28:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5Q76oUPL2p+DJzTWDJegEx3wkhZHjzQKoG+8DS2h6Jw=; b=HxWF7S9Or+9A5QP/Y3cG+7Zr4OJtLZGWx1+yFAIQSpsFoinev6oDjs6zbNqkBDk2qqesiL ANLQU3MkBfjm/HhUJuDcEPpxT16me0wQ3e/MfNvJya+GWaPf6//AfEwOCP7XHJiXdwx23m UnBFcB4vKDht0CzqCgAQQOMy4V8G9hXGiM3JwnHSzLGcb3kbQfhUW5WUfhdnMJ6XMyEpX8 FBWKb4GF7N/B+q9dZ+jRBKsSEivnBzZOHJdWKyYMz+3lXBzVZz06WW9sV5LNK3BPSghwqw 79Cg7Lx7KXUIJkvKp9p5Bc5tXE+7WX2uD8zQi70fDs2gG7tjzHfyW+pbXiqBmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5Q76oUPL2p+DJzTWDJegEx3wkhZHjzQKoG+8DS2h6Jw=; b=AFcq6wgzHERuugbs+KchaUhi6eVI2E7CBiEcOLFeYZ/QFZPV5mcLSbvXc7clDLJGJX75dP linSdE0xCJBKuJkK3w51e81cSTG7wYgCGLogNM0eNIAyiv+sN3JMxuToJMZaGdsMnGLN24 NenObFV84oRbUj+m/uMxGEW8ehpmzkzlP3aHLWp8YJd5MzzHfWR6NJt9mcXnnawTqF1NnY GLNJ+vzPFLCED3Dt/GKNLLYhxhn+HDy+64be4HQpfZyWlet0Oud/+dLd8Qpfrk61mgHVoB clhhw0ERSGOzCqmIHGZyrgVohidiVs0xaZCs2SQveCSUXILPHawNGSwguAEKBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480908; a=rsa-sha256; cv=none; b=WMG23X60KWVFr8J/AM7tYsTMg58vTSyhzdNC/U4kpHENo/3LJ7fU2FXmlEUxmbd8dvYwRe xGtsd9UAz1tKYw/lCFvxyChWbHHmunQy1GFq0a2l67kT5FPfu7ACNK+W+dW80aaOljfIfw BnsMcmphWE47SrjgqVaId0vF2me0lEwHZds8kqRacL9nscypq1NAP8CRR0VwSBTRxmifQE Yj5q2B3tVLcSCxs+4w518NAmGLC1c+Faaszaou3Apfp6GMNmR979Z+1w9Oy/G6XZOqF5CG 2NDsQD39AL96wMB/FhqWoUXEAq17GHJpxuanRFrUqRk2UXeu/PwLQzOOO0N6xg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT181g9fzVpN; Wed, 02 Jul 2025 18:28:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISSWt057716; Wed, 2 Jul 2025 18:28:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISSgA057713; Wed, 2 Jul 2025 18:28:28 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:28 GMT Message-Id: <202507021828.562ISSgA057713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: f936833911d7 - releng/13.5 - libc: allow __cxa_atexit handlers to be added during __cxa_finalize List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.5 X-Git-Reftype: branch X-Git-Commit: f936833911d765c1dc9640913b73acfa1d751742 Auto-Submitted: auto-generated The branch releng/13.5 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=f936833911d765c1dc9640913b73acfa1d751742 commit f936833911d765c1dc9640913b73acfa1d751742 Author: Aurélien Croc de Suray AuthorDate: 2025-04-05 00:47:53 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:42:46 +0000 libc: allow __cxa_atexit handlers to be added during __cxa_finalize science/dlib-cpp reveals an interesting scenario that works fine on other platforms but not on FreeBSD; notably, it ends up creating a new global object from some destructor which is called during __cxa_finalize. This breaks when libdlib is dlopen()ed and then subsequently dlclose()ed, as we never end up invoking the created object's dtor until program exit when the shlib is already unmapped. Fix it by noting when we're in the middle of __cxa_finalize for a dso, and then restarting the search if __cxa_atexit() was called in the middle somewhere. We wait until we've processed the initial set before starting over and processing the newly added handlers as if it were a complete set of handlers added during runtime. The alternative is calling them as they're added to maintain a LIFO in terms of total ordering, but in theory a constructor could add another global object that also needs to be destroyed, and that object needs to be destroyed after the one that constructed it to avoid creating unexpected lifetime issues. This manifests in the pdlib PHP extension for dlib crashing, see [0]. [0] https://github.com/goodspb/pdlib/issues/39 PR: 285870 Reviewed by: kevans (also supplied commit message) Approved by: so Security: FreeBSD-EN-25:09.libc (cherry picked from commit 23427c8e1fedb9fc68ad0bd27a59c7ffd2b3008c) (cherry picked from commit 04f7496f89e28057079f3f0b1a02d7d9d874487f) --- lib/libc/stdlib/atexit.c | 61 ++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c index 6b63d9e728c4..5b39552821ed 100644 --- a/lib/libc/stdlib/atexit.c +++ b/lib/libc/stdlib/atexit.c @@ -39,6 +39,7 @@ static char sccsid[] = "@(#)atexit.c 8.2 (Berkeley) 7/3/94"; #include "namespace.h" #include #include +#include #include #include #include @@ -60,6 +61,8 @@ _Block_copy(void*); #define ATEXIT_FN_CXA 2 static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER; +static void *current_finalize_dso = NULL; +static bool call_finalize_again = false; #define _MUTEX_LOCK(x) if (__isthreaded) _pthread_mutex_lock(x) #define _MUTEX_UNLOCK(x) if (__isthreaded) _pthread_mutex_unlock(x) @@ -119,6 +122,9 @@ atexit_register(struct atexit_fn *fptr) __atexit = p; } p->fns[p->ind++] = *fptr; + if (current_finalize_dso != NULL && + current_finalize_dso == fptr->fn_dso) + call_finalize_again = true; _MUTEX_UNLOCK(&atexit_mutex); return 0; } @@ -212,33 +218,38 @@ __cxa_finalize(void *dso) } _MUTEX_LOCK(&atexit_mutex); - for (p = __atexit; p; p = p->next) { - for (n = p->ind; --n >= 0;) { - if (p->fns[n].fn_type == ATEXIT_FN_EMPTY) - continue; /* already been called */ - fn = p->fns[n]; - if (dso != NULL && dso != fn.fn_dso) { - /* wrong DSO ? */ - if (!has_phdr || global_exit || - !__elf_phdr_match_addr(&phdr_info, - fn.fn_ptr.cxa_func)) - continue; + current_finalize_dso = dso; + do { + call_finalize_again = false; + for (p = __atexit; p; p = p->next) { + for (n = p->ind; --n >= 0;) { + if (p->fns[n].fn_type == ATEXIT_FN_EMPTY) + continue; /* already been called */ + fn = p->fns[n]; + if (dso != NULL && dso != fn.fn_dso) { + /* wrong DSO ? */ + if (!has_phdr || global_exit || + !__elf_phdr_match_addr(&phdr_info, + fn.fn_ptr.cxa_func)) + continue; + } + /* + Mark entry to indicate that this particular + handler has already been called. + */ + p->fns[n].fn_type = ATEXIT_FN_EMPTY; + _MUTEX_UNLOCK(&atexit_mutex); + + /* Call the function of correct type. */ + if (fn.fn_type == ATEXIT_FN_CXA) + fn.fn_ptr.cxa_func(fn.fn_arg); + else if (fn.fn_type == ATEXIT_FN_STD) + fn.fn_ptr.std_func(); + _MUTEX_LOCK(&atexit_mutex); } - /* - Mark entry to indicate that this particular handler - has already been called. - */ - p->fns[n].fn_type = ATEXIT_FN_EMPTY; - _MUTEX_UNLOCK(&atexit_mutex); - - /* Call the function of correct type. */ - if (fn.fn_type == ATEXIT_FN_CXA) - fn.fn_ptr.cxa_func(fn.fn_arg); - else if (fn.fn_type == ATEXIT_FN_STD) - fn.fn_ptr.std_func(); - _MUTEX_LOCK(&atexit_mutex); } - } + } while (call_finalize_again); + current_finalize_dso = NULL; _MUTEX_UNLOCK(&atexit_mutex); if (dso == NULL) _MUTEX_DESTROY(&atexit_mutex); From nobody Wed Jul 2 18:28:29 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT1954Mtz60mBK; Wed, 02 Jul 2025 18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT1931mqz3HyJ; Wed, 02 Jul 2025 18: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=1751480909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g7PwIp2HkUQmiTEPWKvfwx4G9C4tenA9AOD7w3XeoPU=; b=SaXUJ6cfS4fCqRwBzRSP1G3nvwuyeaH7VegfBA8e+gauK8R50afezxyUJhVgW9WpWH7BQz 8vEGCxUm9oI2q52U/3Wtrz8RGKz+h86MhBiGN+tdymZRBY44fIHjJqIRM794np+2SuFcbs s15MCWzT6yu16uOtEX0eSQr1k3UIEjn0Ollwvnwfka1SblPlUG4jAKxfI4/CxGwhRTnBzY V70Z127r+B5qaWEMF/fGtjmn8MloL2Hj9btHvV3sDCVBh+fcTLlY76QWLMHmx/dFWuyRTv msIsyTYITqWLNssrwDW9+RdwaUXvgUB7yQ7D7R44qo1gVqkul6TTuQRsHk4iTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g7PwIp2HkUQmiTEPWKvfwx4G9C4tenA9AOD7w3XeoPU=; b=cQFmsSG9D9zwJxLiLaoZ0BN4V7uBz3sKP8w/UblXvlArmsDceeK3SDA/Oz2MiBNIBhw7Ls QfP9GrsV5bRRIp7phU0ON5FG5G2mY88BnyIrGkez192HbMze5IpZDHGEOshL1y38c0zphm Gv62JiMsf6O/u5zuYiUJtUNe50AGkzdrS5fIrLrENcI5bBLQip3fND7DAYcqWMIqLQKIap 7pu1+3rs9FWC1FcuOwGKoBVQYMUcYW5NOD4NQxsGTvqdg3fegKLNdmpo1gvLIHc4VFGfOh BYt5KhBPOZdU1P1EW/lxOz87Qog9MQtsTkpZVXWvrlWDA+4SPnzurnUh6YfEsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480909; a=rsa-sha256; cv=none; b=epYK49VHgZpBawxsgNHGR8FrIG284sTc7gDfOsmFRc1GFGECmhwZUw9OlV4tW+OmsDs7h8 2Ddmh8izw0LYZP+5WcQ1LiQmXuZWwALgEtHR8JRwlfhp6mCPZjYwmYyCK8FbaCFSzfdIPX zZfI+Ng/ARh+J8qzwYgLNef49aMF2oXRmEUYoN9sDP+BrATa+a0jqTGWIgrWBAy/fx64CH JZe3zb42uQkpdh8TE0UOVBRcVNEYMBk+XNQcEQwjSksfE/fGLUMVqcio0j58WTP0HBFrk7 vLAi0t7w5c+HYawnRrG+a0PcMfYeL1wq2xlGq+chNmAwR8QXFpF33Ol3V1ZhIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT192crHzW9X; Wed, 02 Jul 2025 18:28:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISTCB057749; Wed, 2 Jul 2025 18:28:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISTLP057746; Wed, 2 Jul 2025 18:28:29 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:29 GMT Message-Id: <202507021828.562ISTLP057746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 4d9c4ecf6a48 - releng/13.5 - Fix corruption in ZFS replication streams from encrypted datasets. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.5 X-Git-Reftype: branch X-Git-Commit: 4d9c4ecf6a48a17f9b79a93ec80e09858f80a524 Auto-Submitted: auto-generated The branch releng/13.5 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=4d9c4ecf6a48a17f9b79a93ec80e09858f80a524 commit 4d9c4ecf6a48a17f9b79a93ec80e09858f80a524 Author: Gordon Tetlow AuthorDate: 2025-07-02 05:47:29 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:47:29 +0000 Fix corruption in ZFS replication streams from encrypted datasets. From the upstream pull request merges: #17340 b144b160b Fix 2 bugs in non-raw send with encryption Obtained from: OpenZFS Approved by: so Security: FreeBSD-EN-25:10.zfs --- sys/contrib/openzfs/module/zfs/dmu_send.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/dmu_send.c b/sys/contrib/openzfs/module/zfs/dmu_send.c index 0dd1ec210a1d..e4891e2fe4aa 100644 --- a/sys/contrib/openzfs/module/zfs/dmu_send.c +++ b/sys/contrib/openzfs/module/zfs/dmu_send.c @@ -2676,8 +2676,8 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, } if (fromsnap != 0) { - err = dsl_dataset_hold_obj_flags(dspp.dp, fromsnap, dsflags, - FTAG, &fromds); + err = dsl_dataset_hold_obj(dspp.dp, fromsnap, FTAG, &fromds); + if (err != 0) { dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG); dsl_pool_rele(dspp.dp, FTAG); @@ -2729,7 +2729,7 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap, kmem_free(dspp.fromredactsnaps, dspp.numfromredactsnaps * sizeof (uint64_t)); - dsl_dataset_rele(dspp.to_ds, FTAG); + dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG); return (err); } From nobody Wed Jul 2 18:28:30 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT1C0q8Sz60m06; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT1B4JkVz3JDR; Wed, 02 Jul 2025 18:28:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRvLuzmGXojFOBkT2oWLvSfCAWAy8zML2iyCELUyQn8=; b=CD2fya7ANFLoLUh664FMWhReksNRTS08uzSTx+Ew2TgGvtmfuLMUrdyK8IKL1zkTcCDWoz FGz4U2RzZQX5hf38dDxPPqyILO7wgQN1BIJA4meRY5jShACN1mrxgbz4aVzKXcA65ghU3e eJMSn+y388BqNLbywxTYD7Zn13gQyqgNszpH4NlC7Sh9bSrpbbysN64pCUZP5nDlmRzPzg yH43Opu8zrRWOwCtI9Xvyvp43plsKHkFTnXpq37YpkGWGajd1IfVwhlc7mFNZPdL45bnOp FCazF3F1XrX3P0MgFwgupqbFgAUsFAQADOIDUZhFV7YNzFYbmnsUmSIytamGcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRvLuzmGXojFOBkT2oWLvSfCAWAy8zML2iyCELUyQn8=; b=EXEFsOqj5h6TV3S7ElXPvrRmevF64+N/MtHzDGpaA3UhtfKhsHoy99+2xSgTZwjGOKgd3A qNXJC25sv9Z/87c/cn02GjK8cID2IGXKtcwtx2VLfngljOWulX2bkJkeOxCwT3QvjP0eaX N76ZmR0faFhvtrRxkEfC4yp+rHdYzyfgLXTtz/t3p43CgOvt4KzySlsto674yi+/oFyzsT ubRQiuvUyMV7xsaPB2iDyzWfsroESMRLWFohYCKaYPcYn+qYzdVnYNIsECojK0gTGbd6u0 5w4oPxH1X2Cj2oQ2q4LTAPUl5Cx+Cq1y1ZKqzfE4485Cfl+y1FjzQYH4ZVMBBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480910; a=rsa-sha256; cv=none; b=G6nc7+OqIysH8h7ZSTXGNZh4OWPdWqX97VvqO2X6HHf8BAfZRgb5Hir6YIj0HA3XT7ftOE Sk6CxTC/97YciYw5lrzfAeTFymo9vB2t0PnPnS7kSqlCRlU/aK8QJrHptKuhlRGzLtZwHR u0jlsdGaMn7Pm5nZp3Nrg18d0VM5zvjRantlYwdl4DiTnz7awAA54BstOiOGLy8x30KPKP s4Ky3/RN57rGmUXD1GmU3IsmAGSTMWhwUJ7egAeNF0tisC4qOoWHox0qjCdGrtQlrjXgCO LPNNpsgeCx7UQDTc5vNlllyriDhbiQg6xLctlLIDRkCitl+EmEiZyDo6kYlTqA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT1B3JGvzWGg; Wed, 02 Jul 2025 18:28:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISUaR057782; Wed, 2 Jul 2025 18:28:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISUVk057779; Wed, 2 Jul 2025 18:28:30 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:30 GMT Message-Id: <202507021828.562ISUVk057779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 35c2729211d9 - releng/13.5 - ena: Fix misconfiguration when requesting regular LLQ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.5 X-Git-Reftype: branch X-Git-Commit: 35c2729211d9d4062020fd5eabecc7afd67fb0b9 Auto-Submitted: auto-generated The branch releng/13.5 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=35c2729211d9d4062020fd5eabecc7afd67fb0b9 commit 35c2729211d9d4062020fd5eabecc7afd67fb0b9 Author: David Arinzon AuthorDate: 2025-04-22 10:54:18 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:52:31 +0000 ena: Fix misconfiguration when requesting regular LLQ Patch 0a33c047a443 introduced new values to hw.ena.force_large_llq_header. The default value of 2 means no preference, while 0 and 1 act as the previous false and true respectively, which allowed forcefully setting regular or large LLQ. There are 2 ways to force the driver to select regular LLQ: 1. Setting hw.ena.force_large_llq_header = 0 via sysctl. 2. Turning on ena express, which makes the recommendation by the FW to be regular LLQ. When the device supports large LLQ but the driver is forced to regular LLQ, llq_config->llq_ring_entry_size_value is never initialized and since it is a variable allocated on the stack, it stays garbage. Since this variable is involved in calculating max_entries_in_tx_burst, it could cause the maximum burst size to be zero. This causes the driver to ignore the real maximum burst size of the device, leading to driver resets in devices that have a maximum burst size (Nitro v4 and on. see [1] for more information). In case the garbage value is 0, the calculation of max_entries_in_tx_burst divides by 0 and causes kernel panic. The patch modifies the logic to take into account all use-cases and ensure that the relevant fields are properly initialized. [1]: https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html Fixes: 0a33c047a443 ("ena: Support LLQ entry size recommendation from device") Sponsored by: Amazon, Inc. Differential Revision: https://reviews.freebsd.org/D50040 Approved by: so Security: FreeBSD-EN-25:11.ena (cherry picked from commit 56c45700f2ae15755358f2da8266247613c564df) (cherry picked from commit 162b5bbb4048d0ba99d759616c127ba04c9289c3) --- sys/dev/ena/ena.c | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index a0d3cf28861e..f9342ad91ae2 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -2760,22 +2760,41 @@ static inline void ena_set_llq_configurations(struct ena_llq_configurations *llq_config, struct ena_admin_feature_llq_desc *llq, struct ena_adapter *adapter) { + bool use_large_llq; + llq_config->llq_header_location = ENA_ADMIN_INLINE_HEADER; llq_config->llq_stride_ctrl = ENA_ADMIN_MULTIPLE_DESCS_PER_ENTRY; llq_config->llq_num_decs_before_header = ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_2; - if ((llq->entry_size_ctrl_supported & ENA_ADMIN_LIST_ENTRY_SIZE_256B) != 0) { - if ((ena_force_large_llq_header == ENA_LLQ_HEADER_SIZE_POLICY_LARGE) || - (ena_force_large_llq_header == ENA_LLQ_HEADER_SIZE_POLICY_DEFAULT && - llq->entry_size_recommended == ENA_ADMIN_LIST_ENTRY_SIZE_256B)) { - llq_config->llq_ring_entry_size = - ENA_ADMIN_LIST_ENTRY_SIZE_256B; - llq_config->llq_ring_entry_size_value = 256; - adapter->llq_policy = ENA_ADMIN_LIST_ENTRY_SIZE_256B; - } + + switch (ena_force_large_llq_header) + { + case ENA_LLQ_HEADER_SIZE_POLICY_REGULAR: + use_large_llq = false; + break; + case ENA_LLQ_HEADER_SIZE_POLICY_LARGE: + use_large_llq = true; + break; + case ENA_LLQ_HEADER_SIZE_POLICY_DEFAULT: + use_large_llq = + (llq->entry_size_recommended == ENA_ADMIN_LIST_ENTRY_SIZE_256B); + break; + default: + use_large_llq = false; + ena_log(adapter->pdev, WARN, + "force_large_llq_header should have values [0-2]\n"); + break; + } + + if (!(llq->entry_size_ctrl_supported & ENA_ADMIN_LIST_ENTRY_SIZE_256B)) + use_large_llq = false; + + if (use_large_llq) { + llq_config->llq_ring_entry_size = ENA_ADMIN_LIST_ENTRY_SIZE_256B; + llq_config->llq_ring_entry_size_value = 256; + adapter->llq_policy = ENA_ADMIN_LIST_ENTRY_SIZE_256B; } else { - llq_config->llq_ring_entry_size = - ENA_ADMIN_LIST_ENTRY_SIZE_128B; + llq_config->llq_ring_entry_size = ENA_ADMIN_LIST_ENTRY_SIZE_128B; llq_config->llq_ring_entry_size_value = 128; adapter->llq_policy = ENA_ADMIN_LIST_ENTRY_SIZE_128B; } From nobody Wed Jul 2 18:28:31 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT1D1GdWz60mDY; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT1C4HNKz3J1Z; Wed, 02 Jul 2025 18:28:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r6EAThzx1w990T+aA9RrlKxtPpi9IRkw6fKdYdZO/Ao=; b=jmxRm7DPwLyFZBqUG4VLX3snaPAWc51h63T6vGYHfG2mME9JegaUrNDiIJDpJ/1p1RxOGU au62U5qQz5KK3zhUOJIcTKFq5oSjvmgcf3H2AjNxEbvWSRuDmjc35dRl5zU2ht0RQdqc0x m7dGuJAnc1cTs0iZlWLBo0j74Eqq+TyolIme2xu7TqJ1rxCHMVauKGd2xTvvOnnpebjts3 dLhuZSUl5KofsZ3jwlyrvTWu2VpPAbx1P8k+dUU2CXw6+yZyMysWAGeTGM4jKv6a0p0jco 8/CUCq1C9wX3Do67fsCrN35AdOev/Hm7RwhdHHAhFdJ5Z+vMiN70WxZGcKoyQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r6EAThzx1w990T+aA9RrlKxtPpi9IRkw6fKdYdZO/Ao=; b=S2h0Er0CEB8MgI3j5BpZm9W6Y+2mwBlHhPKXby6yXtjdkXr6tUaq8VI8b+114PI2lVzWw+ 4mKwMGc2idyLGIcQ9dbP9rO+pczUNtFPR05fqWGYPHBkdv8ms9KFQN3FmLQEwxWqLU+ERO TB78zEV+UOyWJisletABp9L/q+iSBgGrh3+aPPARt2ITVKbASnCRXsvVy/oP3wgX3+rv5U AeLNxyt/Sq/YchFOhCgLOd5Cjq1hyH0cPiyVsh63WaVrBwAvSq/15BmVXnS6OCfGQOT4W3 BLYOOhbiLxgSPCcTIVj9FD8Fry7HzUzAAquWvKIs3ybE/uY36oGzykNnxH0Kww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480911; a=rsa-sha256; cv=none; b=WEyvFaLolB7GMkwwLbhHR6efy1tnc+P9nIqK9fP017G4r9ENLb94yU0bIcaallhw3OZCcw F8XMfZjZVKVpXtv4VckcfHsxjs7/j1C4FvK8sseVaqQnMgBl/rIsRA8AFbDmvrNcT7Ran3 Phvg7ClgqjtOXz36VoWDsYPDZj8Ig9zRrDMNvLTMsm3ebwVZ2n0NPpaSSgf8r/qxCEEjaG X2BGLUJiDyR/VRcvB0KF8WOyJTRIEeuTNL+iSyiAUxWooanJctarXC+cWEAlKTSubCGOnD SOVaLrHzWW1vYwymics92XJ64sunisIe56TQGS3zVccb5ARNlzZjaLWGml0blQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT1C3tldzWGh; Wed, 02 Jul 2025 18:28:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISVwZ057821; Wed, 2 Jul 2025 18:28:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISVAW057818; Wed, 2 Jul 2025 18:28:31 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:31 GMT Message-Id: <202507021828.562ISVAW057818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 575644144d5c - releng/13.5 - ena: Bump driver version to v2.8.1 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.5 X-Git-Reftype: branch X-Git-Commit: 575644144d5cf4eef18ca3afd12266d6d3c33fdb Auto-Submitted: auto-generated The branch releng/13.5 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=575644144d5cf4eef18ca3afd12266d6d3c33fdb commit 575644144d5cf4eef18ca3afd12266d6d3c33fdb Author: Arthur Kiyanovski AuthorDate: 2025-04-25 17:19:32 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:53:06 +0000 ena: Bump driver version to v2.8.1 Approved by: so Security: FreeBSD-EN-25:11.ena (cherry picked from commit 59b30c1a864ee8a22c2e9912301cb88674f714c9) (cherry picked from commit 7ea71ba86a57e10a313c7633a894f8c53afcd6c6) --- sys/dev/ena/ena.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index 06bdfad97ed4..3b01605b4ba7 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -39,7 +39,7 @@ #define ENA_DRV_MODULE_VER_MAJOR 2 #define ENA_DRV_MODULE_VER_MINOR 8 -#define ENA_DRV_MODULE_VER_SUBMINOR 0 +#define ENA_DRV_MODULE_VER_SUBMINOR 1 #define ENA_DRV_MODULE_NAME "ena" From nobody Wed Jul 2 18:28:33 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT1G38gkz60m0B; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT1G0hCGz3JHK; Wed, 02 Jul 2025 18:28:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KhTzFMLjAO5o2415vgKsAYCekIJ1j3yl1bSgRCajboA=; b=lK2q6tkuqrqhLDwUuBDAAUu2DbYyk1rTz3HrTnfadBQXJ14/U6eLa8ickX63TpPJSg0dHq W8tgbSNhhx/BwQDObo46cF+t3sCnGfcSf7tLKWCB1hVpoYTMIgv0dIRxzM1bs9cWsyOgfo WYmdVdzl0hGk9Axqg7eIu5MP3n8fUqcWb/YNEuoJ6VhvVYEw3l9vnrEG98IOtgardspeXf BpGVI7cfm9czquK1LxolnF01AHpfQdjv5GUncthizN+mzpEDCPIF2nzf+ashMo0FQT0JQv RBrdAo07GszVlWZW5EsGmtzm6NP1NsQJ/ZTvVwsk7jBim9eR+fetZ0ijJqnn3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KhTzFMLjAO5o2415vgKsAYCekIJ1j3yl1bSgRCajboA=; b=LbZ5YWLAmuKbgDdgyaYkNAFGjrXth045v1h8XbW8NWMfltc3uyZvu5aSUEYwXe8DK3NW2C pMNRLasfa93U5p5yslkawcr/N+eGQwjUfn7cQryVRYrvmonD7lAshjkq5THZtmkMfCdM7N zpfaymdq4jLzfDJSBEZgzEPqkDePOWRyYfIZ40mNOoN4lYNMxTS2dRex3pZTII6uJhHfTP d1m1hTKufCUPiWaWNglEKpaaHKqCPmmIiIUzyo5uiypuzUbBFR7sl1V5BZSRfdn0A5OAr4 /cBdhBL1y80lhvKTMEkx1Y/FnsMb8t18YFGiLaRPOdAJDthniRFKLEo6h24XAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480914; a=rsa-sha256; cv=none; b=oDKDTSt8XqNJ6jn7D9NHACG+Ri913ca0o0ndgqs8eT0NSf8oUqBQAGulx7fY3f+vPDvcd8 l6SxfAvuFp1KMb3b9iGk+MB4ukUkf7HZcy/FSbvqpo6O9uZ51SqXk5D/cNeNzAOEAguURl VnKLe0yqMHEKQQGxL3Py9CDDofeYP9t3QmL0Uje3tfRVUMxHYA+3ubs4oVsG4yV/4w2iaJ Ces/DZ7dSjCRVyjsxYQAtMh/Y1xm0jOlrv3W4Q7ogs4ZCIepSTClOhYcA649PHNPnrnP6/ woYNjE1hnnNtiqmsnmmrLCtYeuDyXnP3feoW0IHhj3UD2rwmkyuRWmRX3otb9A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT1F66WRzVpQ; Wed, 02 Jul 2025 18:28:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISX0N057890; Wed, 2 Jul 2025 18:28:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISXOA057887; Wed, 2 Jul 2025 18:28:33 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:33 GMT Message-Id: <202507021828.562ISXOA057887@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 341d92aef027 - releng/13.5 - Add UPDATING entries and bump version. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.5 X-Git-Reftype: branch X-Git-Commit: 341d92aef027d903b37412363a111840afa290fc Auto-Submitted: auto-generated The branch releng/13.5 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=341d92aef027d903b37412363a111840afa290fc commit 341d92aef027d903b37412363a111840afa290fc Author: Gordon Tetlow AuthorDate: 2025-07-02 06:01:59 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 06:01:59 +0000 Add UPDATING entries and bump version. Approved by: so --- UPDATING | 14 ++++++++++++++ sys/conf/newvers.sh | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index b66ebfd5d8e8..b3f3eb5ef41d 100644 --- a/UPDATING +++ b/UPDATING @@ -12,6 +12,20 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before updating system packages and/or ports. +20250702: + 13.5-RELEASE-p2 EN-25:09.libc + EN-25:10.zfs + EN-25:11.ena + SA-25:06.xz + + Fix dynamically-loaded C++ libraries crashing at exit [EN-25:09.libc] + + Fix corruption in ZFS replication streams from encrypted datasets [EN-25:10.zfs] + + Fix ena resets and kernel panic on Nitro v4 or newer instances [EN-25:11.ena] + + Fix use-after-free in multi-threaded xz decoder [SA-25:06.xz] + 20250410: 13.5-RELEASE-p1 EN-25:04.tzdata EN-25:05.expat diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 6c8ddd529845..5259f59649ff 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -53,7 +53,7 @@ TYPE="FreeBSD" REVISION="13.5" -BRANCH="RELEASE-p1" +BRANCH="RELEASE-p2" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From nobody Wed Jul 2 18:28:32 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXT1F4gncz60mLr; Wed, 02 Jul 2025 18:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXT1D6fq5z3J1t; Wed, 02 Jul 2025 18:28:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RnbHJqC+oQ3uQStbQ8abnU8qd6Q6simTUVi8jYnENW4=; b=G5BhOzqXbqtPa5z8b/VojHtCTJl5piAuB6nYPu+VU+8zzD8FOO/3jUM+gvZfFeJ+Y+lS4F 2atXC0GDmO/mi3PSnTwjBynIeuy3yog0MTW3XZEdZoR8qsSgGHBqKZlLhq6R63Pias9GUg 1tkFQAPeuKZePSTBlrLBn9snVOcq8rhUPJE10na0wNsN0cy33pCajkb5nuBH+ldjlnRWGN ir7OkVhwBHxW+CY33D1E6KMz+fn9Y+0TqyPf3+gs+VDf0r+WnyLaYqKUjeQU2J38yK9UCG vtTQRwJeEON0JJ9EGBo4hQc4yVD7AomNBZ6FfblyBjumJnlHiZKmsilnlSj+7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751480912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RnbHJqC+oQ3uQStbQ8abnU8qd6Q6simTUVi8jYnENW4=; b=nCXEfUTbJHXluGVrheKgjtZ20Ena8MnQ7gHaIPOfwLVDh0zhfvlMssBqv0smJD0ZXKD3MY UqWMWUwpRSTAq3hcH0Qy2AFi7ELQEsobXHYLHozIfMdvAvKqtG989BXGVXBpSlkHaw5MNs NJMVG8P0nRBHVCuLiF7ckzKxIInCO5tl6NK3ifiPTjL9hwOo+bnctZ5m/IdJ+L+P/FFL6O 7maRHHvEywRWJIxBe80yFVeI6BZPumkLyRCUYTURhVTblB5/Jm50/j88GPI6TjVtcX3bUD 1Ng6ZJgBy0l+upBpLOlnnrvs/ix6UEaAKc/HZkS3bSNuFNio3Le1xLD0YJYjRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751480912; a=rsa-sha256; cv=none; b=BlcT8/aaHnJWn7WUSF3Pr5TfSs3G1xUhLOb+xgqCdcQcfeJqU2rNz0rRY6nIPdtcG3o/ZG tMi1BzOu2IbD4GeHMmJ7DnJ9KJpi9TdjBgeynEJPZ7aQ37S4WqCmazfdVT4bvlOqVUzzo6 Xa10SPHlzmBKbaPrvew2MHN7bbh1BHSIIX/lcJDvlnhtrsGFrBBXGcSun+ENO0Y5iRVQ1R NjN0YBKnCHIMbNHamSryLZIGV3edp0WsoZfLvx5GtuRjqtxl2+o9t3RqS3CRKytnseQW4Q YXd/ofoRg9nBNHe2rXRn21ZEgSgpaxmdbwNybz2Sp1t6g5cJiAKh/Z+s6wOyUA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXT1D58bNzW9Y; Wed, 02 Jul 2025 18:28:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562ISW8A057856; Wed, 2 Jul 2025 18:28:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562ISWgW057853; Wed, 2 Jul 2025 18:28:32 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:28:32 GMT Message-Id: <202507021828.562ISWgW057853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 95e9c54b3961 - releng/13.5 - Fix Use-after-free in multi-threaded xz decoder. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.5 X-Git-Reftype: branch X-Git-Commit: 95e9c54b3961af6de4fccf1f801f7eb15fcc5263 Auto-Submitted: auto-generated The branch releng/13.5 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=95e9c54b3961af6de4fccf1f801f7eb15fcc5263 commit 95e9c54b3961af6de4fccf1f801f7eb15fcc5263 Author: Gordon Tetlow AuthorDate: 2025-07-02 05:55:41 +0000 Commit: Gordon Tetlow CommitDate: 2025-07-02 05:55:41 +0000 Fix Use-after-free in multi-threaded xz decoder. Approved by: so Security: FreeBSD-SA-25:06.xz Security: CVE-2025-31115 --- contrib/xz/src/liblzma/common/stream_decoder_mt.c | 104 +++++++++++----------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/contrib/xz/src/liblzma/common/stream_decoder_mt.c b/contrib/xz/src/liblzma/common/stream_decoder_mt.c index 244624a47900..0cdb47d3bc04 100644 --- a/contrib/xz/src/liblzma/common/stream_decoder_mt.c +++ b/contrib/xz/src/liblzma/common/stream_decoder_mt.c @@ -23,15 +23,10 @@ typedef enum { THR_IDLE, /// Decoding is in progress. - /// Main thread may change this to THR_STOP or THR_EXIT. + /// Main thread may change this to THR_IDLE or THR_EXIT. /// The worker thread may change this to THR_IDLE. THR_RUN, - /// The main thread wants the thread to stop whatever it was doing - /// but not exit. Main thread may change this to THR_EXIT. - /// The worker thread may change this to THR_IDLE. - THR_STOP, - /// The main thread wants the thread to exit. THR_EXIT, @@ -346,27 +341,6 @@ worker_enable_partial_update(void *thr_ptr) } -/// Things do to at THR_STOP or when finishing a Block. -/// This is called with thr->mutex locked. -static void -worker_stop(struct worker_thread *thr) -{ - // Update memory usage counters. - thr->coder->mem_in_use -= thr->in_size; - thr->in_size = 0; // thr->in was freed above. - - thr->coder->mem_in_use -= thr->mem_filters; - thr->coder->mem_cached += thr->mem_filters; - - // Put this thread to the stack of free threads. - thr->next = thr->coder->threads_free; - thr->coder->threads_free = thr; - - mythread_cond_signal(&thr->coder->cond); - return; -} - - static MYTHREAD_RET_TYPE worker_decoder(void *thr_ptr) { @@ -397,17 +371,6 @@ next_loop_unlocked: return MYTHREAD_RET_VALUE; } - if (thr->state == THR_STOP) { - thr->state = THR_IDLE; - mythread_mutex_unlock(&thr->mutex); - - mythread_sync(thr->coder->mutex) { - worker_stop(thr); - } - - goto next_loop_lock; - } - assert(thr->state == THR_RUN); // Update progress info for get_progress(). @@ -472,8 +435,7 @@ next_loop_unlocked: } // Either we finished successfully (LZMA_STREAM_END) or an error - // occurred. Both cases are handled almost identically. The error - // case requires updating thr->coder->thread_error. + // occurred. // // The sizes are in the Block Header and the Block decoder // checks that they match, thus we know these: @@ -481,16 +443,30 @@ next_loop_unlocked: assert(ret != LZMA_STREAM_END || thr->out_pos == thr->block_options.uncompressed_size); - // Free the input buffer. Don't update in_size as we need - // it later to update thr->coder->mem_in_use. - lzma_free(thr->in, thr->allocator); - thr->in = NULL; - mythread_sync(thr->mutex) { + // Block decoder ensures this, but do a sanity check anyway + // because thr->in_filled < thr->in_size means that the main + // thread is still writing to thr->in. + if (ret == LZMA_STREAM_END && thr->in_filled != thr->in_size) { + assert(0); + ret = LZMA_PROG_ERROR; + } + if (thr->state != THR_EXIT) thr->state = THR_IDLE; } + // Free the input buffer. Don't update in_size as we need + // it later to update thr->coder->mem_in_use. + // + // This step is skipped if an error occurred because the main thread + // might still be writing to thr->in. The memory will be freed after + // threads_end() sets thr->state = THR_EXIT. + if (ret == LZMA_STREAM_END) { + lzma_free(thr->in, thr->allocator); + thr->in = NULL; + } + mythread_sync(thr->coder->mutex) { // Move our progress info to the main thread. thr->coder->progress_in += thr->in_pos; @@ -510,7 +486,20 @@ next_loop_unlocked: && thr->coder->thread_error == LZMA_OK) thr->coder->thread_error = ret; - worker_stop(thr); + // Return the worker thread to the stack of available + // threads only if no errors occurred. + if (ret == LZMA_STREAM_END) { + // Update memory usage counters. + thr->coder->mem_in_use -= thr->in_size; + thr->coder->mem_in_use -= thr->mem_filters; + thr->coder->mem_cached += thr->mem_filters; + + // Put this thread to the stack of free threads. + thr->next = thr->coder->threads_free; + thr->coder->threads_free = thr; + } + + mythread_cond_signal(&thr->coder->cond); } goto next_loop_lock; @@ -544,17 +533,22 @@ threads_end(struct lzma_stream_coder *coder, const lzma_allocator *allocator) } +/// Tell worker threads to stop without doing any cleaning up. +/// The clean up will be done when threads_exit() is called; +/// it's not possible to reuse the threads after threads_stop(). +/// +/// This is called before returning an unrecoverable error code +/// to the application. It would be waste of processor time +/// to keep the threads running in such a situation. static void threads_stop(struct lzma_stream_coder *coder) { for (uint32_t i = 0; i < coder->threads_initialized; ++i) { + // The threads that are in the THR_RUN state will stop + // when they check the state the next time. There's no + // need to signal coder->threads[i].cond. mythread_sync(coder->threads[i].mutex) { - // The state must be changed conditionally because - // THR_IDLE -> THR_STOP is not a valid state change. - if (coder->threads[i].state != THR_IDLE) { - coder->threads[i].state = THR_STOP; - mythread_cond_signal(&coder->threads[i].cond); - } + coder->threads[i].state = THR_IDLE; } } @@ -1561,6 +1555,10 @@ stream_decode_mt(void *coder_ptr, const lzma_allocator *allocator, } // Return if the input didn't contain the whole Block. + // + // NOTE: When we updated coder->thr->in_filled a few lines + // above, the worker thread might by now have finished its + // work and returned itself back to the stack of free threads. if (coder->thr->in_filled < coder->thr->in_size) { assert(*in_pos == in_size); return LZMA_OK; @@ -1948,7 +1946,7 @@ stream_decoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator, // accounting from scratch, too. Changes in filter and block sizes may // affect number of threads. // - // FIXME? Reusing should be easy but unlike the single-threaded + // Reusing threads doesn't seem worth it. Unlike the single-threaded // decoder, with some types of input file combinations reusing // could leave quite a lot of memory allocated but unused (first // file could allocate a lot, the next files could use fewer From nobody Wed Jul 2 18:41:41 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXTJP3kSTz60n6C; Wed, 02 Jul 2025 18:41: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXTJP2Yxfz3Mgc; Wed, 02 Jul 2025 18:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751481701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EtP8t+P1xpoDs4+lTJkA0BnEv0CLhiCTDHIFk7VdToc=; b=Rs35BUXRE6gkZHXaFa1GnDgj3gI0hgjIlZRyvGAwJJUCJA/QzdVanpvQsQ8rFbqiSb4ecv PIpUzGp8G+d9hgFL7TzVjfEe4ntLtfedNjNRajqz06JFTLwoJb8FVqaClmqqhd2MDJ0Ki7 qn3kiJzofnfVJGVK4XsA1rjB9X5d1S36ul8yIxqBV9P738LaAqe1bV57j8WhHxeJ12dSmK MMDmRpIx8W0da7KozFTv5R97iMjp1Qaiz5O+G5LQcfY21oC3t/55xrQdnTI5eFpHWpFLTr 0cjBon0my8donNSTbJVmx+vD8h++eqfGlBMhFzJd20cy/KIQluRTube6GwirNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751481701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EtP8t+P1xpoDs4+lTJkA0BnEv0CLhiCTDHIFk7VdToc=; b=mv9Mcx3WQ5DVAp2laJ18z18ZV+q3YIGRj+0MbnnYGn2y3vlcNX6zc0qfp/ZqKxfyczcdvs R5GYslMr1bAgJbrnbgc0tTCq9hB8V7n88lRcBNGBA6/KeZ1PcKRBkcbmoO0mdv7T6sN5bK Sc99XTNtRjTSspZ0bSgJrsKvyoSQRsVeb7Us+JctGLYbE+nZn7INOht0Mlf6Xgx6pKMy2f 4HYGAnVeBqrGThKjIGFDymiQQcKIE1t9hR6C22IZ6XOL41tJgki2XZELBVmvzucbEAUKRd 6pzRULbj6eKk3NLASVpGAQWI752M2rjzXW+EtXtqq3ownf1K99fFrfpPypjnmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751481701; a=rsa-sha256; cv=none; b=n+bo/lP9HUU0nFWuh+KRkfrfoD1/HcviCypH0ka/eBD7fg9AUoNZ53IpMRD85A1J+XW9rI GuxCO57N/iLM4gI40n4ERzO9+arjXORaH1FbmmexLU9758bCHNb2d6YSG2IEN+dT3q4E9/ oRcD5NBZlqxM91ezNe9K3GNpYknKKWo+8Z2YoFaeSBPNeBlqKBFuEGlN5Z/LmliXBEpxTG Px2VxGj3ViPwtBISlnK0qaMCMbCmicvq2WTGftnBNHJRKyRNLqVOYdScbCdHVJTbIOTh+F tuoFrwpiuSeYyTiQzIk3IZQ8/K0Hqa7/Buigv5LNHxNzkrDpwRjQeWtXbh7j4Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXTJP27zGzWrY; Wed, 02 Jul 2025 18:41:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562IffTP093606; Wed, 2 Jul 2025 18:41:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562IffIP093603; Wed, 2 Jul 2025 18:41:41 GMT (envelope-from git) Date: Wed, 2 Jul 2025 18:41:41 GMT Message-Id: <202507021841.562IffIP093603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 79dea0c8af4e - main - linker: Fix the ifunc symbol value calculation for ET_REL files List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 79dea0c8af4eeb394c6db6ce62a4da77177bd234 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=79dea0c8af4eeb394c6db6ce62a4da77177bd234 commit 79dea0c8af4eeb394c6db6ce62a4da77177bd234 Author: Mark Johnston AuthorDate: 2025-07-02 18:38:20 +0000 Commit: Mark Johnston CommitDate: 2025-07-02 18:41:06 +0000 linker: Fix the ifunc symbol value calculation for ET_REL files Reported by: cy Fixes: aefae931820f ("linker: Improve handling of ifuncs when fetching symbol metadata") --- sys/kern/link_elf_obj.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 3d18aed2b1c0..151aab96f9be 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -1514,19 +1514,17 @@ static void link_elf_ifunc_symbol_value(linker_file_t lf, caddr_t *valp, size_t *sizep) { c_linker_sym_t sym; - elf_file_t ef; const Elf_Sym *es; caddr_t val; long off; val = *valp; - ef = (elf_file_t)lf; /* Provide the value and size of the target symbol, if available. */ val = ((caddr_t (*)(void))val)(); if (link_elf_search_symbol(lf, val, &sym, &off) == 0 && off == 0) { es = (const Elf_Sym *)sym; - *valp = (caddr_t)ef->address + es->st_value; + *valp = (caddr_t)es->st_value; *sizep = es->st_size; } else { *valp = val; From nobody Wed Jul 2 18:42:40 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXTKf5WKZz60nNT; Wed, 02 Jul 2025 18:42:46 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (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 4bXTKf3Gl2z3Mxb; Wed, 02 Jul 2025 18:42:46 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-7d3cc0017fdso517626885a.3; Wed, 02 Jul 2025 11:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751481765; x=1752086565; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=7/oB7vRiHBFnDw9FyrVexNpHAhLVpUmBllcHRF7A3EE=; b=l5Sz7yy8b0k8+TGNDYwgQyj/xCabw9s0O27prKfNY/NuTfdmuefRNrfJVaK+5BQ416 6KOObrF24cg8m9M0fRD4VDXvtz0GB2c1Be07/jGfDaC0AFPCAHffg0eMpeGYtmrJ7uJE kH/+jVdBwo5cradz9E/wfIki2Dc5jONPn3MegfehRqFFMcFzVFbPJ1kc5FtPvT8vQ/1j PqyliQe1vxm+qG7IjZjf+Um0PvDZ8shM2YBUJaQ8c9W2ZVntezLcGJ5CtmmxEU0oNgZL yRPpxVVYaWE37zgd0t/IumMXy+Kvrp50gLwq42tEXBx/5YpLD3F/xfT+89Tag0vNeGUJ j/kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751481765; x=1752086565; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7/oB7vRiHBFnDw9FyrVexNpHAhLVpUmBllcHRF7A3EE=; b=wrnH++axiVxJfewdCxsq2fnCJhWfk+tT7mJwWSlfXsel/1ZRxwi47VJvKtDZzLDH76 0hCB0Pv/zruIS7DTBOTd0z6jwdCzvSVA3KYF+iIrztFhhmYmmK66HKnfhXGn1vqSs/1Q B1a3iE3Jdbx8by3F1d4pXRob7v3kKOOiUBBO7tYGIPlOTntxIsxLtlppK+MpKgVzHWDS MRSU7YUix+aawdUUwzENfPMkuiSF3evlu/G2CN7a8mtzyUj0kmx8mJz/yBrwcx/xD2V5 jIFuIbOUPbMS94Em9IAbYwhRyRVknIernK0c/o3yD8+0QSNOVY907IgsPfPykrpt9e1w r7sg== X-Forwarded-Encrypted: i=1; AJvYcCVKjdS0MIC7Ti8mA5s6QE9jx0KXbj1oxwBSejuSA/lQz0FaDp7xZSFuWgTGFc7/qSCfGdBi+QpSbfstIVcOKHJ5pAg0@freebsd.org, AJvYcCVMY0IA3wPfaisI++97E0E1vvCSLwY5xIHb+qMkolxD3+IZMvOsdTWk/Mka00BGf2X6Q3G98vCrZJ9adFORyT91txlMJ0s=@freebsd.org X-Gm-Message-State: AOJu0YxDwEvbkGszK08RS0aO1vdlHAV0wrCZFMenXsTBjWaqVVfpqxtj euk6ZSahLOiTBS4R5SHR0lrLiVIiHaJCkbq5tA7ifnrLbu3zR6PoRqyfetCZPh8o X-Gm-Gg: ASbGnctbe7gUSGJqm+B3k5wH4LxddyQJVoKpa8+y+7Pj6XK5VysVQDATdivG/+jpsz4 Kx7rCnX0OaLuKkDAkj/XwZDtFBOvZJ7TweY9GOYf4s41hA3EGPccJ7dGtYIq3C7hKdo0pXs/pQp 2Y+H7C4ECE2k9jlxF2Pb3MNHRicguwAKj0zci5wELfhdK3zXwea8XOmckO8X+T49XkzqtmsRoGY cjqcw/dYKxYBJ8VN22bzoYtyBxlgpW+0DTnYi5ofndFPOePL/VsQJBkuRf7DL6CerbQLJgy8tOg 6582fxGOiCWRn/Iu9zXDQBtaoKOc/LmZ0fxTb8DisgWjSiszCeo+Em6W0KGrRmbkOczjW50dEgb k X-Google-Smtp-Source: AGHT+IFuvgADdU3CNd70+4voxhGVdKIVjJqUW9R1lPdUonndl3G3vFLAbxKKoi1tY/Hv6ZLCs227/g== X-Received: by 2002:a05:620a:7085:b0:7d2:2730:92b0 with SMTP id af79cd13be357-7d5d14758f6mr79026485a.38.1751481764185; Wed, 02 Jul 2025 11:42:44 -0700 (PDT) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4a7fc13d677sm95858811cf.31.2025.07.02.11.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 11:42:42 -0700 (PDT) Date: Wed, 2 Jul 2025 14:42:40 -0400 From: Mark Johnston To: Cy Schubert Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: aefae931820f - main - linker: Improve handling of ifuncs when fetching symbol metadata Message-ID: References: <20250702182553.F0431281@slippy.cwsent.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250702182553.F0431281@slippy.cwsent.com> X-Rspamd-Queue-Id: 4bXTKf3Gl2z3Mxb X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] On Wed, Jul 02, 2025 at 11:25:53AM -0700, Cy Schubert wrote: > Cy Schubert writes: > > In message <202507021341.562DfuEh023668@gitrepo.freebsd.org>, Mark Johnston > > wri > > tes: > > > The branch main has been updated by markj: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=aefae931820fe1e93a318552968510 > > 29 > > > 8c7941a0 > > > > > > commit aefae931820fe1e93a318552968510298c7941a0 > > > Author: Mark Johnston > > > AuthorDate: 2025-07-02 13:34:47 +0000 > > > Commit: Mark Johnston > > > CommitDate: 2025-07-02 13:34:47 +0000 > > > > > > linker: Improve handling of ifuncs when fetching symbol metadata > > > [...] > > > > This commit may have caused a panic loading linux.ko. > > [...] > > Confirmed. kldload linux causes the panic. This should be fixed by commit 79dea0c8af4eeb394c6db6ce62a4da77177bd234. Sorry for the breakage. From nobody Wed Jul 2 19:34:26 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXVTK6ysqz60qQn; Wed, 02 Jul 2025 19:34:29 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta003.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXVTK3nxkz3bXC; Wed, 02 Jul 2025 19:34:29 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; none Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTPS id WuZdu2etU9JM2X3DwuqQrh; Wed, 02 Jul 2025 19:34:28 +0000 Received: from spqr.komquats.com ([70.66.136.217]) by cmsmtp with ESMTPSA id X3DuuC6DuWX70X3DwuONtt; Wed, 02 Jul 2025 19:34:28 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=d71WygjE c=1 sm=1 tr=0 ts=686589c4 a=h7br+8Ma+Xn9xscxy5znUg==:117 a=h7br+8Ma+Xn9xscxy5znUg==:17 a=kj9zAlcOel0A:10 a=Wb1JkmetP80A:10 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=YxBL1-UpAAAA:8 a=c5AlKVwaex26CMH082QA:9 a=CjuIK1q_8ugA:10 a=LK5xJRSDVpKd5WXXoEvA:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 76D2B146; Wed, 02 Jul 2025 12:34:26 -0700 (PDT) Received: by slippy.cwsent.com (Postfix, from userid 1000) id 5D56D300; Wed, 02 Jul 2025 12:34:26 -0700 (PDT) X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Mark Johnston cc: Cy Schubert , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: aefae931820f - main - linker: Improve handling of ifuncs when fetching symbol metadata In-reply-to: References: <20250702182553.F0431281@slippy.cwsent.com> Comments: In-reply-to Mark Johnston message dated "Wed, 02 Jul 2025 14:42:40 -0400." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 02 Jul 2025 12:34:26 -0700 Message-Id: <20250702193426.5D56D300@slippy.cwsent.com> X-CMAE-Envelope: MS4xfG2xOSARRvmmiq2PcAsXOAMKA87ErxVOLR/nfv5fLgC0OCUXxim1HH/maaS6ioBiZ9vaeSkGHm94KrZfUcMWGp6R4vjopB5xzbt4hIb6wI6W/Wq7YzKT CGY3RIpbwariRH6SeU2TGAV0IaM8Wt0kE5h4mAvNzVvi7O8nrJYbMgjHV0MnGnHWlvi44LsNi3XK1O3mH8IkhaVh0f+R01P+S0MIEYACuBlI6XVyssJC3qJq bLWA3wcRR86npxGdgndHpTqzyD/RSgM0dAtamNuuovsU1Oim+NunUP77Bgk3LCniZa8hafVGE/9bNKze4fZDzJ5+TxjuCViBMVg22JwOa/Y= X-Rspamd-Queue-Id: 4bXVTK3nxkz3bXC X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US] In message , Mark Johnston writes: > On Wed, Jul 02, 2025 at 11:25:53AM -0700, Cy Schubert wrote: > > Cy Schubert writes: > > > In message <202507021341.562DfuEh023668@gitrepo.freebsd.org>, Mark Johnst > on > > > wri > > > tes: > > > > The branch main has been updated by markj: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=aefae931820fe1e93a31855296 > 8510 > > > 29 > > > > 8c7941a0 > > > > > > > > commit aefae931820fe1e93a318552968510298c7941a0 > > > > Author: Mark Johnston > > > > AuthorDate: 2025-07-02 13:34:47 +0000 > > > > Commit: Mark Johnston > > > > CommitDate: 2025-07-02 13:34:47 +0000 > > > > > > > > linker: Improve handling of ifuncs when fetching symbol metadata > > > > [...] > > > > > > This commit may have caused a panic loading linux.ko. > > > [...] > > > > Confirmed. kldload linux causes the panic. > > This should be fixed by commit 79dea0c8af4eeb394c6db6ce62a4da77177bd234. > Sorry for the breakage. NP. That does fix it. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e**(i*pi)+1=0 From nobody Wed Jul 2 19:34:38 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXVTW26mhz60qcG; Wed, 02 Jul 2025 19:34: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXVTV38dkz3bXW; Wed, 02 Jul 2025 19:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751484878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3QKKDVd01z8u1vvS0LEmGqepse9mVBSob553lIL4pqI=; b=UVwBa+ntSdhHLN3byYsCYe/zMf7Kjgsw1xMc4Bt6xcNNM6Ihv53yr3yfCRsp7ax4WHFc+f Voo3iNb1u7/c+iv+qhucWz1WRdHz3SwWhIN6OCzC+tnOZ+GysFCe613/5ZuYkEAiecplyf VuQ18gB5Ut3oN1g5G96hcE6XcbEUzXvmtdt2bWp+/6uvLzRNDHOle2engOVY0kdNcQUNEr qtKFhjmyY8YYuJmX3BpySaTLv6DsHhUva0zldItt3si88AEP/jaCkDAOe+a2M7sD4UsHKH p07RCLoUptOuGwRj2ROlFuNAOg2lTvMC6DrzKeChwcahA80sgnO5QsLiJA9ggA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751484878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3QKKDVd01z8u1vvS0LEmGqepse9mVBSob553lIL4pqI=; b=v9gZV7tH+umv/9BOBRw+7rloZuMxl0cVsJp4LMGMq65a8tzmy1nQOD+hzKXYyA+Cr7UFwt mNCzMsnrzOmA44nioNvIIOw2prhW+k5oGd4D5ppRkIX/daWdf3ZO7eA+TK9S3rYp2iOUJ4 UEI9EOFAteQfvSNytZG0xbqXN0xKqawUFPwls3CXTmgSYxqPcGapLZSDGW2PBcCnVYWF3B tY93t9vf3pAjNpR1pKhaTRa1hnCU4zFy4FrXXqqSGoOw0k5rFrHw2Pofd/ysVrdvviGj7y B+KzPLnhCaOhCMNflPt2bEmyltrT8guS4VcLNNmnomsWzNfx3pStDx+SX9HzWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751484878; a=rsa-sha256; cv=none; b=fEJPHyDa25mMD3hWrBPDUH3McOuKZmFNTBl5SsdRkIBvh4fqV86kmEU5Uywmwiie8Q2ObB 6CvZFECXOndirTI/nrpaDwI7XoOyAQAsmmISd3xgWsTKLCGz9KAxOH6lsldju3HSCrM+kA 8Ph1anxj3fh50E+t1U80UK84Pb640GfRyB7B7vmmu2mX6KhBdZh7dim0AcToHjZul2Kh6Z KAOtlc6+aMNmNGrBLU511a5zkkpd9vBNclQLOTgWFcQoz+0+O/ffQJP1bz2kpmteqooMlX bdNu/c0gEuRsXZZfvXTfQBsO4crHu1i44O+EgUKny3bToGrWbUzZWU5Mbv2ZiQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXVTV2DjCzZ1d; Wed, 02 Jul 2025 19:34:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562JYcqs088954; Wed, 2 Jul 2025 19:34:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562JYcTb088951; Wed, 2 Jul 2025 19:34:38 GMT (envelope-from git) Date: Wed, 2 Jul 2025 19:34:38 GMT Message-Id: <202507021934.562JYcTb088951@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: b2f02b04948c - main - if_ethersubr: preserve entropy of MAC addresses List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2f02b04948cea9b7f019b267e1fc2d083b1417c Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b2f02b04948cea9b7f019b267e1fc2d083b1417c commit b2f02b04948cea9b7f019b267e1fc2d083b1417c Author: Quentin Thébault AuthorDate: 2025-07-02 06:17:29 +0000 Commit: Kyle Evans CommitDate: 2025-07-02 19:33:19 +0000 if_ethersubr: preserve entropy of MAC addresses Ethernet MAC addresses are currently generated by concatenating the first bytes of a SHA1 digest. However the digest buffer is defined as a signed char buffer, which means that any digest digit greater than 0x80 will be promoted to a negative int before the concatenation. As a result, any digest digit greater than 0x80 will overwrite the previous ones throught the application of the bitwise-or with its 0xFF higher bytes, effectively reducing the entropy of addresses generated and significantly increasing the risk of conflict. Defining the digest buffer as unsigned ensures there will be no unwanted consequences during integer promotion and the concatenation will work as expected. Signed-off-by: Quentin Thébault Closes: https://github.com/freebsd/freebsd-src/pull/1750 --- sys/net/if_ethersubr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 66a4724a786c..cf697089708c 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1486,7 +1486,7 @@ ether_gen_addr_byname(const char *nameunit, struct ether_addr *hwaddr) char uuid[HOSTUUIDLEN + 1]; uint64_t addr; int i, sz; - char digest[SHA1_RESULTLEN]; + unsigned char digest[SHA1_RESULTLEN]; char jailname[MAXHOSTNAMELEN]; getcredhostuuid(curthread->td_ucred, uuid, sizeof(uuid)); From nobody Wed Jul 2 19:34:39 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXVTX2kxFz60qkm; Wed, 02 Jul 2025 19:34: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXVTW4DkPz3bmK; Wed, 02 Jul 2025 19:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751484879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g74sSnLOPrSySfDFbnyFMSuYUHeerm+27cKV3o6vjnQ=; b=AsKpPA7RNfGVizIHSd32WvyJrgZH+iTQ8BebL0Kl/7hxNQO8YBweLtUiLaIxF2rFAUAhn5 sAq41Hm+goCyJBmx9Cia+7ePfg/PqhpxZs8ONgQprDwPCKKOp85ILXNYTReFrIqxwr7X2L 5BY+2PIiURwpPUGPOr1qA+zbNjLOB7ohFEMuTuABYynIIo0FfzQjQ65o+kA9vaQu/TpX1U lpkq3v83yMV/dqtPn7r9Op0GXixiuS+DcwejYTtwdsHUISAtmoMW8P5KWGe4DwxRQdKiR6 KKIPtYiDAYxzwoNsLGfEr1y09J8k3ZvS3j74BAcMv5RkPpD3jkrELahtml+EGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751484879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g74sSnLOPrSySfDFbnyFMSuYUHeerm+27cKV3o6vjnQ=; b=jLkGHUevb8rqW+BMw8RfgBA8kzAtOeijC6ADJMqRGFNNjUz3cviXmNpeCcH+UNUsuDF5WZ 2TxU6K8j5MZD17OR/7fcqlXDnu858z2oIGfZnoHl1iLS5rsoZQrMpbpdfvqFzda7HDUrGe 5KljS5slfDqYm1wDMeo80StekKGUISdHwYp5qmU6s0PlcRbe8WCTL9R6kVmwDUGVL+mvU7 RFyGVt0RimGinWTr0xP23tBBQ9f3sdR8orMmhVO9igDiJ6YOBvCsagKyEaXbd6BZi1YqrF 6Ev+SfNTSek7quk6qpbZVKVEMXVqkXUBlJsHj78nj2Iyop4jkkvWszx8Nz9aeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751484879; a=rsa-sha256; cv=none; b=fYi+Wvr/bBFxB3uAcyoQQjW7rRJnh6WjjbWz3Ya17yvegkZIljiCUJN8W6wy1Tn7N+XrXu wGFD1BHD5DUXN1NiTKumkZWZC+M2m5CFg8Qsg8JyypRVYyNgsWKoIRFZXQuH/NAdbWmdQ0 6tU5Q8KDgQeyIKsNARi9d+qSOgwQCK2RfFeRi2XXGtDBDN/fMis3tZi6YmMVN06UIzDlQz 3Oj3AXW4oPSsqOdquprh2ULkXsVHPWDJEQ9groCSSUz/K3bj8resAQrtsa+bZDnw6FS2km 8pfGlrPbYQ8svCXVWH+VgPjh5i32ApWxbng7shkEskAHjqI4uIE2aO9UQ93bEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXVTW3GJSzZ1f; Wed, 02 Jul 2025 19:34:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562JYdIv088989; Wed, 2 Jul 2025 19:34:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562JYdop088986; Wed, 2 Jul 2025 19:34:39 GMT (envelope-from git) Date: Wed, 2 Jul 2025 19:34:39 GMT Message-Id: <202507021934.562JYdop088986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 604d34c23f77 - main - net: ether_gen_addr: fix address generation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 604d34c23f772ae0005a552b0b7189f3dc97d519 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=604d34c23f772ae0005a552b0b7189f3dc97d519 commit 604d34c23f772ae0005a552b0b7189f3dc97d519 Author: Maxim Shalomikhin AuthorDate: 2025-07-02 19:25:57 +0000 Commit: Kyle Evans CommitDate: 2025-07-02 19:33:52 +0000 net: ether_gen_addr: fix address generation Some errors in ether_gen_addr() caused us to generate MAC addresses out of range, and the ones that were within range had other errors causing the pool of addresses that we might actually generate to shrink. Fix both prblems by using only two bytes of the digest and then OR'ing against the mask, which has the appropriate byte set for the fourth octet of the range already; essentially, our digest is only contributing the last two octets. Change is the author, but any blame for the commit message goes to kevans. PR: 256850 Relnotes: yes --- sys/net/if_ethersubr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index cf697089708c..7be4dfac23e7 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1510,9 +1510,7 @@ ether_gen_addr_byname(const char *nameunit, struct ether_addr *hwaddr) SHA1Final(digest, &ctx); free(buf, M_TEMP); - addr = ((digest[0] << 16) | (digest[1] << 8) | digest[2]) & - OUI_FREEBSD_GENERATED_MASK; - addr = OUI_FREEBSD(addr); + addr = (digest[0] << 8) | digest[1] | OUI_FREEBSD_GENERATED_LOW; for (i = 0; i < ETHER_ADDR_LEN; ++i) { hwaddr->octet[i] = addr >> ((ETHER_ADDR_LEN - i - 1) * 8) & 0xFF; From nobody Wed Jul 2 20:35:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXWqK0sCNz60sxd; Wed, 02 Jul 2025 20:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXWqK0B5pz3GnD; Wed, 02 Jul 2025 20:35:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751488509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7r6RTaH96SHjDNHii8Wo433laJN7KHDsDZ5FHOA3nJA=; b=bz89ZYnCTjlLvqgN8BkjsJ/QFZOCrNUyQnyG88kSCDxujKZbfMW72jQaUJjs/jqGXmamb6 vGevIAeI8DNOW/UVXQrGnGlAIfieEaVm4NdZZURx0WTN9OpX+ng1U5dhXYUs12TztaQRFJ xBy0ow+af9SjDaenfs77xSLO58+ByRCWLaoOsv5TeB4FaawZLiTrBxg6oma3XsOmdPjJ5D ENyqDcIWo8pcxAY1ZpzK98iuE0FejWBMp40jaXQpGM2SuFib4k6CErL2VPN8QBt2FIXWOm b2910K9U7wl2dnAiRLM14r1Fs0Q0zVYr+IiRpaonzxWZr63Y8lPddg91eaJF/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751488509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7r6RTaH96SHjDNHii8Wo433laJN7KHDsDZ5FHOA3nJA=; b=CLbJlG/ywMBalFcbz3RwIRqZWeVKK5VHTUO43jp2PaVzVWmofeF3UXtP2kgLzAA3qmKfqG 0Z+Hm2duv35kFkPzw2eIUgXk8n+yqMYgdiIgEU74wXG73rrA2oFB82ODmLSsm9dOw0KSX8 nnCHXdFFbe7rGqeCSYlag/FuwY49wjybuXXKtGTMQGY1IG1SNeM4Fq5JP4h2Rcj+TMNiuL uQ1rfYez8eh9E0UobHhUsUYAL/MHxvxBHB5vU2d1JWLs1OuWl+oC68BMygVI2EJKsDO2SR 0MYcOLPtr/IiIzeOlPhiVwQPdJvkzWEr+q+tmFJbUh83ZXh7YdO9dyh4QiC3jA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751488509; a=rsa-sha256; cv=none; b=U1OrSq4DUen8mtDO5NkaTCfitCMoFxDiWmysXntGzbeNE6P30bcDHCPQMHtjqwXgnettb0 oOoHrW2YOww+7JgVwoDJfLA84p0/7nUoRwKmyAFOQxALv7NH9k25awLa/BTVAnBqAgESSS FrUKeFc8toFafgRB6bCANgKqjQWhtrSqKbpM0pu0IaDXlrAl/C8ZgrgepQ+oLneifQDiFd iCtV6S0JNxEtTzRJOX/VnnCwmSW94+6YUioSgLgBNMgv1vWSE0Shw+VkCeqQX2VrhLxJEs xsGDN1bTfpUSYHNunC1O4omDZq+V31F8aRvPp6r09qB+YcE1DwTXkeZOah3wmg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXWqJ6sB1zbmL; Wed, 02 Jul 2025 20:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 562KZ8R9002953; Wed, 2 Jul 2025 20:35:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 562KZ8F0002950; Wed, 2 Jul 2025 20:35:08 GMT (envelope-from git) Date: Wed, 2 Jul 2025 20:35:08 GMT Message-Id: <202507022035.562KZ8F0002950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brooks Davis Subject: git: 8d93877c013f - stable/14 - Add sys/stdarg.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8d93877c013fa3bc00b8b9841e545a941e80b2ca Auto-Submitted: auto-generated The branch stable/14 has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=8d93877c013fa3bc00b8b9841e545a941e80b2ca commit 8d93877c013fa3bc00b8b9841e545a941e80b2ca Author: Brooks Davis AuthorDate: 2025-07-02 20:24:45 +0000 Commit: Brooks Davis CommitDate: 2025-07-02 20:34:44 +0000 Add sys/stdarg.h While the type of va_list and implementation of va_*() psuedo functions varies (sometimes greatly) by architecture, they will always be defined by the compiler in a consistant way that does not require machine dependent handling. MFC after: 1 week Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595 (cherry picked from commit 2d92a5abefc9cf6aa81fb7d23f8fcca4f1d6026d) --- include/Makefile | 4 ++-- sys/sys/stdarg.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/Makefile b/include/Makefile index f5985ebf091a..0ecf72177427 100644 --- a/include/Makefile +++ b/include/Makefile @@ -40,9 +40,9 @@ INCS= a.out.h ar.h assert.h bitstring.h byteswap.h \ .PATH: ${SRCTOP}/contrib/libc-vis INCS+= vis.h -MHDRS= float.h floatingpoint.h stdarg.h +MHDRS= float.h floatingpoint.h -PHDRS= _semaphore.h +PHDRS= _semaphore.h stdarg.h LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ syslog.h ucontext.h diff --git a/sys/sys/stdarg.h b/sys/sys/stdarg.h new file mode 100644 index 000000000000..d9266d12c7e1 --- /dev/null +++ b/sys/sys/stdarg.h @@ -0,0 +1,6 @@ +#ifndef __SYS_STDARG_H__ +#define __SYS_STDARG_H__ + +#include + +#endif /* __SYS_STDARG_H__ */ From nobody Thu Jul 3 01:27:53 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXfK55jTcz60xpy; Thu, 03 Jul 2025 01:27: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXfK54ntyz41pk; Thu, 03 Jul 2025 01:27:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751506073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GpGStNOaM0ZyJMczKlj9c5hP+cZn8RMBBd/vt7X3ZOQ=; b=LbalOi758EdXAiGmlNkgXBDI4F6o1bWe48RqCeNBbjH85ltc7Z8wXkyN3Fhf/A9umNHH2q A785xr2NeunDuAzW+vm742OUDzcl/9RlFTOaxh14N9S3e/y+rJRvuTnj0A1zhJwjmDTTf9 /q8NJoJ3v/1i3PjiCSVb4IgVZVE4d74m+5HOZACuyg075PyP8xwZmtIVDM+XjF4ymWcpUl K/293m7hx/R4FOx1jXnFiz4jvGzmybY+9z2G6IBrrIJkZAiA02rmnaME0b1ltFg9rnbEiz q6vPn9xQwoWtSFIvwK/6Pei6T/ReH93uq8ZRlNDqUdOclnSj5UpOiJQz3XVf3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751506073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GpGStNOaM0ZyJMczKlj9c5hP+cZn8RMBBd/vt7X3ZOQ=; b=WLHfIp+/hnqu6/uaLdZoLZCUJBviz5T36UAXR7jr8KvC6/CEphIzPXZQt7BRgwsui5hGiN CiA4Yn93cIjHNcMuAglP0VjjZyUfooeFDy8xbrnv+EDPo1qFC8rx0R4kwbHUxR1gwT1FqN D8+noD+zlVr8UjOYQlbgVLyba6wC2eY3KXmzcb8415SzpaiWrDIvOVrb/dX4x22UyJkLMe Y0DwXcn5RW3hH36bGx160YSBmxoE5r6Vl/Xa+phslCWJFnPN62NqnXzS4DrYVrwrGQ2x53 c8FfvntBtm0I/oT48rYJkCrri5wjKgpaYsi1NDZDuMsgTMGML+d3KdWxKdjLBw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751506073; a=rsa-sha256; cv=none; b=evSYrb50ZWY/bNMSkUgB/AV4OHnmuZrpD+tcwSy4QQrnmFp24rpTer0W2b+akRIVIixHZn aByTx8+PZ5Ybltst6odGkUm2MMDNLLY1Q8DNBGH2eBZVQv7nvYVr1nrDxPk327rdghoWjI F9vm3MtA2y5Ok7EHZ7KvN32moKNWWLQvXCFo2oRyV7aTeY03wY5643dk7EIX7l5Sl8xPnI J7pSbftthaCZ1WIlfWeYDgLupJrUADYYHwifLRwKezfrTuUF5+jpLvu5g0Pfq7KRoLGAB1 pwfNBcSNWgUY37mD2cV7bV9X8jI0UURC1Yax/VzEgNa61jXGnlGf4EFuMFmlkg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXfK53m6CzkGY; Thu, 03 Jul 2025 01:27:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5631RrGS049196; Thu, 3 Jul 2025 01:27:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5631RrGc049193; Thu, 3 Jul 2025 01:27:53 GMT (envelope-from git) Date: Thu, 3 Jul 2025 01:27:53 GMT Message-Id: <202507030127.5631RrGc049193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Lo Subject: git: 0cc03e473ed7 - stable/14 - uchcom: add support for CH9102 and CH343 uarts List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevlo X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0cc03e473ed74fb495c4ebe21d3ba2d92c5c4968 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevlo: URL: https://cgit.FreeBSD.org/src/commit/?id=0cc03e473ed74fb495c4ebe21d3ba2d92c5c4968 commit 0cc03e473ed74fb495c4ebe21d3ba2d92c5c4968 Author: Kevin Lo AuthorDate: 2025-06-25 01:33:35 +0000 Commit: Kevin Lo CommitDate: 2025-07-03 01:26:06 +0000 uchcom: add support for CH9102 and CH343 uarts The CH343 devices support any baud rate up to 6 Mbps. PR: 272803 Reviewed by: imp Tested by: joerg, Tomasz "CeDeROM" CEDRO Differential Revision: https://reviews.freebsd.org/D46290 (cherry picked from commit 1395712cab8e95808064ba68c5a792b7cd0fe35f) --- share/man/man4/uchcom.4 | 27 +--- sys/dev/usb/serial/uchcom.c | 353 +++++++++++++++++++++++++------------------- sys/dev/usb/usbdevs | 4 +- 3 files changed, 208 insertions(+), 176 deletions(-) diff --git a/share/man/man4/uchcom.4 b/share/man/man4/uchcom.4 index d5efe83286ba..4d395573589f 100644 --- a/share/man/man4/uchcom.4 +++ b/share/man/man4/uchcom.4 @@ -27,12 +27,12 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 26, 2017 +.Dd August 19, 2024 .Dt UCHCOM 4 .Os .Sh NAME .Nm uchcom -.Nd WinChipHead CH341/CH340 serial adapter driver +.Nd WinChipHead CH9102/CH343/CH341/CH340 serial adapter driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -52,22 +52,12 @@ uchcom_load="YES" .Sh DESCRIPTION The .Nm -driver provides support for the WinChipHead CH341/CH340 USB-to-RS-232 -Bridge chip. +driver provides support for the WinChipHead CH9102/CH343/CH341/CH340 +USB-to-RS-232 Bridge chip. .Pp -The device is accessed through the -.Xr ucom 4 -driver which makes it behave like a -.Xr tty 4 . -.Sh HARDWARE -The -.Nm -driver supports the following adapters: -.Pp -.Bl -bullet -compact -.It -HL USB-RS232 -.El +The datasheets for the CH340/CH341 list the maximum +supported baud rate as 2,000,000. +CH9102/CH343 devices support any baud rate up to 6 Mbps. .Sh FILES .Bl -tag -width "/dev/ttyU*.init" -compact .It Pa /dev/ttyU* @@ -95,6 +85,3 @@ The first .Fx release to include it was .Fx 8.0 . -.Sh BUGS -Actually, this chip seems unable to drive other than 8 data bits and -1 stop bit line. diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c index a886b25c89d7..fdc5515fa722 100644 --- a/sys/dev/usb/serial/uchcom.c +++ b/sys/dev/usb/serial/uchcom.c @@ -58,8 +58,7 @@ */ /* - * Driver for WinChipHead CH341/340, the worst USB-serial chip in the - * world. + * Driver for WinChipHead CH9102/343/341/340. */ #include @@ -101,17 +100,19 @@ SYSCTL_INT(_hw_usb_uchcom, OID_AUTO, debug, CTLFLAG_RWTUN, &uchcom_debug, 0, "uchcom debug level"); #endif -#define UCHCOM_IFACE_INDEX 0 -#define UCHCOM_CONFIG_INDEX 0 +#define UCHCOM_IFACE_INDEX 0 +#define UCHCOM_CONFIG_INDEX 0 +#define UCHCOM_SECOND_IFACE_INDEX 1 #define UCHCOM_REV_CH340 0x0250 #define UCHCOM_INPUT_BUF_SIZE 8 -#define UCHCOM_REQ_GET_VERSION 0x5F -#define UCHCOM_REQ_READ_REG 0x95 -#define UCHCOM_REQ_WRITE_REG 0x9A -#define UCHCOM_REQ_RESET 0xA1 -#define UCHCOM_REQ_SET_DTRRTS 0xA4 +#define UCHCOM_REQ_GET_VERSION 0x5F +#define UCHCOM_REQ_READ_REG 0x95 +#define UCHCOM_REQ_WRITE_REG 0x9A +#define UCHCOM_REQ_RESET 0xA1 +#define UCHCOM_REQ_SET_DTRRTS 0xA4 +#define UCHCOM_REQ_CH343_WRITE_REG 0xA8 #define UCHCOM_REG_STAT1 0x06 #define UCHCOM_REG_STAT2 0x07 @@ -134,13 +135,21 @@ SYSCTL_INT(_hw_usb_uchcom, OID_AUTO, debug, CTLFLAG_RWTUN, #define UCHCOM_RTS_MASK 0x40 #define UCHCOM_BRK_MASK 0x01 +#define UCHCOM_ABRK_MASK 0x10 +#define UCHCOM_CH343_BRK_MASK 0x80 #define UCHCOM_LCR1_MASK 0xAF #define UCHCOM_LCR2_MASK 0x07 #define UCHCOM_LCR1_RX 0x80 #define UCHCOM_LCR1_TX 0x40 #define UCHCOM_LCR1_PARENB 0x08 +#define UCHCOM_LCR1_CS5 0x00 +#define UCHCOM_LCR1_CS6 0x01 +#define UCHCOM_LCR1_CS7 0x02 #define UCHCOM_LCR1_CS8 0x03 +#define UCHCOM_LCR1_STOPB 0x04 +#define UCHCOM_LCR1_PARODD 0x00 +#define UCHCOM_LCR1_PAREVEN 0x10 #define UCHCOM_LCR2_PAREVEN 0x07 #define UCHCOM_LCR2_PARODD 0x06 #define UCHCOM_LCR2_PARMARK 0x05 @@ -150,12 +159,18 @@ SYSCTL_INT(_hw_usb_uchcom, OID_AUTO, debug, CTLFLAG_RWTUN, #define UCHCOM_INTR_STAT2 0x03 #define UCHCOM_INTR_LEAST 4 -#define UCHCOM_BULK_BUF_SIZE 1024 /* bytes */ +#define UCHCOM_T 0x08 +#define UCHCOM_CL 0x04 +#define UCHCOM_CH343_CT 0x80 +#define UCHCOM_CT 0x90 + +#define UCHCOM_BULK_BUF_SIZE 1024 /* bytes */ + +#define TYPE_CH343 1 enum { UCHCOM_BULK_DT_WR, UCHCOM_BULK_DT_RD, - UCHCOM_INTR_DT_RD, UCHCOM_N_TRANSFER, }; @@ -164,6 +179,7 @@ struct uchcom_softc { struct ucom_softc sc_ucom; struct usb_xfer *sc_xfer[UCHCOM_N_TRANSFER]; + struct usb_xfer *sc_intr_xfer; /* Interrupt endpoint */ struct usb_device *sc_udev; struct mtx sc_mtx; @@ -171,39 +187,19 @@ struct uchcom_softc { uint8_t sc_rts; /* local copy */ uint8_t sc_version; uint8_t sc_msr; - uint8_t sc_lsr; /* local status register */ -}; - -struct uchcom_divider { - uint8_t dv_prescaler; - uint8_t dv_div; - uint8_t dv_mod; -}; - -struct uchcom_divider_record { - uint32_t dvr_high; - uint32_t dvr_low; - uint32_t dvr_base_clock; - struct uchcom_divider dvr_divider; -}; - -static const struct uchcom_divider_record dividers[] = -{ - {307200, 307200, UCHCOM_BASE_UNKNOWN, {7, 0xD9, 0}}, - {921600, 921600, UCHCOM_BASE_UNKNOWN, {7, 0xF3, 0}}, - {2999999, 23530, 6000000, {3, 0, 0}}, - {23529, 2942, 750000, {2, 0, 0}}, - {2941, 368, 93750, {1, 0, 0}}, - {367, 1, 11719, {0, 0, 0}}, + uint8_t sc_lsr; /* local status register */ + uint8_t sc_chiptype; /* type of chip */ + uint8_t sc_ctrl_iface_no; + uint8_t sc_iface_index; }; -#define NUM_DIVIDERS nitems(dividers) - static const STRUCT_USB_HOST_ID uchcom_devs[] = { {USB_VPI(USB_VENDOR_WCH, USB_PRODUCT_WCH_CH341SER, 0)}, {USB_VPI(USB_VENDOR_WCH2, USB_PRODUCT_WCH2_CH341SER, 0)}, {USB_VPI(USB_VENDOR_WCH2, USB_PRODUCT_WCH2_CH341SER_2, 0)}, {USB_VPI(USB_VENDOR_WCH2, USB_PRODUCT_WCH2_CH341SER_3, 0)}, + {USB_VPI(USB_VENDOR_WCH2, USB_PRODUCT_WCH2_CH343SER, 0)}, + {USB_VPI(USB_VENDOR_WCH2, USB_PRODUCT_WCH2_CH9102SER, 0)}, }; /* protypes */ @@ -225,8 +221,9 @@ static void uchcom_update_version(struct uchcom_softc *); static void uchcom_convert_status(struct uchcom_softc *, uint8_t); static void uchcom_update_status(struct uchcom_softc *); static void uchcom_set_dtr_rts(struct uchcom_softc *); -static int uchcom_calc_divider_settings(struct uchcom_divider *, uint32_t); -static void uchcom_set_baudrate(struct uchcom_softc *, uint32_t); +static void uchcom_calc_baudrate(struct uchcom_softc *, uint32_t, uint8_t *, + uint8_t *); +static void uchcom_set_baudrate(struct uchcom_softc *, uint32_t, uint16_t); static void uchcom_poll(struct ucom_softc *ucom); static device_probe_t uchcom_probe; @@ -244,7 +241,7 @@ static const struct usb_config uchcom_config_data[UCHCOM_N_TRANSFER] = { .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = UCHCOM_BULK_BUF_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .flags = {.pipe_bof = 1,}, .callback = &uchcom_write_callback, }, @@ -256,8 +253,10 @@ static const struct usb_config uchcom_config_data[UCHCOM_N_TRANSFER] = { .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, .callback = &uchcom_read_callback, }, +}; - [UCHCOM_INTR_DT_RD] = { +static const struct usb_config uchcom_intr_config_data[1] = { + [0] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -311,8 +310,9 @@ uchcom_attach(device_t dev) { struct uchcom_softc *sc = device_get_softc(dev); struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usb_interface *iface; + struct usb_interface_descriptor *id; int error; - uint8_t iface_index; DPRINTFN(11, "\n"); @@ -330,20 +330,49 @@ uchcom_attach(device_t dev) case USB_PRODUCT_WCH2_CH341SER_3: device_printf(dev, "CH341 detected\n"); break; + case USB_PRODUCT_WCH2_CH343SER: + device_printf(dev, "CH343 detected\n"); + break; + case USB_PRODUCT_WCH2_CH9102SER: + device_printf(dev, "CH9102 detected\n"); + break; default: - device_printf(dev, "New CH340/CH341 product 0x%04x detected\n", - uaa->info.idProduct); + device_printf(dev, "New CH340/CH341/CH343/CH9102 product " + "0x%04x detected\n", uaa->info.idProduct); break; } - iface_index = UCHCOM_IFACE_INDEX; - error = usbd_transfer_setup(uaa->device, - &iface_index, sc->sc_xfer, uchcom_config_data, - UCHCOM_N_TRANSFER, sc, &sc->sc_mtx); + /* CH343/CH9102 has two interfaces. */ + sc->sc_ctrl_iface_no = uaa->info.bIfaceNum; + iface = usbd_get_iface(uaa->device, UCHCOM_SECOND_IFACE_INDEX); + if (iface) { + id = usbd_get_interface_descriptor(iface); + if (id == NULL) { + device_printf(dev, "no interface descriptor\n"); + goto detach; + } + sc->sc_iface_index = UCHCOM_SECOND_IFACE_INDEX; + usbd_set_parent_iface(uaa->device, UCHCOM_SECOND_IFACE_INDEX, + uaa->info.bIfaceIndex); + sc->sc_chiptype = TYPE_CH343; + } else { + sc->sc_iface_index = UCHCOM_IFACE_INDEX; + } + + /* Setup all transfers. */ + error = usbd_transfer_setup(uaa->device, &sc->sc_iface_index, + sc->sc_xfer, uchcom_config_data, UCHCOM_N_TRANSFER, sc, + &sc->sc_mtx); + if (error) { + device_printf(dev, "could not allocate all pipes\n"); + goto detach; + } + error = usbd_transfer_setup(uaa->device, &sc->sc_ctrl_iface_no, + &sc->sc_intr_xfer, uchcom_intr_config_data, 1, sc, &sc->sc_mtx); if (error) { - DPRINTF("one or more missing USB endpoints, " - "error=%s\n", usbd_errstr(error)); + device_printf(dev, "allocating USB transfers failed for " + "interrupt\n"); goto detach; } @@ -449,7 +478,9 @@ uchcom_write_reg(struct uchcom_softc *sc, (unsigned)reg1, (unsigned)val1, (unsigned)reg2, (unsigned)val2); uchcom_ctrl_write( - sc, UCHCOM_REQ_WRITE_REG, + sc, + (sc->sc_chiptype != TYPE_CH343) ? + UCHCOM_REQ_WRITE_REG : UCHCOM_REQ_CH343_WRITE_REG, reg1 | ((uint16_t)reg2 << 8), val1 | ((uint16_t)val2 << 8)); } @@ -516,9 +547,6 @@ uchcom_update_version(struct uchcom_softc *sc) static void uchcom_convert_status(struct uchcom_softc *sc, uint8_t cur) { - sc->sc_dtr = !(cur & UCHCOM_DTR_MASK); - sc->sc_rts = !(cur & UCHCOM_RTS_MASK); - cur = ~cur & 0x0F; sc->sc_msr = (cur << 4) | ((sc->sc_msr >> 4) ^ cur); } @@ -555,78 +583,69 @@ uchcom_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) uint8_t brk1; uint8_t brk2; - uchcom_read_reg(sc, UCHCOM_REG_BREAK1, &brk1, UCHCOM_REG_LCR1, &brk2); - if (onoff) { - /* on - clear bits */ - brk1 &= ~UCHCOM_BRK_MASK; - brk2 &= ~UCHCOM_LCR1_TX; + if (sc->sc_chiptype == TYPE_CH343) { + brk1 = UCHCOM_CH343_BRK_MASK; + if (!onoff) + brk1 |= UCHCOM_ABRK_MASK; + uchcom_write_reg(sc, brk1, 0, 0, 0); } else { - /* off - set bits */ - brk1 |= UCHCOM_BRK_MASK; - brk2 |= UCHCOM_LCR1_TX; + uchcom_read_reg(sc, UCHCOM_REG_BREAK1, &brk1, UCHCOM_REG_LCR1, + &brk2); + if (onoff) { + /* on - clear bits */ + brk1 &= ~UCHCOM_BRK_MASK; + brk2 &= ~UCHCOM_LCR1_TX; + } else { + /* off - set bits */ + brk1 |= UCHCOM_BRK_MASK; + brk2 |= UCHCOM_LCR1_TX; + } + uchcom_write_reg(sc, UCHCOM_REG_BREAK1, brk1, UCHCOM_REG_LCR1, + brk2); } - uchcom_write_reg(sc, UCHCOM_REG_BREAK1, brk1, UCHCOM_REG_LCR1, brk2); } -static int -uchcom_calc_divider_settings(struct uchcom_divider *dp, uint32_t rate) -{ - const struct uchcom_divider_record *rp; - uint32_t div; - uint32_t rem; - uint32_t mod; - uint8_t i; - - /* find record */ - for (i = 0; i != NUM_DIVIDERS; i++) { - if (dividers[i].dvr_high >= rate && - dividers[i].dvr_low <= rate) { - rp = ÷rs[i]; - goto found; - } - } - return (-1); - -found: - dp->dv_prescaler = rp->dvr_divider.dv_prescaler; - if (rp->dvr_base_clock == UCHCOM_BASE_UNKNOWN) - dp->dv_div = rp->dvr_divider.dv_div; - else { - div = rp->dvr_base_clock / rate; - rem = rp->dvr_base_clock % rate; - if (div == 0 || div >= 0xFF) - return (-1); - if ((rem << 1) >= rate) - div += 1; - dp->dv_div = (uint8_t)-div; +static void +uchcom_calc_baudrate(struct uchcom_softc *sc, uint32_t rate, uint8_t *divisor, + uint8_t *factor) +{ + uint32_t clk = 12000000; + + if (rate >= 256000 && sc->sc_chiptype == TYPE_CH343) + *divisor = 7; + else if (rate > 23529) { + clk /= 2; + *divisor = 3; + } else if (rate > 2941) { + clk /= 16; + *divisor = 2; + } else if (rate > 367) { + clk /= 128; + *divisor = 1; + } else { + clk = 11719; + *divisor = 0; } - mod = (UCHCOM_BPS_MOD_BASE / rate) + UCHCOM_BPS_MOD_BASE_OFS; - mod = mod + (mod / 2); + *factor = 256 - clk / rate; - dp->dv_mod = (mod + 0xFF) / 0x100; - - return (0); + if (rate == 921600 && sc->sc_chiptype != TYPE_CH343) { + *divisor = 7; + *factor = 243; + } } static void -uchcom_set_baudrate(struct uchcom_softc *sc, uint32_t rate) +uchcom_set_baudrate(struct uchcom_softc *sc, uint32_t rate, uint16_t lcr) { - struct uchcom_divider dv; + uint16_t idx; + uint8_t factor, div; - if (uchcom_calc_divider_settings(&dv, rate)) - return; + uchcom_calc_baudrate(sc, rate, &div, &factor); + div |= (sc->sc_chiptype != TYPE_CH343) ? 0x80 : 0x00; + idx = (factor << 8) | div; - /* - * According to linux code we need to set bit 7 of UCHCOM_REG_BPS_PRE, - * otherwise the chip will buffer data. - */ - uchcom_write_reg(sc, - UCHCOM_REG_BPS_PRE, dv.dv_prescaler | 0x80, - UCHCOM_REG_BPS_DIV, dv.dv_div); - uchcom_write_reg(sc, - UCHCOM_REG_BPS_MOD, dv.dv_mod, - UCHCOM_REG_BPS_PAD, 0); + uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, lcr, idx); } /* ---------------------------------------------------------------------- @@ -673,6 +692,14 @@ uchcom_cfg_open(struct ucom_softc *ucom) DPRINTF("\n"); + if (sc->sc_chiptype != TYPE_CH343) { + /* Set default configuration. */ + uchcom_get_version(sc, NULL); + uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, 0, 0); + uchcom_write_reg(sc, UCHCOM_REG_BPS_PRE, 0x82, + UCHCOM_REG_BPS_DIV, 0xd9); + uchcom_write_reg(sc, 0x2c, 0x07, UCHCOM_REG_BPS_PAD, 0); + } uchcom_update_version(sc); uchcom_update_status(sc); } @@ -680,53 +707,69 @@ uchcom_cfg_open(struct ucom_softc *ucom) static int uchcom_pre_param(struct ucom_softc *ucom, struct termios *t) { - struct uchcom_divider dv; + struct uchcom_softc *sc = ucom->sc_parent; - switch (t->c_cflag & CSIZE) { - case CS8: + /* + * Check requested baud rate. + * The CH340/CH341 can set any baud rate up to 2Mb. + * The CH9102/CH343 can set any baud rate up to 6Mb. + */ + switch (sc->sc_chiptype) { + case TYPE_CH343: + if (t->c_ospeed <= 6000000) + return (0); break; default: - return (EIO); + if (t->c_ospeed <= 2000000) + return (0); + break; } - if ((t->c_cflag & CSTOPB) != 0) - return (EIO); - if ((t->c_cflag & PARENB) != 0) - return (EIO); - if (uchcom_calc_divider_settings(&dv, t->c_ospeed)) { - return (EIO); - } - return (0); /* success */ + return (EIO); } static void uchcom_cfg_param(struct ucom_softc *ucom, struct termios *t) { struct uchcom_softc *sc = ucom->sc_parent; + uint8_t lcr; - uchcom_get_version(sc, NULL); - uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, 0, 0); - uchcom_set_baudrate(sc, t->c_ospeed); - if (sc->sc_version < UCHCOM_VER_30) { - uchcom_read_reg(sc, UCHCOM_REG_LCR1, NULL, - UCHCOM_REG_LCR2, NULL); - uchcom_write_reg(sc, UCHCOM_REG_LCR1, 0x50, - UCHCOM_REG_LCR2, 0x00); - } else { - /* - * Set up line control: - * - enable transmit and receive - * - set 8n1 mode - * To do: support other sizes, parity, stop bits. - */ - uchcom_write_reg(sc, - UCHCOM_REG_LCR1, - UCHCOM_LCR1_RX | UCHCOM_LCR1_TX | UCHCOM_LCR1_CS8, - UCHCOM_REG_LCR2, 0x00); + lcr = UCHCOM_LCR1_RX | UCHCOM_LCR1_TX; + + if (t->c_cflag & CSTOPB) + lcr |= UCHCOM_LCR1_STOPB; + + if (t->c_cflag & PARENB) { + lcr |= UCHCOM_LCR1_PARENB; + if (t->c_cflag & PARODD) + lcr |= UCHCOM_LCR1_PARODD; + else + lcr |= UCHCOM_LCR1_PAREVEN; } - uchcom_update_status(sc); - uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, 0x501f, 0xd90a); - uchcom_set_baudrate(sc, t->c_ospeed); + + switch (t->c_cflag & CSIZE) { + case CS5: + lcr |= UCHCOM_LCR1_CS5; + break; + case CS6: + lcr |= UCHCOM_LCR1_CS6; + break; + case CS7: + lcr |= UCHCOM_LCR1_CS7; + break; + case CS8: + default: + lcr |= UCHCOM_LCR1_CS8; + break; + } + + if (sc->sc_chiptype == TYPE_CH343) + uchcom_set_baudrate(sc, t->c_ospeed, + UCHCOM_T | UCHCOM_CL | UCHCOM_CH343_CT | lcr << 8); + else + uchcom_set_baudrate(sc, t->c_ospeed, + UCHCOM_T | UCHCOM_CL | UCHCOM_CT | lcr << 8); + uchcom_set_dtr_rts(sc); uchcom_update_status(sc); } @@ -737,7 +780,7 @@ uchcom_start_read(struct ucom_softc *ucom) struct uchcom_softc *sc = ucom->sc_parent; /* start interrupt endpoint */ - usbd_transfer_start(sc->sc_xfer[UCHCOM_INTR_DT_RD]); + usbd_transfer_start(sc->sc_intr_xfer); /* start read endpoint */ usbd_transfer_start(sc->sc_xfer[UCHCOM_BULK_DT_RD]); @@ -749,7 +792,7 @@ uchcom_stop_read(struct ucom_softc *ucom) struct uchcom_softc *sc = ucom->sc_parent; /* stop interrupt endpoint */ - usbd_transfer_stop(sc->sc_xfer[UCHCOM_INTR_DT_RD]); + usbd_transfer_stop(sc->sc_intr_xfer); /* stop read endpoint */ usbd_transfer_stop(sc->sc_xfer[UCHCOM_BULK_DT_RD]); @@ -779,7 +822,8 @@ uchcom_intr_callback(struct usb_xfer *xfer, usb_error_t error) { struct uchcom_softc *sc = usbd_xfer_softc(xfer); struct usb_page_cache *pc; - uint8_t buf[UCHCOM_INTR_LEAST]; + uint32_t intrstat; + uint8_t buf[16]; int actlen; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); @@ -791,13 +835,12 @@ uchcom_intr_callback(struct usb_xfer *xfer, usb_error_t error) if (actlen >= UCHCOM_INTR_LEAST) { pc = usbd_xfer_get_frame(xfer, 0); - usbd_copy_out(pc, 0, buf, UCHCOM_INTR_LEAST); + usbd_copy_out(pc, 0, buf, sizeof(buf)); - DPRINTF("data = 0x%02X 0x%02X 0x%02X 0x%02X\n", - (unsigned)buf[0], (unsigned)buf[1], - (unsigned)buf[2], (unsigned)buf[3]); + intrstat = (sc->sc_chiptype == TYPE_CH343) ? + actlen - 1 : UCHCOM_INTR_STAT1; - uchcom_convert_status(sc, buf[UCHCOM_INTR_STAT1]); + uchcom_convert_status(sc, buf[intrstat]); ucom_status_change(&sc->sc_ucom); } case USB_ST_SETUP: diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 856ff526fa45..a7519c1e7fe5 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -4976,9 +4976,11 @@ product WAVESENSE JAZZ 0xaaaa Jazz blood glucose meter product WCH CH341SER 0x5523 CH341/CH340 USB-Serial Bridge product WCH2 DUMMY 0x0000 Dummy product product WCH2 CH341SER_2 0x5523 CH341/CH340 USB-Serial Bridge +product WCH2 CH343SER 0x55d3 CH343 USB Serial +product WCH2 CH9102SER 0x55d4 CH9102 USB Serial product WCH2 CH341SER_3 0x7522 CH341/CH340 USB-Serial Bridge product WCH2 CH341SER 0x7523 CH341/CH340 USB-Serial Bridge -product WCH2 U2M 0X752d CH345 USB2.0-MIDI +product WCH2 U2M 0x752d CH345 USB2.0-MIDI /* West Mountain Radio products */ product WESTMOUNTAIN RIGBLASTER_ADVANTAGE 0x0003 RIGblaster Advantage From nobody Thu Jul 3 05:57:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXmJ242fvz61WrP; Thu, 03 Jul 2025 05:57: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXmJ23CPBz40tM; Thu, 03 Jul 2025 05:57:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751522242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XMcudc1S9Dn32AvtdQDB7Qz33QOyqW78DdbnKc7e35E=; b=NuRpssOVzIVfKvXN8mbpr20ZZv0t+hJKB6im0UYfbvBylGgfTXaDlCTXRg/md1OhGcvuhp wcjFlAmv6q20BawI+Bnsh3xdOJKSWfiQkyE2W4Krj2P5SmmsQdHIM/8VES/H7tChm+uXz2 82jjR/bag0x848QuKIjCuQydRsVTdppF+iiM7dE942s/R5rTDBW79/IY4Qz++wTHnAPiLn Ei80/8l5d0gl+amt4qDVTYAJNAxW2juryNxoywLYB0RVGsWw4t0Y0ULlXVv1Txb57aLmMf 0RjBkfCKe4xyt00knX0WAuN39zeGBFng/K1nMNMCVWyAokrTsF7E8ngcJn5Srw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751522242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XMcudc1S9Dn32AvtdQDB7Qz33QOyqW78DdbnKc7e35E=; b=q030NqeO1cZPoAQApeWC84EPoGTRTRmYvj5ViYnjWqUYeK5T53q+TYL+aSW3jrxUFpL276 9t+pXJrRe8FACSfxF5CvYGkywDEbREonSjW6APjYAnpgbsDuqRBaFsX1eHP8I76Tfwwlfh gNlUYDVfUdD1pbT8b+lI4/yhR8tIyghQz4GXKXght4JFobil+Dky1iuIbFFLqLipioA1ko iqDNbIOCHq7HxUWBbma44xDHfWFNT3jkK+4dBve4o5WVLzN2T9Mb9kGkfrkFjqMxdy75N8 KCN7Bf3H+sSJs0myreWrwpA0PjeUk4jrOuN2DKDPbx93dD33QrzPeJft9RRoLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751522242; a=rsa-sha256; cv=none; b=hqkz+cr+FY/adyRMLYy4luVQJswpR0vVQl/WEn5gSb7bRvfgycS0BC7d5BBZoouVqbTgw6 hLXcFyaHFFXuYDYs/3ebfKU9pjuNO/68hFziclmkDsfXSZzp2kK6oGQH9L9Fa63S1ZwB4j ZSaZaGkaqMj8CPkhV41ZuAjzBiL8HdPLCt++rrZjN3q8K+nO3eqRrom7lHal3n92cnbOUp scUTC+jPysUa6MGK2VcH7h8gwFAukHHZ2c0O9P8gnsT3QFVwAY+EgPiL7sIfzfYvjSUigq XP71NmU1wcHbr1PhJfyTHKoPrqteKLow/GMigyFby6K4YHqmOgPxeXAq3uLsZg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXmJ22hPgzsdY; Thu, 03 Jul 2025 05:57:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5635vMQr060846; Thu, 3 Jul 2025 05:57:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5635vMNc060843; Thu, 3 Jul 2025 05:57:22 GMT (envelope-from git) Date: Thu, 3 Jul 2025 05:57:22 GMT Message-Id: <202507030557.5635vMNc060843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: ShengYi Hung Subject: git: 449ade254c87 - main - committers-src: add myself (aokblast@) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: aokblast X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 449ade254c8709c238c649c5ca94ddac16cd4533 Auto-Submitted: auto-generated The branch main has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=449ade254c8709c238c649c5ca94ddac16cd4533 commit 449ade254c8709c238c649c5ca94ddac16cd4533 Author: ShengYi Hung AuthorDate: 2025-07-02 13:53:53 +0000 Commit: ShengYi Hung CommitDate: 2025-07-03 05:57:00 +0000 committers-src: add myself (aokblast@) Add myself (aokblast@) as a new src committer with lwhsu@ and markj@ as my mentor. Accepted By: markj (mentor), lwhsu (mentor) Differential Revision: https://reviews.freebsd.org/D51130 --- share/misc/committers-src.dot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/misc/committers-src.dot b/share/misc/committers-src.dot index 60ef52278a53..313f40ad8e51 100644 --- a/share/misc/committers-src.dot +++ b/share/misc/committers-src.dot @@ -114,6 +114,7 @@ andre [label="Andre Oppermann\nandre@FreeBSD.org\n2003/11/12"] andreast [label="Andreas Tobler\nandreast@FreeBSD.org\n2010/09/05"] andrew [label="Andrew Turner\nandrew@FreeBSD.org\n2010/07/19"] antoine [label="Antoine Brodin\nantoine@FreeBSD.org\n2008/02/03"] +aokblast [label="ShengYi Hung\naokblast@FreeBSD.org\n2025/07/02"] araujo [label="Marcelo Araujo\naraujo@FreeBSD.org\n2015/08/04"] arichardson [label="Alex Richardson\narichardson@FreeBSD.org\n2017/10/30"] ariff [label="Ariff Abdullah\nariff@FreeBSD.org\n2005/11/14"] @@ -764,6 +765,7 @@ kp -> nick kp -> rcm kp -> zlei +lwhsu -> aokblast lwhsu -> khng manu -> corvink @@ -777,6 +779,7 @@ marcel -> nwhitehorn marcel -> sjg markj -> "0mp" +markj -> aokblast markj -> bnovkov markj -> cem markj -> christos From nobody Thu Jul 3 12:01:06 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMk37Z8z60qfH; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMk2JMmz3mhY; Thu, 03 Jul 2025 12:01:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OMBBaThflXBKb2khJQ+wQodQWbMPfSmXin+uF/ZEygI=; b=T3MDDb6a7LC9J5afemPBMBV7XgFig5zUE7AP8LpzbQ6rSlrw9kmlqD1C+TdmiFMYTma1Oj FF4giLHkxCHsMUIYCzVk8ZXGpY+1FPoewLX3x5ybTEmO26EId//wJgZB315kuAyQDkOQV0 oSD5ESt/BSn+TUMV1oU1G8/ik4BvXY4METxhEctlpYt1pvfjsT9ZgrT/FG9LOdX504yJWD +sYYJ5xkmIJYI+6fDm8cH3xY8EUQfcOqkayMRcc2QwhvOT5d82J8LZ2DbjUQoq/OHNo983 ZKx1Uxkjpr5y1Kw1sGRAKeC23jr7jXSzv5Xv4Yt+HO5VyMgwvxGEsA3Ndnleeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OMBBaThflXBKb2khJQ+wQodQWbMPfSmXin+uF/ZEygI=; b=FowVt0BRcN5g6iHlzqQTVmor44LO/XVOethNPtESukMxGzrrPy9SuRo8qgN8eLQNaJrNZe CDdj3QeGn1XynJX/Oe3BPJrrbkUZENMho6BIfmh9tBDALVTsHY1IX8pd/Nb3p0lSfc0/k/ JFHVhh/Cqzf5Wi76xhl1rulnxm/661MYKaxVDF0eQUdit9L1wH9bZDfJhS/9wemtN6Q1NW FlF7xV5AEccgdFZibz3hbhkCZlq+sXlZWrZU1qpIAcsZHEZH7+cNVWSRDYe39mSDRIcSig XUwrofM3gcpbqM9egxm5SvBT0kpNGkhqAUnyC+gya3VIjgNzlEMvDglbqA5lxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544066; a=rsa-sha256; cv=none; b=cHOoFg5fKBwjgBvhFlg3DKQvoc+8ZYhh/0w2tg+8GkVcJ5e1Hsj2povX+vzQqV+1objwS4 lGq2D4XjwfgsL6aOnWJJi6Z3dUxHgx5+w1LXA1sIPhkMHXmq53xnUzMLDFImlWLANfKZ/U SZUZtWAsKn9yPyPK7SKcPKh1tng+vEpjW/Y2gWb0dxQK5zj9R21N9vPHgb70FdKU10acVf Vr16JkbxmYuCdqPV3plZsBukiC+ajt2nBfJPnHirAbhBlsC0fCdtpSN+rWvEAvJmEcUIf1 lEuO0FducAsUIVFUFyPo30KkKJQ+2dQHRvKfwr/groYrl64SL4Y4MEVso1bWOg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMk1hdhz13vL; Thu, 03 Jul 2025 12:01:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C16Hj051911; Thu, 3 Jul 2025 12:01:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C16Qq051908; Thu, 3 Jul 2025 12:01:06 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:06 GMT Message-Id: <202507031201.563C16Qq051908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 3092ea37de7d - main - pfctl: Introduce copy_satopfaddr() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3092ea37de7db89a253ed35cfd225e538916beb5 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3092ea37de7db89a253ed35cfd225e538916beb5 commit 3092ea37de7db89a253ed35cfd225e538916beb5 Author: Kristof Provost AuthorDate: 2025-06-27 14:52:45 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:13 +0000 pfctl: Introduce copy_satopfaddr() Move the same dance around v4/v6 for copying IP addresses from sockaddr into pf_addr to avoid duplicate code and improve readability. Feedback and OK bluhm Obtained from: OpenBSD, kn , 675ff33b8c Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 76 ++++++++++++++++------------------------------- 1 file changed, 26 insertions(+), 50 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 6b47d75f77f3..244531ead280 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -66,6 +66,7 @@ #include "pfctl_parser.h" #include "pfctl.h" +void copy_satopfaddr(struct pf_addr *, struct sockaddr *); void print_op (u_int8_t, const char *, const char *); void print_port (u_int8_t, u_int16_t, u_int16_t, const char *, int); void print_ugid (u_int8_t, unsigned, unsigned, const char *, unsigned); @@ -229,6 +230,15 @@ pfctl_parser_init(void) err(1, "Failed to create interface group query response map"); } +void +copy_satopfaddr(struct pf_addr *pfa, struct sockaddr *sa) +{ + if (sa->sa_family == AF_INET6) + pfa->v6 = ((struct sockaddr_in6 *)sa)->sin6_addr; + else + pfa->v4 = ((struct sockaddr_in *)sa)->sin_addr; +} + const struct icmptypeent * geticmptypebynumber(u_int8_t type, sa_family_t af) { @@ -1502,42 +1512,20 @@ ifa_load(void) } #endif n->ifindex = 0; - if (n->af == AF_INET) { - memcpy(&n->addr.v.a.addr, &((struct sockaddr_in *) - ifa->ifa_addr)->sin_addr.s_addr, - sizeof(struct in_addr)); - memcpy(&n->addr.v.a.mask, &((struct sockaddr_in *) - ifa->ifa_netmask)->sin_addr.s_addr, - sizeof(struct in_addr)); - if (ifa->ifa_broadaddr != NULL) - memcpy(&n->bcast, &((struct sockaddr_in *) - ifa->ifa_broadaddr)->sin_addr.s_addr, - sizeof(struct in_addr)); - if (ifa->ifa_dstaddr != NULL) - memcpy(&n->peer, &((struct sockaddr_in *) - ifa->ifa_dstaddr)->sin_addr.s_addr, - sizeof(struct in_addr)); - } else if (n->af == AF_INET6) { - memcpy(&n->addr.v.a.addr, &((struct sockaddr_in6 *) - ifa->ifa_addr)->sin6_addr.s6_addr, - sizeof(struct in6_addr)); - memcpy(&n->addr.v.a.mask, &((struct sockaddr_in6 *) - ifa->ifa_netmask)->sin6_addr.s6_addr, - sizeof(struct in6_addr)); - if (ifa->ifa_broadaddr != NULL) - memcpy(&n->bcast, &((struct sockaddr_in6 *) - ifa->ifa_broadaddr)->sin6_addr.s6_addr, - sizeof(struct in6_addr)); - if (ifa->ifa_dstaddr != NULL) - memcpy(&n->peer, &((struct sockaddr_in6 *) - ifa->ifa_dstaddr)->sin6_addr.s6_addr, - sizeof(struct in6_addr)); - n->ifindex = ((struct sockaddr_in6 *) - ifa->ifa_addr)->sin6_scope_id; - } else if (n->af == AF_LINK) { - ifa_add_groups_to_map(ifa->ifa_name); + if (n->af == AF_LINK) { n->ifindex = ((struct sockaddr_dl *) ifa->ifa_addr)->sdl_index; + ifa_add_groups_to_map(ifa->ifa_name); + } else { + copy_satopfaddr(&n->addr.v.a.addr, ifa->ifa_addr); + copy_satopfaddr(&n->addr.v.a.mask, ifa->ifa_netmask); + if (ifa->ifa_broadaddr != NULL) + copy_satopfaddr(&n->bcast, ifa->ifa_broadaddr); + if (ifa->ifa_dstaddr != NULL) + copy_satopfaddr(&n->peer, ifa->ifa_dstaddr); + if (n->af == AF_INET6) + n->ifindex = ((struct sockaddr_in6 *) + ifa->ifa_addr) ->sin6_scope_id; } if ((n->ifname = strdup(ifa->ifa_name)) == NULL) err(1, "%s: strdup", __func__); @@ -1918,9 +1906,7 @@ host_v6(const char *s, int mask) err(1, "address: calloc"); h->ifname = NULL; h->af = AF_INET6; - memcpy(&h->addr.v.a.addr, - &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, - sizeof(h->addr.v.a.addr)); + copy_satopfaddr(&h->addr.v.a.addr, res->ai_addr); h->ifindex = ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id; set_ipmask(h, mask); @@ -1974,20 +1960,10 @@ host_dns(const char *s, int mask, int numeric) err(1, "host_dns: calloc"); n->ifname = NULL; n->af = res->ai_family; - if (res->ai_family == AF_INET) { - memcpy(&n->addr.v.a.addr, - &((struct sockaddr_in *) - res->ai_addr)->sin_addr.s_addr, - sizeof(struct in_addr)); - } else { - memcpy(&n->addr.v.a.addr, - &((struct sockaddr_in6 *) - res->ai_addr)->sin6_addr.s6_addr, - sizeof(struct in6_addr)); + copy_satopfaddr(&n->addr.v.a.addr, res->ai_addr); + if (res->ai_family == AF_INET6) n->ifindex = - ((struct sockaddr_in6 *) - res->ai_addr)->sin6_scope_id; - } + ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id; set_ipmask(n, mask); n->next = NULL; n->tail = n; From nobody Thu Jul 3 12:01:07 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMl4kK6z60qXS; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMl33k7z3mcJ; Thu, 03 Jul 2025 12:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kg0Kpa7dZCOJoN+eAuHRH5nCf6gdKncX6thDHR9aH1g=; b=kqbBGi7Wz6hr7NChDpROh6ewIVP+00Uq6MjSiyhItOcNfUKVTVJSXd5uSpIqqjFfxGFIXO RJn/HoAkM6Eu0sQZn+gk75hc9xiP5l/WHnT/tIGpVvwg2xXhkr3hPJdZZroOBTcYTbWH9n WQ/ktRNsq5GXQswAYnQfEFbWVz8Td9V4F6ZDUDsqlIRznGm1mPKpS/H+icH8zpqKCDoIXh NRATsHOfL7ROdp8nzqH8d/OXk2pUvf0B6LHidMiG/swmLitHkP56bQUxGrb9b1cegLwKrd aOF3urkw6XLG3Wt92/RTj+LpqJG7Af42Rh8aXF46+2BePQtl2HyXB1TiBRoImQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kg0Kpa7dZCOJoN+eAuHRH5nCf6gdKncX6thDHR9aH1g=; b=ScZMZtx3SILBhjsS+tCrhiLU/gHNDbkvGYVYF740aPUITzOn4h2ECLFbfY8MreYIurQgrF nMfo9HNOzLp6j7to3g2WwoQcv2aC7q1NfXqp5SYMQeQyilCSiecQr7RcKlRfN+dLXSl7DY 6EC2rk0q/DiqKIo1w15KcBmND8ygq02EwzqqjHNr7xImjW/W3Aiee00a8JC3z1LxzL7QYI RZqrkWlh3ZDyW+VnzyFUkYj+qVVB+j3245lcJGyVfCD35vPy9//AVYiv9TsTWTqpQXI4s1 BWItKAgOVXy+R9Fj0pib9PVdBYFTFrklyaoz36aEG8hsOdK4Zqj58uvtIAnASg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544067; a=rsa-sha256; cv=none; b=N6UJvXEIcjrWJBm3gFp96DwGJx3yEdW7K0QJi8LZDoyP43/pjBNZx8bDrtQA/e2WOwx7ay fS0VXeQWMV+InUxufELXUZg+H8BM6NfTBJ2XN64aDIJh29ImK0LFdG9ddM1Ktcf4musG2m JvKrj13y50jEdqCfpD8O2mzLars7nnusWXh3NR5nqJRFhtbuVMrKijzxqQQzexfH+If0BT G+9q+N4XQfcaYXu77V8cTqpCcOYj8oefZHVhL8hm0WYJq5mNS/ktGTbgmBTj0zojd8KVDp 9qSqakVBdjgC0c2r2iMpPZ9+S9vJZJ4OHWZGtP/z4L4avV1vMJymDmKjVZJxoQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMl2XbQz13rn; Thu, 03 Jul 2025 12:01:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C17t5051945; Thu, 3 Jul 2025 12:01:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C17Df051942; Thu, 3 Jul 2025 12:01:07 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:07 GMT Message-Id: <202507031201.563C17Df051942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: cbca60158062 - main - pfctl: Merge host_v{4,6}() into simpler host_ip() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cbca601580626662f03933a617e88c5ff2fc329f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cbca601580626662f03933a617e88c5ff2fc329f commit cbca601580626662f03933a617e88c5ff2fc329f Author: Kristof Provost AuthorDate: 2025-06-27 14:57:57 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:13 +0000 pfctl: Merge host_v{4,6}() into simpler host_ip() Except for networks such as "10/8" host_ip() now handles addresses in an AF-agnostic way with more duplicate code removed/merged. OK sashan (as for earlier copy_satopfaddr() diff) henning Obtained from: OpenBSD, kn , 1b6fdc2f24 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 71 ++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 44 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 244531ead280..8eb9bd1d6f5a 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -76,8 +76,7 @@ void print_fromto(struct pf_rule_addr *, pf_osfp_t, int ifa_skip_if(const char *filter, struct node_host *p); struct node_host *host_if(const char *, int); -struct node_host *host_v4(const char *, int); -struct node_host *host_v6(const char *, int); +struct node_host *host_ip(const char *, int); struct node_host *host_dns(const char *, int, int); const char * const tcpflags = "FSRPAUEWe"; @@ -1805,8 +1804,7 @@ host(const char *s, int opts) err(1, "host: strdup"); } - if ((h = host_v4(s, mask)) == NULL && - (h = host_v6(ps, mask)) == NULL && + if ((h = host_ip(ps, mask)) == NULL && (h = host_if(ps, mask)) == NULL && (h = host_dns(ps, mask, (opts & PF_OPT_NODNS))) == NULL) { fprintf(stderr, "no IP address found for %s\n", s); @@ -1863,57 +1861,42 @@ error: } struct node_host * -host_v4(const char *s, int mask) -{ - struct node_host *h = NULL; - struct in_addr ina; - - memset(&ina, 0, sizeof(ina)); - if (mask > -1) { - if (inet_net_pton(AF_INET, s, &ina, sizeof(ina)) == -1) - return (NULL); - } else { - if (inet_pton(AF_INET, s, &ina) != 1) - return (NULL); - } - - h = calloc(1, sizeof(struct node_host)); - if (h == NULL) - err(1, "address: calloc"); - h->ifname = NULL; - h->af = AF_INET; - h->addr.v.a.addr.addr32[0] = ina.s_addr; - set_ipmask(h, mask); - h->next = NULL; - h->tail = h; - - return (h); -} - -struct node_host * -host_v6(const char *s, int mask) +host_ip(const char *s, int mask) { struct addrinfo hints, *res; struct node_host *h = NULL; memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_INET6; + hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_flags = AI_NUMERICHOST; - if (getaddrinfo(s, "0", &hints, &res) == 0) { - h = calloc(1, sizeof(struct node_host)); + if (getaddrinfo(s, NULL, &hints, &res) == 0) { + h = calloc(1, sizeof(*h)); if (h == NULL) - err(1, "address: calloc"); - h->ifname = NULL; - h->af = AF_INET6; + err(1, "%s: calloc", __func__); + h->af = res->ai_family; copy_satopfaddr(&h->addr.v.a.addr, res->ai_addr); - h->ifindex = - ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id; - set_ipmask(h, mask); + if (h->af == AF_INET6) + h->ifindex = + ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id; freeaddrinfo(res); - h->next = NULL; - h->tail = h; + } else { /* ie. for 10/8 parsing */ + if (mask == -1) + return (NULL); + h = calloc(1, sizeof(*h)); + if (h == NULL) + err(1, "%s: calloc", __func__); + h->af = AF_INET; + if (inet_net_pton(AF_INET, s, &h->addr.v.a.addr.v4, + sizeof(h->addr.v.a.addr.v4)) == -1) { + free(h); + return (NULL); + } } + set_ipmask(h, mask); + h->ifname = NULL; + h->next = NULL; + h->tail = h; return (h); } From nobody Thu Jul 3 12:01:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMm6Ybpz60qxl; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMm3qn0z3mt4; Thu, 03 Jul 2025 12:01:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kKfhZWTzM2swYKn/njcyU9Nk9jB+EiplxzyE9HG31Zc=; b=crFRspBc/4s7YsWo375gL9vUSoJEySWwvYrWZ7c6UvpU++uK7pSmUkO1LAVak5hXPCnJTJ KPI4cmqT28zGTEjiiBDLLgUSFMw51KCNidhHq7W5sdlahu2jrRKALspXqj9aK35dlrnRoH JIrOA/DVMFIjpwseVbUm7krf2zEXXYyhmmEoCpnOyTRNox+TWK3opKPPzha1vH/t4fs3Gi vRFUmX9PEzo8xGl1X6JaOB7t6vB1Ji26++3MxClxUDw3pgQl7Wy/tcv9fiQAyjQW+tHMgA w2CxHtV1RFwJBMtmDkrBJgPHIQB1yIm3jvRIQWqEmAsCcNrtzPZcNu3KK0IV7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kKfhZWTzM2swYKn/njcyU9Nk9jB+EiplxzyE9HG31Zc=; b=TrdwKGhJD+X+yu/KHufSz5ImrM1TvkWWLHdgOmxsHoe+TKQVI3kJfhORGXmBR4mDNUhgQk vT8DAJWppgBsJsJtlnFQLvsRzYNoGotk+BI7NtSlvDiRa2DcX4p+FVo2YJUciWBYc0sCZ3 YOEX74SWxRdpaYqUWSenV71KqNxsMhY3/K7utN9oWHsoF8cQCtfD7AQ6xMvqoljJzMhXHD 0l2tfxwxrGN8BCHXjB3H71SerG5WtRzAF53ubV8GS6KjR27VoOQBxGZxKNIH3kiQFVgIPM K0i9YX3m6vhoqHeBOc0Rt3UpjIyvAABRbN6ZFv0CZvck/J8aR45+Aq75kZTt8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544068; a=rsa-sha256; cv=none; b=A53DOHZOA59oKBZ32Ifr7KJrM6lAKdNw9PGXFgIWpUa3oMF+XXohcQOlapcy4BJXukktbB Suj/MP1c1RlJ4Ah3QTTT0fK82QLuDW4QX95EYRHJjhRLmnxPLbDYXPgxZMB2eb1+Un68Fo yMUJPtIOg2DUtUVBsk38pYCKE9qMMIAFZCpvQpT8CTxGiqsfaKkM6SUSQBQ7O4lEMJsy+f vMgli4f/DORioEkLlCUlQLPwSgiasmLmUIa1TaBFjliBoUSCbrosKXxpqLfNiLQPOpnAIY 3arWLXqhW68HyL0MKuHdkTRVfJHyph/Cs2QthoKe5V2C6r4RyHCSt06vmY9wZw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMm3NsLz13rp; Thu, 03 Jul 2025 12:01:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C181E051978; Thu, 3 Jul 2025 12:01:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C183c051975; Thu, 3 Jul 2025 12:01:08 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:08 GMT Message-Id: <202507031201.563C183c051975@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: da27faa01f27 - main - pfctl: fix parsing of '10/8' List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da27faa01f27dd04915c204782542525d43ab7eb Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=da27faa01f27dd04915c204782542525d43ab7eb commit da27faa01f27dd04915c204782542525d43ab7eb Author: Kristof Provost AuthorDate: 2025-07-01 15:18:20 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:14 +0000 pfctl: fix parsing of '10/8' FreeBSD's getaddrinfo() differs a little from OpenBSD's, and it will resolve '10' to IPv4 address '0.0.0.10', wheres OpenBSD's will just fail. As a result we work out that '10/8' is '0.0.0.0/8', rather than the intended '10.0.0.0/8'. Reverse the order of operations: attempt to parse the address with inet_net_pton() first and only use getaddrinfo() if that fails. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 8eb9bd1d6f5a..cb083bd09344 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1866,33 +1866,33 @@ host_ip(const char *s, int mask) struct addrinfo hints, *res; struct node_host *h = NULL; + h = calloc(1, sizeof(*h)); + if (h == NULL) + err(1, "%s: calloc", __func__); + if (mask != -1) { + /* Try to parse 10/8 */ + h->af = AF_INET; + if (inet_net_pton(AF_INET, s, &h->addr.v.a.addr.v4, + sizeof(h->addr.v.a.addr.v4)) != -1) + goto out; + } + memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_flags = AI_NUMERICHOST; if (getaddrinfo(s, NULL, &hints, &res) == 0) { - h = calloc(1, sizeof(*h)); - if (h == NULL) - err(1, "%s: calloc", __func__); h->af = res->ai_family; copy_satopfaddr(&h->addr.v.a.addr, res->ai_addr); if (h->af == AF_INET6) h->ifindex = ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id; freeaddrinfo(res); - } else { /* ie. for 10/8 parsing */ - if (mask == -1) - return (NULL); - h = calloc(1, sizeof(*h)); - if (h == NULL) - err(1, "%s: calloc", __func__); - h->af = AF_INET; - if (inet_net_pton(AF_INET, s, &h->addr.v.a.addr.v4, - sizeof(h->addr.v.a.addr.v4)) == -1) { - free(h); - return (NULL); - } + } else { + free(h); + return (NULL); } +out: set_ipmask(h, mask); h->ifname = NULL; h->next = NULL; From nobody Thu Jul 3 12:01:09 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMp00gdz60qxm; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMn4Vfyz3mlg; Thu, 03 Jul 2025 12:01:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=90mySGNAPBphBBbaixfmdjBQzFhKo9mwGd6zValUAV4=; b=BjEvMp3kqUi0vb8Up5CzFgPoUrJrJC2H3vT4kp/+OK2BSBNnr/Sx8eAm5iI3Kxto+PvaDE JwabfCLU6ZsWw4x50YILSIL8GErcUUNiXk5tyTBMC58S6btkCkimI5Xbnoo0BRQtXVapcY ngv5GIjjF5tW6P0eq3fGY0CTAfUbinNqf8aaQpJordazeJmXV9o/wk4eyci2+W/Susa8D8 AMaJ2FP+ILZHstrqtQaT07P4EWFYrnJleTaP/ErY+0ilG5XqlqaCJ88NPR/CaHtbuEg5/B EmKBQuXaxA4JGJxmzg6C5FhC+Eum02MpvLim13GEyrr5P09+SrtwuUKtsi/z+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=90mySGNAPBphBBbaixfmdjBQzFhKo9mwGd6zValUAV4=; b=dhdzb7sJW2U/O0EcWfk1M/m4k6ZeG3wVEcpmTnieELgb+MaCcFPrj3VLS8xG4LCKU22Ck/ HgztebnC8vHUpGUMqhyEwO+knDXLxtolTFNvQdYOTf7D0NCCCRu7ga/pP0DzSICsenK2d/ OhYZzQkNkiVLMRFYK1qL1ssRBflRK/8v4BJlvZuoPNMJtYROKu93htI/xLSHuolNWUp974 VVjXE/V0ZJCrdD6hvJ0QoE1Cd5K21/NtP7GgQR2TPgYwmOlRARdxP/zk3WyBwORIIc3yy+ dJc62gQegedLHStWqfDb+kYuhiDogHepkl4VQHHrgeJVJiJwWyPTt+Iys2HciA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544069; a=rsa-sha256; cv=none; b=ltD0BLCc5ql4VMIIyOJ4Z+y/vkCNuouO7wLDf39+iB9fXYBei6F1tfLmM78lEKEnymB6N+ ClVOA3/epvpjxmbt0s55EZqMVEMm8D6Q+GaKE5j6t/BCOVOxTlpPTH+K/W8pzygf/TuTcw QZm2ms5lDupRzWCTdWw17cg2Ow0x47xLH4yQdfwPo/HejgB0xTvEAx0mWMbTyO3CSYy7KG 066dD2whXG7uRPw0sVvLvqC1aM2iUKDADsex9wH2ZXNDQHJQIgqMU4V1x1nL2NbsI0yZgI LjDJ0DLhWrZMLUQnW7Vz8kNV56r+TWN918aLIbp55mwgUpoUy+c2kk5RH8V2ag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMn42R8z13xW; Thu, 03 Jul 2025 12:01:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C19kK052010; Thu, 3 Jul 2025 12:01:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C19Wu052007; Thu, 3 Jul 2025 12:01:09 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:09 GMT Message-Id: <202507031201.563C19Wu052007@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 467b037a8aab - main - pfctl: use __func__ rather than hardcoding the function name List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 467b037a8aab98083e4fec7b6ccce0f9a533bd2d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=467b037a8aab98083e4fec7b6ccce0f9a533bd2d commit 467b037a8aab98083e4fec7b6ccce0f9a533bd2d Author: Kristof Provost AuthorDate: 2025-06-27 15:05:00 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:14 +0000 pfctl: use __func__ rather than hardcoding the function name Obtained from: OpenBSD, kn , e7f9714dfb Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index cb083bd09344..de3048b27a47 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1797,11 +1797,11 @@ host(const char *s, int opts) goto error; } if ((ps = malloc(strlen(s) - strlen(p) + 1)) == NULL) - err(1, "host: malloc"); + err(1, "%s: malloc", __func__); strlcpy(ps, s, strlen(s) - strlen(p) + 1); } else { if ((ps = strdup(s)) == NULL) - err(1, "host: strdup"); + err(1, "%s: strdup", __func__); } if ((h = host_ip(ps, mask)) == NULL && From nobody Thu Jul 3 12:01:10 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMq2B8Zz60qfN; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMp5tHzz3mnb; Thu, 03 Jul 2025 12:01:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=crqJVJhmsHmleyQeMYyL13ypV2wBswmEt8JSVgFfsgA=; b=VfYn+HgDpHXYN2SlJbVCZs4ewSJR4Hxa/9OBBTIvbagh86/HA60FGwptHJXbKXZQBYNGm5 2e+9ZYOmLNT+dS69qYRUEFD2aSp5lw/yXVK99tzi/6qd08Y2iWpHJ4vs/1l09BX2KiebVZ 5jcH1symrv8JO9GWXPvUfli4+lsTyzHlUpg/bctHYkCpulGA0GZPR0bNiOUFN4LjDffn7Y ay/pLHDy6ZjSSfUFgFuYUT6iW2yf3ktgIBSLJViZB2B5CZ9AKDSylA0na3iAmGMxSaE/Ql tA+Brle9QsW7kxXN5suiH90v2WKj1MUuRSnbt4jYgLuiA9TRXpitGghPUlN2og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=crqJVJhmsHmleyQeMYyL13ypV2wBswmEt8JSVgFfsgA=; b=CGmAW3PaubUbXuYzaXDacrCvKoQSPCAd7YAjHr6M/EFVaaPA0FIjFZLlyilJ2Kb44Dwtvz A5jt28sdfBVoDnVSNkPhpmz7ecgwH9aPfzCrmF+pmzJCZ/PZUi/SEesUEZMOdE2Swwr+b3 5VR6/7ywC+weoYmA7tRb5MfbcLYOxwVs0l7cPMcPj3f+3JNc243wILS0R9ZrhRHs2PWq3L s2NWX3W4P1M22++vf0nE1oUkxzoPydp3G9Zx0fKvuWuL1vSEzHpEDpXDfhksALykgXqq/a nJRvSkrtXNHqSSh2gBDxOHRLBulUUywK47XWonRuiVa7pza7tXB5OTlA/aiDrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544070; a=rsa-sha256; cv=none; b=uENJ2XfZwabbFa2Eddnxm6qHO+OdUBwA7S0KbNcG4jg+rHJfFjz00bWQTRJrjmOyHB5CvX a4eyYvbGHhWNbOXs2nNBiXqKjP9UFifdPIt14XD/jW9xqCiQ4V4i+a/uWUfHMoqY8i18IY u/RtEtT8t3Spg3pA+cF5cbgblKUPFtuvZzYRbs0H+N2cmfqZIyFHbbWSLmA62+ckxsSbHz YzULcNg9rfuDUiLxeQVQpOCWp7AK/U6R2IcnMNDRAk+iPWdRLLamUFqiwWYgK+E8M2LT9A MvTcwrDdk4v+SvQAVpkli0Z7H76JjbchE7NvpD5snUQAwSdtWBprhmunXLz1/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMp5J0bz13rr; Thu, 03 Jul 2025 12:01:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C1A6q052045; Thu, 3 Jul 2025 12:01:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C1Ae9052041; Thu, 3 Jul 2025 12:01:10 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:10 GMT Message-Id: <202507031201.563C1Ae9052041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ad65e2de1852 - main - pfctl tests: verify netmask on dynnode List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad65e2de18529ffc5daca62c31f2688f057eec86 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ad65e2de18529ffc5daca62c31f2688f057eec86 commit ad65e2de18529ffc5daca62c31f2688f057eec86 Author: Kristof Provost AuthorDate: 2025-06-27 15:13:41 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:14 +0000 pfctl tests: verify netmask on dynnode This was broken (in OpenBSD, not FreeBSD) by unmask() refactoring work. Test for this. Based on: OpenBSD, kn , 50befbbe2e Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/tests/files/pf1071.in | 1 + sbin/pfctl/tests/files/pf1071.ok | 1 + sbin/pfctl/tests/pfctl_test_list.inc | 1 + 3 files changed, 3 insertions(+) diff --git a/sbin/pfctl/tests/files/pf1071.in b/sbin/pfctl/tests/files/pf1071.in new file mode 100644 index 000000000000..9e6c2abc0621 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1071.in @@ -0,0 +1 @@ +pass inet from (lo0)/24 diff --git a/sbin/pfctl/tests/files/pf1071.ok b/sbin/pfctl/tests/files/pf1071.ok new file mode 100644 index 000000000000..409b5dc4b068 --- /dev/null +++ b/sbin/pfctl/tests/files/pf1071.ok @@ -0,0 +1 @@ +pass inet from (lo0)/24 to any flags S/SA keep state diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc index f87d8ba6bc73..51729bc9adad 100644 --- a/sbin/pfctl/tests/pfctl_test_list.inc +++ b/sbin/pfctl/tests/pfctl_test_list.inc @@ -179,3 +179,4 @@ PFCTL_TEST_FAIL(1067, "route-to can't be used on block rules") PFCTL_TEST(1068, "max-pkt-rate") PFCTL_TEST(1069, "max-pkt-size") PFCTL_TEST_FAIL(1070, "include line number") +PFCTL_TEST(1071, "mask length on (lo0)") From nobody Thu Jul 3 12:01:11 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMr1HBjz60qXX; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMq6PN7z3mcw; Thu, 03 Jul 2025 12:01:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=djP7JmrHQjTCTNh1zCf0yX7+65FBjGtOnj2M1Oa+SRk=; b=AghRiX8bMSa9nYRJyxVfzqocgqCrC3tLHYVUiG+RNTcsGzaF9jr3w6IPt7gVb0leP15q31 NaYMHX8qzVvEX3CadgCPHfWulbKHjr4071nTant5ujYksuPpulLTqlOIPSEfh8Vy9lfr1d TLxxHWux9cadr/IzOvzeLgdW4Y8a17sgSG7odjTGJHY+lzncSoJSoik0ga9cauoxMoubwl mrla2TFhZgfX6SAIqbdBbcv29Tv3O2o8ziIewXFXim+P6tdEEhnP5e4Jcflu5yU0OpGKqX wMdLeBtZzxfVan/UC//UrBQihbaqe8jOavOki3XZYASnk7XAsVoQsyrx9Zi/bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=djP7JmrHQjTCTNh1zCf0yX7+65FBjGtOnj2M1Oa+SRk=; b=C82DF2BpB5h0GdEvDbU8UT+uahCV01/SjjgoJ9noOcmBW5YIheZ+YhWA3AIHTtbGb4/2Le ayYHhDgwLSRB6qjHqQGovKX/ZC9S5R0bqNv/lpdix35r2bJdR/2rJqYuJ8Ff1jxuafwiys seyqnzmZTEquOdwGdBX7vyBFVrnyWGIgnqRFhrlqZDnYRM58AkJEHpnXIT0kjzY7/Q0fF0 Vcp8rIRY2okWkIE6b6FVAdhJhROZEsmYbG/VGIuXlaJkmUKXrPLjr0L82DoqQ1K8o7Kk2X QGrULLS/55D41yzqhmX01EooWaoKpIGlC9u+vtGlMIXWWBG+goq/CA8UvxR6yg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544071; a=rsa-sha256; cv=none; b=FvHTKWXEBuAN6O3DMSHWFaH7+Mcy7VJT7flYK9J5qFFYKUwN7JTOGNCSjC3/kmfLyHEngQ rm8uhWBaC0sBuScZBzwST91dO+oMnY9NEod6cPHECwDlCl3rBAeSScoa/ZCL07yuKFbIRH 74AzSSVn6b9N6KIMqci7l75Nhd17XT+ndIRLqeQZgBs9u8oGkjCj9Np9QWaMFJ82B0JWr2 vyDQYbdeXPCdG3lmxj9xiyB9H0RBAM6GS38b+cFpLoGtu8lZKLGpOxWFEyxDrdZGKFZJ6x b3iJBZ0ngr9gwcA03uFNCG1XLbW38LTMizvYqEgvcjpgW0aJh1JxnQugypXGww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMq5wfNz13xX; Thu, 03 Jul 2025 12:01:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C1BoJ052081; Thu, 3 Jul 2025 12:01:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C1BMW052078; Thu, 3 Jul 2025 12:01:11 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:11 GMT Message-Id: <202507031201.563C1BMW052078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e98d6da4ddf0 - main - pfctl: Avoid unneeded variable in gen_dynnode() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e98d6da4ddf0c1cd2bec83a27abe7590289632f1 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e98d6da4ddf0c1cd2bec83a27abe7590289632f1 commit e98d6da4ddf0c1cd2bec83a27abe7590289632f1 Author: Kristof Provost AuthorDate: 2025-06-27 15:17:44 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:14 +0000 pfctl: Avoid unneeded variable in gen_dynnode() OK bluhm Obtained from: OpenBSD, kn , 9e1cf8ac88 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index de3048b27a47..dfcf1a7b62a0 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1387,7 +1387,6 @@ struct node_host * gen_dynnode(struct node_host *h, sa_family_t af) { struct node_host *n; - struct pf_addr *m; if (h->addr.type != PF_ADDR_DYNIFTL) return (NULL); @@ -1400,8 +1399,7 @@ gen_dynnode(struct node_host *h, sa_family_t af) n->tail = NULL; /* fix up netmask */ - m = &n->addr.v.a.mask; - if (af == AF_INET && unmask(m) > 32) + if (af == AF_INET && unmask(&n->addr.v.a.mask) > 32) set_ipmask(n, 32); return (n); From nobody Thu Jul 3 12:01:12 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMs3ClXz60qfb; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMs0bbtz3mtr; Thu, 03 Jul 2025 12:01:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iXBBPyjoz+LcFJZdnij9nwzuimhRvIrWO9LZTFMGknM=; b=ic/ADU3S0vFZZ3BhpLW9QWCPDp2VyRl+RS9juauHe2zPeXV5GAAIPMb3oMyzKw9/+qQxRa r4vXydu9Bcv2byq0W4QaWGmOfLX9UJsNR6Oo5w7uEWi7wQxs9Drf//IP0vQmzwDWpbUYi6 T2RaCrMbyVTFoezlohe73ntZ0F8U4K9YWxmZnSxreMxCxkS8W8LOUKH+6b1gAEVIk+zQnr Z6TNEvDXYBlXexVY+T8Qsugv4ghWTePwAjlHr4/3E1rDovKoJTDgfZFWnf3Zzo5y45JSqe 1N8E4PGRx4M290GEItTQ3/nFyGxSFJfpnOptSRHLmGszyAQDTFcHcgcn9tlBmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iXBBPyjoz+LcFJZdnij9nwzuimhRvIrWO9LZTFMGknM=; b=EwEq4b1qaagv3pdLzttEYg6XB2FZeWNa4VqltyBwozrss4PdnOeo5S2Y9huUB8ysKRpvye 0ViJc3ciXxsfa8dfWmkeLS2OdxS6SzdX8dNWA4OQBkC1nbJibJalu4ifaAZgX80kLC05YI zBFVsAc6hZWL8/fIlWlcOZqxvAIH66oKdUjKaD/Jnz5bA78oNtDOzWoa2yz4JtFtU1pPfV e29kYWuLIcfaNsICZgy6TwHC830ejPmSXriTp54wUacHbhiVSwUaaJL02VbgrkHgBwLdm6 YhZVX71hYUSTFjInr1aKa2q1G4r7+Q2dlXqJbiQj4Cosf8eUIfosZgG6CWnJhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544073; a=rsa-sha256; cv=none; b=SIL7mxtrHkeJLo9fWnTW+fheJ4TznSxIfNmqMnK/iaC+kY8VBaDWFagi17ZL45QzN4uKHL zqtW0Be87LqUMTayRgse5mkFiK9ArnYQ0CL2R7cAZNVW2+9U3sQ42Pmp/MRBOIht+eeYdS J65XeOW2mjCIkG0YrlTfSdPF8Sk1On0WsySglDqaH8nfKSVPOtDFQdGxQNOI/XApMTVwg2 4qWrUsPiYZYmFPjo6sjCc4ipb0J6qj6OYQmW8on0N4R+/8MjlB9uIRd+CjLSC4MoG3roAJ Q8B1qbExEBkj75SQl0SuLfBD0CoJ8UA3ZHMY5QUVf6T8GFwQC2rlDL4vF89b1A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMs01mCz13Jn; Thu, 03 Jul 2025 12:01:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C1CnR052115; Thu, 3 Jul 2025 12:01:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C1CEL052112; Thu, 3 Jul 2025 12:01:12 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:12 GMT Message-Id: <202507031201.563C1CEL052112@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 8e4db537c34f - main - pfctl: Use uid_from_user(3) and gid_from_group(3) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e4db537c34fcdea2a14afc84f6bd5ccaa086ddb Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8e4db537c34fcdea2a14afc84f6bd5ccaa086ddb commit 8e4db537c34fcdea2a14afc84f6bd5ccaa086ddb Author: Kristof Provost AuthorDate: 2025-06-30 08:09:22 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:15 +0000 pfctl: Use uid_from_user(3) and gid_from_group(3) in utilities that do repeated lookups. OK tb@ Obtained from: OpenBSD, millert , a0f924b8c9 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index f05e5608ba9d..c939b5ae7cce 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -3926,14 +3926,14 @@ uid : STRING { if (!strcmp($1, "unknown")) $$ = UID_MAX; else { - struct passwd *pw; + uid_t uid; - if ((pw = getpwnam($1)) == NULL) { + if (uid_from_user($1, &uid) == -1) { yyerror("unknown user %s", $1); free($1); YYERROR; } - $$ = pw->pw_uid; + $$ = uid; } free($1); } @@ -4004,14 +4004,14 @@ gid : STRING { if (!strcmp($1, "unknown")) $$ = GID_MAX; else { - struct group *grp; + gid_t gid; - if ((grp = getgrnam($1)) == NULL) { + if (gid_from_group($1, &gid) == -1) { yyerror("unknown group %s", $1); free($1); YYERROR; } - $$ = grp->gr_gid; + $$ = gid; } free($1); } From nobody Thu Jul 3 12:01:13 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMt2R0Sz60qxq; Thu, 03 Jul 2025 12:01:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMt11ZVz3mp9; Thu, 03 Jul 2025 12:01:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hfcWHo0vPppY60KTwQEhClOaGqWRh//o3Wj/fLfLNGw=; b=ItjuRacvMTUR26YWTp2xqW84fNp0U1ZjQW4G+GhAsbojzYRlXK7BEEkX+tvZPde6MfSU5r MzOlZQ/Bm5ABMUWp7uhRPG0oydQ5cuqrqnYvtuwSTC63Of+BzXzBUrEFz4+D81CkRDjZUD kAmmLxV7pcflEd2LO/4aMvJABsIx7d427ufGaNI6mEVNZV4mggjT1ueUsr3YFtBcwbvoVW YXK/H1KYm0Vjnz/vRu11+jARn4LL4k3jNz+kTIREWuJGN1JbYTdgO/MrFrc1VVRO7oWFCD 02jPVA6h25cMhMsPLN3GusxDohVPS2oujSzp28xFjvcEYCam9dxERKVk1aRaxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hfcWHo0vPppY60KTwQEhClOaGqWRh//o3Wj/fLfLNGw=; b=ieNh50ZUFxh0fUDZtBzuBrYlZ98Ju+ewSu4UMQughNfF1bDgfu5Nr07Qz1PTzr/H8oxDzE cnIUJu91EKsMVGkxOzg8X+4ZIiQU3G0gYTh6H7drOdcd9XEFBkxJURu7jBq6iS7EikNdN6 2QThVQ7CaMnnZ6tblD53tYYu+3SuzdzOW+IF5M4UD6jjwIA5hRq6cPEQ8XmNjM5Flk1MUf /PA3JM6LAe93y3tQLWjNP+DA3JOhFzpgGVWHOicZer4FValSiwQ7BMCEmCT6Fp24KDI1W+ 8/SGNRFsIqEOEhhRvhn/CNjd7a71udjBHyc1Fg4eLsIbTiGfNPG2A/U916ITVQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544074; a=rsa-sha256; cv=none; b=sjOSllWnD0SaTB8XHZCtUvXun8LL9PfXhOhdLtK9Jfzu9bQVf04ZTPS3fMEK/yq3ShBJnA +r78+bATBTPijsLtUO3655SC9C0xnNhMTlMgcQ9+725JAJndo2uaHQnGwk2L1EmKs8rwb2 o6XKoShz4K3B05kGrG1eod7whS64jS3cBqQuPxrlvWCiX5w1phZkAcHSvSHdCJ/HIyhJk5 edV4FDnWYd80Wy4uEOKySGMrQPWllmajsPde4uW0v3SYOvhEcoNQEcg7Ojcchea1HEnFBD pyMm89ohzARr0tEfhnE5QhvEMZb4IwTfIK/2aAn4CThNmdCERMP4uQ5uw6DZdg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMt0MwYz143S; Thu, 03 Jul 2025 12:01:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C1DnQ052147; Thu, 3 Jul 2025 12:01:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C1DCE052144; Thu, 3 Jul 2025 12:01:13 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:13 GMT Message-Id: <202507031201.563C1DCE052144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 204fae3f7378 - main - pfctl: robustness improvement on address family List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 204fae3f73780b927aae2e272661c25c2db3f96e Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=204fae3f73780b927aae2e272661c25c2db3f96e commit 204fae3f73780b927aae2e272661c25c2db3f96e Author: Kristof Provost AuthorDate: 2025-06-30 08:36:53 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:15 +0000 pfctl: robustness improvement on address family The kernel does not set the address family for the socket addresses that are used for netmask, broadcast, and destination address. In pfctl(8) take the family of the interface address and write it to the other addresses. This fixes some bugs when copy_satopfaddr() copied only part of IPv6 addresses. Print a warning if the address family is unknown. OK kn@ Obtained from: OpenBSD, bluhm , 1fef2296ff Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_parser.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index dfcf1a7b62a0..1db98c6103d4 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -234,8 +234,10 @@ copy_satopfaddr(struct pf_addr *pfa, struct sockaddr *sa) { if (sa->sa_family == AF_INET6) pfa->v6 = ((struct sockaddr_in6 *)sa)->sin6_addr; - else + else if (sa->sa_family == AF_INET) pfa->v4 = ((struct sockaddr_in *)sa)->sin_addr; + else + warnx("unhandled af %d", sa->sa_family); } const struct icmptypeent * @@ -1515,11 +1517,16 @@ ifa_load(void) ifa_add_groups_to_map(ifa->ifa_name); } else { copy_satopfaddr(&n->addr.v.a.addr, ifa->ifa_addr); + ifa->ifa_netmask->sa_family = ifa->ifa_addr->sa_family; copy_satopfaddr(&n->addr.v.a.mask, ifa->ifa_netmask); - if (ifa->ifa_broadaddr != NULL) + if (ifa->ifa_broadaddr != NULL) { + ifa->ifa_broadaddr->sa_family = ifa->ifa_addr->sa_family; copy_satopfaddr(&n->bcast, ifa->ifa_broadaddr); - if (ifa->ifa_dstaddr != NULL) + } + if (ifa->ifa_dstaddr != NULL) { + ifa->ifa_dstaddr->sa_family = ifa->ifa_addr->sa_family; copy_satopfaddr(&n->peer, ifa->ifa_dstaddr); + } if (n->af == AF_INET6) n->ifindex = ((struct sockaddr_in6 *) ifa->ifa_addr) ->sin6_scope_id; From nobody Thu Jul 3 12:01:15 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMv3tN1z60qZc; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMv25xRz3n0g; Thu, 03 Jul 2025 12:01:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E6rD9Zqu+pL20VddDXOlka6kmbrnGbCzwLf0HC7K73s=; b=jJk7dE7PLxdX4AXSl5E95YrtDabhLud9Zv7/aA7J5ZZtmQlhGHMdLzUW0IBGS/5jxVZub9 SeSlE06SQYgtoc1yTq7M0fkwDmwZU0irVX1CoZV6I1vQ2eJwu6rMoCgF22OL+tcUIyJLEs E2k9v3MK5oZP6Nqheb+ZP6yhvSItWWCmb6vcwSqkS2fz/alYxlvHvvXtlN4P/b7mXYb+Rf 6K33MxLpgBck7G1C48nNcJEH1SvwafDguzrHdQnv2iRyzpIkbbu66BO1wjPvyk4SUCSFDg fqcPXAKG5zgoyOhk0JhG5DgSOAhIB4wQMPqT7dfHHuT8s5RoYyXeyVg7SJt/XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E6rD9Zqu+pL20VddDXOlka6kmbrnGbCzwLf0HC7K73s=; b=Ua9sgfiKdXz7kRKKgngYj7XY4XT/8L9+6lq06Lm8iXvX9zMntuEPKZDvpF9zAXPhtOZ6o0 iYdEU47gjXSq5LhVQocTYpqH4AqSm/Igj2FHlXTDmRE8ICaFb/LFULQX1IC51l5VUqNY3r 5sITrb5vRVABs7e4qZ3QCjcggvwRx5ik31SeOhDCiE+P8P7McD6TV1mx52fHP/Sia8PX7J Q4SagI9ThjpSKIO27WAkG3czlcXmoR1mXUKPo/QlUy60MPBK8uxu2zQWVGe/qnehKz6hka cgIWiz2i4iurLVCqgQAMv4Oj36MiC7l9nccmdUQnsHQGie+g5ypQsXICVVsVGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544075; a=rsa-sha256; cv=none; b=Efw7wNhEgwJcIJQpAMeiR2M6kxlqNbyQNBlMRsysQl+AykuA5qTh7X72SKSM/YsZyoAnqt nph/nFjQghRu2J0HQST0GZgIFmsYK4X+Ti7U1hpgxo5zsAF4h4ONlpm4P82Hz9iw8+L0Cp fsE1tHIAdCeI451hq+/cfv27qBDl4s6bwnrnyJYRnlk6/pj0Rg13Uz903hXkK7ZVhHL4sX s7jkLtWG7ClKRpIh9twKz43S2GM+cksJkLi0b/yYuMZAEAIbT+JZtg8niNGknaN9OqxZ8q 4FKLvaHcWOIAx2rWGVrTgKOusfisrNKJFxoAE4y9IlL4LT5KM9N1462XImWBCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMv1fn0z143T; Thu, 03 Jul 2025 12:01:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C1FwS052179; Thu, 3 Jul 2025 12:01:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C1FK8052176; Thu, 3 Jul 2025 12:01:15 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:15 GMT Message-Id: <202507031201.563C1FK8052176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 2927a5981b34 - main - pfctl: fix table commands under anchors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2927a5981b3400cb5147d13580318419ecd1f91c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2927a5981b3400cb5147d13580318419ecd1f91c commit 2927a5981b3400cb5147d13580318419ecd1f91c Author: Kristof Provost AuthorDate: 2025-06-30 09:34:35 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:15 +0000 pfctl: fix table commands under anchors With r1.358 I simplified anchor handling but also broke semantics with regard to tables: # pfctl -a aname -t tname -T show pfctl: anchors apply to -f, -F and -s only Unbreak this by checking for table commands as well. OK bluhm Obtained from: OpenBSD, kn , 0e2b7406a2 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.8 | 5 +++-- sbin/pfctl/pfctl.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 index 0a4b8952ef74..5238c53f709d 100644 --- a/sbin/pfctl/pfctl.8 +++ b/sbin/pfctl/pfctl.8 @@ -24,7 +24,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 29, 2025 +.Dd June 30, 2025 .Dt PFCTL 8 .Os .Sh NAME @@ -114,8 +114,9 @@ Other rules and options are ignored. Apply flags .Fl f , .Fl F , +.Fl s , and -.Fl s +.Fl T only to the rules in the specified .Ar anchor . In addition to the main ruleset, diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 21befd3ca697..8c6497b4d1ee 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -3196,11 +3196,11 @@ main(int argc, char *argv[]) if (anchoropt != NULL) { int len = strlen(anchoropt); - if (mode == O_RDONLY && showopt == NULL) { - warnx("anchors apply to -f, -F and -s only"); + if (mode == O_RDONLY && showopt == NULL && tblcmdopt == NULL) { + warnx("anchors apply to -f, -F, -s, and -T only"); usage(); } - if (mode == O_RDWR && + if (mode == O_RDWR && tblcmdopt == NULL && (anchoropt[0] == '_' || strstr(anchoropt, "/_") != NULL)) errx(1, "anchor names beginning with '_' cannot " "be modified from the command line"); From nobody Thu Jul 3 12:01:16 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMw5cRlz60qxw; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMw2qzhz3n2v; Thu, 03 Jul 2025 12:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w1sKeGK/W/HeqzrjLvFM5rw03DKaxNfH/GRHg3dUt7M=; b=WG1jnQ6i5DcitOLoJ0KuIJOiU5RBg5GQ7h/oSRMIOnk1m9hkjktfg+mL5njX3CNQ3wcC1l zGeUIHMYpB0/hhI6rv2e6zBNZ3x0F6AijREntksjfsy4Ix0pi5w2P2lepeEwK/dzfZ8rqk wlMUX7dRQ7W/vdwD0Yd+FcgTc3DDH+ri+UyBxT7i7B59wpzYAGbUyqlTUUvp8/F21cEYk7 j6hKH+NrrFxvPdY9+ZwqYfXK8rcV5wxxWii1hnP6cZ9zWhzlXfMQG5yo+GRK9peAg8Wzoy l5ny8nVjX73srxt7dD4xPi0xoikZqEqcz1mXrLDjwwDPgDKeGeTVXlkHyVldLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w1sKeGK/W/HeqzrjLvFM5rw03DKaxNfH/GRHg3dUt7M=; b=AlfEUcDyBw5bVnsOfHE8aS7CW2qZM94jFUiwlAEyBsnsAyDFAEcsShOH7hZCVIBYsO9vcB yrSWn7VAHfFTjA8ge7O6c2sQoAG7n4nhLASRbBFn40pIOXTQmbGfVmdZLyRqIJpOrPKXNa 2MIApd+drzdpRPTsTtBr8S2scMHQoZWWD6mGT3MuZaSkvdfnCPz+PSqhoCw1efhGn1RIpc Nfkj4GEwovU94s3UpczRcGVn2aAAL3yg8bU/TDWbEr9YGhUuJWT08H+RX9mqOkSiVPCrK2 wxgvSvNKM5tZFXhoB98dVTwC34T6pCA4YohKA3S73f7Tdf2uEM3+Ud+f2/oT1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544076; a=rsa-sha256; cv=none; b=WsVfX62fDMqVmg06R9K0u/SVD+3oL2iBpU4H0JKd4qYRlrb9yFBIuKqAUGwOeHOGtS6Z99 TZs24Lv1H7ud+cGG6RlPdi2/+oGqdwJ87CHm79SR51SDy+rzEqZGRGq1BYeK6yOQzkvrUV /m4dZk2gSdFpnxuKnkELptzgfQBlPF10/M7dWeHJ/NMsf91uXu7LBoEv4NEbkrrrbuV5mF OEbyI95T6UCvyw1TQfTQbEKsxsHM/zK5NrC9Bw3RL28Bs3hmb8IOzXPjE33OnCS2+L9nRa EWQdRB5GSlqRWXlQ2vnSyIjUq7Q4kGkPhGN5AR0OGBlHKKV9F2k/l5OklrNWPw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMw2P6Fz13rx; Thu, 03 Jul 2025 12:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C1GIH052211; Thu, 3 Jul 2025 12:01:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C1GJt052208; Thu, 3 Jul 2025 12:01:16 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:16 GMT Message-Id: <202507031201.563C1GJt052208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fe20818673aa - main - pf: Honor quick on anchor rules List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fe20818673aa9fa33c1abe6262a6f3fc0ef7a5e9 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fe20818673aa9fa33c1abe6262a6f3fc0ef7a5e9 commit fe20818673aa9fa33c1abe6262a6f3fc0ef7a5e9 Author: Kristof Provost AuthorDate: 2025-06-30 09:45:36 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:15 +0000 pf: Honor quick on anchor rules When evaluating the anchor's ruleset, prevent clobbering it's very own `quick' test result by blindly setting it. This makes the following pf.conf work as intended (packets would be blocked since `quick' had no effect): anchor quick { pass } block Broken since after 6.1 release as reported by Fabian Mueller-Knapp, thanks! OK henning sashan Obtained from: OpenBSD, kn , b9014d31ce Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index b24bbe036141..accc811a12ba 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4675,6 +4675,12 @@ pf_step_into_anchor(struct pf_test_ctx *ctx, struct pf_krule *r) } } else { rv = pf_match_rule(ctx, &r->anchor->ruleset); + /* + * Unless there was an error inside the anchor, + * retain its quick state. + */ + if (rv != PF_TEST_FAIL && r->quick == PF_TEST_QUICK) + rv = PF_TEST_QUICK; } ctx->depth--; From nobody Thu Jul 3 12:01:17 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bXwMx62pqz60qxy; Thu, 03 Jul 2025 12:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXwMx47YSz3n5W; Thu, 03 Jul 2025 12:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0v2k7poWbKKWfdCTKEqlGRbhx3ReYOu8rYc1YQP5OX4=; b=oCikYOf364AMsa/9KNJ98c8TfXWF7Go8tEkeLRCnRq3kDaQ5KuuEnXQoQVPUA91NI9FF6O zN+r0G/hvtOvXckNYC4NrJFUD/G3OzdJFh/HlRa/6wPE/ASRqM3aYLGXUEMf1tf4Pye5ms TxHOrCBBsF9eYJxDS51fCNTRGNl/wm9m/pnPabwQzr/tq7GGjQjuCwC0UUp/NBWqYkMxBU nuxKgiR3iqWH1mfcjATRg9unxvMD7rk7KoOOUwHM5VctNo8tf5I8qC4VAYJbOBuJJ0g/aE aZgvETri5Ql0wyMUhlAcpBnUgtYaHN77+HGXnE9xLHQpXh26cX5Gi6TQQIXRxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751544077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0v2k7poWbKKWfdCTKEqlGRbhx3ReYOu8rYc1YQP5OX4=; b=cuEseRVZ7hfw0/HPGHZJef1gttYZ5y0Op7agyQD+JfOct5gRZIhbrbBYUP7qzIGj43fBFT IqEZaZiFlIBpAeC/kYI3YJHgv+Dxzq+QVsgJ/9U+/NoXq2OJiUHp2IJWctrHvNxiTZrVw8 WnE6BIqdVqvZsG31N1SHFXtv7lQwCokiAaJsVdMU/OIEZIYWldTxuqTResSJz59qEamrY+ AbzC/ZrP224zjhMhf3l0zXyAH03n9DpdImZFScOlKiG9Pj+b4/cqJ42AR4Ku2HXaJRtNx6 9twd6M4QBvJ+9q28mFD447+yX+PIwRq6hOzNG7IwMAzTZlh8udsfTz3Jh6h7Qg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751544077; a=rsa-sha256; cv=none; b=O8H+6UrOjnWHqo3DZ9FVrijzWMEbligLqHZPF4wtOrVZtUiIx+Ae4Y866YVgsxRo3Gc+u+ aSMj1bZWX8P2VnIr3XBD2KywOz4SmRRCvfFPtKJIK2wmbb0UAcUG/pMv1Gxy2k5liQZTLR qRnXGaN+ADk3nEvLP7Af4lY8EqI+PqwjE8U7shCjLcqhTZE8HfFfO2UdSrPpBWcv5Qr07/ kj12XBd6mMCfvtKmE2QuMHLTS78FXMpUIPm4G0XIQNV8liexFoaBybH6+QVEyC5+PgzUwI +wb+MTfmM5PFKXlXc2N0Ldcv9zyHvcW96nDi0X5ECMk8jUEfpClbjhE1wbFudQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bXwMx3b0Tz13f4; Thu, 03 Jul 2025 12:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563C1HJa052249; Thu, 3 Jul 2025 12:01:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563C1H19052246; Thu, 3 Jul 2025 12:01:17 GMT (envelope-from git) Date: Thu, 3 Jul 2025 12:01:17 GMT Message-Id: <202507031201.563C1H19052246@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 9d004de910bb - main - pf tests: verify that 'quick' works on anchors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d004de910bb7ea4d959dd3726318c4c6bdbd48c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9d004de910bb7ea4d959dd3726318c4c6bdbd48c commit 9d004de910bb7ea4d959dd3726318c4c6bdbd48c Author: Kristof Provost AuthorDate: 2025-06-30 12:13:09 +0000 Commit: Kristof Provost CommitDate: 2025-07-03 07:16:15 +0000 pf tests: verify that 'quick' works on anchors Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/anchor.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh index fbac10240d8d..b4b52d7a24d6 100644 --- a/tests/sys/netpfil/pf/anchor.sh +++ b/tests/sys/netpfil/pf/anchor.sh @@ -401,6 +401,42 @@ include_cleanup() pft_cleanup } +atf_test_case "quick" "cleanup" +quick_head() +{ + atf_set descr 'Test quick on anchors' + atf_set require.user root +} + +quick_body() +{ + pft_init + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}a + + ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz ifconfig ${epair}a 192.0.2.1/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "anchor quick {\n\ + pass\n\ + }" \ + "block" + + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + jexec alcatraz pfctl -sr -vv -a "*" +} + +quick_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "pr183198" @@ -413,4 +449,5 @@ atf_init_test_cases() atf_add_test_case "counter" atf_add_test_case "nat" atf_add_test_case "include" + atf_add_test_case "quick" } From nobody Thu Jul 3 15:03:05 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY0Pj2Gkzz61BPc; Thu, 03 Jul 2025 15: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY0Pj1xyzz3JgD; Thu, 03 Jul 2025 15: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=1751554985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NJw7QzMyOBRrnxJABEgHC05pRAk/Vr1UWGooW3/VrUE=; b=lujCnjCnJLJjwUSiWYOC+xZ3kDqvOPe+YFU7Sal0MWRkuEUjk1AwWlEzJIqMNDaA+tdHcM Mr9wZ4zPAapaW/4JQvojMbZSBgw3Qz3M3ONBLlSgmmzgbXKy+vh82xIDrRNQhDfsDF4Kg2 NM0jBgHv7oQGYjsWSLR+g3yN8RvHyIaeof5y5pAcvb4Fvs4FUAJGAuOgwQPr84evl6WjDo evZuwsFt6Pb1EB1t8LvWFFaCBxpDuvOBMGh9P4BeCqLEAxQ43a79q18naiHSdtFG0jNS8N ZImt8lYDuqLB6RMQE6OcOdn/qo7GHv3dHx3lH/ZLncojc8Sh11U1x78Jv3x1Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751554985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NJw7QzMyOBRrnxJABEgHC05pRAk/Vr1UWGooW3/VrUE=; b=g0svuUyq4FHl+DoWge66Tyctv/dJE1sp+e6GZMQRoCMGtFr7oOUduShFmdkVsmueJ0OG+e 9Ft325/aKxthvMoAEnt246aDJ6W2egAzzd6oroFNxTMD6X5fZ8DDxobh706fbTIHYDY+oy /Ur9Ck3b4WobQ/6ppwKgoLdzV2DuG4GfUWaM8fYLGQxBgq7LplOPwphBohSqKzIpgyWy6N Rv47Nv3sNrCaPKpP5dXqRUhsGpyj+nb2GN0jbaTudKHAEpNqlLfQNw8mwoqfut4YtIpZBj xpOGfRVqHvkpsLTE0lTEtJ+4Oo4/SEkJD+lIjNB1SMGyJUVCZi+UbUQgR1OapA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751554985; a=rsa-sha256; cv=none; b=TgLOtrtM/SkaGEeGFFmCjeuAMCkCHlQnvkTl2gcD733PhTimfSPzypQrSc1+oudgPdohKZ /UylfK7yNMES55n4AOz/jGloxOIoqYvJ8yx8Tru4Ky7WmxBHel8pirQGG+Fg39zxQBWnyF JylnxjD/oj9pYjITzDfHPAfXfrR2GcL75qdvQ+XFgknJqDQIor/bMvvdsHZkikpdkypKsA Pjq3grvyWd1e4sqOJ+LGcCbBzTeziJlUdXIuzvYGj3asQcjlK9CvBiTj0IB00t8O6C2oHg rlxWCPjQcmlbZVNgGadmnRphcq8l3+s6NP/xJ+4lUUIOCRKt7FP12XwGdqNjbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY0Pj1Xhtz18XS; Thu, 03 Jul 2025 15:03:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563F35ln095572; Thu, 3 Jul 2025 15:03:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563F35kp095569; Thu, 3 Jul 2025 15:03:05 GMT (envelope-from git) Date: Thu, 3 Jul 2025 15:03:05 GMT Message-Id: <202507031503.563F35kp095569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: df114daef4c4 - main - Import the Hardware Trace (HWT) framework. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df114daef4c48548c3c2b86717612761185ae18f Auto-Submitted: auto-generated The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=df114daef4c48548c3c2b86717612761185ae18f commit df114daef4c48548c3c2b86717612761185ae18f Author: Ruslan Bukin AuthorDate: 2025-07-03 13:10:45 +0000 Commit: Ruslan Bukin CommitDate: 2025-07-03 14:48:34 +0000 Import the Hardware Trace (HWT) framework. The HWT framework provides infrastructure for hardware-assisted tracing. It collects detailed information about software execution and records it as "events" in highly compressed format into DRAM. The events cover information about control flow changes of a program, whether branches taken or not, exceptions taken, timing information, cycles elapsed and more. This allows to reconstruct entire program flow of a given application. This comes with separate machine-dependent tracing backends for trace collection, trace decoder libraries and an instrumentation tool. Reviewed by: kib (sys/kern bits) Sponsored by: UKRI Differential Revision: https://reviews.freebsd.org/D40466 --- sys/conf/files | 13 ++ sys/conf/options | 3 + sys/dev/hwt/hwt.c | 242 ++++++++++++++++++++ sys/dev/hwt/hwt_backend.c | 289 ++++++++++++++++++++++++ sys/dev/hwt/hwt_backend.h | 87 ++++++++ sys/dev/hwt/hwt_config.c | 108 +++++++++ sys/dev/hwt/hwt_config.h | 36 +++ sys/dev/hwt/hwt_context.c | 201 +++++++++++++++++ sys/dev/hwt/hwt_context.h | 86 ++++++++ sys/dev/hwt/hwt_contexthash.c | 133 +++++++++++ sys/dev/hwt/hwt_contexthash.h | 42 ++++ sys/dev/hwt/hwt_cpu.c | 115 ++++++++++ sys/dev/hwt/hwt_cpu.h | 45 ++++ sys/dev/hwt/hwt_hook.c | 323 +++++++++++++++++++++++++++ sys/dev/hwt/hwt_hook.h | 56 +++++ sys/dev/hwt/hwt_intr.h | 33 +++ sys/dev/hwt/hwt_ioctl.c | 443 +++++++++++++++++++++++++++++++++++++ sys/dev/hwt/hwt_ioctl.h | 35 +++ sys/dev/hwt/hwt_owner.c | 157 +++++++++++++ sys/dev/hwt/hwt_owner.h | 45 ++++ sys/dev/hwt/hwt_ownerhash.c | 141 ++++++++++++ sys/dev/hwt/hwt_ownerhash.h | 42 ++++ sys/dev/hwt/hwt_record.c | 302 +++++++++++++++++++++++++ sys/dev/hwt/hwt_record.h | 47 ++++ sys/dev/hwt/hwt_thread.c | 162 ++++++++++++++ sys/dev/hwt/hwt_thread.h | 64 ++++++ sys/dev/hwt/hwt_vm.c | 501 ++++++++++++++++++++++++++++++++++++++++++ sys/dev/hwt/hwt_vm.h | 47 ++++ sys/kern/kern_exec.c | 19 ++ sys/kern/kern_linker.c | 5 +- sys/kern/kern_pmc.c | 4 + sys/kern/kern_thr.c | 12 +- sys/kern/kern_thread.c | 9 + sys/kern/sched_4bsd.c | 22 +- sys/kern/sched_ule.c | 19 ++ sys/kern/vfs_vnops.c | 23 ++ sys/modules/Makefile | 5 + sys/modules/hwt/Makefile | 21 ++ sys/sys/hwt.h | 129 +++++++++++ sys/sys/hwt_record.h | 70 ++++++ sys/sys/proc.h | 2 + sys/vm/vm_mmap.c | 16 ++ 42 files changed, 4150 insertions(+), 4 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 75ee10be5896..f6d473b1431b 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1776,6 +1776,19 @@ dev/hwpmc/hwpmc_soft.c optional hwpmc dev/hwreset/hwreset.c optional hwreset dev/hwreset/hwreset_array.c optional hwreset dev/hwreset/hwreset_if.m optional hwreset +dev/hwt/hwt.c optional hwt +dev/hwt/hwt_backend.c optional hwt +dev/hwt/hwt_config.c optional hwt +dev/hwt/hwt_context.c optional hwt +dev/hwt/hwt_contexthash.c optional hwt +dev/hwt/hwt_cpu.c optional hwt +dev/hwt/hwt_hook.c optional hwt +dev/hwt/hwt_ioctl.c optional hwt +dev/hwt/hwt_owner.c optional hwt +dev/hwt/hwt_ownerhash.c optional hwt +dev/hwt/hwt_record.c optional hwt +dev/hwt/hwt_thread.c optional hwt +dev/hwt/hwt_vm.c optional hwt dev/ichiic/ig4_acpi.c optional ig4 acpi iicbus dev/ichiic/ig4_iic.c optional ig4 iicbus dev/ichiic/ig4_pci.c optional ig4 pci iicbus diff --git a/sys/conf/options b/sys/conf/options index 03e8964e965d..a637b0b74a77 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -885,6 +885,9 @@ DCONS_FORCE_GDB opt_dcons.h HWPMC_DEBUG opt_global.h HWPMC_HOOKS +# Hardware Trace (HWT) framework options +HWT_HOOKS + # 802.11 support layer IEEE80211_DEBUG opt_wlan.h IEEE80211_DEBUG_REFCNT opt_wlan.h diff --git a/sys/dev/hwt/hwt.c b/sys/dev/hwt/hwt.c new file mode 100644 index 000000000000..c476e6031ba8 --- /dev/null +++ b/sys/dev/hwt/hwt.c @@ -0,0 +1,242 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023-2025 Ruslan Bukin + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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. + */ + +/* + * Hardware Tracing framework. + * + * The framework manages hardware tracing units that collect information + * about software execution and store it as events in highly compressed format + * into DRAM. The events cover information about control flow changes of a + * program, whether branches taken or not, exceptions taken, timing information, + * cycles elapsed and more. That allows us to restore entire program flow of a + * given application without performance impact. + * + * Design overview. + * + * The framework provides character devices for mmap(2) and ioctl(2) system + * calls to allow user to manage CPU (hardware) tracing units. + * + * /dev/hwt: + * .ioctl: + * hwt_ioctl(): + * a) HWT_IOC_ALLOC + * Allocates kernel tracing context CTX based on requested mode + * of operation. Verifies the information that comes with the + * request (pid, cpus), allocates unique ID for the context. + * Creates a new character device for CTX management. + * + * /dev/hwt_%d[_%d], ident[, thread_id] + * .mmap + * Maps tracing buffers of the corresponding thread to userspace. + * .ioctl + * hwt_thread_ioctl(): + * a) HWT_IOC_START + * Enables tracing unit for a given context. + * b) HWT_IOC_RECORD_GET + * Transfers (small) record entries collected during program + * execution for a given context to userspace, such as mmaping + * tables of executable and dynamic libraries, interpreter, + * kernel mappings, tid of threads created, etc. + * c) HWT_IOC_SET_CONFIG + * Allows to specify backend-specific configuration of the + * trace unit. + * d) HWT_IOC_WAKEUP + * Wakes up a thread that is currently sleeping. + * e) HWT_IOC_BUFPTR_GET + * Transfers current hardware pointer in the filling buffer + * to the userspace. + * f) HWT_IOC_SVC_BUF + * To avoid data loss, userspace may notify kernel it has + * copied out the given buffer, so kernel is ok to overwrite + * + * HWT context lifecycle in THREAD mode of operation: + * 1. User invokes HWT_IOC_ALLOC ioctl with information about pid to trace and + * size of the buffers for the trace data to allocate. + * Some architectures may have different tracing units supported, so user + * also provides backend name to use for this context, e.g. "coresight". + * 2. Kernel allocates context, lookups the proc for the given pid. Then it + * creates first hwt_thread in the context and allocates trace buffers for + * it. Immediately, kernel initializes tracing backend. + * Kernel creates character device and returns unique identificator of + * trace context to the user. + * 3. To manage the new context, user opens the character device created. + * User invokes HWT_IOC_START ioctl, kernel marks context as RUNNING. + * At this point any HWT hook invocation by scheduler enables/disables + * tracing for threads associated with the context (threads of the proc). + * Any new threads creation (of the target proc) procedures will be invoking + * corresponding hooks in HWT framework, so that new hwt_thread and buffers + * allocated, character device for mmap(2) created on the fly. + * 4. User issues HWT_IOC_RECORD_GET ioctl to fetch information about mmaping + * tables and threads created during application startup. + * 5. User mmaps tracing buffers of each thread to userspace (using + * /dev/hwt_%d_%d % (ident, thread_id) character devices). + * 6. User can repeat 4 if expected thread is not yet created during target + * application execution. + * 7. User issues HWT_IOC_BUFPTR_GET ioctl to get current filling level of the + * hardware buffer of a given thread. + * 8. User invokes trace decoder library to process available data and see the + * results in human readable form. + * 9. User repeats 7 if needed. + * + * HWT context lifecycle in CPU mode of operation: + * 1. User invokes HWT_IOC_ALLOC ioctl providing a set of CPU to trace within + * single CTX. + * 2. Kernel verifies the set of CPU and allocates tracing context, creates + * a buffer for each CPU. + * Kernel creates a character device for every CPU provided in the request. + * Kernel initialized tracing backend. + * 3. User opens character devices of interest to map the buffers to userspace. + * User can start tracing by invoking HWT_IOC_START on any of character + * device within the context, entire context will be marked as RUNNING. + * 4. The rest is similar to the THREAD mode. + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HWT_DEBUG +#undef HWT_DEBUG + +#ifdef HWT_DEBUG +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define dprintf(fmt, ...) +#endif + +static eventhandler_tag hwt_exit_tag; +static struct cdev *hwt_cdev; +static struct cdevsw hwt_cdevsw = { + .d_version = D_VERSION, + .d_name = "hwt", + .d_mmap_single = NULL, + .d_ioctl = hwt_ioctl +}; + +static void +hwt_process_exit(void *arg __unused, struct proc *p) +{ + struct hwt_owner *ho; + + /* Stop HWTs associated with exiting owner, if any. */ + ho = hwt_ownerhash_lookup(p); + if (ho) + hwt_owner_shutdown(ho); +} + +static int +hwt_load(void) +{ + struct make_dev_args args; + int error; + + make_dev_args_init(&args); + args.mda_devsw = &hwt_cdevsw; + args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_WHEEL; + args.mda_mode = 0660; + args.mda_si_drv1 = NULL; + + hwt_backend_load(); + hwt_ctx_load(); + hwt_contexthash_load(); + hwt_ownerhash_load(); + hwt_record_load(); + + error = make_dev_s(&args, &hwt_cdev, "hwt"); + if (error != 0) + return (error); + + hwt_exit_tag = EVENTHANDLER_REGISTER(process_exit, hwt_process_exit, + NULL, EVENTHANDLER_PRI_ANY); + + hwt_hook_load(); + + return (0); +} + +static int +hwt_unload(void) +{ + + hwt_hook_unload(); + EVENTHANDLER_DEREGISTER(process_exit, hwt_exit_tag); + destroy_dev(hwt_cdev); + hwt_record_unload(); + hwt_ownerhash_unload(); + hwt_contexthash_unload(); + hwt_ctx_unload(); + hwt_backend_unload(); + + return (0); +} + +static int +hwt_modevent(module_t mod, int type, void *data) +{ + int error; + + switch (type) { + case MOD_LOAD: + error = hwt_load(); + break; + case MOD_UNLOAD: + error = hwt_unload(); + break; + default: + error = 0; + break; + } + + return (error); +} + +static moduledata_t hwt_mod = { + "hwt", + hwt_modevent, + NULL +}; + +DECLARE_MODULE(hwt, hwt_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); +MODULE_VERSION(hwt, 1); diff --git a/sys/dev/hwt/hwt_backend.c b/sys/dev/hwt/hwt_backend.c new file mode 100644 index 000000000000..1ba5db0d3d09 --- /dev/null +++ b/sys/dev/hwt/hwt_backend.c @@ -0,0 +1,289 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023-2025 Ruslan Bukin + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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. + */ + +/* Hardware Trace (HWT) framework. */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define HWT_BACKEND_DEBUG +#undef HWT_BACKEND_DEBUG + +#ifdef HWT_BACKEND_DEBUG +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define dprintf(fmt, ...) +#endif + +static struct mtx hwt_backend_mtx; + +struct hwt_backend_entry { + struct hwt_backend *backend; + LIST_ENTRY(hwt_backend_entry) next; +}; + +static LIST_HEAD(, hwt_backend_entry) hwt_backends; + +static MALLOC_DEFINE(M_HWT_BACKEND, "hwt_backend", "HWT backend"); + +int +hwt_backend_init(struct hwt_context *ctx) +{ + int error; + + dprintf("%s\n", __func__); + + error = ctx->hwt_backend->ops->hwt_backend_init(ctx); + + return (error); +} + +void +hwt_backend_deinit(struct hwt_context *ctx) +{ + + dprintf("%s\n", __func__); + + ctx->hwt_backend->ops->hwt_backend_deinit(ctx); +} + +int +hwt_backend_configure(struct hwt_context *ctx, int cpu_id, int thread_id) +{ + int error; + + dprintf("%s\n", __func__); + + error = ctx->hwt_backend->ops->hwt_backend_configure(ctx, cpu_id, + thread_id); + + return (error); +} + +void +hwt_backend_enable(struct hwt_context *ctx, int cpu_id) +{ + + dprintf("%s\n", __func__); + + ctx->hwt_backend->ops->hwt_backend_enable(ctx, cpu_id); +} + +void +hwt_backend_disable(struct hwt_context *ctx, int cpu_id) +{ + + dprintf("%s\n", __func__); + + ctx->hwt_backend->ops->hwt_backend_disable(ctx, cpu_id); +} + +void +hwt_backend_enable_smp(struct hwt_context *ctx) +{ + + dprintf("%s\n", __func__); + + ctx->hwt_backend->ops->hwt_backend_enable_smp(ctx); +} + +void +hwt_backend_disable_smp(struct hwt_context *ctx) +{ + + dprintf("%s\n", __func__); + + ctx->hwt_backend->ops->hwt_backend_disable_smp(ctx); +} + +void __unused +hwt_backend_dump(struct hwt_context *ctx, int cpu_id) +{ + + dprintf("%s\n", __func__); + + ctx->hwt_backend->ops->hwt_backend_dump(cpu_id); +} + +int +hwt_backend_read(struct hwt_context *ctx, struct hwt_vm *vm, int *ident, + vm_offset_t *offset, uint64_t *data) +{ + int error; + + dprintf("%s\n", __func__); + + error = ctx->hwt_backend->ops->hwt_backend_read(vm, ident, + offset, data); + + return (error); +} + +struct hwt_backend * +hwt_backend_lookup(const char *name) +{ + struct hwt_backend_entry *entry; + struct hwt_backend *backend; + + HWT_BACKEND_LOCK(); + LIST_FOREACH(entry, &hwt_backends, next) { + backend = entry->backend; + if (strcmp(backend->name, name) == 0) { + HWT_BACKEND_UNLOCK(); + return (backend); + } + } + HWT_BACKEND_UNLOCK(); + + return (NULL); +} + +int +hwt_backend_register(struct hwt_backend *backend) +{ + struct hwt_backend_entry *entry; + + if (backend == NULL || + backend->name == NULL || + backend->ops == NULL) + return (EINVAL); + + entry = malloc(sizeof(struct hwt_backend_entry), M_HWT_BACKEND, + M_WAITOK | M_ZERO); + entry->backend = backend; + + HWT_BACKEND_LOCK(); + LIST_INSERT_HEAD(&hwt_backends, entry, next); + HWT_BACKEND_UNLOCK(); + + return (0); +} + +int +hwt_backend_unregister(struct hwt_backend *backend) +{ + struct hwt_backend_entry *entry, *tmp; + + if (backend == NULL) + return (EINVAL); + + /* TODO: check if not in use */ + + HWT_BACKEND_LOCK(); + LIST_FOREACH_SAFE(entry, &hwt_backends, next, tmp) { + if (entry->backend == backend) { + LIST_REMOVE(entry, next); + HWT_BACKEND_UNLOCK(); + free(entry, M_HWT_BACKEND); + return (0); + } + } + HWT_BACKEND_UNLOCK(); + + return (ENOENT); +} + +void +hwt_backend_load(void) +{ + + mtx_init(&hwt_backend_mtx, "hwt backend", NULL, MTX_DEF); + LIST_INIT(&hwt_backends); +} + +void +hwt_backend_unload(void) +{ + + /* TODO: ensure all unregistered */ + + mtx_destroy(&hwt_backend_mtx); +} + +void +hwt_backend_stop(struct hwt_context *ctx) +{ + dprintf("%s\n", __func__); + + ctx->hwt_backend->ops->hwt_backend_stop(ctx); +} + +int +hwt_backend_svc_buf(struct hwt_context *ctx, void *data, size_t data_size, + int data_version) +{ + int error; + + dprintf("%s\n", __func__); + + error = ctx->hwt_backend->ops->hwt_backend_svc_buf(ctx, data, data_size, + data_version); + + return (error); +} + +int +hwt_backend_thread_alloc(struct hwt_context *ctx, struct hwt_thread *thr) +{ + int error; + + dprintf("%s\n", __func__); + + if (ctx->hwt_backend->ops->hwt_backend_thread_alloc == NULL) + return (0); + KASSERT(thr->private == NULL, + ("%s: thread private data is not NULL\n", __func__)); + error = ctx->hwt_backend->ops->hwt_backend_thread_alloc(thr); + + return (error); +} + +void +hwt_backend_thread_free(struct hwt_thread *thr) +{ + dprintf("%s\n", __func__); + + if (thr->backend->ops->hwt_backend_thread_free == NULL) + return; + KASSERT(thr->private != NULL, + ("%s: thread private data is NULL\n", __func__)); + thr->backend->ops->hwt_backend_thread_free(thr); + + return; +} diff --git a/sys/dev/hwt/hwt_backend.h b/sys/dev/hwt/hwt_backend.h new file mode 100644 index 000000000000..3b6c9442a7a6 --- /dev/null +++ b/sys/dev/hwt/hwt_backend.h @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2023-2025 Ruslan Bukin + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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. + */ + +#ifndef _DEV_HWT_HWT_BACKEND_H_ +#define _DEV_HWT_HWT_BACKEND_H_ + +struct hwt_backend_ops { + int (*hwt_backend_init)(struct hwt_context *); + int (*hwt_backend_deinit)(struct hwt_context *); + int (*hwt_backend_configure)(struct hwt_context *, int cpu_id, + int thread_id); + int (*hwt_backend_svc_buf)(struct hwt_context *, void *data, + size_t data_size, int data_version); + void (*hwt_backend_enable)(struct hwt_context *, int cpu_id); + void (*hwt_backend_disable)(struct hwt_context *, int cpu_id); + int (*hwt_backend_read)(struct hwt_vm *, int *ident, + vm_offset_t *offset, uint64_t *data); + void (*hwt_backend_stop)(struct hwt_context *); + /* For backends that are tied to local CPU registers */ + int (*hwt_backend_enable_smp)(struct hwt_context *); + int (*hwt_backend_disable_smp)(struct hwt_context *); + /* Allocation and initialization of backend-specific thread data. */ + int (*hwt_backend_thread_alloc)(struct hwt_thread *); + void (*hwt_backend_thread_free)(struct hwt_thread *); + /* Debugging only. */ + void (*hwt_backend_dump)(int cpu_id); +}; + +struct hwt_backend { + const char *name; + struct hwt_backend_ops *ops; + /* buffers require kernel virtual addresses */ + bool kva_req; +}; + +int hwt_backend_init(struct hwt_context *ctx); +void hwt_backend_deinit(struct hwt_context *ctx); +int hwt_backend_configure(struct hwt_context *ctx, int cpu_id, int thread_id); +void hwt_backend_enable(struct hwt_context *ctx, int cpu_id); +void hwt_backend_disable(struct hwt_context *ctx, int cpu_id); +void hwt_backend_enable_smp(struct hwt_context *ctx); +void hwt_backend_disable_smp(struct hwt_context *ctx); +void hwt_backend_dump(struct hwt_context *ctx, int cpu_id); +int hwt_backend_read(struct hwt_context *ctx, struct hwt_vm *vm, int *ident, + vm_offset_t *offset, uint64_t *data); +int hwt_backend_register(struct hwt_backend *); +int hwt_backend_unregister(struct hwt_backend *); +void hwt_backend_stop(struct hwt_context *); +int hwt_backend_svc_buf(struct hwt_context *ctx, void *data, size_t data_size, + int data_version); +struct hwt_backend * hwt_backend_lookup(const char *name); +int hwt_backend_thread_alloc(struct hwt_context *ctx, struct hwt_thread *); +void hwt_backend_thread_free(struct hwt_thread *); + +void hwt_backend_load(void); +void hwt_backend_unload(void); + +#define HWT_BACKEND_LOCK() mtx_lock(&hwt_backend_mtx) +#define HWT_BACKEND_UNLOCK() mtx_unlock(&hwt_backend_mtx) + +#endif /* !_DEV_HWT_HWT_BACKEND_H_ */ + diff --git a/sys/dev/hwt/hwt_config.c b/sys/dev/hwt/hwt_config.c new file mode 100644 index 000000000000..30688e7fc76b --- /dev/null +++ b/sys/dev/hwt/hwt_config.c @@ -0,0 +1,108 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023-2025 Ruslan Bukin + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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 +#include +#include +#include +#include + +#define HWT_MAXCONFIGSIZE PAGE_SIZE + +#define HWT_CONFIG_DEBUG +#undef HWT_CONFIG_DEBUG + +#ifdef HWT_CONFIG_DEBUG +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define dprintf(fmt, ...) +#endif + +static MALLOC_DEFINE(M_HWT_CONFIG, "hwt_config", "HWT config"); + +int +hwt_config_set(struct thread *td, struct hwt_context *ctx, + struct hwt_set_config *sconf) +{ + size_t config_size; + void *old_config; + void *config; + int error; + + config_size = sconf->config_size; + if (config_size == 0) + return (0); + + if (config_size > HWT_MAXCONFIGSIZE) + return (EFBIG); + + config = malloc(config_size, M_HWT_CONFIG, M_WAITOK | M_ZERO); + + error = copyin(sconf->config, config, config_size); + if (error) { + free(config, M_HWT_CONFIG); + return (error); + } + + HWT_CTX_LOCK(ctx); + old_config = ctx->config; + ctx->config = config; + ctx->config_size = sconf->config_size; + ctx->config_version = sconf->config_version; + HWT_CTX_UNLOCK(ctx); + + if (old_config != NULL) + free(old_config, M_HWT_CONFIG); + + return (error); +} + +void +hwt_config_free(struct hwt_context *ctx) +{ + + if (ctx->config == NULL) + return; + + free(ctx->config, M_HWT_CONFIG); + + ctx->config = NULL; +} diff --git a/sys/dev/hwt/hwt_config.h b/sys/dev/hwt/hwt_config.h new file mode 100644 index 000000000000..47485583063c --- /dev/null +++ b/sys/dev/hwt/hwt_config.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2023-2025 Ruslan Bukin + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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. + */ + +#ifndef _DEV_HWT_HWT_CONFIG_H_ +#define _DEV_HWT_HWT_CONFIG_H_ + +int hwt_config_set(struct thread *td, struct hwt_context *ctx, + struct hwt_set_config *sconf); +void hwt_config_free(struct hwt_context *ctx); + +#endif /* !_DEV_HWT_HWT_CONFIG_H_ */ diff --git a/sys/dev/hwt/hwt_context.c b/sys/dev/hwt/hwt_context.c new file mode 100644 index 000000000000..9af76cffc928 --- /dev/null +++ b/sys/dev/hwt/hwt_context.c @@ -0,0 +1,201 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2023-2025 Ruslan Bukin + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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 +#include + +#include +#include +#include +#include +#include +#include +#include + +#define HWT_DEBUG +#undef HWT_DEBUG + +#ifdef HWT_DEBUG +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define dprintf(fmt, ...) +#endif + +static MALLOC_DEFINE(M_HWT_CTX, "hwt_ctx", "Hardware Trace"); + +static bitstr_t *ident_set; +static int ident_set_size; +static struct mtx ident_set_mutex; + +static int +hwt_ctx_ident_alloc(int *new_ident) +{ + + mtx_lock(&ident_set_mutex); + bit_ffc(ident_set, ident_set_size, new_ident); + if (*new_ident == -1) { + mtx_unlock(&ident_set_mutex); + return (ENOMEM); + } + bit_set(ident_set, *new_ident); + mtx_unlock(&ident_set_mutex); + + return (0); +} *** 3705 LINES SKIPPED *** From nobody Thu Jul 3 15:20:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY0nx36PXz61DPk; Thu, 03 Jul 2025 15:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY0nx1MLhz3Lh9; Thu, 03 Jul 2025 15:20:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751556037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oUHmN7J+HggbzCzE+sa8zIq110RGxhGFSpxzWBkDaLk=; b=CmWPR/CrgL+1PT+sYl6/F3gVZFlmFDt0EBZgFiX+9rtiu4miwqsGkWIenb+DW94w9g6EMC c2GExxXfBvbW1fCx3A9TqDdtZrsY+weYt4EbfrO+6sZMH7iV6TVYym1frMGAMGTWbwebmB 1XG0gVKrnzYrGG6hkm40iyRnmZjyMUGgbh9kta5O5OhKdxQLg4Ztmshe6tfrmG6T1Wn2lM 8i5DrmtC5FGa0iO+7VBU9uPpRU9JREPEWajP0BAqWs8DvPjnc7gpUf5h0BYFWHZwOLAvXQ vEXyNfdJYzrmzGr6VxtWymfKFDe3KJzW+GAdOtByk6/ysVnAk2mYwZcJVtvOqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751556037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oUHmN7J+HggbzCzE+sa8zIq110RGxhGFSpxzWBkDaLk=; b=jXUWvE0+ep0kvkzneSs4AwbadGO+keWyaBd7Cl46ybylNjPWtcRvVekTEQJTzxbpPLzWsF iuCv6csEC5F3UAzQAWD71KNAAeXifI7bav4+dEZ8rF4oEdP3I7SKFBmJk/LPtfwVovdm2c v7dj2uaGdK7C57Z1C7qKTqvFKboyBrj5cDNAIKE3OE0yawsf7w7eexZPCasZdKGceKMC0/ eqEmA4KIiOawl2mTVtG+Q9vvJvHE7dugPlr9RfOOx/14p9EOhcPKkvrjapuYYcz18s4Hue 0SLMMTKtC9qnnDU+xnTYWDobQ7JqDhr8F6SjcKgvXn0o0+ftFlsgyV2dCCzn6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751556037; a=rsa-sha256; cv=none; b=Gc0fY9Ov/pxJnB6tZkr9RKgk+/4fHnrIre0ibHGYRrZdRJQE2QR2dQldoFkfD7AHg8E2RA 2YzGQITUFKNCTte4a+s2oLzaHlhf2gVQi+PzOz48uO+bF4LedjO6znYo87EHtl+Gg6Veaj 58xuwF7TGnC6U1gBp9USY7aVyuE7fpbbLQgzLGUq2h5rtmBPQdayY+LoAKbdTzsiR4naZL XT9AsaeKu/OVSXpxnxrkA76/sf72PZrwCL1WPCstEUIWjNNfAfDsu1oJy2I1CuzXGB+3uq SCLlxQqYT7wTLBoOCRtIb2eqAwzPnR0Vzndh4Oi0N1MLRKUYFES8ZDkh9FIx+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY0nw6WKWz18kY; Thu, 03 Jul 2025 15:20:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563FKa60024809; Thu, 3 Jul 2025 15:20:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563FKa9n024806; Thu, 3 Jul 2025 15:20:36 GMT (envelope-from git) Date: Thu, 3 Jul 2025 15:20:36 GMT Message-Id: <202507031520.563FKa9n024806@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5ae9f8e9ac5e - main - md: Restore guards in mddestroy() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ae9f8e9ac5e1307fed4f7f2549347576f01b3fa Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5ae9f8e9ac5e1307fed4f7f2549347576f01b3fa commit 5ae9f8e9ac5e1307fed4f7f2549347576f01b3fa Author: Mark Johnston AuthorDate: 2025-07-03 13:10:49 +0000 Commit: Mark Johnston CommitDate: 2025-07-03 15:10:41 +0000 md: Restore guards in mddestroy() mddestroy() may be invoked on a partially constructed md device. Restore the guards that handled this prior to commit e91022168101. Reported by: syzbot+a0ff73f664de8757cfaa@syzkaller.appspotmail.com Reported by: syzbot+7b4a4824bf81548283ab@syzkaller.appspotmail.com Reviewed by: kib Fixes: e91022168101 ("md(4): move type-specific data under union") Differential Revision: https://reviews.freebsd.org/D51145 --- sys/dev/md/md.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index b842d4f2fd8e..741a7c013f7d 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -1559,19 +1559,26 @@ mddestroy(struct md_s *sc, struct thread *td) mtx_destroy(&sc->queue_mtx); switch (sc->type) { case MD_VNODE: - vn_lock(sc->s_vnode.vnode, LK_EXCLUSIVE | LK_RETRY); - sc->s_vnode.vnode->v_vflag &= ~VV_MD; - VOP_UNLOCK(sc->s_vnode.vnode); - (void)vn_close(sc->s_vnode.vnode, sc->flags & MD_READONLY ? - FREAD : (FREAD|FWRITE), sc->cred, td); - kva_free(sc->s_vnode.kva, maxphys + PAGE_SIZE); + if (sc->s_vnode.vnode != NULL) { + vn_lock(sc->s_vnode.vnode, LK_EXCLUSIVE | LK_RETRY); + sc->s_vnode.vnode->v_vflag &= ~VV_MD; + VOP_UNLOCK(sc->s_vnode.vnode); + (void)vn_close(sc->s_vnode.vnode, + sc->flags & MD_READONLY ? FREAD : (FREAD|FWRITE), + sc->cred, td); + } + if (sc->s_vnode.kva != 0) + kva_free(sc->s_vnode.kva, maxphys + PAGE_SIZE); break; case MD_SWAP: - vm_object_deallocate(sc->s_swap.object); + if (sc->s_swap.object != NULL) + vm_object_deallocate(sc->s_swap.object); break; case MD_MALLOC: - destroy_indir(sc, sc->s_malloc.indir); - uma_zdestroy(sc->s_malloc.uma); + if (sc->s_malloc.indir != NULL) + destroy_indir(sc, sc->s_malloc.indir); + if (sc->s_malloc.uma != NULL) + uma_zdestroy(sc->s_malloc.uma); break; case MD_PRELOAD: case MD_NULL: From nobody Thu Jul 3 16:17:18 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY23N67Myz61KwK for ; Thu, 03 Jul 2025 16:17:20 +0000 (UTC) (envelope-from 01000197d1140180-b91388ce-1c66-407d-b06e-4e9177a6fea0-000000@amazonses.com) Received: from a8-176.smtp-out.amazonses.com (a8-176.smtp-out.amazonses.com [54.240.8.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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY23N3MY3z3Rr5 for ; Thu, 03 Jul 2025 16:17:20 +0000 (UTC) (envelope-from 01000197d1140180-b91388ce-1c66-407d-b06e-4e9177a6fea0-000000@amazonses.com) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57; d=tarsnap.com; t=1751559438; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=cotU0BRgIQCa6iKYgyP6BiabJG4EdXdyo73R5dqiVDk=; b=EmzjX4JcnO3GJA9TVvU+KlYvfNOXljnFfoUO1OiTVSxt/FFWl/V+3oj+lOKE+xXZ 5UwNseEUuOwgEs8gU/JLUqdabGX9VF++0qApCutP08FOtZttXRouu0SCzwz3Ejwelkn SA9udIoBRdgAN81lrMb7cxMoIBVQ87+Vq7bKYcn4= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1751559438; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=cotU0BRgIQCa6iKYgyP6BiabJG4EdXdyo73R5dqiVDk=; b=BcxC10GiIHcfHpDcGtc1NWdcYb8MYr/neKdS8fUiV4Ng0ZEwfSNwy4R0C4Gahf88 iVSBNpHx17oBw4ZahyOzlJsvLYpxP2MlTFs+M64dor49mPC1QPEs/eQNBTPVfe7A4Uy rIIHbkSeio6g4t+Y46MGIMAyiSJYJRxRhgAuW2xM= Message-ID: <01000197d1140180-b91388ce-1c66-407d-b06e-4e9177a6fea0-000000@email.amazonses.com> Date: Thu, 3 Jul 2025 16:17:18 +0000 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: df114daef4c4 - main - Import the Hardware Trace (HWT) framework. To: Ruslan Bukin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202507031503.563F35kp095569@gitrepo.freebsd.org> Content-Language: en-US From: Colin Percival Autocrypt: addr=cperciva@tarsnap.com; keydata= xsFNBGWMSrYBEACdWRqDn3B3SKO7IG0/fGHYtfs26f3Q5QeAcasy1fQLniwGQWn5rlILhbCD K/jdNoDm5Zxq20eqyffoDNObCjnHgg4tGANdi+RmDy+7CDpE789H8dss9y7Pt5DlGGAXQQnt hxush3EYS/Ctprd9UUL/lzOOLOU1aNtzB84tNrJBtcJmL7OYHfyTSNFxvedqJrrasejIQOLI t/DQ89BPzz+vsKHz7FJPXh3fsVkzLA00DJYcfkgxyABfJNA7U6yMwd4DVSdx/SsvfIDMVXnu UXCXswo106WPZbYGlZPpq0wW6iibtTerJix+8AeuwXvl9O1p8yESK4ErkIxCnmghTSz+pdzj z/6xBRkdDM9VdZ0r+CzsaNXMpDOzFuKyjaiYBdgCLljbDnXIHFcqXenrZ7Xwkm09g/M4uVSh pIUG2RYa6tsHSQoGCp3f2RZv1znfViKQFbbL83QjtPA20AhseZSYbHp1FPhXyy9J0wkGL16L e99g6gdGeIRE82BZjBjKGDkoyDPq+oDRSFl8NtzmIKy+cfz00nViqcTF4bREXEawFGhlpO0X O9q8mijI9iFB6zaPBiSdJGBL5ML5qLTNCl8Zlf4m1TBvmRTqF/lzMHVXHidDoUhpSh/y3AFZ 1KrYc27ztJQywDJPJPWPbtY8YhFLFs377gfP8WldsZjzp8nvoQARAQABzSVDb2xpbiBQZXJj aXZhbCA8Y3BlcmNpdmFAdGFyc25hcC5jb20+wsGRBBMBCAA7FiEEglY7hNBiDtwN+4ZBOJfy 4i5lrT8FAmWMSyYCGwMICwkNCAwHCwMFFQoJCAsFFgMCAQACHgUCF4AACgkQOJfy4i5lrT+i Yg/+PYyJNoFuygtV5t/skcjYmvEC93mnazEvh+x99vGYZnGKeJ8NDOF4QCUzeHquOWxDi8Zl reXyswKcrIquPxxX6+YyGe97VbvLnez3ksfzOYRj1F4qV0Rq8ZNK51+bvIrbcS3SfDaRioAk D7WWwFor8y/hSwxYkfsKbtP5PRcem20JUxuC085zqWLaKv5t5n2CBzAGMjwJaQ3tM3AXVwWJ uJaHA6ot/6fntJlmkfcyCYyyr0D6b0guRj3STbZ2hNn5o2AI+f6LJJ31s2sPFjl6rs7fORf3 hFSNOHDd2HxfVBXFdQy24ROkC4orBBz2xh9GScjxxT/hbXkfufkubFubw7n0HkvHzA3UF+Qq A8JiI3n+d7ocsP0/5BQ2sZdeqPGJgHx6RkAMuW1tJ29wSvCN1qMgFwhYkpQdfvHlociQrimU fvlRfSrBEe8o7tvIuEdpvwvCZSTJqQbVoMw8UHFE7nzyCXUSab5h6PbjakCqim13ekVO2KFF TTPcz5o5jEeUY75tzbIwcDfFbT5KqNjWy06TVdM9VEJDHSfOfxHR3kSEwZ+tT2aTvL3grsUn gFwSNcj4Cl4CRFfUw8zVZY+7O7RiMlhBqykikvUurrdGKc1Scwa0yuppdA6eVvylyTWSQGrQ +uLWtV1LUKN7ZqKJWBkLPt9nS4XZWGyBvxOHYqjOwU0EZYxKtgEQANYfgbtUMVnhjxDHhWLp g5kLHK3YW0TfJKzpXqDB7NiqxHofn4OcbZnVC3MKggcbs9o1/UtsjnlsG8550PfiYkDXvPiO RJwgbGs6MGIDK797C6cnBLQ8xwBa9SL4cl5iQFnhWmt6vwnJ+an/cm5JpYves3wL7jV09qU9 57hkHXEUcl38r4FssZzVcLKPUVTa3Un+QGRTGDGe/f4ctjMaqv0ZCM+l2ixPhf/vqESrfSLv V/+T3dmtUfXjazO3SABvsHwxgGuTTYOlKoPCaebr+BRdqm0xeIShoIlhvTI8y4clchqx/Uxg UG5X2kvU13k3DS3Q8uLE4Et9x1CcZT6WGgBZSR6R0WfD0SDnzufNnRWJ0dEPA2MtJHE7+85R Vi9j/IgZV+y5Ur+bnPkjDG1s2SVciX5v9HQ0oilcBhvx0j5lGE9hhurD9F+fCvkr4KdbCknE 6Y8ce8pCNBUoB/DqibJivOzTk9K9MGB5x0De5TerIrFiaw3/mQC9nGeO9dtE7wvDJetWeoTq 4BEaCzpufNqbkpOaTQILr4V6Gp7M6v97g83TVAwZntz/q8ptwuKQPZ2JaSFLZn7oWUpYXA5s +SIODFHLn6iMoYpBQskHQjnj4lEPJadl4qj+ZKA89iDAKsniyoFXsbJe2CPbMS1yzBxKZq6K D/jpt7BOnuHr/JrXABEBAAHCwXYEGAEIACAWIQSCVjuE0GIO3A37hkE4l/LiLmWtPwUCZYxK tgIbDAAKCRA4l/LiLmWtP3jmEACQrh9gWe8F1Tkw3m6VoHKwLc5he4tX3WpQa//soPO6iGG3 S3WPruQ46NrAaAojoOcKI9UONDO5rxG0ZTX53S+lu2EO47jbcLwOCjaEpjKpDRt9ZXBQE8Xl mtBE9Bp3W9gpjB1nE3KNM1mJYgsK0QdRpwwfh4pVgGpOj8j23I6MCK+v99zEBnpgCn2GX8W/ kctRXHqWwndHysOJtRP/zrl7dDaABF1f9efUl0LL3TD3GJ9VDz+DNOin/uK2a1hiJo8QzTRk PpfUQ2ebzDsrd1i/pOWkMSkdH+rEu4AGrXWtaBwrMyrGkL6Icb6yO+P9/z0W2wlgBf3P1YRt JPgQt/Dj3yvA/UnaV/QmuVQPjl13o24UnJGsZM8XGnNdfWBKkC1Q6VXC4QT+dyBHYH9MuE9d 6oGl8pFM1+cTfEfbM62/rRoPkF1yHMsI/903VxEvuUIKfhEZAVLFyHldooNxuchntHQP9y8J 8Ou9bWYQP7MnEn+kwSwrZkjurfPkan+xQvp6dDYnj3V0GwA5pprBMaB928VIDVOv+1PNQI3t Cvk5VPv/skq+TJRMHW7bFSt8PRa91cUf1FOLIz9APDiJOzXkwxUEHGV3zPSaUhs1JYjyBeGT wDAvtLUdjOnRhEUOwlnIrztmvyciutjJoVzKEEjj5WXnHk9L9kQ1bpAjkjTONw== In-Reply-To: <202507031503.563F35kp095569@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Feedback-ID: ::1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-SES-Outgoing: 2025.07.03-54.240.8.176 X-Rspamd-Queue-Id: 4bY23N3MY3z3Rr5 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:14618, ipnet:54.240.8.0/21, country:US] On 7/3/25 08:03, Ruslan Bukin wrote: > commit df114daef4c48548c3c2b86717612761185ae18f > > Import the Hardware Trace (HWT) framework. Can we get a man page for this? -- Colin Percival FreeBSD Release Engineering Lead & EC2 platform maintainer Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From nobody Thu Jul 3 16:19:16 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY26c73PMz61LHc; Thu, 03 Jul 2025 16:20:08 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp052.goneo.de (smtp5.goneo.de [IPv6:2001:1640:5::8:30]) (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 4bY26c3dnkz3SGV; Thu, 03 Jul 2025 16:20:08 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Authentication-Results: mx1.freebsd.org; none Received: from hub1.goneo.de (hub1.goneo.de [IPv6:2001:1640:5::8:52]) (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 smtp5.goneo.de (Postfix) with ESMTPS id B05E024046B; Thu, 3 Jul 2025 18:20:00 +0200 (CEST) Received: from hub1.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 hub1.goneo.de (Postfix) with ESMTPS id B1D86240159; Thu, 3 Jul 2025 18:19:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walstatt-de.de; s=DKIM001; t=1751559598; 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=CToJdxwzKastMeJgg1rlrllDHExcuGmrnNiroaw7aY0=; b=snN1BF4XUgS0cE53crz+5tUulfyRKSlTcKFTeSW2Ahai2OlBQWDYSWzyypQhxUdYgYC0py r8TVTz+436nlBi9BmJGMpi+AhIS//MZ2v7L99Inn2q75I6zAih11FAaE/Gh/tDjSeuQdu4 2ZXLcS1oe58Ui5C8QT9Fy1VPTyvXSXGNVFh+5EcVs14qXeyKk6EKE7qKBL80VsKh+wPiJ9 H+ZK1y1taeCg5QO2TeVRvJNhcvmi7KQzuauF0ZBTkEZp9RGhIMqYf5kGtH75449MUIdhkX jzWprLZ8SapT1WK2KF60FAW+5A3fHDi6FlPhyOJNWT9aRIz3v8jfthISQEu0KA== Received: from thor.sb211.local (dynamic-2a02-3100-1c1a-d402-903d-f088-8f88-1d4b.310.pool.telefonica.de [IPv6:2a02:3100:1c1a:d402:903d:f088:8f88:1d4b]) (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 hub1.goneo.de (Postfix) with ESMTPSA id 4D275240306; Thu, 3 Jul 2025 18:19:58 +0200 (CEST) Date: Thu, 3 Jul 2025 18:19:16 +0200 From: A FreeBSD User To: Ruslan Bukin Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: df114daef4c4 - main - Import the Hardware Trace (HWT) framework. Message-ID: <20250703181943.4476444d@thor.sb211.local> In-Reply-To: <202507031503.563F35kp095569@gitrepo.freebsd.org> References: <202507031503.563F35kp095569@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/3I0jjIvEcihbKSr1ynFm8_."; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Rspamd-UID: 8caa16 X-Rspamd-UID: fdaca3 X-Rspamd-Queue-Id: 4bY26c3dnkz3SGV X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:25394, ipnet:2001:1640::/32, country:DE] --Sig_/3I0jjIvEcihbKSr1ynFm8_. Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Am Tage des Herren Thu, 3 Jul 2025 15:03:05 GMT Ruslan Bukin schrieb: > The branch main has been updated by br: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Ddf114daef4c48548c3c2b86717= 612761185ae18f >=20 > commit df114daef4c48548c3c2b86717612761185ae18f > Author: Ruslan Bukin > AuthorDate: 2025-07-03 13:10:45 +0000 > Commit: Ruslan Bukin > CommitDate: 2025-07-03 14:48:34 +0000 >=20 > Import the Hardware Trace (HWT) framework. > =20 > The HWT framework provides infrastructure for hardware-assisted traci= ng. It > collects detailed information about software execution and records it= as > "events" in highly compressed format into DRAM. The events cover info= rmation > about control flow changes of a program, whether branches taken or no= t, > exceptions taken, timing information, cycles elapsed and more. This a= llows > to reconstruct entire program flow of a given application. > =20 > This comes with separate machine-dependent tracing backends for trace > collection, trace decoder libraries and an instrumentation tool. > =20 > Reviewed by: kib (sys/kern bits) > Sponsored by: UKRI > Differential Revision: https://reviews.freebsd.org/D40466 > --- > sys/conf/files | 13 ++ > sys/conf/options | 3 + > sys/dev/hwt/hwt.c | 242 ++++++++++++++++++++ > sys/dev/hwt/hwt_backend.c | 289 ++++++++++++++++++++++++ > sys/dev/hwt/hwt_backend.h | 87 ++++++++ > sys/dev/hwt/hwt_config.c | 108 +++++++++ > sys/dev/hwt/hwt_config.h | 36 +++ > sys/dev/hwt/hwt_context.c | 201 +++++++++++++++++ > sys/dev/hwt/hwt_context.h | 86 ++++++++ > sys/dev/hwt/hwt_contexthash.c | 133 +++++++++++ > sys/dev/hwt/hwt_contexthash.h | 42 ++++ > sys/dev/hwt/hwt_cpu.c | 115 ++++++++++ > sys/dev/hwt/hwt_cpu.h | 45 ++++ > sys/dev/hwt/hwt_hook.c | 323 +++++++++++++++++++++++++++ > sys/dev/hwt/hwt_hook.h | 56 +++++ > sys/dev/hwt/hwt_intr.h | 33 +++ > sys/dev/hwt/hwt_ioctl.c | 443 +++++++++++++++++++++++++++++++++++++ > sys/dev/hwt/hwt_ioctl.h | 35 +++ > sys/dev/hwt/hwt_owner.c | 157 +++++++++++++ > sys/dev/hwt/hwt_owner.h | 45 ++++ > sys/dev/hwt/hwt_ownerhash.c | 141 ++++++++++++ > sys/dev/hwt/hwt_ownerhash.h | 42 ++++ > sys/dev/hwt/hwt_record.c | 302 +++++++++++++++++++++++++ > sys/dev/hwt/hwt_record.h | 47 ++++ > sys/dev/hwt/hwt_thread.c | 162 ++++++++++++++ > sys/dev/hwt/hwt_thread.h | 64 ++++++ > sys/dev/hwt/hwt_vm.c | 501 ++++++++++++++++++++++++++++++++++++= ++++++ > sys/dev/hwt/hwt_vm.h | 47 ++++ > sys/kern/kern_exec.c | 19 ++ > sys/kern/kern_linker.c | 5 +- > sys/kern/kern_pmc.c | 4 + > sys/kern/kern_thr.c | 12 +- > sys/kern/kern_thread.c | 9 + > sys/kern/sched_4bsd.c | 22 +- > sys/kern/sched_ule.c | 19 ++ > sys/kern/vfs_vnops.c | 23 ++ > sys/modules/Makefile | 5 + > sys/modules/hwt/Makefile | 21 ++ > sys/sys/hwt.h | 129 +++++++++++ > sys/sys/hwt_record.h | 70 ++++++ > sys/sys/proc.h | 2 + > sys/vm/vm_mmap.c | 16 ++ > 42 files changed, 4150 insertions(+), 4 deletions(-) >=20 > diff --git a/sys/conf/files b/sys/conf/files > index 75ee10be5896..f6d473b1431b 100644 > --- a/sys/conf/files > +++ b/sys/conf/files > @@ -1776,6 +1776,19 @@ dev/hwpmc/hwpmc_soft.c optional hwpmc > dev/hwreset/hwreset.c optional hwreset > dev/hwreset/hwreset_array.c optional hwreset > dev/hwreset/hwreset_if.m optional hwreset > +dev/hwt/hwt.c optional hwt > +dev/hwt/hwt_backend.c optional hwt > +dev/hwt/hwt_config.c optional hwt > +dev/hwt/hwt_context.c optional hwt > +dev/hwt/hwt_contexthash.c optional hwt > +dev/hwt/hwt_cpu.c optional hwt > +dev/hwt/hwt_hook.c optional hwt > +dev/hwt/hwt_ioctl.c optional hwt > +dev/hwt/hwt_owner.c optional hwt > +dev/hwt/hwt_ownerhash.c optional hwt > +dev/hwt/hwt_record.c optional hwt > +dev/hwt/hwt_thread.c optional hwt > +dev/hwt/hwt_vm.c optional hwt > dev/ichiic/ig4_acpi.c optional ig4 acpi iicbus > dev/ichiic/ig4_iic.c optional ig4 iicbus > dev/ichiic/ig4_pci.c optional ig4 pci iicbus > diff --git a/sys/conf/options b/sys/conf/options > index 03e8964e965d..a637b0b74a77 100644 > --- a/sys/conf/options > +++ b/sys/conf/options > @@ -885,6 +885,9 @@ DCONS_FORCE_GDB opt_dcons.h > HWPMC_DEBUG opt_global.h > HWPMC_HOOKS > =20 > +# Hardware Trace (HWT) framework options > +HWT_HOOKS > + > # 802.11 support layer > IEEE80211_DEBUG opt_wlan.h > IEEE80211_DEBUG_REFCNT opt_wlan.h > diff --git a/sys/dev/hwt/hwt.c b/sys/dev/hwt/hwt.c > new file mode 100644 > index 000000000000..c476e6031ba8 > --- /dev/null > +++ b/sys/dev/hwt/hwt.c > @@ -0,0 +1,242 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2023-2025 Ruslan Bukin > + * > + * This work was supported by Innovate UK project 105694, "Digital Secur= ity > + * by Design (DSbD) Technology Platform Prototype". > + * > + * 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 distributio= n. > + * > + * 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 PU= RPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIAB= LE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE= NTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOO= DS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S= TRICT > + * 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. > + */ > + > +/* > + * Hardware Tracing framework. > + * > + * The framework manages hardware tracing units that collect informat= ion > + * about software execution and store it as events in highly compressed = format > + * into DRAM. The events cover information about control flow changes of= a > + * program, whether branches taken or not, exceptions taken, timing info= rmation, > + * cycles elapsed and more. That allows us to restore entire program flo= w of a > + * given application without performance impact. > + * > + * Design overview. > + * > + * The framework provides character devices for mmap(2) and ioctl(2) = system > + * calls to allow user to manage CPU (hardware) tracing units. > + * > + * /dev/hwt: > + * .ioctl: > + * hwt_ioctl(): > + * a) HWT_IOC_ALLOC > + * Allocates kernel tracing context CTX based on reques= ted mode > + * of operation. Verifies the information that comes wi= th the > + * request (pid, cpus), allocates unique ID for the con= text. > + * Creates a new character device for CTX management. > + * > + * /dev/hwt_%d[_%d], ident[, thread_id] > + * .mmap > + * Maps tracing buffers of the corresponding thread to userspace. > + * .ioctl > + * hwt_thread_ioctl(): > + * a) HWT_IOC_START > + * Enables tracing unit for a given context. > + * b) HWT_IOC_RECORD_GET > + * Transfers (small) record entries collected during pr= ogram > + * execution for a given context to userspace, such as = mmaping > + * tables of executable and dynamic libraries, interpre= ter, > + * kernel mappings, tid of threads created, etc. > + * c) HWT_IOC_SET_CONFIG > + * Allows to specify backend-specific configuration of = the > + * trace unit. > + * d) HWT_IOC_WAKEUP > + * Wakes up a thread that is currently sleeping. > + * e) HWT_IOC_BUFPTR_GET > + * Transfers current hardware pointer in the filling bu= ffer > + * to the userspace. > + * f) HWT_IOC_SVC_BUF > + * To avoid data loss, userspace may notify kernel it h= as > + * copied out the given buffer, so kernel is ok to over= write > + * > + * HWT context lifecycle in THREAD mode of operation: > + * 1. User invokes HWT_IOC_ALLOC ioctl with information about pid to tra= ce and > + * size of the buffers for the trace data to allocate. > + * Some architectures may have different tracing units supported, so = user > + * also provides backend name to use for this context, e.g. "coresigh= t". > + * 2. Kernel allocates context, lookups the proc for the given pid. Then= it > + * creates first hwt_thread in the context and allocates trace buffer= s for > + * it. Immediately, kernel initializes tracing backend. > + * Kernel creates character device and returns unique identificator of > + * trace context to the user. > + * 3. To manage the new context, user opens the character device created. > + * User invokes HWT_IOC_START ioctl, kernel marks context as RUNNING. > + * At this point any HWT hook invocation by scheduler enables/disables > + * tracing for threads associated with the context (threads of the pr= oc). > + * Any new threads creation (of the target proc) procedures will be i= nvoking > + * corresponding hooks in HWT framework, so that new hwt_thread and b= uffers > + * allocated, character device for mmap(2) created on the fly. > + * 4. User issues HWT_IOC_RECORD_GET ioctl to fetch information about mm= aping > + * tables and threads created during application startup. > + * 5. User mmaps tracing buffers of each thread to userspace (using > + * /dev/hwt_%d_%d % (ident, thread_id) character devices). > + * 6. User can repeat 4 if expected thread is not yet created during tar= get > + * application execution. > + * 7. User issues HWT_IOC_BUFPTR_GET ioctl to get current filling level = of the > + * hardware buffer of a given thread. > + * 8. User invokes trace decoder library to process available data and s= ee the > + * results in human readable form. > + * 9. User repeats 7 if needed. > + * > + * HWT context lifecycle in CPU mode of operation: > + * 1. User invokes HWT_IOC_ALLOC ioctl providing a set of CPU to trace w= ithin > + * single CTX. > + * 2. Kernel verifies the set of CPU and allocates tracing context, crea= tes > + * a buffer for each CPU. > + * Kernel creates a character device for every CPU provided in the re= quest. > + * Kernel initialized tracing backend. > + * 3. User opens character devices of interest to map the buffers to use= rspace. > + * User can start tracing by invoking HWT_IOC_START on any of charact= er > + * device within the context, entire context will be marked as RUNNIN= G. > + * 4. The rest is similar to the THREAD mode. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define HWT_DEBUG > +#undef HWT_DEBUG > + > +#ifdef HWT_DEBUG > +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) > +#else > +#define dprintf(fmt, ...) > +#endif > + > +static eventhandler_tag hwt_exit_tag; > +static struct cdev *hwt_cdev; > +static struct cdevsw hwt_cdevsw =3D { > + .d_version =3D D_VERSION, > + .d_name =3D "hwt", > + .d_mmap_single =3D NULL, > + .d_ioctl =3D hwt_ioctl > +}; > + > +static void > +hwt_process_exit(void *arg __unused, struct proc *p) > +{ > + struct hwt_owner *ho; > + > + /* Stop HWTs associated with exiting owner, if any. */ > + ho =3D hwt_ownerhash_lookup(p); > + if (ho) > + hwt_owner_shutdown(ho); > +} > + > +static int > +hwt_load(void) > +{ > + struct make_dev_args args; > + int error; > + > + make_dev_args_init(&args); > + args.mda_devsw =3D &hwt_cdevsw; > + args.mda_flags =3D MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; > + args.mda_uid =3D UID_ROOT; > + args.mda_gid =3D GID_WHEEL; > + args.mda_mode =3D 0660; > + args.mda_si_drv1 =3D NULL; > + > + hwt_backend_load(); > + hwt_ctx_load(); > + hwt_contexthash_load(); > + hwt_ownerhash_load(); > + hwt_record_load(); > + > + error =3D make_dev_s(&args, &hwt_cdev, "hwt"); > + if (error !=3D 0) > + return (error); > + > + hwt_exit_tag =3D EVENTHANDLER_REGISTER(process_exit, hwt_process_exit, > + NULL, EVENTHANDLER_PRI_ANY); > + > + hwt_hook_load(); > + > + return (0); > +} > + > +static int > +hwt_unload(void) > +{ > + > + hwt_hook_unload(); > + EVENTHANDLER_DEREGISTER(process_exit, hwt_exit_tag); > + destroy_dev(hwt_cdev); > + hwt_record_unload(); > + hwt_ownerhash_unload(); > + hwt_contexthash_unload(); > + hwt_ctx_unload(); > + hwt_backend_unload(); > + > + return (0); > +} > + > +static int > +hwt_modevent(module_t mod, int type, void *data) > +{ > + int error; > + > + switch (type) { > + case MOD_LOAD: > + error =3D hwt_load(); > + break; > + case MOD_UNLOAD: > + error =3D hwt_unload(); > + break; > + default: > + error =3D 0; > + break; > + } > + > + return (error); > +} > + > +static moduledata_t hwt_mod =3D { > + "hwt", > + hwt_modevent, > + NULL > +}; > + > +DECLARE_MODULE(hwt, hwt_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); > +MODULE_VERSION(hwt, 1); > diff --git a/sys/dev/hwt/hwt_backend.c b/sys/dev/hwt/hwt_backend.c > new file mode 100644 > index 000000000000..1ba5db0d3d09 > --- /dev/null > +++ b/sys/dev/hwt/hwt_backend.c > @@ -0,0 +1,289 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2023-2025 Ruslan Bukin > + * > + * This work was supported by Innovate UK project 105694, "Digital Secur= ity > + * by Design (DSbD) Technology Platform Prototype". > + * > + * 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 distributio= n. > + * > + * 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 PU= RPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIAB= LE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE= NTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOO= DS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S= TRICT > + * 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. > + */ > + > +/* Hardware Trace (HWT) framework. */ > + > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > + > +#define HWT_BACKEND_DEBUG > +#undef HWT_BACKEND_DEBUG > + > +#ifdef HWT_BACKEND_DEBUG > +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) > +#else > +#define dprintf(fmt, ...) > +#endif > + > +static struct mtx hwt_backend_mtx; > + > +struct hwt_backend_entry { > + struct hwt_backend *backend; > + LIST_ENTRY(hwt_backend_entry) next; > +}; > + > +static LIST_HEAD(, hwt_backend_entry) hwt_backends; > + > +static MALLOC_DEFINE(M_HWT_BACKEND, "hwt_backend", "HWT backend"); > + > +int > +hwt_backend_init(struct hwt_context *ctx) > +{ > + int error; > + > + dprintf("%s\n", __func__); > + > + error =3D ctx->hwt_backend->ops->hwt_backend_init(ctx); > + > + return (error); > +} > + > +void > +hwt_backend_deinit(struct hwt_context *ctx) > +{ > + > + dprintf("%s\n", __func__); > + > + ctx->hwt_backend->ops->hwt_backend_deinit(ctx); > +} > + > +int > +hwt_backend_configure(struct hwt_context *ctx, int cpu_id, int thread_id) > +{ > + int error; > + > + dprintf("%s\n", __func__); > + > + error =3D ctx->hwt_backend->ops->hwt_backend_configure(ctx, cpu_id, > + thread_id); > + > + return (error); > +} > + > +void > +hwt_backend_enable(struct hwt_context *ctx, int cpu_id) > +{ > + > + dprintf("%s\n", __func__); > + > + ctx->hwt_backend->ops->hwt_backend_enable(ctx, cpu_id); > +} > + > +void > +hwt_backend_disable(struct hwt_context *ctx, int cpu_id) > +{ > + > + dprintf("%s\n", __func__); > + > + ctx->hwt_backend->ops->hwt_backend_disable(ctx, cpu_id); > +} > + > +void > +hwt_backend_enable_smp(struct hwt_context *ctx) > +{ > + > + dprintf("%s\n", __func__); > + > + ctx->hwt_backend->ops->hwt_backend_enable_smp(ctx); > +} > + > +void > +hwt_backend_disable_smp(struct hwt_context *ctx) > +{ > + > + dprintf("%s\n", __func__); > + > + ctx->hwt_backend->ops->hwt_backend_disable_smp(ctx); > +} > + > +void __unused > +hwt_backend_dump(struct hwt_context *ctx, int cpu_id) > +{ > + > + dprintf("%s\n", __func__); > + > + ctx->hwt_backend->ops->hwt_backend_dump(cpu_id); > +} > + > +int > +hwt_backend_read(struct hwt_context *ctx, struct hwt_vm *vm, int *ident, > + vm_offset_t *offset, uint64_t *data) > +{ > + int error; > + > + dprintf("%s\n", __func__); > + > + error =3D ctx->hwt_backend->ops->hwt_backend_read(vm, ident, > + offset, data); > + > + return (error); > +} > + > +struct hwt_backend * > +hwt_backend_lookup(const char *name) > +{ > + struct hwt_backend_entry *entry; > + struct hwt_backend *backend; > + > + HWT_BACKEND_LOCK(); > + LIST_FOREACH(entry, &hwt_backends, next) { > + backend =3D entry->backend; > + if (strcmp(backend->name, name) =3D=3D 0) { > + HWT_BACKEND_UNLOCK(); > + return (backend); > + } > + } > + HWT_BACKEND_UNLOCK(); > + > + return (NULL); > +} > + > +int > +hwt_backend_register(struct hwt_backend *backend) > +{ > + struct hwt_backend_entry *entry; > + > + if (backend =3D=3D NULL || > + backend->name =3D=3D NULL || > + backend->ops =3D=3D NULL) > + return (EINVAL); > + > + entry =3D malloc(sizeof(struct hwt_backend_entry), M_HWT_BACKEND, > + M_WAITOK | M_ZERO); > + entry->backend =3D backend; > + > + HWT_BACKEND_LOCK(); > + LIST_INSERT_HEAD(&hwt_backends, entry, next); > + HWT_BACKEND_UNLOCK(); > + > + return (0); > +} > + > +int > +hwt_backend_unregister(struct hwt_backend *backend) > +{ > + struct hwt_backend_entry *entry, *tmp; > + > + if (backend =3D=3D NULL) > + return (EINVAL); > + > + /* TODO: check if not in use */ > + > + HWT_BACKEND_LOCK(); > + LIST_FOREACH_SAFE(entry, &hwt_backends, next, tmp) { > + if (entry->backend =3D=3D backend) { > + LIST_REMOVE(entry, next); > + HWT_BACKEND_UNLOCK(); > + free(entry, M_HWT_BACKEND); > + return (0); > + } > + } > + HWT_BACKEND_UNLOCK(); > + > + return (ENOENT); > +} > + > +void > +hwt_backend_load(void) > +{ > + > + mtx_init(&hwt_backend_mtx, "hwt backend", NULL, MTX_DEF); > + LIST_INIT(&hwt_backends); > +} > + > +void > +hwt_backend_unload(void) > +{ > + > + /* TODO: ensure all unregistered */ > + > + mtx_destroy(&hwt_backend_mtx); > +} > + > +void > +hwt_backend_stop(struct hwt_context *ctx) > +{ > + dprintf("%s\n", __func__); > + > + ctx->hwt_backend->ops->hwt_backend_stop(ctx); > +} > + > +int > +hwt_backend_svc_buf(struct hwt_context *ctx, void *data, size_t data_siz= e, > + int data_version) > +{ > + int error; > + > + dprintf("%s\n", __func__); > + > + error =3D ctx->hwt_backend->ops->hwt_backend_svc_buf(ctx, data, data_si= ze, > + data_version); > + > + return (error); > +} > + > +int > +hwt_backend_thread_alloc(struct hwt_context *ctx, struct hwt_thread *thr) > +{ > + int error; > + > + dprintf("%s\n", __func__); > + > + if (ctx->hwt_backend->ops->hwt_backend_thread_alloc =3D=3D NULL) > + return (0); > + KASSERT(thr->private =3D=3D NULL, > + ("%s: thread private data is not NULL\n", __func__)); > + error =3D ctx->hwt_backend->ops->hwt_backend_thread_alloc(thr); > + > + return (error); > +} > + > +void > +hwt_backend_thread_free(struct hwt_thread *thr) > +{ > + dprintf("%s\n", __func__); > + > + if (thr->backend->ops->hwt_backend_thread_free =3D=3D NULL) > + return; > + KASSERT(thr->private !=3D NULL, > + ("%s: thread private data is NULL\n", __func__)); > + thr->backend->ops->hwt_backend_thread_free(thr); > + > + return; > +} > diff --git a/sys/dev/hwt/hwt_backend.h b/sys/dev/hwt/hwt_backend.h > new file mode 100644 > index 000000000000..3b6c9442a7a6 > --- /dev/null > +++ b/sys/dev/hwt/hwt_backend.h > @@ -0,0 +1,87 @@ > +/*- > + * Copyright (c) 2023-2025 Ruslan Bukin > + * > + * This work was supported by Innovate UK project 105694, "Digital Secur= ity > + * by Design (DSbD) Technology Platform Prototype". > + * > + * 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 distributio= n. > + * > + * 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 PU= RPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIAB= LE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE= NTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOO= DS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S= TRICT > + * 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. > + */ > + > +#ifndef _DEV_HWT_HWT_BACKEND_H_ > +#define _DEV_HWT_HWT_BACKEND_H_ > + > +struct hwt_backend_ops { > + int (*hwt_backend_init)(struct hwt_context *); > + int (*hwt_backend_deinit)(struct hwt_context *); > + int (*hwt_backend_configure)(struct hwt_context *, int cpu_id, > + int thread_id); > + int (*hwt_backend_svc_buf)(struct hwt_context *, void *data, > + size_t data_size, int data_version); > + void (*hwt_backend_enable)(struct hwt_context *, int cpu_id); > + void (*hwt_backend_disable)(struct hwt_context *, int cpu_id); > + int (*hwt_backend_read)(struct hwt_vm *, int *ident, > + vm_offset_t *offset, uint64_t *data); > + void (*hwt_backend_stop)(struct hwt_context *); > + /* For backends that are tied to local CPU registers */ > + int (*hwt_backend_enable_smp)(struct hwt_context *); > + int (*hwt_backend_disable_smp)(struct hwt_context *); > + /* Allocation and initialization of backend-specific thread data. */ > + int (*hwt_backend_thread_alloc)(struct hwt_thread *); > + void (*hwt_backend_thread_free)(struct hwt_thread *); > + /* Debugging only. */ > + void (*hwt_backend_dump)(int cpu_id); > +}; > + > +struct hwt_backend { > + const char *name; > + struct hwt_backend_ops *ops; > + /* buffers require kernel virtual addresses */ > + bool kva_req; > +}; > + > +int hwt_backend_init(struct hwt_context *ctx); > +void hwt_backend_deinit(struct hwt_context *ctx); > +int hwt_backend_configure(struct hwt_context *ctx, int cpu_id, int threa= d_id); > +void hwt_backend_enable(struct hwt_context *ctx, int cpu_id); > +void hwt_backend_disable(struct hwt_context *ctx, int cpu_id); > +void hwt_backend_enable_smp(struct hwt_context *ctx); > +void hwt_backend_disable_smp(struct hwt_context *ctx); > +void hwt_backend_dump(struct hwt_context *ctx, int cpu_id); > +int hwt_backend_read(struct hwt_context *ctx, struct hwt_vm *vm, int *id= ent, > + vm_offset_t *offset, uint64_t *data); > +int hwt_backend_register(struct hwt_backend *); > +int hwt_backend_unregister(struct hwt_backend *); > +void hwt_backend_stop(struct hwt_context *); > +int hwt_backend_svc_buf(struct hwt_context *ctx, void *data, size_t data= _size, > + int data_version); > +struct hwt_backend * hwt_backend_lookup(const char *name); > +int hwt_backend_thread_alloc(struct hwt_context *ctx, struct hwt_thread = *); > +void hwt_backend_thread_free(struct hwt_thread *); > + > +void hwt_backend_load(void); > +void hwt_backend_unload(void); > + > +#define HWT_BACKEND_LOCK() mtx_lock(&hwt_backend_mtx) > +#define HWT_BACKEND_UNLOCK() mtx_unlock(&hwt_backend_mtx) > + > +#endif /* !_DEV_HWT_HWT_BACKEND_H_ */ > + > diff --git a/sys/dev/hwt/hwt_config.c b/sys/dev/hwt/hwt_config.c > new file mode 100644 > index 000000000000..30688e7fc76b > --- /dev/null > +++ b/sys/dev/hwt/hwt_config.c > @@ -0,0 +1,108 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2023-2025 Ruslan Bukin > + * > + * This work was supported by Innovate UK project 105694, "Digital Secur= ity > + * by Design (DSbD) Technology Platform Prototype". > + * > + * 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 distributio= n. > + * > + * 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 PU= RPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIAB= LE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE= NTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOO= DS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S= TRICT > + * 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 > +#include > +#include > +#include > +#include > + > +#define HWT_MAXCONFIGSIZE PAGE_SIZE > + > +#define HWT_CONFIG_DEBUG > +#undef HWT_CONFIG_DEBUG > + > +#ifdef HWT_CONFIG_DEBUG > +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) > +#else > +#define dprintf(fmt, ...) > +#endif > + > +static MALLOC_DEFINE(M_HWT_CONFIG, "hwt_config", "HWT config"); > + > +int > +hwt_config_set(struct thread *td, struct hwt_context *ctx, > + struct hwt_set_config *sconf) > +{ > + size_t config_size; > + void *old_config; > + void *config; > + int error; > + > + config_size =3D sconf->config_size; > + if (config_size =3D=3D 0) > + return (0); > + > + if (config_size > HWT_MAXCONFIGSIZE) > + return (EFBIG); > + > + config =3D malloc(config_size, M_HWT_CONFIG, M_WAITOK | M_ZERO); > + > + error =3D copyin(sconf->config, config, config_size); > + if (error) { > + free(config, M_HWT_CONFIG); > + return (error); > + } > + > + HWT_CTX_LOCK(ctx); > + old_config =3D ctx->config; > + ctx->config =3D config; > + ctx->config_size =3D sconf->config_size; > + ctx->config_version =3D sconf->config_version; > + HWT_CTX_UNLOCK(ctx); > + > + if (old_config !=3D NULL) > + free(old_config, M_HWT_CONFIG); > + > + return (error); > +} > + > +void > +hwt_config_free(struct hwt_context *ctx) > +{ > + > + if (ctx->config =3D=3D NULL) > + return; > + > + free(ctx->config, M_HWT_CONFIG); > + > + ctx->config =3D NULL; > +} > diff --git a/sys/dev/hwt/hwt_config.h b/sys/dev/hwt/hwt_config.h > new file mode 100644 > index 000000000000..47485583063c > --- /dev/null > +++ b/sys/dev/hwt/hwt_config.h > @@ -0,0 +1,36 @@ > +/*- > + * Copyright (c) 2023-2025 Ruslan Bukin > + * > + * This work was supported by Innovate UK project 105694, "Digital Secur= ity > + * by Design (DSbD) Technology Platform Prototype". > + * > + * 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 distributio= n. > + * > + * 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 PU= RPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIAB= LE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE= NTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOO= DS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S= TRICT > + * 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. > + */ > + > +#ifndef _DEV_HWT_HWT_CONFIG_H_ > +#define _DEV_HWT_HWT_CONFIG_H_ > + > +int hwt_config_set(struct thread *td, struct hwt_context *ctx, > + struct hwt_set_config *sconf); > +void hwt_config_free(struct hwt_context *ctx); > + > +#endif /* !_DEV_HWT_HWT_CONFIG_H_ */ > diff --git a/sys/dev/hwt/hwt_context.c b/sys/dev/hwt/hwt_context.c > new file mode 100644 > index 000000000000..9af76cffc928 > --- /dev/null > +++ b/sys/dev/hwt/hwt_context.c > @@ -0,0 +1,201 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2023-2025 Ruslan Bukin > + * > + * This work was supported by Innovate UK project 105694, "Digital Secur= ity > + * by Design (DSbD) Technology Platform Prototype". > + * > + * 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 distributio= n. > + * > + * 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 PU= RPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIAB= LE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE= NTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOO= DS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S= TRICT > + * 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 > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define HWT_DEBUG > +#undef HWT_DEBUG > + > +#ifdef HWT_DEBUG > +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) > +#else > +#define dprintf(fmt, ...) > +#endif > + > +static MALLOC_DEFINE(M_HWT_CTX, "hwt_ctx", "Hardware Trace"); > + > +static bitstr_t *ident_set; > +static int ident_set_size; > +static struct mtx ident_set_mutex; > + > +static int > +hwt_ctx_ident_alloc(int *new_ident) > +{ > + > + mtx_lock(&ident_set_mutex); > + bit_ffc(ident_set, ident_set_size, new_ident); > + if (*new_ident =3D=3D -1) { > + mtx_unlock(&ident_set_mutex); > + return (ENOMEM); > + } > + bit_set(ident_set, *new_ident); > + mtx_unlock(&ident_set_mutex); > + > + return (0); > mtx)+} > *** 3705 LINES SKIPPED *** >=20 The commit breaks buildkernel: [...] /usr/src/sys/dev/hwt/hwt_contexthash.c:82:2: error: call to undeclared func= tion 'spinlock_enter'; ISO C99 and later do not support implicit function declar= ations [-Werror,-Wimplicit-function-declaration] 82 | HWT_CTXHASH_LOCK(); = | ^ /usr/src/sys/dev/hwt/hwt_contexthash.h:39:28: note: expanded from macro 'HW= T_CTXHASH_LOCK' 39 | #define HWT_CTXHASH_LOCK() mtx_lock_spin(&hwt_contexthash_mtx) --=20 A FreeBSD user --Sig_/3I0jjIvEcihbKSr1ynFm8_. Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRQheDybVktG5eW/1Kxzvs8OqokrwUCaGatoAAKCRCxzvs8Oqok r6jlAQC1X4ctrt+f7nsUI+hl90xr4NCYgS/ARf+VAQ2HaYSvUgD/U4IheiZMxYfE R1VeAZLNhXDSy7ChuOTSrmFp+REcews= =vmHu -----END PGP SIGNATURE----- --Sig_/3I0jjIvEcihbKSr1ynFm8_.-- From nobody Thu Jul 3 16:25:03 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY2DH6mc8z61LYv; Thu, 03 Jul 2025 16:25: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY2DH60Scz3TBQ; Thu, 03 Jul 2025 16:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751559903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2FNiIeJZWXry/zzWvtrS8YGURnG7N7Mwr6RPjGbzmMM=; b=ak8TOb4Q9tfJlvRJwI4Y7qEVe0O8BCDJuEQOnZx+lg43t3gUvm/cj9kaALdBeimFzCoz1G 5XhfOAR62AT0qAT85hVQ+CRLQBVctKJn9nriVV+z+MHDR/2E4Tl9qhGnXqjmMPWV2T+1v2 KnT2GzJvfpAXuBe0vkgAfxT4u3nlaG8pJXcrpLUbF/LKGyDYPNoQ9Q0EKVlfnmFshzw8vE 4tEJHrXKkmGgotHggq77WJOFkWfRTqcmee66uGVjL3qDTeODOQ5kMB+mnQwkY2EqUlxi8R oi1AdKqojPH83kULnKSeRHZsgdysaMHioU7PvuEI5bISz0XqP19Gq+YHMWnMgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751559903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2FNiIeJZWXry/zzWvtrS8YGURnG7N7Mwr6RPjGbzmMM=; b=GXz+vYWAq0Tfr1Z0eLl1z7+1bgnSzPKOzwNOPj+pWcQqay+I3tEKPbKHlisuEiKNzJXHIj uTgbcwazUpbPhWMedUysRfJIAXTO6vAA+U8V7HyN5vj+rMoLsKbDi8Dx/aOAZWzRZK5Qia GmBH/YZ3ekut3Y8hkHa9KJTWpsjw9KXxhUDpuFhIFRqQ/gxo53AxuHx3G2et9818xBOruD 99xKikUkgr5PK4Om2ywzsfIZXPNiA+DAQ63+ALNYBMtURRjk0K0Cw9lmq31rsf56eHX2Mb rqDCo0paxhcJgQNObEC87RREomzscFHbnTv3mx6X7mdkZT/J81Wm2RgdCfdBvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751559903; a=rsa-sha256; cv=none; b=UR2A8ltF3ScadfWbOAcEjjmHEj6m2M3PJWUSMXCXIw9m1ZVMush4+WHDSPidfON0/l33S8 8qffqgPg88TRR2PD/LSUMeismKNpDtrQDEborM7dH9OEkjo2duLzpxByUkx5kLUrJTRVgx TIVS3s1c4XLhgxBVjmP2svNNAbpJIeCBEB/TcOW75HoMOsznuZhdMHzjok1fEWVOnc4yLL y67G8uVYti4+m0ZItRZ/mCZCFinCuRVn1BzMwJnoWWAYfYwPj3tbP0Iz5F8DZQ2U644fgi TaaqT34plBy5L3YRWEWKigDME8M0HSfLNAVd2wkfYdVQrZ/em1b8zjRQOQ5FVQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY2DH5BZVz1BSJ; Thu, 03 Jul 2025 16:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563GP3jD045799; Thu, 3 Jul 2025 16:25:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563GP315045796; Thu, 3 Jul 2025 16:25:03 GMT (envelope-from git) Date: Thu, 3 Jul 2025 16:25:03 GMT Message-Id: <202507031625.563GP315045796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 6b8f0b47776b - main - fusefs: Upgrade FUSE protocol to version 7.35. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b8f0b47776bac6e4d2b7e4cfcecea485e4d91f9 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=6b8f0b47776bac6e4d2b7e4cfcecea485e4d91f9 commit 6b8f0b47776bac6e4d2b7e4cfcecea485e4d91f9 Author: Claudiu I. Palincas AuthorDate: 2025-06-27 16:33:37 +0000 Commit: Alan Somers CommitDate: 2025-07-03 16:23:10 +0000 fusefs: Upgrade FUSE protocol to version 7.35. Upgrade the FUSE API from protocol 7.33 to 7.35. Add support for FOPEN_NOFLUSH, introduced in 7.35. Also, reduce diffs vis-a-vis upstream by factoring out an ioctl type, a change missed in d5e3cf41e89. Signed-off-by: Claudiu I. Palincas Reviewed by: asomers Pull Request: https://github.com/freebsd/freebsd-src/pull/1744 --- sys/fs/fuse/fuse_file.h | 2 +- sys/fs/fuse/fuse_kernel.h | 18 ++++++++++++++++-- sys/fs/fuse/fuse_vnops.c | 4 ++++ tests/sys/fs/fusefs/flush.cc | 30 ++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/sys/fs/fuse/fuse_file.h b/sys/fs/fuse/fuse_file.h index 2a90e66d1b23..232132473953 100644 --- a/sys/fs/fuse/fuse_file.h +++ b/sys/fs/fuse/fuse_file.h @@ -139,7 +139,7 @@ struct fuse_filehandle { /* * flags returned by FUSE_OPEN - * Supported flags: FOPEN_DIRECT_IO, FOPEN_KEEP_CACHE + * Supported flags: FOPEN_DIRECT_IO, FOPEN_KEEP_CACHE, FOPEN_NOFLUSH * Unsupported: * FOPEN_NONSEEKABLE: Adding support would require a new per-file * or per-vnode attribute, which would have to be checked by diff --git a/sys/fs/fuse/fuse_kernel.h b/sys/fs/fuse/fuse_kernel.h index c95caf898ad8..942448b47365 100644 --- a/sys/fs/fuse/fuse_kernel.h +++ b/sys/fs/fuse/fuse_kernel.h @@ -182,6 +182,12 @@ * - add FUSE_OPEN_KILL_SUIDGID * - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT * - add FUSE_SETXATTR_ACL_KILL_SGID + * + * 7.34 + * - add FUSE_SYNCFS + * + * 7.35 + * - add FOPEN_NOFLUSH */ #ifndef _FUSE_FUSE_KERNEL_H @@ -217,7 +223,7 @@ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 33 +#define FUSE_KERNEL_MINOR_VERSION 35 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 @@ -288,12 +294,14 @@ struct fuse_file_lock { * FOPEN_NONSEEKABLE: the file is not seekable * FOPEN_CACHE_DIR: allow caching this directory * FOPEN_STREAM: the file is stream-like (no file position at all) + * FOPEN_NOFLUSH: don't flush data cache on close (unless FUSE_WRITEBACK_CACHE) */ #define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_KEEP_CACHE (1 << 1) #define FOPEN_NONSEEKABLE (1 << 2) #define FOPEN_CACHE_DIR (1 << 3) #define FOPEN_STREAM (1 << 4) +#define FOPEN_NOFLUSH (1 << 5) /** * INIT request/reply flags @@ -518,6 +526,7 @@ enum fuse_opcode { FUSE_COPY_FILE_RANGE = 47, FUSE_SETUPMAPPING = 48, FUSE_REMOVEMAPPING = 49, + FUSE_SYNCFS = 50, #ifdef linux /* CUSE specific operations */ @@ -939,7 +948,8 @@ struct fuse_notify_retrieve_in { }; /* Device ioctls: */ -#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) +#define FUSE_DEV_IOC_MAGIC 229 +#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t) struct fuse_lseek_in { uint64_t fh; @@ -992,4 +1002,8 @@ struct fuse_removemapping_one { #define FUSE_REMOVEMAPPING_MAX_ENTRY \ (PAGE_SIZE / sizeof(struct fuse_removemapping_one)) +struct fuse_syncfs_in { + uint64_t padding; +}; + #endif /* _FUSE_FUSE_KERNEL_H */ diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 107e6db299e0..c0ec5a94b8d3 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -289,6 +289,10 @@ fuse_flush(struct vnode *vp, struct ucred *cred, pid_t pid, int fflag) if (err) return err; + if (fufh->fuse_open_flags & FOPEN_NOFLUSH && + (!fsess_opt_writeback(vnode_mount(vp)))) + return (0); + fdisp_init(&fdi, sizeof(*ffi)); fdisp_make_vp(&fdi, FUSE_FLUSH, vp, td, cred); ffi = fdi.indata; diff --git a/tests/sys/fs/fusefs/flush.cc b/tests/sys/fs/fusefs/flush.cc index 474cdbdb2203..7ba1218b3287 100644 --- a/tests/sys/fs/fusefs/flush.cc +++ b/tests/sys/fs/fusefs/flush.cc @@ -109,6 +109,36 @@ TEST_F(Flush, open_twice) EXPECT_EQ(0, close(fd)) << strerror(errno); } +/** + * Test for FOPEN_NOFLUSH: we expect that zero flush calls will be performed. + */ +TEST_F(Flush, open_noflush) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + uint64_t pid = (uint64_t)getpid(); + int fd; + + expect_lookup(RELPATH, ino, 1); + expect_open(ino, FOPEN_NOFLUSH, 1); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_FLUSH && + in.header.nodeid == ino && + in.body.flush.lock_owner == pid && + in.body.flush.fh == FH); + }, Eq(true)), + _) + ).Times(0); + expect_release(); + + fd = open(FULLPATH, O_WRONLY); + ASSERT_LE(0, fd) << strerror(errno); + // close MUST not flush + EXPECT_EQ(0, close(fd)) << strerror(errno); +} + /* * Some FUSE filesystem cache data internally and flush it on release. Such * filesystems may generate errors during release. On Linux, these get From nobody Thu Jul 3 17:03:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY34V46vSz61Q1H; Thu, 03 Jul 2025 17:03: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY34V2CF9z3X4m; Thu, 03 Jul 2025 17:03:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751562202; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=phCS2ie7cZp3jJHem68V/jNl/aquEKjm9OHP3zcrJCs=; b=KHI020F+8/CfXlYbVUKx2jQ0VjJpZycpH6DShgq0Q+WI5cUQukSr2py8kQqQ99zYN3NF/n 4Jz7CI9xHMv2mvxKi+F2kRmPxVl/FsOpVUWzkDUGyCyq0L0MmkM5d8vzZht1Q8XIAkGq2L bBVDHpE1AlZQVvxRjQ0YK+Cz1gjJnYLQ4VtUgDJecJfHaAEwEex3iaEATXQ8GvMm/b2iEh yeQJpACkCCbt6vBOXoOUg36V6RsgM13eeirlbaL20ykkhg5rGeMqfwhbx20l580I2w2Z4J YmUeWOwfBo46pzXV3HnxOm4GaXLaZKCrBWRMt/3jNabl/s0g7K+zdxsPYQ5EYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751562202; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=phCS2ie7cZp3jJHem68V/jNl/aquEKjm9OHP3zcrJCs=; b=RgLh90MnTSl4KnUE+M9tAjA3fSr4HHSpZljlQjLiENgm9cFzi3bmHTr2gKf161Wyv/UYnh FZAYefYQri6c8rZNZesTnLEGEewSgalVG+cj4OIT7PJ5mOYAsXiVkiPTG4aJowaQfciVF9 ywVzkWz5HSIg+6oagKBjfHCRWIRHPY5tNc/1sZRuvRg3nTiplaAy0PIqqW2P/GlR+y2E/E iAva1NbG0O915iE28PFDBZJmMD4gBsmWRt+t30GpKhkDUGbNGkztSJ8bD0ntrt+IupRVpc kdGwOem2Nt0bEq7/soq/Ecl5DNcGw2Aiepa7BaJZVdM09ZPEjXKuL/BgVM5TpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751562202; a=rsa-sha256; cv=none; b=vj+xSwXccQxzRrcH3hYnRc/ALxWxgHX1NB+qru3BYA+5NGi7QULeIZLYplcC+eP3/ejiOf VFFpyWZ7Y2n4ZaCaMFYugpfvTZ2xWauVKQxO4LDWF6XK+nBqdAbXa8pNWQX6Vg8O1w0oOl gDdbDejPYg6fhFPij34ugWARRSTB574bWIi9376fz0G1ryklEie5ZFUfDKjG5e4qnfFR3U HdYRkoHJEiLb2lObBxMhyJlPaSomCOFqNOT/zG4K0okMXvHsJpLwfv3/3pQTRbcsSgO+Zv SX9h8G+35kvF3PbpPcr2yiGQalQwq2tDPL8T7ofxcbvPr/KtAC47F5JdwwjgpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY34V1hfTz1CkF; Thu, 03 Jul 2025 17:03:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563H3MBv020595; Thu, 3 Jul 2025 17:03:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563H3Mrc020592; Thu, 3 Jul 2025 17:03:22 GMT (envelope-from git) Date: Thu, 3 Jul 2025 17:03:22 GMT Message-Id: <202507031703.563H3Mrc020592@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 027beb002bc5 - main - vmm: Add a missing entry to the ioctl table List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 027beb002bc505301f6bf6ea47fcd8dd15614022 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=027beb002bc505301f6bf6ea47fcd8dd15614022 commit 027beb002bc505301f6bf6ea47fcd8dd15614022 Author: Mark Johnston AuthorDate: 2025-07-03 17:02:10 +0000 Commit: Mark Johnston CommitDate: 2025-07-03 17:02:43 +0000 vmm: Add a missing entry to the ioctl table Reported by: acm Fixes: b9ef152bec6c ("vmm: Merge vmm_dev.c") --- sys/dev/vmm/vmm_dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/vmm/vmm_dev.c b/sys/dev/vmm/vmm_dev.c index 1ffa15dd157b..819debadd1ac 100644 --- a/sys/dev/vmm/vmm_dev.c +++ b/sys/dev/vmm/vmm_dev.c @@ -351,6 +351,7 @@ static const struct vmmdev_ioctl vmmdev_ioctls[] = { VMMDEV_IOCTL(VM_ACTIVATE_CPU, VMMDEV_IOCTL_LOCK_ONE_VCPU), VMMDEV_IOCTL(VM_INJECT_EXCEPTION, VMMDEV_IOCTL_LOCK_ONE_VCPU), VMMDEV_IOCTL(VM_STATS, VMMDEV_IOCTL_LOCK_ONE_VCPU), + VMMDEV_IOCTL(VM_STAT_DESC, 0), #if defined(__amd64__) && defined(COMPAT_FREEBSD12) VMMDEV_IOCTL(VM_ALLOC_MEMSEG_12, From nobody Thu Jul 3 17:35:49 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY3nx55h5z61TPB; Thu, 03 Jul 2025 17:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY3nx1nkqz3b32; Thu, 03 Jul 2025 17:35:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751564149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MONqv4ByfYSX79ZGBJYhxp9CZTJiOdSiHj5wSbKTpOA=; b=EYpjz7RfLRKVgulzXuFMJSO4yqwnQvNUALZkXBen/2N3J/mDcv6s5W0bVkLcd6fF94saqZ JWvaUK5t+WLUY35HyNFj9WdX6U1S8Jv1CYUCySSky5gYtYDvVqQGlUKH3HNd/lipOa7cJM gge/ke7PEya+tenr/fKE6I/s/Ofl3cjaov3VR3ks0qMZk1at5d1fOlLQIXGEHPJ18aZTx0 cGsVT2bt2ngpewUB6v3AdzIjo7rKcHD2DK1QRJnCQuyDo5MelfI7DFhFe+P6ZCIJzQBFgw OcYSSG50cORGS5yIpPvHpmThaqPphzrLI6xKL21alosAf3cy7ol8ihmTLJMq4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751564149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MONqv4ByfYSX79ZGBJYhxp9CZTJiOdSiHj5wSbKTpOA=; b=tiMtFb5URuuVl/hac7slMjKmWbQzhnH4Y0LA+GxunhYeywwdCdrpjPwHUeKmXz+RtAglo0 578kEqUHHvfuQEHTzHcl/2mEKmq2Q8FaXz7cK7R+EZvHGZ1UUVjwkwdCThKRjU/UOjieTk xbau8Ntc119P0FiXuJwlQmTmxK0sPTOBM4JYBqtRFmE8T4rF1ixagehzUIN/kMWpQrINuH 6giMiGlRNmVKRdW5tHhMRyJJAnxRbbN4JGhuKooP4lUoBk+LV4vCx8wfRRGzQxVOHMy9Zp jGN8o0/1Q3zUf5GrtxMUb4e+F1BGzKsFKpnNUKjybb/hJvELZd95LBMpDYUYRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751564149; a=rsa-sha256; cv=none; b=pXY/QbPluSIyLMbs0EQldVT1DR/8MFslkZ874XpcCrpLLeFvd6SbQ83yWePkt0kCl70UZ8 XQljjXnQB5UH+u0Snb3SmPwqBagsc5FerUNmh5TdZJX8hDtXqpsk0pHWRwPLjjUITxep7n tGiT+O7Yd6UpEAWD0x3tV+LGeoT7aGn8V/VeGICe7nyOy9h+J8y8MSVqsjbuk0gf78YV3w neDB9m406jRZfOB7fE4ZQgU2oKxiU8rlwMvugkTcrXBlpKTxyjMRTEyIfCCNQRAPHhpCGd 9LHLJdrB8MNBC8RFhreBIoySoAiVBWbcjVNRMysu5pKxVLpsCDg7THNGseJ1OA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY3nx1FnVzPF; Thu, 03 Jul 2025 17:35:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563HZn20076065; Thu, 3 Jul 2025 17:35:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563HZnXu076062; Thu, 3 Jul 2025 17:35:49 GMT (envelope-from git) Date: Thu, 3 Jul 2025 17:35:49 GMT Message-Id: <202507031735.563HZnXu076062@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6ccf1801f225 - main - random: Replace a comment with a static assertion List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ccf1801f225a5e3e71d5b707646731542a994c7 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6ccf1801f225a5e3e71d5b707646731542a994c7 commit 6ccf1801f225a5e3e71d5b707646731542a994c7 Author: Mark Johnston AuthorDate: 2025-07-03 17:21:18 +0000 Commit: Mark Johnston CommitDate: 2025-07-03 17:21:18 +0000 random: Replace a comment with a static assertion No functional change intended. Reviewed by: cem MFC after: 1 week Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51110 --- sys/dev/random/random_harvestq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index 379b64ac15f1..ccc66019e8ff 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -212,9 +212,10 @@ random_kthread(void) kproc_exit(0); /* NOTREACHED */ } -/* This happens well after SI_SUB_RANDOM */ SYSINIT(random_device_h_proc, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, kproc_start, &random_proc_kp); +_Static_assert(SI_SUB_KICK_SCHEDULER > SI_SUB_RANDOM, + "random kthread starting before subsystem initialization"); static void rs_epoch_init(void *dummy __unused) From nobody Thu Jul 3 17:35:50 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY3nz2LRnz61T8V; Thu, 03 Jul 2025 17:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY3ny37qGz3Zs2; Thu, 03 Jul 2025 17:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751564150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LO0lR/ZZvfJwl0t6QcPaeGPLb7IksuS9ZNa6w/yHPOo=; b=ZELLvfnxTSvd6WWfhzpQD4Lj2SdhMZ7sz20j/3OckyKisD8juFmdNl8KNwTlKsmE6NhCRP Ar2/VC3h/orRL8rnxCoh7wPZz6iDLkVkfFcn6CfoWfLJUV1KXbX+Gf2eJOkykp00UyY+N0 oESiQOK0CqmpCCowfc7yaPZoA8boyi0LVMvzLEWpIGak408LSyw5xJCUBOk20w1clEZe1F ekU/eGFb9yP4sb4CGQLAkdXIaPWtOlzDWENKwDxCB37aKaBH7bDvati/crTH6GWHrZYzVw kqfwQ8wt5d3PB5i4vq+PSTGrKBjSiON7O4A/do5HQ/BAE+fHMbhkY65NJN0SIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751564150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LO0lR/ZZvfJwl0t6QcPaeGPLb7IksuS9ZNa6w/yHPOo=; b=M/kdt4b0K8K9KonbU3fJf9X2Kfmg40Fhhf4GxaFMkVlUJwnyas+bf9iEnSxmEyuA+wxSy+ YU9eK2CpkTs/zWrBiKU2uMjCGiEABSznlM3LquZ/dGkK/DhRIyqcT4xBY60JgW+mMhPmzL bbyIBauVpNb/4dBm4e0eJb9LhB4bdvUbkIw0ZRZvWh7fviw2qre614Ja6IHZz9ZZ7c8yyz HRoyl7Ro8nTaEfloIDuDxiZR/tHnyGJ/Il3NIpSOS8ncg6PduEHdEqK2dvQME7SJe/56L7 KBGrI5no3FmY3+TdDpyfInV2uuMCAOjuq4c3+iS0kFcEtWOpyvVckqo/5MiD/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751564150; a=rsa-sha256; cv=none; b=ouzELR2v48MU8Yw3QEM6OFfbMqf2/MQtqBaSRzCsMu4NIjEOuQqw6IIxkrD8G4z+MYuIY/ OC45Z7of5LqDl3jjTdrblDK8d0kDyVuH1OL6INHUEO6Zv32UjaTaIiPwpX6kQep48TtOXX YbjGE+EEIvhZVtd5tIMF35x+hbRUVaK7ajNb3GZidKCqh+gAQReDFx4vwJealG+6fJf7lW iqP1/I9p/5L4TQLSxSc2R94Sn618pH23KV078gkrwY7M9A/NaDl/INVBHAWduUL+lG2u8q N1W5NAbmfMK8/qvcf22J/syQJRiXIGccipg5m+s4rWT5pNzGjPJOXttEpjHnSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY3ny2TKJzJ9; Thu, 03 Jul 2025 17:35:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563HZoVM076099; Thu, 3 Jul 2025 17:35:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563HZo3n076096; Thu, 3 Jul 2025 17:35:50 GMT (envelope-from git) Date: Thu, 3 Jul 2025 17:35:50 GMT Message-Id: <202507031735.563HZo3n076096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4b8b872a9c55 - main - random: Move entropy harvest queue lock macros to random_harvestq.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b8b872a9c55c040eb83f917fc8fd2bf908b96a9 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4b8b872a9c55c040eb83f917fc8fd2bf908b96a9 commit 4b8b872a9c55c040eb83f917fc8fd2bf908b96a9 Author: Mark Johnston AuthorDate: 2025-07-03 17:21:37 +0000 Commit: Mark Johnston CommitDate: 2025-07-03 17:21:37 +0000 random: Move entropy harvest queue lock macros to random_harvestq.c They can't be used externally, so it makes no sense to have them in a header. No functional change intended. Reviewed by: cem MFC after: 1 week Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51111 --- sys/dev/random/random_harvestq.c | 5 +++++ sys/dev/random/random_harvestq.h | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index ccc66019e8ff..1a8cbd9dcad7 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -161,6 +161,11 @@ static struct harvest_context { } hc_entropy_fast_accumulator; } harvest_context; +#define RANDOM_HARVEST_INIT_LOCK() mtx_init(&harvest_context.hc_mtx, \ + "entropy harvest mutex", NULL, MTX_SPIN) +#define RANDOM_HARVEST_LOCK() mtx_lock_spin(&harvest_context.hc_mtx) +#define RANDOM_HARVEST_UNLOCK() mtx_unlock_spin(&harvest_context.hc_mtx) + static struct kproc_desc random_proc_kp = { "rand_harvestq", random_kthread, diff --git a/sys/dev/random/random_harvestq.h b/sys/dev/random/random_harvestq.h index 69a9dfabd44a..edeb4ff7a17f 100644 --- a/sys/dev/random/random_harvestq.h +++ b/sys/dev/random/random_harvestq.h @@ -40,8 +40,4 @@ struct harvest_event { uint8_t he_source; /* origin of the entropy */ }; -#define RANDOM_HARVEST_INIT_LOCK(x) mtx_init(&harvest_context.hc_mtx, "entropy harvest mutex", NULL, MTX_SPIN) -#define RANDOM_HARVEST_LOCK(x) mtx_lock_spin(&harvest_context.hc_mtx) -#define RANDOM_HARVEST_UNLOCK(x) mtx_unlock_spin(&harvest_context.hc_mtx) - #endif /* SYS_DEV_RANDOM_RANDOM_HARVESTQ_H_INCLUDED */ From nobody Thu Jul 3 17:35:52 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY3p06K9bz61TCc; Thu, 03 Jul 2025 17:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY3p04dCWz3b3C; Thu, 03 Jul 2025 17:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751564152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ItlO6jyeeQZtRbRXHfySFedj96Tvd23Nf5cyiSA/+Nw=; b=UB5ph6I7gSgfX/WhPpYgvOYC36jh/DRRpmq5fgCjwB7igsyBl7381PJSd8k/X6UZXkwAMi BqCkck868SsLAaqww3yUqEZZCe2Q2RBSvqGG+WGJAL2a3mFx5rzMtoq7bjOjKNBxykGWaF 1tpQmZbkh+84ibz6z1NKR0uMA1WKY7jHVFRWqgPBd8hk6ePt2BkS0So1QlAOVuXLjWZ3gA b0T3nVM6Rb+bEzNgOR33UgFhTINq9qLsPE/XdTn2z1ojl/d5M+Bw9ppcbaz1ZgdMgwj/Oq lZRfjLWWOGLZwivESa70kTy/qFnJfRtDXbmFQ/9umgBjQPU9iZwmtfkfnAf9kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751564152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ItlO6jyeeQZtRbRXHfySFedj96Tvd23Nf5cyiSA/+Nw=; b=neeVQ23sWtkHC5w4dwsh99x08AZabWz6Zkogr4/OXtXbvS4xhLFmZAcUB+GH25B3xFg5BH cl5cP//tE4N92ZgX2cGmu9B5NXoPWQHkGIwpAwUYKCw8Ae0WezCSFRkcLOAy1iiyLwSk22 ub9U9UT079meYJLkGReee7NW8frSMKrK0M5L1MbclWCc0UDtxe/GxJ+8xoTy6ZyM5PIojI OcLhglsVN59SOq7p3Nw9ybSzyu63PC2yfNZC9wPcTO7XdsU17vgBSFzX0vUfHUWE/AVk2P +XXb04hHamhy/9s/8EWbNPzOrWKPBUqTAlrWRXn176Rm3iR6dZU8vB01M7pazw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751564152; a=rsa-sha256; cv=none; b=oU3GKY053YzELZVhpWmKQwofRGG8ZCRNMJTboZeTNznSKQSAUM4S9U0dQbhakdD9wWkeKh KlbenS5pNTtHl4ClbELrCfjQORszMdpMCS6p+I+xt+qLNYc+k2hXNgkUldsDILD9CM7BLR tKX7sGz735Jps58Nw7LcOfKJfIkrjWGM8RtBivXoLqQrJgC0XnvxUwt5fy7vclGeuBqBU9 u2LcTmybPKM4ufFIuNU/7yFS0Rf5iW2YlmsbFJXmijAJNY6kYhE6783Lf4UmHc7AcPwDLG //Fpj41nwsXPGlDYLt69Rfj4irXMgieAcZpZ5b5vH5B4aAaDFvMVJwc+fSOROw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY3p0447ZzXX; Thu, 03 Jul 2025 17:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563HZqg2076174; Thu, 3 Jul 2025 17:35:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563HZqqK076171; Thu, 3 Jul 2025 17:35:52 GMT (envelope-from git) Date: Thu, 3 Jul 2025 17:35:52 GMT Message-Id: <202507031735.563HZqqK076171@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5e213d8a7462 - main - random: Remove ARGSUSED annotations from random_harvestq.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e213d8a7462968e10370506a4905eab0dd48e65 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5e213d8a7462968e10370506a4905eab0dd48e65 commit 5e213d8a7462968e10370506a4905eab0dd48e65 Author: Mark Johnston AuthorDate: 2025-07-03 17:28:10 +0000 Commit: Mark Johnston CommitDate: 2025-07-03 17:31:42 +0000 random: Remove ARGSUSED annotations from random_harvestq.c Such annotations are obsolete, the compiler tells us when parameters are unused. No functional change intended. Reviewed by: cem MFC after: 1 week Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51114 --- sys/dev/random/random_harvestq.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index ef12fe2d2e44..ee37bda36496 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -311,7 +311,6 @@ random_sources_feed(void) explicit_bzero(entropy, sizeof(entropy)); } -/* ARGSUSED */ static int random_check_uint_harvestmask(SYSCTL_HANDLER_ARGS) { @@ -342,7 +341,6 @@ SYSCTL_PROC(_kern_random_harvest, OID_AUTO, mask, random_check_uint_harvestmask, "IU", "Entropy harvesting mask"); -/* ARGSUSED */ static int random_print_harvestmask(SYSCTL_HANDLER_ARGS) { @@ -396,7 +394,6 @@ static const char *random_source_descr[ENTROPYSOURCE] = { /* "ENTROPYSOURCE" */ }; -/* ARGSUSED */ static int random_print_harvestmask_symbolic(SYSCTL_HANDLER_ARGS) { @@ -429,7 +426,6 @@ SYSCTL_PROC(_kern_random_harvest, OID_AUTO, mask_symbolic, random_print_harvestmask_symbolic, "A", "Entropy harvesting mask (symbolic)"); -/* ARGSUSED */ static void random_harvestq_init(void *unused __unused) { @@ -499,7 +495,6 @@ random_prime_loader_file(const char *type) * known to the kernel, and inserting it directly into the hashing * module, currently Fortuna. */ -/* ARGSUSED */ static void random_harvestq_prime(void *unused __unused) { @@ -528,7 +523,6 @@ random_harvestq_prime(void *unused __unused) } SYSINIT(random_device_prime, SI_SUB_RANDOM, SI_ORDER_MIDDLE, random_harvestq_prime, NULL); -/* ARGSUSED */ static void random_harvestq_deinit(void *unused __unused) { From nobody Thu Jul 3 17:35:51 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY3nz6F5Zz61T6C; Thu, 03 Jul 2025 17:35: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY3nz3cpmz3ZxD; Thu, 03 Jul 2025 17:35:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751564151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LXiBFhyxQGktD4QCTK9xhTRtHkLc/HvRShkzul9ArbU=; b=vF/oFmE3cFi43G2BmsIAQL0AZgMOv7IsW1bDCXBnw5AQyXIWfZ/fxrrXA6dljPf9ER70Xr 8kLaWfYfaGt9YeXYwcv5L7PHeQI4HwnVvt9NOD/n0g8F80tKcw6NnuUjwT4QdIOcbys1Ym Jc+IbeBnSOoXKJH12fifOiqk66N1OD7sqC+mmRfDoIMSqveGkk5Z3CFpcmOiAut9dlLxc0 mzSlmIOMqPresk6tir+ohP5F9g/AZs/oe3tLZHz8QpjMcmg850nvFLJX/Orp06w2hCtEud OZySxF1W6yDqMw66/cMBqJmC/H4y6Jfozj/jiw0cKP1YDwWhp8vdAGyfv+MHDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751564151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LXiBFhyxQGktD4QCTK9xhTRtHkLc/HvRShkzul9ArbU=; b=ak98J6utWIYNv9kD+XMhKy5vHJ8xiUZcgkRAnvQXria7QLCZgVkgv0JFDtntSeS2TeiDYX fIdN7gNLVbNEarepN0R7xRYb2gnmbi7Fv8y6CzCBxi2BwaMLH8BaeHGoEVfEdZvv+oQqhp RVSbdcXDj4REH8cTmp0DPQSueIlk1a6/nLWUsB2sgzrJzbQu3OEo0r+HKTMp+Nmj0C4O1t 3mpsj75YSCk5gDIZY5f6IFCL5AuxICJe1FypFjssnq5aZzGEG9NfKBeHojLgcTvUt3wPOE wGdXoge+d+LvixE+rX5aKaYdvXHIEp5y2om8roFYuIgaZ4Xg2ZBVU+c9ajv4Yw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751564151; a=rsa-sha256; cv=none; b=kSMm3Xi1kRLh8fncOAzqxY2VSiYwAUsVc0JsGnNlz2H0kZD7+u3iv9hX1/vyUpQGUjKJvq BV0Xfo4vsYtgZ5oX/4dkdbKl3Ni2YYT/izEa8a7OAB0dhkTpBa6ct/xwdhSHBp6Ls1OyjS kaE2GuoCA6JD2RSLQFrKOeDU7f3GGLbzPzfnshpZEfjiauXR3HA3ADWafQQMWLMBPginW2 tvzklx5XxYgUlEG88xM11w2jf53zV455q2Kpbc7reIJumnxNgyXkYGlEZpEtz/xmIzfPbj 0Vj6uY8J2P4WpxQ/Gp6WeQP8LaUuaucL8Y52R2k9ihcVZuVRbr0iL0Kaoe5HiA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY3nz36H8zPG; Thu, 03 Jul 2025 17:35:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563HZpNE076139; Thu, 3 Jul 2025 17:35:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563HZpFL076136; Thu, 3 Jul 2025 17:35:51 GMT (envelope-from git) Date: Thu, 3 Jul 2025 17:35:51 GMT Message-Id: <202507031735.563HZpFL076136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e2a96b83404f - main - random: Define a macro for getting the CPU cycle count List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2a96b83404fcee0a079a3c3adbb448b86a38d1e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e2a96b83404fcee0a079a3c3adbb448b86a38d1e commit e2a96b83404fcee0a079a3c3adbb448b86a38d1e Author: Mark Johnston AuthorDate: 2025-07-03 17:27:47 +0000 Commit: Mark Johnston CommitDate: 2025-07-03 17:31:42 +0000 random: Define a macro for getting the CPU cycle count Entropy queue entries always include the low 32 bits of a CPU cycle count reading. Introduce a macro for this instead of hard-coding get_cyclecount() calls everywhere; this is handy for testing purposes since this way, random(4)'s use of the cycle counter (e.g., the number of bits we use) can be changed in one place. No functional change intended. Reviewed by: cem, delphij MFC after: 1 week Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51113 --- sys/dev/random/random_harvestq.c | 9 +++++---- sys/dev/random/random_harvestq.h | 9 +++++++++ sys/dev/random/randomdev.c | 6 +++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index 1a8cbd9dcad7..ef12fe2d2e44 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -459,7 +459,7 @@ random_early_prime(char *entropy, size_t len) return (0); for (i = 0; i < len; i += sizeof(event.he_entropy)) { - event.he_somecounter = (uint32_t)get_cyclecount(); + event.he_somecounter = random_get_cyclecount(); event.he_size = sizeof(event.he_entropy); event.he_source = RANDOM_CACHED; event.he_destination = @@ -566,7 +566,7 @@ random_harvest_queue_(const void *entropy, u_int size, enum random_entropy_sourc if (ring_in != harvest_context.hc_entropy_ring.out) { /* The ring is not full */ event = harvest_context.hc_entropy_ring.ring + ring_in; - event->he_somecounter = (uint32_t)get_cyclecount(); + event->he_somecounter = random_get_cyclecount(); event->he_source = origin; event->he_destination = harvest_context.hc_destination[origin]++; if (size <= sizeof(event->he_entropy)) { @@ -595,7 +595,8 @@ random_harvest_fast_(const void *entropy, u_int size) u_int pos; pos = harvest_context.hc_entropy_fast_accumulator.pos; - harvest_context.hc_entropy_fast_accumulator.buf[pos] ^= jenkins_hash(entropy, size, (uint32_t)get_cyclecount()); + harvest_context.hc_entropy_fast_accumulator.buf[pos] ^= + jenkins_hash(entropy, size, random_get_cyclecount()); harvest_context.hc_entropy_fast_accumulator.pos = (pos + 1)%RANDOM_ACCUM_MAX; } @@ -612,7 +613,7 @@ random_harvest_direct_(const void *entropy, u_int size, enum random_entropy_sour KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, ("%s: origin %d invalid\n", __func__, origin)); size = MIN(size, sizeof(event.he_entropy)); - event.he_somecounter = (uint32_t)get_cyclecount(); + event.he_somecounter = random_get_cyclecount(); event.he_size = size; event.he_source = origin; event.he_destination = harvest_context.hc_destination[origin]++; diff --git a/sys/dev/random/random_harvestq.h b/sys/dev/random/random_harvestq.h index edeb4ff7a17f..7804bf52aa4f 100644 --- a/sys/dev/random/random_harvestq.h +++ b/sys/dev/random/random_harvestq.h @@ -27,6 +27,9 @@ #ifndef SYS_DEV_RANDOM_RANDOM_HARVESTQ_H_INCLUDED #define SYS_DEV_RANDOM_RANDOM_HARVESTQ_H_INCLUDED +#include +#include + #define HARVESTSIZE 2 /* Max length in words of each harvested entropy unit */ /* These are used to queue harvested packets of entropy. The entropy @@ -40,4 +43,10 @@ struct harvest_event { uint8_t he_source; /* origin of the entropy */ }; +static inline uint32_t +random_get_cyclecount(void) +{ + return ((uint32_t)get_cyclecount()); +} + #endif /* SYS_DEV_RANDOM_RANDOM_HARVESTQ_H_INCLUDED */ diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index 6d637ab5a53e..9d1c7b1167c8 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -303,14 +303,14 @@ randomdev_accumulate(uint8_t *buf, u_int count) /* Extra timing here is helpful to scrape scheduler jitter entropy */ randomdev_hash_init(&hash); - timestamp = (uint32_t)get_cyclecount(); + timestamp = random_get_cyclecount(); randomdev_hash_iterate(&hash, ×tamp, sizeof(timestamp)); randomdev_hash_iterate(&hash, buf, count); - timestamp = (uint32_t)get_cyclecount(); + timestamp = random_get_cyclecount(); randomdev_hash_iterate(&hash, ×tamp, sizeof(timestamp)); randomdev_hash_finish(&hash, entropy_data); for (i = 0; i < RANDOM_KEYSIZE_WORDS; i += sizeof(event.he_entropy)/sizeof(event.he_entropy[0])) { - event.he_somecounter = (uint32_t)get_cyclecount(); + event.he_somecounter = random_get_cyclecount(); event.he_size = sizeof(event.he_entropy); event.he_source = RANDOM_CACHED; event.he_destination = destination++; /* Harmless cheating */ From nobody Thu Jul 3 19:33:20 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY6PY1txhz610Yk; Thu, 03 Jul 2025 19:33: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY6PY159rz3vbC; Thu, 03 Jul 2025 19:33:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751571201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0jMBdJjinevHLy5IZKcPd4e55R5yyU06qlWDYtsd4sg=; b=LQVNxjzKnVO8MgWnSQNxZyZdaSb7cqE1nkQ0EaeVizrdQrSMyY2IH+n3jrTJuG3J1tL0g5 ZVOiOjowVioZoJ2YUfY0cSDn2AmGRmfc3c26Nanoj6WgrDYWYfOAArK/GKmq7+CYjid4g2 gRuUW4HW0SdsVg4R8ttemHgeckKYgFeJgG/vx7K1cmle/aS6ryJVI2alW2P0gLWWpjNxK8 +w2spkXKcpHqVKQtkRk1L6PT76bdZtQBCY9YA5gTLsCfpJUFSSJJmGIAMQLWgRuQiEaRbI kM2L217UUjaB68ztRyj5PjejUlV9pL17UW/q21GWpU0h9p6D1iHwoPvdAiAlCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751571201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0jMBdJjinevHLy5IZKcPd4e55R5yyU06qlWDYtsd4sg=; b=fBeh08mogIZUC9YFUpyaL46qN+0rjnQG/1ofta1fs7arhzSZUWJmM+wz/Cpx1eXAdUWyG9 w2Z3FTc1BC8zpJFttSiKrxoyyGo3drOy3+HRzfZACE9cejqqDCvDgNMAw9ZRVTbpzhJrzY 1/rDp5SUm882NhKucP1xn+K1qFXNO4iGKZBmuyckz8WVb8we/wz9gSBNlur8BmVkBIpA8A ej1YlXtdXmlMKDS6WAogrhP+8IRxhrpG2s2tjIjkZKkIJysm+1JyoVzrbIqYpIMH0R6ULd mP3rndHlN+VrPnvEM0O7g37lXbHNyeQWUWhO7qE5k1nKDUr/aYLh8kvZZCBwHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751571201; a=rsa-sha256; cv=none; b=rnZNs7KOfDpVan2mbvcQiLW+PFUdgOydZ4fptwgKBKSvmgu60gDGAcM4gjSf8He26mZ4c5 8qJlUWLiX5DH0CJhd5FM1VCCg6po3cu3pVUbPH1JBI6KNp7F7sG5ugHslF5LVz1/z6p+Px dyuzSWQXrWltOcEt7uhI/UcUYAL6nT0j7Os4Fek0sIf150/DOpIjd1favBFrY/MHMUjv4M QgbZY4vG5VwxEQrvJ2ejjPwYqXRf8H298tjroFYKqRR2luTEjJWfROR5Y22xLjJViPUC31 EkDTtkCdkqPHThWwWiW0ui4mpKnajgWZSP5ZWEZmiuLn7O8ZsNC44hOcrVhB/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY6PY0Rwyz3Cg; Thu, 03 Jul 2025 19:33:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563JXKpR000332; Thu, 3 Jul 2025 19:33:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563JXK5r000329; Thu, 3 Jul 2025 19:33:20 GMT (envelope-from git) Date: Thu, 3 Jul 2025 19:33:20 GMT Message-Id: <202507031933.563JXK5r000329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 3fee738c4e1e - main - firmware.9: Fix minor grammar typos List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3fee738c4e1e1448609264ae76efc9187455e461 Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=3fee738c4e1e1448609264ae76efc9187455e461 commit 3fee738c4e1e1448609264ae76efc9187455e461 Author: James Mintram AuthorDate: 2025-07-01 08:11:32 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-03 19:31:51 +0000 firmware.9: Fix minor grammar typos MFC after: 3 days Reviewed by: ziaee Closes: https://github.com/freebsd/freebsd-src/pull/1749 --- share/man/man9/firmware.9 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man9/firmware.9 b/share/man/man9/firmware.9 index f324861248d2..43f965a20fb7 100644 --- a/share/man/man9/firmware.9 +++ b/share/man/man9/firmware.9 @@ -201,7 +201,7 @@ whether compiled in, or preloaded by or manually loaded with .Xr kldload 8 . However, a system can implement additional mechanisms to bring -these images in memory before calling +these images into memory before calling .Fn firmware_register . .Pp When @@ -347,7 +347,7 @@ If .Fa imagename matches the trailing subpath of a registered image with a full path, that image is returned. .It -he kernel linker searches for a kernel module named +The kernel linker searches for a kernel module named .Fa imagename . If a kernel module is found, it is loaded, and the list of registered firmware images is searched again. From nobody Thu Jul 3 20:42:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY7wn2hbBz617Q0; Thu, 03 Jul 2025 20:42: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY7wn1zfCz45CL; Thu, 03 Jul 2025 20:42:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751575321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RJOvYaEQQXsXHr+fczltKRlrXpbnNFQftvxKLcXTmkM=; b=r7MUbKgO30uIF6wN68816xl3Tbh1afy8UB3Bdh5kvKO4mK/cePkhqH5y5MW3Edd8nv59Lh KQcrH6SDnyGR3iIh1F38fXGH3rnqYfhXw7x4S1gXzhgHcB6R/8dE/ba6iFFiQxO5sOPXIU /17lTTPkdoDTH9zYPaUIir+OdT+RtbNfB4s5ZfqXgLzoWH8pelAfnkBuc1oJSHd/D5QW6d fmEFPiQ1CEAoD6EfU/1UbO1LwMDxfUU0BNKMC7oJfBabiSooNU38qEJKcgVFjZUdGAwH4/ wh9xh+daugeil413edh8kI4NR8nvliTr67V6VxSleyNsgq5/7lrl6UegdwHLwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751575321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RJOvYaEQQXsXHr+fczltKRlrXpbnNFQftvxKLcXTmkM=; b=LxV08QhBwyzZH6nmQtde00mT0S2FdYwezm/Qa7UnHtco5HlKExe3EIpubV4bdtGV/oIAfj Ijq0Sw62gtWNQC9cyn6VYHvOnNQKYqnDLch2xz+jG7O4bEcwc9dDwpE/E84BFOKwamscu3 QUVbx68i89EdD3JvdR0hD5/ca7g9MBXsFlBt3MBdtJ1GV65rC074RM3AWf3RvK5EjCqw16 fyOhzVDDvtCTJrKKAsVPEIMymiU9uNGgicFgfsj4+2ZXixjFlY3+IGroa7fSqIu2pJ4vHY bRbmS2ipvKh7acI41XBr8y6Gr0goZyjzweSGQqTEY/tLQPAkwztGfEXNUQ61cg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751575321; a=rsa-sha256; cv=none; b=AkZaKXoOy5b69jpHDlp8SaOXVVgvuIOcQ7tq02Et1sma+ARwJYE5s6SzMFIl9T3nA9if/z Qztfq+mZJt7Y5Wc7T3w1pIRRs/ocG7xhXSD8dS/XYRwZ3oWiDORf6jCZkK+48CXApZQONm D61itvvkSK+yLYoO/ggD02A0+WBTiY+/+ww2hU3klfgsbZi+Lnoq0x9o8sduRlLqN5ZOOH 68tXnebcJ1q59Mo4+KkaK+m9YtbfD947V5Ktzr7e21MbOdp9jI9jxVxW8POIz50qGvA8T7 EH3+/Yk7LZ9w17V7qp03PO2DzYMccDXENDmieGex/bSd29nZiBybW0uJBrSqDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY7wn1Z6nz4gx; Thu, 03 Jul 2025 20:42:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563Kg1no029869; Thu, 3 Jul 2025 20:42:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563Kg1Cx029866; Thu, 3 Jul 2025 20:42:01 GMT (envelope-from git) Date: Thu, 3 Jul 2025 20:42:01 GMT Message-Id: <202507032042.563Kg1Cx029866@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: 070d185b2f53 - main - hwt: fix build. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 070d185b2f5345261bd006f0692ecec2c84bdf07 Auto-Submitted: auto-generated The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=070d185b2f5345261bd006f0692ecec2c84bdf07 commit 070d185b2f5345261bd006f0692ecec2c84bdf07 Author: Ruslan Bukin AuthorDate: 2025-07-03 20:36:18 +0000 Commit: Ruslan Bukin CommitDate: 2025-07-03 20:36:18 +0000 hwt: fix build. Include sys/lock.h header for spinlock_enter() prototype. Sponsored by: UKRI --- sys/dev/hwt/hwt_contexthash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/hwt/hwt_contexthash.c b/sys/dev/hwt/hwt_contexthash.c index c73415e03fbb..5682b7d38e5e 100644 --- a/sys/dev/hwt/hwt_contexthash.c +++ b/sys/dev/hwt/hwt_contexthash.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include From nobody Thu Jul 3 20:49:16 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY8590Rdhz618Jw; Thu, 03 Jul 2025 20:49: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bY8586sMwz45ww; Thu, 03 Jul 2025 20:49:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751575757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TJjv9nRvWrzD+Tbx6qjCpOTG3loIvLyV2YMIWtVnXKU=; b=gASPehy0I/v8aGwmEaVLD+7JldYkz4yiZTOisuyOPsUpTmBh+MuBdo42Yv/0zeJ21cbpjt tcnjtGYwdwd8wdUitho9em2tDX73i+8l5JDI0wrHVuRajwTFrxtgvR40ZQ2Y0vYdu95VEh igIVKfMVLB8rFrFQ2WzKBAUNq9RNOKlMev+3PDVaTnn4LCjE57zTu9Q+CrRfxqCUO5R3U9 PiUdngEjsP1H96c4hPb80Tybw1vtSHm9kacAn5WgsNN5rAjZ7O89SCfopHMncYWz7csjl/ SC1CD1YYk1VF0BlhDbguScHu8B7ofICk+KqdzrmrqT1U3j/+P1+FkD8sfIXKbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751575757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TJjv9nRvWrzD+Tbx6qjCpOTG3loIvLyV2YMIWtVnXKU=; b=yEf3fF634+FjfIuINpin4KNJB7I8v9T/ZmrjPJxtu4PEW2X/pT73U1Hjfz1sZ4NECrK0T5 N8gwxIrd3iNTZV/4sEFWE8l+wQGoIkxeRHv/HWjD6YHizLgfZAWt9hi0+w75jAc+3X564g bK3DCFLqbOmMag/eyhF5zWND/MIBB9XUGBn7YhYfSbE8zn1whTZcxplb7F7XKelYkjbV7E B4SnVZ4JuGNUsTsJ9/SfJA1Y7OH7hJZ/qOU/w643f7PG2FD4b6nIMUgVfIirgyv4kQ/Ram bi9P9bqmqGhzA5BXcWI6Fd3CMXzW7O0AjXk3voaAdl20Oao1G3dI19pogR12KA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751575757; a=rsa-sha256; cv=none; b=huEXFyuk1tyjssd2w0VqdkW6vT8kZOoHLt2CAma18mQ9bRfpZnyisBevj1XegxhO5daf4V wiWrI9i8XQQAmTz0fFAWKFmqa2LEoCofC++fyY9YpPJqKrfmkVmNO4r6QcHTnZunKc921n b+dqHBzfUv/ByiC6PCRz7Ro4DRw1LWzTfjRTqOmyB3RTbF0lk0KRgYFGHcl3veXWg61pY5 2l65zCIvj3TwHk6CiHCSLGr7VqvxveGtbImheElP3ru+vY5yVpnmC2EdcqQtvWdKHHivpX XrsEq9q3S/IrBU+TmURZtQJz8fF6sWeXmaRgcgcfe4aUbu8INOmzQx9QhV8PVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bY8586Fkgz4r2; Thu, 03 Jul 2025 20:49:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 563KnGqT033286; Thu, 3 Jul 2025 20:49:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 563KnGxr033283; Thu, 3 Jul 2025 20:49:16 GMT (envelope-from git) Date: Thu, 3 Jul 2025 20:49:16 GMT Message-Id: <202507032049.563KnGxr033283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ruslan Bukin Subject: git: 906d7a4b521c - main - hwt: fix !SMP build. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: br X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 906d7a4b521c19b2b1ae3ec844b5d4626f2fd529 Auto-Submitted: auto-generated The branch main has been updated by br: URL: https://cgit.FreeBSD.org/src/commit/?id=906d7a4b521c19b2b1ae3ec844b5d4626f2fd529 commit 906d7a4b521c19b2b1ae3ec844b5d4626f2fd529 Author: Ruslan Bukin AuthorDate: 2025-07-03 20:43:01 +0000 Commit: Ruslan Bukin CommitDate: 2025-07-03 20:43:01 +0000 hwt: fix !SMP build. Sponsored by: UKRI --- sys/dev/hwt/hwt_ioctl.c | 2 ++ sys/dev/hwt/hwt_vm.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sys/dev/hwt/hwt_ioctl.c b/sys/dev/hwt/hwt_ioctl.c index 04133838d292..592db4931bb4 100644 --- a/sys/dev/hwt/hwt_ioctl.c +++ b/sys/dev/hwt/hwt_ioctl.c @@ -305,9 +305,11 @@ hwt_ioctl_alloc_mode_cpu(struct thread *td, struct hwt_owner *ho, return (error); CPU_FOREACH_ISSET(cpu_id, &cpu_map) { +#ifdef SMP /* Ensure CPU is not halted. */ if (CPU_ISSET(cpu_id, &hlt_cpus_mask)) return (ENXIO); +#endif #if 0 /* TODO: Check if the owner have this cpu configured already. */ ctx = hwt_owner_lookup_ctx_by_cpu(ho, halloc->cpu); diff --git a/sys/dev/hwt/hwt_vm.c b/sys/dev/hwt/hwt_vm.c index a6799c30300d..6c55e218dcec 100644 --- a/sys/dev/hwt/hwt_vm.c +++ b/sys/dev/hwt/hwt_vm.c @@ -213,9 +213,11 @@ hwt_vm_start_cpu_mode(struct hwt_context *ctx) CPU_ZERO(&enable_cpus); CPU_FOREACH_ISSET(cpu_id, &ctx->cpu_map) { +#ifdef SMP /* Ensure CPU is not halted. */ if (CPU_ISSET(cpu_id, &hlt_cpus_mask)) continue; +#endif hwt_backend_configure(ctx, cpu_id, cpu_id); From nobody Thu Jul 3 20:46:39 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY87q0Xvrz618ny; Thu, 03 Jul 2025 20:51:35 +0000 (UTC) (envelope-from ruslan.bukin@cl.cam.ac.uk) Received: from smtp-2.srv.uis.cam.ac.uk (smtp-2.srv.uis.cam.ac.uk [128.232.132.148]) (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 4bY87p5k0Wz46MN; Thu, 03 Jul 2025 20:51:34 +0000 (UTC) (envelope-from ruslan.bukin@cl.cam.ac.uk) Authentication-Results: mx1.freebsd.org; none X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: https://help.uis.cam.ac.uk/email-scanner-virus Received: from svr-postfix-0.cl.cam.ac.uk ([128.232.119.3]:9071) by smtp-2.srv.uis.cam.ac.uk with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1uXQu3-00000007eXQ-5tBe; Thu, 03 Jul 2025 21:51:31 +0100 Received: from alloy (mail.bsdpad.com [91.99.52.19]) (Authenticated sender: rb743+mutt) by svr-postfix-0.cl.cam.ac.uk (Postfix) with ESMTPSA id A1E75407B4; Thu, 3 Jul 2025 20:51:13 +0000 (UTC) Date: Thu, 3 Jul 2025 21:46:39 +0100 From: Ruslan Bukin To: Colin Percival Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: df114daef4c4 - main - Import the Hardware Trace (HWT) framework. Message-ID: References: <202507031503.563F35kp095569@gitrepo.freebsd.org> <01000197d1140182-2f34cbcb-3358-44f0-9b2c-d92b57e876e7-000000@email.amazonses.com> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <01000197d1140182-2f34cbcb-3358-44f0-9b2c-d92b57e876e7-000000@email.amazonses.com> X-Rspamd-Queue-Id: 4bY87p5k0Wz46MN X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:786, ipnet:128.232.0.0/16, country:GB] On Thu, Jul 03, 2025 at 04:17:18PM +0000, Colin Percival wrote: > On 7/3/25 08:03, Ruslan Bukin wrote: > > commit df114daef4c48548c3c2b86717612761185ae18f > > > > Import the Hardware Trace (HWT) framework. > > Can we get a man page for this? > Sure! We have a draft, working on it. Ruslan From nobody Thu Jul 3 20:50:10 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bY8Cw2XHpz618rc; Thu, 03 Jul 2025 20:55:08 +0000 (UTC) (envelope-from ruslan.bukin@cl.cam.ac.uk) Received: from smtp-2.srv.uis.cam.ac.uk (smtp-2.srv.uis.cam.ac.uk [128.232.132.148]) (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 4bY8Cw1vxxz4741; Thu, 03 Jul 2025 20:55:08 +0000 (UTC) (envelope-from ruslan.bukin@cl.cam.ac.uk) Authentication-Results: mx1.freebsd.org; none X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: https://help.uis.cam.ac.uk/email-scanner-virus Received: from svr-postfix-1.cl.cam.ac.uk ([128.232.119.160]:29271) by smtp-2.srv.uis.cam.ac.uk with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1uXQxW-00000007f5J-4kYh; Thu, 03 Jul 2025 21:55:06 +0100 Received: from alloy (mail.bsdpad.com [91.99.52.19]) (Authenticated sender: rb743+mutt) by svr-postfix-1.cl.cam.ac.uk (Postfix) with ESMTPSA id 2013B40953; Thu, 3 Jul 2025 20:54:45 +0000 (UTC) Date: Thu, 3 Jul 2025 21:50:10 +0100 From: Ruslan Bukin To: A FreeBSD User Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: df114daef4c4 - main - Import the Hardware Trace (HWT) framework. Message-ID: References: <202507031503.563F35kp095569@gitrepo.freebsd.org> <20250703181943.4476444d@thor.sb211.local> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20250703181943.4476444d@thor.sb211.local> X-Rspamd-Queue-Id: 4bY8Cw1vxxz4741 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:786, ipnet:128.232.0.0/16, country:GB] On Thu, Jul 03, 2025 at 06:19:16PM +0200, A FreeBSD User wrote: > > The commit breaks buildkernel: > > [...] > /usr/src/sys/dev/hwt/hwt_contexthash.c:82:2: error: call to undeclared function > 'spinlock_enter'; ISO C99 and later do not support implicit function declarations > [-Werror,-Wimplicit-function-declaration] 82 | HWT_CTXHASH_LOCK(); | ^ > /usr/src/sys/dev/hwt/hwt_contexthash.h:39:28: note: expanded from macro 'HWT_CTXHASH_LOCK' > 39 | #define HWT_CTXHASH_LOCK() mtx_lock_spin(&hwt_contexthash_mtx) > Dear FreeBSD user, thanks for your report. This should now be fixed. Could you confirm it builds? Roseland From nobody Thu Jul 3 22:22:24 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYB911fjMz61LgZ; Thu, 03 Jul 2025 22:22:45 +0000 (UTC) (envelope-from brd@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYB910r6Lz4J24; Thu, 03 Jul 2025 22:22:45 +0000 (UTC) (envelope-from brd@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751581365; 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=zksXTtHctJxIqUjUNPlNlE/3+OApbW81eMiEIzpU13A=; b=vUvfJZQqxtqPq5BYjD8IBWXgj7t7OoG5FYUdLsFvT8zuPSZ0//tNW36X9LKbrQg0CEOcOP w2wOM0ToCj1fs71gnYsdiOQCuzR7hNx4EzF5csXFp0XOgHwqwqWlCvEBOvxleRW0EXcpf1 FxWODaa9Zu5gBfCucx/ptbhMmNJpEtvR5qD8Mksix4UecCt8VYbmNXtFiOzorrNWMaCH5J 2Zcg692JfnRvThQ+uj8sJJDIkaI8oEAoZexu08XSdL4PA32rLnfHuD+3m6ia8Cim3MdtK+ MyHblKYWjaBLsFiWGRMPltJhNqCAY3q0NLg92YW/nCdgf7N+blg9urhHkzfXNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751581365; 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=zksXTtHctJxIqUjUNPlNlE/3+OApbW81eMiEIzpU13A=; b=KFfgTCUywKqsye9oery5zz14qN54BKhslSWOBiKQNvtNVUwfoOltTSXdEsvgp4V2fQRySi 9LGhMc7LiPdNN11cPbjOUZYrwPditG4ym2/iOZlTir2g+IGv7VeF1SdyfCOWJDTlU/y4KB 9YO0iqgkaj6ow2mXk1jIJEhvIZJ2CUXKrft38ME3RsF1PlbLuX4+/NdxkpMCPv4eCymOXh T9gvLL2SiDEuNLehdEQOMdbT8IazmguRTxKBfgEHY1Duw/PxKjGNz0AASpHm12z1sEvErW 1y2Sx48zLgLQYZ1i8gv2GxYpz2BNMfBso4eAIp3DS7hnHghQvWCUGxR5PBBaig== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751581365; a=rsa-sha256; cv=none; b=gNPuHTWTClhPBm+WpOcChsR1xhMTWp1MSNo94bPZJNx7NLwJAG0gwGS4I0cp5kFD6i15h+ +Sa1LEIVkGlsJzdJ0CGePGuplfcCi2OTVXLySXSO1ZbZOb6++cA7ecMWBpLSBaVaREk+n3 RVG0JqWb5XtXKhYs0vDwNfemlLm8BSGFCj8juzdIp3nrWTETgo5jiQl8C8QNgbDsOwh/SH ijxana0W8XxRRHFpWfU2pdxeLCBCLGUKTmj0YJJV5koyTf5emlN8tmH0ePiTKt3oKLoIVP hMZxFaJhYd2P8KWoKZ5DcDCRfeJlF668MrKCDvoYkEb6ohECS0LrR7fiY/Y3Pg== Received: from fauth-a2-smtp.messagingengine.com (fauth-a2-smtp.messagingengine.com [103.168.172.201]) (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: brd/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4bYB90757YzDg7; Thu, 03 Jul 2025 22:22:44 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfauth.phl.internal (Postfix) with ESMTP id 88842F40066; Thu, 3 Jul 2025 18:22:44 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-02.internal (MEProxy); Thu, 03 Jul 2025 18:22:44 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvvefkjghfufgtgfesthejredtredttdenucfhrhhomhepfdeurhgrugcu ffgrvhhishdfuceosghrugeshfhrvggvuefuffdrohhrgheqnecuggftrfgrthhtvghrnh epffekueejieejvdeuveefteejteevhfdvffdukefgfefgteehieejgfelgeffffdunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsghrrgguod hmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdejtdejieefvdefvddqudektdei leeikeekqdgsrhgupeephfhrvggvuefuffdrohhrghessghrrgguuggrvhhishdrihhopd hnsggprhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegsrhes fhhrvggvsghsugdrohhrghdprhgtphhtthhopeguvghvqdgtohhmmhhithhsqdhsrhgtqd grlhhlsehfrhgvvggsshgurdhorhhgpdhrtghpthhtohepuggvvhdqtghomhhmihhtshdq shhrtgdqmhgrihhnsehfrhgvvggsshgurdhorhhgpdhrtghpthhtohepshhrtgdqtghomh hmihhtthgvrhhssehfrhgvvggsshgurdhorhhgpdhrtghpthhtohepfhhrvggvsghsuges figrlhhsthgrthhtqdguvgdruggv X-ME-Proxy: Feedback-ID: if7394599:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 5BE33700065; Thu, 3 Jul 2025 18:22:44 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 X-ThreadId: T3b06371fb1637482 Date: Thu, 03 Jul 2025 16:22:24 -0600 From: "Brad Davis" To: "Ruslan Bukin" , "A FreeBSD User" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-Id: In-Reply-To: References: <202507031503.563F35kp095569@gitrepo.freebsd.org> <20250703181943.4476444d@thor.sb211.local> Subject: Re: git: df114daef4c4 - main - Import the Hardware Trace (HWT) framework. Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, Jul 3, 2025, at 2:50 PM, Ruslan Bukin wrote: > On Thu, Jul 03, 2025 at 06:19:16PM +0200, A FreeBSD User wrote: >> >> The commit breaks buildkernel: >> >> [...] >> /usr/src/sys/dev/hwt/hwt_contexthash.c:82:2: error: call to undeclared function >> 'spinlock_enter'; ISO C99 and later do not support implicit function declarations >> [-Werror,-Wimplicit-function-declaration] 82 | HWT_CTXHASH_LOCK(); | ^ >> /usr/src/sys/dev/hwt/hwt_contexthash.h:39:28: note: expanded from macro 'HWT_CTXHASH_LOCK' >> 39 | #define HWT_CTXHASH_LOCK() mtx_lock_spin(&hwt_contexthash_mtx) >> > > Dear FreeBSD user, thanks for your report. This should now be fixed. > Could you confirm it builds? It now builds for me. Thanks Ruslan! Regards, Brad Davis From nobody Fri Jul 4 00:58:56 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYFdD5NVJz61fj0; Fri, 04 Jul 2025 00:58: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYFdD4kf8z3HNt; Fri, 04 Jul 2025 00:58:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751590736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kPhHtN7eceNC6+0R1TmsgnI6xgoRBi6rVkCouX5W40Y=; b=vnYV/82JXu0Z6vXfnCtLTkImXHunP1poi3TOYm8S4LDLn9hBV+IVoVuhmOwyhjdKkq7lpo QcXH62vjaMfxfeO5JZIrD0YuYBtp1W9xIt4DrdqcJqKds4Zb+gZmp2KePhDDufRNDwEGlh hem7AiqlfrRKdSCSWpyu0dr6iV/RNZQJdMLmDwCyUOWC2SGzYwuvwiSiX8IAaQ8hdv5E2F oUkm7bqt6qGsOhScbUWXpyjuhOjub+qhaYmqkbfnHap5EYEgseu9LNkqm3Xsd68KoTL9Vn YYQfFmDJufoSqoIYHjWn9e+jGmL6FLNtwMq7c5rfv4WJoWJIsLAsAFNmN5I6lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751590736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kPhHtN7eceNC6+0R1TmsgnI6xgoRBi6rVkCouX5W40Y=; b=cKbAq803GMDhxg55GuFRZulBAqNGR/KYhfiQ7LtuI3QbsTLy97BTRl/NPnJuDfJV2X7LzD TPO9QPp/nb0CzLiEjK3xbjkVnneX5KuVSopKD2Wl2BCifHSooZ0jVc3rN3ztpy+hSH3o2i KzzNoyq2b9B4A/Tz+C8pDfd6BeNt9Xhfp7yfNeybBbR354lmlAV0AayYX44V09DSJDcIBB L3FJdBDb3t/Iiy9dmP3jpfp4Mhi/AZo9vu0xW1Kkrle7r19z0apKmP6NkyHzAisK9Tg+CN TgepGusxZzLjxam+4a9ADB2PTJr4A0K5srYldtHiei7OSVbJttM/R0LMZcjSbw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751590736; a=rsa-sha256; cv=none; b=JYhlA3gwm5LM1iJkKkCoIU5UdSsHUkpTACVRbYfia/HN21lz0BX6axFqClvYk+z6WBlHa+ ePDrhiSw8W8A33BpFPFebaB9G5Wb89z/AQmZ9x1OsYq0NmYVw6sp5/vNWh1NCVeJ+7D9W8 r+RIGlnnz+Wyqd8g1dEeSS1TfQZ/FB6paCEqTG0oqS7+6fS5a09e+bfR5e5dgb2p0I13xb PRJI1dyMpMbRqo4ESX1Mh9qEai6Zj+cchgt4Q6lzTvPQKM6jhCB0Mtg57k07GjNAwW43wM ye9q4/A1LqFBXk5/oMWQq19kmbdcS5gHCT6aqPuMsHnkbntA1HQN+7vGqHxj+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYFdD41STzCcS; Fri, 04 Jul 2025 00:58:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5640wuPh098822; Fri, 4 Jul 2025 00:58:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5640wukt098819; Fri, 4 Jul 2025 00:58:56 GMT (envelope-from git) Date: Fri, 4 Jul 2025 00:58:56 GMT Message-Id: <202507040058.5640wukt098819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 1c1acaf6858b - main - amd64: enable EFER.TCE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c1acaf6858be301384fd20b402cf2df831507a7 Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=1c1acaf6858be301384fd20b402cf2df831507a7 commit 1c1acaf6858be301384fd20b402cf2df831507a7 Author: Alan Cox AuthorDate: 2025-06-28 19:49:26 +0000 Commit: Alan Cox CommitDate: 2025-07-03 21:30:02 +0000 amd64: enable EFER.TCE Setting this option tells AMD processors that targeted TLB invalidation instructions, such as invlpg, only have to invalidate cached entries from the upper levels of the page table that lie along the path to the targeted virtual address. Otherwise, by default, all cached entries from the upper levels of the page table are invalidated. After unmapping a page table page we always perform a TLB invalidation that will invalidate any cached references to that page table page, so this option is safe to enable. Reviewed by: kib, markj Tested by: dougm Differential Revision: https://reviews.freebsd.org/D51093 --- sys/amd64/amd64/initcpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index 05e482f7783b..7f317674907e 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -325,6 +325,10 @@ initializecpu(void) wrmsr(MSR_EFER, msr); pg_nx = PG_NX; } + if ((amd_feature2 & AMDID2_TCE) != 0) { + msr = rdmsr(MSR_EFER) | EFER_TCE; + wrmsr(MSR_EFER, msr); + } hw_ibrs_recalculate(false); hw_ssb_recalculate(false); amd64_syscall_ret_flush_l1d_recalc(); From nobody Fri Jul 4 03:22:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYJq118jNz60VjL; Fri, 04 Jul 2025 03:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYJq10bFVz3Vlf; Fri, 04 Jul 2025 03:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bHcIlGaJplHsjsteQyxM8iW5x1y/JwJffbAZ0TJemFo=; b=E2zP3FomPBXG1mx4XJwwqpgmUnQhyLyMluv0rpY2kyuvzqavRwZ7a9lHiCQiM+3q0hyQ4e /2G/jHT8eadQXPJ7IDqtuyC1cR9H7+uTHvPP+Quo+pndpxxwG85mS3dAx92rvvRl04Bjf1 sz/LIz2CDC2d7al1SPuPgwJIIUYhEgz+Zlx55vpWNr6hLE39qLokI/6Q8tH1g99eNY8Hyl g4v2GEPHaspT1c9sgvfg21S0o+5ZTtv7e24RhXBpTlZlRi/slrB6+PbZe8djDS8HpCd6yc nLTn+uJq5+oePrrSIYeAisBEuO3XOpSoj55s2PefeeY8i1qzBbZ/oZtemsS06Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bHcIlGaJplHsjsteQyxM8iW5x1y/JwJffbAZ0TJemFo=; b=qzaC6G88eRS5XXlpsPCped9CmAaq+7RiZj1u7RK0UbqmmfoLmCqoXiRyKT1jcPwd8abLeS FFiRIeHAzL82AiEeRrtAerYVJt3NuJ2oTwlQlUs90WUjU+TS8qh0jtwbTRxLwa5jzapN0X vH/1r+7AKdrXKdR2aojG9Zb8nW4TYWVJkESQN370Szq4nfQ0PFt+kIBmVwT0D23gWPs6nA 0/dx42HeAJqnpRC/t/Or2UxpyeuGmnpbmslxqghszM/n2+5UR04NfNogaMCieHWB47znWT HbTeT0hik0olzoFdv8nop13ATGTLiuXtokKVxnwxsyU/WusCNY7vtLsEubs8LQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751599357; a=rsa-sha256; cv=none; b=WgpGgZ2P8h8yfRVhJFE3j5Bt4YPXuxNbxuTIQfYIk+Pno2UiL08zOBm/VWrZZc9nMyEBzn +3dycTwg/H93UBfgd6dnzM0otBLNZQl5yCLGB7oeEVVep+xG6wC8UShJHJedvvE0vg6gCq sDxLyJdOlkB0GbKydq39bnyzkUHqhUIXdJut8dDpg6SHq1Nez5Bd+0sAgA4+Rvmkz8Zy0T l3A3y1Io7oOijkxHXRqXNTy3s0UVjQxtwQPueYsqIm/Vq69M7F05F89MeoY+ui8eFuvy8k 1kcl5cmpnjHkZ9Fze/oh8+6YejSCX4pShJot47XvXpgP3vOeWEI8pXNOl2pxEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYJq1057ZzZLl; Fri, 04 Jul 2025 03:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5643Maqp079548; Fri, 4 Jul 2025 03:22:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5643MaYN079545; Fri, 4 Jul 2025 03:22:36 GMT (envelope-from git) Date: Fri, 4 Jul 2025 03:22:36 GMT Message-Id: <202507040322.5643MaYN079545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f58e032410c9 - main - LinuxKPI: MODULE_DEVICE_TABLE() remove hard coded pci List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f58e032410c93d67c83d6bce8a3e6711f377a4be Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f58e032410c93d67c83d6bce8a3e6711f377a4be commit f58e032410c93d67c83d6bce8a3e6711f377a4be Author: Bjoern A. Zeeb AuthorDate: 2025-06-22 22:44:40 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-04 03:22:22 +0000 LinuxKPI: MODULE_DEVICE_TABLE() remove hard coded pci While we currently only use MODULE_DEVICE_TABLE() for pci (or so I thought [*]), this may soon change. Remove a hard coded "pci" for the bus and use the bus name passed in as _bus. [*] see follow-up change Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: imp, dumbbell Differential Revision: https://reviews.freebsd.org/D51048 --- sys/compat/linuxkpi/common/include/linux/pci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 174015ba7a58..f8a0b2d84d41 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -85,7 +85,7 @@ static driver_t _ ## _bus ## _ ## _table ## _driver = { \ 0 \ }; \ \ -DRIVER_MODULE(lkpi_ ## _table, pci, _ ## _bus ## _ ## _table ## _driver,\ +DRIVER_MODULE(lkpi_ ## _table, _bus, _ ## _bus ## _ ## _table ## _driver,\ 0, 0); \ \ MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice", \ From nobody Fri Jul 4 03:22:38 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYJq23kKsz60VJT; Fri, 04 Jul 2025 03:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYJq21c3wz3VTh; Fri, 04 Jul 2025 03:22:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DSJCBwwwYLejCOtP4qbW0BxrZqpqVMwQqfdigg+j1l0=; b=udGp52pe1U5zrV2loAgix7g9AhfVLlNTBXDYcFrYfYQ5i4Lcnihh5Emoo38/MqUeiMhVYu Q1y72qGBSHl40je0Now4xF1wI0yedrn8RU04Fbhgx9kk/6hJyhfoPjV3mlLMXfTpfAcGt/ 3IfZf50sgSgzxD74msooXWX+faFX8b2vV+nDTMl5qZGEhY2rvcln3B6JhzQMZwr8Sxm3O2 59csQxJ6yqq4cZfhbmtk/X1C4esRQ7i7EtWPwOTnOZgjMM8UuZT7i2sXyS7Yh86JRqnsdh U2ldjHvfP7l25lf+qBO+xC4CJvPlwmBB+mTqEJ50+czWDI5ngtIpeT14/JVbCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DSJCBwwwYLejCOtP4qbW0BxrZqpqVMwQqfdigg+j1l0=; b=fYoCH+M3zl4+INmSgX8pImK1bAWB4NxPAjfHuil6XHHPIGYyhhOeZ/6ZIlAtQ+rodu278l vRtRlHHvBWi/U2pXny4rUGlyZp6Akyx6J4bBELKB9xNLLgSJES0p5MlUYT8xQVgW6MG2mx Cy5M4H6rFGhGlEKNUxSj6fsHWJjoQo12Fjg1HiTFtd1QWpbWN25BpsbFI7OsBP+2dHZQu5 m8L4RVPP4u3vPLW8cuVmeyfI2XwtRhlo9FDGL/Va4ZH15e2zyPM5xqjcsTTMNBpOJ+x+bl +N9LOS6UKY63XRnBerdvj639dvDPQ2Fx9cy8I1RaXQKN+LSPeFMwWUcYIf2dlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751599358; a=rsa-sha256; cv=none; b=b4P0OPgp61Is3bg1jS5Nv/AK/JS7akQScopHYjK2IwO/voqfiKWuNU1Wo8fCRkW6ShzjKU djfjvptnUZ8J0W3IX5WnSsL/ZyxDVURk6GxfOxz1BAGpEO3AOFE4QIDkxVog9czlbJrCQw dX1Nz4mp5CSjbfjkHfLfQi+ol6KCeenEEWWWIy1Kp0a2+yfQmfRP6JkyoczX8Vtf/0Rofa YpD/XxhYq6lzA6PZVYd0xdfRWtGIsG/c0wEdRucHsOwJercN1WQ6AhYEZLwfojyrjAvg5w ReHn87S0NNU5AQXSzS0HESXqIRKE2jZCAVozk4Jan3V3u37i/BTosUf3WcH/xA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYJq21224zYst; Fri, 04 Jul 2025 03:22:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5643McaO079585; Fri, 4 Jul 2025 03:22:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5643Mccq079582; Fri, 4 Jul 2025 03:22:38 GMT (envelope-from git) Date: Fri, 4 Jul 2025 03:22:38 GMT Message-Id: <202507040322.5643Mccq079582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 2f5666c1727c - main - LinuxKPI: MODULE_DEVICE_TABLE() factor out the bus specific MODULE_PNP_INFO() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f5666c1727c949491f73e6c3277b7b542131714 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2f5666c1727c949491f73e6c3277b7b542131714 commit 2f5666c1727c949491f73e6c3277b7b542131714 Author: Bjoern A. Zeeb AuthorDate: 2025-06-22 22:50:33 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-04 03:22:22 +0000 LinuxKPI: MODULE_DEVICE_TABLE() factor out the bus specific MODULE_PNP_INFO() In order to be able to use MODULE_DEVICE_TABLE() with multiple bus attachments, factor out the bus-specfic MODULE_PNP_INFO() and place it next to the structure defining the table. As it turns out bnxt(4) has been using the MODULE_DEVICE_TABLE() with PCI attachments for the "auxillary" bus so far. That makes little sense. Define the MODULE_PNP_INFO() to nothing for that. We may consider pulling these LinucKPI bits in semi-native drivers into LinuxKPI one day as that route is not really sustainabke. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: imp, dumbbell Differential Revision: https://reviews.freebsd.org/D51049 --- sys/compat/linuxkpi/common/include/linux/pci.h | 7 +++++-- sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index f8a0b2d84d41..af19829f1cbb 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -72,6 +72,10 @@ struct pci_device_id { uintptr_t driver_data; }; +#define MODULE_DEVICE_TABLE_BUS_pci(_bus, _table) \ +MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice", \ + _bus, lkpi_ ## _table, _table, nitems(_table) - 1) + /* Linux has an empty element at the end of the ID table -> nitems() - 1. */ #define MODULE_DEVICE_TABLE(_bus, _table) \ \ @@ -88,8 +92,7 @@ static driver_t _ ## _bus ## _ ## _table ## _driver = { \ DRIVER_MODULE(lkpi_ ## _table, _bus, _ ## _bus ## _ ## _table ## _driver,\ 0, 0); \ \ -MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice", \ - _bus, lkpi_ ## _table, _table, nitems(_table) - 1) +MODULE_DEVICE_TABLE_BUS_ ## _bus(_bus, _table) #define PCI_ANY_ID -1U diff --git a/sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h b/sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h index 1d844a67c928..c4c9e789cf3e 100644 --- a/sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h +++ b/sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h @@ -39,6 +39,7 @@ struct auxiliary_device_id { char name[AUXILIARY_NAME_SIZE]; uint64_t driver_data; }; +#define MODULE_DEVICE_TABLE_BUS_auxiliary(_bus, _table) struct auxiliary_device { struct device dev; From nobody Fri Jul 4 03:22:39 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYJq44XZZz60Vhx; Fri, 04 Jul 2025 03:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYJq42RVzz3Vg5; Fri, 04 Jul 2025 03:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MRDtt6JbKxCcpmtb9ycT0HeOEdImzuWNrPFoZZSraFs=; b=NN8EXZbEB46TfHcgqnMgRAIeQGnPKqYIAbmnrobmUvTTbwC8xoCMk6VfJv6Ul+0Aao1JSg /I7AsDJLfnQZkzrU3BfBX/7gp+KbqsPyHk0YyWTBykdVZowPukmcj1XcjyDgOy06ere/NE x5pf+ZyVEIAeDiguKeSkQQc38CYLgFYvwlCsOvifQ5cC/S9Z5EIwCSeqi7bjZGyb45Yy54 xFS5wCryXh8AGfBStm54ipmtHXYJNhCVZuX0qU064/dg8QeMm/LmzkVnPqpw4AL+zPruqo QWmOhFUEAgJz9ully0ik6sKEbETRHwza+IU16th/VjVCXluZ7TmH/fRXaTX0Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MRDtt6JbKxCcpmtb9ycT0HeOEdImzuWNrPFoZZSraFs=; b=Id1Sl1uUY5B12PkT21VBiErJv/ESr/RyEzD20XMxhkXV31/0rourqljClcqw5EXQTJRjsa 61D4Q7Nre/aVZDKjKlIU+sSy0xtEFFyPT3n9fyEQ1y4Ku8/mXl7FdZeLHaEETKd2bsosA7 w3K0E5K3NbsbU/HbpYn0kXFpux/G9QThGXZkRpdDG3yPymyqEVbcTROgNSk8re5ZwH7JDu rFOVo5Ub6BTwkXR5HnDfb7Y0uAffF5dK//ZEUFpM5fc9FT0P5TLDNeFvxJLTPCw1zDdLW8 4ZdzVKauoUmXOl3h6JSNBtwSj6asXOKzqGIDnt4bsc800UbXeW3MwTeGIRgiEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751599360; a=rsa-sha256; cv=none; b=H4pa5ObcCW8zWQuJfFd5tZNKry3qoFGZHlTiKH3wrO1gfiWTJzN3A9En6vqgtOb/6BkHu/ zD2Ab3+bCZ8YcWoyAB2P7mndotG67Z82qWj1RCpQJlRQzz8gcbMmQ4XEaW8ZmEP/LZhViH uMwThozjfzTMlHbTpCSlap9ipDoqpVPKdMRxrK9CiPLHbgWk+zlFrfZujIL/C1ZfawCEpy Eh0ZAld4h1NsW6IRzSWFLWDfH9RKs/cvBUSamOf7XwuuaqWnYHs8OAz3T8nD8fk9kfE5AH o+frElkV7eWSvXhqFTptQmWp/KlRiVP7Mjy8bfWhbDXT9ShbfezRwmJA6EBYAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYJq41yc6zYsv; Fri, 04 Jul 2025 03:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5643MdBL079622; Fri, 4 Jul 2025 03:22:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5643Md3E079619; Fri, 4 Jul 2025 03:22:39 GMT (envelope-from git) Date: Fri, 4 Jul 2025 03:22:39 GMT Message-Id: <202507040322.5643Md3E079619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 16c6a3444a19 - main - LinuxKPI: device.h add (*shutdown) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16c6a3444a1913e01ce0fce4257c52b5969da10a Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=16c6a3444a1913e01ce0fce4257c52b5969da10a commit 16c6a3444a1913e01ce0fce4257c52b5969da10a Author: Bjoern A. Zeeb AuthorDate: 2024-07-29 16:10:29 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-04 03:22:22 +0000 LinuxKPI: device.h add (*shutdown) There are too many ways to call (*shutdown)() and others in Linux it seems; rather than using the one from dev_pm_ops or directly on the bus system device, some wireless drivers are setting it on struct device_driver so add it. Bump __FreeBSD_version as this changes the size of various other structs which have struct device_driver embedded. Sponsored by: The FreeBSD Foundation Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D50679 --- sys/compat/linuxkpi/common/include/linux/device.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index a5f6874a07f6..2556b0c45e49 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -90,6 +90,8 @@ struct dev_pm_ops { struct device_driver { const char *name; const struct dev_pm_ops *pm; + + void (*shutdown) (struct device *); }; struct device_type { From nobody Fri Jul 4 03:22:40 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYJq45Hn3z60VT5; Fri, 04 Jul 2025 03:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYJq43LZMz3VpD; Fri, 04 Jul 2025 03:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pN3ynQtonN/XkduL2C4Ikk55lxV7TohL9vKrigGNS2w=; b=lVcamMqVOxy8xVAgVShhtB0FStyWWKzHf39USKulRcONKAOI8U6p+K+do82oJv7JthOTZf xmKco8Sv95c9B1nGVU8TuUMBng0ceK7wpBrVAf864g6aV3vKxlSlTuQkLtWp8JZSQdoLpe nlFakIYwnClRWeDUXLKZiY9OJug5WQL7x8PNdK4d9WY5KMo0ayLIcVaSrlpcsjqXxllJyo eNbxO9DQusxwIai86Js0F3JjVnPO4S4j0u4umQILBrZ622qSLJnSv8/kQZZDjV9dImURmF Jrssh3kuaniA29oqCdKpHXT/u2a05nM8QzlfpBMqIByE+JaQ1NApItSIOJJ7jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pN3ynQtonN/XkduL2C4Ikk55lxV7TohL9vKrigGNS2w=; b=dlQPVZ2IGBhRt/m3R2VC3bOO70KMbVJxuud1ElnV/+hK+ysD69YIOLt24rghQQm/pxm0XU VtIq8cqsiiVvy7ZnkrP53791fS74YoRiax4xhFYEKw37bcLaqQmvh0wR7GZYqSJ14hEZvm Jlw3cJwde46bQRG9Fh5hv3+kPaA9HLFcF4qhGOA1mECBM+hq2YNbyLxT65XACNI3nf3e30 vVvLvYFkufdhr6h370eB/02Eh1kxfbGa3X65rNmu+bgl/T5rg2MWU+qQpxtXsxRiyUqv4c AigrGtfYMx8TGFMpavXlvtYMm5/oVRFWFRm4TDWg5mTH5FjIVmYZAZ0KxeNT7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751599360; a=rsa-sha256; cv=none; b=xqEMlQMROMxC6VhbRZ1sVRoQVy7qZTsZvRV8lEJALbvsk/84wvu/HNLk4qNJbdeco3bT3m mI+wRvxYK5zK4HD1wmxggXKbtjwDaQKnHPTX/zntY3Mjs3YruIUlySc89GfXFVIPZ+g067 +HLfyYEgpzNHGxCHpzCo52AlxMiC8LC7dzu8E/GA54fv37TDfxNEQ4iTEQrDTxuXE9bDHn BIDJq0HV7RBKhkPeMp3q0uPLuB26SZaeyIdJpNVFWGKv8Hxgs3tG68hyUGx88hav5lXNXG /hevEvkYx4ebFM/l/zHpyH1IbpEj2CdTlyY9rjiToyqAcLCCRLwKMHaffxMq4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYJq42snrzZ4Y; Fri, 04 Jul 2025 03:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5643MeJf079659; Fri, 4 Jul 2025 03:22:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5643Me8q079656; Fri, 4 Jul 2025 03:22:40 GMT (envelope-from git) Date: Fri, 4 Jul 2025 03:22:40 GMT Message-Id: <202507040322.5643Me8q079656@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 2ddfcc013c25 - main - LinuxKPI: acpi: provide union [linuxkpi]_acpi_(object|buffer) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ddfcc013c251f13c8c9b24970b8134ddd49afea Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2ddfcc013c251f13c8c9b24970b8134ddd49afea commit 2ddfcc013c251f13c8c9b24970b8134ddd49afea Author: Bjoern A. Zeeb AuthorDate: 2025-06-15 10:38:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-04 03:22:22 +0000 LinuxKPI: acpi: provide union [linuxkpi]_acpi_(object|buffer) Provide union acpi_(object|buffer) as linuxkpi_ versions and in Linux native lower case spelling so that driver code compiles unmodified. Use the linuxkpi_ prefix to avoid name clashes with the native ACPI implementation which uses CamelCase. Use the linuxkpi_ names internally and redefine the linuxkpi_ unions to their native names so they are avail as expected in drivers. As a transition to not break drm-kmod which has in-place (no #ifdef) changes from Linux spelling ot FreeBSD spelling, introduce LINUXKPI_WANT_LINUX_ACPI so we have the Linux spelling as an opt-in. That way the transition can happen gracefully and once "top-of-trees" are all sorted we can remove the #ifdefs here again. Bump __FreeBSD_version to be able to detect this change. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: wulf (previous version), dumbbell Differential Revision: https://reviews.freebsd.org/D50863 --- sys/compat/linuxkpi/common/include/acpi/acpi.h | 76 ++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/acpi/acpi.h b/sys/compat/linuxkpi/common/include/acpi/acpi.h index e0218bdde12e..1e398d05ba20 100644 --- a/sys/compat/linuxkpi/common/include/acpi/acpi.h +++ b/sys/compat/linuxkpi/common/include/acpi/acpi.h @@ -3,6 +3,10 @@ * * Copyright (c) 2017 Mark Johnston * Copyright (c) 2020 Vladimir Kondratyev + * Copyright (c) 2025 The FreeBSD Foundation + * + * Portions of this software were developed by Björn Zeeb + * 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 are @@ -30,6 +34,13 @@ #ifndef _LINUXKPI_ACPI_ACPI_H_ #define _LINUXKPI_ACPI_ACPI_H_ +/* + * LINUXKPI_WANT_LINUX_ACPI is a temporary workaround to allow drm-kmod + * to update all needed branches without breaking builds. + * Once that happened and checks are implemented based on __FreeBSD_verison + * we will remove these conditions again. + */ + /* * FreeBSD import of ACPICA has a typedef for BOOLEAN which conflicts with * amdgpu driver. Workaround it on preprocessor level. @@ -46,8 +57,8 @@ typedef int64_t INT64; #include #undef BOOLEAN +typedef ACPI_IO_ADDRESS acpi_io_address; typedef ACPI_HANDLE acpi_handle; -typedef ACPI_OBJECT acpi_object; typedef ACPI_OBJECT_HANDLER acpi_object_handler; typedef ACPI_OBJECT_TYPE acpi_object_type; typedef ACPI_STATUS acpi_status; @@ -55,12 +66,62 @@ typedef ACPI_STRING acpi_string; typedef ACPI_SIZE acpi_size; typedef ACPI_WALK_CALLBACK acpi_walk_callback; +union linuxkpi_acpi_object { + acpi_object_type type; + struct { + acpi_object_type type; + UINT64 value; + } integer; + struct { + acpi_object_type type; + UINT32 length; + char *pointer; + } string; + struct { + acpi_object_type type; + UINT32 length; + UINT8 *pointer; + } buffer; + struct { + acpi_object_type type; + UINT32 count; + union linuxkpi_acpi_object *elements; + } package; + struct { + acpi_object_type type; + acpi_object_type actual_type; + acpi_handle handle; + } reference; + struct { + acpi_object_type type; + UINT32 proc_id; + acpi_io_address pblk_address; + UINT32 pblk_length; + } processor; + struct { + acpi_object_type type; + UINT32 system_level; + UINT32 resource_order; + } power_resource; +}; + +#ifdef LINUXKPI_WANT_LINUX_ACPI +struct linuxkpi_acpi_buffer { + acpi_size length; /* Length in bytes of the buffer */ + void *pointer; /* pointer to buffer */ +}; + +typedef struct linuxkpi_acpi_buffer lkpi_acpi_buffer_t; +#else +typedef ACPI_BUFFER lkpi_acpi_buffer_t; +#endif + static inline ACPI_STATUS acpi_evaluate_object(ACPI_HANDLE Object, ACPI_STRING Pathname, - ACPI_OBJECT_LIST *ParameterObjects, ACPI_BUFFER *ReturnObjectBuffer) + ACPI_OBJECT_LIST *ParameterObjects, lkpi_acpi_buffer_t *ReturnObjectBuffer) { return (AcpiEvaluateObject( - Object, Pathname, ParameterObjects, ReturnObjectBuffer)); + Object, Pathname, ParameterObjects, (ACPI_BUFFER *)ReturnObjectBuffer)); } static inline const char * @@ -83,9 +144,9 @@ acpi_get_data(ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, void **Data) } static inline ACPI_STATUS -acpi_get_name(ACPI_HANDLE Object, UINT32 NameType, ACPI_BUFFER *RetPathPtr) +acpi_get_name(ACPI_HANDLE Object, UINT32 NameType, lkpi_acpi_buffer_t *RetPathPtr) { - return (AcpiGetName(Object, NameType, RetPathPtr)); + return (AcpiGetName(Object, NameType, (ACPI_BUFFER *)RetPathPtr)); } static inline ACPI_STATUS @@ -101,4 +162,9 @@ acpi_put_table(ACPI_TABLE_HEADER *Table) AcpiPutTable(Table); } +#ifdef LINUXKPI_WANT_LINUX_ACPI +#define acpi_object linuxkpi_acpi_object +#define acpi_buffer linuxkpi_acpi_buffer +#endif + #endif /* _LINUXKPI_ACPI_ACPI_H_ */ From nobody Fri Jul 4 03:22:41 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYJq573bjz60VR8; Fri, 04 Jul 2025 03:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYJq54bxgz3VVD; Fri, 04 Jul 2025 03:22:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r1gnqhPfDZ8yV2GmeMlqti0hPk0oymd4CTQU0RNIa1M=; b=buCPqghfC3EFBaWNsPALMmb6k45Z6fMzR2xEjZt8qnmAb9BGGmigEvF7D08ZfWZ+PlY5jK NK+xAa2eF/rqVWJoyTK9EEVLO2K9p5aMh5Tx6WPtLL25PCOT67+h4MOXqZR5SRlsuO/4ce nJLyesCyA0ckXduv2fxu5u6APUhmBeI0gLXq82R2cDXbmZpXg0yF1iff3uxa1/XJogx8vp xdw1LNqiPhmRolm2EkTTNIz/aMCt1Pn1slFTC56419corW3yArCMbpyYjfp5XP2ix/tdnn MQFrg+cGSkW9zefjecMD7v1b12Vd/bTuuHAqedadgPWXE9Q05bQPvEge+VsagQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r1gnqhPfDZ8yV2GmeMlqti0hPk0oymd4CTQU0RNIa1M=; b=okFjWIKD0V6eUVsPXcIz9ZXWfkspNRReQUL5zHn9cf+/DAJJ+7w+UlnA8N0kXOouGZUFVl Yb7QjWI5NQNPCzuocAGuOh4k8ydMwIYXQExSNRj6d7PPxKGH6bWznAhdp70LU+7wstRiMZ gnSpmHHm+m39JLYWYo21zJwZz8/hml5gvQ+QnDiuMuAvUew4Fxw08LHUHsdIJDMyNS9RVC 00FvH37dw8b9FrEcI60V2TKaVwe9mQmnuOPQnZjAncC+PtC6E9o8oMEGeGUHzyxRZKDVzA CKWNsQfCk7u0iz+0hx66Z4cjb0PW0xHXocxvWDStmw4ZmVJypIimDJXV0/drfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751599361; a=rsa-sha256; cv=none; b=V17n45tzwTDslQ8StWH4HsZr8zNKCM/ck0L9tkiojJhAK8ffJWrMR0tlkV7aAgvE6KI5UO LtMaSJNZ2iJl9txnEc3dpNS0o2daCGRVkWnnqMQ8M2OUhVwDNwAt0/AbNS+mgh3aplTKDX RLvsAC5k3DnJRRC5tPm/hoBGLYhGTb52gLpAfHgaIyEJq3fdF6nc5xRa/cGqUdj1K1Z1d6 KvOvBc5JIQswbOs019QuuWRkkiOFe4aNy7FVIemggKarDFG0lwwqkMjMKUhqz9q57y2iVs 4irJvyowjncifh3D5L9B6ITYUiWYl6Vuv81lIF5diMZSAS2eCfZTmjA3qZ4NYg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYJq53qlbzZV5; Fri, 04 Jul 2025 03:22:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5643Mfdh079702; Fri, 4 Jul 2025 03:22:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5643MfoB079699; Fri, 4 Jul 2025 03:22:41 GMT (envelope-from git) Date: Fri, 4 Jul 2025 03:22:41 GMT Message-Id: <202507040322.5643MfoB079699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ba6460df5607 - main - LinuxKPI: acpi: add acpi_evaluate_dsm() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ba6460df5607e572e9c868413c75ce9bc5ce9a00 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ba6460df5607e572e9c868413c75ce9bc5ce9a00 commit ba6460df5607e572e9c868413c75ce9bc5ce9a00 Author: Bjoern A. Zeeb AuthorDate: 2025-06-15 10:43:18 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-04 03:22:22 +0000 LinuxKPI: acpi: add acpi_evaluate_dsm() Add a acpi_evaluate_dsm() wrapper around the native implementation as needd by wireless drivers. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D50864 --- sys/compat/linuxkpi/common/include/acpi/acpi_bus.h | 6 ++++++ sys/compat/linuxkpi/common/src/linux_acpi.c | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h b/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h index 65bcbe7f1bdd..47195e7d66a6 100644 --- a/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h +++ b/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h @@ -58,4 +58,10 @@ bool lkpi_acpi_dev_present(const char *hid, const char *uid, struct acpi_device *lkpi_acpi_dev_get_first_match_dev(const char *hid, const char *uid, int64_t hrv); +union linuxkpi_acpi_object; + +union linuxkpi_acpi_object * +acpi_evaluate_dsm(ACPI_HANDLE ObjHandle, const guid_t *guid, + UINT64 rev, UINT64 func, union linuxkpi_acpi_object *arg); + #endif /* _LINUXKPI_ACPI_ACPI_BUS_H_ */ diff --git a/sys/compat/linuxkpi/common/src/linux_acpi.c b/sys/compat/linuxkpi/common/src/linux_acpi.c index 6a9afb3ddff0..d18c69d9210d 100644 --- a/sys/compat/linuxkpi/common/src/linux_acpi.c +++ b/sys/compat/linuxkpi/common/src/linux_acpi.c @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -99,6 +100,17 @@ acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid, int rev, argv4, &buf, type)) ? (ACPI_OBJECT *)buf.Pointer : NULL); } +union linuxkpi_acpi_object * +acpi_evaluate_dsm(ACPI_HANDLE ObjHandle, const guid_t *guid, + UINT64 rev, UINT64 func, union linuxkpi_acpi_object *pkg) +{ + ACPI_BUFFER buf; + + return (ACPI_SUCCESS(acpi_EvaluateDSM(ObjHandle, (const uint8_t *)guid, + rev, func, (ACPI_OBJECT *)pkg, &buf)) ? + (union linuxkpi_acpi_object *)buf.Pointer : NULL); +} + static void linux_handle_power_suspend_event(void *arg __unused) { @@ -323,6 +335,13 @@ acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid, int rev, return (NULL); } +union linuxkpi_acpi_object * +acpi_evaluate_dsm(ACPI_HANDLE ObjHandle, const guid_t *guid, + UINT64 rev, UINT64 func, union linuxkpi_acpi_object *pkg) +{ + return (NULL); +} + int register_acpi_notifier(struct notifier_block *nb) { From nobody Fri Jul 4 03:22:42 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYJq71WRfz60VR9; Fri, 04 Jul 2025 03:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYJq656y1z3VgY; Fri, 04 Jul 2025 03:22:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kxyoMPDNwiAMHJSeXhjula8od5hWf4Rh4lI0nA1NEUo=; b=QHpvPCY/a4Yi6/FqmHZWXqiZG14dHsOpgMWemMFE2yj4BN5kS1MUKOfA0L1VZ/nFHi9WX7 OQMmAhcQT8EiipmNfF1+Ev6Cl8kDXfVT8GB4A5VeWrUclw2Hdl/fWfV1x9CveZgntGArou Ac5N5DHmWRn5mFsvSB/m4neJZHrTKX5hCmS5Q2Ll4yZq53/8Lfw+a3xhNGCPX6KSRTkhDC aAYS/Fw5KGXwPfslG9YutDgCgTiCOcrDsEP+SCEinZYgqolDMlxKrFxVyyxrztkBKUHgOD a5H4B4J21OBUEbd+r8GdXYwpdH9orvngKoOCiN1DZxjAWy2NEk8sVyBHl1aTvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751599362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kxyoMPDNwiAMHJSeXhjula8od5hWf4Rh4lI0nA1NEUo=; b=w7RyqjJWIjssnsJ/kly02mhckrQPH9zz7BKKymhryN5XSRJOM4794qlK6G7oIQTxOy6ydr /xPrE62qRIYhHsu1hFTXynVMQroDdljnsbDuxlgkGbBKWR3o08pYeIrZSmESzPMf4LnDbS WfhcVygkalR+s5lY1SWqOSEpd9LCTRDrizb9/C+rQcrqh8sKz3GvG0MSWIXwshrbH8baKP qdrsY5z6X+L1Tua6S5uCpR+M7Tri5IeieeShGE6YVK2Z4edjOM8aa360LKQIaf477CLNW+ YXtlYLOM/5aUlDq4eL5Ejmj/lRC1DRMLqJxOtfbOrMFb1353+zObXtpxNE15uQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751599362; a=rsa-sha256; cv=none; b=iRLCCks0c7V94XSwDPGPUMiDaU8fX332jj3SZM0gytVUP/u2ptdVHuUs6Zq9mMEDKc2R97 PQHKiborlwiK18OT7Zdh4E0utz0PumFNtJm4YKDOekQOLGKzz+F8e28rE5f3hT5KCH833r JhcusEBfKOljuRbcGgHdyzfl8/4uGe6z9kz01Sc/h/lF2nlEVYmg0pyBvDsAqoUG5ikce1 KaxtKGMKdwbWB+fjckoZvEBGu/DkoQ6xkkAbJqgxl5Bd91aL3TjI1PL+RuvtQmefZAF30F /7K7/yF7mBRJS5IXBmdH0wju37aUmnQdiOp1C/Po6QoGINuz9X+fprV97Q7Yqw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYJq64jzvzYsw; Fri, 04 Jul 2025 03:22:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5643Mg7s079740; Fri, 4 Jul 2025 03:22:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5643Mg8i079737; Fri, 4 Jul 2025 03:22:42 GMT (envelope-from git) Date: Fri, 4 Jul 2025 03:22:42 GMT Message-Id: <202507040322.5643Mg8i079737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 842da154a0ce - main - Bump __FreeBSD_verion for LinuxKPI changes to device.h and acpi. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 842da154a0ce8f866d65f495537a13ffa8fb9cc0 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=842da154a0ce8f866d65f495537a13ffa8fb9cc0 commit 842da154a0ce8f866d65f495537a13ffa8fb9cc0 Author: Bjoern A. Zeeb AuthorDate: 2025-07-04 03:19:23 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-04 03:22:23 +0000 Bump __FreeBSD_verion for LinuxKPI changes to device.h and acpi. Sponsored by: The FreeBSD Foundation MFC after: 3 days X-MFC: acpi part only --- UPDATING | 4 ++++ sys/sys/param.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 9b3cd1b90909..8205086dbab5 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20250704: + LinuxKPI device.h and acpi changes effecting drivers and drm-kmod. + Bump __FreeBSD_version 1500050 to be able to detect these changes. + 20250630: Commits 171f66b0c2ca and 8e2a90ac8089 changed the internal api between nfscommon.ko and the other nfs modules. diff --git a/sys/sys/param.h b/sys/sys/param.h index f1bf874cb5fd..57eb8ebcf12c 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -74,7 +74,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1500049 +#define __FreeBSD_version 1500050 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From nobody Fri Jul 4 04:57:39 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYLwh088Lz60jJf; Fri, 04 Jul 2025 04:57: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYLwg6mgxz3rWS; Fri, 04 Jul 2025 04:57:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XqxKAf5PWn5ZWfD18xKJ7vL5gRjB4eRuDEC4bCXqQ4Q=; b=FxV34GdAXRDZANf1f9IhZyG5iZi+te2F2yYngF1LGJX114+uBjAaXHNjPQsxEA04ytCsht n8xJk5BpI7BsU+GEZdSvpDHK+HY843GigQWFY+o/bf/ZWzcOnR9RXa+jZ6QchvxFRZ/HYX O1IVLUzjFTPBhlhU460P/plgfgefkEiFtdaLjiFxpcx+NyIfpElTQVny/ZuBdZpKvDRjEe QHyTPOpKyrNziXNeYgIEfCdwKbqVT+P4ZO1U1ex39xHWDPZ8BQ4Jy3xvy7qBQg4XNez9Eo EKUZrGkpMLFiorWB/vTPEUhHFDVr/Hg2mtSHjGS3Ke6Nfl4fgYmdG0QFjficgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XqxKAf5PWn5ZWfD18xKJ7vL5gRjB4eRuDEC4bCXqQ4Q=; b=nrbBpyswNhuvTPzeE7NKtIcaxH7D5Ic4kuqPkOgZdLiOaGZf4EPfpEnSNmyn2zIuLkG82K 1Ioebkw4GWP1ApQoNQb/IM7PlugxWdwfS/WmJZLPnSeeVxUg6gGKSGtx85S0FIimZ7cg3G lfDmA/EiKTlPp42O4jToghsCi4W/P4l3yO+VrEA06rq0hVAw4+IRW2MjtndaaCOxiI4zuY drcJq2jZiVHXu/F6g+KfFKTsYsRF17qaWYJPQNjaMxM2fHMrf7ojRchcIBKKwqrYJpFnMO TjVimmfQ0rzvCrtvFsAGRJW5XtV5jWMUUrWM1SkAggsUtHAye+k9E5zCcWs/Ow== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751605059; a=rsa-sha256; cv=none; b=LkwU6bch7XpCBgNhyeVYxPOW0gq7y5ZkDdornuj1qET6OlMWLeWjT8tHgIbA9g2oabk3vd JYlIZydweIsWH9OHUyYXE0g8hbHhu8vjm63MI4JaM/l2vsts0qmOMcWSZvRY1WZVhu27zC 1GMG9iu4lDCIydKmU6rpA5Y5L7OmBgsD0u8rcjz09aPhAmNFFVw9QRhx7cgQOzZA625LLc lzhITsaklDoPTSxG9abnItakATbjo3VwJDjGDY/boxmFlsutA6qNR8Gy2HdN2HsE3559Ju F1TjVbtCpTAm13LTtX0q9y7jp7l2lHSfToddvFFquIvhjqNOd5VmUlaTfJgAUw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYLwg69bJzc3m; Fri, 04 Jul 2025 04:57:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5644vd4X050100; Fri, 4 Jul 2025 04:57:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5644vdb0050097; Fri, 4 Jul 2025 04:57:39 GMT (envelope-from git) Date: Fri, 4 Jul 2025 04:57:39 GMT Message-Id: <202507040457.5644vdb0050097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b6fb125330dd - stable/14 - amd64: express KV4ADDR() using KV5ADDR() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b6fb125330dd4c079ebb734e97e7378e30fc2c89 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b6fb125330dd4c079ebb734e97e7378e30fc2c89 commit b6fb125330dd4c079ebb734e97e7378e30fc2c89 Author: Konstantin Belousov AuthorDate: 2025-06-15 21:12:52 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 04:57:00 +0000 amd64: express KV4ADDR() using KV5ADDR() (cherry picked from commit 2b09d177bd058ae1d8e03e1d65cf82ab351ae011) --- sys/amd64/include/pmap.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 7ef826c19fe7..76cc122d6b8a 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -113,12 +113,7 @@ * Pte related macros. This is complicated by having to deal with * the sign extension of the 48th bit. */ -#define KV4ADDR(l4, l3, l2, l1) ( \ - ((unsigned long)-1 << 47) | \ - ((unsigned long)(l4) << PML4SHIFT) | \ - ((unsigned long)(l3) << PDPSHIFT) | \ - ((unsigned long)(l2) << PDRSHIFT) | \ - ((unsigned long)(l1) << PAGE_SHIFT)) +#define KV4ADDR(l4, l3, l2, l1) KV5ADDR(-1, l4, l3, l2, l1) #define KV5ADDR(l5, l4, l3, l2, l1) ( \ ((unsigned long)-1 << 56) | \ ((unsigned long)(l5) << PML5SHIFT) | \ From nobody Fri Jul 4 04:57:40 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYLwj0kH8z60hnk; Fri, 04 Jul 2025 04:57: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYLwh6ntQz3rG6; Fri, 04 Jul 2025 04:57:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aJoFGauCBeNklQf2wuQkDop/PmP7SFzVWHi+8mAKJ9Q=; b=TU4mH9KjpILqWFfjtUQh9kZz+pOhaFCs9/WXgW2PGXtgLp3uPRh+HJ1zrcE/lUSkRcn3xs NWfuEYg0d7A9ZzwkzHNnnZCv1tb4P44hiue/ALWu2NDkXqnxgOMcxNgiTkktVHXnlOw0m2 hhaJ5bocfn4XHg/T69nWO2ohaOP+4BfX38b3gSmFVRdDuAXYmg8CLucsqUZl/tZ3tpgO+z EDkfvczwdQZAsnsQflU2kAm4/CLpc5wvdXO7ZelKz3JM5sMwbbNHLq052AI0/JQUvLQCVL +Mwf+t+uPozpkTnEnSxFx9H+bm9SKlHKSgDLNiY7/P8HjUi9UhHumo+RDrFJwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aJoFGauCBeNklQf2wuQkDop/PmP7SFzVWHi+8mAKJ9Q=; b=XtDpOhMkhFgqHM6P0vdDiGb/V3ewQ++xluPQujOiHNCM6CpiuootAdukp42Z0ZizzgzUl4 vS8wP351xs8axc6I3k3oAFdtanuH/ya/udkMQ1dN3IfoiFa/Iz8Qrb04t5rNAfcq1q9/KC 4vRLAh0FGcC4M8lda5UMfA5xeUTSEVnc/v20xUzosRYBAuz0h2FiPGmqT8ftuIXGzqn4WP 5TfMHTq6TyBVz5zotodHqGyWwC6Z4I+PIKOAgE1g+xOLIueRN13lWN7V3vxj+4+kZ2VD7l vPeyHUtR6xakoy1UPxIh65pboA3Y6cFOHEg9fNs4VEOCpgvvAJh73FUuNYU4kg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751605060; a=rsa-sha256; cv=none; b=b+gXPDdPGytmU6rHySYNqE3r6qSmHIqiOuhVP4rZ2DIsa1SM/VXJWOW51LuRITS04W8CMe 6O194EOzJ2OQqJpQ0mZ3x5WojHqg5y51cdsdf4vxqAmyzXW1iPzKGsNq0+BV4L/h9o3Mkp JMN+odtITOz0pl26chVzLR9WqdAYdK3Fb79ZwmEhumgb46s7THJmjIf297ogv3CX1TLNXw keePWE85l+daq+p7XTj1rWfjLcmr1kAIhZR5BVqAc1pXOchiW/0BMaVcKCnF6VA4AFm/// Wpk0Z9Az/WVkaCEgqf/1Q6fZG1jd4PJuagVsPCPXpiaO4gTtOeghPtyl0XUAUg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYLwh6JmXzcdd; Fri, 04 Jul 2025 04:57:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5644vep3050136; Fri, 4 Jul 2025 04:57:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5644veUm050133; Fri, 4 Jul 2025 04:57:40 GMT (envelope-from git) Date: Fri, 4 Jul 2025 04:57:40 GMT Message-Id: <202507040457.5644veUm050133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 9f685f4f2f93 - stable/14 - amd64: remove dmapbase, dmapend symbols List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9f685f4f2f930316f04ab180843e342897034dc4 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9f685f4f2f930316f04ab180843e342897034dc4 commit 9f685f4f2f930316f04ab180843e342897034dc4 Author: Konstantin Belousov AuthorDate: 2025-06-19 21:03:15 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 04:57:01 +0000 amd64: remove dmapbase, dmapend symbols (cherry picked from commit 96f6283cc7af8342fd7965f3791d22352a028022) --- sys/amd64/amd64/locore.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 4d10879d9f30..29fbf38cea33 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -40,11 +40,9 @@ /* * Compiled KERNBASE location */ - .globl kernbase, kernload, dmapbase, dmapend + .globl kernbase, kernload .set kernbase,KERNBASE .set kernload,KERNLOAD - .set dmapbase,DMAP_MIN_ADDRESS - .set dmapend,DMAP_MAX_ADDRESS #define BOOTSTACK_SIZE (PAGE_SIZE * KSTACK_PAGES) From nobody Fri Jul 4 04:57:41 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYLwk3Ztfz60hnn; Fri, 04 Jul 2025 04:57: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYLwk0MySz3rNN; Fri, 04 Jul 2025 04:57:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9z6SGkKj2MpcoZByk3Vm2Lf+uVFEaZoWXZHA8xw0J6o=; b=tnu8PclZlUNM6XrIwzyUw6RBQhdqiXZJRSfFC+TeezCS9VAFp01NOhorekOx1zVJNLfQbt LaPFrm1qtAIA8J5NzAjmRGwZFgjmmfkSmP3moIVWOGTuE64kgVek4JBjuHKMAUKHitT761 IXsIC2hjuIPo+2Q5FS0wclpKLL7BVdHEJ9vQ1EIlQDZOMRLiJ3/1cH3Nr5pgeJYGTo64pM zrbYkEC3D6APgKH2MRcaRn6jCWyd4PlU0BVQZor8lH1m4ZVCObHfW6oQt0wbY9ZHDdpLcq W1FUKwa58tEcxigplDhEddc3Uzti8stUGxyHfJtsbN4yExh5+7twdI6v9BkJ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9z6SGkKj2MpcoZByk3Vm2Lf+uVFEaZoWXZHA8xw0J6o=; b=D5kZvOHMdLPmhxUAlYafv1ueWGkbsNvIfh1DtvTvsb+IFJHT/OQ/LOXlKHV8pJtNpJqzBV lAtT25vfyzs+3zg/1hVHxEr4+ya8CvmUfnTUAIoXbeK7TyYYAVMcQSyliLvhI4segaHwx/ 70Mx2QgzwSW/D9C/NxbEDujmDK8kqL0Ziq8HJb2dQ79C5B2lxMLlBr4o+9bYCcCzcWQtCB VGtsaKPQd0CUIGFKiHzw/CMXgphYFk6spcEY/wnkTrjOPRjODBqTIfy78jO1MowueqNOid OsSvr3YVkdN2CWcYKuYwDeKgg596YoxsYVBE6weubOB1LenhaYnf+3yvc7cZdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751605062; a=rsa-sha256; cv=none; b=iNi8+A6QokHpOeklZ5QSAQWGlZFyURbtKp47jiIyPaE6zmHjSHPRuwWivITO+NxL2/IrIB fveoZFm3Q9HSvAZ6kr/Ibg66755dSG7wStef3k8+8qhnZUw/QyJexdnbFSydTDn4G2ECr3 00BgFjp/701vV0fIdaHLjp0dZGaKzGlPR3Tc97CaXaEKjPT9rSciWudKOiEruRT/jhlCE9 b4Ic+WTgAYWXK0L/x0KXlOupSS9Gq/Cen+ihPlw88N5PES/e1y6k4iL3Ps4U3AUrhmEBuZ AxzdYIZXKYtla0BHUxlQ+DI3bsN1KjQubWeBMhADJYgUvP5PO4W6vSh6dHx7Nw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYLwj70J7zcNm; Fri, 04 Jul 2025 04:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5644vf4B050170; Fri, 4 Jul 2025 04:57:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5644vfvk050167; Fri, 4 Jul 2025 04:57:41 GMT (envelope-from git) Date: Fri, 4 Jul 2025 04:57:41 GMT Message-Id: <202507040457.5644vfvk050167@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 0e33dd60f617 - stable/14 - amd64: eliminate asm symbols DMAP_MIN/MAX_ADDRESS List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0e33dd60f617bd2386f7600dd60283d29e6e9d28 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0e33dd60f617bd2386f7600dd60283d29e6e9d28 commit 0e33dd60f617bd2386f7600dd60283d29e6e9d28 Author: Konstantin Belousov AuthorDate: 2025-06-19 21:17:38 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 04:57:02 +0000 amd64: eliminate asm symbols DMAP_MIN/MAX_ADDRESS (cherry picked from commit 3d1b33d9233936efbdd819c55d75569db1dd8690) --- sys/amd64/amd64/genassym.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c index 214ad494639c..a0cf9649e423 100644 --- a/sys/amd64/amd64/genassym.c +++ b/sys/amd64/amd64/genassym.c @@ -112,8 +112,6 @@ ASSYM(val_PML4PML4I, PML4PML4I); ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); ASSYM(KERNBASE, KERNBASE); ASSYM(KERNLOAD, KERNLOAD); -ASSYM(DMAP_MIN_ADDRESS, DMAP_MIN_ADDRESS); -ASSYM(DMAP_MAX_ADDRESS, DMAP_MAX_ADDRESS); ASSYM(KSTACK_PAGES, KSTACK_PAGES); ASSYM(PCB_R15, offsetof(struct pcb, pcb_r15)); From nobody Fri Jul 4 04:57:43 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYLwm22Hrz60jP4; Fri, 04 Jul 2025 04:57: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYLwl2wzfz3rKx; Fri, 04 Jul 2025 04:57:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W2xueEsRfWqTxJECZPdSFh8gFIMhFQ9zG/csgTP8Sw0=; b=K6/cxJDAWfM1f+nLFp3gTDY/ukQdStRGg0l4qh9zZW1/iSmBl3u/45nLd+rOI86YFjJEM6 adGl5kdfsDZF81gE16nYrnAeNL+QQm0o6aUQJ6MTDuzQlVpbMoYCVq0bjsjeFo8J94syAg y6yIHlcGbxETH+bCsn9U+dTaiXZaRGNppOfvBtP2tChZki3Bq0gvmOz0alHGS7q4Xhr2I2 oKLovKkjV8R2VlS88pLVy4JZ1iz5D2AfQLTLtLymjtoZ+aarpHZv8EDfmVS61YU6Fgtcvf s6tpdbUJd3cAW4o8R7iDBv7KBx9PkHsVeEQYrV1HmV7EZgRlD6ZnUFNFALpfFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W2xueEsRfWqTxJECZPdSFh8gFIMhFQ9zG/csgTP8Sw0=; b=cE9hJP+322CwDEnkgywiSxvlDan+sRhNym2J9RZb1DHkFKkTFrKqi2CyNAPu2Xo9BrvZxE l0CgoWyO753kDJcgd9c6+pnzBCoh3wghUxc/qBdRZMCg3Kqy7DGyQoYCrDs5aeE4o47tRH MePwFKJWb+jVsqOKrtBJabF0lJugTiopM1iEjqXQzhhCAmMVpY/Tg7OWsvDYSn724M35Ym NdNGlbTuzSnr/Mgzci2vrOB2yhQnw+YO5GhzbieU0KgTl5bCiRn6sYtUt20riRjW3IUytK DRW3mzN9x1mpnoC3t2Be4uhBwlgE3kVTWp0MkZdWLrjWmVpifug+A5LMEgqkIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751605063; a=rsa-sha256; cv=none; b=xHkfleJoPs8ULMOOZaZdATKGqzGB23hoiACWuVExsE3tgLKnIkYYp33EtTHnCCL4Pcmb4/ LJUUOCnrESjFRd6ARI4DlrZeKNkM1NLQyt02JnyreBk5SmcAErwHNnHPkn5GSYpe1c/CL8 HDPDrV9QRy8o1b/ZxTAxlSKhH6a0Kilbq13lTiFFtLHjV60UokiN21bWV+a+E3wKCDXJJC nh686OO6rYUvY7wM6H+VvN2kW6XXOfBGuOzTG8KPaIqkCkQgDwwTBf3hE3F5AO8miw4Qqx jWW436L8GhuWA98os8psoLjbiGsrern0Wg3wSSalYnotBUPsn6g2kxpJK5dGPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYLwl1Bb6zc3n; Fri, 04 Jul 2025 04:57:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5644vhx9050207; Fri, 4 Jul 2025 04:57:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5644vhsD050204; Fri, 4 Jul 2025 04:57:43 GMT (envelope-from git) Date: Fri, 4 Jul 2025 04:57:43 GMT Message-Id: <202507040457.5644vhsD050204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 0f62297dd1f2 - stable/14 - amd64: switch to la57 mode before creating kernel page tables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0f62297dd1f2084af942924265b7c46b60525699 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0f62297dd1f2084af942924265b7c46b60525699 commit 0f62297dd1f2084af942924265b7c46b60525699 Author: Konstantin Belousov AuthorDate: 2025-06-23 23:20:56 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 04:57:02 +0000 amd64: switch to la57 mode before creating kernel page tables (cherry picked from commit 4e1d69b9fbff280962e5ae5258624b60d5ab4618) --- sys/amd64/amd64/locore.S | 2 + sys/amd64/amd64/pmap.c | 207 ++++++++++++++++------------------------------- 2 files changed, 72 insertions(+), 137 deletions(-) diff --git a/sys/amd64/amd64/locore.S b/sys/amd64/amd64/locore.S index 29fbf38cea33..2be555b25160 100644 --- a/sys/amd64/amd64/locore.S +++ b/sys/amd64/amd64/locore.S @@ -119,6 +119,8 @@ ENTRY(la57_trampoline) leaq la57_trampoline_end(%rip),%rsp /* priv stack */ movq %cr0,%rbp + leaq la57_trampoline_gdt(%rip),%rax + movq %rax,la57_trampoline_gdt_desc+2(%rip) lgdtq la57_trampoline_gdt_desc(%rip) pushq $(2<<3) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 8e2c2109e7ad..97e59123df97 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1686,12 +1686,43 @@ bootaddr_rwx(vm_paddr_t pa) return (pg_nx); } +extern const char la57_trampoline[]; + +static void +pmap_bootstrap_la57(vm_paddr_t *firstaddr) +{ + void (*la57_tramp)(uint64_t pml5); + pml5_entry_t *pt; + + if ((cpu_stdext_feature2 & CPUID_STDEXT2_LA57) == 0) + return; + TUNABLE_INT_FETCH("vm.pmap.la57", &la57); + if (!la57) + return; + + KPML5phys = allocpages(firstaddr, 1); + KPML4phys = rcr3() & 0xfffff000; /* pml4 from loader must be < 4G */ + + pt = (pml5_entry_t *)KPML5phys; + pt[0] = KPML4phys | X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M; + pt[NPML4EPG - 1] = KPML4phys | X86_PG_V | X86_PG_RW | X86_PG_A | + X86_PG_M; + + la57_tramp = (void (*)(uint64_t))((uintptr_t)la57_trampoline - + KERNSTART + amd64_loadaddr()); + printf("Calling la57 trampoline at %p, KPML5phys %#lx ...", + la57_tramp, KPML5phys); + la57_tramp(KPML5phys); + printf(" alive in la57 mode\n"); +} + static void create_pagetables(vm_paddr_t *firstaddr) { pd_entry_t *pd_p; pdp_entry_t *pdp_p; pml4_entry_t *p4_p; + pml5_entry_t *p5_p; uint64_t DMPDkernphys; vm_paddr_t pax; #ifdef KASAN @@ -1919,6 +1950,27 @@ create_pagetables(vm_paddr_t *firstaddr) } kernel_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys); + + if (la57) { + /* XXXKIB bootstrap KPML5phys page is lost */ + KPML5phys = allocpages(firstaddr, 1); + for (i = 0, p5_p = (pml5_entry_t *)KPML5phys; i < NPML5EPG; + i++) { + if (i == PML5PML5I) { + /* + * Recursively map PML5 to itself in + * order to get PTmap and PDmap. + */ + p5_p[i] = KPML5phys | X86_PG_RW | X86_PG_A | + X86_PG_M | X86_PG_V | pg_nx; + } else if (i == pmap_pml5e_index(UPT_MAX_ADDRESS)) { + p5_p[i] = KPML4phys | X86_PG_RW | X86_PG_A | + X86_PG_M | X86_PG_V; + } else { + p5_p[i] = 0; + } + } + } TSEXIT(); } @@ -1952,6 +2004,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) /* * Create an initial set of page tables to run the kernel in. */ + pmap_bootstrap_la57(firstaddr); create_pagetables(firstaddr); pcpu0_phys = allocpages(firstaddr, 1); @@ -1981,7 +2034,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) cr4 = rcr4(); cr4 |= CR4_PGE; load_cr4(cr4); - load_cr3(KPML4phys); + load_cr3(la57 ? KPML5phys : KPML4phys); if (cpu_stdext_feature & CPUID_STDEXT_SMEP) cr4 |= CR4_SMEP; if (cpu_stdext_feature & CPUID_STDEXT_SMAP) @@ -1994,8 +2047,20 @@ pmap_bootstrap(vm_paddr_t *firstaddr) * later unmapped (using pmap_remove()) and freed. */ PMAP_LOCK_INIT(kernel_pmap); - kernel_pmap->pm_pmltop = kernel_pml4; - kernel_pmap->pm_cr3 = KPML4phys; + if (la57) { + vtoptem = ((1ul << (NPTEPGSHIFT + NPDEPGSHIFT + NPDPEPGSHIFT + + NPML4EPGSHIFT + NPML5EPGSHIFT)) - 1) << 3; + PTmap = (vm_offset_t)P5Tmap; + vtopdem = ((1ul << (NPDEPGSHIFT + NPDPEPGSHIFT + + NPML4EPGSHIFT + NPML5EPGSHIFT)) - 1) << 3; + PDmap = (vm_offset_t)P5Dmap; + kernel_pmap->pm_pmltop = (void *)PHYS_TO_DMAP(KPML5phys); + kernel_pmap->pm_cr3 = KPML5phys; + pmap_pt_page_count_adj(kernel_pmap, 1); /* top-level page */ + } else { + kernel_pmap->pm_pmltop = kernel_pml4; + kernel_pmap->pm_cr3 = KPML4phys; + } kernel_pmap->pm_ucr3 = PMAP_NO_CR3; TAILQ_INIT(&kernel_pmap->pm_pvchunk); kernel_pmap->pm_stats.resident_count = res; @@ -2050,6 +2115,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr) /* * Re-initialize PCPU area for BSP after switching. * Make hardware use gdt and common_tss from the new PCPU. + * Also clears the usage of temporary gdt during switch to + * LA57 paging. */ STAILQ_INIT(&cpuhead); wrmsr(MSR_GSBASE, (uint64_t)&__pcpu[0]); @@ -2179,140 +2246,6 @@ pmap_page_alloc_below_4g(bool zeroed) 1, 0, (1ULL << 32), PAGE_SIZE, 0, VM_MEMATTR_DEFAULT)); } -extern const char la57_trampoline[], la57_trampoline_gdt_desc[], - la57_trampoline_gdt[], la57_trampoline_end[]; - -static void -pmap_bootstrap_la57(void *arg __unused) -{ - char *v_code; - pml5_entry_t *v_pml5; - pml4_entry_t *v_pml4; - pdp_entry_t *v_pdp; - pd_entry_t *v_pd; - pt_entry_t *v_pt; - vm_page_t m_code, m_pml4, m_pdp, m_pd, m_pt, m_pml5; - void (*la57_tramp)(uint64_t pml5); - struct region_descriptor r_gdt; - - if ((cpu_stdext_feature2 & CPUID_STDEXT2_LA57) == 0) - return; - TUNABLE_INT_FETCH("vm.pmap.la57", &la57); - if (!la57) - return; - - r_gdt.rd_limit = NGDT * sizeof(struct user_segment_descriptor) - 1; - r_gdt.rd_base = (long)__pcpu[0].pc_gdt; - - m_code = pmap_page_alloc_below_4g(true); - v_code = (char *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_code)); - m_pml5 = pmap_page_alloc_below_4g(true); - KPML5phys = VM_PAGE_TO_PHYS(m_pml5); - v_pml5 = (pml5_entry_t *)PHYS_TO_DMAP(KPML5phys); - m_pml4 = pmap_page_alloc_below_4g(true); - v_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pml4)); - m_pdp = pmap_page_alloc_below_4g(true); - v_pdp = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pdp)); - m_pd = pmap_page_alloc_below_4g(true); - v_pd = (pdp_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pd)); - m_pt = pmap_page_alloc_below_4g(true); - v_pt = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m_pt)); - - /* - * Map m_code 1:1, it appears below 4G in KVA due to physical - * address being below 4G. Since kernel KVA is in upper half, - * the pml4e should be zero and free for temporary use. - */ - kernel_pmap->pm_pmltop[pmap_pml4e_index(VM_PAGE_TO_PHYS(m_code))] = - VM_PAGE_TO_PHYS(m_pdp) | X86_PG_V | X86_PG_RW | X86_PG_A | - X86_PG_M; - v_pdp[pmap_pdpe_index(VM_PAGE_TO_PHYS(m_code))] = - VM_PAGE_TO_PHYS(m_pd) | X86_PG_V | X86_PG_RW | X86_PG_A | - X86_PG_M; - v_pd[pmap_pde_index(VM_PAGE_TO_PHYS(m_code))] = - VM_PAGE_TO_PHYS(m_pt) | X86_PG_V | X86_PG_RW | X86_PG_A | - X86_PG_M; - v_pt[pmap_pte_index(VM_PAGE_TO_PHYS(m_code))] = - VM_PAGE_TO_PHYS(m_code) | X86_PG_V | X86_PG_RW | X86_PG_A | - X86_PG_M; - - /* - * Add pml5 entry at top of KVA pointing to existing pml4 table, - * entering all existing kernel mappings into level 5 table. - */ - v_pml5[pmap_pml5e_index(UPT_MAX_ADDRESS)] = KPML4phys | X86_PG_V | - X86_PG_RW | X86_PG_A | X86_PG_M; - - /* - * Add pml5 entry for 1:1 trampoline mapping after LA57 is turned on. - */ - v_pml5[pmap_pml5e_index(VM_PAGE_TO_PHYS(m_code))] = - VM_PAGE_TO_PHYS(m_pml4) | X86_PG_V | X86_PG_RW | X86_PG_A | - X86_PG_M; - v_pml4[pmap_pml4e_index(VM_PAGE_TO_PHYS(m_code))] = - VM_PAGE_TO_PHYS(m_pdp) | X86_PG_V | X86_PG_RW | X86_PG_A | - X86_PG_M; - - /* - * Copy and call the 48->57 trampoline, hope we return there, alive. - */ - bcopy(la57_trampoline, v_code, la57_trampoline_end - la57_trampoline); - *(u_long *)(v_code + 2 + (la57_trampoline_gdt_desc - la57_trampoline)) = - la57_trampoline_gdt - la57_trampoline + VM_PAGE_TO_PHYS(m_code); - la57_tramp = (void (*)(uint64_t))VM_PAGE_TO_PHYS(m_code); - pmap_invalidate_all(kernel_pmap); - if (bootverbose) { - printf("entering LA57 trampoline at %#lx\n", - (vm_offset_t)la57_tramp); - } - la57_tramp(KPML5phys); - - /* - * gdt was necessary reset, switch back to our gdt. - */ - lgdt(&r_gdt); - wrmsr(MSR_GSBASE, (uint64_t)&__pcpu[0]); - load_ds(_udatasel); - load_es(_udatasel); - load_fs(_ufssel); - ssdtosyssd(&gdt_segs[GPROC0_SEL], - (struct system_segment_descriptor *)&__pcpu[0].pc_gdt[GPROC0_SEL]); - ltr(GSEL(GPROC0_SEL, SEL_KPL)); - lidt(&r_idt); - - if (bootverbose) - printf("LA57 trampoline returned, CR4 %#lx\n", rcr4()); - - /* - * Now unmap the trampoline, and free the pages. - * Clear pml5 entry used for 1:1 trampoline mapping. - */ - pte_clear(&v_pml5[pmap_pml5e_index(VM_PAGE_TO_PHYS(m_code))]); - invlpg((vm_offset_t)v_code); - vm_page_free(m_code); - vm_page_free(m_pdp); - vm_page_free(m_pd); - vm_page_free(m_pt); - - /* - * Recursively map PML5 to itself in order to get PTmap and - * PDmap. - */ - v_pml5[PML5PML5I] = KPML5phys | X86_PG_RW | X86_PG_V | pg_nx; - - vtoptem = ((1ul << (NPTEPGSHIFT + NPDEPGSHIFT + NPDPEPGSHIFT + - NPML4EPGSHIFT + NPML5EPGSHIFT)) - 1) << 3; - PTmap = (vm_offset_t)P5Tmap; - vtopdem = ((1ul << (NPDEPGSHIFT + NPDPEPGSHIFT + - NPML4EPGSHIFT + NPML5EPGSHIFT)) - 1) << 3; - PDmap = (vm_offset_t)P5Dmap; - - kernel_pmap->pm_cr3 = KPML5phys; - kernel_pmap->pm_pmltop = v_pml5; - pmap_pt_page_count_adj(kernel_pmap, 1); -} -SYSINIT(la57, SI_SUB_KMEM, SI_ORDER_ANY, pmap_bootstrap_la57, NULL); - /* * Initialize a vm_page's machine-dependent fields. */ From nobody Fri Jul 4 04:57:44 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYLwn4Bcpz60jXT; Fri, 04 Jul 2025 04:57: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYLwm39G7z3rNZ; Fri, 04 Jul 2025 04:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v53jkI9m3T/QgXz1CKV1oRjayMWfJIODo1ZqvANeex4=; b=egp2NfZlxLCZJzW6v7kEVdqW5U2XvI4az2+GX+b8ABcnvfTxh8Sj5Ht3qqxgbj3ilxzIkg /cWzH49FJTXEhk5hi4ia+x3Mw4BzSW6JtigLUn2ICEVEUrHVYkxl87y4NM00O/rd8RnK3q BlfXjJfeRrWL8A46esCeP5vLLCWrPpQnoIQoZhijRj4IQ8VGWRBO3I0Kmw0MYeMYSLKfNO 0WVqqZEJ/30XgV/EL6ND+9G6e1GHJo9uYjlizfS5d6VI4R+kZmHmMLiH8MA8pOQdI/Fj+3 h50G/4uQaMF9ZID+QcxaQ7mPdn1UKciz5tmYTBRZWyPC1eUiKgZUGE6SSbBBIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751605064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v53jkI9m3T/QgXz1CKV1oRjayMWfJIODo1ZqvANeex4=; b=Dz5idKxe/jX0RNZdAENZViGZU3GPMKj7J0n4zB869jKsyiDsPHGIRGjg0GJ52wvm8YAcru ynfckPrqyqJBD6qlrIb9+tpPbJ1Epkzv5cbnfq4AE02XR7aqPLnRonN6BaeEjTEUfCFWbi SFqh2q+E3NVUXaa5b5aHWiLMonHMsUMYpA0pEgu7O9aJQtTtQqTGfowWqjDThYAKrAeGRK w3MwcE36e4SoyO/F2WdWvxbtP9YZQe0Y61PRvCSuqndDGTk8XsxmdLMMrOaHeUO3+Ldj/s tnamgII/HFN8kWjCNWr2O0cI9FL0N2Y797QZaDuzhAMl4tA3Q7M1wHLt4zErEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751605064; a=rsa-sha256; cv=none; b=auf/u/3czOyi7/XdI2ITcDDMx6CsHPDd6sukIDrqHDt9Em9Iw4b/gb9gaN3qiHhzHr1doI /S9fDcQMoTSSyGnDB1IcJEtjy6V8Mw+qw/j7Az31fVWspP9/PW9tM1n0Vug8BlwA1ADbU7 BVDIQqJdpDLSvN9R+xsWfv6IE00mv1TuUfxJ21p6CVBiloSZiOdRla9rS8W8n1NsUNVJXv VaT9VhvvpD8rVFd1vYNwVHFRpqFDRXd4QlKafDR3p7d2TAFl8xmrmUt/kRvz7HxOcnFuE0 pj5lLG0uJs0Tyi38ZkovtLfhiKrBQRGQBHhBTrmkZ8hSKgx4pCglv+GrehanOA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYLwm1sFZzc0y; Fri, 04 Jul 2025 04:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5644viXJ050242; Fri, 4 Jul 2025 04:57:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5644viHZ050239; Fri, 4 Jul 2025 04:57:44 GMT (envelope-from git) Date: Fri, 4 Jul 2025 04:57:44 GMT Message-Id: <202507040457.5644viHZ050239@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3a2e1feea91e - stable/14 - amd64 ddb 'show pte': print both pte VA in recursive map and pte content List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3a2e1feea91ea1c9f6ebb9a0450a7158f6871d57 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a2e1feea91ea1c9f6ebb9a0450a7158f6871d57 commit 3a2e1feea91ea1c9f6ebb9a0450a7158f6871d57 Author: Konstantin Belousov AuthorDate: 2025-06-27 04:06:39 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 04:57:03 +0000 amd64 ddb 'show pte': print both pte VA in recursive map and pte content (cherry picked from commit 289a7a790cf74c679123a543ae95ac1be7659fad) --- sys/amd64/amd64/pmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 97e59123df97..84cab304af6d 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -12138,7 +12138,7 @@ DB_SHOW_COMMAND(pte, pmap_print_pte) if (pmap_is_la57(pmap)) { pml5 = pmap_pml5e(pmap, va); - db_printf(" pml5e 0x%016lx", *pml5); + db_printf(" pml5e@0x%016lx 0x%016lx", (uint64_t)pml5, *pml5); if ((*pml5 & PG_V) == 0) { db_printf("\n"); return; @@ -12147,25 +12147,25 @@ DB_SHOW_COMMAND(pte, pmap_print_pte) } else { pml4 = pmap_pml4e(pmap, va); } - db_printf(" pml4e 0x%016lx", *pml4); + db_printf(" pml4e@0x%016lx 0x%016lx", (uint64_t)pml4, *pml4); if ((*pml4 & PG_V) == 0) { db_printf("\n"); return; } pdp = pmap_pml4e_to_pdpe(pml4, va); - db_printf(" pdpe 0x%016lx", *pdp); + db_printf(" pdpe@0x%016lx 0x%016lx", (uint64_t)pdp, *pdp); if ((*pdp & PG_V) == 0 || (*pdp & PG_PS) != 0) { db_printf("\n"); return; } pde = pmap_pdpe_to_pde(pdp, va); - db_printf(" pde 0x%016lx", *pde); + db_printf(" pde@0x%016lx 0x%016lx", (uint64_t)pde, *pde); if ((*pde & PG_V) == 0 || (*pde & PG_PS) != 0) { db_printf("\n"); return; } pte = pmap_pde_to_pte(pde, va); - db_printf(" pte 0x%016lx\n", *pte); + db_printf(" pte@0x%016lx 0x%016lx\n", (uint64_t)pte, *pte); } DB_SHOW_COMMAND(phys2dmap, pmap_phys2dmap) From nobody Fri Jul 4 05:15:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYMK65kjWz60lLY; Fri, 04 Jul 2025 05:15: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYMK64f5dz41Xd; Fri, 04 Jul 2025 05:15:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751606122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l489w2A4JqTJIrhff6LHpbO35PHPilUia+Aev0dypfU=; b=GzFo7aYZs4t+xxg9hjn9odKU/3VJwdKc0CLj6iQEvVyiUmdnHNZ5UwQI8zgKQ6NpPtxe/R BsW1uZdn9wQgH0qUEq9e+rm0Ekh6gbO49RZSPAELwhvpkDtqzXj9WTEMdd5kNT53GNWmux rTWO6VAd47graRVKkhkLFTcU6x5SfQuAwh2B2ol4aE6PeMtLyVg71RY8Bwg1ZM7Ac2HRlK SD5ZBg+j8KOTpceNJKLCwhreg60a/yaSnbwMQiTfz2MYwwg7UnNcXVWDe7awqtutTDNWE0 HCS+sy3NDol/dUEH/AJRmALhBzox4/688r53Isn4VJ2Gh2XlkaNQ5vQsj8YBOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751606122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l489w2A4JqTJIrhff6LHpbO35PHPilUia+Aev0dypfU=; b=IgZ+3m8YbnGBFqI1A+Evf/gZ7axejaj8eIEYrUdU78Hep8vxS7uE7HGbnj640pw2DL/Wsp jAFVv0IJrr3DbdmAFX3NWxJZq69bLIvWF5k1Y7LaJchecBBXk9DUyvIRt7P4FO3c5ocB3o XLJDaFPMJhsTowqtFlWrC0RiNe6FPwhkNZRNr3MwjtcE2JduI6r1R+unRmr/pBl4pElokS DGVFqgOBG0Xny2Hk4vNXjf7J7LjDHvr9nR4Np6uXewcJ3RUkqOkSrSwW1AYxCxC6yvIZ6+ FQHyaW5GfRGayh3ZlSAA21uiJX/b/T76CQ45bWEoQT4A/rwUF3ECP+AVHkJhsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751606122; a=rsa-sha256; cv=none; b=R2tNLMT0f+oEwAVAbJuR7bL8ciogwnzt+85/PUWiCpk+lvp/HmXSLJ6quF1BEsPjvUTbLp /fWp1awOZiCK78mhdX5uT2fZFRyuETJXt77jy3IS4JaJFP/bfjrppQKcYKFUVFm6Rwe60e XLeHj71RZH+1nZgE450aHsvxleDEMAimu9qvZPpiIRcMJyNztlJCqH0IEMCTLh/2ENqKTH UDuGEzaYMW/4YeACDzVObkZGnCIDiWgsE9xcVBLU23CxXO3EnqjwBpmrb1U6fACkJJaLGd bd40sQRDSJxpBKy6HmcxppnHM+o6LJrAg9+WdMrjtFiTgtO83905C5xgIxn2Yg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYMK64DnWzcsV; Fri, 04 Jul 2025 05:15:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5645FMQ4087667; Fri, 4 Jul 2025 05:15:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5645FMm5087665; Fri, 4 Jul 2025 05:15:22 GMT (envelope-from git) Date: Fri, 4 Jul 2025 05:15:22 GMT Message-Id: <202507040515.5645FMm5087665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: bd173a540c0e - main - write.2: Add EINVAL to ERRORS List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd173a540c0ead4881b0866b721955440e3b96fe Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=bd173a540c0ead4881b0866b721955440e3b96fe commit bd173a540c0ead4881b0866b721955440e3b96fe Author: Felix Johnson AuthorDate: 2025-07-03 20:27:22 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 05:14:19 +0000 write.2: Add EINVAL to ERRORS Since phk rewrote the block layer ~2 decades ago, write(2) can return EINVAL when the target is a block device and nbytes, the write size, is not a multiple of the sector's block size. From the original PR: When coming from Linux, people are surprised by the fact that write(2) to a device must be aligned to block size. Writing a non-aligned block onto a raw device is a case where EINVAL is also returned but the manpage does not mention this. MFC after: 3 days PR: 227185 Reported by: riggs Reviewed by: imp, Pau Amma Differential Revision: https://reviews.freebsd.org/D51138 --- lib/libsys/write.2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libsys/write.2 b/lib/libsys/write.2 index 7ff1c42715d6..d2ff41ceead9 100644 --- a/lib/libsys/write.2 +++ b/lib/libsys/write.2 @@ -195,6 +195,9 @@ is greater than if the sysctl .Va debug.iosize_max_clamp is non-zero). +.It Bq Er EINVAL +The file descriptor refers to a raw device, and the write +offset or size is not a multiple of the device's block size. .It Bq Er EINTEGRITY The backing store for .Fa fd From nobody Fri Jul 4 05:23:23 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYMVM5G81z60m8d; Fri, 04 Jul 2025 05:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYMVM3ymYz44WF; Fri, 04 Jul 2025 05:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751606603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=erfyjCVNern5+BeY7Ek23q7/TtUqkjHAyEFO8n++DWo=; b=lJtR1eAR9EfmCZiXcJBpTGdqYY3ytBh115d/KIL+XENllIJ0F3j59JXYM4cvTbRqSg050F HvSUvPDJS8zkrDm0zaMlPgcBvDX+NAx7haxDaE33uzxT62I7BBmRxR6h9DCyulXzvoMYyw 240tPRKc4LhTKZbLP80KxWGgqOriiu1Z/3FwW74BO/JGl7B3BOu4E8ZpKnLeOFk1g0WRuU FLpuKHHxYjbfQ+aLMzOHvh58ueoysyUwFHdhZ27ormi94unegEvoWtuBrtQtUrHWlSCMQv EAg1m+jpY4QjyWy5jiSX1kWFqsDOycpslJLqYyIwsAzGCe3QZuDfkIWbj3dgVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751606603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=erfyjCVNern5+BeY7Ek23q7/TtUqkjHAyEFO8n++DWo=; b=epid3nIaS06wXatc4UOlP0Rot6+hGRAtD5/51ulzm+1gsyLiIYnOxEXZqkX5aigXEmozNI 8aKHOl7D62o97ubwon/ECjOYkyZSZj764IRjX6mciK12LXJijaGqztytgKo9NkrixD8Dyx 5dwYBcI1qPkPhOGf8Vum2g/HwkgIZmuLngQ4+6QGDubw1QgXjE54/jwBf2BxyFDJDY2bn/ 6TBDhKfuRXWZSLpjpGc/K8EgMG9Vye8EANzviIBpVQfjLMjUyBkj/ND64xvWwhjVOE7qv1 wAFwoF/IbPUo93mGRiNT4eFo292LyypUPGH+xSrrBChBdLBumkOe7UsrjulO3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751606603; a=rsa-sha256; cv=none; b=bpzAKxRvqGUrdPQlcjx7QNUrMyowsBXBPL9zk7fi9DowBFSDIuqgnLbdB2WBWNyw1Nziyu om3ZTXGkCzXV5jF+Vpqb0jFtO53zGtQX4+fnz47Wmb13epIwUs4khzuTBCa5IXV0/CiB3o l9kiIVXO3YQEi0O7LV/SCKAmp497ZejTybdmMKO0ZNibXwcfoCkb+TfuOYVayCmUK/yNpO PjyIcabVzOX5ei8lHinZhhTbk/FtKIbFt6NeVJMBspPn9cmr7Wt6nAyNxyP1sHi8xnYuHF 8t4VNhUzt6ONICsIIHWQnP6gP5rlxy2qMbblAgzLHgQN/c3BEw2DKRRXL85TzQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYMVM3HmkzdMc; Fri, 04 Jul 2025 05:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5645NNpd005829; Fri, 4 Jul 2025 05:23:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5645NNUC005826; Fri, 4 Jul 2025 05:23:23 GMT (envelope-from git) Date: Fri, 4 Jul 2025 05:23:23 GMT Message-Id: <202507040523.5645NNUC005826@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 8c97c46418f9 - main - rtw89: enable ACPI support on FreeBSD List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c97c46418f9767a9984df259116da08d9659076 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8c97c46418f9767a9984df259116da08d9659076 commit 8c97c46418f9767a9984df259116da08d9659076 Author: Bjoern A. Zeeb AuthorDate: 2025-06-15 10:44:55 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-04 05:22:22 +0000 rtw89: enable ACPI support on FreeBSD Now that LinuxKPI supports the lower case Linux ACPI spellings under LINUXKPI_WANT_LINUX_ACPI remove the #ifdef around the code and compile in ACPI support. Sponsored by: The FreeBSD Foundation MFC after; 3 days --- sys/contrib/dev/rtw89/acpi.c | 26 -------------------------- sys/modules/rtw89/Makefile | 1 + 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/sys/contrib/dev/rtw89/acpi.c b/sys/contrib/dev/rtw89/acpi.c index 02d4526c1538..f5dedb12c129 100644 --- a/sys/contrib/dev/rtw89/acpi.c +++ b/sys/contrib/dev/rtw89/acpi.c @@ -8,7 +8,6 @@ #include "acpi.h" #include "debug.h" -#if defined(__linux__) static const guid_t rtw89_guid = GUID_INIT(0xD2A8C3E8, 0x4B69, 0x4F00, 0x82, 0xBD, 0xFE, 0x86, 0x07, 0x80, 0x3A, 0xA7); @@ -149,14 +148,6 @@ int rtw89_acpi_evaluate_dsm(struct rtw89_dev *rtwdev, ACPI_FREE(obj); return ret; } -#elif defined(__FreeBSD__) -int rtw89_acpi_evaluate_dsm(struct rtw89_dev *rtwdev, - enum rtw89_acpi_dsm_func func, - struct rtw89_acpi_dsm_result *res) -{ - return -ENOENT; -} -#endif int rtw89_acpi_evaluate_rtag(struct rtw89_dev *rtwdev, struct rtw89_acpi_rtag_result *res) @@ -180,28 +171,15 @@ int rtw89_acpi_evaluate_rtag(struct rtw89_dev *rtwdev, if (ACPI_FAILURE(status)) return -EIO; -#if defined(__linux__) obj = buf.pointer; if (obj->type != ACPI_TYPE_BUFFER) { -#elif defined(__FreeBSD__) - obj = buf.Pointer; - if (obj->Type != ACPI_TYPE_BUFFER) { -#endif rtw89_debug(rtwdev, RTW89_DBG_ACPI, -#if defined(__linux__) "acpi: expect buffer but type: %d\n", obj->type); -#elif defined(__FreeBSD__) - "acpi: expect buffer but type: %d\n", obj->Type); -#endif ret = -EINVAL; goto out; } -#if defined(__linux__) buf_len = obj->buffer.length; -#elif defined(__FreeBSD__) - buf_len = obj->Buffer.Length; -#endif if (buf_len != sizeof(*res)) { rtw89_debug(rtwdev, RTW89_DBG_ACPI, "%s: invalid buffer length: %u\n", __func__, buf_len); @@ -209,11 +187,7 @@ int rtw89_acpi_evaluate_rtag(struct rtw89_dev *rtwdev, goto out; } -#if defined(__linux__) *res = *(struct rtw89_acpi_rtag_result *)obj->buffer.pointer; -#elif defined(__FreeBSD__) - *res = *(struct rtw89_acpi_rtag_result *)obj->Buffer.Pointer; -#endif rtw89_hex_dump(rtwdev, RTW89_DBG_ACPI, "antenna_gain: ", res, sizeof(*res)); diff --git a/sys/modules/rtw89/Makefile b/sys/modules/rtw89/Makefile index 73945591826c..09580f288c62 100644 --- a/sys/modules/rtw89/Makefile +++ b/sys/modules/rtw89/Makefile @@ -39,6 +39,7 @@ SRCS+= ${LINUXKPI_GENSRCS} SRCS+= opt_wlan.h opt_inet6.h opt_inet.h opt_acpi.h CFLAGS+= -DKBUILD_MODNAME='"rtw89"' +CFLAGS+= -DLINUXKPI_WANT_LINUX_ACPI CFLAGS+= -I${DEVRTW89DIR} CFLAGS+= ${LINUXKPI_INCLUDES} From nobody Fri Jul 4 05:23:24 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYMVN5w0yz60m6J; Fri, 04 Jul 2025 05:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYMVN4kh9z44QY; Fri, 04 Jul 2025 05:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751606604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZQJMRTXnm4nvCO7/0Gdly3LZtI/oWfjhaxKbCAGlrjc=; b=Xnm3uUhp26YK6djpljmhihqrhAhPzgSFRaVB+cEvgkS8e9F8mmcFk+HvJW79R2Xjmrlv/M 5BQS4KPNemD5HYu/+Ngfd2tCiA5cA4mnoRNyvAbIOkcgG500Avw4Ko7IST/hrn6ooFG4n7 DHzZgJBUTMdpu2/KCk9Da2XznVNV0lkWGvcp9YGfIu3rU0w0bhC4hr4e8iRFpTzgpjkrR4 1lI6Ll++R3vFfz2xiMc+5xpja1bMXtokLiZdRivfHHRG7JY+CwVCh90XbeJRGPTPiwuwyK F+e1F6WJE/XtH13wWvyYx1xJpuYpuIyKFdJBJcvCJ78ufXJuYazoXXiYF5Hlsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751606604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZQJMRTXnm4nvCO7/0Gdly3LZtI/oWfjhaxKbCAGlrjc=; b=HIvj/DSm3Ya6579KD4DUWSv+njZ8JVyu4+gF4Y/B9JM/OKWDqK7QcxL1frR4BNjQAgs+0A aoAN7FcQUc4WFMrDeVZIp1nnofsQTBw2NjUk46OXiDUvUIOahphETs0vG/mWlH+ZCnwOFM PMzguxvsqStVKYY0kTotN0lt2vXf4DqVXtJoWJxnfWj+R3u/lFUYIGY1FcqZK8QPoa/HJM I5V4NHkqXVJ9OaKEaQnlc03u90cj8G8mhazS+3EdoAOy3nM4kJl2oxqCy9jnGaLca1Svl4 /90vJY2lqN4S23jhqoC+oNoFPX93jdMN3fpLdG0kJYxVHRYhEHnKoKqyYxPYcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751606604; a=rsa-sha256; cv=none; b=h2/NiM8oDRPbvg4I9wujYYSF1johhlEV+re7hx/qwDrKM9r5Hk0i4+VapX0S1DA2A3wPkr T3t+6rRBuSqC70RlAdxqWFqmEvHQBXo8k5QCCNgqoEtnY2PrcTqDKYVnR0GRGxMuQnL89Y iDnplAWFF8OIGZGQjQ/bAh6LOR7BNt0A8ffJoqc/GNV2OitUfF9uNyOpLV4ZUz5PJfXPJt OafzDhSbTw9iItM8eRePwBuLcWzfFEThjmRM9bKjmIb2rRxxhDjR6Ypmj3wWa/qbL3Q3Oc JCAYwWz4L5+VuLA5LFsPqFZPIhEt4ba8euGHzIhZ36bg4eXkykGPmK9Hhi+SNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYMVN3yLxzcr2; Fri, 04 Jul 2025 05:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5645NOnt005865; Fri, 4 Jul 2025 05:23:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5645NOsU005862; Fri, 4 Jul 2025 05:23:24 GMT (envelope-from git) Date: Fri, 4 Jul 2025 05:23:24 GMT Message-Id: <202507040523.5645NOsU005862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 228b43c258d2 - main - iwlwifi: compile in ACPI support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 228b43c258d24c293b135ae94c120e7ccf0a7aea Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=228b43c258d24c293b135ae94c120e7ccf0a7aea commit 228b43c258d24c293b135ae94c120e7ccf0a7aea Author: Bjoern A. Zeeb AuthorDate: 2025-06-15 10:46:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-07-04 05:22:22 +0000 iwlwifi: compile in ACPI support Now that LinuxKPI supports the lower case Linux ACPI spellings under LINUXKPI_WANT_LINUX_ACPI we only need to provide the debug macro to allow us to compile in ACPI support. This ties into regulatory and will be used, e.g., for 11ax, 11be, and Per Platform Antenna Gain (PPAG) settings. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/contrib/dev/iwlwifi/iwl-debug.h | 4 +++- sys/modules/iwlwifi/Makefile | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/contrib/dev/iwlwifi/iwl-debug.h b/sys/contrib/dev/iwlwifi/iwl-debug.h index 43288a5a8d74..7b3b402766b4 100644 --- a/sys/contrib/dev/iwlwifi/iwl-debug.h +++ b/sys/contrib/dev/iwlwifi/iwl-debug.h @@ -47,7 +47,7 @@ enum iwl_dl { IWL_DL_DROP = 0x00000010, IWL_DL_EEPROM = 0x00000020, IWL_DL_FW = 0x00000040, - /* = 0x00000080, */ + IWL_DL_DEV_RADIO = 0x00000080, IWL_DL_HC = 0x00000100, IWL_DL_HT = 0x00000200, IWL_DL_INFO = 0x00000400, @@ -195,6 +195,8 @@ void __iwl_dbg(struct device *, u32, bool, const char *, const char *fmt, ...); IWL_DPRINTF(_subsys, IWL_DL_WEP, _fmt, ##__VA_ARGS__) #define IWL_DEBUG_WOWLAN(_subsys, _fmt, ...) \ IWL_DPRINTF(_subsys, IWL_DL_WOWLAN, _fmt, ##__VA_ARGS__) +#define IWL_DEBUG_DEV_RADIO(_dev, _fmt, ...) \ + IWL_DPRINTF_DEV((_dev), IWL_DL_DEV_RADIO, _fmt, ##__VA_ARGS__) #define IWL_DEBUG_PCI_RW(_subsys, _fmt, ...) \ IWL_DPRINTF(_subsys, IWL_DL_PCI_RW, _fmt, ##__VA_ARGS__) diff --git a/sys/modules/iwlwifi/Makefile b/sys/modules/iwlwifi/Makefile index 6e0fea6efc3a..9774c3da61ee 100644 --- a/sys/modules/iwlwifi/Makefile +++ b/sys/modules/iwlwifi/Makefile @@ -4,6 +4,7 @@ DEVIWLWIFIDIR= ${SRCTOP}/sys/contrib/dev/iwlwifi WITH_CONFIG_PM= 0 WITH_DEBUGFS= 1 +WITH_CONFIG_ACPI= 1 KMOD= if_iwlwifi @@ -40,6 +41,12 @@ CFLAGS+= -DCONFIG_PM CFLAGS+= -DCONFIG_PM_SLEEP .endif +.if defined(WITH_CONFIG_ACPI) && ${WITH_CONFIG_ACPI} > 0 +SRCS+= fw/acpi.c +CFLAGS+= -DCONFIG_ACPI +CFLAGS+= -DLINUXKPI_WANT_LINUX_ACPI +.endif + SRCS+= iwl-devtrace.c # Other @@ -56,7 +63,6 @@ CFLAGS+= -DCONFIG_IWLMVM=1 # Helpful after fresh imports. #CFLAGS+= -ferror-limit=0 -#CFLAGS+= -DCONFIG_ACPI=1 #CFLAGS+= -DCONFIG_INET=1 # Need LKPI TSO implementation. #CFLAGS+= -DCONFIG_IPV6=1 CFLAGS+= -DCONFIG_IWLWIFI_DEBUG=1 From nobody Fri Jul 4 06:20:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYNmh2zfzz60t7V; Fri, 04 Jul 2025 06:20:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) 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 4bYNmg1MVjz3SpN; Fri, 04 Jul 2025 06:20:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) 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 5646Kb9Y042754; Fri, 4 Jul 2025 09:20:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 5646Kb9Y042754 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 5646KaoH042753; Fri, 4 Jul 2025 09:20:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 4 Jul 2025 09:20:36 +0300 From: Konstantin Belousov To: Ruslan Bukin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 906d7a4b521c - main - hwt: fix !SMP build. Message-ID: References: <202507032049.563KnGxr033283@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202507032049.563KnGxr033283@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4bYNmg1MVjz3SpN X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Thu, Jul 03, 2025 at 08:49:16PM +0000, Ruslan Bukin wrote: > The branch main has been updated by br: > > URL: https://cgit.FreeBSD.org/src/commit/?id=906d7a4b521c19b2b1ae3ec844b5d4626f2fd529 > > commit 906d7a4b521c19b2b1ae3ec844b5d4626f2fd529 > Author: Ruslan Bukin > AuthorDate: 2025-07-03 20:43:01 +0000 > Commit: Ruslan Bukin > CommitDate: 2025-07-03 20:43:01 +0000 > > hwt: fix !SMP build. > > Sponsored by: UKRI > --- > sys/dev/hwt/hwt_ioctl.c | 2 ++ > sys/dev/hwt/hwt_vm.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/sys/dev/hwt/hwt_ioctl.c b/sys/dev/hwt/hwt_ioctl.c > index 04133838d292..592db4931bb4 100644 > --- a/sys/dev/hwt/hwt_ioctl.c > +++ b/sys/dev/hwt/hwt_ioctl.c > @@ -305,9 +305,11 @@ hwt_ioctl_alloc_mode_cpu(struct thread *td, struct hwt_owner *ho, > return (error); > > CPU_FOREACH_ISSET(cpu_id, &cpu_map) { > +#ifdef SMP > /* Ensure CPU is not halted. */ > if (CPU_ISSET(cpu_id, &hlt_cpus_mask)) > return (ENXIO); > +#endif > #if 0 > /* TODO: Check if the owner have this cpu configured already. */ > ctx = hwt_owner_lookup_ctx_by_cpu(ho, halloc->cpu); > diff --git a/sys/dev/hwt/hwt_vm.c b/sys/dev/hwt/hwt_vm.c > index a6799c30300d..6c55e218dcec 100644 > --- a/sys/dev/hwt/hwt_vm.c > +++ b/sys/dev/hwt/hwt_vm.c > @@ -213,9 +213,11 @@ hwt_vm_start_cpu_mode(struct hwt_context *ctx) > CPU_ZERO(&enable_cpus); > > CPU_FOREACH_ISSET(cpu_id, &ctx->cpu_map) { > +#ifdef SMP > /* Ensure CPU is not halted. */ > if (CPU_ISSET(cpu_id, &hlt_cpus_mask)) > continue; > +#endif > > hwt_backend_configure(ctx, cpu_id, cpu_id); > This again raises a wonder: should we drop SMP option at all? From nobody Fri Jul 4 06:47:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYPMG4WZvz60xK1; Fri, 04 Jul 2025 06:47: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYPMG2m8Sz3fWw; Fri, 04 Jul 2025 06:47:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751611642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rBKH4L22H0V/UjkN9aUlWzOFvlD8DmhRXRdkraftu0I=; b=bfobooYhJdONVe93DPSqhBqIFxKpZCAYgvFbgs5AZJuIFAGpuMxNr1iCIPtJyLKpE1LwjW +lOvPGmGQ9ZHsfaWI1vXpY+VQdEYs3CiaQbcZkL5pYm8wyChVhfbJZ3b7HH9atQ25CDisA apQBhOmX/1pzK+FokvIQgezzJFYRFjE5YotsyxHciZu1IUwTAKZ01fe6KAbSKavdUUBcLf ZTgZGLYZJxrgOk/pr8/ym3BqoBTOsr7fe2MvbEx2cN3Ep6Hu/DctNFtpw5+kAgB07JVgLz epoD9VSavJ4bdU9CczElO5py/pFg9ufSK9zRTv0HKKPzCbBi6keAuncGB+qj1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751611642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rBKH4L22H0V/UjkN9aUlWzOFvlD8DmhRXRdkraftu0I=; b=PvDaX4GYcmNqJO3tLpOL1TZfyxVd8ep13Z6F4h/2dXr2wA0zupK/Q44z/YECRBA0T4sYmt /Wd0d3i8uktUNthyzuVmKPQzCO25rwufG+nG4qA1jHL6bniqpESdMpPRnat503But2mv8U zgavLWpRP+ZBli0s1LK1HQrKBa1GKbxKqGiVwg9yEwH5JD7onzEYxJrgRy+fSkNcUcdPO1 NHXKrGFmK2gM5bMnm5J9K6rPNDij0czQb4jYR3g45LFlTk9IlscsqlKsQnbcPT90/qiMqI gG7PCZr2uEEvZopq/LEdHNPzPz0/HknGOPsOIC64wodixZUOYrik6o65fqgHDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751611642; a=rsa-sha256; cv=none; b=YkV9e3EbgQMyoytVoZta7tc5tFWYuYfPbVOPS7zo0cbWDHWwSjW4MxVLKRef4KK4iPPVwW we2kmw0J1mSn7gj/BqYH0GlavfEFFv1YmKzk1RCjXRHnt5pe7XVJVLNDA+gK1H3IER6q0I UW8oU7ZpEvoRbf2JNKdpNFPbZ01yhjEu4dTMDsHHHF4Otm+E8sh89NxPU9OsV36OmHkpGw zwItqgtx+ZtpEqc/0Z8CAELFN2mcj7bmc/FFrvXYaMGVHXeS0mQEmiEkoPhagH/cXo1xTC RTXtTDM0YuVkuwfWI+AmTxApA/uVxZCCgMBQeKiRqzuDThWE+Qjn+dWjWQYIdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYPMG2C8JzgDW; Fri, 04 Jul 2025 06:47:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5646lMhO055854; Fri, 4 Jul 2025 06:47:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5646lMbN055851; Fri, 4 Jul 2025 06:47:22 GMT (envelope-from git) Date: Fri, 4 Jul 2025 06:47:22 GMT Message-Id: <202507040647.5646lMbN055851@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tom Jones Subject: git: d72c74a6c52c - main - loader: Add halt as an alias to poweroff machine List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d72c74a6c52cd382c5aaf8f28b5f94e102140a6d Auto-Submitted: auto-generated The branch main has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=d72c74a6c52cd382c5aaf8f28b5f94e102140a6d commit d72c74a6c52cd382c5aaf8f28b5f94e102140a6d Author: Tom Jones AuthorDate: 2025-07-04 06:37:19 +0000 Commit: Tom Jones CommitDate: 2025-07-04 06:37:31 +0000 loader: Add halt as an alias to poweroff machine Add halt as an alias to also poweroff a machine from the loader prompt, this is consistent with ddb. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51132 --- stand/efi/loader/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 70cdfb2e9328..3ef418d20df3 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -1547,6 +1547,7 @@ command_seed_entropy(int argc, char *argv[]) } COMMAND_SET(poweroff, "poweroff", "power off the system", command_poweroff); +COMMAND_SET(halt, "halt", "power off the system", command_poweroff); static int command_poweroff(int argc __unused, char *argv[] __unused) From nobody Fri Jul 4 06:50:02 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYPQd1wh0z60xZH; Fri, 04 Jul 2025 06:50:17 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) 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 "E5" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYPQc5hwLz3gcd; Fri, 04 Jul 2025 06:50:16 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Authentication-Results: mx1.freebsd.org; none 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 CF479A64805; Fri, 04 Jul 2025 06:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zabbadoz.net; s=20240622; t=1751611800; bh=imX0AWt2/Bb8VZJvMKLZGSJcWvRo6pYclVK55g+j3dQ=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=l4hMt9kiZQkG42ZY5AMP4M7ej1mqoWvSqSCakbNWNTWQ4jsCI38gnmQd2YbE2nnfX twy58AOmLZRFiJ/jcughGwt8NEjOvOizldTtHrAzTHOC3ciYxGXaxAypzI/xANlxAG iK3OKt2FEUWnthPbFwcAWY4SIzmKtMI9bZPUjRQG3n3Gd+G3KPmokdNPmeP1aBXtYE LwPQ9pSPsjsaHyf9YhaPNT9UW7gH6E0clRaOi/ryCyiQLdL4EbtXpl47+Tnru9HWBl CH3nmySh1sE/uHM+GdYrZxDjouLY220LaKnrVG3LVbkrmYaeRy7zJ55StLcfYf6n1l ukOYE9OPYZgtZ4h2AcQpKFTPMP4THCsk3UvGYUXUI/6KwJ1MpJXRVYOyKBdCya60nE OUE5y8dFhQSbBKYj2ES1crD0cjBffxtzP3iSfLOi+4oyPIrxvAMpuCwglrhMBv6I9O 9Auu5t/KfGyKB+WJyC/ucPaIkKZ8AeGHqumaT3r+1m+lqEd6Cw90U4/a2uO/h/KvGd eHPodxpE3VSfQbY6cwogkzVo7hHP7ro8CcFt4/aU8mywz0iU+pP27Jr7dazxmfmdaa uSGQyof1VZCd4VSbBkVQ/+a064ppQTQU6nidd8/G56rDGVQLwC6LNMq93pieiu1AJj X/pPvLPYo+WUF+Xd5Qz+VpOs= 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 B144D2D029E0; Fri, 4 Jul 2025 06:50:03 +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 Jfe3RINrZcea; Fri, 4 Jul 2025 06:50:02 +0000 (UTC) Received: from strong-rtwn0.sbone.de (strong-rtwn0.sbone.de [IPv6:fde9:577b:c1a9:4902:3e64:cfff:fe55:bc80]) (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 90C102D029D8; Fri, 4 Jul 2025 06:50:02 +0000 (UTC) Date: Fri, 4 Jul 2025 06:50:02 +0000 (UTC) From: "Bjoern A. Zeeb" To: Tom Jones cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: d72c74a6c52c - main - loader: Add halt as an alias to poweroff machine In-Reply-To: <202507040647.5646lMbN055851@gitrepo.freebsd.org> Message-ID: <33914q1n-2s92-q345-7r4r-r276ooo9r7s5@yvfgf.mnoonqbm.arg> References: <202507040647.5646lMbN055851@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4bYPQc5hwLz3gcd X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:3320, ipnet:2003::/19, country:DE] On Fri, 4 Jul 2025, Tom Jones wrote: > The branch main has been updated by thj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d72c74a6c52cd382c5aaf8f28b5f94e102140a6d > > commit d72c74a6c52cd382c5aaf8f28b5f94e102140a6d > Author: Tom Jones > AuthorDate: 2025-07-04 06:37:19 +0000 > Commit: Tom Jones > CommitDate: 2025-07-04 06:37:31 +0000 > > loader: Add halt as an alias to poweroff machine > > Add halt as an alias to also poweroff a machine from the loader prompt, > this is consistent with ddb. Would it make sense to add an alias 'reset' for 'reboot' as well? I think ddb is the only one using reset, everything else uses reboot (kind-of makes sense but still is confusing). > Reviewed by: imp > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D51132 > --- > stand/efi/loader/main.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c > index 70cdfb2e9328..3ef418d20df3 100644 > --- a/stand/efi/loader/main.c > +++ b/stand/efi/loader/main.c > @@ -1547,6 +1547,7 @@ command_seed_entropy(int argc, char *argv[]) > } > > COMMAND_SET(poweroff, "poweroff", "power off the system", command_poweroff); > +COMMAND_SET(halt, "halt", "power off the system", command_poweroff); > > static int > command_poweroff(int argc __unused, char *argv[] __unused) > -- Bjoern A. Zeeb r15:7 From nobody Fri Jul 4 06:56:31 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYPZZ6l7jz60yRc; Fri, 04 Jul 2025 06:57:10 +0000 (UTC) (envelope-from thj@freebsd.org) Received: from fhigh-a4-smtp.messagingengine.com (fhigh-a4-smtp.messagingengine.com [103.168.172.155]) (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 4bYPZZ4hs3z3kJK; Fri, 04 Jul 2025 06:57:10 +0000 (UTC) (envelope-from thj@freebsd.org) Authentication-Results: mx1.freebsd.org; none Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 726821400389; Fri, 4 Jul 2025 02:57:09 -0400 (EDT) Received: from phl-imap-17 ([10.202.2.105]) by phl-compute-03.internal (MEProxy); Fri, 04 Jul 2025 02:57:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1751612229; x= 1751698629; bh=pQZHrxeYoqDEZ/ElzZHJXbffh4mg6YS5NH6O17MQx9A=; b=X xFeZDZs2ckM3usyLebfccXJ1jsGIUQ75IClyjrqdUGNyVBHj9tIsQbUDfRiXh4xV 0gQU7pmxrq/DMn+tK7K0uajYVa7CNbqftXiQ/pUuuJyZXExgo+1gSwXZd0bDXSge 27NPToHJZanW1JPzr2jKRcAjWXWhllWDRFkn9ZsAaI6ZqRLXPfBdBnwWpEWqdL/z son98dMk5AvcfQe0v6Bd9xKqqJ3CXIDfYa/bUWIUOYMuY5o5ebrn1pDRGg+NGFU7 KGOpvSc8PG1B7dl5geicGlhdy1za2bbCwQEaoQSG3+RIu66eH/TqcTXnYua10WWT ctsUmIVYzeGXgVmhdIKLA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddvvdeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhepofggfffhvfevkfgjfhfutgfgsehtjeertd ertddtnecuhfhrohhmpedfvfhomhculfhonhgvshdfuceothhhjhesfhhrvggvsghsugdr ohhrgheqnecuggftrfgrthhtvghrnhepieekkeeiveevuefhledvvdehheetjeekheehtd efffefvdeglefhvdehjeevtedtnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhjhesfh hrvggvsghsugdrohhrghdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhht pdhrtghpthhtohepuggvvhdqtghomhhmihhtshdqshhrtgdqrghllhesfhhrvggvsghsug drohhrghdprhgtphhtthhopeguvghvqdgtohhmmhhithhsqdhsrhgtqdhmrghinhesfhhr vggvsghsugdrohhrghdprhgtphhtthhopehsrhgtqdgtohhmmhhithhtvghrshesfhhrvg gvsghsugdrohhrghdprhgtphhtthhopegsiigvvggsqdhlihhsthhssehlihhsthhsrdii rggssggrughoiidrnhgvth X-ME-Proxy: Feedback-ID: ib75146ab:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 34B14C4006B; Fri, 4 Jul 2025 02:57:09 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 X-ThreadId: T471ff1bf70afeff8 Date: Fri, 04 Jul 2025 07:56:31 +0100 From: "Tom Jones" To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-Id: <0b50729a-eada-415a-9721-11d77365c4ee@app.fastmail.com> In-Reply-To: <33914q1n-2s92-q345-7r4r-r276ooo9r7s5@yvfgf.mnoonqbm.arg> References: <202507040647.5646lMbN055851@gitrepo.freebsd.org> <33914q1n-2s92-q345-7r4r-r276ooo9r7s5@yvfgf.mnoonqbm.arg> Subject: Re: git: d72c74a6c52c - main - loader: Add halt as an alias to poweroff machine Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4bYPZZ4hs3z3kJK X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:151847, ipnet:103.168.172.0/24, country:AU] On Fri, Jul 4, 2025, at 07:50, Bjoern A. Zeeb wrote: > On Fri, 4 Jul 2025, Tom Jones wrote: > >> The branch main has been updated by thj: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=d72c74a6c52cd382c5aaf8f28b5f94e102140a6d >> >> commit d72c74a6c52cd382c5aaf8f28b5f94e102140a6d >> Author: Tom Jones >> AuthorDate: 2025-07-04 06:37:19 +0000 >> Commit: Tom Jones >> CommitDate: 2025-07-04 06:37:31 +0000 >> >> loader: Add halt as an alias to poweroff machine >> >> Add halt as an alias to also poweroff a machine from the loader prompt, >> this is consistent with ddb. > > Would it make sense to add an alias 'reset' for 'reboot' as well? > > I think ddb is the only one using reset, everything else uses reboot > (kind-of makes sense but still is confusing). > I'd be more temped to add reboot to ddb than reset to loader. I think every time I get unknown command from ddb trying to reboot I just halt the machine - I'm not sure I knew there was a reset command. I'm happy to make the command sets for these tools more consistent its very jarring for these commands to not work. - Tom From nobody Fri Jul 4 07:32:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYQLp3CVjz612lv; Fri, 04 Jul 2025 07:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYQLn6W7mz41TP; Fri, 04 Jul 2025 07:32:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751614321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MDdrDwW2hxvO7P31YKW98TBYJgLUkfwDBsMBZc7ZC1A=; b=ft9Pc+nkPMVdAgCdlmShpt7aVaoFtpJjh8HJEBFgjeXguYa6ZzdXVK5gTcYUnd1mu9pS0t ShVrmmqJGlYPuyGzFLATJgbjVxcUQvYPyaWMmrq/mJJe8WU+2gekR5endk9K8Ig0fJuQLd /Yn4M4UXoSQvhqzI3+FWqEY/V0T5O81aHL/f25qYJssruUwLq4oMGTthjp2xZkhTi+KPJd wyK7NsSTCzWWKTojrysztlWFnhc9UwHQfhhPlxJAq9RpsUS2g+Nqyq8WfRnBS2b4HkFLFV XnZJbGGxfL2rR9lPvc9NSbqoSHQXzhim0YY/dZXbuB/c4795z7R+i82jvZaN0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751614321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MDdrDwW2hxvO7P31YKW98TBYJgLUkfwDBsMBZc7ZC1A=; b=QtXyqIQOGFb/8Bo+KLeZPG/pErfuWhwXXZ7sQV3kB28luGffvntb9ETHtgP0qgDEkpmAj9 VWkJKUtUn5t5euaBIvSvQ68lSDG1NgUMDu+K4nZs+o6hhEAG/n49RYNqUSyt4B1OLPizdi iyuzCpiBzeU/jWcbi0lRrH5NafHIWqoVNnVUa2j/norXCZ/zIiLhjfqpREBkvhaxkpkf5j FBSd2kcSyPK3cJl8ZojilYA0pHDWz9B0i+UXyCDuGjFmTP9CzAkBQyrL94Ugg3aPU79tTP kVkaofrsjY5r79BnBidQAsQYl4hGxjayFRlRUQBlSBFqMYWJcBL/l486lxI7rQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751614321; a=rsa-sha256; cv=none; b=s15VS7j21zkMcxBlxAmucEzJiBRlLeOTtTaNINkvp0/utSbcVI3MhDv/xM9aG4RbKEx3lp zVo28OmjAwu74qljr97k3cvgMamLIJrqIB7WdarNIZjiiyGqpS+IV6x5iDYrmuvxOecPqU SdtgyHEhOKlGZLom7rFuF4lqMNQWn/2B5Kfa+bnVJMn0Fb8RQ+dr3l+NWb0v2dUd68fDoP m055yaqW2fKLu5A/ebZ/7kuYTJse0PmrjOCnPtGIRLtO+XcT2bPG9cWwlGA7unUM2ltpHF HW2slYi5i7GXtFfzq4yBPLas3J9Z0LkhJ2t4J6Txlr54kK7m5/V/tHJax4nQIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYQLn64fczhhR; Fri, 04 Jul 2025 07:32:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5647W1M6044443; Fri, 4 Jul 2025 07:32:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5647W1Ph044440; Fri, 4 Jul 2025 07:32:01 GMT (envelope-from git) Date: Fri, 4 Jul 2025 07:32:01 GMT Message-Id: <202507040732.5647W1Ph044440@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Popov Subject: git: d4c8fd3a2c83 - main - fuse_vnop_allocate: Drop duplicated vfs_isrdonly() check List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4c8fd3a2c83b213ca3a4ae095d39569e9da4d0e Auto-Submitted: auto-generated The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=d4c8fd3a2c83b213ca3a4ae095d39569e9da4d0e commit d4c8fd3a2c83b213ca3a4ae095d39569e9da4d0e Author: Gleb Popov AuthorDate: 2025-06-17 10:00:28 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 07:14:21 +0000 fuse_vnop_allocate: Drop duplicated vfs_isrdonly() check Approved by: asomers Pull Request: https://github.com/freebsd/freebsd-src/pull/1727 --- sys/fs/fuse/fuse_vnops.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index c0ec5a94b8d3..f3a9d80208b7 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -610,8 +610,6 @@ fuse_vnop_allocate(struct vop_allocate_args *ap) return (ESPIPE); case VLNK: case VREG: - if (vfs_isrdonly(mp)) - return (EROFS); break; default: return (ENODEV); From nobody Fri Jul 4 07:32:02 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYQLq3ks5z6130P; Fri, 04 Jul 2025 07:32: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYQLq059Kz41Y9; Fri, 04 Jul 2025 07:32:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751614323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fTOYUFP9NSu2ziQvfQwAqc5ViVDINnAveVPmkWyVSDM=; b=dsxFMVf3Z2/MUr0Ac43QI44bljDTCLcxoWK62Ku1OeahBhjwenunubm8pAQ1Rf2CuR2awF uY2LU7pGcjC3gM/20NgiXHv+kltCKkXrQVmE83GYsaxwGkR5e2y9p6XViNf/9cxzs49quA 2eDeFeISadhcHDq0QdqHHm3+HHaDqM4nYJGsmKH+kL5y7TCxCYjQM2ma7uTIkpYiKi/Y// o93r7WsA5mr+2DMImI/3pV404LL1eUkp1fNXQfFo8vTiRBq4gK5oJxHlfXMip7ykMyM4RX 6mkME9XzWQXHbDMq995ZRMPw3uYZFcec86a7hoRafxodZQGleRWOi+gf11ScYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751614323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fTOYUFP9NSu2ziQvfQwAqc5ViVDINnAveVPmkWyVSDM=; b=hiBmovcWEGo6GD5nxoJrT1eWsGTN1peoUT//Di9UsMDctL8QOk6LJ7TYZW2xwa+La5DIyN tvsTFKqlceeUzGJ1aDGNxNsJUO/nkE+kLdJi59R3o/LjBCMTB097ce+M30J5/XIWioko42 Vy3Rc9oarqTJAKhglgYSWodOeszE1Kq7J/GFqgMKi/I204P0dykDeU0mfe/mNXb4Kf5MqM c00xkEjrs0wc5QmnKWZl6j6qkHr5EZeOd8WOWIYJOCQ4EYXPREPb/LAFfq1YF0WuG1MUEW VDx31IwW4mX+WVheKq0KBDewf3QqFXcZFOoiZb4m/KsQCROw1TxgAP54oF5y4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751614323; a=rsa-sha256; cv=none; b=tVtKpfu+VtiqTXViHHhYFwdtgEGgxTivpXLvIcXJABal4yhJCiqNROl6mTFe4X3zAVZVA8 TFJi1lmH8dq3wYcmhuUC+/RfiHFPxwJFSbi3P5fc1AYX7EmJf17AU6QLY8f8Kr1fz0wPlA /sAvMsQBqMuXViUedhub/We0iZ0D9LAfMnrpYvlvrq+Z6beQwMQg3v7HrcPmaEEQQKRWbX XBkGTcV+d6Ruej+lzdNTWPWdg2+kguRd3TJSpOYyAoCGeH2e312y2IYnH/GeyYZj50wmNc wr/X9rb9pVxt/mc0GuFeNyulVAfBYjIkSBaMJoLGn8o+DonBvVzvyfB0X7oyYw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYQLp6l5mzhfT; Fri, 04 Jul 2025 07:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5647W2rh044477; Fri, 4 Jul 2025 07:32:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5647W2hn044474; Fri, 4 Jul 2025 07:32:02 GMT (envelope-from git) Date: Fri, 4 Jul 2025 07:32:02 GMT Message-Id: <202507040732.5647W2hn044474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Popov Subject: git: c51660a62251 - main - fusefs: exterrorize fuse_vnops.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c51660a62251b37ecb7e9a5a7609097fd13d6385 Auto-Submitted: auto-generated The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=c51660a62251b37ecb7e9a5a7609097fd13d6385 commit c51660a62251b37ecb7e9a5a7609097fd13d6385 Author: Gleb Popov AuthorDate: 2025-06-17 10:11:14 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 07:14:21 +0000 fusefs: exterrorize fuse_vnops.c Approved by: asomers Pull Request: https://github.com/freebsd/freebsd-src/pull/1727 --- sys/fs/fuse/fuse_vnops.c | 197 +++++++++++++++++++++++++++++------------------ 1 file changed, 123 insertions(+), 74 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index f3a9d80208b7..ae28617537fd 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -89,6 +89,8 @@ #include #include #include +#define EXTERR_CATEGORY EXTERR_CAT_FUSE +#include #include #include @@ -439,7 +441,8 @@ fuse_vnop_access(struct vop_access_args *ap) if (vnode_isvroot(vp)) { return 0; } - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (!(data->dataflags & FSESS_INITED)) { if (vnode_isvroot(vp)) { @@ -448,7 +451,8 @@ fuse_vnop_access(struct vop_access_args *ap) return 0; } } - return EBADF; + return (EXTERROR(EBADF, "Access denied until FUSE session " + "is initialized")); } if (vnode_islnk(vp)) { return 0; @@ -489,7 +493,8 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) dataflags = fuse_get_mpdata(vnode_mount(vp))->dataflags; if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } switch(ap->a_op) { @@ -506,7 +511,7 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) op = FUSE_SETLK; break; default: - return EINVAL; + return (EXTERROR(EINVAL, "Unsupported lock flags")); } if (!(dataflags & FSESS_POSIX_LOCKS)) @@ -534,14 +539,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) size = vattr.va_size; if (size > OFF_MAX || (fl->l_start > 0 && size > OFF_MAX - fl->l_start)) { - err = EOVERFLOW; + err = EXTERROR(EOVERFLOW, "Offset is too large"); goto out; } start = size + fl->l_start; break; default: - return (EINVAL); + return (EXTERROR(EINVAL, "Unsupported offset type")); } err = fuse_filehandle_get_anyflags(vp, &fufh, cred, pid); @@ -603,7 +608,8 @@ fuse_vnop_allocate(struct vop_allocate_args *ap) int err; if (fuse_isdeadfs(vp)) - return (ENXIO); + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); switch (vp->v_type) { case VFIFO: @@ -619,7 +625,8 @@ fuse_vnop_allocate(struct vop_allocate_args *ap) return (EROFS); if (fsess_not_impl(mp, FUSE_FALLOCATE)) - return (EINVAL); + return (EXTERROR(EINVAL, "This server does not implement " + "FUSE_FALLOCATE")); io.uio_offset = *offset; io.uio_resid = *len; @@ -649,13 +656,14 @@ fuse_vnop_allocate(struct vop_allocate_args *ap) if (err == ENOSYS) { fsess_set_notimpl(mp, FUSE_FALLOCATE); - err = EINVAL; + err = EXTERROR(EINVAL, "This server does not implement " + "FUSE_ALLOCATE"); } else if (err == EOPNOTSUPP) { /* * The file system server does not support FUSE_FALLOCATE with * the supplied mode for this particular file. */ - err = EINVAL; + err = EXTERROR(EINVAL, "This file can't be pre-allocated"); } else if (!err) { *offset += *len; *len = 0; @@ -701,7 +709,8 @@ fuse_vnop_bmap(struct vop_bmap_args *ap) int maxrun; if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } mp = vnode_mount(vp); @@ -868,19 +877,21 @@ fuse_vnop_copy_file_range(struct vop_copy_file_range_args *ap) pid_t pid; int err; - err = ENOSYS; if (mp == NULL || mp != vnode_mount(outvp)) - goto fallback; + return (EXTERROR(ENOSYS, "Mount points do not match")); if (incred->cr_uid != outcred->cr_uid) - goto fallback; + return (EXTERROR(ENOSYS, "FUSE_COPY_FILE_RANGE does not " + "support different credentials for infd and outfd")); if (incred->cr_groups[0] != outcred->cr_groups[0]) - goto fallback; + return (EXTERROR(ENOSYS, "FUSE_COPY_FILE_RANGE does not " + "support different credentials for infd and outfd")); /* Caller busied mp, mnt_data can be safely accessed. */ if (fsess_not_impl(mp, FUSE_COPY_FILE_RANGE)) - goto fallback; + return (EXTERROR(ENOSYS, "This daemon does not " + "implement COPY_FILE_RANGE")); if (ap->a_fsizetd == NULL) td = curthread; @@ -890,7 +901,7 @@ fuse_vnop_copy_file_range(struct vop_copy_file_range_args *ap) vn_lock_pair(invp, false, LK_SHARED, outvp, false, LK_EXCLUSIVE); if (invp->v_data == NULL || outvp->v_data == NULL) { - err = EBADF; + err = EXTERROR(EBADF, "vnode got reclaimed"); goto unlock; } @@ -954,7 +965,6 @@ unlock: if (err == ENOSYS) fsess_set_notimpl(mp, FUSE_COPY_FILE_RANGE); -fallback: /* * No need to call vn_rlimit_fsizex_res before return, since the uio is @@ -1022,7 +1032,8 @@ fuse_vnop_create(struct vop_create_args *ap) int flags; if (fuse_isdeadfs(dvp)) - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); /* FUSE expects sockets to be created with FUSE_MKNOD */ if (vap->va_type == VSOCK) @@ -1038,7 +1049,7 @@ fuse_vnop_create(struct vop_create_args *ap) bzero(&fdi, sizeof(fdi)); if (vap->va_type != VREG) - return (EINVAL); + return (EXTERROR(EINVAL, "Only regular files can be created")); if (fsess_not_impl(mp, FUSE_CREATE) || vap->va_type == VSOCK) { /* Fallback to FUSE_MKNOD/FUSE_OPEN */ @@ -1219,8 +1230,8 @@ fuse_vnop_getattr(struct vop_getattr_args *ap) if (!(dataflags & FSESS_INITED)) { if (!vnode_isvroot(vp)) { fdata_set_dead(fuse_get_mpdata(vnode_mount(vp))); - err = ENOTCONN; - return err; + return (EXTERROR(ENOTCONN, "FUSE daemon is not " + "initialized")); } else { goto fake; } @@ -1349,10 +1360,11 @@ fuse_vnop_link(struct vop_link_args *ap) int err; if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (vnode_mount(tdvp) != vnode_mount(vp)) { - return EXDEV; + return (EXDEV); } /* @@ -1362,7 +1374,7 @@ fuse_vnop_link(struct vop_link_args *ap) * validating that nlink does not overflow. */ if (vap != NULL && vap->va_nlink >= FUSE_LINK_MAX) - return EMLINK; + return (EMLINK); fli.oldnodeid = VTOI(vp); fdisp_init(&fdi, 0); @@ -1374,12 +1386,13 @@ fuse_vnop_link(struct vop_link_args *ap) feo = fdi.answ; if (fli.oldnodeid != feo->nodeid) { + static const char exterr[] = "Server assigned wrong inode " + "for a hard link."; struct fuse_data *data = fuse_get_mpdata(vnode_mount(vp)); - fuse_warn(data, FSESS_WARN_ILLEGAL_INODE, - "Assigned wrong inode for a hard link."); + fuse_warn(data, FSESS_WARN_ILLEGAL_INODE, exterr); fuse_vnode_clear_attr_cache(vp); fuse_vnode_clear_attr_cache(tdvp); - err = EIO; + err = EXTERROR(EIO, exterr); goto out; } @@ -1456,7 +1469,8 @@ fuse_vnop_lookup(struct vop_lookup_args *ap) if (fuse_isdeadfs(dvp)) { *vpp = NULL; - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (!vnode_isdir(dvp)) return ENOTDIR; @@ -1476,7 +1490,8 @@ fuse_vnop_lookup(struct vop_lookup_args *ap) * Since the file system doesn't support ".." lookups, * we have no way to find this entry. */ - return ESTALE; + return (EXTERROR(ESTALE, "This server does not support " + "'..' lookups")); } nid = VTOFUD(dvp)->parent_nid; if (nid == 0) @@ -1599,11 +1614,11 @@ fuse_vnop_lookup(struct vop_lookup_args *ap) vref(dvp); *vpp = dvp; } else { + static const char exterr[] = "Server assigned " + "same inode to both parent and child."; fuse_warn(fuse_get_mpdata(mp), - FSESS_WARN_ILLEGAL_INODE, - "Assigned same inode to both parent and " - "child."); - err = EIO; + FSESS_WARN_ILLEGAL_INODE, exterr); + err = EXTERROR(EIO, exterr); } } else { @@ -1691,7 +1706,8 @@ fuse_vnop_mkdir(struct vop_mkdir_args *ap) struct fuse_mkdir_in fmdi; if (fuse_isdeadfs(dvp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } fmdi.mode = MAKEIMODE(vap->va_type, vap->va_mode); fmdi.umask = curthread->td_proc->p_pd->pd_cmask; @@ -1718,7 +1734,8 @@ fuse_vnop_mknod(struct vop_mknod_args *ap) struct vattr *vap = ap->a_vap; if (fuse_isdeadfs(dvp)) - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); return fuse_internal_mknod(dvp, vpp, cnp, vap); } @@ -1742,11 +1759,13 @@ fuse_vnop_open(struct vop_open_args *ap) pid_t pid = td->td_proc->p_pid; if (fuse_isdeadfs(vp)) - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); if (vp->v_type == VCHR || vp->v_type == VBLK || vp->v_type == VFIFO) - return (EOPNOTSUPP); + return (EXTERROR(EOPNOTSUPP, "Unsupported vnode type", + vp->v_type)); if ((a_mode & (FREAD | FWRITE | FEXEC)) == 0) - return EINVAL; + return (EXTERROR(EINVAL, "Illegal mode", a_mode)); if (fuse_filehandle_validrw(vp, a_mode, cred, pid)) { fuse_vnode_open(vp, 0, td); @@ -1828,7 +1847,8 @@ fuse_vnop_pathconf(struct vop_pathconf_args *ap) return (0); } else if (fsess_not_impl(mp, FUSE_LSEEK)) { /* FUSE_LSEEK is not implemented */ - return (EINVAL); + return (EXTERROR(EINVAL, "This server does not " + "implement FUSE_LSEEK")); } else { return (err); } @@ -1862,7 +1882,8 @@ fuse_vnop_read(struct vop_read_args *ap) MPASS(vp->v_type == VREG || vp->v_type == VDIR); if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (VTOFUD(vp)->flag & FN_DIRECTIO) { @@ -1939,10 +1960,11 @@ fuse_vnop_readdir(struct vop_readdir_args *ap) if (ap->a_eofflag) *ap->a_eofflag = 0; if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (uio_resid(uio) < sizeof(struct dirent)) - return EINVAL; + return (EXTERROR(EINVAL, "Buffer is too small")); tresid = uio->uio_resid; err = fuse_filehandle_get_dir(vp, &fufh, cred, pid); @@ -2012,7 +2034,8 @@ fuse_vnop_readlink(struct vop_readlink_args *ap) int err; if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (!vnode_islnk(vp)) { return EINVAL; @@ -2023,10 +2046,11 @@ fuse_vnop_readlink(struct vop_readlink_args *ap) goto out; } if (strnlen(fdi.answ, fdi.iosize) + 1 < fdi.iosize) { + static const char exterr[] = "Server returned an embedded NUL " + "from FUSE_READLINK."; struct fuse_data *data = fuse_get_mpdata(vnode_mount(vp)); - fuse_warn(data, FSESS_WARN_READLINK_EMBEDDED_NUL, - "Returned an embedded NUL from FUSE_READLINK."); - err = EIO; + fuse_warn(data, FSESS_WARN_READLINK_EMBEDDED_NUL, exterr); + err = EXTERROR(EIO, exterr); goto out; } if (((char *)fdi.answ)[0] == '/' && @@ -2110,10 +2134,11 @@ fuse_vnop_remove(struct vop_remove_args *ap) int err; if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (vnode_isdir(vp)) { - return EPERM; + return (EXTERROR(EPERM, "vnode is a directory")); } err = fuse_internal_remove(dvp, vp, cnp, FUSE_UNLINK); @@ -2146,12 +2171,13 @@ fuse_vnop_rename(struct vop_rename_args *ap) int err = 0; if (fuse_isdeadfs(fdvp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (fvp->v_mount != tdvp->v_mount || (tvp && fvp->v_mount != tvp->v_mount)) { SDT_PROBE2(fusefs, , vnops, trace, 1, "cross-device rename"); - err = EXDEV; + err = EXTERROR(EXDEV, "Cross-device rename"); goto out; } cache_purge(fvp); @@ -2222,10 +2248,12 @@ fuse_vnop_rmdir(struct vop_rmdir_args *ap) int err; if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (VTOFUD(vp) == VTOFUD(dvp)) { - return EINVAL; + return (EXTERROR(EINVAL, "Directory to be removed " + "contains itself")); } err = fuse_internal_remove(dvp, vp, ap->a_cnp, FUSE_RMDIR); @@ -2262,7 +2290,8 @@ fuse_vnop_setattr(struct vop_setattr_args *ap) checkperm = dataflags & FSESS_DEFAULT_PERMISSIONS; if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (vap->va_uid != (uid_t)VNOVAL) { @@ -2427,7 +2456,8 @@ fuse_vnop_symlink(struct vop_symlink_args *ap) size_t len; if (fuse_isdeadfs(dvp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } /* * Unlike the other creator type calls, here we have to create a message @@ -2473,7 +2503,8 @@ fuse_vnop_write(struct vop_write_args *ap) MPASS(vp->v_type == VREG || vp->v_type == VDIR); if (fuse_isdeadfs(vp)) { - return ENXIO; + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); } if (VTOFUD(vp)->flag & FN_DIRECTIO) { @@ -2626,10 +2657,12 @@ fuse_vnop_getextattr(struct vop_getextattr_args *ap) int err; if (fuse_isdeadfs(vp)) - return (ENXIO); + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); if (fsess_not_impl(mp, FUSE_GETXATTR)) - return EOPNOTSUPP; + return (EXTERROR(EOPNOTSUPP, "This server does not implement " + "extended attributes")); err = fuse_extattr_check_cred(vp, ap->a_attrnamespace, cred, td, VREAD); if (err) @@ -2667,7 +2700,8 @@ fuse_vnop_getextattr(struct vop_getextattr_args *ap) if (err != 0) { if (err == ENOSYS) { fsess_set_notimpl(mp, FUSE_GETXATTR); - err = EOPNOTSUPP; + err = (EXTERROR(EOPNOTSUPP, "This server does not " + "implement extended attributes")); } goto out; } @@ -2713,10 +2747,12 @@ fuse_vnop_setextattr(struct vop_setextattr_args *ap) int err; if (fuse_isdeadfs(vp)) - return (ENXIO); + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); if (fsess_not_impl(mp, FUSE_SETXATTR)) - return EOPNOTSUPP; + return (EXTERROR(EOPNOTSUPP, "This server does not implement " + "setting extended attributes")); if (vfs_isrdonly(mp)) return EROFS; @@ -2728,9 +2764,11 @@ fuse_vnop_setextattr(struct vop_setextattr_args *ap) * return EOPNOTSUPP. */ if (fsess_not_impl(mp, FUSE_REMOVEXATTR)) - return (EOPNOTSUPP); + return (EXTERROR(EOPNOTSUPP, "This server does not " + "implement removing extended attributess")); else - return (EINVAL); + return (EXTERROR(EINVAL, "DELETEEXTATTR should be used " + "to remove extattrs")); } err = fuse_extattr_check_cred(vp, ap->a_attrnamespace, cred, td, @@ -2776,7 +2814,8 @@ fuse_vnop_setextattr(struct vop_setextattr_args *ap) if (err == ENOSYS) { fsess_set_notimpl(mp, FUSE_SETXATTR); - err = EOPNOTSUPP; + err = EXTERROR(EOPNOTSUPP, "This server does not implement " + "setting extended attributes"); } if (err == ERESTART) { /* Can't restart after calling uiomove */ @@ -2887,10 +2926,12 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap) int err; if (fuse_isdeadfs(vp)) - return (ENXIO); + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); if (fsess_not_impl(mp, FUSE_LISTXATTR)) - return EOPNOTSUPP; + return (EXTERROR(EOPNOTSUPP, "This server does not implement " + "extended attributes")); err = fuse_extattr_check_cred(vp, ap->a_attrnamespace, cred, td, VREAD); if (err) @@ -2918,7 +2959,8 @@ fuse_vnop_listextattr(struct vop_listextattr_args *ap) if (err != 0) { if (err == ENOSYS) { fsess_set_notimpl(mp, FUSE_LISTXATTR); - err = EOPNOTSUPP; + err = EXTERROR(EOPNOTSUPP, "This server does not " + "implement extended attributes"); } goto out; } @@ -3018,7 +3060,8 @@ fuse_vnop_deallocate(struct vop_deallocate_args *ap) bool closefufh = false; if (fuse_isdeadfs(vp)) - return (ENXIO); + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); if (vfs_isrdonly(mp)) return (EROFS); @@ -3124,10 +3167,12 @@ fuse_vnop_deleteextattr(struct vop_deleteextattr_args *ap) int err; if (fuse_isdeadfs(vp)) - return (ENXIO); + return (EXTERROR(ENXIO, "This FUSE session is about " + "to be closed")); if (fsess_not_impl(mp, FUSE_REMOVEXATTR)) - return EOPNOTSUPP; + return (EXTERROR(EOPNOTSUPP, "This server does not implement " + "removing extended attributes")); if (vfs_isrdonly(mp)) return EROFS; @@ -3156,7 +3201,8 @@ fuse_vnop_deleteextattr(struct vop_deleteextattr_args *ap) err = fdisp_wait_answ(&fdi); if (err == ENOSYS) { fsess_set_notimpl(mp, FUSE_REMOVEXATTR); - err = EOPNOTSUPP; + err = EXTERROR(EOPNOTSUPP, "This server does not implement " + "removing extended attributes"); } fdisp_destroy(&fdi); @@ -3210,7 +3256,8 @@ fuse_vnop_vptofh(struct vop_vptofh_args *ap) /* NFS requires lookups for "." and ".." */ SDT_PROBE2(fusefs, , vnops, trace, 1, "VOP_VPTOFH without FUSE_EXPORT_SUPPORT"); - return EOPNOTSUPP; + return (EXTERROR(EOPNOTSUPP, "This server is " + "missing FUSE_EXPORT_SUPPORT")); } if ((mp->mnt_flag & MNT_EXPORTED) && fsess_is_impl(mp, FUSE_OPENDIR)) @@ -3228,7 +3275,8 @@ fuse_vnop_vptofh(struct vop_vptofh_args *ap) */ SDT_PROBE2(fusefs, , vnops, trace, 1, "VOP_VPTOFH with FUSE_OPENDIR"); - return EOPNOTSUPP; + return (EXTERROR(EOPNOTSUPP, "This server implements " + "FUSE_OPENDIR so is not compatible with getfh")); } err = fuse_internal_getattr(vp, &va, curthread->td_ucred, curthread); @@ -3242,6 +3290,7 @@ fuse_vnop_vptofh(struct vop_vptofh_args *ap) if (fvdat->generation <= UINT32_MAX) fhp->gen = fvdat->generation; else - return EOVERFLOW; + return (EXTERROR(EOVERFLOW, "inode generation " + "number overflow")); return (0); } From nobody Fri Jul 4 07:33:15 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYQNN4DxFz612mJ; Fri, 04 Jul 2025 07:33:24 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) 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 "E5" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYQNM1hy6z42XH; Fri, 04 Jul 2025 07:33:23 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=zabbadoz.net header.s=20240622 header.b=MxbTmM0c; spf=pass (mx1.freebsd.org: domain of bzeeb-lists@lists.zabbadoz.net designates 2003:a:140a:2200:6:594:fffe:19 as permitted sender) smtp.mailfrom=bzeeb-lists@lists.zabbadoz.net; dmarc=pass (policy=none) header.from=zabbadoz.net 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 B7FD5A64805; Fri, 04 Jul 2025 07:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zabbadoz.net; s=20240622; t=1751614393; bh=tApljUFDb6YPQdwLv34FJwYhIWV2kykKijVEsJPS+TU=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=MxbTmM0c7Hqau3/DM9MH4+IMn50xqmK8BIJn54/YWZXez6ev5Wx225IAsZ1IlLyCb dhsoWByzsh5q8M1SDc4ALS7dZHgW9VPDjRyfO91w/hPG3vpb4VJo8jPrdjUMcHAXYv HxM3r11MCoC2C9hu8fIDYvxXXQoRiXbBJOaYArxpiMkJMAhRnZR0yY7WXaF9Zh8UUL eY+W9WuTEs5eZ7Gl0MN56rnK+8/W2KPA0S50hfD+rCrVsZ6FFjnfD2STie1ax+uyka IMwXoipp/UZtFkliuh/Sb+O3sz9IJB3H0HEL2YREJYfJpVgIS/OrN7F7StMZdGpvlb CFEScDOK2wNBD+sjKXoaX8bM15jGNoi1KDla74tSJc/qMb4oDstEVLtMIPW2R2z8Ia EUvGtPempaXTdf/Wx2OuJJ6Atk7g5HbYLpfDTKh4q+o3HaB/0TL9mqFGJF/KmPfIfb usPqX4mBJXytv3b86pttY41mPr2DlH0tZVnvdS3NYDl74IQZEwpFzm/KQixSTAFs8+ 02x/304qz1tecgGG+XRR523fb2N/iOW7gCGT0uEFr0bl0xpud4r8gftP0DN/OHJQ1d Y3SAh1+dTNjBt6m+RJ2g2PjLqpfkBAaqn/cVxoqBqr6+GBo2bK+GLrUfyaglPT2VFV 4z29z73fOJM4XABw/w5ShEQA= 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 B03432D029E0; Fri, 4 Jul 2025 07:33:16 +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 amTDDNvdmW6y; Fri, 4 Jul 2025 07:33:15 +0000 (UTC) Received: from strong-rtwn0.sbone.de (strong-rtwn0.sbone.de [IPv6:fde9:577b:c1a9:4902:3e64:cfff:fe55:bc80]) (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 456B82D029D8; Fri, 4 Jul 2025 07:33:15 +0000 (UTC) Date: Fri, 4 Jul 2025 07:33:15 +0000 (UTC) From: "Bjoern A. Zeeb" To: Andriy Gapon cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 5aedb8b1d4a6 - main - mmc_da: fix garbage in disk->d_attachment In-Reply-To: <202506270721.55R7LmtP067254@gitrepo.freebsd.org> Message-ID: <49qns615-158p-0n85-332r-986r65rs4rr0@yvfgf.mnoonqbm.arg> References: <202506270721.55R7LmtP067254@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spamd-Result: default: False [-3.77 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-0.98)[-0.975]; NEURAL_HAM_SHORT(-0.79)[-0.791]; DMARC_POLICY_ALLOW(-0.50)[zabbadoz.net,none]; R_DKIM_ALLOW(-0.20)[zabbadoz.net:s=20240622]; R_SPF_ALLOW(-0.20)[+ip6:2003:a:140a:2200:6:594:fffe:19]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; ASN(0.00)[asn:3320, ipnet:2003::/19, country:DE]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MLMMJ_DEST(0.00)[dev-commits-src-all@FreeBSD.org,dev-commits-src-main@FreeBSD.org]; DKIM_TRACE(0.00)[zabbadoz.net:+] X-Rspamd-Queue-Id: 4bYQNM1hy6z42XH X-Spamd-Bar: --- On Fri, 27 Jun 2025, Andriy Gapon wrote: > The branch main has been updated by avg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5aedb8b1d4a6c099eaa0a65f8fcbdcc4aba8f75b > > commit 5aedb8b1d4a6c099eaa0a65f8fcbdcc4aba8f75b > Author: Andriy Gapon > AuthorDate: 2025-06-23 21:43:35 +0000 > Commit: Andriy Gapon > CommitDate: 2025-06-27 07:19:15 +0000 > > mmc_da: fix garbage in disk->d_attachment > > The garbage resulted from reading the value from a ccb which was > originally populated by XPT_PATH_INQ operation but then overwritten by > XPT_GET_TRAN_SETTINGS operation. > > The problem could probably be fixed by re-ordering the > XPT_GET_TRAN_SETTINGS operation, but it seems like the operation was > redundant. Besides, the ccb is declared not as union ccb but as struct > ccb_pathinq, so using it for XPT_GET_TRAN_SETTINGS was questionable. > > I opted for replacing a call to sdda_get_max_data (which uses > XPT_GET_TRAN_SETTINGS internally) with using maxio provided by the > XPT_PATH_INQ operation. > > This also required fixing mmc_cam_sim_default_action as controllers > return maximum I/O size in sectors, but maxio value should be in bytes. > > MFC after: 2 weeks > --- > sys/cam/mmc/mmc_da.c | 4 +--- > sys/cam/mmc/mmc_sim.c | 2 +- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c > index fc29a1925c66..1c455e1951d7 100644 > --- a/sys/cam/mmc/mmc_da.c > +++ b/sys/cam/mmc/mmc_da.c > @@ -1572,9 +1572,7 @@ sdda_add_part(struct cam_periph *periph, u_int type, const char *name, > part->disk->d_gone = sddadiskgonecb; > part->disk->d_name = part->name; > part->disk->d_drv1 = part; > - part->disk->d_maxsize = > - MIN(maxphys, sdda_get_max_data(periph, > - (union ccb *)&cpi) * mmc_get_sector_size(periph)); This now results in: sys/cam/mmc/mmc_da.c:1202:1: warning: unused function 'sdda_get_max_data' [-Wunused-function] 1202 | sdda_get_max_data(struct cam_periph *periph, union ccb *ccb) | ^~~~~~~~~~~~~~~~~ 1 warning generated. Can the function be garbage collected? > + part->disk->d_maxsize = MIN(maxphys, cpi.maxio); > part->disk->d_unit = cnt; > part->disk->d_flags = 0; > strlcpy(part->disk->d_descr, sc->card_id_string, > diff --git a/sys/cam/mmc/mmc_sim.c b/sys/cam/mmc/mmc_sim.c > index 104916a41782..ab6daffb0995 100644 > --- a/sys/cam/mmc/mmc_sim.c > +++ b/sys/cam/mmc/mmc_sim.c > @@ -109,7 +109,7 @@ mmc_cam_sim_default_action(struct cam_sim *sim, union ccb *ccb) > ccb->ccb_h.status = CAM_REQ_INVALID; > } else { > mmc_path_inq(&ccb->cpi, "Deglitch Networks", > - sim, mmc.host_max_data); > + sim, mmc.host_max_data * MMC_SECTOR_SIZE); > } > break; > case XPT_GET_TRAN_SETTINGS: > -- Bjoern A. Zeeb r15:7 From nobody Fri Jul 4 07:45:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYQfF4gb4z613rn; Fri, 04 Jul 2025 07:45:25 +0000 (UTC) (envelope-from avg@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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYQfF3dNlz469l; Fri, 04 Jul 2025 07:45:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751615125; 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:autocrypt:autocrypt; bh=vrHscaWbFUb3GCNtUZxZWemzAxsyUuas5oOKwrNOi1U=; b=OG681JseviAuRTGyM4FgACbud22TrwVwbO2rnRLQ0Ouuxt7QJzlWW52j2ZgDOMyp+eVFpn Y9ZUwK+rAcAMZnNdqC7o5LXJIqowxRqT9Zhdv4Tej61agxXKeF8lnxJLLdPsX9+Fbv4rbx d98InbM9ZSpT4pBvbFemsleAn8uaWruADtZlXp8vA4MzepuvgbPN5mg6IP6fRVwzsRQWDh S0OQYvMkkLJo9bgLBkWWjmfn72fbgD9MblZwVW1YZzsEsV3+DTaRRWzhOljnYIV52xM/Ay 3Gnxc8D7HhmSep4nXagip0qXBrAeGkuw2mO7ojDjuDeXGPzOH3XNHWDrI4VJLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751615125; 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:autocrypt:autocrypt; bh=vrHscaWbFUb3GCNtUZxZWemzAxsyUuas5oOKwrNOi1U=; b=EZns3f/joMeZ5eNTzyq36/I9cE3ZB5oZC+NaGphwPP5EsldBmpOL0I+TdAzva4608ZNBJ/ 5U7QkU48NCqW9qAwjz0iWsfbPfp4akjq8Q0DKqzHV458QyRC13GR7OqnH9IaJmQAL6JzfC ef3ODWge0Cw4uODsmpLQqgHhUp03XdL/h+2iSRUb+csJiu3h0sijhAW4E65IZQ+F233cTr RplP1VvS2wCB+383PPTO6fnamRQionSOmCql7apSXSPIWnAFI50nODWKUyr0pxUeWLC4jX GiiRHbOHoOGD7Nmb6UqFYNiRhnMHz6q28XvRpaGvrwcKG8Hk93bfJDfPuG0EDQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751615125; a=rsa-sha256; cv=none; b=nDbWELaiW/EWaf+GafZoybctJPbeScLTitQgqrOaSOEpYq7TH+rUDRoKmZJnPxIHIvIaAR D3MJwL2m02aovT7dq6pPbQ2OqV3WRk04xruzosD2WZtgfY1OLBHUXm13NoQptCTelsiHSX qt6aAAQVm78VqjLjyEjuDuA+niLCzreiSI828crQIG7qZ4bG5P8MhGdvgX4sOnWhQ626C6 oCo3Q5jJn4Nrvj6maWzELIxz3NZAQGKi86GEsA4ST+eR0DH9y7RcOFXcsAsYFYEKUNQp7C hmvGIsXRYGS73y9ummRmJmqWSqDul+WsKNBxkcBLhEhg6cjIvM7GIIPDL7AWMQ== Received: from [192.168.0.88] (unknown [93.188.39.137]) (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: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4bYQfD5jmVzRbB; Fri, 04 Jul 2025 07:45:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Message-ID: <0cd79a1f-daac-48a0-a0d2-65712fcae4d4@FreeBSD.org> Date: Fri, 4 Jul 2025 10:45:22 +0300 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Andriy Gapon Subject: Re: git: 5aedb8b1d4a6 - main - mmc_da: fix garbage in disk->d_attachment To: "Bjoern A. Zeeb" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202506270721.55R7LmtP067254@gitrepo.freebsd.org> <49qns615-158p-0n85-332r-986r65rs4rr0@yvfgf.mnoonqbm.arg> Content-Language: en-US Autocrypt: addr=avg@FreeBSD.org; keydata= xsDNBGcKrHEBDADRvwQOK0b/yo4ys5cs6bOQMhEh4xtfbaZ/CU00cpPgUip3sOZCdrtMWlRC g25z97prxE9pKueZi+HXDhIPpa9xl14ghqF4oYScuJ1i18HyiOH2y5Q3Vv/TtFiSzicd3EAu QgS3jVidpgDSPDdj2Yz3UxYpZ+PuFl6nOnvCvqOFcjUlzKCyPaiN2b86l1Nscmhnc+zQ/faB erUOEFEDQbWMA5YfXi8HrbeR16hfRfGt7E0aMDlIj9FIPIq71UWMN9CimPgs4+rbNr1MAlLa z4GxSDhVYZEY5rqtCzr+PLXboRQWnaUwXl0/biw9enf17NHdYv1SNAFTX2eC4dZ3qBVI74dS PgNprm+PMfz+6Hhs/dAv+Nan5nVhg3EFIjYTiy0MnjMSq8uI0v0ykpAGAcJJ5xl6d23aLxgN 6f0z6pJRCO0hGPgU7UzvFD0MxJxmbzqdT1R51KDan1oD41b+tjl2LMBuCDCoB0U44Pu0zLdp xMfFTxCXtwIYKIUxwd28jwMAEQEAAc0eQW5kcml5IEdhcG9uIDxhdmdARnJlZUJTRC5vcmc+ wsENBBMBCAA3FiEEmXvSmjiQFHPVOpLnzDOt5NLj67sFAmcKrHEFCQeEzgACGwMECwkIBwUV CAkKCwUWAgMBAAAKCRDMM63k0uPru5tSDACFK15LLbq89RSQ6QMnjiIm1t/wYJyumb519MHu Dhzxx1lbr8oghf0RHtF6kYRLQPaW2VdToi74pRobd3CN4bhZKDLSL6WfTn17RfavDjL6Njwp KBo30CkOeYKWq1mDmo0xEoQj8cc7ybEZnus+YScZOpj8Ti4EFwhRt6SHer7YDb161IHKL8m4 MsCxpFSGEjbKj8Iul3Ri/fTOO8w14ivcuEEQIvJt4/+4YV5Az8G23wKzL/3aJ7SOT3oYGmR9 atBTmVO3DlODjM+rZLegd8SfLSPTcBTHspWE5duemIzZbEX3BP77r3Qx4Fo5Tkit3bG1XVar yPQato+sFGFEGifdE9USBQoAoOaaeZevwAWjDU0TIuCT0CUe0sKtQuNP4LRq0n9EEHOXBu9a CfdMhFUSkAZnuE7miSVwgPvoVNJ1stA37EXLN/sVsWik7wslTQ5vF81VpdGFiwoQPOe2XEKh ogcwGSnXbwv1gD4x+Gz/7Y+kFyr1NY+4/nSaeXVcS2fOwM0EZwqscgEMAMQTe6ypAmQe/TFO HqKD2hfFKdksTptKi6uEh8xIwct8G/0FBldDWXo9eu8CGr/ZrDg0/bAwJxbaLRQCMH19Gq2Y hLvZ1QK5GQJVzZKcqfxbF2LiDUTs6WkdOBIhGpdDy7p1xFrvqCGCtNFYHuGYm067EozibBSF BWAPstKu2FQuVHZNMOfs7p3OIz3Yfqu9woXDeg3/8G2qVQJINe+8EwXKlhgh4CyDbq7nAZoA kIu1SE9z9u3WI5mcNy/0dFmVUsFxBqRC3ewbvzie8tKyZ9yFOlaZPT0Y4nRBXQTI3mLZ8zQ8 mtrWK5OOmrJ02kdeO9RBXe+OMaUUWMf92ZIoBFb4HP6N+B+4N1y1OwULousfl7JRoYxA4MRL ls7E2sSoJvrEBTJB3Pc34xu8rsJ1A5V3NgN6djX8yEZYpTRkcmrBeWy/ofDqZPVqneAx0LRm eldDS9msXDW4KXODyPZ+9unvmHAcoH0xaBYaSH44CDZDQDg4LNcmbOvuu1TEXBJhjQARAQAB wsD8BBgBCAAmFiEEmXvSmjiQFHPVOpLnzDOt5NLj67sFAmcKrHMFCQeEzgACGwwACgkQzDOt 5NLj67sUCAv5AXqgWnYN9EblapMbZjkiqL8pZQ0GNqh+Pg9FwbyULxjtRTO6rD4D0IxizByb ef+neeUNyYlagt5nfKMysEr0SU/gHKCi8vyTF/63ukMrGUNGmJJxrndl5ZYKC6j6eX7twrZF L1Uvlmn6FnQ22red5kHO93fDjG4zaDIZvHfwj7kzjZ4tpC7Byinf88s14mdZeScc0PnU2hj4 UGYju/wg2FF4YxaZYhcmdTiRYY0Wx85XSMZv19pnn78sadEuRvfRd4JTmw++j1xGXeqQGWzz /CTG5/Ex9GAkQ02hZbmi236byDXoet4G8TEyOph9QFVkV9bNd0jQZaFZPGEj4PSPUYGAF7s5 xJaNGgctC3aZ7WjEv1FBoo44XCU4xcjJ1wZQUrHxRhx6TW0Jtcl0U9qfKFW30TSPo6RyiXuj X4ltWKAtjoXB8nUmEJckaz7IRu2b4pXDeazZuz5JBygUs10yJjDxh2vFQZo0KaBAPx9MZlPn gpPTjT15L8xGftEjQXF6 In-Reply-To: <49qns615-158p-0n85-332r-986r65rs4rr0@yvfgf.mnoonqbm.arg> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 04/07/2025 10:33, Bjoern A. Zeeb wrote: > This now results in: > > sys/cam/mmc/mmc_da.c:1202:1: warning: unused function 'sdda_get_max_data' [- > Wunused-function] >  1202 | sdda_get_max_data(struct cam_periph *periph, union ccb *ccb) >       | ^~~~~~~~~~~~~~~~~ > 1 warning generated. > > Can the function be garbage collected? Sure! Thank you for the info. -- Andriy Gapon From nobody Fri Jul 4 08:01:16 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYR0X4c1Yz6163f; Fri, 04 Jul 2025 08:01: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYR0X3wx3z3Dr3; Fri, 04 Jul 2025 08:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751616076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=htkNsi2gZkxAc/0NqEdEpIjRL/dwDs6HZrsQ+uGq4DA=; b=i2cLXZp4zCWI+YQrfz8KqL3DlqyL544EYBwmWnZsC+7OP1aZhW5HX7Vv8LQNDcN9PHkQf1 eCifbA60pKC08w5fp2RMRmo9+5AIOJNw4nh70mW5/qApaJnUagQos/0a/S0r/F9bJioPOk dbQnTW+CdzAP0Y4pB/sgURwxL3BrDHYpQq6QJEqgyrhqnvMCl2iBoUAZSWTsVkyWMbgK9H NzC3AbNQV8pBK6CFD38LNAkBIAu21IWusAQaAU00jyGRXwkAhBGjgyz4iVraFGfplbai9V uzkJ/U70UGtQBfKpXjTyRW4kgV/XneR8ZSTHCtzRSE9TKdgF2HNHIeZqQCJoAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751616076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=htkNsi2gZkxAc/0NqEdEpIjRL/dwDs6HZrsQ+uGq4DA=; b=ijEpkpsvqbpeWvH+ICmvsCh/yfKNjXQoVGJDKNV8EW83NGeUdpUdjbSZDakSjjW6CmKpCj tX2ld4l4z8ru3Puf9y16LfiCaHQphG0WFBjqRbven1YrZwYXGtbtL1kkzF3xw2XW7MJJ6l 7+9InWc2c0/jqClfjsmP23gFdqL5IZZ9z26LZI91gDV6hwWIyL5lxSTzt4FKUr8FQqCKnt dohWScxZ+Qi8cN4LvzzT26iwuOGM5TeEk7h288oikm+4x8a51/qV51b+L5VbBI58NYGAVu 5ex5lAkK6nELAZ/nVMbTywMnAg0jKLewtcFF25R2QEvrUNthMo1Nag09K9MkMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751616076; a=rsa-sha256; cv=none; b=pPK+t1ioOklOLRL0s7wXNUW96pItahzI6d2ZwfMygu0kYzYVu8mCJvkVZd32SsbZsY8Vqq PVKRBg5cecIra8O8gpqvmkTEBxwAXU1COtbj+M3776qZTX9SYvqQg2LXGU4sSa2zO6hc5b L7Z/iQonlzBzXvc2j4PYfUI7vpw5WQl94VrK5AlZF7Ee+x9nn+eYESPCZYE7qhLocLbDfd WjzsLi23nJLpLcsIwXW6e66EMquyZfSWCXshYarK8jNoWEa++UwrVY8VwEpz9aVKeitlIS Ee1RV6ciToHahKUMz9odqmrRe4OTNSG2SzhVLBLMp5hTNAEPzGdsZK5UQMiceA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYR0X3TVCzj1R; Fri, 04 Jul 2025 08:01:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56481Gc0099605; Fri, 4 Jul 2025 08:01:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56481GQA099602; Fri, 4 Jul 2025 08:01:16 GMT (envelope-from git) Date: Fri, 4 Jul 2025 08:01:16 GMT Message-Id: <202507040801.56481GQA099602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: ad0c3859a918 - main - mmc_da: garbage-collect sdda_get_max_data List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad0c3859a9184036484c0cd63d7260a4a3d1ad2d Auto-Submitted: auto-generated The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=ad0c3859a9184036484c0cd63d7260a4a3d1ad2d commit ad0c3859a9184036484c0cd63d7260a4a3d1ad2d Author: Andriy Gapon AuthorDate: 2025-07-04 07:53:11 +0000 Commit: Andriy Gapon CommitDate: 2025-07-04 08:01:00 +0000 mmc_da: garbage-collect sdda_get_max_data The function is unused since 5aedb8b1d4a6. For information, in MMC CAM both XPT_GET_TRAN_SETTINGS and XPT_PATH_INQ obtain data using MMC_SIM_GET_TRAN_SETTINGS. So, "overlapping" information like ccb_trans_settings_mmc::host_max_data and ccb_pathinq::maxio is derived from the same source. That's why sdda_get_max_data was redundant. Reported by: bz MFC after: 5 days --- sys/cam/mmc/mmc_da.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c index 1c455e1951d7..9246f95a080e 100644 --- a/sys/cam/mmc/mmc_da.c +++ b/sys/cam/mmc/mmc_da.c @@ -1198,27 +1198,6 @@ sdda_get_host_caps(struct cam_periph *periph, union ccb *ccb) return (cts->host_caps); } -static uint32_t -sdda_get_max_data(struct cam_periph *periph, union ccb *ccb) -{ - struct ccb_trans_settings_mmc *cts; - - cts = &ccb->cts.proto_specific.mmc; - memset(cts, 0, sizeof(struct ccb_trans_settings_mmc)); - - ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS; - ccb->ccb_h.flags = CAM_DIR_NONE; - ccb->ccb_h.retry_count = 0; - ccb->ccb_h.timeout = 100; - ccb->ccb_h.cbfcnp = NULL; - xpt_action(ccb); - - if (ccb->ccb_h.status != CAM_REQ_CMP) - panic("Cannot get host max data"); - KASSERT(cts->host_max_data != 0, ("host_max_data == 0?!")); - return (cts->host_max_data); -} - static void sdda_start_init(void *context, union ccb *start_ccb) { From nobody Fri Jul 4 09:22:33 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpK5WPnz61GNv; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpK4ZNTz3pL2; Fri, 04 Jul 2025 09:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sZwiF+PiQZP6SSkOGibvc9LyHpbyyon2OmxPkPOxdx4=; b=p0sQcD0/4py8Of5xprgShq5m7qn6/CAxONX/aWCySwajkGcxAQ9X9ffMtYc5pOsigZ5LkV 6oW/Ou97lF6lROV+1+fd3Er1jsbY+EogfQb1/jd8jZ/9sR+7i+m9GlAl7YL815tu5i2B7F NwSP0MGzYaIWutiujNTwqQJRV05oeN/NpkFdReU/DAdCAmSjG+vgXj0uC491F+SxgfZuLD GYSxnJCZUORPsHW/KX/XkKiX7tRT/zAZ8ZG88NbLheiL1MPqQn7afhT5e7mkQuNeDc7MTa diyntGPqC4fDa1yHG0VQggdLx/r7qce7WR/3Mlwdk2I3Jk0rhreePVk6ZHv0UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sZwiF+PiQZP6SSkOGibvc9LyHpbyyon2OmxPkPOxdx4=; b=C41H655I01J6DlFX5nDghQ1SOp8ZCCoahe4cZfuf/EpVnQqxEt1lpDUkgdpOFZi5x7LTGR Od+jzgjRwszVYfFFcDFBWfbOXJyuI4F6fuV+5wMdNnsR7YYZwhjtxPIXeBLKKPBEyjCVd8 Dxjkt0SsE35zC7qblaCN5Bf39njCwzAV10iwgFYKHCvPlENpOLqZPbge3fAlb6zcpNC5HF MY+JTxMZMus2ENwDluV7FHhXYdFdXVMQd6stWSxNgBmU7bUFNu/AXlRbHYYoZkRvb5/S0c HaU5ajvqUvFoxzb8hTzz1Dj9/1eh+N+CJFviC7w7tOqn8LLekEv2en0wzvVq8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620953; a=rsa-sha256; cv=none; b=rE0/xMP1a1+JqN7pb0HI4h6C2ozHP8RuekopoIT1ebZ7dxVycPnLwzEe1e/YJjOEJFMGm9 geLWp/nHUzVoQJpej+ud85HPczcWGGhEqjBp7XpTVeGJ4hOZW8/MqEBdWZ4411FchPOiGA KNjMtodfWsbt4OojfMm+h1ob/flstClktXrcRO/lbXt5KHv8RPSW93nUsUHgNtn9ofsdQw OGdd1BU0IYDmnML56MexqxZaOMwE4Tw78JxQshSISAUbEv+CE5yKxoXp+uyPOw4/8IbNPt qjvjdRgkMxK05xvZQoM7bF5XEfzdSnob5Z6XrZPU3Lb95RVXRTTVaQK+B2z7sQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpK44hjzkwn; Fri, 04 Jul 2025 09:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MXqH055609; Fri, 4 Jul 2025 09:22:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MXtA055606; Fri, 4 Jul 2025 09:22:33 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:33 GMT Message-Id: <202507040922.5649MXtA055606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 90b015916386 - main - pf: use PFR_RB_NONE consistently List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90b0159163862254fe9a1a1d851444a37faf1f6b Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=90b0159163862254fe9a1a1d851444a37faf1f6b commit 90b0159163862254fe9a1a1d851444a37faf1f6b Author: Kristof Provost AuthorDate: 2025-06-30 12:24:53 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:10 +0000 pf: use PFR_RB_NONE consistently Replace hardcoded 0 and implicit checks with enum as done in all other use cases of `pfra_fback'. No object change. OK sashan Obtained from: OpenBSD, kn , ab23e671fc Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl_table.c | 14 +++++++++----- sys/netpfil/pf/pf_table.c | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index 3fe87b53b7f9..abe22a3258de 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -214,7 +214,8 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, xprintf(opts, "%d/%d addresses added", nadd, b.pfrb_size); if (opts & PF_OPT_VERBOSE) PFRB_FOREACH(a, &b) - if ((opts & PF_OPT_VERBOSE2) || a->pfra_fback) + if ((opts & PF_OPT_VERBOSE2) || + a->pfra_fback != PFR_FB_NONE) print_addrx(a, NULL, opts & PF_OPT_USEDNS); } else if (!strcmp(command, "delete")) { @@ -228,7 +229,8 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, xprintf(opts, "%d/%d addresses deleted", ndel, b.pfrb_size); if (opts & PF_OPT_VERBOSE) PFRB_FOREACH(a, &b) - if ((opts & PF_OPT_VERBOSE2) || a->pfra_fback) + if ((opts & PF_OPT_VERBOSE2) || + a->pfra_fback != PFR_FB_NONE) print_addrx(a, NULL, opts & PF_OPT_USEDNS); } else if (!strcmp(command, "replace")) { @@ -259,7 +261,8 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, xprintf(opts, "no changes"); if (opts & PF_OPT_VERBOSE) PFRB_FOREACH(a, &b) - if ((opts & PF_OPT_VERBOSE2) || a->pfra_fback) + if ((opts & PF_OPT_VERBOSE2) || + a->pfra_fback != PFR_FB_NONE) print_addrx(a, NULL, opts & PF_OPT_USEDNS); } else if (!strcmp(command, "expire")) { @@ -282,7 +285,7 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, break; } PFRB_FOREACH(p, &b) { - ((struct pfr_astats *)p)->pfras_a.pfra_fback = 0; + ((struct pfr_astats *)p)->pfras_a.pfra_fback = PFR_FB_NONE; if (time(NULL) - ((struct pfr_astats *)p)->pfras_tzero > lifetime) if (pfr_buf_add(&b2, @@ -297,7 +300,8 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, xprintf(opts, "%d/%d addresses expired", ndel, b2.pfrb_size); if (opts & PF_OPT_VERBOSE) PFRB_FOREACH(a, &b2) - if ((opts & PF_OPT_VERBOSE2) || a->pfra_fback) + if ((opts & PF_OPT_VERBOSE2) || + a->pfra_fback != PFR_FB_NONE) print_addrx(a, NULL, opts & PF_OPT_USEDNS); } else if (!strcmp(command, "reset")) { diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index d5874df3df66..6332e713c596 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -704,7 +704,7 @@ pfr_validate_addr(struct pfr_addr *ad) return (-1); if (ad->pfra_not && ad->pfra_not != 1) return (-1); - if (ad->pfra_fback) + if (ad->pfra_fback != PFR_FB_NONE) return (-1); return (0); } From nobody Fri Jul 4 09:22:34 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpM29MDz61GZt; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpL5STNz3pl6; Fri, 04 Jul 2025 09:22:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QVUrzGIbQZHZiL9sl0Ko2VJGYaC6lWsB/0sEfyGfyyQ=; b=ILYceHXq/CqhSKsb7kvgqektnKM8nO9BTD25mrSYXxfSjjAHrb6vU0PzrMeYJOe11uCQWr sBDyXntGuKmCRbCe+Y53dUKaHWFa2/FfQjjvYNaJOyGmL4M+DZBev/loEZ+1PiPoxIvpKL vyRv1tTRr5zhX/lpykS3UGgSCokUu4xmLpaAJmLm23bCnHCBjUqNnQsU91RVM4VGGZ7Nxl EAFPBsYYu+SVFGfZRGyvoOINbrBdCEmvJYoHHUdcjPhr9sFEC3aRRSiVgOp6ovPNSKPyGK bOyVrHv48HoCh7YX3jb6QOdWadAJ001hDrCuL/LyIm+pzhhxjz6tAUqKy8rMpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QVUrzGIbQZHZiL9sl0Ko2VJGYaC6lWsB/0sEfyGfyyQ=; b=wYZm3UMsOrzFMyywriWuDsBVT3c7Tn5NjKsr1kpXu2ehwunfb8hWhvc919i7LVBeb+LP80 nA0sOPEpOIMgawz7DWtihpP2dq5VU90xWfC+vfOE01VKH/jFrC2OT9Tkmgi3TaomFduQQD +aUg11toBecZiuDeOr76yY9niH8IqucS4x2x2PulwRol9jMPOdWHEZFIoYpUfWweCodWuH +sL8HPXpSIeyfVfyLKWcAXTCaOs4hkvENnDE+qtcMEP+rVXXAUGIYEjECgk5b0fMG2mf8j 4EB839dgVsfo6oXlgGKdTrW3W7gecGil+QzX1ECK+oMBxtHYJfrMmYW6Bf43RA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620954; a=rsa-sha256; cv=none; b=ZvUm1a8t5cvmkbremKKjVOMyFHHeP687jHk+ZGGCyuwcGrsH2EqMxpymgtPAHvXChQG7zr 6licxwSCsCc1IPQ66mWTiuU9GnsQ0HajZn6MLw14qZZrFJCCwYdVKGyGDbND95Qr+0gyM8 Fo6061IFLQ+lxoypqjUXz1xFY0nE6TgfAEHhN7gFAoTQdg2A0XXZuKk6MLB3Pel+X6pGnF 4FryssTk1VUjU+TzU+fCj68NGATARygSj+jx7jsjEouV5aF72nkr9YDuECntFcPy+FZhz2 MBzkLnTdpLh8+eBFziBgbZXuuYV/FtBgn84/U69yMktZAYuilj5M0TRKaOcZ5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpL53M3zlS1; Fri, 04 Jul 2025 09:22:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MYou055643; Fri, 4 Jul 2025 09:22:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MYfC055640; Fri, 4 Jul 2025 09:22:34 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:34 GMT Message-Id: <202507040922.5649MYfC055640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: b168cac06613 - main - pf: honor quick on anchor rules List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b168cac06613733c56e59edc6afc8388d60e203e Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b168cac06613733c56e59edc6afc8388d60e203e commit b168cac06613733c56e59edc6afc8388d60e203e Author: Kristof Provost AuthorDate: 2025-06-30 12:31:24 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:10 +0000 pf: honor quick on anchor rules Regression has been introduced in version 1.1024 (a 6.2 time frame). It's been discovered and reported by Fabian Mueller-Knapp. Fair amount of credit goes to kn@, benno@ and henning@ for pointing me to releveant section of pf.conf(5). Fabian and kn@ also did test the patch. OK kn@, henning@ Obtained from: OpenBSD, sashan , 7e89334d42 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index accc811a12ba..04f9f7a9d67d 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4676,10 +4676,11 @@ pf_step_into_anchor(struct pf_test_ctx *ctx, struct pf_krule *r) } else { rv = pf_match_rule(ctx, &r->anchor->ruleset); /* - * Unless there was an error inside the anchor, - * retain its quick state. + * Unless errors occured, stop iff any rule matched + * within quick anchors. */ - if (rv != PF_TEST_FAIL && r->quick == PF_TEST_QUICK) + if (rv != PF_TEST_FAIL && r->quick == PF_TEST_QUICK && + *ctx->am == r) rv = PF_TEST_QUICK; } From nobody Fri Jul 4 09:22:35 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpN0yntz61GX4; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpM61ZJz3pl9; Fri, 04 Jul 2025 09:22:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PFp62aIvPHJaLtxT77Cj7zpaG3R4wMGIy7t+D8Nt3FI=; b=prMcVGakhLP1osy7IBvs1cEuLYU9DjMiq/PkQ4pkD2QU6NOuSN4Jp2bNGPDi6jrern5wol hlwJZXGyCISfkHy8vX9uBkKhpLJaFRseuDlh3lxVJgxhWJYoeRRhrgcfpo0uQAkzU5kgYA Yon97+VGWO3eLUg8VFX6HJPRc+XlxfppAvYyKVyJvFnsHyBNU2w7WSOPwK4csuQ961TLCW fpoJo9jSzKb8jegwBPOvSw46cZKMSQ9Onx94ciuvfx8B4we+FuUWrwlKk7tdKCpGn3oa0U DU6bNJgBoWoDWkMzkI76skHoQaE2cW73yzx2MPKuPJ/MXJXkRLJYzn+hSR4VUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PFp62aIvPHJaLtxT77Cj7zpaG3R4wMGIy7t+D8Nt3FI=; b=um/tHCuchgzMBhWDH1DiuEMiIplXHpFvxOWrnOcAyDKnuULFQOUe/chmBF418F9IszE0Nx nWOa7epD4cJ2Y4Wfhf2REgfYXO3ElR8m87jC/c9b9dxP7lktPmJR/g1R9E1mQ+s8/Ibxam 92UuZLhyVnZbtClVp+ZFGtWzX6uufZLcd/RXG6Vlx3K24o2Bw6mrXSUNNFCP68Kr4wdvpC KyshPPy9nPL56gILRaVI+N8i3BR4GKKFnMlclYxjM6pBtZR69RuVH4Jzx1mMGGI5qpqsFP gCnnXKoOiVTFiiS/oMgbvpKEfMndXvzf3yUiAmOSGsHt4Al+3u28lbnU8fcROw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620955; a=rsa-sha256; cv=none; b=rTGpwe4nl8ukWGyZ87EKKSA8XZNMCkvd9ZVfOLaT2Wn9wJTDlZqstwpzpPmRvBKbzOWSMa j6YgG1SLPwMINMMNTH8FpwknlEys8foiWDM8woR7Y6LRXbPUziD2qtV/S5EOji9+YVlSk0 HZDwWS6lYyhipbVcaB2CpAFclyEo/KYPLsbvRAG+XL5v+piW1Nnhe4Fp3M5kbArGylmHnB AA/VWierLWs3DrO63WmOaYTFUYRzQwr/Wl18b3Bsrv9ACQZapSc6BwGUa76iGASPzLoWZr MlnaaDvSYILYJDo7K8lQQkHtITYfeOwilk6fl3fY9iv+hRYGFuqHdaMSCHdEdg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpM5cQMzlGP; Fri, 04 Jul 2025 09:22:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MZQP055680; Fri, 4 Jul 2025 09:22:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MZQ3055677; Fri, 4 Jul 2025 09:22:35 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:35 GMT Message-Id: <202507040922.5649MZQ3055677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7d5d1fae2854 - main - pfctl: odd condition/test in PF lexer List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d5d1fae28541034423763313cca61fa6ed15ae2 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7d5d1fae28541034423763313cca61fa6ed15ae2 commit 7d5d1fae28541034423763313cca61fa6ed15ae2 Author: Kristof Provost AuthorDate: 2025-06-30 12:55:38 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:11 +0000 pfctl: odd condition/test in PF lexer This commit rectifies earlier change: in the lex... even inside quotes, a \ followed by space or tab should expand to space or tab, and a \ followed by newline should be ignored (as a line continuation). compatible with the needs of hoststated (which has the most strict quoted string requirements), and ifstated (where one commonly does line continuations in strings). OK deraadt@, OK millert@ Obtained from: OpenBSD, sashan , a153335958 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index c939b5ae7cce..beff11bebf69 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -6854,7 +6854,8 @@ top: } else if (c == '\\') { if ((next = lgetc(quotec)) == EOF) return (0); - if (next == quotec || c == ' ' || c == '\t') + if (next == quotec || next == ' ' || + next == '\t') c = next; else if (next == '\n') { file->lineno++; From nobody Fri Jul 4 09:22:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpP2GqSz61Gb0; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpP03RHz3plB; Fri, 04 Jul 2025 09:22:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VjYjJZkArLXNY67CpVq1F9MBoE1FFVmMAeXYuEF7lKg=; b=l9w5PeRrRn2lup2fl6JJRXo/AMPThLkRUZt9DAqinVyzVxUdllrAaSeoemzjJqN8iNpAKr kH/OQMYTySFUOLJQ1vqkn84cFdNsrKRLMYwno6m2UFBKxH1OeXzZFpsjAex0Xd7dnbRos4 3m4scgOq28p+ADvt9mGZKYHdwiLw9A65SAVHa15cN24AZYciC5Nzg07mCnbGzcoZq2VzqF 2M8wTI0T56BBrUS/pB3RMC2UJT0FQqDxGJ8Ts9g34COEzyL8jzVtuXW1jGPKur/GJhosSm ofKwGaQG2+jm98d57bgLp8TWfhj6pLDqRe47bJtXA8yddBvdd0bjW2ZqbnRzWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VjYjJZkArLXNY67CpVq1F9MBoE1FFVmMAeXYuEF7lKg=; b=dZ80ChsoGp3BpRr2x3n1yr3om8TPI8P1XgNqIBWrDHrHMVohZVDYY8648SMJOewWQUdWNL vjZwSeWoJiCyabhv7L1awAGT3SUpURIn57ytBJluOGdWQAvSE1AKMzj0lxL/QjLM2ggwQQ jUoeb7QdipVq9DAAhtwy3IfEUzkWciIx5TyoyP88zhwRJPfGOD5+7PIiL7tMTVABgm5fkh O2Udd6XaHhp7PCIenuEQYQJh/Xlq91Mug+QlxQwHp42SyXJx6vcP0wmzp+eYWFkt7rWoCt CA7er9x9mYjkOGHrBqF/CHX556ccKiAUPd8/1Cy237VujI+aD+Qi3mIr6kEpgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620957; a=rsa-sha256; cv=none; b=IuZH/Q1u/p1YY/KYc8gDD1Thoxj7MHgjQPA1TswRdbBQGq9kefzKNbmTAaKq+Emx+axBdy Ps6aanuF/M7WZKg00GqjFg0RAaCKnmWFjSBgdQSRvaGK7+bOqDoutO2A5IiU/bzJGafDp2 4QYLdRd9on9+e/Xgup/8hDwpVVKdrXcfzjStxfBzBxQ4iJ1eahdA1Ljjsoc1ZSqHq+xCuP LsFVkmH5nhKld7YDybLDdu0GIBTTylUucBSXgmB706g2DNbichah05NAuiMzed1ZqyclJq lF1eZEY+FWaDOqKqogQcGFlH3/30nEYZXhLbqc2+nabQmeyk0uACnJRKnUFkOQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpN6YtdzlGQ; Fri, 04 Jul 2025 09:22:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MaYK055714; Fri, 4 Jul 2025 09:22:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MaT4055711; Fri, 4 Jul 2025 09:22:36 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:36 GMT Message-Id: <202507040922.5649MaT4055711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: f78c18a7ac9e - main - pfctl: sync cmdline_symset() changes with src/usr.sbin List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f78c18a7ac9ebb5079ad4afebd248881e3672ed2 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f78c18a7ac9ebb5079ad4afebd248881e3672ed2 commit f78c18a7ac9ebb5079ad4afebd248881e3672ed2 Author: Kristof Provost AuthorDate: 2025-06-30 16:29:01 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:11 +0000 pfctl: sync cmdline_symset() changes with src/usr.sbin OK sashan@ claudio@ Obtained from: OpenBSD, miko , 22023c0153 Obtained from: OpenBSD, kn , d0f238ef32 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index beff11bebf69..c59204d3d5a4 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -7150,11 +7150,10 @@ pfctl_cmdline_symset(char *s) if ((val = strrchr(s, '=')) == NULL) return (-1); - if ((sym = malloc(strlen(s) - strlen(val) + 1)) == NULL) + sym = strndup(s, val - s); + if (sym == NULL) err(1, "%s: malloc", __func__); - strlcpy(sym, s, strlen(s) - strlen(val) + 1); - ret = symset(sym, val + 1, 1); free(sym); From nobody Fri Jul 4 09:22:37 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpQ2dT4z61GX8; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpQ0v5Nz3pnt; Fri, 04 Jul 2025 09:22:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GtXlrJXuelmwZjpXbrQhlQzuEL7uitvyhdXQkty9DAQ=; b=O7ElY72WqC2wJ1FJeR9qcdXcfWETeV7e3YeELYNFjd/SqsJYm79BQUxRJk2LiMNRV2MB9X rXkfUJ4jwtAA5fCMPP4bK2cbXOKB7rZVOANdo1SK++tsfEC0fKZ6P4XJUXC5XeE6AGVH1H rwKNq2VuvPDcXt1EyeGeHGNusYCVax2DuIzyVemMUY8VHeDKMQunw6JDvyUc4VdRKtQi2Y Sz/oIAEJISdfkCe6b9d93L11kDqiT3jc726nYOZ/Sy9PEHvMiEtEc3vIYeIRFm1n4oUBae UnEnctNDKTEXXR7PemQgqp97mMTw6Rwymp9uDLNpJbEZdWGUAoNRs/cEOn1HYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GtXlrJXuelmwZjpXbrQhlQzuEL7uitvyhdXQkty9DAQ=; b=mtQXo55HiZhww51k1aDTn7Qn9Xnk/fQR1sf1IMq6DtyMGTEUKMD59s1eujslm27tozP7AB HHdBkmAH9AQjOVjDJIUC0/IJnFZfHG5C1DRJkk97X1e4ZRHrfEMzWLRgvaXOJTC/hhAqsp shwIxzWO9PcWekDjuYnDXJEK/MXbZ+JvwPq/idehvq7QxasIcZKJmXNZEJydkngd+UzJxx Dthnoy5YC2CP/sCMNLt6M7xeK2qBAU5Itl8F4A5ggMNk/ZQxMnHl4cXRXqlHNmIVDzTreY 9AkLj4vOabnbZPRXeictFz01SAKkOKJN8nvamSbP5vgorsjXuHKuxsw8i7YBcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620958; a=rsa-sha256; cv=none; b=S/yI5JvoYkOM9yCkflS7ZV7TQ1xI9DWlxXo4w7tB2+6pmzB3rg4muBNv35zxsnuaY97xjL ezKmLAbxKTtI3o7xTpjgXZKqVrhKX5Bcd5xKcRCVMzZ/OIkSjNr8GQaaZc2FH6pNIXR6I1 L6KKxna7McD+IMAN1QXm1VlFohbSxRivxyv5XZvEvCwzyzByeUVjzy1p961uAtRaRWNv5U 7Ml7XH42LSnbsB0EyxxWyA3RPxf5tNIqqw9EiiauHzACn5m8r3D7qvJsXP8vLtuFVbopv4 OjAUqrQY0lrDF+JqELmyA8BtdIK/PUfRvsy9LxBwicM5E9tGC21XbTV/Pcru9g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpQ0PJyzlS2; Fri, 04 Jul 2025 09:22:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649Mbir055748; Fri, 4 Jul 2025 09:22:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649Mbkx055745; Fri, 4 Jul 2025 09:22:37 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:37 GMT Message-Id: <202507040922.5649Mbkx055745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 9ec47b79c10e - main - pf: replace hardcoded function names by __func__ List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ec47b79c10e149a47bb8533eeadeebb85a3110c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9ec47b79c10e149a47bb8533eeadeebb85a3110c commit 9ec47b79c10e149a47bb8533eeadeebb85a3110c Author: Kristof Provost AuthorDate: 2025-06-30 16:34:09 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:11 +0000 pf: replace hardcoded function names by __func__ Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ruleset.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 865c5ecd72d9..33527645e6e7 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -259,8 +259,8 @@ pf_create_kanchor(struct pf_kanchor *parent, const char *aname) if ((dup = RB_INSERT(pf_kanchor_global, &V_pf_anchors, anchor)) != NULL) { - printf("pf_find_or_create_ruleset: RB_INSERT1 " - "'%s' '%s' collides with '%s' '%s'\n", + printf("%s: RB_INSERT1 " + "'%s' '%s' collides with '%s' '%s'\n", __func__, anchor->path, anchor->name, dup->path, dup->name); rs_free(anchor); return (NULL); @@ -270,10 +270,10 @@ pf_create_kanchor(struct pf_kanchor *parent, const char *aname) anchor->parent = parent; if ((dup = RB_INSERT(pf_kanchor_node, &parent->children, anchor)) != NULL) { - printf("pf_find_or_create_ruleset: " + printf("%s: " "RB_INSERT2 '%s' '%s' collides with " - "'%s' '%s'\n", anchor->path, anchor->name, - dup->path, dup->name); + "'%s' '%s'\n", __func__, anchor->path, + anchor->name, dup->path, dup->name); RB_REMOVE(pf_kanchor_global, &V_pf_anchors, anchor); rs_free(anchor); @@ -444,7 +444,7 @@ pf_kanchor_copyout(const struct pf_kruleset *rs, const struct pf_krule *r, anchor_call_len); } if (strncmp(a, r->anchor->path, strlen(a))) { - printf("pf_anchor_copyout: '%s' '%s'\n", a, + printf("%s: '%s' '%s'\n", __func__, a, r->anchor->path); return (1); } @@ -530,7 +530,7 @@ pf_kanchor_remove(struct pf_krule *r) if (r->anchor == NULL) return; if (r->anchor->refcnt <= 0) { - printf("pf_anchor_remove: broken refcount\n"); + printf("%s: broken refcount\n", __func__); r->anchor = NULL; return; } From nobody Fri Jul 4 09:22:39 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpR5Dsnz61GXD; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpR212Yz3pg2; Fri, 04 Jul 2025 09:22:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fOUrQMxYqwn+8no/MXdAbe6zWODTpZbzdvfe4Wj8ZNE=; b=k+XBx+bj68/E8G5QKJeu0fc6MXLJY+d29zjYyfftRi/EMv/gUmNUiqAKuc2SwdHvWdFaI3 i5iyzFoGtWimplcWFoEAzYZY0PaFDaUhPS/sDwL+pKS6qUOLSk+r0tIAn9G1IwZv14IR6h kGZoN2/1JSgetIQUQKIXNS1tI4KyevoxPyC4CD+qvLJL9rMpRZenQhyAWOgxPP+03d6JpF KppWk5NZ19s3TQyzqzXGOA6P9IEouEIn60+9OPu3H3c3zOIp5RJh+ECggL5VdYjtFO9qhB CRAtZSyKqElQNoCNtSghQx9t70MVVr38u1j9zKZHwlO4t8+yADfDI/gHSGtTfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fOUrQMxYqwn+8no/MXdAbe6zWODTpZbzdvfe4Wj8ZNE=; b=d8UPKmsAyU+3m7vsImXYeTNaedbhGePZJO7rBqkH2EdA5vSLlDEYGTZGdy7JSDqHYtlinZ fa5pwEc1vIfmfzxUsE3EATwAGUgIVtULqW/mHedkNaX0FjzitjhTiioWfZykI5ai0E5ywk YSesEc2dc5Tq5bZ+VSAW9K0sa5jkYdZY7HHmdMLfM7EF+X5zOWEGoc9gEvUcuIRb7h9MMe QFma3wabq8IAN6v0Z50HifSaa/4uujfQt41JWYy8nET56e0AqjtpGqfxN5WikUyWu1ReHq K3WvIJThnuvlcCN7KeHbS8egyAMaAY01UBWY/GCzwxWq4foiH6EM/PXPV5rlvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620959; a=rsa-sha256; cv=none; b=dn7tV8jj7CEnPHlGMRDI3mI8doyh+alqrCyIWxiai/7ShIqZt7mFU5DsFJosx50YFMLM69 yo+Jb9TlZbHGpoY5OyZZGrTfTmbJnakQDiBFKTTXdzFqjy8eft7xxRvLioQnh4rEXY91FT iBHz4nLS7doJktYPu3nWzMYTt1UeFluTUnlgxPKUfwzfk6j3aDJq+EnclwWkVFObTE5nzJ mYQq4f7tp8sjPyvhPHDGHw1Bc/Sm8mXK/QZyn2f0pMKzJJ41U6C4u8BAXKQ61tlRY/t1Mg 5M0SWm+iXO6vnYpanpS4Hd2XqMFiryTLPT5Xo8aKohym+VCOO6+TelhgeUklQw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpR1MwbzlQ6; Fri, 04 Jul 2025 09:22:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MdQj055788; Fri, 4 Jul 2025 09:22:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MdKW055785; Fri, 4 Jul 2025 09:22:39 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:39 GMT Message-Id: <202507040922.5649MdKW055785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 614ae218ca22 - main - pf: pf_create_kanchor() can be static List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 614ae218ca22997f9d8f079b1949eb35f0ab6902 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=614ae218ca22997f9d8f079b1949eb35f0ab6902 commit 614ae218ca22997f9d8f079b1949eb35f0ab6902 Author: Kristof Provost AuthorDate: 2025-06-30 16:35:31 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:11 +0000 pf: pf_create_kanchor() can be static Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 1 - sys/netpfil/pf/pf_ruleset.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 71cb1862aabf..97a70db97b71 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -2678,7 +2678,6 @@ void pf_kanchor_remove(struct pf_krule *); void pf_remove_if_empty_kruleset(struct pf_kruleset *); struct pf_kruleset *pf_find_kruleset(const char *); struct pf_kruleset *pf_get_leaf_kruleset(char *, char **); -struct pf_kanchor *pf_create_kanchor(struct pf_kanchor *, const char *); struct pf_kruleset *pf_find_or_create_kruleset(const char *); void pf_rs_initialize(void); diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 33527645e6e7..0414e4f06f9c 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -232,7 +232,7 @@ pf_get_leaf_kruleset(char *path, char **path_remainder) return (ruleset); } -struct pf_kanchor * +static struct pf_kanchor * pf_create_kanchor(struct pf_kanchor *parent, const char *aname) { struct pf_kanchor *anchor, *dup; From nobody Fri Jul 4 09:22:40 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpT2yBgz61GfN; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpS34SZz3pLn; Fri, 04 Jul 2025 09:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4F2MIINg+88twoP3g3nVLPNaO2vN3D2ZcTZHacfsEQE=; b=x79iFV8NGKmBTKQ3svBgoz7IBfm8JJOitTKFMMIZ+GfqvTZznhZJyZwGv0Gv2+GB2Jrf4+ WbYtczuAjJ+yyDWmsP4B0G9rw6mdNOlglvZAjdfDoH9tX/SguwGE1t9LeUJfwE4BmLjHwj tsfZ5LjFO1o7ZEAFF8PLc1CaM5XXSrBghPCa+4VvYHRU9yD2Xb/Mfp4Wd2BrD8+MUaBmyA nAOxR66oviPeuWVzt3I9Ml6cKZCTfmbOObuE49L2nksgJQijMCdzFaza0sKdTHoTMTTgTq F/f2/Gs7yGKWTBf42bmzAqGHahf6o6VQbE4VHRLNwlc1VWWfl1kQarO6w/raHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4F2MIINg+88twoP3g3nVLPNaO2vN3D2ZcTZHacfsEQE=; b=YjutUpRfHpril6Vm5k6S7HcHs4+NWUiNns9y2xraHIOpYX+m5LsXswfr65eeQDjyjlC6jk oA4fcmu197DTa/9oxxZ/rvPt+4ca6hcX3QoYFWk6WLmmPWm1Y1bH8Y/lNam+Ei3JI60b2k u5FSyMqmhGGVGeXMK7mJTFv+bUVW3cO9S+f2yzO+cly2Hou3Vu0Mi+0wPoxGlO9hAfhe6c T+A6kDPS2iTXxRgNfV5gnvTkj7y9xkDgqLVjIvtfZmu7XvDIUjZLw6Z5PCLihxq018rzO3 DMzTaffT4k50xs4JvqRwBCyOJH2lMDNyssBlS8D38k78PvZXSiOB8QlwMyGyvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620960; a=rsa-sha256; cv=none; b=G0DxQZKrg0xzH+VjVLUnviSrs5B02W2WdaUgL+c/qaErE6lfe4nIZ+T0eTyDmyKOrrpCh5 44HOI4CIRNE2ZSD7HqEGRXggIwdfGm20LhEwifAw/KZMV3HxLQ4f+leSpXsse7OEFQzU8a Rq7cWjfa5bQrwL/wVAYf4KcegcRtqM81Qn1GZHJOqdmzbakjo2WPJOs/NZsTw2l96kCzD6 ps7hUV7tTjU3rn55UrkWHmtF7ZunUsv0LkQhC/6HNF+iCqze++BbdiToBAFon8oP/x1/MD AbDtnFgDoyueWT+md1lIshUCMHQ1w/2ssgDA55+5LTjorxpWo0B4Jc0eEqr3Aw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpS29BHzlBF; Fri, 04 Jul 2025 09:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MeZL055822; Fri, 4 Jul 2025 09:22:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649Me1Y055819; Fri, 4 Jul 2025 09:22:40 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:40 GMT Message-Id: <202507040922.5649Me1Y055819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 58571f3ea37c - main - pf: Remove useless macros List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 58571f3ea37c3e5019d39591aa09c1723c00face Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=58571f3ea37c3e5019d39591aa09c1723c00face commit 58571f3ea37c3e5019d39591aa09c1723c00face Author: Kristof Provost AuthorDate: 2025-06-30 16:56:12 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:11 +0000 pf: Remove useless macros These are just unhelpful case conversion. OK sashan henning Obtained from: OpenBSD, kn , 492cf6614c Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 51 ++------------ sys/netpfil/pf/pf.c | 166 +++++++++++++++++++++++++--------------------- sys/netpfil/pf/pf_if.c | 4 +- sys/netpfil/pf/pf_ioctl.c | 32 +++++---- sys/netpfil/pf/pf_lb.c | 67 ++++++++++--------- sys/netpfil/pf/pf_nl.c | 4 +- sys/netpfil/pf/pf_table.c | 16 ++--- 7 files changed, 160 insertions(+), 180 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 97a70db97b71..028297310d7b 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -508,18 +508,6 @@ extern struct sx pf_end_lock; (c == AF_INET6 && !(a)->addr32[0] && !(a)->addr32[1] && \ !(a)->addr32[2] && !(a)->addr32[3] )) \ -#define PF_MATCHA(n, a, m, b, f) \ - pf_match_addr(n, a, m, b, f) - -#define PF_ACPY(a, b, f) \ - pf_addrcpy(a, b, f) - -#define PF_AINC(a, f) \ - pf_addr_inc(a, f) - -#define PF_POOLMASK(a, b, c, d, f) \ - pf_poolmask(a, b, c, d, f) - #else /* Just IPv6 */ @@ -544,18 +532,6 @@ extern struct sx pf_end_lock; !(a)->addr32[2] && \ !(a)->addr32[3] ) \ -#define PF_MATCHA(n, a, m, b, f) \ - pf_match_addr(n, a, m, b, f) - -#define PF_ACPY(a, b, f) \ - pf_addrcpy(a, b, f) - -#define PF_AINC(a, f) \ - pf_addr_inc(a, f) - -#define PF_POOLMASK(a, b, c, d, f) \ - pf_poolmask(a, b, c, d, f) - #else /* Just IPv4 */ @@ -570,29 +546,11 @@ extern struct sx pf_end_lock; #define PF_AZERO(a, c) \ (!(a)->addr32[0]) -#define PF_MATCHA(n, a, m, b, f) \ - pf_match_addr(n, a, m, b, f) - -#define PF_ACPY(a, b, f) \ - (a)->v4.s_addr = (b)->v4.s_addr - -#define PF_AINC(a, f) \ - do { \ - (a)->addr32[0] = htonl(ntohl((a)->addr32[0]) + 1); \ - } while (0) - -#define PF_POOLMASK(a, b, c, d, f) \ - do { \ - (a)->addr32[0] = ((b)->addr32[0] & (c)->addr32[0]) | \ - (((c)->addr32[0] ^ 0xffffffff ) & (d)->addr32[0]); \ - } while (0) - #endif /* PF_INET_ONLY */ #endif /* PF_INET6_ONLY */ #endif /* PF_INET_INET6 */ #ifdef _KERNEL -#ifdef INET6 static void inline pf_addrcpy(struct pf_addr *dst, const struct pf_addr *src, sa_family_t af) { @@ -602,12 +560,13 @@ pf_addrcpy(struct pf_addr *dst, const struct pf_addr *src, sa_family_t af) memcpy(&dst->v4, &src->v4, sizeof(dst->v4)); break; #endif /* INET */ +#ifdef INET6 case AF_INET6: memcpy(&dst->v6, &src->v6, sizeof(dst->v6)); break; +#endif /* INET6 */ } } -#endif /* INET6 */ #endif /* @@ -629,7 +588,7 @@ pf_addrcpy(struct pf_addr *dst, const struct pf_addr *src, sa_family_t af) &(aw)->v.a.mask, (x), (af))) || \ ((aw)->type == PF_ADDR_ADDRMASK && \ !PF_AZERO(&(aw)->v.a.mask, (af)) && \ - !PF_MATCHA(0, &(aw)->v.a.addr, \ + !pf_match_addr(0, &(aw)->v.a.addr, \ &(aw)->v.a.mask, (x), (af))))) != \ (neg) \ ) @@ -2477,11 +2436,11 @@ int pf_test(sa_family_t, int, int, struct ifnet *, struct mbuf **, struct inpcb int pf_normalize_ip(u_short *, struct pf_pdesc *); #endif /* INET */ -#ifdef INET6 -int pf_normalize_ip6(int, u_short *, struct pf_pdesc *); void pf_poolmask(struct pf_addr *, struct pf_addr*, struct pf_addr *, struct pf_addr *, sa_family_t); void pf_addr_inc(struct pf_addr *, sa_family_t); +#ifdef INET6 +int pf_normalize_ip6(int, u_short *, struct pf_pdesc *); int pf_max_frag_size(struct mbuf *); int pf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *, struct ifnet *, bool); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 04f9f7a9d67d..127b29320acb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -682,7 +682,8 @@ pf_packet_rework_nat(struct pf_pdesc *pd, int off, struct pf_state_key *nk) 0); break; case AF_INET6: - PF_ACPY(pd->src, &nk->addr[pd->sidx], pd->af); + pf_addrcpy(pd->src, &nk->addr[pd->sidx], + pd->af); break; default: unhandled_af(pd->af); @@ -696,7 +697,8 @@ pf_packet_rework_nat(struct pf_pdesc *pd, int off, struct pf_state_key *nk) 0); break; case AF_INET6: - PF_ACPY(pd->dst, &nk->addr[pd->didx], pd->af); + pf_addrcpy(pd->dst, &nk->addr[pd->didx], + pd->af); break; default: unhandled_af(pd->af); @@ -1084,9 +1086,9 @@ pf_insert_src_node(struct pf_ksrc_node *sns[PF_SN_MAX], (*sn)->af = af; (*sn)->rule = r_track; - PF_ACPY(&(*sn)->addr, src, af); + pf_addrcpy(&(*sn)->addr, src, af); if (raddr != NULL) - PF_ACPY(&(*sn)->raddr, raddr, af); + pf_addrcpy(&(*sn)->raddr, raddr, af); (*sn)->rkif = rkif; LIST_INSERT_HEAD(&(*sh)->nodes, *sn, entry); (*sn)->creation = time_uptime; @@ -1687,9 +1689,9 @@ pf_state_key_addr_setup(struct pf_pdesc *pd, copy: #endif /* INET6 */ if (saddr) - PF_ACPY(&key->addr[pd->sidx], saddr, pd->af); + pf_addrcpy(&key->addr[pd->sidx], saddr, pd->af); if (daddr) - PF_ACPY(&key->addr[pd->didx], daddr, pd->af); + pf_addrcpy(&key->addr[pd->didx], daddr, pd->af); return (0); } @@ -1734,13 +1736,17 @@ pf_state_key_setup(struct pf_pdesc *pd, u_int16_t sport, u_int16_t dport, bzero(&(*nk)->addr[0], sizeof((*nk)->addr[0])); bzero(&(*nk)->addr[1], sizeof((*nk)->addr[1])); if (pd->dir == PF_IN) { - PF_ACPY(&(*nk)->addr[pd->didx], &pd->nsaddr, pd->naf); - PF_ACPY(&(*nk)->addr[pd->sidx], &pd->ndaddr, pd->naf); + pf_addrcpy(&(*nk)->addr[pd->didx], &pd->nsaddr, + pd->naf); + pf_addrcpy(&(*nk)->addr[pd->sidx], &pd->ndaddr, + pd->naf); (*nk)->port[pd->didx] = pd->nsport; (*nk)->port[pd->sidx] = pd->ndport; } else { - PF_ACPY(&(*nk)->addr[pd->sidx], &pd->nsaddr, pd->naf); - PF_ACPY(&(*nk)->addr[pd->didx], &pd->ndaddr, pd->naf); + pf_addrcpy(&(*nk)->addr[pd->sidx], &pd->nsaddr, + pd->naf); + pf_addrcpy(&(*nk)->addr[pd->didx], &pd->ndaddr, + pd->naf); (*nk)->port[pd->sidx] = pd->nsport; (*nk)->port[pd->didx] = pd->ndport; } @@ -2053,11 +2059,11 @@ pf_udp_mapping_create(sa_family_t af, struct pf_addr *src_addr, uint16_t src_por mapping = uma_zalloc(V_pf_udp_mapping_z, M_NOWAIT | M_ZERO); if (mapping == NULL) return (NULL); - PF_ACPY(&mapping->endpoints[0].addr, src_addr, af); + pf_addrcpy(&mapping->endpoints[0].addr, src_addr, af); mapping->endpoints[0].port = src_port; mapping->endpoints[0].af = af; mapping->endpoints[0].mapping = mapping; - PF_ACPY(&mapping->endpoints[1].addr, nat_addr, af); + pf_addrcpy(&mapping->endpoints[1].addr, nat_addr, af); mapping->endpoints[1].port = nat_port; mapping->endpoints[1].af = af; mapping->endpoints[1].mapping = mapping; @@ -3295,9 +3301,9 @@ pf_change_ap(struct pf_pdesc *pd, struct pf_addr *a, u_int16_t *p, MPASS(pd->ip_sum); } - PF_ACPY(&ao, a, pd->af); + pf_addrcpy(&ao, a, pd->af); if (pd->af == pd->naf) - PF_ACPY(a, an, pd->af); + pf_addrcpy(a, an, pd->af); if (pd->m->m_pkthdr.csum_flags & (CSUM_DELAY_DATA | CSUM_DELAY_DATA_IPV6)) *pd->pcksum = ~*pd->pcksum; @@ -3426,8 +3432,8 @@ pf_change_a6(struct pf_addr *a, u_int16_t *c, struct pf_addr *an, u_int8_t u) { struct pf_addr ao; - PF_ACPY(&ao, a, AF_INET6); - PF_ACPY(a, an, AF_INET6); + pf_addrcpy(&ao, a, AF_INET6); + pf_addrcpy(a, an, AF_INET6); *c = pf_cksum_fixup(pf_cksum_fixup(pf_cksum_fixup( pf_cksum_fixup(pf_cksum_fixup(pf_cksum_fixup( @@ -3450,9 +3456,9 @@ pf_change_icmp(struct pf_addr *ia, u_int16_t *ip, struct pf_addr *oa, { struct pf_addr oia, ooa; - PF_ACPY(&oia, ia, af); + pf_addrcpy(&oia, ia, af); if (oa) - PF_ACPY(&ooa, oa, af); + pf_addrcpy(&ooa, oa, af); /* Change inner protocol port, fix inner protocol checksum. */ if (ip != NULL) { @@ -3469,7 +3475,7 @@ pf_change_icmp(struct pf_addr *ia, u_int16_t *ip, struct pf_addr *oa, *ic = pf_cksum_fixup(*ic, opc, *pc, 0); } /* Change inner ip address, fix inner ip and icmp checksums. */ - PF_ACPY(ia, na, af); + pf_addrcpy(ia, na, af); switch (af) { #ifdef INET case AF_INET: { @@ -3503,7 +3509,7 @@ pf_change_icmp(struct pf_addr *ia, u_int16_t *ip, struct pf_addr *oa, } /* Outer ip address, fix outer ip or icmpv6 checksum, if necessary. */ if (oa) { - PF_ACPY(oa, na, af); + pf_addrcpy(oa, na, af); switch (af) { #ifdef INET case AF_INET: @@ -4299,8 +4305,8 @@ pf_undo_nat(struct pf_krule *nr, struct pf_pdesc *pd, uint16_t bip_sum) { /* undo NAT changes, if they have taken place */ if (nr != NULL) { - PF_ACPY(pd->src, &pd->osrc, pd->af); - PF_ACPY(pd->dst, &pd->odst, pd->af); + pf_addrcpy(pd->src, &pd->osrc, pd->af); + pf_addrcpy(pd->dst, &pd->odst, pd->af); if (pd->sport) *pd->sport = pd->osport; if (pd->dport) @@ -4791,7 +4797,6 @@ pf_step_out_of_keth_anchor(struct pf_keth_anchor_stackframe *stack, int *depth, return (quick); } -#ifdef INET6 void pf_poolmask(struct pf_addr *naddr, struct pf_addr *raddr, struct pf_addr *rmask, struct pf_addr *saddr, sa_family_t af) @@ -4803,6 +4808,7 @@ pf_poolmask(struct pf_addr *naddr, struct pf_addr *raddr, ((rmask->addr32[0] ^ 0xffffffff ) & saddr->addr32[0]); break; #endif /* INET */ +#ifdef INET6 case AF_INET6: naddr->addr32[0] = (raddr->addr32[0] & rmask->addr32[0]) | ((rmask->addr32[0] ^ 0xffffffff ) & saddr->addr32[0]); @@ -4813,6 +4819,7 @@ pf_poolmask(struct pf_addr *naddr, struct pf_addr *raddr, naddr->addr32[3] = (raddr->addr32[3] & rmask->addr32[3]) | ((rmask->addr32[3] ^ 0xffffffff ) & saddr->addr32[3]); break; +#endif /* INET6 */ } } @@ -4825,6 +4832,7 @@ pf_addr_inc(struct pf_addr *addr, sa_family_t af) addr->addr32[0] = htonl(ntohl(addr->addr32[0]) + 1); break; #endif /* INET */ +#ifdef INET6 case AF_INET6: if (addr->addr32[3] == 0xffffffff) { addr->addr32[3] = 0; @@ -4844,9 +4852,9 @@ pf_addr_inc(struct pf_addr *addr, sa_family_t af) addr->addr32[3] = htonl(ntohl(addr->addr32[3]) + 1); break; +#endif /* INET6 */ } } -#endif /* INET6 */ void pf_rule_to_actions(struct pf_krule *r, struct pf_rule_actions *a) @@ -5745,8 +5753,8 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, ctx.reason = *reason; SLIST_INIT(&ctx.rules); - PF_ACPY(&pd->nsaddr, pd->src, pd->af); - PF_ACPY(&pd->ndaddr, pd->dst, pd->af); + pf_addrcpy(&pd->nsaddr, pd->src, pd->af); + pf_addrcpy(&pd->ndaddr, pd->dst, pd->af); if (inp != NULL) { INP_LOCK_ASSERT(inp); @@ -6364,7 +6372,7 @@ pf_translate_compat(struct pf_test_ctx *ctx) &nk->addr[pd->sidx], nk->port[pd->sidx]); pd->sport = &th->th_sport; pd->nsport = th->th_sport; - PF_ACPY(&pd->nsaddr, pd->src, pd->af); + pf_addrcpy(&pd->nsaddr, pd->src, pd->af); } if (PF_ANEQ(&pd->ndaddr, &nk->addr[pd->didx], pd->af) || @@ -6373,7 +6381,7 @@ pf_translate_compat(struct pf_test_ctx *ctx) &nk->addr[pd->didx], nk->port[pd->didx]); pd->dport = &th->th_dport; pd->ndport = th->th_dport; - PF_ACPY(&pd->ndaddr, pd->dst, pd->af); + pf_addrcpy(&pd->ndaddr, pd->dst, pd->af); } rewrite++; break; @@ -6386,7 +6394,7 @@ pf_translate_compat(struct pf_test_ctx *ctx) nk->port[pd->sidx]); pd->sport = &pd->hdr.udp.uh_sport; pd->nsport = pd->hdr.udp.uh_sport; - PF_ACPY(&pd->nsaddr, pd->src, pd->af); + pf_addrcpy(&pd->nsaddr, pd->src, pd->af); } if (PF_ANEQ(&pd->ndaddr, &nk->addr[pd->didx], pd->af) || @@ -6397,7 +6405,7 @@ pf_translate_compat(struct pf_test_ctx *ctx) nk->port[pd->didx]); pd->dport = &pd->hdr.udp.uh_dport; pd->ndport = pd->hdr.udp.uh_dport; - PF_ACPY(&pd->ndaddr, pd->dst, pd->af); + pf_addrcpy(&pd->ndaddr, pd->dst, pd->af); } rewrite++; break; @@ -6410,7 +6418,7 @@ pf_translate_compat(struct pf_test_ctx *ctx) nk->port[pd->sidx]); pd->sport = &pd->hdr.sctp.src_port; pd->nsport = pd->hdr.sctp.src_port; - PF_ACPY(&pd->nsaddr, pd->src, pd->af); + pf_addrcpy(&pd->nsaddr, pd->src, pd->af); } if (PF_ANEQ(&pd->ndaddr, &nk->addr[pd->didx], pd->af) || nk->port[pd->didx] != pd->ndport) { @@ -6420,7 +6428,7 @@ pf_translate_compat(struct pf_test_ctx *ctx) nk->port[pd->didx]); pd->dport = &pd->hdr.sctp.dest_port; pd->ndport = pd->hdr.sctp.dest_port; - PF_ACPY(&pd->ndaddr, pd->dst, pd->af); + pf_addrcpy(&pd->ndaddr, pd->dst, pd->af); } break; } @@ -6429,13 +6437,13 @@ pf_translate_compat(struct pf_test_ctx *ctx) if (PF_ANEQ(&pd->nsaddr, &nk->addr[pd->sidx], AF_INET)) { pf_change_a(&pd->src->v4.s_addr, pd->ip_sum, nk->addr[pd->sidx].v4.s_addr, 0); - PF_ACPY(&pd->nsaddr, pd->src, pd->af); + pf_addrcpy(&pd->nsaddr, pd->src, pd->af); } if (PF_ANEQ(&pd->ndaddr, &nk->addr[pd->didx], AF_INET)) { pf_change_a(&pd->dst->v4.s_addr, pd->ip_sum, nk->addr[pd->didx].v4.s_addr, 0); - PF_ACPY(&pd->ndaddr, pd->dst, pd->af); + pf_addrcpy(&pd->ndaddr, pd->dst, pd->af); } if (ctx->virtual_type == htons(ICMP_ECHO) && @@ -6454,13 +6462,13 @@ pf_translate_compat(struct pf_test_ctx *ctx) if (PF_ANEQ(&pd->nsaddr, &nk->addr[pd->sidx], AF_INET6)) { pf_change_a6(pd->src, &pd->hdr.icmp6.icmp6_cksum, &nk->addr[pd->sidx], 0); - PF_ACPY(&pd->nsaddr, pd->src, pd->af); + pf_addrcpy(&pd->nsaddr, pd->src, pd->af); } if (PF_ANEQ(&pd->ndaddr, &nk->addr[pd->didx], AF_INET6)) { pf_change_a6(pd->dst, &pd->hdr.icmp6.icmp6_cksum, &nk->addr[pd->didx], 0); - PF_ACPY(&pd->ndaddr, pd->dst, pd->af); + pf_addrcpy(&pd->ndaddr, pd->dst, pd->af); } rewrite++; break; @@ -6474,7 +6482,7 @@ pf_translate_compat(struct pf_test_ctx *ctx) pf_change_a(&pd->src->v4.s_addr, pd->ip_sum, nk->addr[pd->sidx].v4.s_addr, 0); - PF_ACPY(&pd->nsaddr, pd->src, pd->af); + pf_addrcpy(&pd->nsaddr, pd->src, pd->af); } if (PF_ANEQ(&pd->ndaddr, @@ -6482,7 +6490,7 @@ pf_translate_compat(struct pf_test_ctx *ctx) pf_change_a(&pd->dst->v4.s_addr, pd->ip_sum, nk->addr[pd->didx].v4.s_addr, 0); - PF_ACPY(&pd->ndaddr, pd->dst, pd->af); + pf_addrcpy(&pd->ndaddr, pd->dst, pd->af); } break; #endif /* INET */ @@ -6490,14 +6498,17 @@ pf_translate_compat(struct pf_test_ctx *ctx) case AF_INET6: if (PF_ANEQ(&pd->nsaddr, &nk->addr[pd->sidx], AF_INET6)) { - PF_ACPY(&pd->nsaddr, &nk->addr[pd->sidx], pd->af); - PF_ACPY(pd->src, &nk->addr[pd->sidx], pd->af); + pf_addrcpy(&pd->nsaddr, &nk->addr[pd->sidx], + pd->af); + pf_addrcpy(pd->src, &nk->addr[pd->sidx], pd->af); } if (PF_ANEQ(&pd->ndaddr, &nk->addr[pd->didx], AF_INET6)) { - PF_ACPY(&pd->ndaddr, &nk->addr[pd->didx], pd->af); - PF_ACPY(pd->dst, &nk->addr[pd->didx], pd->af); + pf_addrcpy(&pd->ndaddr, &nk->addr[pd->didx], + pd->af); + pf_addrcpy(pd->dst, &nk->addr[pd->didx], + pd->af); } break; #endif /* INET6 */ @@ -7016,8 +7027,8 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) bzero(&key, sizeof(key)); key.af = pd->af; key.proto = pd->virtual_proto; - PF_ACPY(&key.addr[pd->sidx], pd->src, key.af); - PF_ACPY(&key.addr[pd->didx], pd->dst, key.af); + pf_addrcpy(&key.addr[pd->sidx], pd->src, key.af); + pf_addrcpy(&key.addr[pd->didx], pd->dst, key.af); key.port[pd->sidx] = pd->osport; key.port[pd->didx] = pd->odport; @@ -7208,8 +7219,8 @@ pf_test_state(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) } if (afto) { - PF_ACPY(&pd->nsaddr, &nk->addr[sidx], nk->af); - PF_ACPY(&pd->ndaddr, &nk->addr[didx], nk->af); + pf_addrcpy(&pd->nsaddr, &nk->addr[sidx], nk->af); + pf_addrcpy(&pd->ndaddr, &nk->addr[didx], nk->af); pd->naf = nk->af; action = PF_AFRT; } @@ -7503,13 +7514,13 @@ again: key.af = j->pd.af; key.proto = IPPROTO_SCTP; if (j->pd.dir == PF_IN) { /* wire side, straight */ - PF_ACPY(&key.addr[0], j->pd.src, key.af); - PF_ACPY(&key.addr[1], j->pd.dst, key.af); + pf_addrcpy(&key.addr[0], j->pd.src, key.af); + pf_addrcpy(&key.addr[1], j->pd.dst, key.af); key.port[0] = j->pd.hdr.sctp.src_port; key.port[1] = j->pd.hdr.sctp.dest_port; } else { /* stack side, reverse */ - PF_ACPY(&key.addr[1], j->pd.src, key.af); - PF_ACPY(&key.addr[0], j->pd.dst, key.af); + pf_addrcpy(&key.addr[1], j->pd.src, key.af); + pf_addrcpy(&key.addr[0], j->pd.dst, key.af); key.port[1] = j->pd.hdr.sctp.src_port; key.port[0] = j->pd.hdr.sctp.dest_port; } @@ -7905,8 +7916,10 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, #endif /* INET6 */ } if (afto) { - PF_ACPY(&pd->nsaddr, &nk->addr[sidx], nk->af); - PF_ACPY(&pd->ndaddr, &nk->addr[didx], nk->af); + pf_addrcpy(&pd->nsaddr, &nk->addr[sidx], + nk->af); + pf_addrcpy(&pd->ndaddr, &nk->addr[didx], + nk->af); pd->naf = nk->af; return (PF_AFRT); } @@ -8038,8 +8051,8 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, key.af = pd2.af; key.proto = IPPROTO_TCP; - PF_ACPY(&key.addr[pd2.sidx], pd2.src, key.af); - PF_ACPY(&key.addr[pd2.didx], pd2.dst, key.af); + pf_addrcpy(&key.addr[pd2.sidx], pd2.src, key.af); + pf_addrcpy(&key.addr[pd2.didx], pd2.dst, key.af); key.port[pd2.sidx] = th->th_sport; key.port[pd2.didx] = th->th_dport; @@ -8142,9 +8155,9 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, &nk->addr[didx], pd->af, nk->af)) return (PF_DROP); - PF_ACPY(&pd->nsaddr, &nk->addr[pd2.sidx], - nk->af); - PF_ACPY(&pd->ndaddr, + pf_addrcpy(&pd->nsaddr, + &nk->addr[pd2.sidx], nk->af); + pf_addrcpy(&pd->ndaddr, &nk->addr[pd2.didx], nk->af); if (nk->af == AF_INET) { pd->proto = IPPROTO_ICMP; @@ -8233,8 +8246,8 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, key.af = pd2.af; key.proto = IPPROTO_UDP; - PF_ACPY(&key.addr[pd2.sidx], pd2.src, key.af); - PF_ACPY(&key.addr[pd2.didx], pd2.dst, key.af); + pf_addrcpy(&key.addr[pd2.sidx], pd2.src, key.af); + pf_addrcpy(&key.addr[pd2.didx], pd2.dst, key.af); key.port[pd2.sidx] = uh->uh_sport; key.port[pd2.didx] = uh->uh_dport; @@ -8277,9 +8290,9 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, &nk->addr[didx], pd->af, nk->af)) return (PF_DROP); - PF_ACPY(&pd->nsaddr, + pf_addrcpy(&pd->nsaddr, &nk->addr[pd2.sidx], nk->af); - PF_ACPY(&pd->ndaddr, + pf_addrcpy(&pd->ndaddr, &nk->addr[pd2.didx], nk->af); if (nk->af == AF_INET) { pd->proto = IPPROTO_ICMP; @@ -8365,8 +8378,8 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, key.af = pd2.af; key.proto = IPPROTO_SCTP; - PF_ACPY(&key.addr[pd2.sidx], pd2.src, key.af); - PF_ACPY(&key.addr[pd2.didx], pd2.dst, key.af); + pf_addrcpy(&key.addr[pd2.sidx], pd2.src, key.af); + pf_addrcpy(&key.addr[pd2.didx], pd2.dst, key.af); key.port[pd2.sidx] = sh->src_port; key.port[pd2.didx] = sh->dest_port; @@ -8432,9 +8445,9 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, sh->src_port = nk->port[sidx]; sh->dest_port = nk->port[didx]; m_copyback(pd2.m, pd2.off, sizeof(*sh), (c_caddr_t)sh); - PF_ACPY(&pd->nsaddr, + pf_addrcpy(&pd->nsaddr, &nk->addr[pd2.sidx], nk->af); - PF_ACPY(&pd->ndaddr, + pf_addrcpy(&pd->ndaddr, &nk->addr[pd2.didx], nk->af); if (nk->af == AF_INET) { pd->proto = IPPROTO_ICMP; @@ -8575,9 +8588,9 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, iih->icmp_id = nk->port[iidx]; m_copyback(pd2.m, pd2.off, ICMP_MINLEN, (c_caddr_t)iih); - PF_ACPY(&pd->nsaddr, + pf_addrcpy(&pd->nsaddr, &nk->addr[pd2.sidx], nk->af); - PF_ACPY(&pd->ndaddr, + pf_addrcpy(&pd->ndaddr, &nk->addr[pd2.didx], nk->af); /* * IPv4 becomes IPv6 so we must copy @@ -8703,9 +8716,9 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, iih->icmp6_id = nk->port[iidx]; m_copyback(pd2.m, pd2.off, sizeof(struct icmp6_hdr), (c_caddr_t)iih); - PF_ACPY(&pd->nsaddr, + pf_addrcpy(&pd->nsaddr, &nk->addr[pd2.sidx], nk->af); - PF_ACPY(&pd->ndaddr, + pf_addrcpy(&pd->ndaddr, &nk->addr[pd2.didx], nk->af); pd->naf = nk->af; return (PF_AFRT); @@ -8747,8 +8760,8 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, key.af = pd2.af; key.proto = pd2.proto; - PF_ACPY(&key.addr[pd2.sidx], pd2.src, key.af); - PF_ACPY(&key.addr[pd2.didx], pd2.dst, key.af); + pf_addrcpy(&key.addr[pd2.sidx], pd2.src, key.af); + pf_addrcpy(&key.addr[pd2.didx], pd2.dst, key.af); key.port[0] = key.port[1] = 0; action = pf_find_state(&pd2, &key, state); @@ -9284,7 +9297,8 @@ pf_route6(struct pf_krule *r, struct ifnet *oifp, bzero(&dst, sizeof(dst)); dst.sin6_family = AF_INET6; dst.sin6_len = sizeof(dst); - PF_ACPY((struct pf_addr *)&dst.sin6_addr, &pd->act.rt_addr, AF_INET6); + pf_addrcpy((struct pf_addr *)&dst.sin6_addr, &pd->act.rt_addr, + AF_INET6); if (pd->dir == PF_IN) { if (ip6->ip6_hlim <= IPV6_HLIMDEC) { @@ -10084,8 +10098,8 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, pd->src = (struct pf_addr *)&h->ip_src; pd->dst = (struct pf_addr *)&h->ip_dst; - PF_ACPY(&pd->osrc, pd->src, af); - PF_ACPY(&pd->odst, pd->dst, af); + pf_addrcpy(&pd->osrc, pd->src, af); + pf_addrcpy(&pd->odst, pd->dst, af); pd->ip_sum = &h->ip_sum; pd->tos = h->ip_tos & ~IPTOS_ECN_MASK; pd->ttl = h->ip_ttl; @@ -10122,8 +10136,8 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, h = mtod(pd->m, struct ip6_hdr *); pd->src = (struct pf_addr *)&h->ip6_src; pd->dst = (struct pf_addr *)&h->ip6_dst; - PF_ACPY(&pd->osrc, pd->src, af); - PF_ACPY(&pd->odst, pd->dst, af); + pf_addrcpy(&pd->osrc, pd->src, af); + pf_addrcpy(&pd->odst, pd->dst, af); pd->ip_sum = NULL; pd->tos = IPV6_DSCP(h); pd->ttl = h->ip6_hlim; diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 389b74d09d37..e2200c15c704 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -522,7 +522,7 @@ pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af) case 0: return (0); case 1: - return (PF_MATCHA(0, &dyn->pfid_addr4, + return (pf_match_addr(0, &dyn->pfid_addr4, &dyn->pfid_mask4, a, AF_INET)); default: return (pfr_match_addr(dyn->pfid_kt, a, AF_INET)); @@ -535,7 +535,7 @@ pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af) case 0: return (0); case 1: - return (PF_MATCHA(0, &dyn->pfid_addr6, + return (pf_match_addr(0, &dyn->pfid_addr6, &dyn->pfid_mask6, a, AF_INET6)); default: return (pfr_match_addr(dyn->pfid_kt, a, AF_INET6)); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 05a7e1311ad8..96e913635cd0 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2350,15 +2350,17 @@ relock_DIOCKILLSTATES: if (psk->psk_proto && psk->psk_proto != sk->proto) continue; - if (! PF_MATCHA(psk->psk_src.neg, &psk->psk_src.addr.v.a.addr, + if (! pf_match_addr(psk->psk_src.neg, + &psk->psk_src.addr.v.a.addr, &psk->psk_src.addr.v.a.mask, srcaddr, sk->af)) continue; - if (! PF_MATCHA(psk->psk_dst.neg, &psk->psk_dst.addr.v.a.addr, + if (! pf_match_addr(psk->psk_dst.neg, + &psk->psk_dst.addr.v.a.addr, &psk->psk_dst.addr.v.a.mask, dstaddr, sk->af)) continue; - if (! PF_MATCHA(psk->psk_rt_addr.neg, + if (! pf_match_addr(psk->psk_rt_addr.neg, &psk->psk_rt_addr.addr.v.a.addr, &psk->psk_rt_addr.addr.v.a.mask, &s->act.rt_addr, sk->af)) @@ -2398,10 +2400,10 @@ relock_DIOCKILLSTATES: match_key.af = s->key[idx]->af; match_key.proto = s->key[idx]->proto; - PF_ACPY(&match_key.addr[0], + pf_addrcpy(&match_key.addr[0], &s->key[idx]->addr[1], match_key.af); match_key.port[0] = s->key[idx]->port[1]; - PF_ACPY(&match_key.addr[1], + pf_addrcpy(&match_key.addr[1], &s->key[idx]->addr[0], match_key.af); match_key.port[1] = s->key[idx]->port[0]; } @@ -4152,9 +4154,9 @@ DIOCGETSTATESV2_full: bzero(&key, sizeof(key)); key.af = pnl->af; key.proto = pnl->proto; - PF_ACPY(&key.addr[sidx], &pnl->saddr, pnl->af); + pf_addrcpy(&key.addr[sidx], &pnl->saddr, pnl->af); key.port[sidx] = pnl->sport; - PF_ACPY(&key.addr[didx], &pnl->daddr, pnl->af); + pf_addrcpy(&key.addr[didx], &pnl->daddr, pnl->af); key.port[didx] = pnl->dport; state = pf_find_state_all(&key, direction, &m); @@ -4166,9 +4168,11 @@ DIOCGETSTATESV2_full: error = E2BIG; /* more than one state */ } else { sk = state->key[sidx]; - PF_ACPY(&pnl->rsaddr, &sk->addr[sidx], sk->af); + pf_addrcpy(&pnl->rsaddr, + &sk->addr[sidx], sk->af); pnl->rsport = sk->port[sidx]; - PF_ACPY(&pnl->rdaddr, &sk->addr[didx], sk->af); + pf_addrcpy(&pnl->rdaddr, + &sk->addr[didx], sk->af); pnl->rdport = sk->port[didx]; PF_STATE_UNLOCK(state); } @@ -4606,7 +4610,7 @@ DIOCGETSTATESV2_full: } pool->cur = TAILQ_FIRST(&pool->list); - PF_ACPY(&pool->counter, &pool->cur->addr.v.a.addr, pca->af); + pf_addrcpy(&pool->counter, &pool->cur->addr.v.a.addr, pca->af); PF_RULES_WUNLOCK(); break; @@ -6024,11 +6028,11 @@ pf_kill_srcnodes(struct pfioc_src_node_kill *psnk) PF_HASHROW_LOCK(sh); LIST_FOREACH_SAFE(sn, &sh->nodes, entry, tmp) if (psnk == NULL || - (PF_MATCHA(psnk->psnk_src.neg, + (pf_match_addr(psnk->psnk_src.neg, &psnk->psnk_src.addr.v.a.addr, &psnk->psnk_src.addr.v.a.mask, &sn->addr, sn->af) && - PF_MATCHA(psnk->psnk_dst.neg, + pf_match_addr(psnk->psnk_dst.neg, &psnk->psnk_dst.addr.v.a.addr, &psnk->psnk_dst.addr.v.a.mask, &sn->raddr, sn->af))) { @@ -6132,10 +6136,10 @@ relock_DIOCCLRSTATES: match_key.af = s->key[idx]->af; match_key.proto = s->key[idx]->proto; - PF_ACPY(&match_key.addr[0], + pf_addrcpy(&match_key.addr[0], &s->key[idx]->addr[1], match_key.af); match_key.port[0] = s->key[idx]->port[1]; - PF_ACPY(&match_key.addr[1], + pf_addrcpy(&match_key.addr[1], &s->key[idx]->addr[0], match_key.af); match_key.port[1] = s->key[idx]->port[0]; } diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 5e7865e4fac5..308d76c46e5b 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -319,12 +319,14 @@ pf_get_sport(struct pf_pdesc *pd, struct pf_krule *r, bzero(&udp_source, sizeof(udp_source)); udp_source.af = pd->af; - PF_ACPY(&udp_source.addr, &pd->nsaddr, pd->af); + pf_addrcpy(&udp_source.addr, &pd->nsaddr, pd->af); udp_source.port = pd->nsport; if (udp_mapping) { *udp_mapping = pf_udp_mapping_find(&udp_source); if (*udp_mapping) { - PF_ACPY(naddr, &(*udp_mapping)->endpoints[1].addr, pd->af); + pf_addrcpy(naddr, + &(*udp_mapping)->endpoints[1].addr, + pd->af); *nport = (*udp_mapping)->endpoints[1].port; /* Try to find a src_node as per pf_map_addr(). */ if (*sn == NULL && rpool->opts & PF_POOL_STICKYADDR && @@ -369,12 +371,13 @@ pf_get_sport(struct pf_pdesc *pd, struct pf_krule *r, key.proto = pd->proto; do { - PF_ACPY(&key.addr[didx], &pd->ndaddr, key.af); - PF_ACPY(&key.addr[sidx], naddr, key.af); + pf_addrcpy(&key.addr[didx], &pd->ndaddr, key.af); + pf_addrcpy(&key.addr[sidx], naddr, key.af); key.port[didx] = pd->ndport; if (udp_mapping && *udp_mapping) - PF_ACPY(&(*udp_mapping)->endpoints[1].addr, naddr, pd->af); + pf_addrcpy(&(*udp_mapping)->endpoints[1].addr, naddr, + pd->af); /* * port search; start random, step; @@ -591,10 +594,10 @@ pf_map_addr(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, switch (rpool->opts & PF_POOL_TYPEMASK) { case PF_POOL_NONE: - PF_ACPY(naddr, raddr, af); + pf_addrcpy(naddr, raddr, af); break; case PF_POOL_BITMASK: - PF_POOLMASK(naddr, raddr, rmask, saddr, af); + pf_poolmask(naddr, raddr, rmask, saddr, af); break; case PF_POOL_RANDOM: if (rpool->cur->addr.type == PF_ADDR_TABLE) { @@ -609,7 +612,7 @@ pf_map_addr(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, reason = PFRES_MAPFAILED; goto done_pool_mtx; /* unsupported */ } - PF_ACPY(naddr, &rpool->counter, af); + pf_addrcpy(naddr, &rpool->counter, af); } else if (rpool->cur->addr.type == PF_ADDR_DYNIFTL) { cnt = rpool->cur->addr.p.dyn->pfid_kt->pfrkt_cnt; if (cnt == 0) @@ -623,7 +626,7 @@ pf_map_addr(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, reason = PFRES_MAPFAILED; goto done_pool_mtx; /* unsupported */ } - PF_ACPY(naddr, &rpool->counter, af); + pf_addrcpy(naddr, &rpool->counter, af); } else if (init_addr != NULL && PF_AZERO(init_addr, af)) { switch (af) { #ifdef INET @@ -654,12 +657,12 @@ pf_map_addr(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, break; #endif /* INET6 */ } - PF_POOLMASK(naddr, raddr, rmask, &rpool->counter, af); - PF_ACPY(init_addr, naddr, af); + pf_poolmask(naddr, raddr, rmask, &rpool->counter, af); + pf_addrcpy(init_addr, naddr, af); } else { - PF_AINC(&rpool->counter, af); - PF_POOLMASK(naddr, raddr, rmask, &rpool->counter, af); + pf_addr_inc(&rpool->counter, af); + pf_poolmask(naddr, raddr, rmask, &rpool->counter, af); } break; case PF_POOL_SRCHASH: @@ -680,7 +683,7 @@ pf_map_addr(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, reason = PFRES_MAPFAILED; goto done_pool_mtx; /* unsupported */ } - PF_ACPY(naddr, &rpool->counter, af); + pf_addrcpy(naddr, &rpool->counter, af); } else if (rpool->cur->addr.type == PF_ADDR_DYNIFTL) { cnt = rpool->cur->addr.p.dyn->pfid_kt->pfrkt_cnt; if (cnt == 0) @@ -694,9 +697,9 @@ pf_map_addr(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, reason = PFRES_MAPFAILED; goto done_pool_mtx; /* unsupported */ } - PF_ACPY(naddr, &rpool->counter, af); + pf_addrcpy(naddr, &rpool->counter, af); } else { - PF_POOLMASK(naddr, raddr, rmask, + pf_poolmask(naddr, raddr, rmask, (struct pf_addr *)&hash, af); } break; @@ -743,14 +746,14 @@ pf_map_addr(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, } else { raddr = &rpool->cur->addr.v.a.addr; rmask = &rpool->cur->addr.v.a.mask; - PF_ACPY(&rpool->counter, raddr, af); + pf_addrcpy(&rpool->counter, raddr, af); } get_addr: - PF_ACPY(naddr, &rpool->counter, af); + pf_addrcpy(naddr, &rpool->counter, af); if (init_addr != NULL && PF_AZERO(init_addr, af)) - PF_ACPY(init_addr, naddr, af); - PF_AINC(&rpool->counter, af); + pf_addrcpy(init_addr, naddr, af); + pf_addr_inc(&rpool->counter, af); break; } } @@ -798,7 +801,7 @@ pf_map_addr_sn(sa_family_t af, struct pf_krule *r, struct pf_addr *saddr, goto done; } - PF_ACPY(naddr, &(*sn)->raddr, af); + pf_addrcpy(naddr, &(*sn)->raddr, af); if (nkif) *nkif = (*sn)->rkif; if (V_pf_status.debug >= PF_DEBUG_NOISY) { @@ -948,7 +951,7 @@ pf_get_transaddr(struct pf_test_ctx *ctx, struct pf_krule *r, reason = PFRES_MAPFAILED; goto notrans; } - PF_POOLMASK(naddr, + pf_poolmask(naddr, &rpool->cur->addr.p.dyn->pfid_addr4, &rpool->cur->addr.p.dyn->pfid_mask4, &pd->nsaddr, AF_INET); @@ -961,7 +964,7 @@ pf_get_transaddr(struct pf_test_ctx *ctx, struct pf_krule *r, reason = PFRES_MAPFAILED; goto notrans; } - PF_POOLMASK(naddr, + pf_poolmask(naddr, &rpool->cur->addr.p.dyn->pfid_addr6, &rpool->cur->addr.p.dyn->pfid_mask6, &pd->nsaddr, AF_INET6); @@ -969,7 +972,7 @@ pf_get_transaddr(struct pf_test_ctx *ctx, struct pf_krule *r, #endif /* INET6 */ } } else - PF_POOLMASK(naddr, + pf_poolmask(naddr, &rpool->cur->addr.v.a.addr, &rpool->cur->addr.v.a.mask, &pd->nsaddr, pd->af); @@ -983,7 +986,7 @@ pf_get_transaddr(struct pf_test_ctx *ctx, struct pf_krule *r, reason = PFRES_MAPFAILED; goto notrans; } - PF_POOLMASK(naddr, + pf_poolmask(naddr, &r->src.addr.p.dyn->pfid_addr4, &r->src.addr.p.dyn->pfid_mask4, &pd->ndaddr, AF_INET); @@ -995,7 +998,7 @@ pf_get_transaddr(struct pf_test_ctx *ctx, struct pf_krule *r, reason = PFRES_MAPFAILED; goto notrans; } - PF_POOLMASK(naddr, + pf_poolmask(naddr, &r->src.addr.p.dyn->pfid_addr6, &r->src.addr.p.dyn->pfid_mask6, &pd->ndaddr, AF_INET6); @@ -1003,7 +1006,7 @@ pf_get_transaddr(struct pf_test_ctx *ctx, struct pf_krule *r, #endif /* INET6 */ } } else - PF_POOLMASK(naddr, &r->src.addr.v.a.addr, + pf_poolmask(naddr, &r->src.addr.v.a.addr, &r->src.addr.v.a.mask, &pd->ndaddr, pd->af); break; } @@ -1018,7 +1021,7 @@ pf_get_transaddr(struct pf_test_ctx *ctx, struct pf_krule *r, if (reason != 0) goto notrans; if ((rpool->opts & PF_POOL_TYPEMASK) == PF_POOL_BITMASK) - PF_POOLMASK(naddr, naddr, &rpool->cur->addr.v.a.mask, + pf_poolmask(naddr, naddr, &rpool->cur->addr.v.a.mask, &pd->ndaddr, pd->af); /* Do not change SCTP ports. */ @@ -1056,9 +1059,9 @@ pf_get_transaddr(struct pf_test_ctx *ctx, struct pf_krule *r, key.af = pd->af; key.proto = pd->proto; key.port[0] = pd->nsport; - PF_ACPY(&key.addr[0], &pd->nsaddr, key.af); + pf_addrcpy(&key.addr[0], &pd->nsaddr, key.af); key.port[1] = nport; - PF_ACPY(&key.addr[1], naddr, key.af); + pf_addrcpy(&key.addr[1], naddr, key.af); if (!pf_find_state_all_exists(&key, PF_OUT)) *** 83 LINES SKIPPED *** From nobody Fri Jul 4 09:22:42 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpW0df5z61GhS; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpV4zf4z3pgw; Fri, 04 Jul 2025 09:22:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dBNE4397sDpK5pwztA2odshkF8O8MHOZpF837TRBmMo=; b=u8uI47B7LaioCARFs8ANWDOaCHGG6ChXSvI53yTTP67C9UCh2L6CCizygLMlVqTust7N73 hapN4kcaBZSFlN1/Z6TLm9Z0G804hJz0y6zgA7BbiEDKxoQa35gQTQbp0slYUg9Hc/HTz3 Xi9NVo7imyfiMeObCdbVvgy6EKOdWLZNMEwE/oUozxoIMxbLo8MVVQIb1OGmX6XUFzDlHx bol09LDx80JXRziBWZBU38wLR7PeCfXewPPe/Dk894yN9fPpUe1tvIEYElECBwUCzzhZT8 hTNUscmjIffwA/AGcvtoRO3WsT1ePNf1zMOkVTbzwY+H5dj5vVQNOAYm6WtInQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dBNE4397sDpK5pwztA2odshkF8O8MHOZpF837TRBmMo=; b=XonvxeYobguW4vNjwK5+TrF2ZUPfzmtb86OBx8Ek/+yAknD9QoCBuqgfm7oMFXpg6Q/O/f Rk+amKgtdK3as+nHpYrdbeppuJdQXGdPUQkhQUrMhZn4rgkJaUJ9R0RAfVkrKp3UxpKilH QBXbwb84x9iuA0k0UAw2gB/x741et7vSa1MxOhExbP8G9hN39DMz0pR2zJ4op828Nr2/ra Ym66hNJPOAMjdC1Y5mf2cTi08tcJt3vrwdFKP+ex9vZvvLmcq1qWegoe3dst0W2Qw8zg+9 GSWGxs0/fmz8d6ZXF2wq5aUHtqg9XkMbtBdVJni4zIGqYGSHwBfzMkKwITfVFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620962; a=rsa-sha256; cv=none; b=JfiQj9DIWiPoK/NNNNXSXeMhnjMp3e2n2lTZb349N2HU/oTU2sn6ypMeH0szljyuHlJxmM cr5Eg/UfRbDXmtHHfOHxePAKAXk6RNT6zLvDIjQgU35iUheSffpmDyOLVSXXyz8kFcfuav n8MLnrFXhIwN3GInREydFPt1ZNqqdn6D4YKDqgHaYHU9hf3H6zgavcQd2q5fzwh2aSAIpX JlRSo2RVx/iviqZL/7e4TS6IMnvfeET8IuJv1yE1q4iJ25+ddN+s09bOVj0Jr/ojRRF5N7 OnR+7qaBssmY6aQinL68C9elf5S+vZUruRnY+69Jv7yrU+KHyvk9l7OZ8wAEsQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpV44qzzlGR; Fri, 04 Jul 2025 09:22:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MgQC055890; Fri, 4 Jul 2025 09:22:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649Mg9r055887; Fri, 4 Jul 2025 09:22:42 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:42 GMT Message-Id: <202507040922.5649Mg9r055887@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ddb8faceb1dd - main - pf.4: DIOCIGETIFACES provides interfaces and groups, not drivers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddb8faceb1dd58f757f4904bf6117db5610ef7bf Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ddb8faceb1dd58f757f4904bf6117db5610ef7bf commit ddb8faceb1dd58f757f4904bf6117db5610ef7bf Author: Kristof Provost AuthorDate: 2025-06-30 17:08:02 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:12 +0000 pf.4: DIOCIGETIFACES provides interfaces and groups, not drivers "driver" is a left-over from earlier implementations. Nowadays each driver such as lo(4) has it's respective interface group of the same name ("lo"), but additional driver-independent groups exist, too: # ifconfig lo0 group foo # pfctl -s I -i foo foo lo0 OK henning Obtained from: OpenBSD, kn , 822e892650 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.8 | 2 +- share/man/man4/pf.4 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 index 5238c53f709d..269987e2969f 100644 --- a/sbin/pfctl/pfctl.8 +++ b/sbin/pfctl/pfctl.8 @@ -474,7 +474,7 @@ Show the list of tables. .It Fl s Cm osfp Show the list of operating system fingerprints. .It Fl s Cm Interfaces -Show the list of interfaces and interface drivers available to PF. +Show the list of interfaces and interface groups available to PF. When used together with .Fl v , it additionally lists which interfaces have skip rules activated. diff --git a/share/man/man4/pf.4 b/share/man/man4/pf.4 index 422600a6fa44..03a4ba2bbe7f 100644 --- a/share/man/man4/pf.4 +++ b/share/man/man4/pf.4 @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 1, 2025 +.Dd July 2, 2025 .Dt PF 4 .Os .Sh NAME @@ -1114,7 +1114,7 @@ will be set to the length of the buffer actually used. .It Dv DIOCCLRSRCNODES Clear the tree of source tracking nodes. .It Dv DIOCIGETIFACES Fa "struct pfioc_iface *io" -Get the list of interfaces and interface drivers known to +Get the list of interfaces and interface groups known to .Nm . All the ioctls that manipulate interfaces use the same structure described below: @@ -1131,7 +1131,7 @@ struct pfioc_iface { .Pp If not empty, .Va pfiio_name -can be used to restrict the search to a specific interface or driver. +can be used to restrict the search to a specific interface or group. .Va pfiio_buffer[pfiio_size] is the user-supplied buffer for returning the data. On entry, From nobody Fri Jul 4 09:22:41 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpV0pqjz61Gx5; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpT4T4Lz3pgf; Fri, 04 Jul 2025 09:22:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R0FD9tpN9W9OAZagFdgsfAQ17WIMDY+vl/5ZbubyQbY=; b=ZgICuEml3kpVMTSiFrWgF55wESHczdnvd2kbb5sKAfP4/AsBWC/ZidJKPWiO0PXGHGujDR uZAzcfFEZ9fD+3fc5TIbKdD9PJ023p5B7/9BYgZOic1lfzbzvx2dqhH+g7MIr1lKo6ueqD USJvNFuMHu/e5bIaFSMwHVS/RuoDAfVYO2OiNalIAO1FwVj1gsh0IovEN2fmsNZMe5Vl8q 21SlEkx5gYkPHERivyfYjkTcT5WrrnV2CGJe8Homemg54v/x0HRJZcE4h2vtIYVlxrFHEB BmONfdSG97qbXmA5T8qvb4oZXTgoPY85cBumAJWieCdivUDzX8mW4sRQxwh8Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R0FD9tpN9W9OAZagFdgsfAQ17WIMDY+vl/5ZbubyQbY=; b=ZeITTyyMdihmSh4vJnQ2iPQQK4en3EOFrjxWA7xDHI0IKZPpyUm/rEZhBPODzgwwy/6juy 622e4/RSy/xRo+6Jv4J08MAKkUKjBNbWic4cQ1Z5IWBOYDsBL1Ppghf8+xmdeCK/wYK4db U6nQX/TkaX7Qzzbz1Cuy3jA6bj7LdvnNOjgwGciThy8ExLKy2doaIFolFuEI0wfaWqBgIC TYjV28fAzrXhwWLXk+UVdhOxYPouJYlzPvDhpNbwoYxhPbCXT/+EHU3KEDMai24BU4lhhx iEOF6Uv8FxKwOZon5Nw2S7xFUnbUwW7izCjNgJI5u+O3M3e1t5DL78cEZZSE1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620961; a=rsa-sha256; cv=none; b=P74CeKx3oWnd3qiAgbsFeuMah2HMVC+pxkTzV3CwpbNYD5UEP0ICW1QOHjvrb2l6Rf4w6s NbF2u5p6BodEF8C/jY3XoxPVvziRXbOAhUFVICXb8YheufweuHyk7CXOasPZL62Z8FK2uM OCdQ0pj2Lxc3XAgtBhvQAW5lD+4rirfhOneGh6SU0U67YX2jOCr90mV4FhMXkON04hPeS+ fAQZTaEHZvI74fs07mrtWX5bXDpOUrcjvs5GCUsFqGOf9z4pyMTxxoON8GujBf5OLH2xUD jcn1+qvZ77r5sbn8Ub3uX+U4DOliFJIdq/RdIOMUvD9hIGVf07oxjzg54BZlbg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpT36bFzlQ7; Fri, 04 Jul 2025 09:22:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MfLr055856; Fri, 4 Jul 2025 09:22:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MfkY055853; Fri, 4 Jul 2025 09:22:41 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:41 GMT Message-Id: <202507040922.5649MfkY055853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 651fbbc9a69b - main - pf: Rename pf_anchor_remove() to pf_remove_anchor() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 651fbbc9a69bddaa8abe1cd4434e70f1367396c9 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=651fbbc9a69bddaa8abe1cd4434e70f1367396c9 commit 651fbbc9a69bddaa8abe1cd4434e70f1367396c9 Author: Kristof Provost AuthorDate: 2025-06-30 17:06:06 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:12 +0000 pf: Rename pf_anchor_remove() to pf_remove_anchor() For semantic consistency with pf_{create,find,remove}_{anchor,ruleset}(). Simplify logic by squashing the if/else block while here. No functional change. Feedback jca and mikeb, OK mikeb Obtained from: OpenBSD, kn , f6275afa61 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 2 +- sys/netpfil/pf/pf_ioctl.c | 2 +- sys/netpfil/pf/pf_ruleset.c | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 028297310d7b..1416f0c2cdbe 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -2633,7 +2633,7 @@ int pf_kanchor_copyout(const struct pf_kruleset *, const struct pf_krule *, char *, size_t); int pf_kanchor_nvcopyout(const struct pf_kruleset *, const struct pf_krule *, nvlist_t *); -void pf_kanchor_remove(struct pf_krule *); +void pf_remove_kanchor(struct pf_krule *); void pf_remove_if_empty_kruleset(struct pf_kruleset *); struct pf_kruleset *pf_find_kruleset(const char *); struct pf_kruleset *pf_get_leaf_kruleset(char *, char **); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 96e913635cd0..45201f2eaec9 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -615,7 +615,7 @@ pf_free_rule(struct pf_krule *rule) pfi_kkif_unref(rule->kif); if (rule->rcv_kif) pfi_kkif_unref(rule->rcv_kif); - pf_kanchor_remove(rule); + pf_remove_kanchor(rule); pf_empty_kpool(&rule->rdr.list); pf_empty_kpool(&rule->nat.list); pf_empty_kpool(&rule->route.list); diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 0414e4f06f9c..94e8527f6555 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -525,16 +525,13 @@ done: } void -pf_kanchor_remove(struct pf_krule *r) +pf_remove_kanchor(struct pf_krule *r) { if (r->anchor == NULL) return; - if (r->anchor->refcnt <= 0) { + if (r->anchor->refcnt <= 0) printf("%s: broken refcount\n", __func__); - r->anchor = NULL; - return; - } - if (!--r->anchor->refcnt) + else if (!--r->anchor->refcnt) pf_remove_if_empty_kruleset(&r->anchor->ruleset); r->anchor = NULL; } From nobody Fri Jul 4 09:22:43 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpX3R4bz61GfQ; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpW5gp0z3phB; Fri, 04 Jul 2025 09:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j85goNIBZAX10wtyBCtiKmhlP6EE9e2Pvop+aUdZ/EY=; b=R5NGNzK8NC1rt99n4qxGtEORwE2w1ELZeRtytqDbuLtM0HudOEA0lmWJ+DUZyXDgG7bVTT CaC/X4nCSNOzMhgLYhVABPW120zkCW6ulfcajpi4R0jvk/z/kP/d+UMgwf8tq7SYI2la5d TL7hXeQQQaWrlmG0/GdY6heooc18NbNOzYCutJ8F+GewbdSwp0AAs4mmAiS2XVwqW80tje mq+sI2z+6nUr6NBBw8i6LWYYI+8ULexJGsKU6KVp092s2d2QBOCsnn8uxEPC7P9xqw1iDS DaA2W0HQZelPRKRwd9d6PbwVM/PB57SnrS9yQr6FHZF9l3KolixSh+BfhMrYsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j85goNIBZAX10wtyBCtiKmhlP6EE9e2Pvop+aUdZ/EY=; b=Yxor22T85nt/lVB4itK2p3IATas83PDAwOhgRS+oScM2xfZrAyx4KQxatCSaKsv7ay+1Hp HhLFIaAiAQOulzEYZcL7JL5Q0AFn69FcD1EVqzKVqjN18RvgZzh5J8CiMXwnkLR3vhMNVE sRHOHEltres9BJIP5vLrjfZHk+KglrpN+7WE0/NZU5EdiuXqkUe2140ZQq6gcHCogR5s2B vtqjtrOsZZgcZQJo4muNknVsKvlCGtqPeI86kzClOj/vQNlmAYA6iDA/A9g1AdiPDAgQ35 QBmsOgh+BrrBgjNBnF7bXZcMALjvYfrx/HRWaCEfniISBtlzjPx+0BqfxDODnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620963; a=rsa-sha256; cv=none; b=gVwGDkgV0ZIewgzbq0LMw5AURFzDfox75JhXSfdbMZkBTE3OLLE8dv+btWxoB3W4Yn1b/2 kmOc48ftWqM97rlwkxwQ5wH5eTcLT/VSBRvNKrmR5JfmCoHOIWJy4aqVPl13YfFs8noJfe XMHH6U3V3f6zgKhV6JxbOSwLMdPe+ces0khPABdJZpbNT1hYhtHrRnnJUuvHbnVa23cPFO N1iaNKXmZ0ey7cxrj7SaWvJBgEJX59ytVm8PXgefjXKhYZxPp1ZEVSXI6mktRjCLP4XuJm clKj7MJKNfsCFS3D2FrUJZtFqOH1jmpA79yLZGtPaJFixgD/AB/9/ysI0uDZvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpW57jrzkwp; Fri, 04 Jul 2025 09:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MhTH055926; Fri, 4 Jul 2025 09:22:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MhM9055921; Fri, 4 Jul 2025 09:22:43 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:43 GMT Message-Id: <202507040922.5649MhM9055921@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: f7289cce493d - main - pf: Check for main ruleset explicitly List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7289cce493d8db579e3e10bec2c95887c4ba52e Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f7289cce493d8db579e3e10bec2c95887c4ba52e commit f7289cce493d8db579e3e10bec2c95887c4ba52e Author: Kristof Provost AuthorDate: 2025-06-30 17:12:12 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:12 +0000 pf: Check for main ruleset explicitly All rulesets reference their parent anchor, except for the special cased main anchor containing the main ruleset, which's reference is always NULL since initialization and never changes. Replacing nullity tests with clearer equality checks makes the code less ambigious and easier to understand. OK sashan Obtained from: OpenBSD, kn , 55038654e1 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 4 ++-- sys/netpfil/pf/pf_ruleset.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 45201f2eaec9..357b2be194a5 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2740,7 +2740,7 @@ pf_ioctl_get_rulesets(struct pfioc_ruleset *pr) return (ENOENT); } pr->nr = 0; - if (ruleset->anchor == NULL) { + if (ruleset == &pf_main_ruleset) { /* XXX kludge for pf_main_ruleset */ RB_FOREACH(anchor, pf_kanchor_global, &V_pf_anchors) if (anchor->parent == NULL) @@ -2772,7 +2772,7 @@ pf_ioctl_get_ruleset(struct pfioc_ruleset *pr) } pr->name[0] = 0; - if (ruleset->anchor == NULL) { + if (ruleset == &pf_main_ruleset) { /* XXX kludge for pf_main_ruleset */ RB_FOREACH(anchor, pf_kanchor_global, &V_pf_anchors) if (anchor->parent == NULL && nr++ == pr->nr) { diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 94e8527f6555..2e5165a9900c 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -339,7 +339,7 @@ pf_remove_if_empty_kruleset(struct pf_kruleset *ruleset) int i; while (ruleset != NULL) { - if (ruleset == &pf_main_ruleset || ruleset->anchor == NULL || + if (ruleset == &pf_main_ruleset || !RB_EMPTY(&ruleset->anchor->children) || ruleset->anchor->refcnt > 0 || ruleset->tables > 0 || ruleset->topen) @@ -407,7 +407,7 @@ pf_kanchor_setup(struct pf_krule *r, const struct pf_kruleset *s, } ruleset = pf_find_or_create_kruleset(path); rs_free(path); - if (ruleset == NULL || ruleset->anchor == NULL) { + if (ruleset == NULL || ruleset == &pf_main_ruleset) { DPFPRINTF("%s: ruleset\n", __func__); return (1); } @@ -432,7 +432,7 @@ pf_kanchor_copyout(const struct pf_kruleset *rs, const struct pf_krule *r, char a[MAXPATHLEN]; char *p; int i; - if (rs->anchor == NULL) + if (rs == &pf_main_ruleset) a[0] = 0; else strlcpy(a, rs->anchor->path, MAXPATHLEN); From nobody Fri Jul 4 09:22:45 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpZ1dmcz61GtW; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpY6xQ7z3pkn; Fri, 04 Jul 2025 09:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WmNqHSl6H6ieVzB6n79JKFCVAaoH4JyaeY/wX+U5ZZ8=; b=vCclI7lfFabD+nhbGhi+Lo0VMBzAkHLxSyK5aMWPB4NpyNTtgGEKKd9tzFwnaiHKx4ti1j YOq4y4YjJBF1QcszDigcfnZKcnhsyeNBCEj8cphQHMgu5KamJ5bM8qgz0FlgSDx+bnftL5 sxcxydV/p47TvFXISN8ju/nxl4phw01ZoArafGo3332I7OGHMXXI4lWnx5EV42EYnCGXyB +vt759pVU/egNd3jztLdXK8ct98Rq8ngGMeR3itj1GX/nxZqti/GOyitn8rsZTlqIWW8oX HZhyIQlq9NJQLuVgwx0T9TAktIFxyVrTi5ZuiY/9vpmt5O6WVAgJVsbdU82dCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WmNqHSl6H6ieVzB6n79JKFCVAaoH4JyaeY/wX+U5ZZ8=; b=Dp6Nq3bTQBUM3CajP6TqcgtWyEnS57GeTDFdItqRIMVIB9Z5biHxw1RvFsU6HuuYLNkwq+ sZtv16u/NpgHAe6bxDgBXTXbEhHy9/4VWT54R+7x/MBqEYycZoStPufX+6os18BiGHW8+Y meOGRIS1fXdLXv5G3apZHAJGYk20383Z6ceM+pXh1TbpJUD14beZ0Y/Yjrkm/6UKJ3kVa7 g5+x+FXSgaB6k2aYAiEbBi2+ikSemd8AdeFxHsj2/vb+R7r+Zglabyy03cZgu9BOUo4EFB gUfv3xDQ42+/oZhtSNoZq8mpcSlotjKaHlpIyJP+p0IbXvHniHsALDV9aW+4WA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620966; a=rsa-sha256; cv=none; b=AUQt6LphOyXP/JmkbTq6Y9WeuLrqLIgS6XrsEJrI+iJnjGtDHfPm4tElH1LhuEWzQ+wvYP ncKIcjCw/nX07Z+GXMcp/fBIaltU1sQHwHbrRW8lSAsGDwASN0TsjGa8c+AlT6HeSNFFOf TInZKqeH8Uwqobs7HCfGBhRIf3ArMRuki/NF6vBnq9JPWNIYewil41X3Vu0LbRX3kyCJ6V Z9Q0dyBB6BU0rR31vHPUqdonzkM5D5AHTbh5FaPib4Qic7a/iGiX1j2fCcpcDS8o2PgOGp R+sBaD7RRe3+7MEnoiU54ytJQFc/itZru6N94e6COmAiTWTn9Ck3/iUusYLb3g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpY6Vv4zlQ8; Fri, 04 Jul 2025 09:22:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MjJh055993; Fri, 4 Jul 2025 09:22:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MjP6055990; Fri, 4 Jul 2025 09:22:45 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:45 GMT Message-Id: <202507040922.5649MjP6055990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 945ba658d803 - main - pfctl: Error out on missing table command, zap internal wrapper function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 945ba658d8036102729e3ae7809c56879bf1e259 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=945ba658d8036102729e3ae7809c56879bf1e259 commit 945ba658d8036102729e3ae7809c56879bf1e259 Author: Kristof Provost AuthorDate: 2025-07-01 09:41:12 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:13 +0000 pfctl: Error out on missing table command, zap internal wrapper function Table name and table command require each other as reflected in the synopsis [-t table -T command [address ...]], so print usage and exit if only one of them is given. By moving the inter-dependence check right after option parsing is done, we can bail out even before opening pf(4) and drop the internal wrapper pfctl_command_tables() as unneeded indirection with now duplicate checks. OK sashan Obtained from: OpenBSD, kn , 97699edbc9 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.c | 5 ++++- sbin/pfctl/pfctl.h | 2 +- sbin/pfctl/pfctl_table.c | 11 ----------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 8c6497b4d1ee..38d74aceba80 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -3175,6 +3175,9 @@ main(int argc, char *argv[]) } } + if (tblcmdopt == NULL ^ tableopt == NULL) + usage(); + if (tblcmdopt != NULL) { argc -= optind; argv += optind; @@ -3400,7 +3403,7 @@ main(int argc, char *argv[]) pfctl_kill_src_nodes(dev, ifaceopt, opts); if (tblcmdopt != NULL) { - error = pfctl_command_tables(argc, argv, tableopt, + error = pfctl_table(argc, argv, tableopt, tblcmdopt, rulesopt, anchorname, opts); rulesopt = NULL; } diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index 5abd5ddcdf8f..08d48695709e 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -83,7 +83,7 @@ int pfi_clr_istats(const char *, int *, int); void pfctl_print_title(char *); void pfctl_do_clear_tables(const char *, int); void pfctl_show_tables(const char *, int); -int pfctl_command_tables(int, char *[], char *, const char *, char *, +int pfctl_table(int, char *[], char *, const char *, char *, const char *, int); int pfctl_show_altq(int, const char *, int, int); void warn_namespace_collision(const char *); diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index abe22a3258de..53abea3e1ae1 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -55,8 +55,6 @@ #include "pfctl.h" extern void usage(void); -static int pfctl_table(int, char *[], char *, const char *, char *, - const char *, int); static void print_table(const struct pfr_table *, int, int); static int print_tstats(const struct pfr_tstats *, int); static int load_addr(struct pfr_buffer *, int, char *[], char *, int, int); @@ -118,15 +116,6 @@ pfctl_show_tables(const char *anchor, int opts) exit(1); } -int -pfctl_command_tables(int argc, char *argv[], char *tname, - const char *command, char *file, const char *anchor, int opts) -{ - if (tname == NULL || command == NULL) - usage(); - return pfctl_table(argc, argv, tname, command, file, anchor, opts); -} - int pfctl_table(int argc, char *argv[], char *tname, const char *command, char *file, const char *anchor, int opts) From nobody Fri Jul 4 09:22:44 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYSpY2G2rz61H2j; Fri, 04 Jul 2025 09:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYSpX6TLKz3phR; Fri, 04 Jul 2025 09:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z0aFoV6i31C1dssTTBPjLZce3CNUpNwy3Vzej9jNvJQ=; b=Fx8nJebZmlBykoC2VuVH+SodA9Z3718Go5a6/lhT6BTajEude7uS4PF9kJ5On3JLfmIFiD HJ7PrDWUCKuCEK+ScM4fibWotLpSdhM4s2ilzUkBlPwTVDsVKTpRX6Zb2OfLtLgHxUBwBQ m6lf2dLJpDUvLu+ynlV4MbAcRU4Qah+Eqlz8BFgJ0Pnu6oE8X5clwHDza+agd0VtW8XpCV CW7B0mRYqnLORQ6871glT2HkWtp9ibVJyFdDsQFmK9FAB5WAarG6dJMfAQqID+fXQrmBfX sbOt15U4DWrOTjsbQOeFN+IrWl5ULQjxlyre5FgicgDg2FBnb6W/ckPl3GxBtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751620964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z0aFoV6i31C1dssTTBPjLZce3CNUpNwy3Vzej9jNvJQ=; b=RcEzOTSqaAf89NMEbzzkcV1ELzQNxuHvUOk5BaKkjvqx9iXL1+PUEwH7/h5Z7kHeo5sJtV zSr+JgVMNkGzxpFzBm9ov5hj79ANzQWpNvFb8J8alhvyq6M3ew/UZyEeL+aHNxrSj5jQhW lXlDMXuaSqUY0WCR+nCUtvHhh7BGaUc2but8RYAIqgisEQZwCGLlTlHuz8EIBspGjKK/+B 81qE9KFx+U6KZM9ad8g6UbHmAwzIJ3jcLn0QhOVZtpdkw6P635T3JBRB4OWOas+dBrCpOf 44wA2si52BrdmXb0bD2tSJUJqQUaKmVMAvZL8LCl++phc7IxbxQm7btPULAr5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751620964; a=rsa-sha256; cv=none; b=lLqja5HFb+ctGEF9ptAXgZ32bt3eG5y3OXLNpQNheSYwPhk6lgmda/WAj8FOxOdFPPIFGt Hes5URd6eO5tl2j91Fr7ljnnSvCyqvOVcH4iIoySJLbGU+NCoTN9YMZrkjKyX43nehh6Ju LnamNjPDjFOlHfVM2cxFTxpkO4f+/JzyQD1iSsniKouyyvBiY9Ypd11hAO+L1E3NED10Pl 8pq8SwIxEVYxQDdYkQb57IBiUljjBhElT+xqwlpYP98MYem98c88GoNVB2cZJlmY3Tpapf 9D3FviTTdlViNUAzVDEikGIGe8PLxl5QkdcSIvXSKxxV6qwCkkRS75rT56uSwA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYSpX5sYbzkwq; Fri, 04 Jul 2025 09:22:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5649MiuE055959; Fri, 4 Jul 2025 09:22:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5649MitY055956; Fri, 4 Jul 2025 09:22:44 GMT (envelope-from git) Date: Fri, 4 Jul 2025 09:22:44 GMT Message-Id: <202507040922.5649MitY055956@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 3c24dfa30bb9 - main - pfctl.8: Explicitly mention that tables created by -T{add,replace} are persistent List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c24dfa30bb9e2d90ab643758628b7586fa40f06 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c24dfa30bb9e2d90ab643758628b7586fa40f06 commit 3c24dfa30bb9e2d90ab643758628b7586fa40f06 Author: Kristof Provost AuthorDate: 2025-06-30 17:13:24 +0000 Commit: Kristof Provost CommitDate: 2025-07-04 08:31:12 +0000 pfctl.8: Explicitly mention that tables created by -T{add,replace} are persistent pf.conf(5)'s TABLE section explains it, but lets be clear about it in the table command descriptions, too. "go for it" jmc Obtained from: OpenBSD, kn , 8d4231551f Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8 index 269987e2969f..c7fad58262dc 100644 --- a/sbin/pfctl/pfctl.8 +++ b/sbin/pfctl/pfctl.8 @@ -544,7 +544,7 @@ Kill a table. Flush all addresses of a table. .It Fl T Cm add Add one or more addresses in a table. -Automatically create a nonexisting table. +Automatically create a persistent table if it does not exist. .It Fl T Cm delete Delete one or more addresses from a table. .It Fl T Cm expire Ar number @@ -556,7 +556,7 @@ For entries which have never had their statistics cleared, refers to the time they were added to the table. .It Fl T Cm replace Replace the addresses of the table. -Automatically create a nonexisting table. +Automatically create a persistent table if it does not exist. .It Fl T Cm show Show the content (addresses) of a table. .It Fl T Cm test From nobody Fri Jul 4 13:28:42 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGL5rdNz615FF; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGL5XHhz3M3W; Fri, 04 Jul 2025 13:28:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ymmpjvLNF9lpIpIMenX5fug0nn+6pCBIA0WmCZbI2O8=; b=PRoccFSn6SjuGTdeud1uFAVjj9LVcG4ctfMaglguUtXK9pNCMY6sZY+7T3Z7aEQpl5GzF+ oR72QIe38bpvuaGMHSLmS7LkaGJsy/ynZEZsqEqBno06lY70s1gvNjxSEnvngn//YbwxYv 0gSf3/j+FvXaNY9ou4LhkUKKrzkDIUOvOOe+rTeM+MtgsMbypiy3mCfNuEXX2WIRPrsNOQ 1tPJBUlsv2+l9/RBNpFzx4i7wemKmVFo8+UHFsPgtJYrQILXbSaiuDNcS1xFes+UDBMD6Y W5CUS+I3DWEOZZEJwVun/vFR9S/2ZiHtsS5TkK/AH+/534xN5QSXi/Lxt4x1WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ymmpjvLNF9lpIpIMenX5fug0nn+6pCBIA0WmCZbI2O8=; b=nNuo1kSCKTPZrkkQ83AlyFhpS1/3mKSJDa9k2lNPmsX/gOzUdZKSULlUuF591RyNtpKqlj Cbb0gxezkg+jiCp7Cs2XGGe1+PlVUhYLRz8MeIffe6Nux5NwkqtfFCEWeNC4I603/ShtKY nxchAaV5db3Ed1yZ7zpFntfvyLSs44TvGA7fddLCZ4Sy8yeKjRBz6oU2rDS26rXUjzT7JY Zxkuwyp8Mjfc7vo78Ay0Qkblvm9Q9flBlmb3dEzTbhDKz5fn1Hl+kokpTeE8i5TRArGZeb PPSffLFWmlQDSbDUMQ+YNFKW+w5kznTQdv41G716tuwAZ9lqQ+D8aZUMLP6iHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635722; a=rsa-sha256; cv=none; b=iQVd2u0r1LrqaDHaLQsc21t6Dtd3JCIn/Q24Dp7AB1Zq2vrXBz7aUnxGCL5DlUtZfQNYJd VRzu9UY4NC4FBpTu+J9O6DanArRGk3VfxX9QDSbXdsIkwIH4vd+n0E3DgPDzdBrZsFL3T+ oFk4B8KbuAFrlCznhsXnmw+I+MnG5/jB7H1jpPlEA4u+UEZf8KnqCtl8vTL9dBIqv8Qfm2 C+ffBEAKFZjNVIFrzfxOoapXTkDfwRq2G1CtYyORHqOpAdfA1BlynK6Quy7k2FxqX0Mfws lO8x57pa6aDWy+x2XTSosjteutIyzpZg/7qbH7UC/giUxUkdhz0qME04sKc3AA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGL56nszsSD; Fri, 04 Jul 2025 13:28:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSg93005743; Fri, 4 Jul 2025 13:28:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSgpc005740; Fri, 4 Jul 2025 13:28:42 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:42 GMT Message-Id: <202507041328.564DSgpc005740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: 615fba7c6b39 - stable/14 - Add an implementation of the 9P filesystem List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 615fba7c6b39ac40239beb5624025d0d0576fdc0 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=615fba7c6b39ac40239beb5624025d0d0576fdc0 commit 615fba7c6b39ac40239beb5624025d0d0576fdc0 Author: Doug Rabson AuthorDate: 2022-12-06 13:07:46 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:05 +0000 Add an implementation of the 9P filesystem This is derived from swills@ fork of the Juniper virtfs with many changes by me including bug fixes, style improvements, clearer layering and more consistent logging. The filesystem is renamed to p9fs to better reflect its function and to prevent possible future confusion with virtio-fs. Several updates and fixes from Juniper have been integrated into this version by Val Packett and these contributions along with the original Juniper authors are credited below. To use this with bhyve, add 'virtio_p9fs_load=YES' to loader.conf. The bhyve virtio-9p device allows access from the guest to files on the host by mapping a 'sharename' to a host path. It is possible to use p9fs as a root filesystem by adding this to /boot/loader.conf: vfs.root.mountfrom="p9fs:sharename" for non-root filesystems add something like this to /etc/fstab: sharename /mnt p9fs rw 0 0 In both examples, substitute the share name used on the bhyve command line. The 9P filesystem protocol relies on stateful file opens which map protocol-level FIDs to host file descriptors. The FreeBSD vnode interface doesn't really support this and we use heuristics to guess the right FID to use for file operations. This can be confused by privilege lowering and does not guarantee that the FID created for a given file open is always used for file operations, even if the calling process is using the file descriptor from the original open call. Improving this would involve changes to the vnode interface which is out-of-scope for this import. Differential Revision: https://reviews.freebsd.org/D41844 Reviewed by: kib, emaste, dch MFC after: 3 months Co-authored-by: Val Packett Co-authored-by: Ka Ho Ng Co-authored-by: joyu Co-authored-by: Kumara Babu Narayanaswamy (cherry picked from commit e97ad33a89a78f55280b0485b3249ee9b907a718) --- share/man/man5/Makefile | 1 + share/man/man5/p9fs.5 | 127 +++ sys/conf/files | 7 + sys/conf/options | 1 + sys/dev/virtio/p9fs/virtio_p9fs.c | 511 +++++++++ sys/dev/virtio/p9fs/virtio_p9fs.h | 39 + sys/fs/p9fs/p9_client.c | 1311 ++++++++++++++++++++++ sys/fs/p9fs/p9_client.h | 168 +++ sys/fs/p9fs/p9_debug.h | 45 + sys/fs/p9fs/p9_protocol.c | 632 +++++++++++ sys/fs/p9fs/p9_protocol.h | 280 +++++ sys/fs/p9fs/p9_transport.c | 70 ++ sys/fs/p9fs/p9_transport.h | 53 + sys/fs/p9fs/p9fs.h | 203 ++++ sys/fs/p9fs/p9fs_proto.h | 42 + sys/fs/p9fs/p9fs_subr.c | 411 +++++++ sys/fs/p9fs/p9fs_vfsops.c | 602 +++++++++++ sys/fs/p9fs/p9fs_vnops.c | 2148 +++++++++++++++++++++++++++++++++++++ sys/kern/vfs_mountroot.c | 1 + sys/modules/Makefile | 1 + sys/modules/p9fs/Makefile | 8 + sys/modules/virtio/Makefile | 2 +- sys/modules/virtio/p9fs/Makefile | 32 + 23 files changed, 6694 insertions(+), 1 deletion(-) diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile index 84d8d9011503..34a8a43d9c7a 100644 --- a/share/man/man5/Makefile +++ b/share/man/man5/Makefile @@ -47,6 +47,7 @@ MAN= acct.5 \ nsswitch.conf.5 \ nullfs.5 \ os-release.5 \ + p9fs.5 \ passwd.5 \ pbm.5 \ periodic.conf.5 \ diff --git a/share/man/man5/p9fs.5 b/share/man/man5/p9fs.5 new file mode 100644 index 000000000000..5c110e3dc963 --- /dev/null +++ b/share/man/man5/p9fs.5 @@ -0,0 +1,127 @@ +.\" +.\" Copyright (c) 2022-present Doug Rabson +.\" All rights reserved. +.\" +.\" 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 DOCUMENTATION IS PROVIDED BY THE AUTHOR ``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 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. +.\" +.Dd December 7, 2022 +.Dt P9FS 5 +.Os +.Sh NAME +.Nm p9fs +.Nd "9P file system" +.Sh SYNOPSIS +To use this filesystem, +either add the following to the kernel config: +.Bd -ragged -offset indent +.Cd "options P9FS" +.Cd "device virtio_p9fs" +.Ed +.Pp +Alternatively, load the driver as a kernel module, +either at boot time by adding the following to +.Xr loader.conf 5 : +.Bd -literal -offset indent +virtio_p9fs_load="YES" +.Ed +.Pp +or on system startup using the command: +.Pp +.Dl "# sysrc kld_list+=virtio_p9fs" +.Sh DESCRIPTION +The +.Nm +filesystem uses the 9P protocol to mount a host file system directory +into a +.Xr bhyve 8 +guest. +Multiple host directories can be accessed using the +.Xr bhyve 8 +virtio-9p virtual PCI device. +Each device is configured with a share name and a host directory path. +The share name can be used with +.Xr mount 8 +to mount the host directory in the guest: +.Pp +.Dl "# mount -t p9fs mysharename /mnt" +.Pp +Host directories can be mounted on system startup using +.Xr fstab 5 +like this: +.Pp +.Bd -literal -offset indent +mysharename /mnt p9fs rw 0 0 +.Ed +.Pp +Using +.Nm +as a root file system is supported by adding the following to +.Xr loader.conf 5 : +.Bd -literal -offset indent +vfs.root.mountfrom="p9fs:mysharename" +.Ed +.Sh LIMITATIONS +The 9P protocol relies on stateful file opens +which map protocol-level FIDs to host file descriptors. +The FreeBSD vnode interface doesn't support this and +.Nm +uses heuristics to guess the right FID to use for file operations. +.Pp +This can be confused by privilege lowering and +does not guarantee that the FID created for a +given file open is always used, +even if the calling process is using the file descriptor from +the original open call. +.Pp +In particular, accessing unlinked files using open file descriptor +may not work correctly. +If +.Nm +is the root filesystem, +it is recommented to use with +.Xr tmpfs 5 +to ensure that temporary files created in +.Pa /tmp +or +.Pa /var/tmp +have the expected semantics. +.Sh SEE ALSO +.Xr fstab 5 +.Sh HISTORY +The 9P protocol first appeared in the Plan 9 operating system. +More recently, the protocol has been widely used with virtual machines +to allow the use of host file resources inside a guest VM. +.Sh AUTHORS +This is derived from software released by Juniper Networks, Inc. +with many improvements and fixes from +.An Steve Wills . +.Pp +This manual page was written by +.An -nosplit +.An Doug Rabson Aq Mt dfr@FreeBSD.org . +.Sh BUGS +A better name for this filesystem would be +.Ar 9pfs +but for technical reasons, +the names of filesystems must be valid C identifiers. +As a compromise, +the filesystem is named +.Nm . diff --git a/sys/conf/files b/sys/conf/files index 6412e84d9f70..d0e6ee1eb477 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3421,6 +3421,7 @@ dev/virtio/balloon/virtio_balloon.c optional virtio_balloon dev/virtio/block/virtio_blk.c optional virtio_blk dev/virtio/console/virtio_console.c optional virtio_console dev/virtio/gpu/virtio_gpu.c optional virtio_gpu +dev/virtio/p9fs/virtio_p9fs.c optional virtio_p9fs dev/virtio/random/virtio_random.c optional virtio_random dev/virtio/scsi/virtio_scsi.c optional virtio_scsi dev/vkbd/vkbd.c optional vkbd @@ -3569,6 +3570,12 @@ fs/nfsserver/nfs_nfsdcache.c optional nfsd inet fs/nullfs/null_subr.c optional nullfs fs/nullfs/null_vfsops.c optional nullfs fs/nullfs/null_vnops.c optional nullfs +fs/p9fs/p9_client.c optional p9fs +fs/p9fs/p9_protocol.c optional p9fs +fs/p9fs/p9_transport.c optional p9fs +fs/p9fs/p9fs_subr.c optional p9fs +fs/p9fs/p9fs_vfsops.c optional p9fs +fs/p9fs/p9fs_vnops.c optional p9fs fs/procfs/procfs.c optional procfs fs/procfs/procfs_dbregs.c optional procfs fs/procfs/procfs_fpregs.c optional procfs diff --git a/sys/conf/options b/sys/conf/options index b05e146b7428..2becb1aaa7a3 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -279,6 +279,7 @@ TMPFS opt_dontuse.h UDF opt_dontuse.h UNIONFS opt_dontuse.h ZFS opt_dontuse.h +P9FS opt_dontuse.h # Pseudofs debugging PSEUDOFS_TRACE opt_pseudofs.h diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c new file mode 100644 index 000000000000..77f5b1334e77 --- /dev/null +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -0,0 +1,511 @@ +/*- + * Copyright (c) 2017 Juniper Networks, Inc. + * All rights reserved. + * + * 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 ``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 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. + * + */ +/* + * The Virtio 9P transport driver. This file contains all functions related to + * the virtqueue infrastructure which include creating the virtqueue, host + * interactions, interrupts etc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#define VT9P_MTX(_sc) (&(_sc)->vt9p_mtx) +#define VT9P_LOCK(_sc) mtx_lock(VT9P_MTX(_sc)) +#define VT9P_UNLOCK(_sc) mtx_unlock(VT9P_MTX(_sc)) +#define VT9P_LOCK_INIT(_sc) mtx_init(VT9P_MTX(_sc), \ + "VIRTIO 9P CHAN lock", NULL, MTX_DEF) +#define VT9P_LOCK_DESTROY(_sc) mtx_destroy(VT9P_MTX(_sc)) +#define MAX_SUPPORTED_SGS 20 +static MALLOC_DEFINE(M_P9FS_MNTTAG, "p9fs_mount_tag", "P9fs Mounttag"); + +struct vt9p_softc { + device_t vt9p_dev; + struct mtx vt9p_mtx; + struct sglist *vt9p_sglist; + struct cv submit_cv; + bool busy; + struct virtqueue *vt9p_vq; + int max_nsegs; + uint16_t mount_tag_len; + char *mount_tag; + STAILQ_ENTRY(vt9p_softc) chan_next; +}; + +/* Global channel list, Each channel will correspond to a mount point */ +static STAILQ_HEAD( ,vt9p_softc) global_chan_list; +struct mtx global_chan_list_mtx; + +static struct virtio_feature_desc virtio_9p_feature_desc[] = { + { VIRTIO_9PNET_F_MOUNT_TAG, "9PMountTag" }, + { 0, NULL } +}; + +static void +global_chan_list_init(void) +{ + + mtx_init(&global_chan_list_mtx, "9pglobal", + NULL, MTX_DEF); + STAILQ_INIT(&global_chan_list); +} +SYSINIT(global_chan_list_init, SI_SUB_KLD, SI_ORDER_FIRST, + global_chan_list_init, NULL); + +/* We don't currently allow canceling of virtio requests */ +static int +vt9p_cancel(void *handle, struct p9_req_t *req) +{ + + return (1); +} + +SYSCTL_NODE(_vfs, OID_AUTO, 9p, CTLFLAG_RW, 0, "9P File System Protocol"); + +/* + * Maximum number of seconds vt9p_request thread sleep waiting for an + * ack from the host, before exiting + */ +static unsigned int vt9p_ackmaxidle = 120; + +SYSCTL_UINT(_vfs_9p, OID_AUTO, ackmaxidle, CTLFLAG_RW, &vt9p_ackmaxidle, 0, + "Maximum time request thread waits for ack from host"); + +/* + * Wait for completion of a p9 request. + * + * This routine will sleep and release the chan mtx during the period. + * chan mtx will be acquired again upon return. + */ +static int +vt9p_req_wait(struct vt9p_softc *chan, struct p9_req_t *req) +{ + if (req->tc->tag != req->rc->tag) { + if (msleep(req, VT9P_MTX(chan), 0, "chan lock", + vt9p_ackmaxidle * hz)) { + /* + * Waited for 120s. No response from host. + * Can't wait for ever.. + */ + P9_DEBUG(ERROR, "Timeout after waiting %u seconds" + "for an ack from host\n", vt9p_ackmaxidle); + return (EIO); + } + KASSERT(req->tc->tag == req->rc->tag, + ("Spurious event on p9 req")); + } + return (0); +} + +/* + * Request handler. This is called for every request submitted to the host + * It basically maps the tc/rc buffers to sg lists and submits the requests + * into the virtqueue. Since we have implemented a synchronous version, the + * submission thread sleeps until the ack in the interrupt wakes it up. Once + * it wakes up, it returns back to the P9fs layer. The rc buffer is then + * processed and completed to its upper layers. + */ +static int +vt9p_request(void *handle, struct p9_req_t *req) +{ + int error; + struct vt9p_softc *chan; + int readable, writable; + struct sglist *sg; + struct virtqueue *vq; + + chan = handle; + sg = chan->vt9p_sglist; + vq = chan->vt9p_vq; + + P9_DEBUG(TRANS, "%s: req=%p\n", __func__, req); + + /* Grab the channel lock*/ + VT9P_LOCK(chan); + sglist_reset(sg); + /* Handle out VirtIO ring buffers */ + 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); + return (error); + } + readable = sg->sg_nseg; + + 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); + return (error); + } + writable = sg->sg_nseg - readable; + +req_retry: + error = virtqueue_enqueue(vq, req, sg, readable, writable); + + if (error != 0) { + if (error == ENOSPC) { + /* + * Condvar for the submit queue. Unlock the chan + * since wakeup needs one. + */ + cv_wait(&chan->submit_cv, VT9P_MTX(chan)); + P9_DEBUG(TRANS, "%s: retry virtio request\n", __func__); + goto req_retry; + } else { + P9_DEBUG(ERROR, "%s: virtio enuqueue failed \n", __func__); + VT9P_UNLOCK(chan); + return (EIO); + } + } + + /* We have to notify */ + virtqueue_notify(vq); + + error = vt9p_req_wait(chan, req); + if (error != 0) { + VT9P_UNLOCK(chan); + return (error); + } + + VT9P_UNLOCK(chan); + + P9_DEBUG(TRANS, "%s: virtio request kicked\n", __func__); + + return (0); +} + +/* + * Completion of the request from the virtqueue. This interrupt handler is + * setup at initialization and is called for every completing request. It + * just wakes up the sleeping submission requests. + */ +static void +vt9p_intr_complete(void *xsc) +{ + struct vt9p_softc *chan; + struct virtqueue *vq; + struct p9_req_t *curreq; + + chan = (struct vt9p_softc *)xsc; + vq = chan->vt9p_vq; + + P9_DEBUG(TRANS, "%s: completing\n", __func__); + + VT9P_LOCK(chan); + while ((curreq = virtqueue_dequeue(vq, NULL)) != NULL) { + curreq->rc->tag = curreq->tc->tag; + wakeup_one(curreq); + } + virtqueue_enable_intr(vq); + cv_signal(&chan->submit_cv); + VT9P_UNLOCK(chan); +} + +/* + * Allocation of the virtqueue with interrupt complete routines. + */ +static int +vt9p_alloc_virtqueue(struct vt9p_softc *sc) +{ + struct vq_alloc_info vq_info; + device_t dev; + + dev = sc->vt9p_dev; + + VQ_ALLOC_INFO_INIT(&vq_info, sc->max_nsegs, + vt9p_intr_complete, sc, &sc->vt9p_vq, + "%s request", device_get_nameunit(dev)); + + return (virtio_alloc_virtqueues(dev, 0, 1, &vq_info)); +} + +/* Probe for existence of 9P virtio channels */ +static int +vt9p_probe(device_t dev) +{ + + /* If the virtio device type is a 9P device, then we claim and attach it */ + if (virtio_get_device_type(dev) != VIRTIO_ID_9P) + return (ENXIO); + device_set_desc(dev, "VirtIO 9P Transport"); + + return (BUS_PROBE_DEFAULT); +} + +static void +vt9p_stop(struct vt9p_softc *sc) +{ + + /* Device specific stops .*/ + virtqueue_disable_intr(sc->vt9p_vq); + virtio_stop(sc->vt9p_dev); +} + +/* Detach the 9P virtio PCI device */ +static int +vt9p_detach(device_t dev) +{ + struct vt9p_softc *sc; + + sc = device_get_softc(dev); + VT9P_LOCK(sc); + vt9p_stop(sc); + VT9P_UNLOCK(sc); + + if (sc->vt9p_sglist) { + sglist_free(sc->vt9p_sglist); + sc->vt9p_sglist = NULL; + } + if (sc->mount_tag) { + free(sc->mount_tag, M_P9FS_MNTTAG); + sc->mount_tag = NULL; + } + mtx_lock(&global_chan_list_mtx); + STAILQ_REMOVE(&global_chan_list, sc, vt9p_softc, chan_next); + mtx_unlock(&global_chan_list_mtx); + + VT9P_LOCK_DESTROY(sc); + cv_destroy(&sc->submit_cv); + + return (0); +} + +/* Attach the 9P virtio PCI device */ +static int +vt9p_attach(device_t dev) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + struct vt9p_softc *chan; + char *mount_tag; + int error; + uint16_t mount_tag_len; + + chan = device_get_softc(dev); + chan->vt9p_dev = dev; + + /* Init the channel lock. */ + VT9P_LOCK_INIT(chan); + /* Initialize the condition variable */ + cv_init(&chan->submit_cv, "Conditional variable for submit queue" ); + chan->max_nsegs = MAX_SUPPORTED_SGS; + chan->vt9p_sglist = sglist_alloc(chan->max_nsegs, M_NOWAIT); + + /* Negotiate the features from the host */ + virtio_set_feature_desc(dev, virtio_9p_feature_desc); + virtio_negotiate_features(dev, VIRTIO_9PNET_F_MOUNT_TAG); + + /* + * If mount tag feature is supported read the mount tag + * from device config + */ + if (virtio_with_feature(dev, VIRTIO_9PNET_F_MOUNT_TAG)) + mount_tag_len = virtio_read_dev_config_2(dev, + offsetof(struct virtio_9pnet_config, mount_tag_len)); + else { + error = EINVAL; + P9_DEBUG(ERROR, "%s: Mount tag feature not supported by host\n", __func__); + goto out; + } + mount_tag = malloc(mount_tag_len + 1, M_P9FS_MNTTAG, + M_WAITOK | M_ZERO); + + virtio_read_device_config(dev, + offsetof(struct virtio_9pnet_config, mount_tag), + mount_tag, mount_tag_len); + + device_printf(dev, "Mount tag: %s\n", mount_tag); + + mount_tag_len++; + chan->mount_tag_len = mount_tag_len; + chan->mount_tag = mount_tag; + + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "p9fs_mount_tag", + CTLFLAG_RD, chan->mount_tag, 0, "Mount tag"); + + if (chan->vt9p_sglist == NULL) { + error = ENOMEM; + P9_DEBUG(ERROR, "%s: Cannot allocate sglist\n", __func__); + goto out; + } + + /* We expect one virtqueue, for requests. */ + error = vt9p_alloc_virtqueue(chan); + + if (error != 0) { + P9_DEBUG(ERROR, "%s: Allocating the virtqueue failed \n", __func__); + goto out; + } + + error = virtio_setup_intr(dev, INTR_TYPE_MISC|INTR_MPSAFE); + + if (error != 0) { + P9_DEBUG(ERROR, "%s: Cannot setup virtqueue interrupt\n", __func__); + goto out; + } + error = virtqueue_enable_intr(chan->vt9p_vq); + + if (error != 0) { + P9_DEBUG(ERROR, "%s: Cannot enable virtqueue interrupt\n", __func__); + goto out; + } + + mtx_lock(&global_chan_list_mtx); + /* Insert the channel in global channel list */ + STAILQ_INSERT_HEAD(&global_chan_list, chan, chan_next); + mtx_unlock(&global_chan_list_mtx); + + return (0); +out: + /* Something went wrong, detach the device */ + vt9p_detach(dev); + return (error); +} + +/* + * Allocate a new virtio channel. This sets up a transport channel + * for 9P communication + */ +static int +vt9p_create(const char *mount_tag, void **handlep) +{ + struct vt9p_softc *sc, *chan; + + chan = NULL; + + /* + * Find out the corresponding channel for a client from global list + * of channels based on mount tag and attach it to client + */ + mtx_lock(&global_chan_list_mtx); + STAILQ_FOREACH(sc, &global_chan_list, chan_next) { + if (!strcmp(sc->mount_tag, mount_tag)) { + chan = sc; + break; + } + } + mtx_unlock(&global_chan_list_mtx); + + /* + * If chan is already attached to a client then it cannot be used for + * another client. + */ + if (chan && chan->busy) { + //p9_debug(TRANS, "Channel busy: used by clnt=%p\n", chan->client); + return (EBUSY); + } + + /* If we dont have one, for now bail out.*/ + if (chan) { + *handlep = (void *)chan; + chan->busy = TRUE; + } else { + P9_DEBUG(TRANS, "%s: No Global channel with mount_tag=%s\n", + __func__, mount_tag); + return (EINVAL); + } + + return (0); +} + +static void +vt9p_close(void *handle) +{ + struct vt9p_softc *chan = handle; + chan->busy = FALSE; +} + +static struct p9_trans_module vt9p_trans = { + .name = "virtio", + .create = vt9p_create, + .close = vt9p_close, + .request = vt9p_request, + .cancel = vt9p_cancel, +}; + +static device_method_t vt9p_mthds[] = { + /* Device methods. */ + DEVMETHOD(device_probe, vt9p_probe), + DEVMETHOD(device_attach, vt9p_attach), + DEVMETHOD(device_detach, vt9p_detach), + DEVMETHOD_END +}; + +static driver_t vt9p_drv = { + "virtio_p9fs", + vt9p_mthds, + sizeof(struct vt9p_softc) +}; + +static int +vt9p_modevent(module_t mod, int type, void *unused) +{ + int error; + + error = 0; + + switch (type) { + case MOD_LOAD: + p9_init_zones(); + p9_register_trans(&vt9p_trans); + break; + case MOD_UNLOAD: + p9_destroy_zones(); + break; + case MOD_SHUTDOWN: + break; + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +DRIVER_MODULE(virtio_p9fs, virtio_pci, vt9p_drv, vt9p_modevent, 0); +MODULE_VERSION(virtio_p9fs, 1); +MODULE_DEPEND(virtio_p9fs, virtio, 1, 1, 1); +MODULE_DEPEND(virtio_p9fs, p9fs, 1, 1, 1); diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.h b/sys/dev/virtio/p9fs/virtio_p9fs.h new file mode 100644 index 000000000000..924b413d29a5 --- /dev/null +++ b/sys/dev/virtio/p9fs/virtio_p9fs.h @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2017 Juniper Networks, Inc. + * All rights reserved. + * + * 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 ``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 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. + * + */ + +#ifndef __VIRTIO_9P_CONFIG__ +#define __VIRTIO_9P_CONFIG__ + +/* Mount point feature specified in config variable */ +#define VIRTIO_9PNET_F_MOUNT_TAG 1 + +struct virtio_9pnet_config { + /* Mount tag length */ + uint16_t mount_tag_len; + /* non NULL terminated tag name */ + uint8_t mount_tag[0]; +}; +#endif /* __VIRTIO_9P_CONFIG__ */ diff --git a/sys/fs/p9fs/p9_client.c b/sys/fs/p9fs/p9_client.c new file mode 100644 index 000000000000..8f36cc4e775a --- /dev/null +++ b/sys/fs/p9fs/p9_client.c @@ -0,0 +1,1311 @@ +/*- + * Copyright (c) 2017 Juniper Networks, Inc. + * All rights reserved. + * + * 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 ``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 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 file contains 9P client functions which prepares message to be sent to + * the server. Every fileop typically has a function defined here to interact + * with the host. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define QEMU_HEADER 7 +#define P9FS_MAX_FID_CNT (1024 * 1024 * 1024) +#define P9FS_ROOT_FID_NO 2 +#define P9FS_MIN_TAG 1 +#define P9FS_MAX_TAG 65535 +#define WSTAT_SIZE 47 +#define WSTAT_EXTENSION_SIZE 14 + +static MALLOC_DEFINE(M_P9CLNT, "p9_client", "p9fs client structure"); +static uma_zone_t p9fs_fid_zone; +static uma_zone_t p9fs_req_zone; +static uma_zone_t p9fs_buf_zone; + +SYSCTL_DECL(_vfs_p9fs); +int p9_debug_level = 0; +SYSCTL_INT(_vfs_p9fs, OID_AUTO, debug_level, CTLFLAG_RW, + &p9_debug_level, 0, "p9fs debug logging"); + +static struct p9_req_t *p9_get_request(struct p9_client *c, int *error); +static struct p9_req_t *p9_client_request( + struct p9_client *c, int8_t type, int *error, const char *fmt, ...); + +inline int +p9_is_proto_dotl(struct p9_client *clnt) +{ + + return (clnt->proto_version == p9_proto_2000L); +} + +inline int +p9_is_proto_dotu(struct p9_client *clnt) +{ + + return (clnt->proto_version == p9_proto_2000u); +} + +/* Parse mount options into client structure */ +static int +p9_parse_opts(struct mount *mp, struct p9_client *clnt) +{ + int error, len; + char *trans; + + /* + * Default to virtio since thats the only transport we have for now. + */ + error = vfs_getopt(mp->mnt_optnew, "trans", (void **)&trans, &len); + if (error == ENOENT) + trans = "virtio"; + + /* These are defaults for now */ + clnt->proto_version = p9_proto_2000L; + clnt->msize = 8192; + + /* Get the default trans callback */ + clnt->ops = p9_get_trans_by_name(trans); + + return (0); +} + +/* Allocate buffer for sending request and getting responses */ +static struct p9_buffer * +p9_buffer_alloc(int alloc_msize) +{ + struct p9_buffer *fc; + + fc = uma_zalloc(p9fs_buf_zone, M_WAITOK | M_ZERO); + fc->capacity = alloc_msize; + fc->offset = 0; + fc->size = 0; + fc->sdata = (char *)fc + sizeof(struct p9_buffer); + + return (fc); +} + +/* Free memory used by request and response buffers */ +static void +p9_buffer_free(struct p9_buffer **buf) +{ + + /* Free the sdata buffers first, then the whole structure*/ + uma_zfree(p9fs_buf_zone, *buf); + *buf = NULL; +} + +/* Free the request */ +static void +p9_free_req(struct p9_client *clnt, struct p9_req_t *req) +{ + + 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); + + uma_zfree(p9fs_req_zone, req); +} + +/* Allocate a request by tag */ +static struct p9_req_t * +p9_get_request(struct p9_client *clnt, int *error) +{ + struct p9_req_t *req; + int alloc_msize; + uint16_t tag; + *** 5964 LINES SKIPPED *** From nobody Fri Jul 4 13:28:43 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGN0m7tz615CC; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGM6j4yz3Lvm; Fri, 04 Jul 2025 13:28:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KHvd7/5eHEIe5vkib1te3zJdR60B0pohbkvSwbucAGI=; b=LOoflivbqoPbJQSq4kvBcrV+opzRwAwD4McVdCw1wnA+TRZofHNbrvSENXlKTVKoQnrw8C 4vM7c/5+jowf3Q/c5GJVUBcvS5hKAN5RjCLER4kTQRaZu+hytTAQnt/gIB/KkuGxPCRY/C IdI6jdf9HuBytEjlvmg1EKeSpNiFnSDtGNqmxwN/KFQIKkLuI+vlbL9DTb4ILoTLj+4kzk 7SekwjWzhyiP/h3orqlco5pQDaNR5INYTtjJTFUPbMcXbgS2CsQptAYwt7rGODhRCQRnbt E/l5ACgnxpPKwLJJyYOrh4O3wObBhg3EKFWUA2NsX1WtQ7ZK2L7OpASU7KBVDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KHvd7/5eHEIe5vkib1te3zJdR60B0pohbkvSwbucAGI=; b=EZJXjOxVOvx3V0iIfAzl/CXO7m0qvnwyDoxB4IkyZU8MkVNMAp2AFMzQGnQgL0NlXLlKzx aWZZp+yyLZYR955CCq2NeVqjDC4jstFfFNQDgnddQY5jWfpj6P0epuMgfkeQH2jU3I0Xby AF1+2DpRKnhMBo0pm2kGc+JwseBa5EYhMRiYtEAyUs3kRqd+aOl9SfyNoub+4reGtHuunW xCn+zmswZUAymEB4O0GUuNJK8gQJjeewPv/hEJ6n5gN32W5XmODNkPpcJSbAvCgOs4tjoE g+5KDyfsoO5bb/RQ/U97AAD1xouytaRt9NmUywzHtFQ5Qt3OxHRip6Po7u1MZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635724; a=rsa-sha256; cv=none; b=xGBcWYiZhr/glZDky6FY3zNfQHb9I+f7i0f0HDQXoeUmn/NniG9EgpFomC2UMQwL+tzHTl MZwgi/RoinwUOEtrsxt1eKpJzV4cU623O9b7/TZ/jCXsdT6flb/d6eS8nzLQ6N0oo3Grce 3DQja61G7VzDo3k+8kRfxJ7K/YbmsXpiVVOBoeT4EWM2d7xq1YyYtSeTJbWvQbX7CVZuse CaRKGEl9+EigSx7bMVKxH/u+e9C4jVsM7U71AZf3R+3hLV+SqA8zDsXjxtJhxdlA3thuhZ 30QZAFTr9FPZNknAALVP5qP1+ZVvqwIC0SGkxZjoaRVkc6YijVv79M5fsQ9OmA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGM6JWLzsD3; Fri, 04 Jul 2025 13:28:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSh4D005779; Fri, 4 Jul 2025 13:28:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DShi4005776; Fri, 4 Jul 2025 13:28:43 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:43 GMT Message-Id: <202507041328.564DShi4005776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: ab63bdaf1d1f - stable/14 - p9fs: Fix the build for 32-bit kernels List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ab63bdaf1d1f96a3a682886dccd13936a8cb0a5d Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=ab63bdaf1d1f96a3a682886dccd13936a8cb0a5d commit ab63bdaf1d1f96a3a682886dccd13936a8cb0a5d Author: Doug Rabson AuthorDate: 2024-06-19 14:15:34 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:05 +0000 p9fs: Fix the build for 32-bit kernels MFC after: 3 months (cherry picked from commit b2ebcd19f467f518aa969b84527018c03fb0286e) --- sys/fs/p9fs/p9fs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index c1bea18d5eef..d17d7624aef1 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -1762,7 +1762,7 @@ p9fs_readdir(struct vop_readdir_args *ap) count = 0; clnt = np->p9fs_ses->clnt; - P9_DEBUG(VOPS, "%s: vp %p, offset %ld, resid %zd\n", __func__, vp, uio->uio_offset, uio->uio_resid); + P9_DEBUG(VOPS, "%s: vp %p, offset %jd, resid %zd\n", __func__, vp, (intmax_t) uio->uio_offset, uio->uio_resid); if (ap->a_uio->uio_iov->iov_len <= 0) return (EINVAL); From nobody Fri Jul 4 13:28:45 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGQ53spz614wh; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGQ1WMrz3Lsf; Fri, 04 Jul 2025 13:28:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MM601fNw1R0RUcvSzc067vqldrNlgeoW4Ftsxmj+vwI=; b=C/o1Xkic+CEPK2Hoe7NTf5kS13zHFKYbrroV8Cp3LyueVX3QG4hXMpsHspqzItvCpUSZzl pBkMwOVo1RbcVeFwKvAlt/jVixFwkUF/4oaEUClfVz7Z2gQQQStWzRqjA/Rt6rWw3+HDY9 XVmvBnLM9WVAsu4G6pDAiDK9Ynba6srN28IuI5o6BrioMwLEUiHeduqGR4kbpfJATHczy7 MzFPLvbJ9ZU20xMJLxBf6KkUFJutoJIz4mE/XWpGfX2dTRM+ENtZdYysjOGVxXZcXg9pzz 19aMoV0wC/ba53ou5hhr/TGX6KIoQwGaH1b1te9e8IBSSyJnAjUStZSBjhIITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MM601fNw1R0RUcvSzc067vqldrNlgeoW4Ftsxmj+vwI=; b=NrwJXfWYBHJeyz+lerg04+rMge4GDmwEOesh4sFBFwsrymX4DckmdkvK0jhXKSV4S7meVe E3Z4Ei6rmSjURE+XAU113pBu5gqcx8rEaSOiqK/YhEJgE7kR5o3I6Ke2aI0juSz003sEK0 57z0uRBMFddMy6Ujb0oXv8lc1m2oMyYQLe+KCiYbVRkgjjkoCE+qtTOrcw9wly4jEH7uTD 1N316JfTMH3vw79e8bUC9txLpjnWxAYeoCjgJkLtUqLZJoHbW7ZnBi9bYVMMVMkhvdhIdP gA1P11lB2pYXvkOTJ4HxOXcm5jRXJPz4oLDPdrru8yyZenBCrWeuMloBM8hzMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635726; a=rsa-sha256; cv=none; b=UisWMaJqtC7YLM8gBHngU+kyW1195EnXE2zr3kscnBGUd1yRfHmfUGzWH9FL3CU6eu9gMs dhusjYGEPYIEOyXi1J9a2yOQgITSIC8dRzDRzrsPeqIHbLmQP5RT01CM7VjNMxDtjuJSSN YNQuJvjTUXmlT09bfg6dyxW9ecZcDZxpb43MVogzaJkzAniJoGO23081IfCYH5G8tGbXuC tUx4Fwjk+w0Am5Fq+WAvss+abDeyamE8CjKnpkwwuFSvFUAXlTwyKaKWbf1lWjLzTXjT6A yE3/TfwYvVyc5mKuPVCGoabuxvia1M6A0WergwCJTlBZKo70w4DOf+SVpgES3w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGQ0LV8zsGY; Fri, 04 Jul 2025 13:28:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSjdO005852; Fri, 4 Jul 2025 13:28:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSjnB005849; Fri, 4 Jul 2025 13:28:45 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:45 GMT Message-Id: <202507041328.564DSjnB005849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: 99f8e26e29a6 - stable/14 - p9fs: implement working putpages (fix mmap write) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 99f8e26e29a62714061998ace211f26e3f724af3 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=99f8e26e29a62714061998ace211f26e3f724af3 commit 99f8e26e29a62714061998ace211f26e3f724af3 Author: Val Packett AuthorDate: 2024-06-24 13:37:58 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:05 +0000 p9fs: implement working putpages (fix mmap write) Mostly copied from smbfs. This driver in its current state has the exact same issue that prevents the generic putpages implementation from working. Sponsored by: https://www.patreon.com/valpackett Reviewed by: dfr Differential Revision: https://reviews.freebsd.org/D45639 MFC after: 3 months (cherry picked from commit daa2c99c89f224200911aa6c8cdee07bc354947a) --- sys/fs/p9fs/p9fs_vfsops.c | 6 ++++ sys/fs/p9fs/p9fs_vnops.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/sys/fs/p9fs/p9fs_vfsops.c b/sys/fs/p9fs/p9fs_vfsops.c index 6cc65aca35d3..f674c866ce9d 100644 --- a/sys/fs/p9fs/p9fs_vfsops.c +++ b/sys/fs/p9fs/p9fs_vfsops.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,7 @@ static uma_zone_t p9fs_node_zone; uma_zone_t p9fs_io_buffer_zone; uma_zone_t p9fs_getattr_zone; uma_zone_t p9fs_setattr_zone; +uma_zone_t p9fs_pbuf_zone; extern struct vop_vector p9fs_vnops; /* option parsing */ @@ -106,6 +108,9 @@ p9fs_init(struct vfsconf *vfsp) p9fs_setattr_zone = uma_zcreate("p9fs setattr zone", sizeof(struct p9_iattr_dotl), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + /* Create the putpages zone */ + p9fs_pbuf_zone = pbuf_zsecond_create("p9fs pbuf zone", nswbuf / 2); + /* * Create the io_buffer zone pool to keep things simpler in case of * multiple threads. Each thread works with its own so there is no @@ -126,6 +131,7 @@ p9fs_uninit(struct vfsconf *vfsp) uma_zdestroy(p9fs_io_buffer_zone); uma_zdestroy(p9fs_getattr_zone); uma_zdestroy(p9fs_setattr_zone); + uma_zdestroy(p9fs_pbuf_zone); return (0); } diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index 77162c0a4aff..5556e60f4bae 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -39,10 +39,14 @@ #include #include #include +#include +#include #include #include #include +#include +#include #include #include @@ -62,6 +66,7 @@ static MALLOC_DEFINE(M_P9UIOV, "uio", "UIOV structures for strategy in p9fs"); extern uma_zone_t p9fs_io_buffer_zone; extern uma_zone_t p9fs_getattr_zone; extern uma_zone_t p9fs_setattr_zone; +extern uma_zone_t p9fs_pbuf_zone; /* For the root vnode's vnops. */ struct vop_vector p9fs_vnops; @@ -2126,6 +2131,79 @@ out: return (error); } +/* + * Put VM pages, synchronously. + * XXX: like smbfs, cannot use vop_stdputpages due to mapping requirement + */ +static int +p9fs_putpages(struct vop_putpages_args *ap) +{ + struct uio uio; + struct iovec iov; + int i, error, npages, count; + off_t offset; + int *rtvals; + struct vnode *vp; + struct thread *td; + struct ucred *cred; + struct p9fs_node *np; + vm_page_t *pages; + vm_offset_t kva; + struct buf *bp; + + vp = ap->a_vp; + np = P9FS_VTON(vp); + td = curthread; + cred = curthread->td_ucred; + pages = ap->a_m; + count = ap->a_count; + rtvals = ap->a_rtvals; + npages = btoc(count); + offset = IDX_TO_OFF(pages[0]->pindex); + + /* + * When putting pages, do not extend file past EOF. + */ + if (offset + count > np->inode.i_size) { + count = np->inode.i_size - offset; + if (count < 0) + count = 0; + } + + for (i = 0; i < npages; i++) + rtvals[i] = VM_PAGER_ERROR; + + bp = uma_zalloc(p9fs_pbuf_zone, M_WAITOK); + kva = (vm_offset_t) bp->b_data; + pmap_qenter(kva, pages, npages); + + VM_CNT_INC(v_vnodeout); + VM_CNT_ADD(v_vnodepgsout, count); + + iov.iov_base = (caddr_t) kva; + iov.iov_len = count; + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + uio.uio_offset = offset; + uio.uio_resid = count; + uio.uio_segflg = UIO_SYSSPACE; + uio.uio_rw = UIO_WRITE; + uio.uio_td = td; + + P9_DEBUG(VOPS, "of=%jd,resid=%zd\n", (intmax_t)uio.uio_offset, uio.uio_resid); + + error = VOP_WRITE(vp, &uio, vnode_pager_putpages_ioflags(ap->a_sync), + cred); + + pmap_qremove(kva, npages); + uma_zfree(p9fs_pbuf_zone, bp); + + if (error == 0) + vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid, + np->inode.i_size - offset, npages * PAGE_SIZE); + + return (rtvals[0]); +} struct vop_vector p9fs_vnops = { .vop_default = &default_vnodeops, @@ -2150,5 +2228,6 @@ struct vop_vector p9fs_vnops = { .vop_rename = p9fs_rename, .vop_link = p9fs_link, .vop_readlink = p9fs_readlink, + .vop_putpages = p9fs_putpages, }; VFS_VOP_VECTOR_REGISTER(p9fs_vnops); From nobody Fri Jul 4 13:28:44 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGP3F7sz6156j; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGP0Nltz3Lxv; Fri, 04 Jul 2025 13:28:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B7+EixfyEcDYxdhLAR+qMBh7B9gXpg4ZHfg9Wqq8MB0=; b=fRpI63WnNPh3zt7pGR2cpLc5WwB09srTsyB5L1+BWk5313UKQ5V3E4dLAs8wwOkHgPOM/F YU9RW//N7uFR4Y6fMvUtxGp9fjktA1xQRtatpz1GOcjChjYFj8ad+2WNWsvTotUJtoK82q lT/PzcewzCzBigPzMSGeEcwC1bQV5JUS+rmUhChiTfYiWAe3pSJYCsiuYBMc8oCohdmpKC gpcJqMAn6ETZAmXzV8oWWtCfkd85FUbvIicFo3ZrLW6CjQsX4BuMOZeoziGGESXZT7UBri 9wlaPeGg7EJc/X+BTIMoAfOFHS2caqWaQrQKYB1+5GJUe/AF3sjMnKIYbxsWPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=B7+EixfyEcDYxdhLAR+qMBh7B9gXpg4ZHfg9Wqq8MB0=; b=dOpjpf6Mej978iuw5yce8Z8tCg4bkjHtcRkMs4TTcFwuH7g08TgW5t377NMx42dxItGR99 y4ezYNstavdFOpC/ckkVGdvzuPqfOiQ1KpIkyY/HCgdouIxunAQu8bBI9GEcC9vnR5toit zShV4aLMcFRSlSZuFiZ6DeEyI0ui8Qyx8sO+yhWe43QSkw97cYFx7HnjZL0TG33qHqi+g6 +nnN7kXrUurzRPKT7yflhu+vL3FbXkT67u6sgxEbPjAH7EifuRfK5Kp3I/IMmJr9kCoqkX K0BlSaFv2j6AefdyDqIW81eWKAmCnIUk57ti7WaMkDcp4aSPfqAcoGSJ5j/zPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635725; a=rsa-sha256; cv=none; b=S8VrstzU2jBW7DjIxXEzUOdFeyC6WmqIOhvqdpfZKtnWtYY40XnOq/6a/Y5KXU9LR57JM+ F6USv72wAqCbrCzjrYUv3KWGcz0o8vJzBkjChWn4Zxtemi2IQyuraD8ITHWStUutPDzsUI aug1vr7sDA82tOUyQN5ND7l1CzOd1lqD3EFxPfp2aNj8G1tUnXMIwyPYVuBsMzO5n66fms u0wcb+bL6xKdthR7dVvb6DhOX/7+Ti0+Vz9rD/x3xLXnve+W1MdNakYqSR7z6P+VGWFr2r cXDOeZYueg1aslWE3Ahtb2IotdpttJp8b0M/5AmCrfLtBwZk6paRv3ryqK632A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGN75brzs0y; Fri, 04 Jul 2025 13:28:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSi71005818; Fri, 4 Jul 2025 13:28:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSiwm005815; Fri, 4 Jul 2025 13:28:44 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:44 GMT Message-Id: <202507041328.564DSiwm005815@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: 03f840f9cc8b - stable/14 - p9fs: fix lookup of "." for lib9p-based 9P servers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 03f840f9cc8b5d02e776f59b033fe6165fc2cf4a Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=03f840f9cc8b5d02e776f59b033fe6165fc2cf4a commit 03f840f9cc8b5d02e776f59b033fe6165fc2cf4a Author: Doug Rabson AuthorDate: 2024-06-24 11:22:57 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:05 +0000 p9fs: fix lookup of "." for lib9p-based 9P servers The lib9p implementation takes a strict interpretation of the Twalk RPC call and returns an error for attempts to lookup ".". The workaround is to fake the lookup locally. Reviewed by: Val Packett MFC after: 3 months (cherry picked from commit 56e4622588ed2eec0197ac47c3059d3db439f5c0) --- sys/fs/p9fs/p9fs_vnops.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index d17d7624aef1..77162c0a4aff 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -243,6 +243,12 @@ p9fs_lookup(struct vop_lookup_args *ap) if (dnp == NULL) return (ENOENT); + if (cnp->cn_nameptr[0] == '.' && strlen(cnp->cn_nameptr) == 1) { + vref(dvp); + *vpp = dvp; + return (0); + } + vses = dnp->p9fs_ses; mp = vses->p9fs_mount; From nobody Fri Jul 4 13:28:47 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGS0G5Hz6155D; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGR3wPcz3MBk; Fri, 04 Jul 2025 13:28:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NdDYSMeF6CGL3E08YEBS7UG95OVVEgUx9REEbH9kCv4=; b=g6blnGOJACfolCXoPPYEH+jVYuwkIdI7MTRRDQYlYAvg0VUXwW9Q6bzjVUcmhsnOdO65WT DWg3yHIwoeXodXf0LV7QRnkIBDKfhhLURvxluUxvI1osdO8FRwogfTqDgH7TJm+vVhnQ31 q8cFuhEFqU5WN11++WT343uzXviLfJ8USha3vm6zay7+ovnisualije9/ARSKnWWHCJqY/ h1GirBnIFjHEcoRYAxzFv5zCeRxlUFmCdnAVh1IeSs++AVhQbsMNPavSWUJaboZ224/XA0 RIAwH0Ikmd4vcsb+QcdDIWRjHUFclWCENVXdxjpDBeddr4EoWUFsbWJA/K7UcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NdDYSMeF6CGL3E08YEBS7UG95OVVEgUx9REEbH9kCv4=; b=RxRkSllXHXL75h0WWvDtRgnlK+spgP4ANFM1Yq1qQZPzI+vzC1FWU6/tZgTZrc6ei87Mqd 7dejaPzKftoIUocLMk9sMKGZqTgP0Ug/o5xEPOqwsfJn73/CDxpheKtpck12+mEwQUWsjy SIMyJHP0zgjCVQV0ljZfAUitrzjMce6pmyt0+ewwc+IYPBMhU2Y7Ieizfq7MqHwUiXIw4X a2hGkqovMOhmriU93J3WTQjQJqWMldodpStd6N7e1I2hCnkqJkTiqkMBce6En5VWWkJvPY 1cBUU6r+V6ehcdW/nVnBBVpKgwa4bdzRoHQyuNTx6gtZ/Nto7SKVorx/nUel4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635727; a=rsa-sha256; cv=none; b=XfwEQHFTBCSy825EywdI5rWA0RA+TKylc+UW00L/+qCzz148Gf3ulW+DNAoQvpMZSTECay FAQ++KrNUJl25uUdSpUqUoqaGbGINmp7KQI75V2ywUGHGFOdDdncEgWqraXdH6SDXyCbsu 96Y48oV79cAMy2jQZwuJJ1u7C2nsxb9EvnI4hIbp3eQWuZ+Kkn70SFfvxttZSIV3XxCGJf NLZF5Rq0IuS3oE974HSPZakrFnj/OokId4BMESH6+7V+4iClnjsmofHWAX5uiycU0yMBhD QH6YlQzIp45Y2ttsZX6Wjn/NwzC/75kAWFCWXER/pJumtceafypEbk6sqK4PPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGR1WqKzsD4; Fri, 04 Jul 2025 13:28:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSlaT005885; Fri, 4 Jul 2025 13:28:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSl6m005882; Fri, 4 Jul 2025 13:28:47 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:47 GMT Message-Id: <202507041328.564DSl6m005882@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: 0d1dd7c4863a - stable/14 - p9fs: move NULL check immediately after allocation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0d1dd7c4863ab0856c93becf103d59acb917623d Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=0d1dd7c4863ab0856c93becf103d59acb917623d commit 0d1dd7c4863ab0856c93becf103d59acb917623d Author: Ed Maste AuthorDate: 2024-06-24 16:21:19 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:05 +0000 p9fs: move NULL check immediately after allocation Reported by: Shawn Webb (HardenedBSD) Reviewed by: dfr Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45719 (cherry picked from commit 1efd69f933b6ad4177ecda78cf4891aa9a1e8f6b) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 77f5b1334e77..1c076e353bbc 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -332,6 +332,11 @@ vt9p_attach(device_t dev) cv_init(&chan->submit_cv, "Conditional variable for submit queue" ); chan->max_nsegs = MAX_SUPPORTED_SGS; chan->vt9p_sglist = sglist_alloc(chan->max_nsegs, M_NOWAIT); + if (chan->vt9p_sglist == NULL) { + error = ENOMEM; + P9_DEBUG(ERROR, "%s: Cannot allocate sglist\n", __func__); + goto out; + } /* Negotiate the features from the host */ virtio_set_feature_desc(dev, virtio_9p_feature_desc); @@ -367,12 +372,6 @@ vt9p_attach(device_t dev) SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "p9fs_mount_tag", CTLFLAG_RD, chan->mount_tag, 0, "Mount tag"); - if (chan->vt9p_sglist == NULL) { - error = ENOMEM; - P9_DEBUG(ERROR, "%s: Cannot allocate sglist\n", __func__); - goto out; - } - /* We expect one virtqueue, for requests. */ error = vt9p_alloc_virtqueue(chan); From nobody Fri Jul 4 13:28:48 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGS4SQDz614wl; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGS36knz3MBp; Fri, 04 Jul 2025 13:28:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NXEnTnxlEs86RER/o/Z20z4YAGG8g7lRqGNcikw8NNE=; b=n+UapfKoK/zvw3Kptin21yCw1hyDs1Ewbj8zwFXWqiuA7zaPmcBwzqVHg5FSeX2JVoK9aD ipbzNioDdfDKcKTU5njNC8spER0DkFhqNks2typQu6JSD179+6HQFoit9Tx4GuJ+04YlA8 hIpIVPm1M8t8axCEdq3FaV8KrRTd17IR1CI8RG9OPVt3fpIU82QV2Q83WPjleow0CNoxJc eWU6FV/1TwpKXOfvROs/WRuA2O7xViplimXKqHxHyoPRxsCZNNQDTfkgF9oShCwK2nnoI1 RSDqLSa1VWLLRTCGHOMZS9egOqSOzJOVX4t4+oPMQvlg2Su0edKhhTDRzJhEgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NXEnTnxlEs86RER/o/Z20z4YAGG8g7lRqGNcikw8NNE=; b=Fp9GWzDd6dwjwj+J+C7UMZVjY+edFMmO5kA6B3/lSG910KUPtlEqIyTDTn/m3wtsuANCBl VdfqNBUPqenHwYkBU/QPGD9xLo3M8/Papqty3NfW7Q6I8vR4YiagziSZteOZflqu0SpRfv DA1Dobt/2KFTwhuKnWeg7AVR7vxIXJx5+pwSt05ShOlHHLTN+jKTnUaaoi2tcpB77jn9Zv 77c8D7tgE197QEm3sM566JwttTYw8xe+VGoF+6gE4XuISr7wUR6eBbkBxHphY7DdRJTgXX seXSPmYfcUtqq+2UtN3UlWZ2X4LDaRrQs+Zr6swelGVT/sjn5/F37Z5zec6Uvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635728; a=rsa-sha256; cv=none; b=aCvovdfdyRsPhyKYxe/i2ez/3dvmpYC+rAbe3zpgXfC3f5M5sumTOvc8ZG+mYKOq1fB5ND pUimpBPPTRO3XkiVONzG+AxmBGsKtEdMxCHm5nCzXElPMYPhuhzlZiSxhjOfYv6FnnzHK+ gKABzbsXkI4i8m1LWN9RpIZ9sdjYw2xCgo+a3wI0fN/6763Jyo2q4plgqptATCn4tsPg2A xk8KU0COKX5RIdNqmhjsQVvHcIqwWUbqeVPnJSDTEzvu01Ikm7WzS6QrkZEEz+pZtVQcaX WPHK6p2tm82PK1rLr9ZK92W8rMpkGH3RhXqJAP/wmSxntOKq8Dd8sft4cnteBQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGS2Vwxzs10; Fri, 04 Jul 2025 13:28:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSmD4005918; Fri, 4 Jul 2025 13:28:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSmd2005915; Fri, 4 Jul 2025 13:28:48 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:48 GMT Message-Id: <202507041328.564DSmd2005915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: 201d2e45f51f - stable/14 - p9fs: use M_WAITOK where appropriate List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 201d2e45f51fee2b1438bcc0a53a51bd6416ea73 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=201d2e45f51fee2b1438bcc0a53a51bd6416ea73 commit 201d2e45f51fee2b1438bcc0a53a51bd6416ea73 Author: Ed Maste AuthorDate: 2024-06-24 20:10:00 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 p9fs: use M_WAITOK where appropriate device_attach routines are allowed to sleep, and this routine already has other M_WAITOK allocations. Reported by: markj Reviewed by: markj Fixes: 1efd69f933b6 ("p9fs: move NULL check immediately after alloc...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45721 (cherry picked from commit e6b88237c6c33fe2f66cad9836858b877900871a) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 1c076e353bbc..e87659da2732 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -331,12 +331,7 @@ vt9p_attach(device_t dev) /* Initialize the condition variable */ cv_init(&chan->submit_cv, "Conditional variable for submit queue" ); chan->max_nsegs = MAX_SUPPORTED_SGS; - chan->vt9p_sglist = sglist_alloc(chan->max_nsegs, M_NOWAIT); - if (chan->vt9p_sglist == NULL) { - error = ENOMEM; - P9_DEBUG(ERROR, "%s: Cannot allocate sglist\n", __func__); - goto out; - } + chan->vt9p_sglist = sglist_alloc(chan->max_nsegs, M_WAITOK); /* Negotiate the features from the host */ virtio_set_feature_desc(dev, virtio_9p_feature_desc); From nobody Fri Jul 4 13:28:49 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGV4BB5z6156r; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGT47XPz3M4N; Fri, 04 Jul 2025 13:28:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wKfbflxrYoh5+zX1cgKXEeRnwqzYVOMqS+yBrYl9ee0=; b=qTBvg7u/aucmsWraVWwpV5Yb46bKKD8gJQu96ujDwte6WcN8Cy6F40grW55ckz8V0KInla GJcciUHivTKIdZ8QwH/R0X75a/9CzY4MsC+OuV64rYcD7BBSScwFCY70AanOSaB8FRBV03 uBxdzmhNgJG5atHFdFkVtH/SdmEe/akUnJsEm42AsvL15xC9n4nL93K+HygZTaoujUtzOk +EtYs9W+6zVUJTYghnLrwt3EXtwJhEkwPB4dUV49vI3aQC/2vu0xahnh4EQx/w5IZePc2T a+slQbng6SPztNQhwEV12aonLSQyRldrRas5gv/LrNY3dHNdq6rN5/EKvDNIzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wKfbflxrYoh5+zX1cgKXEeRnwqzYVOMqS+yBrYl9ee0=; b=qCAf0hZ5X9iM+59GXImbkrjxCaNAVReCyWfENs3IufHXpXGRVug+xbjcELEEgHl4lu60gk o2Gylbe5/mHNW6+y2KdlQhZ0k14gUPcEFbgYhe9EuVsiaVtt4/b7LNypayfubo5Xz7arRZ EYrYMSczl2JxGnI2+5p1eL17spQ9XV4KWjkAfU2Iio+Hl0M7iOKV6QSwPxxdYYhHKUSyO6 d4FFJemR37XiIFu1bSGGIgalMXELY5OY0n6RPjj0bjrVrkVzyAyui6pk6fLJp916ELd4o8 Vrb0sxNoA3gHMUn0piZ/vq7GRj1lPMmt+SHq3Gg8f/lWe/+0UjiRHO5nsydLRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635729; a=rsa-sha256; cv=none; b=p+/O9ZNbbDcLHxUuPcxmGZB7TwZif/LHXC/+HejHK/l5ASvAeZ/xR9hYbJL/Do0ztFkra2 rrfM5vHM8PwMEENnKJTdpaF6iTUqTkkdpTeKvS1SPYT0AcOHW+eZUOjoUCXGQ6LIhkcIro Y2cPPFucuy/rhgZwR4nuHVX5gNI159VjK3/rir8vhafTI9EO5FKOOhN06RCK6vQwi/b8/m +mNzQv5vLPquxL9gITiY1vwYTc9nnZnAmUolvqXKP4pLwGzqGnQaQK/sMjpbfXT4wHYJ6/ ryt/VSRxEtqSrc0k5H7hHOST3yhZK/nJnE4UYnOVqq54UyarXr0pqojVvVaqdQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGT3NHDzs11; Fri, 04 Jul 2025 13:28:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSnHU005952; Fri, 4 Jul 2025 13:28:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSn5U005949; Fri, 4 Jul 2025 13:28:49 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:49 GMT Message-Id: <202507041328.564DSn5U005949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: f5cc62e54a7f - stable/14 - virtio_p9fs: fix panic on qemu/kvm List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f5cc62e54a7f8ae9b8bb1484e0ebb22352c95d36 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=f5cc62e54a7f8ae9b8bb1484e0ebb22352c95d36 commit f5cc62e54a7f8ae9b8bb1484e0ebb22352c95d36 Author: Danilo Egea Gondolfo AuthorDate: 2024-07-06 16:51:51 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 virtio_p9fs: fix panic on qemu/kvm When the module is loaded on a system running on qemu/kvm the "modern" virtio infrastructure is used and virtio_read_device_config() will end up calling vtpci_modern_read_dev_config(). This function cannot read values of arbitrary sizes and will panic if the p9fs mount tag size is not supported by it. Use virtio_read_device_config_array() instead. It was tested on both bhyve and qemu/kvm. PR: 280098 Co-authored-by: Mark Peek Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1320 (cherry picked from commit 814bf1fddd27aea69740f9e7426302354285cad4) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index e87659da2732..f7bc3f00fe6a 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -352,9 +352,9 @@ vt9p_attach(device_t dev) mount_tag = malloc(mount_tag_len + 1, M_P9FS_MNTTAG, M_WAITOK | M_ZERO); - virtio_read_device_config(dev, + virtio_read_device_config_array(dev, offsetof(struct virtio_9pnet_config, mount_tag), - mount_tag, mount_tag_len); + mount_tag, 1, mount_tag_len); device_printf(dev, "Mount tag: %s\n", mount_tag); From nobody Fri Jul 4 13:28:50 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGV6cS5z615CJ; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGV5B6Nz3M4W; Fri, 04 Jul 2025 13:28:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VLUlqaXlpT1I/WJw1byot1bmBovCTj43g8ZRCMMmF3E=; b=RYAGarNZn/WYFmYZHFZBBbxoP/xonVTOqElpHXkss9nLXnad/mfoXziWaSxkupK9OnbR1D +b1vrw+icDF4Raqg9rqB4joobWkyy0KpPherZE+aAaTt2E2OKCcNfQJenNdChyoEgiCN/L YOhD47xY4uTEzHUxsYhXnWv12t4KiVRjKUXXGHt4dfcRZ1JE6rHhaSXTHa3MQ/T+l+jqJu BRVJr34yQKHfArm7usxwV71kq9+/4rWhx4Apm0lXq90wngDSiiIuTLfI/ZawTRpoGYrVcf Qyl2U8LYb1igka1dA/l0GeoMDuVrhSmiHntGdzJXQ8ppSE37LlMKVhuV1E0R6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VLUlqaXlpT1I/WJw1byot1bmBovCTj43g8ZRCMMmF3E=; b=K+1CNuvV72l7vPWET0gUHwOq2mWBxwM3I9wnWkS0MyoAIvlHoIBvehjY623X2eL6E0lH6Z I75HvnWwm5NLOXV3Mi6oxLZolFma+qqt4FxPzFqxUxZdz4s34gagKMr0mv3/gVindO6mjd e4264DGnT0WzBWa96QqlwYjvuQQkwGTCuLadf5tg2F7P4GhAGAGNNFs4I0yDTOwdAQ4AVE y2MJAPQHqjF15zV8Zrg8zVi49eWkZKm5fdBNATTOt3vzFCnUW60BJDI+kk10gBEeNbJUPD 0NKSQEIJs3bSD01Ig8cEu/lYNvYEaYdkf52R+iZ0lI7o8TnG8SjwErv1kXJAOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635730; a=rsa-sha256; cv=none; b=j4POl1wOiBs0au7bPvNjeprX88olQex7yCFwibSMwg0f7/yEJ6INudBYN22Q7WlCZCDcII dL4HHJ/Bt9cjw+FnJ909LgYf7HKT/KZx0fwVOmhVCDZ5ChvlsfmYSjl2i/OIJeJQVwX5xN 5H0YjhpYMa2eISD98PpKWCr5dsknvMqED85aLrjFrHKUDd7z5owXjbWn3TJgptAcQSIaBu VKr4v7ixulZEYbiaPhi3OMbJlye0pA25H2i7IYS64X2VM3oMxlYxwlVfKKkv5Yv8DoAe0l A3uu+y1jxGEdlLpRfGz7yT6/DIXk7IoPtpUyMOe8A2fwq5vfiifnOz2Ym0lPhA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGV49hZzsGZ; Fri, 04 Jul 2025 13:28:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSoKo005986; Fri, 4 Jul 2025 13:28:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSoZi005983; Fri, 4 Jul 2025 13:28:50 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:50 GMT Message-Id: <202507041328.564DSoZi005983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: ec70e1177b20 - stable/14 - p9fs: remove duplicated code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ec70e1177b2004a5990222dbe3bd6130d9566822 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=ec70e1177b2004a5990222dbe3bd6130d9566822 commit ec70e1177b2004a5990222dbe3bd6130d9566822 Author: Danilo Egea Gondolfo AuthorDate: 2024-07-09 19:07:18 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 p9fs: remove duplicated code This code is using the vnode after it has been released and causing a panic when a p9fs shared volume is unmounted. In fact, it seems like it's just duplicated code left behind from a bad merge. PR: 279887 Reported by: Michael Dexter Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1323 (cherry picked from commit a6ca6dfd60b66eec563bd473d96b31f0be1de80a) --- sys/fs/p9fs/p9fs_vnops.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index 5556e60f4bae..6ac0a7c008cc 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -125,16 +125,6 @@ p9fs_cleanup(struct p9fs_node *np) /* Destroy the vm object and flush associated pages. */ vnode_destroy_vobject(vp); - /* Remove the vnode from hash list if vnode is not already deleted */ - if ((np->flags & P9FS_NODE_DELETED) == 0) - vfs_hash_remove(vp); - - /* Invalidate all entries to a particular vnode. */ - cache_purge(vp); - - /* Destroy the vm object and flush associated pages. */ - vnode_destroy_vobject(vp); - /* Remove all the FID */ p9fs_fid_remove_all(np, FALSE); From nobody Fri Jul 4 13:28:52 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGY3gJRz6152K; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGX6MFSz3MCY; Fri, 04 Jul 2025 13:28:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gjE52xxR5jTp2e+h0sDSGcVUrf478eLf1V+KveNC4AI=; b=EXOhxti26+CmhDkAXrqjYRbRuwBVP3hRghwTyLCUkc3db0Odt5dubwDn2GqmdLBPuw2a6X 4hk0FeEodZMtDv/Lir0BVGEb3U8OdceOsOK5OkhkrCFrT7X0mvrcFnPAdRHSdiR2KeeHdX 9SMOL/eo/9VjC8n4LWDq4FLu34QEcgzbMQO5pkyj6XjgmBJ6kujO+ssnz2NnhOdJAVdwT7 rPjUjRvox2i4r8gfunpp6ziJIbyIvYCwHAo+fiFABrlQjRbvuWfcSxGA5x32xZm6NV3mya S3gajWSk6tY8fshW1DUO3c2ny7+4VeeGxKnf+gJC3mLtIYwjEzwj80lKXpNVig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gjE52xxR5jTp2e+h0sDSGcVUrf478eLf1V+KveNC4AI=; b=Q91tztvAAa+Re4/1DSOeuli4dnVgwP2+A6JDvD6KB7YXX02NAQbnl5tm9W2pkfo2dfjMjh KvNm8EbxPyaTgHPH7hOc/V3x/4B1GJOv3W5LHT6HQd6pSSfQI+1nJqUe07DhQgiDXNifd4 vyx5ozWrgpOISRPRyHXELTfoqJsjKpbi2aMS3iUuvQP5OK8peBVV0sEBz9rQQdsW6+2X9H z0uTB3iinDnQhcQJHvAq27Glhx3CKXGsRgLkP0TmPEOOsWROPlml5Gnr0JaWQG/07BotQP qJD1FUYd6c8divDcY7OGgcbd/1jSqEEMf6YKQYYv/Uv6QPZMmga0Tfj2Bv0DRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635733; a=rsa-sha256; cv=none; b=HoWC8PNmvnDs420LnZDT0dLvlN25/NAmJww/QXF54T2TByJ3gB+4a8/jZxynSPeCmzLIsO 9Fvkao+jYY/7p8+f8YQxZUuH61hXBnN8KgHdGcYYVGAb3nUIYF6ciesLt1dYHsIMAY2gO/ rZ5Mn3akgt2tS1fGHppkUZcRkCvL380P2hN5IwdJa944Ost4Hzf2DzKHkreifRwcxFZ3// Hy0ZgUkArjeZ5Y183cqQ5T8q/wbo7F75QcsEqvEXOt7gulxKudAEF1KkSoBBf4MHXW14T4 q/DhiZurmufzC/PXlH7vul40HeF+9zbVqSMose/CZLehcGG35NSVvzV928cWnQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGX5whSzsQf; Fri, 04 Jul 2025 13:28:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSqbh006060; Fri, 4 Jul 2025 13:28:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSqxg006055; Fri, 4 Jul 2025 13:28:52 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:52 GMT Message-Id: <202507041328.564DSqxg006055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: a23bc2ddb540 - stable/14 - p9fs: Fix whitespace in request tag handling functions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a23bc2ddb5409bfb3c1186d8062438b504ea41c7 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=a23bc2ddb5409bfb3c1186d8062438b504ea41c7 commit a23bc2ddb5409bfb3c1186d8062438b504ea41c7 Author: Mark Johnston AuthorDate: 2024-10-25 17:50:37 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 p9fs: Fix whitespace in request tag handling functions No functional change intended. Sponsored by: Klara, Inc. (cherry picked from commit f86e328d324d4d67ab4db4a89ef6239c8978bb87) --- sys/fs/p9fs/p9_client.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/fs/p9fs/p9_client.c b/sys/fs/p9fs/p9_client.c index 8f36cc4e775a..45d24870306c 100644 --- a/sys/fs/p9fs/p9_client.c +++ b/sys/fs/p9fs/p9_client.c @@ -380,16 +380,16 @@ out: uint16_t p9_tag_create(struct p9_client *clnt) { - int tag; + int tag; - tag = alloc_unr(&clnt->tagpool); - P9_DEBUG(LPROTO, "%s: clnt %p: tag %d\n", __func__, clnt, tag); + tag = alloc_unr(&clnt->tagpool); + P9_DEBUG(LPROTO, "%s: clnt %p: tag %d\n", __func__, clnt, tag); - /* Alloc_unr returning -1 is an error for no units left */ - if (tag == -1) { - return (P9_NOTAG); - } - return (tag); + /* Alloc_unr returning -1 is an error for no units left */ + if (tag == -1) { + return (P9_NOTAG); + } + return (tag); } /* Clean up tag structures */ @@ -397,10 +397,10 @@ void p9_tag_destroy(struct p9_client *clnt, uint16_t tag) { - P9_DEBUG(LPROTO, "%s: clnt %p: tag %d\n", __func__, clnt, tag); + P9_DEBUG(LPROTO, "%s: clnt %p: tag %d\n", __func__, clnt, tag); - /* Release to the pool */ - free_unr(&clnt->tagpool, tag); + /* Release to the pool */ + free_unr(&clnt->tagpool, tag); } /* Allocate a new fid from the fidpool */ From nobody Fri Jul 4 13:28:51 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGX1d2Dz615CK; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGW5cl2z3M8b; Fri, 04 Jul 2025 13:28:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7a5BVhUPmdeqxYy+h+6CN+NO/N96f6lylBD6EzLJUvw=; b=dMA6vQh7IVbShErjWMbWfJByUllgPAA42vIdnDfRjBYv6pF7aDDCNVlv0uEGSizvvfKw5j u21L8MV4Y613irVFMh5rBxgsS/Bp9w/d3ySA6lxNj1rxJwxFbnZsEPRaoR5wJgRwVsxCuc NaDWhlKaDyjNRc2Hce1QTmAeojDGIJhj9I1QgVo91GFJbrm8aULaC4TpwSIcrQb7nRuuf7 +vFUU6p2frJUBTRIA7ngIbw0PrF3qbpIOV+AgINkKYx/bUC11kfS+aRN7rX8e7r7YnrJRG +G5TY7iXRtu7qwun3cT5g0soxUFEu9beJXxkhcxV4RRy9Ym/Rrm8VRVgBy7FHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7a5BVhUPmdeqxYy+h+6CN+NO/N96f6lylBD6EzLJUvw=; b=mbuqnSdmcZumknNmkgl00Qg87TGLGm3FwvqqQuNmon51rIQJL8ikZaEAYW4a/TjJ8cwuiO bzt01MyZ4GEZ7xSg1vapYhXtrksz+shOfgqLq5ULQwp4Z6Vikvxyl9Cd4+KR/7fdO68HGd gR/7iPTPJv8BqCrffeM9LwjCl0vrV4R4h2mhyPNQuHePRy2T0s/FpdzYuErUGOK5lGCaWM GVr0VvSyEtMVNTnnD0NJOEQ6N29M4bbrjRvGh7Lx06D1oPBmZBT/w0pP7vhJGSPzbMA2UK Gc4QLdJPwdNFGAO2cxZ0vJYaJBELGGT9S0c6k2dtc9n9k0ani4SObJRZdipzHg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635731; a=rsa-sha256; cv=none; b=BHH51+h9gAiLqN7qBMS24+dugG7VxCv9xNVWLBOyYeQtW11TqqMWx2WkwSIZ8cIYw2pXjk L4kbASAe1IxN8eRZdbvk2DOIj17WEa++rN5pGBxQ+TFzDa8m59K1XMAqVKOFzjac0HMRWq 0Z8sT58BSW/EwQXCgwO7ynmxtZE765ed+IOG9tnciqkx2qKfw7FY1EAfql4BESB5F/Mda2 6sCNyYVQxZC61BLdtlLFMKEMinHiZ+S1FXdz16W4RYshL5lqgu/Il88dJhlzj6vb/OdFUr 8TJ5i45bh5n9jMkGEjwbLSEAGpedxd7zPvPNbc0NIKkuMQCyv3Tc/A/Wqlee7A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGW58F2zs12; Fri, 04 Jul 2025 13:28:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSpYH006023; Fri, 4 Jul 2025 13:28:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSpus006018; Fri, 4 Jul 2025 13:28:51 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:51 GMT Message-Id: <202507041328.564DSpus006018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: 2e7e267e7fcb - stable/14 - p9fs: Properly handle paths containing "." List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2e7e267e7fcbcd0dfb9957fb9809308232276f15 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=2e7e267e7fcbcd0dfb9957fb9809308232276f15 commit 2e7e267e7fcbcd0dfb9957fb9809308232276f15 Author: Bakul Shah AuthorDate: 2024-08-04 18:19:52 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 p9fs: Properly handle paths containing "." Fixes: 56e4622588ed ("p9fs: fix lookup of "." for lib9p-based 9P servers") Pull Request: https://github.com/freebsd/freebsd-src/pull/1361 (cherry picked from commit 62bb18abed25a831a29e1e5b6e6f7fdddbba6403) --- sys/fs/p9fs/p9fs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index 6ac0a7c008cc..14951e96b59d 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -238,7 +238,7 @@ p9fs_lookup(struct vop_lookup_args *ap) if (dnp == NULL) return (ENOENT); - if (cnp->cn_nameptr[0] == '.' && strlen(cnp->cn_nameptr) == 1) { + if (cnp->cn_nameptr[0] == '.' && cnp->cn_namelen == 1) { vref(dvp); *vpp = dvp; return (0); From nobody Fri Jul 4 13:28:53 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGZ3Zz5z614ws; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGZ04Snz3M8q; Fri, 04 Jul 2025 13:28:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xi/hjeVrn8IEP1dywqkPIP20tDfszmXVsktJUEquUTU=; b=ua0nJzPH2QYwWJXjwq4RHPfPgashqgVP3ITUMTZJVZVTp3tNymcF4oCj4PP6a+CCpb9gHr dR/pbtzsEF56p+9imgb1y4mu6U8nRTRfPQKfN1gls9GsgQLSi/ZXafj7tvLIRXB4l2fqDp iFh8TBP2uEVePYFSVV3Z+r8ObZLVXQg4YfpkEG7rcqyS4lm3UL6JVScPMRgImu1/6J5wdq Q/Win2w6di/ojGZMcPMg5nJA3caOW7pxZ/8VbaOPc4RrHsxgInTcIJVA7WqaVBtZ3UflDa GsL0/4INIUZhKPbatz8BXo7Z+3Qqx/CbyE9V8TYeI4D1Bf0nbND6un9rgL6kFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xi/hjeVrn8IEP1dywqkPIP20tDfszmXVsktJUEquUTU=; b=npoWVRmf4n08cvPktHW/3jZcUuWGOWp7Z46RPvRFwfTtzF+zC2zTgTNdE6mA71SebtJ0gg bCLbxi5WlPfmscU3E9O83UZkgcN39jXe3zAkA8eP8TLksGsgZsy2zMIB9Vz1MQ3RoqtDG7 tbBxuD9qLDFRo7rgIhvVVDDu5vXdbqqafzfnDr25GjYWvV3JcK/Eqg/Nk8bhDrpubGY4Lr iZYVEdz417Tc4lImakDdB7pI5wgr2oqLx/bCfisP3QJC4LUp2nLNXG6Xi6Tam2OZvO4pmg ZGJWltRY9oY4aiHUmejw+0N10y+r+eXUudHtqmwNWfwouhNwUeCN6d3nlcontw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635734; a=rsa-sha256; cv=none; b=c57QjcMG2Ai8ySoj7Ja+PQl1emh8fS6cfVZDqqpG8JVeo2KXtpnLaijECGgQ5Xd67VPTXr Kj0bv9FH/VYI6/Q86K5WDoDomG9ip66VDtQMCo1gah5O/uDkrPP9YZD9t6VeVVf2HuIKwj ArOvG19eT6JzGmAjmCkTAHogZu1Jr07ISfniSxAo/C95OI0t/Wz1ZBg3X4NdoxOiCnxFAT KbXM9nY5lQt5VcIN7JX/NgWY7bHJowTD41d1/FtlQGBwZ58NlwV8EIe5JDGiwPRBBQ5a3A /rXYtRkuEkNE1OknDjtQIalrwlLgVQOMRnysWmx/WbznP7fYqG5ScajGLFueUA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGY6jyBzsQg; Fri, 04 Jul 2025 13:28:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSrAk006095; Fri, 4 Jul 2025 13:28:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSrTT006091; Fri, 4 Jul 2025 13:28:53 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:53 GMT Message-Id: <202507041328.564DSrTT006091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: f3289f252854 - stable/14 - virtio_p9fs: Fix some style issues List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f3289f2528549160afa09fca09b141cbb7f36c32 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=f3289f2528549160afa09fca09b141cbb7f36c32 commit f3289f2528549160afa09fca09b141cbb7f36c32 Author: Mark Johnston AuthorDate: 2024-10-25 17:50:43 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 virtio_p9fs: Fix some style issues - Remove superfluous newlines. - Use bool literals. - Replace an unneeded SYSINIT with static initialization. No functional change intended. Sponsored by: Klara, Inc. (cherry picked from commit b9500cbd38967686a801b1ed3ab1dd5b5b5571fb) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index f7bc3f00fe6a..43d5c0d9d6ba 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -74,30 +74,20 @@ struct vt9p_softc { }; /* Global channel list, Each channel will correspond to a mount point */ -static STAILQ_HEAD( ,vt9p_softc) global_chan_list; +static STAILQ_HEAD( ,vt9p_softc) global_chan_list = + STAILQ_HEAD_INITIALIZER(global_chan_list); struct mtx global_chan_list_mtx; +MTX_SYSINIT(global_chan_list_mtx, &global_chan_list_mtx, "9pglobal", MTX_DEF); static struct virtio_feature_desc virtio_9p_feature_desc[] = { { VIRTIO_9PNET_F_MOUNT_TAG, "9PMountTag" }, { 0, NULL } }; -static void -global_chan_list_init(void) -{ - - mtx_init(&global_chan_list_mtx, "9pglobal", - NULL, MTX_DEF); - STAILQ_INIT(&global_chan_list); -} -SYSINIT(global_chan_list_init, SI_SUB_KLD, SI_ORDER_FIRST, - global_chan_list_init, NULL); - /* We don't currently allow canceling of virtio requests */ static int vt9p_cancel(void *handle, struct p9_req_t *req) { - return (1); } @@ -108,7 +98,6 @@ SYSCTL_NODE(_vfs, OID_AUTO, 9p, CTLFLAG_RW, 0, "9P File System Protocol"); * ack from the host, before exiting */ static unsigned int vt9p_ackmaxidle = 120; - SYSCTL_UINT(_vfs_9p, OID_AUTO, ackmaxidle, CTLFLAG_RW, &vt9p_ackmaxidle, 0, "Maximum time request thread waits for ack from host"); @@ -369,20 +358,16 @@ vt9p_attach(device_t dev) /* We expect one virtqueue, for requests. */ error = vt9p_alloc_virtqueue(chan); - if (error != 0) { P9_DEBUG(ERROR, "%s: Allocating the virtqueue failed \n", __func__); goto out; } - error = virtio_setup_intr(dev, INTR_TYPE_MISC|INTR_MPSAFE); - if (error != 0) { P9_DEBUG(ERROR, "%s: Cannot setup virtqueue interrupt\n", __func__); goto out; } error = virtqueue_enable_intr(chan->vt9p_vq); - if (error != 0) { P9_DEBUG(ERROR, "%s: Cannot enable virtqueue interrupt\n", __func__); goto out; @@ -436,7 +421,7 @@ vt9p_create(const char *mount_tag, void **handlep) /* If we dont have one, for now bail out.*/ if (chan) { *handlep = (void *)chan; - chan->busy = TRUE; + chan->busy = true; } else { P9_DEBUG(TRANS, "%s: No Global channel with mount_tag=%s\n", __func__, mount_tag); @@ -450,7 +435,8 @@ static void vt9p_close(void *handle) { struct vt9p_softc *chan = handle; - chan->busy = FALSE; + + chan->busy = false; } static struct p9_trans_module vt9p_trans = { From nobody Fri Jul 4 13:28:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGb5K94z6155Q; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGb0ny6z3MNM; Fri, 04 Jul 2025 13:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gFE1gz2c4P21fePDBmz8SiiORNnj82JZ2+nxA3z0RsA=; b=WHAAiiJz3AW44mNo7juj66v80w3qhusIjUUy9Ly+WSiPhSXzc7oMV5n6YjRfLSoPLJLOGo 2Q9RV0UTQ4jNko47Vb0nlef0eMApDvhwRPS9sDbVBTTnc1BHFLpSTmbcpARCRTiL0PNDSb T7sAwvoILrKriC3Apus94rgiNAv4ze0ZIeH0r8DLgE6wEeeLuBGEdcSR7NaClar5ku8Q+p 8scL5bgncbzgDtHwYmK/5E3QfSEcp4yOeahbLWVpxyeuBxVt28tj9EBbRZ/N7xtWODPsyi tQufvFdbsCWqmXKuDZWdRvw7AhwZjlDpBX4oFLTl1bR2/3NMfmcnzOYHyxtC0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gFE1gz2c4P21fePDBmz8SiiORNnj82JZ2+nxA3z0RsA=; b=hfe5QyOj1fO5k2VE1jvcc/UCYic2pdl9DTHNjJEl9GpHynzOYIzUN1i0n0ATN7FlKdkqWy 4G66NO1Ns5T8CvU65YQx+t0eBbsn+aa8LJU9vb7aK8rNDmh/WoAmt0cPycTiGkvS0B1wO2 4Jw68FYQguNsQ71mErVmgbv4wKM8+SdQWUMP59HMpMj+pP9eymIFmCDEBVD1rsB8PUkDbv zbIKoCy8y3M/s5hRhEv4oPoDMGsOp5DVQ3rackkvRjUvv+VqNoFmAGextfgHPRYnpvP9eU w0ij68fMAWDQ3wZelh01H8OklToYudI2OKyR5f4HaimTUNzbtMRuJm7HAjLxmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635735; a=rsa-sha256; cv=none; b=qNrse6+dcJvkZFpJGbuW+z7ciG/wQwz1M9MH7LOKwKH/TleKZ0Q9b3t5gYhyEE8aSX5g+u H5cDbmGPwFbNq2flxT35h2uFRIeG+OA2bq4HfM9Rc1H4VXMYqNzPoQUSKsTqez81p94b4H alGhKHKfaaVOBAtmh0LHgf9gph8TkuVk1bI3Q3J6h2Wby2JymWUDE5UyonZk29pjJIq5MK EJXk/TpasKjFVswRaZMEjr18TxW+QW03jvNHOJbv+0VxG2pSNNDpQdkmFp2OA88RUWSq7g 6/mbQHJpQ9pp3RA0n/e/8EdyTKKMou7lZLSElP2CoyY8uHmqAuTCWB3S6PjS3A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGb0N8TzsD5; Fri, 04 Jul 2025 13:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSsne006129; Fri, 4 Jul 2025 13:28:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSsH7006126; Fri, 4 Jul 2025 13:28:54 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:54 GMT Message-Id: <202507041328.564DSsH7006126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: f3478cfc7817 - stable/14 - virtio_p9fs: Fix handling of a full request queue List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f3478cfc7817afcd47e8c9caee143fb807220ffc Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=f3478cfc7817afcd47e8c9caee143fb807220ffc commit f3478cfc7817afcd47e8c9caee143fb807220ffc Author: Mark Johnston AuthorDate: 2024-10-25 17:51:16 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 virtio_p9fs: Fix handling of a full request queue If, when submitting a request, the virtqueue is full, we sleep until an interrupt has fired, then restart the request. However, while sleeping the channel lock is dropped, and in the meantime another thread may have reset the per-channel SG list, so upon retrying we'd (re)submit whatever happened to be left over in the previous request. Fix the problem by rebuilding the SG list after sleeping. Sponsored by: Klara, Inc. (cherry picked from commit fff518117b40cbc3bca49073eed85dc725ebae4c) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 43d5c0d9d6ba..d359fbbf1a3d 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -152,6 +152,7 @@ vt9p_request(void *handle, struct p9_req_t *req) /* Grab the channel lock*/ VT9P_LOCK(chan); +req_retry: sglist_reset(sg); /* Handle out VirtIO ring buffers */ error = sglist_append(sg, req->tc->sdata, req->tc->size); @@ -170,9 +171,7 @@ vt9p_request(void *handle, struct p9_req_t *req) } writable = sg->sg_nseg - readable; -req_retry: error = virtqueue_enqueue(vq, req, sg, readable, writable); - if (error != 0) { if (error == ENOSPC) { /* From nobody Fri Jul 4 13:28:56 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGc4Vdhz615FW; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGc1Z4zz3M97; Fri, 04 Jul 2025 13:28:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DB/RCy/qCxJ6+N1k4ZYmbL7KiUq77VbAOQA7lau5b/w=; b=p+Aca+974V5EFPP8OYrV0MRYykpp//TNWs2XAndoHp/EbBMqK7AR5j4PJD+A5q+TYMOZsR 43LIi6b+4JuQD6GII4HDMEViA+qqycJeZLUC5IQHsQVNh/B1Ds043ReoJTMF9nX12s2jTs uVJEv8Ym8FlW4gEcFfx6Ngeoi5bGFcCiqh57oeulUIYBLNFOctOqqg381Sqxz7kXljnCfU qm9kyCA6j/OzfQc/KP98fQYv8gm+mglACqOS6GQ6MbbV1pirfxn8Vo6tkzImwEYxORx6Tf 8HA+WKZ1j5ybLt7i0HbS7LHQsM74nVjdUdTBVKj/419wW6iHDivcV7ZkuUjfCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DB/RCy/qCxJ6+N1k4ZYmbL7KiUq77VbAOQA7lau5b/w=; b=a8N1HjS9M261y0i5CNrAwJKqmw0PQ+yYan1DfiaJdzsmNo/ADtsEX9Y8OteXkBVtCqd8Cm Y3bItruzRxiCES0Ofa6rX/v+2mCXtjWN2wSoW5yQQYPaLzfeUQvd0CZyTdinrpPzb2gl8H UovbWwkRiZ5nD4epXC0RdwRZbjHPvrhbGYttYzm9qKw5Z5fztk4QLN2BwqOoiz/N5F7x3s yMWd77Fu9XTSeQ+wHRLSBei/+SE1WoQ5DdhRS19NQOnJXJY33I7HL/HvbvWrBw7wssmald 8qeitTzocUHoBLlQR+n3NS1YGpeSJPMV6jirbYlF/ZOfAukrazVjNzHh5gRung== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635736; a=rsa-sha256; cv=none; b=LgE95v3MNhqnG8FBKOmqHdGtHb1g09alHzAvv9wNaKcN+6qqGZ4kjG/JsHRgplVw4dWi9U UZzLeu8nPX83YPXG/Xr+PdXcCKPu/Z64dXWMCVtD7/JfWw5Hi03jPe1B+ZJNeDWJqCRXTv JnzhSPvS/UL84n4oYLYusa5TVtqxQU6WYJw9wMQ0NG1fCGmFMS4/0g/Xn4RMoPNaWAa8Rd 9hC3fcMICpChZQNK4PQAOXKC729f+5I0SsWzBVGw4d1Pfp5Dlk3SenvKe9OFMOXonvYh66 iPwKYtqlk7XEVD0Z6bWi7hV0J0dYQI+2uUBIRwdZT7qUtS3wJbl3k2dAKnO9bA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGc0tv9zsD6; Fri, 04 Jul 2025 13:28:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSuYL006165; Fri, 4 Jul 2025 13:28:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSutn006160; Fri, 4 Jul 2025 13:28:56 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:56 GMT Message-Id: <202507041328.564DSutn006160@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: d888c75dd49e - stable/14 - p9fs: Use UNLINKAT instead of REMOVE to implement removals List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d888c75dd49e0f07f3bce297c87850f7c06f3938 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=d888c75dd49e0f07f3bce297c87850f7c06f3938 commit d888c75dd49e0f07f3bce297c87850f7c06f3938 Author: Mark Johnston AuthorDate: 2024-11-07 18:23:32 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 p9fs: Use UNLINKAT instead of REMOVE to implement removals REMOVE doesn't work properly in the face of hard links. Use UNLINKAT instead, which is implemented by qemu and bhyve and lets the client specify the name being removed. PR: 282432 Reviewed by: dfr Differential Revision: https://reviews.freebsd.org/D47438 (cherry picked from commit 1d99e8d9a37e1ba528628186df57b79fe74e196c) --- sys/fs/p9fs/p9_client.c | 21 +++++++++++++++++++++ sys/fs/p9fs/p9_client.h | 1 + sys/fs/p9fs/p9_protocol.h | 2 ++ sys/fs/p9fs/p9fs_vnops.c | 21 ++++++++++++++------- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/sys/fs/p9fs/p9_client.c b/sys/fs/p9fs/p9_client.c index 45d24870306c..547de98c4c03 100644 --- a/sys/fs/p9fs/p9_client.c +++ b/sys/fs/p9fs/p9_client.c @@ -669,6 +669,27 @@ p9_client_remove(struct p9_fid *fid) return (error); } +int +p9_client_unlink(struct p9_fid *dfid, const char *name, int32_t flags) +{ + int error; + struct p9_client *clnt; + struct p9_req_t *req; + + error = 0; + clnt = dfid->clnt; + + req = p9_client_request(clnt, P9PROTO_TUNLINKAT, &error, "dsd", + dfid->fid, name, flags); + if (error != 0) { + P9_DEBUG(PROTO, "RUNLINKAT fid %d\n", dfid->fid); + return (error); + } + + p9_free_req(clnt, req); + return (error); +} + /* Inform the file server that the current file represented by fid is no longer * needed by the client. Any allocated fid on the server needs a clunk to be * destroyed. diff --git a/sys/fs/p9fs/p9_client.h b/sys/fs/p9fs/p9_client.h index 8597c0732ba3..79d402c174e8 100644 --- a/sys/fs/p9fs/p9_client.h +++ b/sys/fs/p9fs/p9_client.h @@ -140,6 +140,7 @@ int p9_client_write(struct p9_fid *fid, uint64_t offset, uint32_t count, char *d int p9_client_file_create(struct p9_fid *fid, char *name, uint32_t perm, int mode, char *extension); int p9_client_remove(struct p9_fid *fid); +int p9_client_unlink(struct p9_fid *dfid, const char *name, int32_t flags); int p9_dirent_read(struct p9_client *clnt, char *buf, int start, int len, struct p9_dirent *dirent); int p9_client_statfs(struct p9_fid *fid, struct p9_statfs *stat); diff --git a/sys/fs/p9fs/p9_protocol.h b/sys/fs/p9fs/p9_protocol.h index ddd8571adc8d..7ffd7dd67bcf 100644 --- a/sys/fs/p9fs/p9_protocol.h +++ b/sys/fs/p9fs/p9_protocol.h @@ -267,6 +267,8 @@ struct p9_iattr_dotl { #define P9PROTO_TGETATTR_BLK 512 +#define P9PROTO_UNLINKAT_REMOVEDIR 0x200 + /* PDU buffer used for SG lists. */ struct p9_buffer { uint32_t size; diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index 14951e96b59d..cfb50c704019 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -1497,7 +1497,8 @@ out: * After that, does a node metadata cleanup on client side. */ static int -remove_common(struct p9fs_node *np, struct ucred *cred) +remove_common(struct p9fs_node *dnp, struct p9fs_node *np, const char *name, + struct ucred *cred) { int error; struct p9fs_session *vses; @@ -1508,21 +1509,23 @@ remove_common(struct p9fs_node *np, struct ucred *cred) vses = np->p9fs_ses; vp = P9FS_NTOV(np); - vfid = p9fs_get_fid(vses->clnt, np, cred, VFID, -1, &error); + vfid = p9fs_get_fid(vses->clnt, dnp, cred, VFID, -1, &error); if (error != 0) return (error); - error = p9_client_remove(vfid); + error = p9_client_unlink(vfid, name, + np->v_node->v_type == VDIR ? P9PROTO_UNLINKAT_REMOVEDIR : 0); if (error != 0) return (error); /* Remove all non-open fids associated with the vp */ - p9fs_fid_remove_all(np, TRUE); + if (np->inode.i_links_count == 1) + p9fs_fid_remove_all(np, TRUE); /* Invalidate all entries of vnode from name cache and hash list. */ cache_purge(vp); - vfs_hash_remove(vp); + np->flags |= P9FS_NODE_DELETED; return (error); @@ -1537,8 +1540,10 @@ p9fs_remove(struct vop_remove_args *ap) struct vnode *dvp; struct p9fs_node *dnp; struct p9fs_inode *dinode; + struct componentname *cnp; int error; + cnp = ap->a_cnp; vp = ap->a_vp; np = P9FS_VTON(vp); dvp = ap->a_dvp; @@ -1550,7 +1555,7 @@ p9fs_remove(struct vop_remove_args *ap) if (vp->v_type == VDIR) return (EISDIR); - error = remove_common(np, ap->a_cnp->cn_cred); + error = remove_common(dnp, np, cnp->cn_nameptr, cnp->cn_cred); if (error == 0) P9FS_DECR_LINKS(dinode); @@ -1566,8 +1571,10 @@ p9fs_rmdir(struct vop_rmdir_args *ap) struct vnode *dvp; struct p9fs_node *dnp; struct p9fs_inode *dinode; + struct componentname *cnp; int error; + cnp = ap->a_cnp; vp = ap->a_vp; np = P9FS_VTON(vp); dvp = ap->a_dvp; @@ -1576,7 +1583,7 @@ p9fs_rmdir(struct vop_rmdir_args *ap) P9_DEBUG(VOPS, "%s: vp %p node %p \n", __func__, vp, np); - error = remove_common(np, ap->a_cnp->cn_cred); + error = remove_common(dnp, np, cnp->cn_nameptr, cnp->cn_cred); if (error == 0) P9FS_DECR_LINKS(dinode); From nobody Fri Jul 4 13:28:57 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGf0yk0z614wt; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGd2qf5z3MHr; Fri, 04 Jul 2025 13:28:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=unD/Ruk6BnQtx2gyGZ/1x28pKwYhD8BtN8XfJr2wZBE=; b=heLM3YxvXFp+tdnXxhUGe8rjyFfAMguFvQCfVVDtpksurUd+Y3zgbmcaKh173wNLdLs++m UMHxE6TS6hjKoUfbKTsCKpvrfsZHVwkhzM0joQcVSPZOuE1nyeaaEOWB7cSyqm1GCTC9TP xn4FEfANeW9y6uHi1I0NmS6eKRc8beUCVgCUYUk/XFWl/2jMr4Yh3o7wbhHkRNIMT2K1qd lmskhW5Tg3UG0ttJiuT0oj9+r8fcrqwDwBC6lnwwBmMBXJ3QvGSw9UiKkIGzjK3e/61OsY IZh48WoRR062/YB8Xz7NthxwvoR0AckgC2iDMmIo0B1dGCM1Elx5D5iLHVmN2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=unD/Ruk6BnQtx2gyGZ/1x28pKwYhD8BtN8XfJr2wZBE=; b=ak4TO+Xqucp7VxOAAF+aBGLNM0qLJpxBo6R9y5tStcp0A2riE/cva5rMkgwBMt9q/B6vmw KkJQZf4xy67DQT6ks7N1y2YB6SZkpfA8OGhUUX+lJ9DiQoRcps+6y5EW8djjJjcIxGo2fa w4l1Jj2OpVPr1gg4eNaZBZFmH/b0+sh1vkLfAtznXqSh+uNwo9GtojppTcl0PHZ/rKf55c Rj8Qx+qrAmKwQ1kxgPdZIAxoRRSwHVHW4U9q4LlP3Hw5DowEAhEQO0mT9bANiO/F/1LNao 0ne4hZOptt39h2+nsk2JBVIoyx/lxQB12s5fQHmjkNZ3ZmIX+vuZ8OCLip/98Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635737; a=rsa-sha256; cv=none; b=TqnBAYpiw61BlpLnaMZqj0XVQG6mcMM7XOBkdhItX5oyAhf+9vcr6ChMYOvcvm7W/PPrSw KfPEFIikcmXgiv7iqohvZ2dZ08SlBAa652+ZbgctdfD0a1uJeaCoeYzYqLqVNitebmm0Sy R7TNeFyur+OuU+igdUTKvtS4HfHx5HbRsSaESbRnLINUlUBHrPuDwOMGJ6VISi/5I4CHAJ ehS0K+ltRREY+bnArGWzp26fowCxUOy8uEj02XOgZNYmxHEfx8aXM8cRJaDrQ+9pczRTTt TIEEjcAT0cQbSMEe1Ih169855m8f10k09ksEBAzQ2KwMhT5naKZLAFlFwZWqdg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGd1YX1zsQh; Fri, 04 Jul 2025 13:28:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSvwn006203; Fri, 4 Jul 2025 13:28:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSvWg006200; Fri, 4 Jul 2025 13:28:57 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:57 GMT Message-Id: <202507041328.564DSvWg006200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: fc393006c0ec - stable/14 - p9fs.5: rename to p9fs.4 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fc393006c0ec18c5519cc9309e7ac77d1bad6abf Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=fc393006c0ec18c5519cc9309e7ac77d1bad6abf commit fc393006c0ec18c5519cc9309e7ac77d1bad6abf Author: Lexi Winter AuthorDate: 2024-11-07 20:25:10 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:06 +0000 p9fs.5: rename to p9fs.4 This is a filesystem (driver), not a file format, so it should be in section 4. Pull Request: https://github.com/freebsd/freebsd-src/pull/1520 (cherry picked from commit 5b62dc782d4891845b47f2c0dfbb7717cbfe3897) --- ObsoleteFiles.inc | 3 +++ share/man/man4/Makefile | 1 + share/man/{man5/p9fs.5 => man4/p9fs.4} | 4 ++-- share/man/man5/Makefile | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index d8a177732c77..5195dba6d58e 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -560,6 +560,9 @@ OLD_FILES+=usr/include/c++/v1/__type_traits/is_trivially_move_constructible.h OLD_FILES+=usr/include/c++/v1/__type_traits/operation_traits.h OLD_FILES+=usr/include/c++/v1/experimental/__memory +# 20241112: move p9fs from section 5 to section 4 +OLD_FILES+=usr/share/man/man5/p9fs.5.gz + # 20240827: retire fips.so OLD_LIBS+=usr/lib/ossl-modules/fips.so diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 12048cf5fe06..48fead7c6287 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -428,6 +428,7 @@ MAN= aac.4 \ owc.4 \ ovpn.4 \ ${_padlock.4} \ + p9fs.4 \ pass.4 \ pca954x.4 \ pccard.4 \ diff --git a/share/man/man5/p9fs.5 b/share/man/man4/p9fs.4 similarity index 99% rename from share/man/man5/p9fs.5 rename to share/man/man4/p9fs.4 index 5c110e3dc963..04f27abd2545 100644 --- a/share/man/man5/p9fs.5 +++ b/share/man/man4/p9fs.4 @@ -22,8 +22,8 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 7, 2022 -.Dt P9FS 5 +.Dd November 7, 2024 +.Dt P9FS 4 .Os .Sh NAME .Nm p9fs diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile index 34a8a43d9c7a..84d8d9011503 100644 --- a/share/man/man5/Makefile +++ b/share/man/man5/Makefile @@ -47,7 +47,6 @@ MAN= acct.5 \ nsswitch.conf.5 \ nullfs.5 \ os-release.5 \ - p9fs.5 \ passwd.5 \ pbm.5 \ periodic.conf.5 \ From nobody Fri Jul 4 13:28:59 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGh0fXgz6157C; Fri, 04 Jul 2025 13:29: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGg35Cjz3MGM; Fri, 04 Jul 2025 13:28:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jjo6ayu7+Qlide4b2WNsQq+tofGF8UZjlTi/+30t1qM=; b=hjwEpc/nBwbis/k2mpoZnUtKdvYqNK5yl7Mz9RV3p6IDLzYKGF+QBsLKnmDQ+G/W1u5B0g SadQY4phn8ObUrZYoCkYfmJHw6fGwg7cMYBVLnZmEetIBAG76TEBSMgLZ+5OOVoqhxfVcu JutXlV376Y10aKffD6Z9vl/MuUITF8RgGOifevs3iF42s4zjvEGmg4dUe3BnMjYKWZOhr2 1XoHGCLxCQdFTu/qxAzEcH+weMAR+kKMejAQIiKMu3CO48Vw342Ge022uYM5OKefQLhpqz 3Y4Quvm/RNgI2orShyUnAu1HljvcYPnezlVYTTp5timxaPKTHHeVpVfYxGMMOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jjo6ayu7+Qlide4b2WNsQq+tofGF8UZjlTi/+30t1qM=; b=ZF+E2aM3fBcOqgTJ269psMZ2UotgY/cra6Rje5Rq7A/ln9ZqR7J5n8e1MoNDei/tbf2Ubk fOUwhGNvQYPRZ7fojj03liP+3PP7c2cqFJFVJJ0tyxltCPdJWRifKVgzBDHOJeDOl5DRJb v00dMrMDV9rrkS22SwhdVm6sj0Twig6kp2oauekUHIygK0UDEPcnh8IP1FbIE6hhNTFmPk IK9QO2CPZSq5/kpPEHUAn+J6fARhX76A6WjA/xaupShA41i9UAHYU6FeFZihnGXPBOjBXd t+aMt8rpYQTqxuj1N8vFBfy7oRPGd2tiN7Ax+syB7ccm7Ir5oPNeZYLX2EXFXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635739; a=rsa-sha256; cv=none; b=we2RTFB191s41wXzNgQghN4u1K8i+MciV3ZqImM5ayJXz8do75dE0aGdMVrMf7JtsuKVun +tyLgfjXhLftDwlRlsrd7Lm94H19hXZGz+VRZTHirDdcDrPPaxLryywSnJdYMOzK4O4fRs 9IfH2D+oxiasA3y5FqFYj9xrUFeCXRafLSN4tqh3AbJ6oUwnuTQOBPcjC0vdY2Eq5ofhao FxPwNrJYlPx6fPTm9qCXYoYf6Z7xiEJ284NWIyugQm5QKOwRXLUkb9O77UjAqHTcucFqsV du8jc0XaqSb60QDNH9xVRe2d4PCznMXDeb1WosCUsc3967UFjsjAiGdJM/lB1Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGg2jCKzs3t; Fri, 04 Jul 2025 13:28:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSxDA006272; Fri, 4 Jul 2025 13:28:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSxNk006269; Fri, 4 Jul 2025 13:28:59 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:59 GMT Message-Id: <202507041328.564DSxNk006269@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: 256be6bf6c5d - stable/14 - namei: Fix cn_flags width in 9pfs List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 256be6bf6c5d62c60cf4b95ac84b3b6ac7db2e5a Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=256be6bf6c5d62c60cf4b95ac84b3b6ac7db2e5a commit 256be6bf6c5d62c60cf4b95ac84b3b6ac7db2e5a Author: Mark Johnston AuthorDate: 2025-05-27 13:29:14 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:07 +0000 namei: Fix cn_flags width in 9pfs This truncation is mostly harmless today, but fix it anyway to avoid pain later down the road. Reviewed by: olce, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50417 (partially cherry picked from commit 0d224af399a66f00a5b33e5512fc018062cabf1d) --- sys/fs/p9fs/p9fs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index cfb50c704019..56bf766ef801 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -222,9 +222,9 @@ p9fs_lookup(struct vop_lookup_args *ap) struct p9fs_session *vses; struct mount *mp; /* Get the mount point */ struct p9_fid *dvfid, *newfid; + uint64_t flags; int error; struct vattr vattr; - int flags; char tmpchr; dvp = ap->a_dvp; From nobody Fri Jul 4 13:28:58 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGf6Mllz615Fb; Fri, 04 Jul 2025 13:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGf2B55z3M9L; Fri, 04 Jul 2025 13:28:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cakRu9qiR51nn6/lJ7fPzAE55jc5NVHhY+hKvCFcFXU=; b=rRRSdFDJ3/vcXZaFdAeHBJmnEeh+MXcDwIVIouSCyZ/mUuS8qCWGQX1b9Zq2gdTNH7HBG4 Di10vBJreQpZ2pd5ZGZE1unECPOxgoGU4j/k7eyjmeBJc3c8K0zCACl1l9KxohGI2RKh4u JZxZ+YyhGW0qZp6O7Rf9FmT5FJByAZElpbDKRSW/49YhF5JRaH/JGZ1svTvLVnYIk3GSXE mvxtH2CQxI+pv4Y9N7D1YxaYBzIAxszO9sjtBEMp8ZzkUwJx2J2SFvU5ww35x0/HnNKn87 BsugR7kM+tfwBDzEAPCHLhIf8Q3LkbZpM07zyu5MWk4fswJH0+Phm2Pela3psQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cakRu9qiR51nn6/lJ7fPzAE55jc5NVHhY+hKvCFcFXU=; b=PVj+iWyqAu2rnItCFSHLFQgMBJ+i4Vqw5+gpDj8phzHV1+fm3FW0JAK8I6QBnAxYEh78lT MzCPoRpvvYDmRRPSOItZWWcikNTyHBQAr8dWsmuyTcab78jUiTEXzMsAY8EwjoUQ66a0wk PVQe4JwLVchYFRUIAxF7pX4/dIzxq0ASSjckdXu7grJZUo21uyeWD4E67/Ek6jt6TVeh/P 9JgMA6azh9Bt33JNh7YJ6+M0P2m3fhgul+bxJW2RLaIPi9Y4KWlYt/zGRwnzQpYfbyFZ3s Gl5eHWJNTI147W+o2xQnCHzNQw45RTHSMzoVg0Gr/6UBPk8sMrYha1A/OAl+bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635738; a=rsa-sha256; cv=none; b=DDlnt55qyI9pyJNODLvGZ3Vb6xzUGKvzN9XuDo6wgWZdUQ6v43tjZrPxVZKqTZpsXO/JNh 4T9vtfugUFpwtFJboLe47o+nFpVKF5qtM4KowXXK9N6aXomHdUCWiFpzCj4StioAdGT40F VlPBdijwDxT3L+Veb82NvoawEb/EANxY2tzwdIvw/egaTpZzHktoyfWURmUXZuyswj0R9q Au0h3nwLpcaKkSLwnyfpeUi5NfNpo6KvjbJITqrmqyw7AH+jnfU52aWec6rLFlzxNWbLhV kOnHHyvDYpzYAI8xIxUcLjqmSqzKRxH3NeVP79mQ7IPQ/tmYIUCWxC7bXtLfGg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGf1nj7zrc0; Fri, 04 Jul 2025 13:28:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DSwmu006237; Fri, 4 Jul 2025 13:28:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DSwn2006234; Fri, 4 Jul 2025 13:28:58 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:28:58 GMT Message-Id: <202507041328.564DSwn2006234@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: b7ef7f8b0b65 - stable/14 - virtio_p9fs: Support attaching to pci and mmio List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b7ef7f8b0b65e67da6ab11441b365684f231250f Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=b7ef7f8b0b65e67da6ab11441b365684f231250f commit b7ef7f8b0b65e67da6ab11441b365684f231250f Author: Andrew Turner AuthorDate: 2025-04-08 10:27:20 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:07 +0000 virtio_p9fs: Support attaching to pci and mmio Some implementations of the virtio 9p transport are implemented on virtio_mmio, e.g. the Arm FVP. Use the correct macro so the driver attaches when this is the case. Reviewed by: markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D49600 (cherry picked from commit fd9f67e689e83f20e29edf63cc6488402de5901c) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index d359fbbf1a3d..67426a88bceb 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -484,7 +484,7 @@ vt9p_modevent(module_t mod, int type, void *unused) return (error); } -DRIVER_MODULE(virtio_p9fs, virtio_pci, vt9p_drv, vt9p_modevent, 0); +VIRTIO_DRIVER_MODULE(virtio_p9fs, vt9p_drv, vt9p_modevent, NULL); MODULE_VERSION(virtio_p9fs, 1); MODULE_DEPEND(virtio_p9fs, virtio, 1, 1, 1); MODULE_DEPEND(virtio_p9fs, p9fs, 1, 1, 1); From nobody Fri Jul 4 13:29:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYZGj0GS7z614wy; Fri, 04 Jul 2025 13:29: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYZGh4b3Xz3MWX; Fri, 04 Jul 2025 13:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VqVX0PnXeU9UtB8XDqkpr9EF2Y7Sy9LLwywuOWzOce4=; b=GuOsa+tFiGNKtCNjOEr466pKry4iXA4Jflcl7p9qad7B3VP9F/714+qiDzWSoyzag5RNi8 qVNlDEu1Fp7Zcn/hsonx077rTWgRXBiRdFXlceA3q2erTNqE+2kVxYN4RVDHZDW6O48xHz SX8ELrh5JPSJrOH/6T0eNhHMqpEP3XQmt2q7YEbO3BF7xDj7GVr8z+AuGM/AMVJ8mjC6aF d1++vLLGr4w1v+jENRz5xrfZcWHDZpnva1iM6t5V5L8y6upw75bxGfgKHqoJMuFhgqNe9Y m/DlWbtjQz9vWornwLdbN72lhUcl7iDSZsAhJS5rXq+vGdKYUuKQXw56lYFLUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751635740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VqVX0PnXeU9UtB8XDqkpr9EF2Y7Sy9LLwywuOWzOce4=; b=UazRQWHepUK1DOu5OiOhQZMPhTTZvv/pLDcaTZegVkVs0k6yrGjFoS9R174La5z8Dwx1yz GJnrlgbxrQ9xrVTb9FzXodCWbLWT0S/OM3SeaKaFxiJUmetslLCuAiUxgBhKL+0Ew4uOHf EvhcoAQ5yuiA5k8yot2M/6o41+lQrLWpLHL+CXTiV8F53Vi4LNfk90s08oyliv/loFKsCd TDHyz5WZDVwYepq4DwgMSvwM1x3KNCbebZJIcocCNgxsA3mj4a0OHGcG2criboNVnoChE4 AKJheQkHFRsxfsKA4WwujnObOsFrdWu/JPl55ZwBqOCiVkZjBOt0BRnqJ5ESqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751635740; a=rsa-sha256; cv=none; b=DIxQJ4mAdViVIpYSa+wGNeGuh5f2uhDNdDfaXxK9l5wrV+DVm8I3BvpxyglltqOXXIshi0 f7bpTvMz9eMSml2k4NAE1oCRRZ7qGF5yqfJfopegw4k8YK54oJ2VIE6jlO8c+VwbpAsLTd FzsTd33ZR9cQgXJUmxVb+77byvxyL56jus0iwJw8pr8ZHXpwmIl3czo0p7Y6/1FalZszR6 fvElAvOBIp+qNFECefWhUMm2aaNnTcswauS6SCOYvSrwqTzCDoi7gi+/8E5Gx/oePmNtZc G4LsNZTXEPaNhYUz3dDcog6yEjlicMJFQx7EjyCjkNwi3sbzFy5HDFHwYlIDOQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYZGh3xjHzsSF; Fri, 04 Jul 2025 13:29:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564DT0t3006313; Fri, 4 Jul 2025 13:29:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564DT0ap006310; Fri, 4 Jul 2025 13:29:00 GMT (envelope-from git) Date: Fri, 4 Jul 2025 13:29:00 GMT Message-Id: <202507041329.564DT0ap006310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Popov Subject: git: f2e6f2444098 - stable/14 - p9fs: Call VN_LOCK_ASHARE on new vnodes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f2e6f24440984dce314a8eb3f9009cef3aae62b8 Auto-Submitted: auto-generated The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=f2e6f24440984dce314a8eb3f9009cef3aae62b8 commit f2e6f24440984dce314a8eb3f9009cef3aae62b8 Author: Mark Johnston AuthorDate: 2025-06-13 19:08:09 +0000 Commit: Gleb Popov CommitDate: 2025-07-04 13:28:07 +0000 p9fs: Call VN_LOCK_ASHARE on new vnodes We set MNTK_LOOKUP_SHARED on p9fs mounts, but disable shared locking of vnodes (i.e., LK_SHARED requests are automatically translated to LK_EXCLUSIVE. Reviewed by: kib Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50759 (cherry picked from commit 5defdd5342c392880e3917ba0873fb49ddafc4c6) --- sys/fs/p9fs/p9fs_vfsops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/fs/p9fs/p9fs_vfsops.c b/sys/fs/p9fs/p9fs_vfsops.c index f674c866ce9d..3451bc052187 100644 --- a/sys/fs/p9fs/p9fs_vfsops.c +++ b/sys/fs/p9fs/p9fs_vfsops.c @@ -345,6 +345,8 @@ p9fs_vget_common(struct mount *mp, struct p9fs_node *np, int flags, P9FS_SET_LINKS(inode); lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); + if (vp->v_type != VFIFO) + VN_LOCK_ASHARE(vp); error = insmntque(vp, mp); if (error != 0) { /* From nobody Fri Jul 4 14:07:16 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYb6r70b5z619br; Fri, 04 Jul 2025 14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYb6r26rCz3g9N; Fri, 04 Jul 2025 14: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=1751638036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S79N7zVw6Ogfa7F6ZhG+QLyrg2aAMUJToM9bMwYFaTI=; b=xTRSj3C6D6OxcKpt3K8tJ6rWR374E6Ir2TMY/GXQitI4BQCLyh/STSRdUZ9GM7ndVaqUMD L6p0jtASRUuLSuGAUzMUdFL3WndHXRpImIbt+RFhs5DGrQF7+2PR7NO5Sr6vMPRegqSBk+ mB8J/Xw5HlMY7+J2k0uJu2otAR/aTP9RHd5oJd3XORNLUjrZ+QdrVyv1E1Qo4k0FzK0cu9 R+faAXofYz7Gmp97VNcjuy4qavTDRcooCsWMZ4azaYjqpRQViP2IHQDKEIYofRNj2W7UCc 0hYW1quP9BjG1VZ9MNweTXHEMUduK6Z+soHeTJmKPRHYoV7UkOpDDnqKfNXs8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751638036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S79N7zVw6Ogfa7F6ZhG+QLyrg2aAMUJToM9bMwYFaTI=; b=wm4lILJmRzWVZKW44bzJpVmBdXc/6JCZQwV1PESpb4LwjxbtFE1xWE0WSL3ac3jtPusalY OLic6VCPr8uP/hL26YRGSLhiP7diHH4Tot42iumcVkDmQoYlzsDZ53AWgut2UdrXaiicTq /nJ2OLthpHIXya/LNXuu8eUrI5ADEu7+93pWZSTqP3C+B5N4BY7yg7FbEZMB/aWwdhUdh9 1OFtDw+PxXb/YLtVaaqQoMcNX2yAy0liMO7ggd43AbCNg7AQHiwmCf+8VXr25gvhm/yHrj Wq2BINnHyQYJSYZMhWDC0jCGd69ekcn3rn75cCtAXqEyeLfYl4SIG8kbFoxydA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751638036; a=rsa-sha256; cv=none; b=nnwltawQ+hwWmze0Hc+BSfpCnXv3qRul6Snt3smw4tIodewfj/UL0aqsZTng8zf0gOgdr8 w6tzVpdoimg1ULSdRsyc+8ispr0UmuD34OhrUt2gNomFqjk4Sy7OQ309MXWwaWOsvbaoTt 8NjcVHOy/d/abmEYLeqA5JoyiUX5qSX9MPVy12qUAFqiPJK+RbuMkhicX+bAQSOKV4FUJr J43n9ZT+Adrn6/tQTn2dt9E8VXvQJKTXj9QHeQc9XXR90o0B5shf4p22pSX0Vt2Ytv1INr LzCHs7yB4iOfpMggHj2H+U1MZZ3tzBxE0kaZZuLDvyeadjVkTMLvythYJlFRcw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYb6r10xTzt2J; Fri, 04 Jul 2025 14:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564E7GMG080629; Fri, 4 Jul 2025 14:07:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564E7GM5080626; Fri, 4 Jul 2025 14:07:16 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:07:16 GMT Message-Id: <202507041407.564E7GM5080626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: c2d8cca77152 - main - gpio: remove redundant calls to bus_attach_children List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2d8cca77152ebf72f488490163585be7e34eb0f Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=c2d8cca77152ebf72f488490163585be7e34eb0f commit c2d8cca77152ebf72f488490163585be7e34eb0f Author: Ahmad Khalifa AuthorDate: 2025-07-04 13:51:11 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 13:55:05 +0000 gpio: remove redundant calls to bus_attach_children gpiobus_attach_bus already calls it. Reviewed by: mmel, imp, andrew Approved by: imp (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D51108 --- sys/arm/mv/mvebu_gpio.c | 1 - sys/arm/nvidia/tegra_gpio.c | 1 - 2 files changed, 2 deletions(-) diff --git a/sys/arm/mv/mvebu_gpio.c b/sys/arm/mv/mvebu_gpio.c index 681cf20f7f9f..7acdfff539dc 100644 --- a/sys/arm/mv/mvebu_gpio.c +++ b/sys/arm/mv/mvebu_gpio.c @@ -810,7 +810,6 @@ mvebu_gpio_attach(device_t dev) return (ENXIO); } - bus_attach_children(dev); return (0); } diff --git a/sys/arm/nvidia/tegra_gpio.c b/sys/arm/nvidia/tegra_gpio.c index 16e1ef94d6a9..e37fd69a121e 100644 --- a/sys/arm/nvidia/tegra_gpio.c +++ b/sys/arm/nvidia/tegra_gpio.c @@ -824,7 +824,6 @@ tegra_gpio_attach(device_t dev) return (ENXIO); } - bus_attach_children(dev); return (0); } From nobody Fri Jul 4 14:07:17 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYb6t0c7Yz619c0; Fri, 04 Jul 2025 14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYb6s35cqz3gFm; Fri, 04 Jul 2025 14: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=1751638037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eQ+6rCnFfXGHTgr2gjJcSzmlZ3dGwppS9JzKdd7Vp54=; b=eTEwdbuvtFIIVNptuqembEmWlz54+2pJKKgdDssQkCQZI9jKqoZYHx7E2WyGjDeZbyIN4m 5765qP6/AYy1eKUiTzF1CKG0taCL4sAaWAdbCVtB51LJfXneFRc+WOBccu/eo/B2buUVkW 3YTSPHbX3pivw7lDqu/1rQc/K7n6BT58232LqCWYKI8mjh/PIeItqYNfDQBgVO+r0LczSm dx0VzH4fH/wGYlftdDjGsQBVlp4yt727D1eea/MyYs1QyMk3Zp1CQET5Fi3PhyKqHtB/mS FK0WK8Muwnrsh4l2YIOFDt/aV5VmqQt77Kiei6I2PB6DqDbq2Oy7luRcZq6D5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751638037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eQ+6rCnFfXGHTgr2gjJcSzmlZ3dGwppS9JzKdd7Vp54=; b=QXLX3f0Divc+RioLSOUKKNG6D8bKoIGWa2pHP6iNUw+zlVePVytLt4o6xjuNJJgbe9r7Rq fFSRw3cfrBqqie3XUm3zQ5pV1ysKdUrups3+Ub82R+4YxWviyyAkBnqbx/m6TrnYsh7mIo tPZXSC0F/WJhlKliMvjWlkAQNf958Be76coPqf2XnZCaHPMA8ermIgyPFiQBw91pk5iApn /lLeapK5mjt80aetWxFnkwA72ikFMEil+2rW7zgDYsIHIQQe2hb9j4mRyqYKhcpfl0SlBA eOso+bSqyNIumg1UcWakIL8EYSRchU+y2XGgA5Q9+Hu5acsum0HFsbDgEQVj1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751638037; a=rsa-sha256; cv=none; b=XunxfzGql5sR6g2VReCSnwZb1/0v3u2ncIkDSp+InbqBRUvnKVKpjX+p9/u6R6/nWSCraP MA5puZI2DbvUqlUc8yVGNJ2Q+LCI4fR2rQDcjlIKnbNIpAqpEBxJ7L4SbF+N5OPr5qBu6z IxOZNenv6CBDddyH/Ag6pWLinLxr5Ah7ncpqXPITzYV6PtbtQTMI8Lrt/cyjVZeynfekfG mlGiyrCVKS6133w+cP3vgGZsJMkiLx2WbgJyZjzYkVRZO1S52ATmiHHghu96b7YeHaY7w3 QS+I0d/Lg7fQtuETFjGQjc9zWoe/crkR3wxSupm0OHiOAzeGmSGWTXV8yZi3sg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYb6s2SJ4ztRT; Fri, 04 Jul 2025 14:07:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564E7Heu080661; Fri, 4 Jul 2025 14:07:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564E7Hgd080658; Fri, 4 Jul 2025 14:07:17 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:07:17 GMT Message-Id: <202507041407.564E7Hgd080658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 2c356c8b8f79 - main - gpiobus: add a gpiobus_add_bus function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c356c8b8f79c08d42b23a72b7a320b59d955a3f Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=2c356c8b8f79c08d42b23a72b7a320b59d955a3f commit 2c356c8b8f79c08d42b23a72b7a320b59d955a3f Author: Ahmad Khalifa AuthorDate: 2025-07-04 13:51:25 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 13:55:55 +0000 gpiobus: add a gpiobus_add_bus function Some drivers need to postpone the attachment of gpiobus until hardware init is done. Add a new gpiobus_add_bus function to accommodate this case. Suggested by: mmel, andrew Reviewed by: mmel, imp, andrew Approved by: imp (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D51133 --- sys/dev/gpio/gpiobus.c | 20 ++++++++++++++++++-- sys/dev/gpio/gpiobusvar.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 2e2618805e7b..6b5379b6084a 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -293,7 +293,7 @@ gpiobus_print_pins(struct gpiobus_ivar *devi, struct sbuf *sb) } device_t -gpiobus_attach_bus(device_t dev) +gpiobus_add_bus(device_t dev) { device_t busdev; @@ -307,8 +307,24 @@ gpiobus_attach_bus(device_t dev) #ifdef FDT ofw_gpiobus_register_provider(dev); #endif - bus_attach_children(dev); + return (busdev); +} +/* + * Attach a gpiobus child. + * Note that the controller is expected + * to be fully initialized at this point. + */ +device_t +gpiobus_attach_bus(device_t dev) +{ + device_t busdev; + + busdev = gpiobus_add_bus(dev); + if (busdev == NULL) + return (NULL); + + bus_attach_children(dev); return (busdev); } diff --git a/sys/dev/gpio/gpiobusvar.h b/sys/dev/gpio/gpiobusvar.h index 74783e112f89..3ae0767466c9 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -172,6 +172,7 @@ struct resource *gpio_alloc_intr_resource(device_t consumer_dev, int *rid, * these should not be called directly by other drivers. */ int gpio_check_flags(uint32_t, uint32_t); +device_t gpiobus_add_bus(device_t); device_t gpiobus_attach_bus(device_t); int gpiobus_detach_bus(device_t); int gpiobus_attach(device_t); From nobody Fri Jul 4 14:07:18 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYb6w0Tpqz619Sf; Fri, 04 Jul 2025 14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYb6t3htzz3gHw; Fri, 04 Jul 2025 14: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=1751638038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P4oP3aaWtTT3MtDtLi6DWBx3zKVQtoV2Q3Gfegn0zEc=; b=eXeGsoAAO47/vZuAqaExYxFgR8CEo68TgRte/nOje+4TjQ4tEEQM2cjR7806DEbQddhGt2 hAgq1LonmTeTtcm5vvxbHjdyZDbL8X1Klc3B+5aLk3qlA5qROfBoFnIfY0m48iIMkR8/oR vrXjOvo4GRau8P/wei+raUXPYuc91OvzFM62Gmsynlp5ZgIItTaxuPTTErGBgVs6KMPJD8 /rkFMoXi5QogtJlO/rNcAXjEQ6hSiJ5z3uW0BfXz490EjKJHCZXTvc0urezWN7fopz+jZc XCQIi6886KKwXrFexqqjgZC1ylWuFM9WyZ+0Gw+5D+KN7i8fVfxY+aYO66JXDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751638038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P4oP3aaWtTT3MtDtLi6DWBx3zKVQtoV2Q3Gfegn0zEc=; b=inOoiw696aX49271Ylgf3jZuUZZ38+1Gggl7UKALqPwgQRQCm6e2oq/8g8Y6IyhQ+LVPzb BgDDDBDqagA6BkWr/HQzRo/9/XSsp3EpqTrht4RmDF5kbOLSqvbRpRTbMREkQ+0OI4mRdJ kRKNXqRzQZYQTokzZUXSBJpOlEj7Vtfn9HGADJCTsthsTDoQNcg7XXRmLW4rneJOe2PYXW 8Ez/FadwyYD8a6YL8vyB8nl6VpXOY+MF1YEXrgcI9Bq1wIxkaWHvRmjIBQL7NkBFc6YapE UCKOX/NmdL65FgK15y3VCjXadGOSDSf1z0xpbbj0/1cgoU/zmpkx/9B7kHT79g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751638038; a=rsa-sha256; cv=none; b=I8MY7oejCNrnaMSMPE1IOsGRgL5TSi7Jw2UDpGrplszwKQwbD1ywkjhPFL7gqeZLrTTH1G BMnN065XzabFkXIxxekTuMpfyIbaJgyAJxbIL3eFQvE6xmwliGXkII2V7VgqVyF0QfR76o su/Nr4d7gQWfArKjV5l/XiLapi7vuvxYyEKG0o8Tv2dywMHk2WKTwztSOxkmBra2Lsmu5e W0nii1iESKuyHGCdjRGfiiTuJ3Ug6/FSd320cBlSHhAumjF4/6syhvrG68Q7eoHQ2hXjZC z+7mdFkUfg2Qczr3HHtOpgrFOco8gipW4wwrxQS9sEV5naSxc8rW6893OQsYcA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYb6t2sHQzt4P; Fri, 04 Jul 2025 14:07:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564E7IuJ080693; Fri, 4 Jul 2025 14:07:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564E7I9g080690; Fri, 4 Jul 2025 14:07:18 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:07:18 GMT Message-Id: <202507041407.564E7I9g080690@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 4695e3aa7c68 - main - gpio: attach gpiobus when the controller is ready List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4695e3aa7c685c092cb4b2662bee16c31be790f8 Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=4695e3aa7c685c092cb4b2662bee16c31be790f8 commit 4695e3aa7c685c092cb4b2662bee16c31be790f8 Author: Ahmad Khalifa AuthorDate: 2025-07-04 13:52:00 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 13:56:00 +0000 gpio: attach gpiobus when the controller is ready Only attach gpiobus when the controller is fully initialized. Children of gpiobus expect this to be the case. Reviewed by: mmel, imp, andrew Approved by: imp (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D51088 --- sys/arm/allwinner/aw_gpio.c | 8 ++++---- sys/arm/broadcom/bcm2835/bcm2835_gpio.c | 6 +++--- sys/arm/nvidia/as3722_gpio.c | 2 +- sys/arm64/apple/apple_pinctrl.c | 20 ++++++++++---------- sys/arm64/nvidia/tegra210/max77620_gpio.c | 2 +- sys/arm64/rockchip/rk_gpio.c | 12 ++++++------ sys/dev/gpio/pl061.c | 12 ++++++++++-- sys/dev/gpio/pl061.h | 1 + sys/dev/gpio/pl061_acpi.c | 15 ++++----------- sys/dev/gpio/pl061_fdt.c | 15 ++++----------- sys/dev/gpio/qoriq_gpio.c | 11 ++++++----- sys/dev/iicbus/gpio/tca64xx.c | 3 +-- sys/powerpc/mpc85xx/mpc85xx_gpio.c | 4 ++-- 13 files changed, 53 insertions(+), 58 deletions(-) diff --git a/sys/arm/allwinner/aw_gpio.c b/sys/arm/allwinner/aw_gpio.c index 18b47bab12d9..2061e38a155f 100644 --- a/sys/arm/allwinner/aw_gpio.c +++ b/sys/arm/allwinner/aw_gpio.c @@ -1154,10 +1154,6 @@ aw_gpio_attach(device_t dev) aw_gpio_register_isrcs(sc); intr_pic_register(dev, OF_xref_from_node(ofw_bus_get_node(dev))); - sc->sc_busdev = gpiobus_attach_bus(dev); - if (sc->sc_busdev == NULL) - goto fail; - /* * Register as a pinctrl device */ @@ -1166,6 +1162,10 @@ aw_gpio_attach(device_t dev) fdt_pinctrl_register(dev, "allwinner,pins"); fdt_pinctrl_configure_tree(dev); + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) + goto fail; + config_intrhook_oneshot(aw_gpio_enable_bank_supply, sc); return (0); diff --git a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c index e4fc57b79ba5..48d1d2af5abc 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c @@ -837,12 +837,12 @@ bcm_gpio_attach(device_t dev) } sc->sc_gpio_npins = i; bcm_gpio_sysctl_init(sc); - sc->sc_busdev = gpiobus_attach_bus(dev); - if (sc->sc_busdev == NULL) - goto fail; fdt_pinctrl_register(dev, "brcm,pins"); fdt_pinctrl_configure_tree(dev); + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) + goto fail; return (0); diff --git a/sys/arm/nvidia/as3722_gpio.c b/sys/arm/nvidia/as3722_gpio.c index 073d057884c9..f7b3d4d43bab 100644 --- a/sys/arm/nvidia/as3722_gpio.c +++ b/sys/arm/nvidia/as3722_gpio.c @@ -544,7 +544,7 @@ as3722_gpio_attach(struct as3722_softc *sc, phandle_t node) sc->gpio_pins = malloc(sizeof(struct as3722_gpio_pin *) * sc->gpio_npins, M_AS3722_GPIO, M_WAITOK | M_ZERO); - sc->gpio_busdev = gpiobus_attach_bus(sc->dev); + sc->gpio_busdev = gpiobus_add_bus(sc->dev); if (sc->gpio_busdev == NULL) return (ENXIO); for (i = 0; i < sc->gpio_npins; i++) { diff --git a/sys/arm64/apple/apple_pinctrl.c b/sys/arm64/apple/apple_pinctrl.c index ec2dd5907024..ebaaccea1d99 100644 --- a/sys/arm64/apple/apple_pinctrl.c +++ b/sys/arm64/apple/apple_pinctrl.c @@ -161,22 +161,22 @@ apple_pinctrl_attach(device_t dev) goto error; } + fdt_pinctrl_register(dev, "pinmux"); + fdt_pinctrl_configure_tree(dev); + + if (OF_hasprop(node, "interrupt-controller")) { + sc->sc_irqs = mallocarray(sc->sc_ngpios, + sizeof(*sc->sc_irqs), M_DEVBUF, M_ZERO | M_WAITOK); + intr_pic_register(dev, + OF_xref_from_node(ofw_bus_get_node(dev))); + } + sc->sc_busdev = gpiobus_attach_bus(dev); if (sc->sc_busdev == NULL) { device_printf(dev, "failed to attach gpiobus\n"); goto error; } - fdt_pinctrl_register(dev, "pinmux"); - fdt_pinctrl_configure_tree(dev); - - if (!OF_hasprop(node, "interrupt-controller")) - return (0); - - sc->sc_irqs = mallocarray(sc->sc_ngpios, - sizeof(*sc->sc_irqs), M_DEVBUF, M_ZERO | M_WAITOK); - intr_pic_register(dev, OF_xref_from_node(ofw_bus_get_node(dev))); - return (0); error: mtx_destroy(&sc->sc_mtx); diff --git a/sys/arm64/nvidia/tegra210/max77620_gpio.c b/sys/arm64/nvidia/tegra210/max77620_gpio.c index 8dcf98099dac..5d91e23324c7 100644 --- a/sys/arm64/nvidia/tegra210/max77620_gpio.c +++ b/sys/arm64/nvidia/tegra210/max77620_gpio.c @@ -672,7 +672,7 @@ max77620_gpio_attach(struct max77620_softc *sc, phandle_t node) sx_init(&sc->gpio_lock, "MAX77620 GPIO lock"); - sc->gpio_busdev = gpiobus_attach_bus(sc->dev); + sc->gpio_busdev = gpiobus_add_bus(sc->dev); if (sc->gpio_busdev == NULL) return (ENXIO); diff --git a/sys/arm64/rockchip/rk_gpio.c b/sys/arm64/rockchip/rk_gpio.c index a86392f16624..847bc7394dd0 100644 --- a/sys/arm64/rockchip/rk_gpio.c +++ b/sys/arm64/rockchip/rk_gpio.c @@ -362,12 +362,6 @@ rk_gpio_attach(device_t dev) return (ENXIO); } - sc->sc_busdev = gpiobus_attach_bus(dev); - if (sc->sc_busdev == NULL) { - rk_gpio_detach(dev); - return (ENXIO); - } - /* Set the cached value to unknown */ for (i = 0; i < RK_GPIO_MAX_PINS; i++) sc->pin_cached[i].is_gpio = 2; @@ -377,6 +371,12 @@ rk_gpio_attach(device_t dev) sc->swporta_ddr = rk_gpio_read_4(sc, RK_GPIO_SWPORTA_DDR); RK_GPIO_UNLOCK(sc); + sc->sc_busdev = gpiobus_attach_bus(dev); + if (sc->sc_busdev == NULL) { + rk_gpio_detach(dev); + return (ENXIO); + } + return (0); } diff --git a/sys/dev/gpio/pl061.c b/sys/dev/gpio/pl061.c index cc39790322b6..87d4310a6396 100644 --- a/sys/dev/gpio/pl061.c +++ b/sys/dev/gpio/pl061.c @@ -487,14 +487,21 @@ pl061_attach(device_t dev) } } + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "pl061", MTX_SPIN); + + if (sc->sc_xref != 0 && !intr_pic_register(dev, sc->sc_xref)) { + device_printf(dev, "couldn't register PIC\n"); + PL061_LOCK_DESTROY(sc); + goto free_isrc; + } + sc->sc_busdev = gpiobus_attach_bus(dev); if (sc->sc_busdev == NULL) { device_printf(dev, "couldn't attach gpio bus\n"); + PL061_LOCK_DESTROY(sc); goto free_isrc; } - mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "pl061", MTX_SPIN); - return (0); free_isrc: @@ -503,6 +510,7 @@ free_isrc: * for (irq = 0; irq < PL061_NUM_GPIO; irq++) * intr_isrc_deregister(PIC_INTR_ISRC(sc, irq)); */ + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_hdlr); bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_irq_res); free_pic: diff --git a/sys/dev/gpio/pl061.h b/sys/dev/gpio/pl061.h index 809a1168493d..d9fe23e502b1 100644 --- a/sys/dev/gpio/pl061.h +++ b/sys/dev/gpio/pl061.h @@ -46,6 +46,7 @@ struct pl061_softc { struct resource *sc_mem_res; struct resource *sc_irq_res; void *sc_irq_hdlr; + intptr_t sc_xref; int sc_mem_rid; int sc_irq_rid; struct pl061_pin_irqsrc sc_isrcs[PL061_NUM_GPIO]; diff --git a/sys/dev/gpio/pl061_acpi.c b/sys/dev/gpio/pl061_acpi.c index f5885025083e..8e9921261e4e 100644 --- a/sys/dev/gpio/pl061_acpi.c +++ b/sys/dev/gpio/pl061_acpi.c @@ -67,19 +67,12 @@ pl061_acpi_probe(device_t dev) static int pl061_acpi_attach(device_t dev) { - int error; + struct pl061_softc *sc; - error = pl061_attach(dev); - if (error != 0) - return (error); + sc = device_get_softc(dev); + sc->sc_xref = ACPI_GPIO_XREF; - if (!intr_pic_register(dev, ACPI_GPIO_XREF)) { - device_printf(dev, "couldn't register PIC\n"); - pl061_detach(dev); - error = ENXIO; - } - - return (error); + return (pl061_attach(dev)); } static device_method_t pl061_acpi_methods[] = { diff --git a/sys/dev/gpio/pl061_fdt.c b/sys/dev/gpio/pl061_fdt.c index aa22298b43c6..681b3ccdfdeb 100644 --- a/sys/dev/gpio/pl061_fdt.c +++ b/sys/dev/gpio/pl061_fdt.c @@ -61,19 +61,12 @@ pl061_fdt_probe(device_t dev) static int pl061_fdt_attach(device_t dev) { - int error; + struct pl061_softc *sc; - error = pl061_attach(dev); - if (error != 0) - return (error); + sc = device_get_softc(dev); + sc->sc_xref = OF_xref_from_node(ofw_bus_get_node(dev)); - if (!intr_pic_register(dev, OF_xref_from_node(ofw_bus_get_node(dev)))) { - device_printf(dev, "couldn't register PIC\n"); - pl061_detach(dev); - error = ENXIO; - } - - return (error); + return (pl061_attach(dev)); } static device_method_t pl061_fdt_methods[] = { diff --git a/sys/dev/gpio/qoriq_gpio.c b/sys/dev/gpio/qoriq_gpio.c index 25dfccede29f..8b44cd256c79 100644 --- a/sys/dev/gpio/qoriq_gpio.c +++ b/sys/dev/gpio/qoriq_gpio.c @@ -369,11 +369,6 @@ qoriq_gpio_attach(device_t dev) for (i = 0; i <= MAXPIN; i++) sc->sc_pins[i].gp_caps = DEFAULT_CAPS; - sc->busdev = gpiobus_attach_bus(dev); - if (sc->busdev == NULL) { - qoriq_gpio_detach(dev); - return (ENOMEM); - } /* * Enable the GPIO Input Buffer for all GPIOs. * This is safe on devices without a GPIBE register, because those @@ -384,6 +379,12 @@ qoriq_gpio_attach(device_t dev) OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); + sc->busdev = gpiobus_attach_bus(dev); + if (sc->busdev == NULL) { + qoriq_gpio_detach(dev); + return (ENOMEM); + } + return (0); } diff --git a/sys/dev/iicbus/gpio/tca64xx.c b/sys/dev/iicbus/gpio/tca64xx.c index 3b3bca9936f1..cd011ae9be75 100644 --- a/sys/dev/iicbus/gpio/tca64xx.c +++ b/sys/dev/iicbus/gpio/tca64xx.c @@ -261,14 +261,13 @@ tca64xx_attach(device_t dev) sc->addr = iicbus_get_addr(dev); mtx_init(&sc->mtx, "tca64xx gpio", "gpio", MTX_DEF); + OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { device_printf(dev, "Could not create busdev child\n"); return (ENXIO); } - OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); - #ifdef DEBUG switch (sc->chip) { case TCA6416_TYPE: diff --git a/sys/powerpc/mpc85xx/mpc85xx_gpio.c b/sys/powerpc/mpc85xx/mpc85xx_gpio.c index 0f333feb747f..cb96d768adef 100644 --- a/sys/powerpc/mpc85xx/mpc85xx_gpio.c +++ b/sys/powerpc/mpc85xx/mpc85xx_gpio.c @@ -226,14 +226,14 @@ mpc85xx_gpio_attach(device_t dev) return (ENOMEM); } + OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); + sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { mpc85xx_gpio_detach(dev); return (ENOMEM); } - OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); - return (0); } From nobody Fri Jul 4 14:55:52 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcBw6lNPz61HQk; Fri, 04 Jul 2025 14:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcBw5CWpz43Gd; Fri, 04 Jul 2025 14:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TIfOnsPSqdCW4lutZjeciYeZI82Q17IEW86tYvm+0DQ=; b=lfihqV0n0y5Rcn1XiWdI7G51LlrTbxQgmZvtsB2RjFEtEQ28BcHjImDtEGkDKeqHkD5Xo8 vsUyGxiziDNbRH2gFwgoHh5WX+tRQv7mhhBZd1N7qW8DWM8+Kj3njCuMBqWm0h4n+mTKIH i7YUsw97KLN7c+SiKwYzeSJqbIf5tZqOE6MbYzioFhbY7MQU09FqK6/ZDNmSmYK9h4Jtzg XDRsVSMjVcmSTDzeZiWMIozYgtHbli/1/3eCBxOQgqPDWE5DAkzRsceqm2mRbLu47jYfvt E3gW2Dun1spvHig7+VcKL91gfvZMDE2F6r742o0vNrMKYSgwWu24IlDiF1tLew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TIfOnsPSqdCW4lutZjeciYeZI82Q17IEW86tYvm+0DQ=; b=tcgvmWRcHof1a2qUkPSpi4JABo6x5EvHURyFsvLwTZtNrwsJKpdLtwZmIk0WYNDj62QYHs VPI87HV10qAGQalfGC4o77XEqJ1Dgxoqi7EG9xbqyzKXKSW8YvXljbKfvm1mTseEs55lhY IyAzHK4bLmLbLBMkOofaRNGLRjs/sueKdecYLErqX8AUg4VPNKchbhTOZpRokwczNmEKYS yuPPJf7PgT8i6VbyqLOXbXiHWVMcYpfcQm7Ay0RyJGgdxzqw68sI5mKh+nl09z4YUb3e/g 1E+jUuaZNVfHTjZZEA5tNOBkhYJpgM51sIezB2iCEX1Q4HIiHbfRYL7YNgm8jQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640952; a=rsa-sha256; cv=none; b=shUJfKB4IdDLpOF0NUXYu2h0qn85rBFp+QmcN8qNERcqQGW9G+iFgbmTa/ArjkzwC7EoVh MvUwY9g7gcfPdAqNzixJDKyY5QXmhiiumxzIMfkTau9fAMxGDg+8VZRoPL+Z4PiTR57GpV graZL1eCqfbkXg5VjUHtveexQ+n/DKc4r6tnxi6Rp1HsfbfTz9eC9TnH8wKdSvmFsb1iHy 9fbiNGyWrSgyJS1RNuxcbrNUrH0sP5ci/FLtIdVDiQdO/1UIN8nAMIcdabNT9JXae03syN IIDH+zIswr1I3ktEQYb6gFcThzOjY/f+trMHnjHn4csfQY3l0F1x1n/BjfV2DA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcBw4VBBztd6; Fri, 04 Jul 2025 14:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Etq94073427; Fri, 4 Jul 2025 14:55:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564EtqwS073424; Fri, 4 Jul 2025 14:55:52 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:55:52 GMT Message-Id: <202507041455.564EtqwS073424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f1f230439fa4 - main - vfs: Initial revision of inotify List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f1f230439fa48581f40a57f095627f667a9713c3 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f1f230439fa48581f40a57f095627f667a9713c3 commit f1f230439fa48581f40a57f095627f667a9713c3 Author: Mark Johnston AuthorDate: 2025-07-03 20:07:45 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 vfs: Initial revision of inotify Add an implementation of inotify_init(), inotify_add_watch(), inotify_rm_watch(), source-compatible with Linux. This provides functionality similar to kevent(2)'s EVFILT_VNODE, i.e., it lets applications monitor filesystem files for accesses. Compared to inotify, however, EVFILT_VNODE has the limitation of requiring the application to open the file to be monitored. This means that activity on a newly created file cannot be monitored reliably, and that a file descriptor per file in the hierarchy is required. inotify on the other hand allows a directory and its entries to be monitored at once. It introduces a new file descriptor type to which "watches" can be attached; a watch is a pseudo-file descriptor associated with a file or directory and a set of events to watch for. When a watched vnode is accessed, a description of the event is queued to the inotify descriptor, readable with read(2). Events for files in a watched directory include the file name. A watched vnode has its usecount bumped, so name cache entries originating from a watched directory are not evicted. Name cache entries are used to populate inotify events for files with a link in a watched directory. In particular, if a file is accessed with, say, read(2), an IN_ACCESS event will be generated for any watched hard link of the file. The inotify_add_watch_at() variant is included so that this functionality is available in capability mode; plain inotify_add_watch() is disallowed in capability mode. When a file in a nullfs mount is watched, the watch is attached to the lower vnode, such that accesses via either layer generate inotify events. Many thanks to Gleb Popov for testing this patch and finding lots of bugs. PR: 258010, 215011 Reviewed by: kib Tested by: arrowd MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315 --- share/man/man4/rights.4 | 10 +- sys/bsm/audit_kevents.h | 1 + sys/conf/files | 1 + sys/fs/nullfs/null_subr.c | 4 + sys/fs/nullfs/null_vnops.c | 29 +- sys/kern/kern_resource.c | 21 + sys/kern/subr_capability.c | 4 + sys/kern/sys_generic.c | 35 +- sys/kern/syscalls.master | 15 + sys/kern/vfs_cache.c | 59 +++ sys/kern/vfs_default.c | 17 + sys/kern/vfs_inotify.c | 1008 ++++++++++++++++++++++++++++++++++++++++++++ sys/kern/vfs_subr.c | 7 +- sys/kern/vfs_vnops.c | 3 +- sys/kern/vnode_if.src | 21 + sys/sys/caprights.h | 2 + sys/sys/capsicum.h | 8 +- sys/sys/exterr_cat.h | 1 + sys/sys/file.h | 1 + sys/sys/inotify.h | 146 +++++++ sys/sys/resourcevar.h | 4 + sys/sys/specialfd.h | 5 + sys/sys/user.h | 5 + sys/sys/vnode.h | 12 +- sys/tools/vnode_if.awk | 1 + 25 files changed, 1405 insertions(+), 15 deletions(-) diff --git a/share/man/man4/rights.4 b/share/man/man4/rights.4 index 0c24f6b45f88..8f5f6ad9c2d2 100644 --- a/share/man/man4/rights.4 +++ b/share/man/man4/rights.4 @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 1, 2024 +.Dd May 22, 2025 .Dt RIGHTS 4 .Os .Sh NAME @@ -319,6 +319,14 @@ Permit .It Dv CAP_GETSOCKOPT Permit .Xr getsockopt 2 . +.It Dv CAP_INOTIFY_ADD +Permit +.Xr inotify_add_watch 2 +and +.Xr inotify_add_watch_at 2 . +.It Dv CAP_INOTIFY_RM +Permit +.Xr inotify_rm_watch 2 . .It Dv CAP_IOCTL Permit .Xr ioctl 2 . diff --git a/sys/bsm/audit_kevents.h b/sys/bsm/audit_kevents.h index 0f110d5f9ddd..9381396f247c 100644 --- a/sys/bsm/audit_kevents.h +++ b/sys/bsm/audit_kevents.h @@ -663,6 +663,7 @@ #define AUE_FSPACECTL 43269 /* FreeBSD-specific. */ #define AUE_TIMERFD 43270 /* FreeBSD/Linux. */ #define AUE_SETCRED 43271 /* FreeBSD-specific. */ +#define AUE_INOTIFY 43272 /* FreeBSD/Linux. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the diff --git a/sys/conf/files b/sys/conf/files index f6d473b1431b..dd6f9a3021d4 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3992,6 +3992,7 @@ kern/vfs_export.c standard kern/vfs_extattr.c standard kern/vfs_hash.c standard kern/vfs_init.c standard +kern/vfs_inotify.c standard kern/vfs_lookup.c standard kern/vfs_mount.c standard kern/vfs_mountroot.c standard diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index 0356877eaf05..7dcc83880bb9 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -245,6 +245,10 @@ null_nodeget(struct mount *mp, struct vnode *lowervp, struct vnode **vpp) vp->v_object = lowervp->v_object; vn_irflag_set(vp, VIRF_PGREAD); } + if ((vn_irflag_read(lowervp) & VIRF_INOTIFY) != 0) + vn_irflag_set(vp, VIRF_INOTIFY); + if ((vn_irflag_read(lowervp) & VIRF_INOTIFY_PARENT) != 0) + vn_irflag_set(vp, VIRF_INOTIFY_PARENT); if (lowervp == MOUNTTONULLMOUNT(mp)->nullm_lowerrootvp) vp->v_vflag |= VV_ROOT; diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 8608216e10e5..74c1a8f3acb6 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -189,6 +189,26 @@ static int null_bug_bypass = 0; /* for debugging: enables bypass printf'ing */ SYSCTL_INT(_debug, OID_AUTO, nullfs_bug_bypass, CTLFLAG_RW, &null_bug_bypass, 0, ""); +/* + * Synchronize inotify flags with the lower vnode: + * - If the upper vnode has the flag set and the lower does not, then the lower + * vnode is unwatched and the upper vnode does not need to go through + * VOP_INOTIFY. + * - If the lower vnode is watched, then the upper vnode should go through + * VOP_INOTIFY, so copy the flag up. + */ +static void +null_copy_inotify(struct vnode *vp, struct vnode *lvp, short flag) +{ + if ((vn_irflag_read(vp) & flag) != 0) { + if (__predict_false((vn_irflag_read(lvp) & flag) == 0)) + vn_irflag_unset(vp, flag); + } else if ((vn_irflag_read(lvp) & flag) != 0) { + if (__predict_false((vn_irflag_read(vp) & flag) == 0)) + vn_irflag_set(vp, flag); + } +} + /* * This is the 10-Apr-92 bypass routine. * This version has been optimized for speed, throwing away some @@ -305,7 +325,10 @@ null_bypass(struct vop_generic_args *ap) lvp = *(vps_p[i]); /* - * Get rid of the transient hold on lvp. + * Get rid of the transient hold on lvp. Copy inotify + * flags up in case something is watching the lower + * layer. + * * If lowervp was unlocked during VOP * operation, nullfs upper vnode could have * been reclaimed, which changes its v_vnlock @@ -314,6 +337,10 @@ null_bypass(struct vop_generic_args *ap) * upper (reclaimed) vnode. */ if (lvp != NULLVP) { + null_copy_inotify(old_vps[i], lvp, + VIRF_INOTIFY); + null_copy_inotify(old_vps[i], lvp, + VIRF_INOTIFY_PARENT); if (VOP_ISLOCKED(lvp) == LK_EXCLUSIVE && old_vps[i]->v_vnlock != lvp->v_vnlock) { VOP_UNLOCK(lvp); diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index c8b01afeab4f..dcd38c6e6fbe 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1637,6 +1637,12 @@ uifree(struct uidinfo *uip) if (uip->ui_pipecnt != 0) printf("freeing uidinfo: uid = %d, pipecnt = %ld\n", uip->ui_uid, uip->ui_pipecnt); + if (uip->ui_inotifycnt != 0) + printf("freeing uidinfo: uid = %d, inotifycnt = %ld\n", + uip->ui_uid, uip->ui_inotifycnt); + if (uip->ui_inotifywatchcnt != 0) + printf("freeing uidinfo: uid = %d, inotifywatchcnt = %ld\n", + uip->ui_uid, uip->ui_inotifywatchcnt); free(uip, M_UIDINFO); } @@ -1742,6 +1748,21 @@ chgpipecnt(struct uidinfo *uip, int diff, rlim_t max) return (chglimit(uip, &uip->ui_pipecnt, diff, max, "pipecnt")); } +int +chginotifycnt(struct uidinfo *uip, int diff, rlim_t max) +{ + + return (chglimit(uip, &uip->ui_inotifycnt, diff, max, "inotifycnt")); +} + +int +chginotifywatchcnt(struct uidinfo *uip, int diff, rlim_t max) +{ + + return (chglimit(uip, &uip->ui_inotifywatchcnt, diff, max, + "inotifywatchcnt")); +} + static int sysctl_kern_proc_rlimit_usage(SYSCTL_HANDLER_ARGS) { diff --git a/sys/kern/subr_capability.c b/sys/kern/subr_capability.c index 7cc6fb593697..5ad5b0af1681 100644 --- a/sys/kern/subr_capability.c +++ b/sys/kern/subr_capability.c @@ -74,6 +74,10 @@ const cap_rights_t cap_getsockopt_rights = CAP_RIGHTS_INITIALIZER(CAP_GETSOCKOPT); const cap_rights_t cap_getsockname_rights = CAP_RIGHTS_INITIALIZER(CAP_GETSOCKNAME); +const cap_rights_t cap_inotify_add_rights = + CAP_RIGHTS_INITIALIZER(CAP_INOTIFY_ADD); +const cap_rights_t cap_inotify_rm_rights = + CAP_RIGHTS_INITIALIZER(CAP_INOTIFY_RM); const cap_rights_t cap_ioctl_rights = CAP_RIGHTS_INITIALIZER(CAP_IOCTL); const cap_rights_t cap_listen_rights = CAP_RIGHTS_INITIALIZER(CAP_LISTEN); const cap_rights_t cap_linkat_source_rights = diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index d31ff3b939cc..5d09ba3f37f7 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -42,11 +42,12 @@ #include #include #include +#include #include #include #include #include -#include +#include #include #include #include @@ -939,7 +940,6 @@ int kern_specialfd(struct thread *td, int type, void *arg) { struct file *fp; - struct specialfd_eventfd *ae; int error, fd, fflags; fflags = 0; @@ -948,12 +948,22 @@ kern_specialfd(struct thread *td, int type, void *arg) return (error); switch (type) { - case SPECIALFD_EVENTFD: + case SPECIALFD_EVENTFD: { + struct specialfd_eventfd *ae; + ae = arg; if ((ae->flags & EFD_CLOEXEC) != 0) fflags |= O_CLOEXEC; error = eventfd_create_file(td, fp, ae->initval, ae->flags); break; + } + case SPECIALFD_INOTIFY: { + struct specialfd_inotify *si; + + si = arg; + error = inotify_create_file(td, fp, si->flags, &fflags); + break; + } default: error = EINVAL; break; @@ -970,11 +980,12 @@ kern_specialfd(struct thread *td, int type, void *arg) int sys___specialfd(struct thread *td, struct __specialfd_args *args) { - struct specialfd_eventfd ae; int error; switch (args->type) { - case SPECIALFD_EVENTFD: + case SPECIALFD_EVENTFD: { + struct specialfd_eventfd ae; + if (args->len != sizeof(struct specialfd_eventfd)) { error = EINVAL; break; @@ -989,6 +1000,20 @@ sys___specialfd(struct thread *td, struct __specialfd_args *args) } error = kern_specialfd(td, args->type, &ae); break; + } + case SPECIALFD_INOTIFY: { + struct specialfd_inotify si; + + if (args->len != sizeof(si)) { + error = EINVAL; + break; + } + error = copyin(args->req, &si, sizeof(si)); + if (error != 0) + break; + error = kern_specialfd(td, args->type, &si); + break; + } default: error = EINVAL; break; diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 08b557a7a540..2ab17e036d5c 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -3356,4 +3356,19 @@ _In_reads_bytes_(4) void *ptr ); } +593 AUE_INOTIFY STD|CAPENABLED { + int inotify_add_watch_at( + int fd, + int dfd, + _In_z_ const char *path, + uint32_t mask + ); + } +594 AUE_INOTIFY STD|CAPENABLED { + int inotify_rm_watch( + int fd, + int wd + ); + } + ; vim: syntax=off diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 883beaf6d1da..3d455b3874cc 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -2628,6 +2629,14 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, atomic_thread_fence_rel(); atomic_store_ptr(&dvp->v_cache_dd, ncp); } else if (vp != NULL) { + /* + * Take the slow path in INOTIFY(). This flag will be lazily + * cleared by cache_vop_inotify() once all directories referring + * to vp are unwatched. + */ + if (__predict_false((vn_irflag_read(dvp) & VIRF_INOTIFY) != 0)) + vn_irflag_set_cond(vp, VIRF_INOTIFY_PARENT); + /* * For this case, the cache entry maps both the * directory name in it and the name ".." for the @@ -4008,6 +4017,56 @@ out: return (error); } +void +cache_vop_inotify(struct vnode *vp, int event, uint32_t cookie) +{ + struct mtx *vlp; + struct namecache *ncp; + int isdir; + bool logged, self; + + isdir = vp->v_type == VDIR ? IN_ISDIR : 0; + self = (vn_irflag_read(vp) & VIRF_INOTIFY) != 0 && + (vp->v_type != VDIR || (event & ~_IN_DIR_EVENTS) != 0); + + if (self) { + int selfevent; + + if (event == _IN_ATTRIB_LINKCOUNT) + selfevent = IN_ATTRIB; + else + selfevent = event; + inotify_log(vp, NULL, 0, selfevent | isdir, cookie); + } + if ((event & IN_ALL_EVENTS) == 0) + return; + + logged = false; + vlp = VP2VNODELOCK(vp); + mtx_lock(vlp); + TAILQ_FOREACH(ncp, &vp->v_cache_dst, nc_dst) { + if ((ncp->nc_flag & NCF_ISDOTDOT) != 0) + continue; + if ((vn_irflag_read(ncp->nc_dvp) & VIRF_INOTIFY) != 0) { + /* + * XXX-MJ if the vnode has two links in the same + * dir, we'll log the same event twice. + */ + inotify_log(ncp->nc_dvp, ncp->nc_name, ncp->nc_nlen, + event | isdir, cookie); + logged = true; + } + } + if (!logged && (vn_irflag_read(vp) & VIRF_INOTIFY_PARENT) != 0) { + /* + * We didn't find a watched directory that contains this vnode, + * so stop calling VOP_INOTIFY for operations on the vnode. + */ + vn_irflag_unset(vp, VIRF_INOTIFY_PARENT); + } + mtx_unlock(vlp); +} + #ifdef DDB static void db_print_vpath(struct vnode *vp) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index be49c0887609..2a01ec1e307e 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -119,6 +120,8 @@ struct vop_vector default_vnodeops = { .vop_getwritemount = vop_stdgetwritemount, .vop_inactive = VOP_NULL, .vop_need_inactive = vop_stdneed_inactive, + .vop_inotify = vop_stdinotify, + .vop_inotify_add_watch = vop_stdinotify_add_watch, .vop_ioctl = vop_stdioctl, .vop_kqfilter = vop_stdkqfilter, .vop_islocked = vop_stdislocked, @@ -1305,6 +1308,20 @@ vop_stdneed_inactive(struct vop_need_inactive_args *ap) return (1); } +int +vop_stdinotify(struct vop_inotify_args *ap) +{ + vn_inotify(ap->a_vp, ap->a_dvp, ap->a_cnp, ap->a_event, ap->a_cookie); + return (0); +} + +int +vop_stdinotify_add_watch(struct vop_inotify_add_watch_args *ap) +{ + return (vn_inotify_add_watch(ap->a_vp, ap->a_sc, ap->a_mask, + ap->a_wdp, ap->a_td)); +} + int vop_stdioctl(struct vop_ioctl_args *ap) { diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c new file mode 100644 index 000000000000..929ce0426ee8 --- /dev/null +++ b/sys/kern/vfs_inotify.c @@ -0,0 +1,1008 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Klara, Inc. + */ + +#include "opt_ktrace.h" + +#include +#include +#include +#include +#include +#define EXTERR_CATEGORY EXTERR_CAT_INOTIFY +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint32_t inotify_rename_cookie; + +static SYSCTL_NODE(_vfs, OID_AUTO, inotify, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "inotify configuration"); + +static int inotify_max_queued_events = 16384; +SYSCTL_INT(_vfs_inotify, OID_AUTO, max_queued_events, CTLFLAG_RWTUN, + &inotify_max_queued_events, 0, + "Maximum number of events to queue on an inotify descriptor"); + +static int inotify_max_user_instances = 256; +SYSCTL_INT(_vfs_inotify, OID_AUTO, max_user_instances, CTLFLAG_RWTUN, + &inotify_max_user_instances, 0, + "Maximum number of inotify descriptors per user"); + +static int inotify_max_user_watches; +SYSCTL_INT(_vfs_inotify, OID_AUTO, max_user_watches, CTLFLAG_RWTUN, + &inotify_max_user_watches, 0, + "Maximum number of inotify watches per user"); + +static int inotify_max_watches; +SYSCTL_INT(_vfs_inotify, OID_AUTO, max_watches, CTLFLAG_RWTUN, + &inotify_max_watches, 0, + "Maximum number of inotify watches system-wide"); + +static int inotify_watches; +SYSCTL_INT(_vfs_inotify, OID_AUTO, watches, CTLFLAG_RD, + &inotify_watches, 0, + "Total number of inotify watches currently in use"); + +static int inotify_coalesce = 1; +SYSCTL_INT(_vfs_inotify, OID_AUTO, coalesce, CTLFLAG_RWTUN, + &inotify_coalesce, 0, + "Coalesce inotify events when possible"); + +static COUNTER_U64_DEFINE_EARLY(inotify_event_drops); +SYSCTL_COUNTER_U64(_vfs_inotify, OID_AUTO, event_drops, CTLFLAG_RD, + &inotify_event_drops, + "Number of inotify events dropped due to limits or allocation failures"); + +static fo_rdwr_t inotify_read; +static fo_ioctl_t inotify_ioctl; +static fo_poll_t inotify_poll; +static fo_kqfilter_t inotify_kqfilter; +static fo_stat_t inotify_stat; +static fo_close_t inotify_close; +static fo_fill_kinfo_t inotify_fill_kinfo; + +static const struct fileops inotifyfdops = { + .fo_read = inotify_read, + .fo_write = invfo_rdwr, + .fo_truncate = invfo_truncate, + .fo_ioctl = inotify_ioctl, + .fo_poll = inotify_poll, + .fo_kqfilter = inotify_kqfilter, + .fo_stat = inotify_stat, + .fo_close = inotify_close, + .fo_chmod = invfo_chmod, + .fo_chown = invfo_chown, + .fo_sendfile = invfo_sendfile, + .fo_fill_kinfo = inotify_fill_kinfo, + .fo_cmp = file_kcmp_generic, + .fo_flags = DFLAG_PASSABLE, +}; + +static void filt_inotifydetach(struct knote *kn); +static int filt_inotifyevent(struct knote *kn, long hint); + +static const struct filterops inotify_rfiltops = { + .f_isfd = 1, + .f_detach = filt_inotifydetach, + .f_event = filt_inotifyevent, +}; + +static MALLOC_DEFINE(M_INOTIFY, "inotify", "inotify data structures"); + +struct inotify_record { + STAILQ_ENTRY(inotify_record) link; + struct inotify_event ev; +}; + +static uint64_t inotify_ino = 1; + +/* + * On LP64 systems this occupies 64 bytes, so we don't get internal + * fragmentation by allocating watches with malloc(9). If the size changes, + * consider using a UMA zone to improve memory efficiency. + */ +struct inotify_watch { + struct inotify_softc *sc; /* back-pointer */ + int wd; /* unique ID */ + uint32_t mask; /* event mask */ + struct vnode *vp; /* vnode being watched, refed */ + RB_ENTRY(inotify_watch) ilink; /* inotify linkage */ + TAILQ_ENTRY(inotify_watch) vlink; /* vnode linkage */ +}; + +static void +inotify_init(void *arg __unused) +{ + /* Don't let a user hold too many vnodes. */ + inotify_max_user_watches = desiredvnodes / 3; + /* Don't let the system hold too many vnodes. */ + inotify_max_watches = desiredvnodes / 2; +} +SYSINIT(inotify, SI_SUB_VFS, SI_ORDER_ANY, inotify_init, NULL); + +static int +inotify_watch_cmp(const struct inotify_watch *a, + const struct inotify_watch *b) +{ + if (a->wd < b->wd) + return (-1); + else if (a->wd > b->wd) + return (1); + else + return (0); +} +RB_HEAD(inotify_watch_tree, inotify_watch); +RB_GENERATE_STATIC(inotify_watch_tree, inotify_watch, ilink, inotify_watch_cmp); + +struct inotify_softc { + struct mtx lock; /* serialize all softc writes */ + STAILQ_HEAD(, inotify_record) pending; /* events waiting to be read */ + struct inotify_record overflow; /* preallocated record */ + int nextwatch; /* next watch ID to try */ + int npending; /* number of pending events */ + size_t nbpending; /* bytes available to read */ + uint64_t ino; /* unique identifier */ + struct inotify_watch_tree watches; /* active watches */ + struct selinfo sel; /* select/poll/kevent info */ + struct ucred *cred; /* credential ref */ +}; + +static struct inotify_record * +inotify_dequeue(struct inotify_softc *sc) +{ + struct inotify_record *rec; + + mtx_assert(&sc->lock, MA_OWNED); + KASSERT(!STAILQ_EMPTY(&sc->pending), + ("%s: queue for %p is empty", __func__, sc)); + + rec = STAILQ_FIRST(&sc->pending); + STAILQ_REMOVE_HEAD(&sc->pending, link); + sc->npending--; + sc->nbpending -= sizeof(rec->ev) + rec->ev.len; + return (rec); +} + +static void +inotify_enqueue(struct inotify_softc *sc, struct inotify_record *rec, bool head) +{ + mtx_assert(&sc->lock, MA_OWNED); + + if (head) + STAILQ_INSERT_HEAD(&sc->pending, rec, link); + else + STAILQ_INSERT_TAIL(&sc->pending, rec, link); + sc->npending++; + sc->nbpending += sizeof(rec->ev) + rec->ev.len; +} + +static int +inotify_read(struct file *fp, struct uio *uio, struct ucred *cred, int flags, + struct thread *td) +{ + struct inotify_softc *sc; + struct inotify_record *rec; + int error; + bool first; + + sc = fp->f_data; + error = 0; + + mtx_lock(&sc->lock); + while (STAILQ_EMPTY(&sc->pending)) { + if ((flags & IO_NDELAY) != 0 || (fp->f_flag & FNONBLOCK) != 0) { + mtx_unlock(&sc->lock); + return (EWOULDBLOCK); + } + error = msleep(&sc->pending, &sc->lock, PCATCH, "inotify", 0); + if (error != 0) { + mtx_unlock(&sc->lock); + return (error); + } + } + for (first = true; !STAILQ_EMPTY(&sc->pending); first = false) { + size_t len; + + rec = inotify_dequeue(sc); + len = sizeof(rec->ev) + rec->ev.len; + if (uio->uio_resid < (ssize_t)len) { + inotify_enqueue(sc, rec, true); + if (first) { + error = EXTERROR(EINVAL, + "read buffer is too small"); + } + break; + } + mtx_unlock(&sc->lock); + error = uiomove(&rec->ev, len, uio); +#ifdef KTRACE + if (error == 0 && KTRPOINT(td, KTR_STRUCT)) + ktrstruct("inotify", &rec->ev, len); +#endif + mtx_lock(&sc->lock); + if (error != 0) { + inotify_enqueue(sc, rec, true); + mtx_unlock(&sc->lock); + return (error); + } + if (rec == &sc->overflow) { + /* + * Signal to inotify_queue_record() that the overflow + * record can be reused. + */ + memset(rec, 0, sizeof(*rec)); + } else { + free(rec, M_INOTIFY); + } + } + mtx_unlock(&sc->lock); + return (error); +} + +static int +inotify_ioctl(struct file *fp, u_long com, void *data, struct ucred *cred, + struct thread *td) +{ + struct inotify_softc *sc; + + sc = fp->f_data; + + switch (com) { + case FIONREAD: + *(int *)data = (int)sc->nbpending; + return (0); + case FIONBIO: + case FIOASYNC: + return (0); + default: + return (ENOTTY); + } + + return (0); +} + +static int +inotify_poll(struct file *fp, int events, struct ucred *cred, struct thread *td) +{ + struct inotify_softc *sc; + int revents; + + sc = fp->f_data; + revents = 0; + + mtx_lock(&sc->lock); + if ((events & (POLLIN | POLLRDNORM)) != 0 && sc->npending > 0) + revents |= events & (POLLIN | POLLRDNORM); + else + selrecord(td, &sc->sel); + mtx_unlock(&sc->lock); + return (revents); +} + +static void +filt_inotifydetach(struct knote *kn) +{ + struct inotify_softc *sc; + + sc = kn->kn_hook; + knlist_remove(&sc->sel.si_note, kn, 0); +} + +static int +filt_inotifyevent(struct knote *kn, long hint) +{ + struct inotify_softc *sc; + + sc = kn->kn_hook; + mtx_assert(&sc->lock, MA_OWNED); + kn->kn_data = sc->nbpending; + return (kn->kn_data > 0); +} + +static int +inotify_kqfilter(struct file *fp, struct knote *kn) +{ + struct inotify_softc *sc; + + if (kn->kn_filter != EVFILT_READ) + return (EINVAL); + sc = fp->f_data; + kn->kn_fop = &inotify_rfiltops; + kn->kn_hook = sc; + knlist_add(&sc->sel.si_note, kn, 0); + return (0); +} + +static int +inotify_stat(struct file *fp, struct stat *sb, struct ucred *cred) +{ + struct inotify_softc *sc; + + sc = fp->f_data; + + memset(sb, 0, sizeof(*sb)); + sb->st_mode = S_IFREG | S_IRUSR; + sb->st_blksize = sizeof(struct inotify_event) + _IN_NAMESIZE(NAME_MAX); + mtx_lock(&sc->lock); + sb->st_size = sc->nbpending; + sb->st_blocks = sc->npending; + sb->st_uid = sc->cred->cr_ruid; + sb->st_gid = sc->cred->cr_rgid; + sb->st_ino = sc->ino; + mtx_unlock(&sc->lock); + return (0); +} + +static void +inotify_unlink_watch_locked(struct inotify_softc *sc, struct inotify_watch *watch) +{ + struct vnode *vp; + + vp = watch->vp; + mtx_assert(&vp->v_pollinfo->vpi_lock, MA_OWNED); + + atomic_subtract_int(&inotify_watches, 1); + (void)chginotifywatchcnt(sc->cred->cr_ruidinfo, -1, 0); + + TAILQ_REMOVE(&vp->v_pollinfo->vpi_inotify, watch, vlink); + if (TAILQ_EMPTY(&vp->v_pollinfo->vpi_inotify)) + vn_irflag_unset_locked(vp, VIRF_INOTIFY); +} + +/* + * Assumes that the watch has already been removed from its softc. + */ +static void +inotify_remove_watch(struct inotify_watch *watch) +{ + struct inotify_softc *sc; + struct vnode *vp; + + sc = watch->sc; + + vp = watch->vp; + mtx_lock(&vp->v_pollinfo->vpi_lock); + inotify_unlink_watch_locked(sc, watch); + mtx_unlock(&vp->v_pollinfo->vpi_lock); + + vrele(vp); + free(watch, M_INOTIFY); +} + +static int +inotify_close(struct file *fp, struct thread *td) +{ + struct inotify_softc *sc; + struct inotify_record *rec; + struct inotify_watch *watch; + + sc = fp->f_data; + + mtx_lock(&sc->lock); + (void)chginotifycnt(sc->cred->cr_ruidinfo, -1, 0); + while ((watch = RB_MIN(inotify_watch_tree, &sc->watches)) != NULL) { + RB_REMOVE(inotify_watch_tree, &sc->watches, watch); + mtx_unlock(&sc->lock); + inotify_remove_watch(watch); + mtx_lock(&sc->lock); + } + while (!STAILQ_EMPTY(&sc->pending)) { + rec = inotify_dequeue(sc); + if (rec != &sc->overflow) + free(rec, M_INOTIFY); + } + mtx_unlock(&sc->lock); + seldrain(&sc->sel); + knlist_destroy(&sc->sel.si_note); + mtx_destroy(&sc->lock); + crfree(sc->cred); + free(sc, M_INOTIFY); + return (0); +} + +static int +inotify_fill_kinfo(struct file *fp, struct kinfo_file *kif, + struct filedesc *fdp) +{ + struct inotify_softc *sc; + + sc = fp->f_data; + + kif->kf_type = KF_TYPE_INOTIFY; + kif->kf_un.kf_inotify.kf_inotify_npending = sc->npending; + kif->kf_un.kf_inotify.kf_inotify_nbpending = sc->nbpending; + return (0); +} + +int +inotify_create_file(struct thread *td, struct file *fp, int flags, int *fflagsp) +{ + struct inotify_softc *sc; + int fflags; + + if ((flags & ~(IN_NONBLOCK | IN_CLOEXEC)) != 0) + return (EINVAL); + + if (!chginotifycnt(td->td_ucred->cr_ruidinfo, 1, + inotify_max_user_instances)) + return (EMFILE); + + sc = malloc(sizeof(*sc), M_INOTIFY, M_WAITOK | M_ZERO); + sc->nextwatch = 1; /* Required for compatibility. */ + STAILQ_INIT(&sc->pending); + RB_INIT(&sc->watches); + mtx_init(&sc->lock, "inotify", NULL, MTX_DEF); + knlist_init_mtx(&sc->sel.si_note, &sc->lock); + sc->cred = crhold(td->td_ucred); + sc->ino = atomic_fetchadd_64(&inotify_ino, 1); + + fflags = FREAD; + if ((flags & IN_NONBLOCK) != 0) + fflags |= FNONBLOCK; + if ((flags & IN_CLOEXEC) != 0) + *fflagsp |= O_CLOEXEC; + finit(fp, fflags, DTYPE_INOTIFY, sc, &inotifyfdops); + + return (0); +} + +static struct inotify_record * +inotify_alloc_record(uint32_t wd, const char *name, size_t namelen, int event, + uint32_t cookie, int waitok) +{ + struct inotify_event *evp; + struct inotify_record *rec; + + rec = malloc(sizeof(*rec) + _IN_NAMESIZE(namelen), M_INOTIFY, + waitok | M_ZERO); + if (rec == NULL) + return (NULL); + evp = &rec->ev; + evp->wd = wd; + evp->mask = event; + evp->cookie = cookie; + evp->len = _IN_NAMESIZE(namelen); *** 940 LINES SKIPPED *** From nobody Fri Jul 4 14:55:53 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcBy0NG2z61HJ6; Fri, 04 Jul 2025 14:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcBx5Hc5z42xv; Fri, 04 Jul 2025 14:55:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nr0pQaKDg07zv+RdcwfL+rMC7wrbdDs4V5L9H5Q8pGI=; b=yRq04BpEE4Bu8orEFmQXEy4eX4BXsmlZEqVvHTbK7fz5LCWMIkuwg1OGbWjmMpvRVgPOnO k46+95NUOrZiEEhP5b94Ai/Qd3uik2g2Vq0Egk29+qzCHVVQu25tqxfuGFJeVXsgBPBNzv Zuv34ipTujxbHXu7kvIieAljDktdPcLzTlLo8l1sn1AdKQrkQ6k6N6OeBJ0v4laMreSd1K PRsonxJE8n3S92pOgYJ72r9JufFmzpeG3vvmmE16WkgW2PKaLjcu8j8GkDleqWvNhIj0oQ 9wrg+gFmujFc9Oz62I4EwHJW3JFeXlsQW57nOTP/Iz/PvWWzXkdaDF1/5VOQ5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nr0pQaKDg07zv+RdcwfL+rMC7wrbdDs4V5L9H5Q8pGI=; b=L4y6irQjJTgu7asHdPKesu9KPOOLskToI34wFnL7mpRRSleWqTxP4z5kaW3VUluXrKYx+c wOykyvBy6HeAFri+XKIUCQmDAetqrli2pDS7BGHhbKbc70OBpkK6tQ486rh+gZ0y+1dxov prn6qdZN2IK3LPM8P0R3tTNy/P2sCW6F7NOSGk3BGjuZQC3ycUShvGWU8uU5RKF5o+hE8R oLUm/pDMs7CQ17d3VbjSb5ji3c2RdcyiychNSsAuUK0vg1E5NZ6XaIH1l5D7S9Hdqe6Npr Rltgb3Dsj0eQjx+2iQD6RjonfVujNZlaq4qkaHO/IfZo8NdykYy3lE1Nqpmkgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640953; a=rsa-sha256; cv=none; b=wsP1h3yE5VHSjXKcJowpjXgD+7MBQJvj9BaPWyz7TkUB4x7tVhxk8vzIfdgt/QeIgiEkxT wjKbS0OJXVd4/SUVFX3/TtKIpsTqUoCvqDljbdc0BwpyGf8W81UsAVFf/0CUeYx9lxJLuZ OoMFKGj3FqmsRWCUUYgynhexrUuDrqoyoSL36lxrD41Izn7s2CpCCLsnmzsErxAHhYeGQ2 7rzQKKp2oEFCJt1RPSfwCdXLbl2A4XnVnzNOY+p1BobR+r/qktz0ZEsMXJOAdykx8/OKpS ORxINH8MquCyq2XE+ONHEdFMRnV8hf3xVrNA4TvwPoJxjf4zr6lizv8IJjvwVA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcBx4hVfzvg9; Fri, 04 Jul 2025 14:55:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564EtrJs073468; Fri, 4 Jul 2025 14:55:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564EtrOO073465; Fri, 4 Jul 2025 14:55:53 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:55:53 GMT Message-Id: <202507041455.564EtrOO073465@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d4ead7edbbfe - main - inotify: Regenerate syscall definitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4ead7edbbfe7f84ba57a28685e09241433fa380 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d4ead7edbbfe7f84ba57a28685e09241433fa380 commit d4ead7edbbfe7f84ba57a28685e09241433fa380 Author: Mark Johnston AuthorDate: 2025-05-12 19:40:45 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 inotify: Regenerate syscall definitions Sponsored by: Klara, Inc. --- lib/libsys/_libsys.h | 4 ++ lib/libsys/syscalls.map | 4 ++ sys/compat/freebsd32/freebsd32_syscall.h | 4 +- sys/compat/freebsd32/freebsd32_syscalls.c | 2 + sys/compat/freebsd32/freebsd32_sysent.c | 2 + sys/compat/freebsd32/freebsd32_systrace_args.c | 60 ++++++++++++++++++++++++++ sys/kern/init_sysent.c | 2 + sys/kern/syscalls.c | 2 + sys/kern/systrace_args.c | 60 ++++++++++++++++++++++++++ sys/sys/syscall.h | 4 +- sys/sys/syscall.mk | 4 +- sys/sys/sysproto.h | 14 ++++++ 12 files changed, 159 insertions(+), 3 deletions(-) diff --git a/lib/libsys/_libsys.h b/lib/libsys/_libsys.h index e2a8f2253814..1799906eb885 100644 --- a/lib/libsys/_libsys.h +++ b/lib/libsys/_libsys.h @@ -466,6 +466,8 @@ typedef int (__sys_getrlimitusage_t)(u_int, int, rlim_t *); typedef int (__sys_fchroot_t)(int); typedef int (__sys_setcred_t)(u_int, const struct setcred *, size_t); typedef int (__sys_exterrctl_t)(u_int, u_int, void *); +typedef int (__sys_inotify_add_watch_at_t)(int, int, const char *, uint32_t); +typedef int (__sys_inotify_rm_watch_t)(int, int); void __sys_exit(int rval); int __sys_fork(void); @@ -868,6 +870,8 @@ int __sys_getrlimitusage(u_int which, int flags, rlim_t * res); int __sys_fchroot(int fd); int __sys_setcred(u_int flags, const struct setcred * wcred, size_t size); int __sys_exterrctl(u_int op, u_int flags, void * ptr); +int __sys_inotify_add_watch_at(int fd, int dfd, const char * path, uint32_t mask); +int __sys_inotify_rm_watch(int fd, int wd); __END_DECLS #endif /* __LIBSYS_H_ */ diff --git a/lib/libsys/syscalls.map b/lib/libsys/syscalls.map index 51be88203c17..69fce2ea7c63 100644 --- a/lib/libsys/syscalls.map +++ b/lib/libsys/syscalls.map @@ -809,4 +809,8 @@ FBSDprivate_1.0 { __sys_setcred; _exterrctl; __sys_exterrctl; + _inotify_add_watch_at; + __sys_inotify_add_watch_at; + _inotify_rm_watch; + __sys_inotify_rm_watch; }; diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index eaa086188b5f..8d2748098c00 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -511,4 +511,6 @@ #define FREEBSD32_SYS_fchroot 590 #define FREEBSD32_SYS_freebsd32_setcred 591 #define FREEBSD32_SYS_exterrctl 592 -#define FREEBSD32_SYS_MAXSYSCALL 593 +#define FREEBSD32_SYS_inotify_add_watch_at 593 +#define FREEBSD32_SYS_inotify_rm_watch 594 +#define FREEBSD32_SYS_MAXSYSCALL 595 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index 989f32a5c6f0..bda373268cc5 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -598,4 +598,6 @@ const char *freebsd32_syscallnames[] = { "fchroot", /* 590 = fchroot */ "freebsd32_setcred", /* 591 = freebsd32_setcred */ "exterrctl", /* 592 = exterrctl */ + "inotify_add_watch_at", /* 593 = inotify_add_watch_at */ + "inotify_rm_watch", /* 594 = inotify_rm_watch */ }; diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index 476fe2ac3f80..3718a1b0c8ee 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -660,4 +660,6 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(fchroot_args), .sy_call = (sy_call_t *)sys_fchroot, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 590 = fchroot */ { .sy_narg = AS(freebsd32_setcred_args), .sy_call = (sy_call_t *)freebsd32_setcred, .sy_auevent = AUE_SETCRED, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 591 = freebsd32_setcred */ { .sy_narg = AS(exterrctl_args), .sy_call = (sy_call_t *)sys_exterrctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 592 = exterrctl */ + { .sy_narg = AS(inotify_add_watch_at_args), .sy_call = (sy_call_t *)sys_inotify_add_watch_at, .sy_auevent = AUE_INOTIFY, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 593 = inotify_add_watch_at */ + { .sy_narg = AS(inotify_rm_watch_args), .sy_call = (sy_call_t *)sys_inotify_rm_watch, .sy_auevent = AUE_INOTIFY, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 594 = inotify_rm_watch */ }; diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index cf08938cd5de..37564a737a62 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -3395,6 +3395,24 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } + /* inotify_add_watch_at */ + case 593: { + struct inotify_add_watch_at_args *p = params; + iarg[a++] = p->fd; /* int */ + iarg[a++] = p->dfd; /* int */ + uarg[a++] = (intptr_t)p->path; /* const char * */ + uarg[a++] = p->mask; /* uint32_t */ + *n_args = 4; + break; + } + /* inotify_rm_watch */ + case 594: { + struct inotify_rm_watch_args *p = params; + iarg[a++] = p->fd; /* int */ + iarg[a++] = p->wd; /* int */ + *n_args = 2; + break; + } default: *n_args = 0; break; @@ -9172,6 +9190,38 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* inotify_add_watch_at */ + case 593: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "userland const char *"; + break; + case 3: + p = "uint32_t"; + break; + default: + break; + }; + break; + /* inotify_rm_watch */ + case 594: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -11070,6 +11120,16 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* inotify_add_watch_at */ + case 593: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* inotify_rm_watch */ + case 594: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index a48a513aa3b5..34e71a0665ed 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -659,4 +659,6 @@ struct sysent sysent[] = { { .sy_narg = AS(fchroot_args), .sy_call = (sy_call_t *)sys_fchroot, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 590 = fchroot */ { .sy_narg = AS(setcred_args), .sy_call = (sy_call_t *)sys_setcred, .sy_auevent = AUE_SETCRED, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 591 = setcred */ { .sy_narg = AS(exterrctl_args), .sy_call = (sy_call_t *)sys_exterrctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 592 = exterrctl */ + { .sy_narg = AS(inotify_add_watch_at_args), .sy_call = (sy_call_t *)sys_inotify_add_watch_at, .sy_auevent = AUE_INOTIFY, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 593 = inotify_add_watch_at */ + { .sy_narg = AS(inotify_rm_watch_args), .sy_call = (sy_call_t *)sys_inotify_rm_watch, .sy_auevent = AUE_INOTIFY, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 594 = inotify_rm_watch */ }; diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index fa36cc824078..90a4f3a7dad8 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -598,4 +598,6 @@ const char *syscallnames[] = { "fchroot", /* 590 = fchroot */ "setcred", /* 591 = setcred */ "exterrctl", /* 592 = exterrctl */ + "inotify_add_watch_at", /* 593 = inotify_add_watch_at */ + "inotify_rm_watch", /* 594 = inotify_rm_watch */ }; diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 15789d3eb5fa..90b21616a558 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -3482,6 +3482,24 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } + /* inotify_add_watch_at */ + case 593: { + struct inotify_add_watch_at_args *p = params; + iarg[a++] = p->fd; /* int */ + iarg[a++] = p->dfd; /* int */ + uarg[a++] = (intptr_t)p->path; /* const char * */ + uarg[a++] = p->mask; /* uint32_t */ + *n_args = 4; + break; + } + /* inotify_rm_watch */ + case 594: { + struct inotify_rm_watch_args *p = params; + iarg[a++] = p->fd; /* int */ + iarg[a++] = p->wd; /* int */ + *n_args = 2; + break; + } default: *n_args = 0; break; @@ -9317,6 +9335,38 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* inotify_add_watch_at */ + case 593: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "userland const char *"; + break; + case 3: + p = "uint32_t"; + break; + default: + break; + }; + break; + /* inotify_rm_watch */ + case 594: + switch (ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -11305,6 +11355,16 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* inotify_add_watch_at */ + case 593: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* inotify_rm_watch */ + case 594: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 68406a2dfc29..eec923d0b82e 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -529,4 +529,6 @@ #define SYS_fchroot 590 #define SYS_setcred 591 #define SYS_exterrctl 592 -#define SYS_MAXSYSCALL 593 +#define SYS_inotify_add_watch_at 593 +#define SYS_inotify_rm_watch 594 +#define SYS_MAXSYSCALL 595 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index 9a90a63f35a3..547242a73277 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -434,4 +434,6 @@ MIASM = \ getrlimitusage.o \ fchroot.o \ setcred.o \ - exterrctl.o + exterrctl.o \ + inotify_add_watch_at.o \ + inotify_rm_watch.o diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 94da81c84d25..94b5a0a7a95e 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -1891,6 +1891,16 @@ struct exterrctl_args { char flags_l_[PADL_(u_int)]; u_int flags; char flags_r_[PADR_(u_int)]; char ptr_l_[PADL_(void *)]; void * ptr; char ptr_r_[PADR_(void *)]; }; +struct inotify_add_watch_at_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char dfd_l_[PADL_(int)]; int dfd; char dfd_r_[PADR_(int)]; + char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; + char mask_l_[PADL_(uint32_t)]; uint32_t mask; char mask_r_[PADR_(uint32_t)]; +}; +struct inotify_rm_watch_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char wd_l_[PADL_(int)]; int wd; char wd_r_[PADR_(int)]; +}; int sys_exit(struct thread *, struct exit_args *); int sys_fork(struct thread *, struct fork_args *); int sys_read(struct thread *, struct read_args *); @@ -2293,6 +2303,8 @@ int sys_getrlimitusage(struct thread *, struct getrlimitusage_args *); int sys_fchroot(struct thread *, struct fchroot_args *); int sys_setcred(struct thread *, struct setcred_args *); int sys_exterrctl(struct thread *, struct exterrctl_args *); +int sys_inotify_add_watch_at(struct thread *, struct inotify_add_watch_at_args *); +int sys_inotify_rm_watch(struct thread *, struct inotify_rm_watch_args *); #ifdef COMPAT_43 @@ -3275,6 +3287,8 @@ int freebsd13_swapoff(struct thread *, struct freebsd13_swapoff_args *); #define SYS_AUE_fchroot AUE_NULL #define SYS_AUE_setcred AUE_SETCRED #define SYS_AUE_exterrctl AUE_NULL +#define SYS_AUE_inotify_add_watch_at AUE_INOTIFY +#define SYS_AUE_inotify_rm_watch AUE_INOTIFY #undef PAD_ #undef PADL_ From nobody Fri Jul 4 14:55:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcBz3VnKz61HLR; Fri, 04 Jul 2025 14:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcBy6P9pz43Gg; Fri, 04 Jul 2025 14:55:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mU9ASvjDrItpJiURB6sWIO14JkFejF5DTZK3tcTZdgQ=; b=bYn1sldn6FlW7//ReIsRPQO+4zE598kVKnLqC2alF0z4lS2pN/7q5noK71Famy3NCbeL6A G6vwbHnymdKa3g9ahWPHIc72/RuekOkcxfi0LBXG+NRZlcYuadsARiEWfLQKtyPqW5MWF7 grcGLSyjzYM8OoqCi1Fov39we/y8L5aA0OSThbHlZ+vLPwgdeknYigQpKmu2dC809/Il/k FHaFR7+HC7fZ54M/mIfvCOamn5pmQUjDz551vjFIEJqhwHj4FFIo+S6DAZijyEhoOxvNTp L5gBJFROFJnV2Ks+uHT7KePHBhxmn8/ceYMADPEEd7m2/Sxeyg+XLYdroLbGtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mU9ASvjDrItpJiURB6sWIO14JkFejF5DTZK3tcTZdgQ=; b=ynLluHL5Kkka+UnvMzmdC2DOWw56y6e3Hzzj+t3IVIhTE/ENHrZaEcMh7DdFKVug+HAajI P7wnT1S55yFzsxFTZBkrG9wqlfLy0bYNYJg3yDfu6+mzPjWZBuH5UAHK9wuoyUqEGdEOLm bCNjxWVnCTiRDZinpLZ4JgiTRL0P/5xBclaAzAU7c8NJoDL3AeJ/p21wDHs8iADjDLz3uE ZDLtNM+D2UJBv5bzaFwtWIu619QUfFlEBQpRIj9TUlthn9ms/Mbjsd3VAmhbgIITPb84Kb cWgXyOKq+xn7miIKC4GDXuOQcVwo/ltbMT7cZM9RXyBTSG+aOkqGQm5Ebv9lvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640954; a=rsa-sha256; cv=none; b=mxDOB027Q08Epl5T0PX0plyMJdAO9HHdNYicdyZwjdjeW7Ge2iTL/lRFVHa/X+LReSPQ1m GkFLg9fGYHTcwp7jhS472+WzAVN6MedOPLiogHSmQcuynJf6hbNATmyKk9TBPjCBq02tCJ BJR7jOmFLc1YgGDR8kpAlycqNK4Bo2s7jvrHMTMF8mYE3yjnfACIkj+n8E2MoZXJK461fv uVC6E5+jbh0wJ/tNyU672ajhi5/0TYIHwfq2QJedSnmwooOrIvqDkj8DA5nsrrXJoP+p8k Vg3Dtxv4p2d1DvLf70ZBT9/1Bt+UKdhx4LxPMFTWzar9aVWljCbztCMshtW5pA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcBy5vsfztd7; Fri, 04 Jul 2025 14:55:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Etse6073503; Fri, 4 Jul 2025 14:55:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Etss1073500; Fri, 4 Jul 2025 14:55:54 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:55:54 GMT Message-Id: <202507041455.564Etss1073500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 245ff4c4b2c2 - main - libc: Add inotify support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 245ff4c4b2c2728674121a5d9736a5e079bd00b2 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=245ff4c4b2c2728674121a5d9736a5e079bd00b2 commit 245ff4c4b2c2728674121a5d9736a5e079bd00b2 Author: Mark Johnston AuthorDate: 2025-07-03 20:08:59 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 libc: Add inotify support inotify_init() and inotify_init1() are implemented using __specialfd(2). inotify_add_watch() is implemented in terms of inotify_add_watch_at(2). Reviewed by: kib MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315 --- lib/libc/gen/Makefile.inc | 1 + lib/libc/gen/Symbol.map | 3 +++ lib/libc/gen/inotify.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index ad13aaa65621..4d064d18d36e 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -89,6 +89,7 @@ SRCS+= \ glob.c \ glob-compat11.c \ initgroups.c \ + inotify.c \ isatty.c \ isinf.c \ isnan.c \ diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map index 8faecf4b3048..50dbf3425964 100644 --- a/lib/libc/gen/Symbol.map +++ b/lib/libc/gen/Symbol.map @@ -464,6 +464,9 @@ FBSD_1.8 { fdscandir_b; fts_open_b; glob_b; + inotify_add_watch; + inotify_init; + inotify_init1; psiginfo; rtld_get_var; rtld_set_var; diff --git a/lib/libc/gen/inotify.c b/lib/libc/gen/inotify.c new file mode 100644 index 000000000000..7ce53aaccd58 --- /dev/null +++ b/lib/libc/gen/inotify.c @@ -0,0 +1,48 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Klara, Inc. + */ + +#include "namespace.h" +#include +#include +#include +#include "un-namespace.h" +#include "libc_private.h" + +/* + * Provide compatibility with libinotify, which uses different values for these + * flags. + */ +#define IN_NONBLOCK_OLD 0x80000 +#define IN_CLOEXEC_OLD 0x00800 + +int +inotify_add_watch(int fd, const char *pathname, uint32_t mask) +{ + return (inotify_add_watch_at(fd, AT_FDCWD, pathname, mask)); +} + +int +inotify_init1(int flags) +{ + struct specialfd_inotify args; + + if ((flags & IN_NONBLOCK_OLD) != 0) { + flags &= ~IN_NONBLOCK_OLD; + flags |= IN_NONBLOCK; + } + if ((flags & IN_CLOEXEC_OLD) != 0) { + flags &= ~IN_CLOEXEC_OLD; + flags |= IN_CLOEXEC; + } + args.flags = flags; + return (__sys___specialfd(SPECIALFD_INOTIFY, &args, sizeof(args))); +} + +int +inotify_init(void) +{ + return (inotify_init1(0)); +} From nobody Fri Jul 4 14:55:56 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC14Tjpz61HCT; Fri, 04 Jul 2025 14:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC12bbrz439w; Fri, 04 Jul 2025 14:55:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BSMsS3BSN4O5ojYkIPQCy8f9mH1zonf9m3voGzzaZq0=; b=cMUa+NrUVCwlyQUjqCAV1hsGSO2QnIlVpexagzzuDxR+SAcUNNl8EUKihhPGu/YDmyWobd Rpyq/T8sF+3vUBjqVwjJ6LYsGQzIP+KkfXBhG+57iUFxfz1WqMPVOC01ubQ/hKMuwnj22w a7pzfTaDYY45HHQs/VV1RMBX50WYuj00iUngYPANmciy/tLPrdBQN0M/5f7PI0uHdkjHiE jEb9tTgBL3fA8VA106pEbpniyIkVTMfB6McxcsczEB8C6YycLk1tUTh9VU4AuJdrgFW4SV 2RSTbzFVjTGvFnpvEueQNie8IK6EQaiGkDjCNMCJ678Y/BUf050AYbrn2YVNbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BSMsS3BSN4O5ojYkIPQCy8f9mH1zonf9m3voGzzaZq0=; b=SCgjiMgSIb/56gqHiGlmJpbgeirwVfi4sYlFOqPxAThhTrbJZX2Z0Tkeog4My7N+toiBrT BKZm6QJ6Wem2/FB/guMYH2L9wekf/VuEN4NmiuUFUt3GlHaIvPfMJA5xi+jQLVUNM1e2rp 84CsmNCGYg30zofp1l0KRfdqvtCmBWCakfR9PJwGAshl0KHmNAryWjOSBcTimJg9fIe0wo Q9I0zSA7DxzADTDq4eRnfYXQb2pC/n9Z3MuVsMptjUviaiiI7Wvq+3MHRwO+A3AnZz2rLo gkPhsjQ3l2VhKjEViIoVWpnKGpQ+dwQ9b/KaJ00Xw0nKETr0m52NKLjOhRbXYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640957; a=rsa-sha256; cv=none; b=R4l35Y4OdNdyTj6OMFTcwgvoeZtWgEsDDoBDK6yPcWRtdw2vtgPLnGq0butX8KSzuoVlcM 0AO7+A6FlqzBaPZmJv50JdGo4uXUvRAFc+cy1WEAlBH5tqmmLwsTC3VcPEgj+Qf/jHW8W6 wTARF/WyVDzRdlt9dLaX0FqTbHYotq+sDo/93vJ7CNZ7KMalnz0t4LtzmntWJ8jcXDQgoG eeVNZfiqRtFipQhfkCKg7dMHpiznZntxrkjHdrmA6xOGIvi74mPQzMIiXq9obfHsOszRNL lnFRsUoGcdtqP6+zUrdjJ/pu6x1MX6EF7ZvbiaGTKUQMKr8GVTCB/U/a2f02Hg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC10Qd8zvjd; Fri, 04 Jul 2025 14:55:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Etvvb073577; Fri, 4 Jul 2025 14:55:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564EtuxF073574; Fri, 4 Jul 2025 14:55:56 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:55:56 GMT Message-Id: <202507041455.564EtuxF073574@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: bc4430dc203e - main - vfs: Add event notification points List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc4430dc203ed7b6765fb5df041bf545c50f859b Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bc4430dc203ed7b6765fb5df041bf545c50f859b commit bc4430dc203ed7b6765fb5df041bf545c50f859b Author: Mark Johnston AuthorDate: 2025-07-03 20:10:35 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 vfs: Add event notification points The INOTIFY macro and its variants check if the vnode is being watched, and if so, calls into a slow path which adds an event to one or more inotify descriptors. Most of these events correspond to EVFILT_VNODE events as well, and are added to VOP *_post hooks. Reviewed by: kib MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315 --- sys/kern/kern_sendfile.c | 4 ++- sys/kern/vfs_subr.c | 86 +++++++++++++++++++++++++++++++++++++++++------- sys/kern/vfs_vnops.c | 4 +++ sys/kern/vnode_if.src | 3 ++ sys/sys/vnode.h | 12 +++++-- 5 files changed, 94 insertions(+), 15 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 17b53208157a..35b258e68701 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -27,12 +27,12 @@ * SUCH DAMAGE. */ -#include #include "opt_kern_tls.h" #include #include #include +#include #include #include #include @@ -1246,6 +1246,8 @@ out: */ if (error == 0) { td->td_retval[0] = 0; + if (sbytes > 0 && vp != NULL) + INOTIFY(vp, IN_ACCESS); } if (sent != NULL) { (*sent) = sbytes; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index fdc86e8ef90c..877931721da4 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -6057,6 +6058,28 @@ vop_need_inactive_debugpost(void *ap, int rc) } #endif +void +vop_allocate_post(void *ap, int rc) +{ + struct vop_allocate_args *a; + + a = ap; + if (rc == 0) + INOTIFY(a->a_vp, IN_MODIFY); +} + +void +vop_copy_file_range_post(void *ap, int rc) +{ + struct vop_copy_file_range_args *a; + + a = ap; + if (rc == 0) { + INOTIFY(a->a_invp, IN_ACCESS); + INOTIFY(a->a_outvp, IN_MODIFY); + } +} + void vop_create_pre(void *ap) { @@ -6077,8 +6100,20 @@ vop_create_post(void *ap, int rc) a = ap; dvp = a->a_dvp; vn_seqc_write_end(dvp); - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(dvp, NOTE_WRITE); + INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE); + } +} + +void +vop_deallocate_post(void *ap, int rc) +{ + struct vop_deallocate_args *a; + + a = ap; + if (rc == 0) + INOTIFY(a->a_vp, IN_MODIFY); } void @@ -6123,8 +6158,10 @@ vop_deleteextattr_post(void *ap, int rc) a = ap; vp = a->a_vp; vn_seqc_write_end(vp); - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(a->a_vp, NOTE_ATTRIB); + INOTIFY(vp, IN_ATTRIB); + } } void @@ -6154,6 +6191,8 @@ vop_link_post(void *ap, int rc) if (!rc) { VFS_KNOTE_LOCKED(vp, NOTE_LINK); VFS_KNOTE_LOCKED(tdvp, NOTE_WRITE); + INOTIFY_NAME(vp, tdvp, a->a_cnp, _IN_ATTRIB_LINKCOUNT); + INOTIFY_NAME(vp, tdvp, a->a_cnp, IN_CREATE); } } @@ -6177,8 +6216,10 @@ vop_mkdir_post(void *ap, int rc) a = ap; dvp = a->a_dvp; vn_seqc_write_end(dvp); - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(dvp, NOTE_WRITE | NOTE_LINK); + INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE); + } } #ifdef DEBUG_VFS_LOCKS @@ -6213,8 +6254,10 @@ vop_mknod_post(void *ap, int rc) a = ap; dvp = a->a_dvp; vn_seqc_write_end(dvp); - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(dvp, NOTE_WRITE); + INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE); + } } void @@ -6226,8 +6269,10 @@ vop_reclaim_post(void *ap, int rc) a = ap; vp = a->a_vp; ASSERT_VOP_IN_SEQC(vp); - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(vp, NOTE_REVOKE); + INOTIFY_REVOKE(vp); + } } void @@ -6258,6 +6303,8 @@ vop_remove_post(void *ap, int rc) if (!rc) { VFS_KNOTE_LOCKED(dvp, NOTE_WRITE); VFS_KNOTE_LOCKED(vp, NOTE_DELETE); + INOTIFY_NAME(vp, dvp, a->a_cnp, _IN_ATTRIB_LINKCOUNT); + INOTIFY_NAME(vp, dvp, a->a_cnp, IN_DELETE); } } @@ -6289,6 +6336,8 @@ vop_rename_post(void *ap, int rc) VFS_KNOTE_UNLOCKED(a->a_fvp, NOTE_RENAME); if (a->a_tvp) VFS_KNOTE_UNLOCKED(a->a_tvp, NOTE_DELETE); + INOTIFY_MOVE(a->a_fvp, a->a_fdvp, a->a_fcnp, a->a_tvp, + a->a_tdvp, a->a_tcnp); } if (a->a_tdvp != a->a_fdvp) vdrop(a->a_fdvp); @@ -6328,6 +6377,7 @@ vop_rmdir_post(void *ap, int rc) vp->v_vflag |= VV_UNLINKED; VFS_KNOTE_LOCKED(dvp, NOTE_WRITE | NOTE_LINK); VFS_KNOTE_LOCKED(vp, NOTE_DELETE); + INOTIFY_NAME(vp, dvp, a->a_cnp, IN_DELETE); } } @@ -6351,8 +6401,10 @@ vop_setattr_post(void *ap, int rc) a = ap; vp = a->a_vp; vn_seqc_write_end(vp); - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(vp, NOTE_ATTRIB); + INOTIFY(vp, IN_ATTRIB); + } } void @@ -6397,8 +6449,10 @@ vop_setextattr_post(void *ap, int rc) a = ap; vp = a->a_vp; vn_seqc_write_end(vp); - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(vp, NOTE_ATTRIB); + INOTIFY(vp, IN_ATTRIB); + } } void @@ -6421,8 +6475,10 @@ vop_symlink_post(void *ap, int rc) a = ap; dvp = a->a_dvp; vn_seqc_write_end(dvp); - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(dvp, NOTE_WRITE); + INOTIFY_NAME(*a->a_vpp, dvp, a->a_cnp, IN_CREATE); + } } void @@ -6430,8 +6486,10 @@ vop_open_post(void *ap, int rc) { struct vop_open_args *a = ap; - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(a->a_vp, NOTE_OPEN); + INOTIFY(a->a_vp, IN_OPEN); + } } void @@ -6443,6 +6501,8 @@ vop_close_post(void *ap, int rc) !VN_IS_DOOMED(a->a_vp))) { VFS_KNOTE_LOCKED(a->a_vp, (a->a_fflag & FWRITE) != 0 ? NOTE_CLOSE_WRITE : NOTE_CLOSE); + INOTIFY(a->a_vp, (a->a_fflag & FWRITE) != 0 ? + IN_CLOSE_WRITE : IN_CLOSE_NOWRITE); } } @@ -6451,8 +6511,10 @@ vop_read_post(void *ap, int rc) { struct vop_read_args *a = ap; - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ); + INOTIFY(a->a_vp, IN_ACCESS); + } } void @@ -6469,8 +6531,10 @@ vop_readdir_post(void *ap, int rc) { struct vop_readdir_args *a = ap; - if (!rc) + if (!rc) { VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ); + INOTIFY(a->a_vp, IN_ACCESS); + } } static struct knlist fs_knlist; diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 2d743eacd1f0..6451c9e07a60 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -485,6 +486,7 @@ vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, if (vp->v_type != VFIFO && vp->v_type != VSOCK && VOP_ACCESS(vp, VREAD, cred, td) == 0) fp->f_flag |= FKQALLOWED; + INOTIFY(vp, IN_OPEN); return (0); } @@ -1747,6 +1749,8 @@ vn_truncate_locked(struct vnode *vp, off_t length, bool sync, vattr.va_vaflags |= VA_SYNC; error = VOP_SETATTR(vp, &vattr, cred); VOP_ADD_WRITECOUNT_CHECKED(vp, -1); + if (error == 0) + INOTIFY(vp, IN_MODIFY); } return (error); } diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index 9651d655f887..38138a4af921 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -702,6 +702,7 @@ vop_vptocnp { %% allocate vp E E E +%! allocate post vop_allocate_post vop_allocate { IN struct vnode *vp; @@ -786,6 +787,7 @@ vop_fdatasync { %% copy_file_range invp U U U %% copy_file_range outvp U U U +%! copy_file_range post vop_copy_file_range_post vop_copy_file_range { IN struct vnode *invp; @@ -810,6 +812,7 @@ vop_vput_pair { %% deallocate vp L L L +%! deallocate post vop_deallocate_post vop_deallocate { IN struct vnode *vp; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index c6a03edacff0..3ed469bdce6d 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -918,9 +918,12 @@ int dead_read(struct vop_read_args *ap); int dead_write(struct vop_write_args *ap); /* These are called from within the actual VOPS. */ +void vop_allocate_post(void *a, int rc); +void vop_copy_file_range_post(void *ap, int rc); void vop_close_post(void *a, int rc); void vop_create_pre(void *a); void vop_create_post(void *a, int rc); +void vop_deallocate_post(void *a, int rc); void vop_whiteout_pre(void *a); void vop_whiteout_post(void *a, int rc); void vop_deleteextattr_pre(void *a); @@ -1028,9 +1031,12 @@ void vop_rename_fail(struct vop_rename_args *ap); #define VOP_WRITE_POST(ap, ret) \ noffset = (ap)->a_uio->uio_offset; \ - if (noffset > ooffset && !VN_KNLIST_EMPTY((ap)->a_vp)) { \ - VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE \ - | (noffset > osize ? NOTE_EXTEND : 0)); \ + if (noffset > ooffset) { \ + if (VN_KNLIST_EMPTY((ap)->a_vp)) { \ + VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE | \ + (noffset > osize ? NOTE_EXTEND : 0)); \ + } \ + INOTIFY((ap)->a_vp, IN_MODIFY); \ } #define VOP_LOCK(vp, flags) VOP_LOCK1(vp, flags, __FILE__, __LINE__) From nobody Fri Jul 4 14:55:55 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC0200qz61HNJ; Fri, 04 Jul 2025 14:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC009rGz42xw; Fri, 04 Jul 2025 14:55:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1cWHIB02MLVpcXnmZDLFHeR1UpWgzO0c5SAhhndMIZU=; b=XFO4+x2usJy0ecqTkGfagYwlLRXKaIXKSZ7yybzCmUkHyyWvFVysUt9Wx1+9kY/6zGUwfR GlwVrvB1xFbBETCJhU4si+fB2zCT5u35i4hQdvyQN+6iDYsYwrTZrPpDQ1qHy7QuV7evl4 rtSMH6LnzomNx/izqYyNZr7t4aRdjq/tolCZ050rUu56kp2XwNPa2ThyraDbHecNpDrLCN g9rgTrXI+gkV8HGSvtoSb6NRChAXrD0+ytlqa4YBbf26Dbu32yNf4nY/W7or1Uj/COp2jR ssKBUPOT1oCNk3ibDcVFq/KVME6lRxvr3VS4dR/A3iJV4DYkKhFiAwumLUcoRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1cWHIB02MLVpcXnmZDLFHeR1UpWgzO0c5SAhhndMIZU=; b=IMqMlTA5+cKC/AlRiboH+toybevyHjiC5PQZVAeU+Qdhs5fIHutBdks5UNmEeeddeTK425 dKgiLlKUN1NNDviDfwmmvbq2GAklzQMXtMtzyKxmy3d+XG/xqNVaz7V9kSuPfGEw1BWpzq zon6U+hTcJQ5gyRPEElTsLPkN11VhpuIw2rbGRxaOs3oCpiFpL0gofDl8fjL6JG+SJr6nt omMEtzxaiMPRFEMYcXfxBXqDEn60MUPOUSaqm6WrAKzEnllAGFkmIZeR+nJmdQamYTSK3U 6ECB5HzBWyNLuE52rzg6klDpIGpUtLC/Ry31ypV94fFjhxmJJ+EbO43d7Bssbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640956; a=rsa-sha256; cv=none; b=hyZlkPD7j9Cdr4kLei/BzUHy9uhPlGO+dB1dGKnCiB78q2aEifL2OqZ9BmuBlwfp7PnNRY pFeifev3V+KgCdtb3Y3RVVHHIRc8NtWs168ruR2m9uBkuER4MCliQDfCxE0WKqhXqhgBWU EJl26hjSo8zHBZRmmzpAoViQX6nP5NYlJZXg9KT0witQkqqqvZmowCbaQd2OYydBOgwAtT N5iu/sZesPQWVm+msk0htIhe3uxx1IfJQkmMFN2Hrcbt7/MCOwpuGwyKeRXKcMJTIIOjPO 06Osr7K3SYqwBs6K4fWZ4PLYzChbmGgjWHOGWFFVzsMib6QBp3rH+jg2F3KE/A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcBz6rzszvgB; Fri, 04 Jul 2025 14:55:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564EttTE073537; Fri, 4 Jul 2025 14:55:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564EttrZ073534; Fri, 4 Jul 2025 14:55:55 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:55:55 GMT Message-Id: <202507041455.564EttrZ073534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: cf65b5e43d7c - main - libsys: Add inotify support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf65b5e43d7cdc67a932d089312c5a54342167db Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cf65b5e43d7cdc67a932d089312c5a54342167db commit cf65b5e43d7cdc67a932d089312c5a54342167db Author: Mark Johnston AuthorDate: 2025-07-03 20:09:19 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 libsys: Add inotify support Include the two new syscalls in the symbol map. Reviewed by: kib MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315 --- lib/libsys/Symbol.sys.map | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map index 7fac1ed6160d..45e0160100af 100644 --- a/lib/libsys/Symbol.sys.map +++ b/lib/libsys/Symbol.sys.map @@ -381,6 +381,8 @@ FBSD_1.8 { exterrctl; fchroot; getrlimitusage; + inotify_add_watch_at; + inotify_rm_watch; kcmp; setcred; }; From nobody Fri Jul 4 14:55:58 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC32gQwz61HJ8; Fri, 04 Jul 2025 14:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC22cqqz435K; Fri, 04 Jul 2025 14:55:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7KMD5wHFlqBr/RtBAPyBRFi78opqOHmJLHsWx5v8WE0=; b=H2h2DFK2lVEHzIVt6FfHcKpeQztuHp8fkh+u7ecebmhY5F1kj7n8gKIX4+j9Kw3ZJobNr1 QtF5KnnZEhRPVJJxlMMOHB+b1mxEUsZnyfMCW9vNIopTHi5cHYjR4yUJMuSbvFlXzHVwXP hdGXijSPYmeR7fT25K5EaZCw7KfBQCKluT4snPgs+O0XF91ZZk3i91AheT2fHYUvU1xNix T0AIjTH+ooql5VuBl9EO0mQdlFwjxHjPnwBEg0112Dr/lRX0wm1N5Qy/SLsAVl1iFZiQSV It4LZ9TLv4jkTbqJBaq62w16QZqCI1UTDuoujyWggjKmbWo5Dg8w6OROEtFIrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7KMD5wHFlqBr/RtBAPyBRFi78opqOHmJLHsWx5v8WE0=; b=e3R5tb68MpBbb3mInZGMyTNNNLh104WsmzsUwz0Wvu9KwtPJdCisLplXbtHKg1SWDC0PU5 18Tg/HPZwUyvO/gK+Tixl1vTY9ZFYoAXpY+oTvlLEemGxv2HfJN/EXiX6bLyoRKlVxs6+j U/t2uT30G2arV5RadseZTsRHZW0FLZlv580sbntK5xdUuKrgKwDvdsz3IOUMPusqUdRA6X ueBSAXI6dnLAOIOW413+a/bOvUWv9EXonrgVBYwsf8GzGDJ3tOVTZuyfKaHoURD5Q37HTF NOrNK273bVx7KFMEtasrJzV8L/Po8i4cuoeW1X4zAiWxz38bweB+LaoIbSy6fw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640958; a=rsa-sha256; cv=none; b=h4HDbSMhCVwYvSd50objXBPTqR4bLKNHaRgcqlgiMAMhVQu5JGoCy0Fonw77uu+RWLVf8f P51n/VAOSH3nCDunO27nrqOYYly/d4zOMb7C5T6tkr2CaC3FDSH3MqpDpHt7WpXCU+WBLB 3JveT9tupcEXHX0VGtqCFKspWT6Nr0FXdqnxzv+gzhibaGtxade3b9Lt/Mk5FeuGJ1vCVy c1cSffVeHBHjV2sa5ajOQIU2UITrPdWZ77sWSTLereYtxsZVkrxROEOT5xRmhk1f/27Wom Rp+kn5Ra4xXxNlpmsYR8kYYE/2E3u5ilOS7om9TKgxDlniWzNsA68xmosmH40A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC21DGbzvQ5; Fri, 04 Jul 2025 14:55:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Etwoq073613; Fri, 4 Jul 2025 14:55:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564EtwLT073609; Fri, 4 Jul 2025 14:55:58 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:55:58 GMT Message-Id: <202507041455.564EtwLT073609@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b79bd43f9ab3 - main - libsysdecode: Add support for decoding inotify syscall flags List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b79bd43f9ab3bf0dfd4744dee406782f0329134a Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b79bd43f9ab3bf0dfd4744dee406782f0329134a commit b79bd43f9ab3bf0dfd4744dee406782f0329134a Author: Mark Johnston AuthorDate: 2025-07-03 19:52:31 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 libsysdecode: Add support for decoding inotify syscall flags MFC after: 3 months Sponsored by: Klara, Inc. --- lib/libsysdecode/Makefile | 1 + lib/libsysdecode/flags.c | 9 ++++++++- lib/libsysdecode/mktables | 1 + lib/libsysdecode/sysdecode.h | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile index b01877bb8bb8..ca020552a6e9 100644 --- a/lib/libsysdecode/Makefile +++ b/lib/libsysdecode/Makefile @@ -84,6 +84,7 @@ MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \ sysdecode_mask.3 sysdecode_fileflags.3 \ sysdecode_mask.3 sysdecode_filemode.3 \ sysdecode_mask.3 sysdecode_flock_operation.3 \ + sysdecode_mask.3 sysdecode_inotifyflags.3 \ sysdecode_mask.3 sysdecode_mlockall_flags.3 \ sysdecode_mask.3 sysdecode_mmap_flags.3 \ sysdecode_mask.3 sysdecode_mmap_prot.3 \ diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c index 32829d35dbe0..dc09c5747968 100644 --- a/lib/libsysdecode/flags.c +++ b/lib/libsysdecode/flags.c @@ -23,7 +23,6 @@ * SUCH DAMAGE. */ -#include #define L2CAP_SOCKET_CHECKED #include @@ -31,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -351,6 +351,13 @@ sysdecode_getrusage_who(int who) return (lookup_value(rusage, who)); } +bool +sysdecode_inotifyflags(FILE *fp, int flag, int *rem) +{ + + return (print_mask_int(fp, inotifyflags, flag, rem)); +} + static struct name_table kevent_user_ffctrl[] = { X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY) XEND diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 5d7be2aad3c8..6b4f79402660 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -98,6 +98,7 @@ gen_table "extattrns" "EXTATTR_NAMESPACE_[A-Z]+[[:space:]]+0x[0-9]+" "sys/ gen_table "fadvisebehav" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h" gen_table "openflags" "O_[A-Z]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/fcntl.h" "O_RDONLY|O_RDWR|O_WRONLY" gen_table "flockops" "LOCK_[A-Z]+[[:space:]]+0x[0-9]+" "sys/fcntl.h" +gen_table "inotifyflags" "IN_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/inotify.h" "IN_CLOEXEC|IN_NONBLOCK" gen_table "kldsymcmd" "KLDSYM_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" gen_table "kldunloadfflags" "LINKER_UNLOAD_[A-Z]+[[:space:]]+[0-9]+" "sys/linker.h" gen_table "lio_listiomodes" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h" diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h index 8dc0bbea6f0d..c95d7f71379b 100644 --- a/lib/libsysdecode/sysdecode.h +++ b/lib/libsysdecode/sysdecode.h @@ -61,6 +61,7 @@ const char *sysdecode_getfsstat_mode(int _mode); const char *sysdecode_getrusage_who(int _who); const char *sysdecode_idtype(int _idtype); const char *sysdecode_ioctlname(unsigned long _val); +bool sysdecode_inotifyflags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_ipproto(int _protocol); void sysdecode_kevent_fflags(FILE *_fp, short _filter, int _fflags, int _base); From nobody Fri Jul 4 14:55:59 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC41FHsz61HCb; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC32fB4z435X; Fri, 04 Jul 2025 14:55:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I8CZItDqtGDzL8/A6OFsnRctUJx5hG4d7//5RU87ifU=; b=xDJgBwU3I3G4Le4gDpod3Jbv8EwZ/Kz13DBpQV6En14Xp4wxrA6wF4Q6PaVEIeZcfBfGWx TXjzTJ1Vc22v3a5QV3au1QqKH/9BD9k01r1slzSgh/crTkY89CifZMHxJwK4sU3aoMhTgE phzG3903uyTnNIvkDZxbAxUhnhHtN139qZZkqR+WPsykswG/IIH6UxVpfUwbnoj6P0Z9LP ns7szKBjY3GG9cA2EubL6fUdIhUnw8siLU5wgIavSwEDLYcg7fI40EKlOoQhwmh++ZfDr9 On//hMWBhoHB06QGT96IvJCHPQ/80E0OzsgIVUNglIQU9lrg4gG498bkYX7f3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I8CZItDqtGDzL8/A6OFsnRctUJx5hG4d7//5RU87ifU=; b=gAAAtKUY625RrFoztzi6NraCuntcLjB9WbFk07gNNIKnobM01p22cDhLSiWKF7LBSXY28v M1VKaDd87ysYLs7661Q9Sv3lByr3Tx4LCoP9s0+R0Ufnh0+AgPEiYyVixUgAfY4kYSHOAc pVwCcSm9nKq2+3ZWVZCnZNYyFzaEP5x7mwAOXxNACjRs7xOUlFgcRIMfDwyHyOcMrkQmmV VlXBmEAjoHbii3t2Nx9ldXHPqnDvv47uTZTdi/OXcQJVzQJIbszt3X66x0tZgsaG3GbVo6 j3uo8rRMlLNxp8BtioHK1MN6ldEAYp80+DSYS8OiJRyVJMECZVObgnZoUCPJPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640959; a=rsa-sha256; cv=none; b=d66WUqU22wfsJM7AR9ERZ1CHHXxRWd2l5DNY7DsEQLz5NG1c0/S7UKIoMc6IXyop9t8O6M 5rfBADlB8hjp7WpyXYutt6FeEKFqhdAZGG7GwVYgfTtTFunGvdXTsa8Pi/s/cZjJyAI43O RBaYldxd3x5Bfuj4DrjeoKMG3A6Z0TT42UlVPvl1UgsrYdgZgVxViOvB55yZ3AxfgINPqN x7DWGUNenf5Cpl8Ty2Ko8lHJ83xo4bq1Ca7ZMXIxA7qgzmiF36YQT/c4asYbFmshz0otNZ jUbflZ3OD8Sg0T58G+xLUwXhWc8pm/TZ6FAa4w1PCnnNi1B/BrT46eMFwsdPfw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC320cYzvgC; Fri, 04 Jul 2025 14:55:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564EtxIs073649; Fri, 4 Jul 2025 14:55:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564EtxeG073646; Fri, 4 Jul 2025 14:55:59 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:55:59 GMT Message-Id: <202507041455.564EtxeG073646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4d08e7815d6c - main - truss: Add a decoder for inotify_add_watch_at(2) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d08e7815d6c71c620f19a8abdf0caa26f9c5c57 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4d08e7815d6c71c620f19a8abdf0caa26f9c5c57 commit 4d08e7815d6c71c620f19a8abdf0caa26f9c5c57 Author: Mark Johnston AuthorDate: 2025-07-03 19:52:56 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 truss: Add a decoder for inotify_add_watch_at(2) MFC after: 3 months Sponsored by: Klara, Inc. --- usr.bin/truss/syscall.h | 1 + usr.bin/truss/syscalls.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index d79ef882cff0..47d973326dfb 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -99,6 +99,7 @@ enum Argtype { Getfsstatmode, Idtype, Ioctl, + Inotifyflags, Itimerwhich, Kldsymcmd, Kldunloadflags, diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 47d6aef8f6ff..656d642e1f19 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. */ -#include /* * This file has routines used to print out system calls and their * arguments. @@ -316,6 +315,9 @@ static const struct syscall_decode decoded_syscalls[] = { { Ptr | OUT, 3 }, { Ptr | OUT, 4 } } }, { .name = "gettimeofday", .ret_type = 1, .nargs = 2, .args = { { Timeval | OUT, 0 }, { Ptr, 1 } } }, + { .name = "inotify_add_watch_at", .ret_type = 1, .nargs = 4, + .args = { { Int, 0 }, { Atfd, 1 }, { Name | IN, 2 }, + { Inotifyflags, 3 } } }, { .name = "ioctl", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Ioctl, 1 }, { Ptr, 2 } } }, { .name = "kevent", .ret_type = 1, .nargs = 6, @@ -2447,6 +2449,9 @@ print_arg(struct syscall_arg *sc, syscallarg_t *args, syscallarg_t *retval, print_integer_arg(sysdecode_getfsstat_mode, fp, args[sc->offset]); break; + case Inotifyflags: + print_mask_arg(sysdecode_inotifyflags, fp, args[sc->offset]); + break; case Itimerwhich: print_integer_arg(sysdecode_itimer, fp, args[sc->offset]); break; From nobody Fri Jul 4 14:56:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC46Wv4z61HLb; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC42zzZz43HB; Fri, 04 Jul 2025 14:56:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2zYfTmJ5PizNBUHIMbQ/1B/Ap8Ovr7+9KWG7mFHFqIY=; b=n64dZreZomRNBBoE/VN+pnh/WQzOf8BqvsQJ9jgUZsWWPEuyAqzY/3gcUXTvIpx5Yhqbt3 zYra/hA/yJj/N5wVGHRpE4CmA6Un4VOF65jWfAblISrEYDsr3ebqCWkV99vT8dJNNOe79H KTbrYZ5CdkKnTRA58fbeqMPQiOvMMD2/i/d+5I62q2I/pds8ug2NN2tYi65pTnDnUKB60b 0ZyAqRlbKtcmRecyCeZlqMzbPS4jNtruq3HmhIctwWN6ZUFSm4VjLHIMv9G1VZuTkpxs7S qAO3cvlSrhn+lOyCFNpZGzeKl2xooSnVeWdTYpWI+rrnGvpZhx5YoRvTOa7nuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2zYfTmJ5PizNBUHIMbQ/1B/Ap8Ovr7+9KWG7mFHFqIY=; b=nfCjaFbNycKEKmG/lQRj7Hp+kAh8NBdhUmvC7kfTvpdYiUDF+0T3PZlh7I0eUwTwvqk8mW CK4VHeeQgHt6yACeTxnAy7+Fj6c/rjfy3kxEZ99p88Mjb+yghf3mVoq8oiPRLKTEaBabM1 BaVyiT8PMiBjFQ2TSpxQlXxBUXowoBAW7hvtQlav7lL1zVWczaKZa1Lqf4NmnZsWjFkpVz 01Lre45ffeLhMTCedXDdULguUdhIh03Cli2bJuF9GMZMP88PJ+SS10nazfS8SOID8trifb Y0rSraRnBQRsf40wGEVDimnQqtJ/BwnaUlB68loMak5Nm+Zb/8u7/lf0fLOltg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640960; a=rsa-sha256; cv=none; b=m8NlOR4zpWWifmSaa7yQJtgDpRz8Wf7e6kxjvpgJ/SDhLSVbuX97oVJgrvbyse+mLZJ6ys EUck2HbEcp6/4IJhN1A05+imUgMCp9H7+7vp4lWBz6UofRtVnyxZvW6NpXBjUli0o0Wbw5 L9xPBjLKrHmZlib2JoztD1RpvPTb+LqkZaeEUmJVYNim3rCbpvhy4N/qW2rWjFuLRvd+ft UcuFX/oEOsuAxJeDjkqhSF+PaVrHA/5h+0gHUbTQshykzu3+rCBHC6xtbPeyeMFWIIi9ll i/TrZu2ffmiORs2BUOsdh/YnV68KRH7/2tWnmSPastpThuUnDy8lkwnV5jCmrg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC42blzzvjf; Fri, 04 Jul 2025 14:56:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Eu0Ho073690; Fri, 4 Jul 2025 14:56:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Eu0Vk073687; Fri, 4 Jul 2025 14:56:00 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:56:00 GMT Message-Id: <202507041456.564Eu0Vk073687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e02d4fab5453 - main - kdump: Add support for decoding inotify events List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e02d4fab54539a5d127c12e9e9f8b0ddd2a1cafa Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e02d4fab54539a5d127c12e9e9f8b0ddd2a1cafa commit e02d4fab54539a5d127c12e9e9f8b0ddd2a1cafa Author: Mark Johnston AuthorDate: 2025-07-03 19:53:30 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 kdump: Add support for decoding inotify events These are emitted when reading from an inotify descriptor. MFC after: 3 months Sponsored by: Klara, Inc. --- usr.bin/kdump/kdump.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 9cc22d382de5..17ed43b55c5a 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +106,7 @@ static void ktrcsw(struct ktr_csw *); static void ktrcsw_old(struct ktr_csw_old *); static void ktruser(int, void *); static void ktrcaprights(cap_rights_t *); +static void ktrinotify(struct inotify_event *); static void ktritimerval(struct itimerval *it); static void ktrsockaddr(struct sockaddr *); static void ktrsplice(struct splice *); @@ -1860,6 +1862,14 @@ ktrtimeval(struct timeval *tv) printf("{%ld, %ld}", (long)tv->tv_sec, tv->tv_usec); } +static void +ktrinotify(struct inotify_event *ev) +{ + printf( + "inotify { .wd = %d, .mask = %#x, .cookie = %u, .len = %u, .name = %s }\n", + ev->wd, ev->mask, ev->cookie, ev->len, ev->name); +} + static void ktritimerval(struct itimerval *it) { @@ -2128,6 +2138,17 @@ ktrstruct(char *buf, size_t buflen) goto invalid; memcpy(&rights, data, datalen); ktrcaprights(&rights); + } else if (strcmp(name, "inotify") == 0) { + struct inotify_event *ev; + + if (datalen < sizeof(struct inotify_event) || + datalen > sizeof(struct inotify_event) + NAME_MAX + 1) + goto invalid; + ev = malloc(datalen); + if (ev == NULL) + err(1, "malloc"); + memcpy(ev, data, datalen); + ktrinotify(ev); } else if (strcmp(name, "itimerval") == 0) { if (datalen != sizeof(struct itimerval)) goto invalid; From nobody Fri Jul 4 14:56:02 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC66nK7z61HLc; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC63xfRz43MK; Fri, 04 Jul 2025 14:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NM9yfpuV+cvWFKRULmv/+8wggBrOjLFP8iXoYcQGZ/M=; b=PBQK8kwNgSE5Rga4cjfL+Pmmj3JmsKuorWhama68NOKwYzqMtOnexh6u3PKv6hFk9OrEnX mWEuNJz3UMu8GPAo/PFVddfC9DyHs73x6URnfNUx6sIETFc74h9Ig2cbuUVmBWMds4kD6F g6p+/bbBl8JPJUFuSvnCYVBRoXoiFJvrSsLkX7DWX2lr7+Oik4zy+M1qCEQsAKSuCSnSou qZyqM/XT1FNysdyPJSkaa+cVhoa7/axhoGTknETHDVkwaCg1WpdCeF22Fh6TIUUtwJ0Lmh hXT5tpBD82BH7vbIvVIYPAl3UwY1hk7bSpHeHKbZE/FbvtmqrDK7STkwX5+acQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NM9yfpuV+cvWFKRULmv/+8wggBrOjLFP8iXoYcQGZ/M=; b=OcNjOudPVJstn8w+gr6VPJz7J360AeMpA4Xdpdopp4cYJNbenGAbRXLXWrDCRpQv6+prx7 msthQm/FWm10TvvqYxkhc4meCGkyPQSxaIPC5rGpog5rS/zSS8+mci/OVdfrH53WRoclPD 8x/1n8RHfYuHSdBnoYooLMG3SwsUpM/fed4mXvoNzVuNs9PhUAyx3BNhkGMlPmf4i7uLE+ NUj3P4epyhm8psg4npRHvL1jxrUw1qesk9FkabuUn5+90/ymk4w4u1hrgsf4mGZhAsACPq qqErb6rK1GfVaAY+tkD0Z10Jzcy3DjriJRe1gH2SRj3osT69AE+lMEncupYXZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640962; a=rsa-sha256; cv=none; b=Z4h70mm8D+cKnf207Db+cw8ZVbSmjgGNFOrMac+POlTvRCsnr4gtRz86E7X8stBdhcoPeQ v/aWmFqUjehOuyWXb4344ZMWXYo9WTkz3xNRogz8i2BRSRP+UXpzOXYLCCRcOYdcvtPaef op7R4aG/MOjgiQyLlHMEF1iRl5nGK5KdSwLtMP7o4yIkdr5exK84o0+Y88OW8y+mQQ3ZeI QlUt1bXl6HH1dXpwfumhHv2KG4NxobSg687NuPxJLDix2kfGE2Jv/hHOUL49Mazpu3jRZd V/URKgFPYnyvf2y3KrVcZNBURNokdU1ChBsxujGn06hR/WFI1svs92w+F3ntqQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC637FTzvXP; Fri, 04 Jul 2025 14:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Eu27p073760; Fri, 4 Jul 2025 14:56:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Eu2oL073757; Fri, 4 Jul 2025 14:56:02 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:56:02 GMT Message-Id: <202507041456.564Eu2oL073757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 739fc14938d5 - main - tests: Add some regression tests for inotify List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 739fc14938d58a2ed34c0663bf1f06c83eada685 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=739fc14938d58a2ed34c0663bf1f06c83eada685 commit 739fc14938d58a2ed34c0663bf1f06c83eada685 Author: Mark Johnston AuthorDate: 2025-07-03 20:00:19 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 tests: Add some regression tests for inotify Reviewed by: kib MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315 --- tests/sys/kern/Makefile | 2 + tests/sys/kern/inotify_test.c | 862 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 864 insertions(+) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index 8cc7beade3f3..26c0013696c7 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -19,6 +19,7 @@ ATF_TESTS_C+= kern_descrip_test TEST_METADATA.kern_descrip_test+= is_exclusive="true" ATF_TESTS_C+= fdgrowtable_test ATF_TESTS_C+= jail_lookup_root +ATF_TESTS_C+= inotify_test ATF_TESTS_C+= kill_zombie .if ${MK_OPENSSL} != "no" ATF_TESTS_C+= ktls_test @@ -85,6 +86,7 @@ LIBADD.sys_getrandom+= c LIBADD.sys_getrandom+= pthread LIBADD.ptrace_test+= pthread LIBADD.unix_seqpacket_test+= pthread +LIBADD.inotify_test+= util LIBADD.kcov+= pthread CFLAGS.ktls_test+= -DOPENSSL_API_COMPAT=0x10100000L LIBADD.ktls_test+= crypto util diff --git a/tests/sys/kern/inotify_test.c b/tests/sys/kern/inotify_test.c new file mode 100644 index 000000000000..ed7cef5d148c --- /dev/null +++ b/tests/sys/kern/inotify_test.c @@ -0,0 +1,862 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Klara, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static const char * +ev2name(int event) +{ + switch (event) { + case IN_ACCESS: + return ("IN_ACCESS"); + case IN_ATTRIB: + return ("IN_ATTRIB"); + case IN_CLOSE_WRITE: + return ("IN_CLOSE_WRITE"); + case IN_CLOSE_NOWRITE: + return ("IN_CLOSE_NOWRITE"); + case IN_CREATE: + return ("IN_CREATE"); + case IN_DELETE: + return ("IN_DELETE"); + case IN_DELETE_SELF: + return ("IN_DELETE_SELF"); + case IN_MODIFY: + return ("IN_MODIFY"); + case IN_MOVE_SELF: + return ("IN_MOVE_SELF"); + case IN_MOVED_FROM: + return ("IN_MOVED_FROM"); + case IN_MOVED_TO: + return ("IN_MOVED_TO"); + case IN_OPEN: + return ("IN_OPEN"); + default: + return (NULL); + } +} + +static void +close_checked(int fd) +{ + ATF_REQUIRE(close(fd) == 0); +} + +/* + * Make sure that no other events are pending, and close the inotify descriptor. + */ +static void +close_inotify(int fd) +{ + int n; + + ATF_REQUIRE(ioctl(fd, FIONREAD, &n) == 0); + ATF_REQUIRE(n == 0); + close_checked(fd); +} + +static uint32_t +consume_event_cookie(int ifd, int wd, int event, int flags, const char *name) +{ + struct inotify_event *ev; + size_t evsz, namelen; + ssize_t n; + uint32_t cookie; + + /* Only read one record. */ + namelen = name == NULL ? 0 : strlen(name); + evsz = sizeof(*ev) + _IN_NAMESIZE(namelen); + ev = malloc(evsz); + ATF_REQUIRE(ev != NULL); + + n = read(ifd, ev, evsz); + ATF_REQUIRE_MSG(n >= 0, "failed to read event %s", ev2name(event)); + ATF_REQUIRE((size_t)n >= sizeof(*ev)); + ATF_REQUIRE((size_t)n == sizeof(*ev) + ev->len); + ATF_REQUIRE((size_t)n == evsz); + + ATF_REQUIRE_MSG((ev->mask & IN_ALL_EVENTS) == event, + "expected event %#x, got %#x", event, ev->mask); + ATF_REQUIRE_MSG((ev->mask & _IN_ALL_RETFLAGS) == flags, + "expected flags %#x, got %#x", flags, ev->mask); + ATF_REQUIRE_MSG(ev->wd == wd, + "expected wd %d, got %d", wd, ev->wd); + ATF_REQUIRE_MSG(name == NULL || strcmp(name, ev->name) == 0, + "expected name '%s', got '%s'", name, ev->name); + cookie = ev->cookie; + if ((ev->mask & (IN_MOVED_FROM | IN_MOVED_TO)) == 0) + ATF_REQUIRE(cookie == 0); + free(ev); + return (cookie); +} + +/* + * Read an event from the inotify file descriptor and check that it + * matches the expected values. + */ +static void +consume_event(int ifd, int wd, int event, int flags, const char *name) +{ + (void)consume_event_cookie(ifd, wd, event, flags, name); +} + +static int +inotify(int flags) +{ + int ifd; + + ifd = inotify_init1(flags); + ATF_REQUIRE(ifd != -1); + return (ifd); +} + +static void +mount_nullfs(char *dir, char *src) +{ + struct iovec *iov; + char errmsg[1024]; + int error, iovlen; + + iov = NULL; + iovlen = 0; + + build_iovec(&iov, &iovlen, "fstype", "nullfs", (size_t)-1); + build_iovec(&iov, &iovlen, "fspath", dir, (size_t)-1); + build_iovec(&iov, &iovlen, "target", src, (size_t)-1); + build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); + + errmsg[0] = '\0'; + error = nmount(iov, iovlen, 0); + ATF_REQUIRE_MSG(error == 0, + "mount nullfs %s %s: %s", src, dir, + errmsg[0] == '\0' ? strerror(errno) : errmsg); + + free_iovec(&iov, &iovlen); +} + +static void +mount_tmpfs(const char *dir) +{ + struct iovec *iov; + char errmsg[1024]; + int error, iovlen; + + iov = NULL; + iovlen = 0; + + build_iovec(&iov, &iovlen, "fstype", "tmpfs", (size_t)-1); + build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir), + (size_t)-1); + build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); + + errmsg[0] = '\0'; + error = nmount(iov, iovlen, 0); + ATF_REQUIRE_MSG(error == 0, + "mount tmpfs %s: %s", dir, + errmsg[0] == '\0' ? strerror(errno) : errmsg); + + free_iovec(&iov, &iovlen); +} + +static int +watch_file(int ifd, int events, char *path) +{ + int fd, wd; + + strncpy(path, "test.XXXXXX", PATH_MAX); + fd = mkstemp(path); + ATF_REQUIRE(fd != -1); + close_checked(fd); + + wd = inotify_add_watch(ifd, path, events); + ATF_REQUIRE(wd != -1); + + return (wd); +} + +static int +watch_dir(int ifd, int events, char *path) +{ + char *p; + int wd; + + strlcpy(path, "test.XXXXXX", PATH_MAX); + p = mkdtemp(path); + ATF_REQUIRE(p == path); + + wd = inotify_add_watch(ifd, path, events); + ATF_REQUIRE(wd != -1); + + return (wd); +} + +/* + * Verify that Capsicum restrictions are applied as expected. + */ +ATF_TC_WITHOUT_HEAD(inotify_capsicum); +ATF_TC_BODY(inotify_capsicum, tc) +{ + int error, dfd, ifd, wd; + + ifd = inotify(IN_NONBLOCK); + ATF_REQUIRE(ifd != -1); + + dfd = open(".", O_RDONLY | O_DIRECTORY); + ATF_REQUIRE(dfd != -1); + + error = mkdirat(dfd, "testdir", 0755); + ATF_REQUIRE(error == 0); + + error = cap_enter(); + ATF_REQUIRE(error == 0); + + /* + * Plain inotify_add_watch() is disallowed. + */ + wd = inotify_add_watch(ifd, ".", IN_DELETE_SELF); + ATF_REQUIRE_ERRNO(ECAPMODE, wd == -1); + wd = inotify_add_watch_at(ifd, dfd, "testdir", IN_DELETE_SELF); + ATF_REQUIRE(wd >= 0); + + /* + * Generate a record and consume it. + */ + error = unlinkat(dfd, "testdir", AT_REMOVEDIR); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_DELETE_SELF, IN_ISDIR, NULL); + consume_event(ifd, wd, 0, IN_IGNORED, NULL); + + close_checked(dfd); + close_inotify(ifd); +} + +/* + * Make sure that duplicate, back-to-back events are coalesced. + */ +ATF_TC_WITHOUT_HEAD(inotify_coalesce); +ATF_TC_BODY(inotify_coalesce, tc) +{ + char file[PATH_MAX], path[PATH_MAX]; + int fd, fd1, ifd, n, wd; + + ifd = inotify(IN_NONBLOCK); + + /* Create a directory and watch it. */ + wd = watch_dir(ifd, IN_OPEN, path); + /* Create a file in the directory and open it. */ + snprintf(file, sizeof(file), "%s/file", path); + fd = open(file, O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + close_checked(fd); + fd = open(file, O_RDWR); + ATF_REQUIRE(fd != -1); + fd1 = open(file, O_RDONLY); + ATF_REQUIRE(fd1 != -1); + close_checked(fd1); + close_checked(fd); + + consume_event(ifd, wd, IN_OPEN, 0, "file"); + ATF_REQUIRE(ioctl(ifd, FIONREAD, &n) == 0); + ATF_REQUIRE(n == 0); + + close_inotify(ifd); +} + +/* + * Check handling of IN_MASK_CREATE. + */ +ATF_TC_WITHOUT_HEAD(inotify_mask_create); +ATF_TC_BODY(inotify_mask_create, tc) +{ + char path[PATH_MAX]; + int ifd, wd, wd1; + + ifd = inotify(IN_NONBLOCK); + + /* Create a directory and watch it. */ + wd = watch_dir(ifd, IN_CREATE, path); + /* Updating the watch with IN_MASK_CREATE should result in an error. */ + wd1 = inotify_add_watch(ifd, path, IN_MODIFY | IN_MASK_CREATE); + ATF_REQUIRE_ERRNO(EEXIST, wd1 == -1); + /* It's an error to specify IN_MASK_ADD with IN_MASK_CREATE. */ + wd1 = inotify_add_watch(ifd, path, IN_MODIFY | IN_MASK_ADD | + IN_MASK_CREATE); + ATF_REQUIRE_ERRNO(EINVAL, wd1 == -1); + /* Updating the watch without IN_MASK_CREATE should work. */ + wd1 = inotify_add_watch(ifd, path, IN_MODIFY); + ATF_REQUIRE(wd1 != -1); + ATF_REQUIRE_EQ(wd, wd1); + + close_inotify(ifd); +} + +/* + * Make sure that inotify cooperates with nullfs: if a lower vnode is the + * subject of an event, the upper vnode should be notified, and if the upper + * vnode is the subject of an event, the lower vnode should be notified. + */ +ATF_TC_WITH_CLEANUP(inotify_nullfs); +ATF_TC_HEAD(inotify_nullfs, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(inotify_nullfs, tc) +{ + char path[PATH_MAX], *p; + int dfd, error, fd, ifd, mask, wd; + + mask = IN_CREATE | IN_OPEN; + + ifd = inotify(IN_NONBLOCK); + + strlcpy(path, "./test.XXXXXX", sizeof(path)); + p = mkdtemp(path); + ATF_REQUIRE(p == path); + + error = mkdir("./mnt", 0755); + ATF_REQUIRE(error == 0); + + /* Mount the testdir onto ./mnt. */ + mount_nullfs("./mnt", path); + + wd = inotify_add_watch(ifd, "./mnt", mask); + ATF_REQUIRE(wd != -1); + + /* Create a file in the lower directory and open it. */ + dfd = open(path, O_RDONLY | O_DIRECTORY); + ATF_REQUIRE(dfd != -1); + fd = openat(dfd, "file", O_RDWR | O_CREAT, 0644); + close_checked(fd); + close_checked(dfd); + + /* We should see events via the nullfs mount. */ + consume_event(ifd, wd, IN_OPEN, IN_ISDIR, NULL); + consume_event(ifd, wd, IN_CREATE, 0, "file"); + consume_event(ifd, wd, IN_OPEN, 0, "file"); + + error = inotify_rm_watch(ifd, wd); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, 0, IN_IGNORED, NULL); + + /* Watch the lower directory. */ + wd = inotify_add_watch(ifd, path, mask); + ATF_REQUIRE(wd != -1); + /* ... and create a file in the upper directory and open it. */ + dfd = open("./mnt", O_RDONLY | O_DIRECTORY); + ATF_REQUIRE(dfd != -1); + fd = openat(dfd, "file2", O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + close_checked(fd); + close_checked(dfd); + + /* We should see events via the lower directory. */ + consume_event(ifd, wd, IN_OPEN, IN_ISDIR, NULL); + consume_event(ifd, wd, IN_CREATE, 0, "file2"); + consume_event(ifd, wd, IN_OPEN, 0, "file2"); + + close_inotify(ifd); +} +ATF_TC_CLEANUP(inotify_nullfs, tc) +{ + int error; + + error = unmount("./mnt", 0); + if (error != 0) { + perror("unmount"); + exit(1); + } +} + +/* + * Make sure that exceeding max_events pending events results in an overflow + * event. + */ +ATF_TC_WITHOUT_HEAD(inotify_queue_overflow); +ATF_TC_BODY(inotify_queue_overflow, tc) +{ + char path[PATH_MAX]; + size_t size; + int error, dfd, ifd, max, wd; + + size = sizeof(max); + error = sysctlbyname("vfs.inotify.max_queued_events", &max, &size, NULL, + 0); + ATF_REQUIRE(error == 0); + + ifd = inotify(IN_NONBLOCK); + + /* Create a directory and watch it for file creation events. */ + wd = watch_dir(ifd, IN_CREATE, path); + dfd = open(path, O_DIRECTORY); + ATF_REQUIRE(dfd != -1); + /* Generate max+1 file creation events. */ + for (int i = 0; i < max + 1; i++) { + char name[NAME_MAX]; + int fd; + + (void)snprintf(name, sizeof(name), "file%d", i); + fd = openat(dfd, name, O_CREAT | O_RDWR, 0644); + ATF_REQUIRE(fd != -1); + close_checked(fd); + } + + /* + * Read our events. We should see files 0..max-1 and then an overflow + * event. + */ + for (int i = 0; i < max; i++) { + char name[NAME_MAX]; + + (void)snprintf(name, sizeof(name), "file%d", i); + consume_event(ifd, wd, IN_CREATE, 0, name); + } + + /* Look for an overflow event. */ + consume_event(ifd, -1, 0, IN_Q_OVERFLOW, NULL); + + close_checked(dfd); + close_inotify(ifd); +} + +ATF_TC_WITHOUT_HEAD(inotify_event_access_file); +ATF_TC_BODY(inotify_event_access_file, tc) +{ + char path[PATH_MAX], buf[16]; + off_t nb; + ssize_t n; + int error, fd, fd1, ifd, s[2], wd; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_file(ifd, IN_ACCESS, path); + + fd = open(path, O_RDWR); + n = write(fd, "test", 4); + ATF_REQUIRE(n == 4); + + /* A simple read(2) should generate an access. */ + ATF_REQUIRE(lseek(fd, 0, SEEK_SET) == 0); + n = read(fd, buf, sizeof(buf)); + ATF_REQUIRE(n == 4); + ATF_REQUIRE(memcmp(buf, "test", 4) == 0); + consume_event(ifd, wd, IN_ACCESS, 0, NULL); + + /* copy_file_range(2) should as well. */ + ATF_REQUIRE(lseek(fd, 0, SEEK_SET) == 0); + fd1 = open("sink", O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd1 != -1); + n = copy_file_range(fd, NULL, fd1, NULL, 4, 0); + ATF_REQUIRE(n == 4); + close_checked(fd1); + consume_event(ifd, wd, IN_ACCESS, 0, NULL); + + /* As should sendfile(2). */ + error = socketpair(AF_UNIX, SOCK_STREAM, 0, s); + ATF_REQUIRE(error == 0); + error = sendfile(fd, s[0], 0, 4, NULL, &nb, 0); + ATF_REQUIRE(error == 0); + ATF_REQUIRE(nb == 4); + consume_event(ifd, wd, IN_ACCESS, 0, NULL); + close_checked(s[0]); + close_checked(s[1]); + + close_checked(fd); + + close_inotify(ifd); +} + +ATF_TC_WITHOUT_HEAD(inotify_event_access_dir); +ATF_TC_BODY(inotify_event_access_dir, tc) +{ + char root[PATH_MAX], path[PATH_MAX]; + struct dirent *ent; + DIR *dir; + int error, ifd, wd; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_dir(ifd, IN_ACCESS, root); + snprintf(path, sizeof(path), "%s/dir", root); + error = mkdir(path, 0755); + ATF_REQUIRE(error == 0); + + /* Read an entry and generate an access. */ + dir = opendir(path); + ATF_REQUIRE(dir != NULL); + ent = readdir(dir); + ATF_REQUIRE(ent != NULL); + ATF_REQUIRE(strcmp(ent->d_name, ".") == 0 || + strcmp(ent->d_name, "..") == 0); + ATF_REQUIRE(closedir(dir) == 0); + consume_event(ifd, wd, IN_ACCESS, IN_ISDIR, "dir"); + + /* + * Reading the watched directory should generate an access event. + * This is contrary to Linux's inotify man page, which states that + * IN_ACCESS is only generated for accesses to objects in a watched + * directory. + */ + dir = opendir(root); + ATF_REQUIRE(dir != NULL); + ent = readdir(dir); + ATF_REQUIRE(ent != NULL); + ATF_REQUIRE(strcmp(ent->d_name, ".") == 0 || + strcmp(ent->d_name, "..") == 0); + ATF_REQUIRE(closedir(dir) == 0); + consume_event(ifd, wd, IN_ACCESS, IN_ISDIR, NULL); + + close_inotify(ifd); +} + +ATF_TC_WITHOUT_HEAD(inotify_event_attrib); +ATF_TC_BODY(inotify_event_attrib, tc) +{ + char path[PATH_MAX]; + int error, ifd, fd, wd; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_file(ifd, IN_ATTRIB, path); + + fd = open(path, O_RDWR); + ATF_REQUIRE(fd != -1); + error = fchmod(fd, 0600); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_ATTRIB, 0, NULL); + + error = fchown(fd, getuid(), getgid()); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_ATTRIB, 0, NULL); + + close_checked(fd); + close_inotify(ifd); +} + +ATF_TC_WITHOUT_HEAD(inotify_event_close_nowrite); +ATF_TC_BODY(inotify_event_close_nowrite, tc) +{ + char file[PATH_MAX], file1[PATH_MAX], dir[PATH_MAX]; + int ifd, fd, wd1, wd2; + + ifd = inotify(IN_NONBLOCK); + + wd1 = watch_dir(ifd, IN_CLOSE_NOWRITE, dir); + wd2 = watch_file(ifd, IN_CLOSE_NOWRITE | IN_CLOSE_WRITE, file); + + fd = open(dir, O_DIRECTORY); + ATF_REQUIRE(fd != -1); + close_checked(fd); + consume_event(ifd, wd1, IN_CLOSE_NOWRITE, IN_ISDIR, NULL); + + fd = open(file, O_RDONLY); + ATF_REQUIRE(fd != -1); + close_checked(fd); + consume_event(ifd, wd2, IN_CLOSE_NOWRITE, 0, NULL); + + snprintf(file1, sizeof(file1), "%s/file", dir); + fd = open(file1, O_RDONLY | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + close_checked(fd); + consume_event(ifd, wd1, IN_CLOSE_NOWRITE, 0, "file"); + + close_inotify(ifd); +} + +ATF_TC_WITHOUT_HEAD(inotify_event_close_write); +ATF_TC_BODY(inotify_event_close_write, tc) +{ + char path[PATH_MAX]; + int ifd, fd, wd; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_file(ifd, IN_CLOSE_NOWRITE | IN_CLOSE_WRITE, path); + + fd = open(path, O_RDWR); + ATF_REQUIRE(fd != -1); + close_checked(fd); + consume_event(ifd, wd, IN_CLOSE_WRITE, 0, NULL); + + close_inotify(ifd); +} + +/* Verify that various operations in a directory generate IN_CREATE events. */ +ATF_TC_WITHOUT_HEAD(inotify_event_create); +ATF_TC_BODY(inotify_event_create, tc) +{ + struct sockaddr_un sun; + char path[PATH_MAX], path1[PATH_MAX], root[PATH_MAX]; + ssize_t n; + int error, ifd, ifd1, fd, s, wd, wd1; + char b; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_dir(ifd, IN_CREATE, root); + + /* Regular file. */ + snprintf(path, sizeof(path), "%s/file", root); + fd = open(path, O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + /* + * Make sure we get an event triggered by the fd used to create the + * file. + */ + ifd1 = inotify(IN_NONBLOCK); + wd1 = inotify_add_watch(ifd1, root, IN_MODIFY); + b = 42; + n = write(fd, &b, sizeof(b)); + ATF_REQUIRE(n == sizeof(b)); + close_checked(fd); + consume_event(ifd, wd, IN_CREATE, 0, "file"); + consume_event(ifd1, wd1, IN_MODIFY, 0, "file"); + close_inotify(ifd1); + + /* Hard link. */ + snprintf(path1, sizeof(path1), "%s/link", root); + error = link(path, path1); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_CREATE, 0, "link"); + + /* Directory. */ + snprintf(path, sizeof(path), "%s/dir", root); + error = mkdir(path, 0755); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_CREATE, IN_ISDIR, "dir"); + + /* Symbolic link. */ + snprintf(path1, sizeof(path1), "%s/symlink", root); + error = symlink(path, path1); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_CREATE, 0, "symlink"); + + /* FIFO. */ + snprintf(path, sizeof(path), "%s/fifo", root); + error = mkfifo(path, 0644); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_CREATE, 0, "fifo"); + + /* Binding a socket. */ + s = socket(AF_UNIX, SOCK_STREAM, 0); + memset(&sun, 0, sizeof(sun)); + sun.sun_family = AF_UNIX; + sun.sun_len = sizeof(sun); + snprintf(sun.sun_path, sizeof(sun.sun_path), "%s/socket", root); + error = bind(s, (struct sockaddr *)&sun, sizeof(sun)); + ATF_REQUIRE(error == 0); + close_checked(s); + consume_event(ifd, wd, IN_CREATE, 0, "socket"); + + close_inotify(ifd); +} + +ATF_TC_WITHOUT_HEAD(inotify_event_delete); +ATF_TC_BODY(inotify_event_delete, tc) +{ + char root[PATH_MAX], path[PATH_MAX], file[PATH_MAX]; + int error, fd, ifd, wd, wd2; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_dir(ifd, IN_DELETE | IN_DELETE_SELF, root); + + snprintf(path, sizeof(path), "%s/file", root); + fd = open(path, O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + error = unlink(path); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_DELETE, 0, "file"); + close_checked(fd); + + /* + * Make sure that renaming over a file generates a delete event when and + * only when that file is watched. + */ + fd = open(path, O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + close_checked(fd); + wd2 = inotify_add_watch(ifd, path, IN_DELETE | IN_DELETE_SELF); + ATF_REQUIRE(wd2 != -1); + snprintf(file, sizeof(file), "%s/file2", root); + fd = open(file, O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + close_checked(fd); + error = rename(file, path); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd2, IN_DELETE_SELF, 0, NULL); + consume_event(ifd, wd2, 0, IN_IGNORED, NULL); + + error = unlink(path); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_DELETE, 0, "file"); + error = rmdir(root); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd, IN_DELETE_SELF, IN_ISDIR, NULL); + consume_event(ifd, wd, 0, IN_IGNORED, NULL); + + close_inotify(ifd); +} + +ATF_TC_WITHOUT_HEAD(inotify_event_move); +ATF_TC_BODY(inotify_event_move, tc) +{ + char dir1[PATH_MAX], dir2[PATH_MAX], path1[PATH_MAX], path2[PATH_MAX]; + char path3[PATH_MAX]; + int error, ifd, fd, wd1, wd2, wd3; + uint32_t cookie1, cookie2; + + ifd = inotify(IN_NONBLOCK); + + wd1 = watch_dir(ifd, IN_MOVE | IN_MOVE_SELF, dir1); + wd2 = watch_dir(ifd, IN_MOVE | IN_MOVE_SELF, dir2); + + snprintf(path1, sizeof(path1), "%s/file", dir1); + fd = open(path1, O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + close_checked(fd); + snprintf(path2, sizeof(path2), "%s/file2", dir2); + error = rename(path1, path2); + ATF_REQUIRE(error == 0); + cookie1 = consume_event_cookie(ifd, wd1, IN_MOVED_FROM, 0, "file"); + cookie2 = consume_event_cookie(ifd, wd2, IN_MOVED_TO, 0, "file2"); + ATF_REQUIRE_MSG(cookie1 == cookie2, + "expected cookie %u, got %u", cookie1, cookie2); + + snprintf(path2, sizeof(path2), "%s/dir", dir2); + error = rename(dir1, path2); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd1, IN_MOVE_SELF, IN_ISDIR, NULL); + consume_event(ifd, wd2, IN_MOVED_TO, IN_ISDIR, "dir"); + + wd3 = watch_file(ifd, IN_MOVE_SELF, path3); + error = rename(path3, "foo"); + ATF_REQUIRE(error == 0); + consume_event(ifd, wd3, IN_MOVE_SELF, 0, NULL); + + close_inotify(ifd); +} + +ATF_TC_WITHOUT_HEAD(inotify_event_open); +ATF_TC_BODY(inotify_event_open, tc) +{ + char root[PATH_MAX], path[PATH_MAX]; + int error, ifd, fd, wd; + + ifd = inotify(IN_NONBLOCK); + + wd = watch_dir(ifd, IN_OPEN, root); + + snprintf(path, sizeof(path), "%s/file", root); + fd = open(path, O_RDWR | O_CREAT, 0644); + ATF_REQUIRE(fd != -1); + close_checked(fd); + consume_event(ifd, wd, IN_OPEN, 0, "file"); + + fd = open(path, O_PATH); + ATF_REQUIRE(fd != -1); + close_checked(fd); + consume_event(ifd, wd, IN_OPEN, 0, "file"); + + fd = open(root, O_DIRECTORY); + ATF_REQUIRE(fd != -1); + close_checked(fd); + consume_event(ifd, wd, IN_OPEN, IN_ISDIR, NULL); + + snprintf(path, sizeof(path), "%s/fifo", root); + error = mkfifo(path, 0644); + ATF_REQUIRE(error == 0); + fd = open(path, O_RDWR); + ATF_REQUIRE(fd != -1); + close_checked(fd); + consume_event(ifd, wd, IN_OPEN, 0, "fifo"); + + close_inotify(ifd); +} + +ATF_TC_WITH_CLEANUP(inotify_event_unmount); +ATF_TC_HEAD(inotify_event_unmount, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(inotify_event_unmount, tc) +{ + int error, fd, ifd, wd; + + ifd = inotify(IN_NONBLOCK); + + error = mkdir("./root", 0755); + ATF_REQUIRE(error == 0); + + mount_tmpfs("./root"); + + error = mkdir("./root/dir", 0755); + ATF_REQUIRE(error == 0); + wd = inotify_add_watch(ifd, "./root/dir", IN_OPEN); + ATF_REQUIRE(wd >= 0); + + fd = open("./root/dir", O_RDONLY | O_DIRECTORY); + ATF_REQUIRE(fd != -1); + consume_event(ifd, wd, IN_OPEN, IN_ISDIR, NULL); + close_checked(fd); + + /* A regular unmount should fail, as inotify holds a vnode reference. */ + error = unmount("./root", 0); + ATF_REQUIRE_ERRNO(EBUSY, error == -1); + error = unmount("./root", MNT_FORCE); + ATF_REQUIRE_MSG(error == 0, + "unmounting ./root failed: %s", strerror(errno)); + + consume_event(ifd, wd, 0, IN_UNMOUNT, NULL); + consume_event(ifd, wd, 0, IN_IGNORED, NULL); + + close_inotify(ifd); +} +ATF_TC_CLEANUP(inotify_event_unmount, tc) +{ + (void)unmount("./root", MNT_FORCE); +} + +ATF_TP_ADD_TCS(tp) +{ + /* Tests for the inotify syscalls. */ + ATF_TP_ADD_TC(tp, inotify_capsicum); + ATF_TP_ADD_TC(tp, inotify_coalesce); + ATF_TP_ADD_TC(tp, inotify_mask_create); + ATF_TP_ADD_TC(tp, inotify_nullfs); + ATF_TP_ADD_TC(tp, inotify_queue_overflow); + /* Tests for the various inotify event types. */ + ATF_TP_ADD_TC(tp, inotify_event_access_file); + ATF_TP_ADD_TC(tp, inotify_event_access_dir); + ATF_TP_ADD_TC(tp, inotify_event_attrib); + ATF_TP_ADD_TC(tp, inotify_event_close_nowrite); + ATF_TP_ADD_TC(tp, inotify_event_close_write); + ATF_TP_ADD_TC(tp, inotify_event_create); + ATF_TP_ADD_TC(tp, inotify_event_delete); + ATF_TP_ADD_TC(tp, inotify_event_move); + ATF_TP_ADD_TC(tp, inotify_event_open); + ATF_TP_ADD_TC(tp, inotify_event_unmount); + return (atf_no_error()); +} From nobody Fri Jul 4 14:56:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC55L7Jz61H7d; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC53MT2z43Bf; Fri, 04 Jul 2025 14:56:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yQxa3TtPpc1fIRKstKJZ+igsaMcwKPsn2Yz/Rcote+E=; b=f0Zx8lIFgg0YT1cU/6UqRrX6ChzNDodRE0V4tmda2oAbi8ebHa010A4pSGAnNTmob/IZbL 9FLPCoPqH5ISv5RkQ+1gMs0KCa+OpxjzFqQ0PH1P05p/AgmXQ7M0bkQ8SmhNqprooTCp0O EUlU+nOY9MAgXVtLoinDDcMQC5D0yoIKbc7gzwjGFUv/ap3qPGJXNt9AxEBqSDaPok7Y95 ty4jqx0T76GQdVwEbXMdUrS2+prcCaOyoCPUWbfMcLM8hz/fa+loq4M8UfZf82Y/1kt0ib ZHiN2yMqM3W0XC90t53JIkU6PK1PdbghQo2xwSypR7drgWgzirJj7WhnAI4pAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yQxa3TtPpc1fIRKstKJZ+igsaMcwKPsn2Yz/Rcote+E=; b=drpsOI6UDUOKo2qHM6sZ2whQZD1iyNE4Wk9GYNQPLw674m3MqeNNb/Uj5ZJFlYARGcx+vG EQvmXTnPy4Z2sxaEqA9iGMVrHxXFadzzMm+t+icGk25MT1+QRwUw0HK/un+iPwazQQvErI 6g9Fe5PsJqOk8JKHwgIZ8mvCLuq1v0EfAr0GPLulQvqSjtSJkzN4SdR9Tx5q6SWR5nK2CW /Qb1010vMzg6qHieyN+7+V3qnWtt5VoQR/JT38koChTIYrZxLVGd06VIgYk5eXvEBVYl+3 QkHn1Zf2cuKr0WlBFBunRq3Sn4HeJBzLDiAYqHC+tvYtkAZ5uySrcMr/+Kpk3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640961; a=rsa-sha256; cv=none; b=bztKMi3NCbUgXbq5P0Z1cYEalKbrhiDUfiVn3wzvOIOzOb1vTPMonzHGyr8szOwkW1LGHR GjPorQfD0vO3zMgc4H3EZu+FB1u0mOCRD1x7bDQzjG8bUlBzi5gYQ/GYk0Z1m1LG2g4+zD Ynql/ZNtcs3dRIqOjodbeS7P5eHLAwwyKqrjXmZtatzdnC0I8+YQwQDMWBiQ1P6CRKGcsZ 33FtAwZ9IH0gfxcl7O2xI6jruDMicMfTCua8TrmwBd6G1NJgMwSvMqAVBvgJhPWraonHnY BqHOomZ80+jgP5jfEMS2vORbK5hsQcgL31AmM0HsVFm4PtIYypASs841pdYuag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC52qqWzvDN; Fri, 04 Jul 2025 14:56:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Eu1ZY073725; Fri, 4 Jul 2025 14:56:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Eu1dI073722; Fri, 4 Jul 2025 14:56:01 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:56:01 GMT Message-Id: <202507041456.564Eu1dI073722@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5202cfcf93b1 - main - inotify: Add man pages for the new syscalls and for VOP_INOTIFY List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5202cfcf93b19b39f3d2bf80e73a8ca94d7fffd1 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5202cfcf93b19b39f3d2bf80e73a8ca94d7fffd1 commit 5202cfcf93b19b39f3d2bf80e73a8ca94d7fffd1 Author: Mark Johnston AuthorDate: 2025-07-03 20:02:21 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:33 +0000 inotify: Add man pages for the new syscalls and for VOP_INOTIFY Reviewed by: kib MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315 --- lib/libsys/Makefile.sys | 6 + lib/libsys/inotify.2 | 379 +++++++++++++++++++++++++++++++++++++++++++ share/man/man9/Makefile | 2 + share/man/man9/VOP_INOTIFY.9 | 60 +++++++ 4 files changed, 447 insertions(+) diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys index 491c765e9416..3eb4bf85153d 100644 --- a/lib/libsys/Makefile.sys +++ b/lib/libsys/Makefile.sys @@ -224,6 +224,7 @@ MAN+= abort2.2 \ getsockopt.2 \ gettimeofday.2 \ getuid.2 \ + inotify.2 \ intro.2 \ ioctl.2 \ issetugid.2 \ @@ -448,6 +449,11 @@ MLINKS+=getrlimit.2 setrlimit.2 MLINKS+=getsockopt.2 setsockopt.2 MLINKS+=gettimeofday.2 settimeofday.2 MLINKS+=getuid.2 geteuid.2 +MLINKS+=inotify.2 inotify_init.2 \ + inotify.2 inotify_init1.2 \ + inotify.2 inotify_add_watch.2 \ + inotify.2 inotify_add_watch_at.2 \ + inotify.2 inotify_rm_watch.2 MLINKS+=intro.2 errno.2 MLINKS+=jail.2 jail_attach.2 \ jail.2 jail_get.2 \ diff --git a/lib/libsys/inotify.2 b/lib/libsys/inotify.2 new file mode 100644 index 000000000000..f94509d6f59e --- /dev/null +++ b/lib/libsys/inotify.2 @@ -0,0 +1,379 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2025 Klara, Inc. +.\" +.Dd May 19, 2025 +.Dt INOTIFY 2 +.Os +.Sh NAME +.Nm inotify_init , +.Nm inotify_init1 , +.Nm inotify_add_watch , +.Nm inotify_add_watch_at , +.Nm inotify_rm_watch +.Nd monitor file system events +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/inotify.h +.Ft int +.Fo inotify_init +.Fc +.Ft int +.Fo inotify_init1 +.Fa "int flags" +.Fc +.Ft int +.Fo inotify_add_watch +.Fa "int fd" +.Fa "const char *pathname" +.Fa "uint32_t mask" +.Fc +.Ft int +.Fo inotify_add_watch_at +.Fa "int fd" +.Fa "int dfd" +.Fa "const char *pathname" +.Fa "uint32_t mask" +.Fc +.Ft int +.Fo inotify_rm_watch +.Fa "int fd" +.Fa "uint32_t wd" +.Fc +.Bd -literal +struct inotify_event { + int wd; /* Watch descriptor */ + uint32_t mask; /* Event and flags */ + uint32_t cookie; /* Unique ID which links rename events */ + uint32_t len; /* Name field size, including nul bytes */ + char name[0]; /* Filename (nul-terminated) */ +}; +.Ed +.Sh DESCRIPTION +The inotify system calls provide an interface to monitor file system events. +They aim to be compatible with the Linux inotify interface. +The provided functionality is similar to the +.Dv EVFILT_VNODE +filter of the +.Xr kevent 2 +system call, but further allows monitoring of a directory without needing to +open each object in that directory. +This avoids races and reduces the number of file descriptors needed to monitor +a large file hierarchy. +.Pp +inotify allows one or more file system objects, generally files or directories, +to be watched for events, such as file open or close. +Watched objects are associated with a file descriptor returned +by +.Fn inotify_init +or +.Fn inotify_init1 . +When an event occurs, a record describing the event becomes available for +reading from the inotify file descriptor. +Each inotify descriptor thus refers to a queue of events waiting to be read. +inotify descriptors are inherited across +.Xr fork 2 +calls and may be passed to other processes via +.Xr unix 4 +sockets. +.Pp +The +.Fn inotify_init1 +system call accepts two flags. +The +.Dv IN_NONBLOCK +flag causes the inotify descriptor to be opened in non-blocking mode, such that +.Xr read 2 +calls will not block if no records are available to consume, and will instead +return +.Er EWOULDBLOCK . +The +.Dv IN_CLOEXEC +flag causes the inotify descriptor to be closed automatically when +.Xr execve 2 +is called. +.Pp +To watch a file or directory, the +.Fn inotify_add_watch +or +.Fn inotify_add_watch_at +system calls must be used. +They take a path and a mask of events to watch for, and return a +.Dq watch descriptor , +a non-negative integer which uniquely identifies the watched object within the +inotify descriptor. +.Pp +The +.Fn inotify_rm_watch +system call removes a watch from an inotify descriptor. +.Pp +When watching a directory, objects within the directory are monitored for events +as well as the directory itself. +A record describing an inotify event consists of a +.Dq struct inotify_event +followed by the name of the object in the directory being watched. +If the watched object itself generates an event, no name is present. +Extra nul bytes may follow the file name in order to provide alignment for a +subsequent record. +.Pp +The following events are defined: +.Bl -tag -width IN_CLOSE_NOWRITE +.It Dv IN_ACCESS +A file's contents were accessed, e.g., by +.Xr read 2 +.Xr copy_file_range 2 , +.Xr sendfile 2 , +or +.Xr getdirentries 2 . +.It Dv IN_ATTRIB +A file's metadata was changed, e.g., by +.Xr chmod 2 +or +.Xr unlink 2 . +.It Dv IN_CLOSE_WRITE +A file that was previously opened for writing was closed. +.It Dv IN_CLOSE_NOWRITE +A file that was previously opened read-only was closed. +.It Dv IN_CREATE +A file within a watched directory was created, e.g., by +.Xr open 2 , +.Xr mkdir 2 , +.Xr symlink 2 , +.Xr mknod 2 , +or +.Xr bind 2 . +.It Dv IN_DELETE +A file or directory within a watched directory was removed. +.It Dv IN_DELETE_SELF +The watched file or directory itself was deleted. +This event is generated only when the link count of the file drops +to zero. +.It Dv IN_MODIFY +A file's contents were modified, e.g., by +.Xr write 2 +or +.Xr copy_file_range 2 . +.It Dv IN_MOVE_SELF +The watched file or directory itself was renamed. +.It Dv IN_MOVED_FROM +A file or directory was moved from a watched directory. +.It Dv IN_MOVED_TO +A file or directory was moved into a watched directory. +A +.Xr rename 2 +call thus may generate two events, one for the old name and one for the new +name. +These are linked together by the +.Ar cookie +field in the inotify record, which can be compared to link the two records +to the same event. +.It Dv IN_OPEN +A file was opened. +.El +.Pp +Some additional flags may be set in inotify event records: +.Bl -tag -width IN_Q_OVERFLOW +.It Dv IN_IGNORED +When a watch is removed from a file, for example because it was created with the +.Dv IN_ONESHOT +flag, the file was deleted, or the watch was explicitly removed with +.Xr inotify_rm_watch 2 , +an event with this mask is generated to indicate that the watch will not +generate any more events. +Once this event is generated, the watch is automatically removed, and in +particular should not be removed manually with +.Xr inotify_rm_watch 2 . +.It Dv IN_ISDIR +When the subject of an event is a directory, this flag is set in the +.Ar mask +.It Dv IN_Q_OVERFLOW +One or more events were dropped, for example because of a kernel memory allocation +failure or because the event queue size hit a limit. +.It Dv IN_UNMOUNT +The filesystem containing the watched object was unmounted. +.El +.Pp +A number of flags may also be specified in the +.Ar mask +given to +.Fn inotify_add_watch +and +.Fn inotify_add_watch_at : +.Bl -tag -width IN_DONT_FOLLOW +.It Dv IN_DONT_FOLLOW +If +.Ar pathname +is a symbolic link, do not follow it. +.It Dv IN_EXCL_UNLINK +This currently has no effect, see the +.Sx BUGS +section. +.In Dv IN_MASK_ADD +When adding a watch to an object, and that object is already watched by the +same inotify descriptor, by default the mask of the existing watch is +overwritten. +When +.Dv IN_MASK_ADD +is specified, the mask of the existing watch is instead logically ORed with +the new mask. +.In Dv IN_MASK_CREATE +When +.Fn inotify_add watch +is used to add a watch to an object, +.Dv IN_MASK_CREATE +is specified, and that object is already watched by the same inotify descriptor, +return an error instead of updating the existing watch. +.In Dv IN_ONESHOT +Monitor the object for a single event, after which the watch is automatically +removed. +As part of removal, a +.Dv IN_IGNORED +event is generated. +.In Dv IN_ONLYDIR +When creating a watch, fail with +.Er ENOTDIR +if the path does not refer to a directory. +.El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width 15 +.It Va vfs.inotify.max_events +The maximum number of inotify records that can be queued for a single +inotify descriptor. +Records in excess of this limit are discarded, and a single event with +mask equal to +.Dv IN_Q_OVERFLOW +will be present in the queue. +.It Va vfs.inotify.max_user_instances +The maximum number of inotify descriptors that can be created by a single +user. +.It Va vfs.inotify.max_user_watches +The maximum number of inotify watches per user. +.El +.Sh EXAMPLES +See the example program in +.Pa /usr/share/examples/inotify/inotify.c . +.Sh ERRORS +The +.Fn inotify_init +and +.Fn inotify_init1 +functions will fail if: +.Bl -tag -width Er +.It Bq Er ENFILE +The system limit on the total number of open files has been reached. +.It Bq Er EMFILE +A per-process limit on the number of open files has been reached. +.It Bq Er EMFILE +The system limit on the number of inotify descriptors has been reached. +.It Bq Er EINVAL +An unrecognized flag was passed to +.Fn inotify_init1 . +.El +.Pp +The +.Fn inotify_add_watch +and +.Fn inotify_add_watch_at +system calls will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Ar fd +parameter is not a valid file descriptor. +.It Bq Er EINVAL +The +.Ar fd +parameter is not an inotify descriptor. +.It Bq Er EINVAL +The +.Ar mask +parameter does not specify an event, or +the +.Dv IN_MASK_CREATE +and +.Dv IN_MASK_ADD +flags are both set, or an unrecognized flag was passed. +.It Bq Er ENOTDIR +The +.Ar pathname +parameter refers to a file that is not a directory, and the +.Dv IN_ONLYDIR +flag was specified. +.It Bq Er ENOSPC +The per-user limit on the total number of inotify watches has been reached. +.It Bq Er ECAPMODE +The process is in capability mode and +.Fn inotify_add_watch +was called, or +.Fn inotify_add_watch_at +was called with +.Dv AT_FDCWD +as the directory file descriptor +.Ar dfd . +.It Bq Er ENOTCAPABLE +The process is in capability mode and +.Ar pathname +contains a +.Dq .. +component leading to a directory outside the directory hierarchy specified +by +.Ar dfd . +.El +.Pp +The +.Fn inotify_rm_watch +system call will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Ar fd +parameter is not a valid file descriptor. +.It Bq Er EINVAL +The +.Ar fd +parameter is not an inotify descriptor. +.It Bq Er EINVAL +The +.Ar wd +parameter is not a valid watch descriptor. +.El +.Sh SEE ALSO +.Xr kevent 2 , +.Xr capsicum 4 +.Sh STANDARDS +The +.Nm +interface originates from Linux and is non-standard. +This implementation aims to be compatible with that of Linux and is based +on the documentation available at +.Pa https://man7.org/linux/man-pages/man7/inotify.7.html . +.Sh HISTORY +The inotify system calls first appeared in +.Fx 15.0 . +.Sh BUGS +If a file in a watched directory has multiple hard links, +an access via any hard link for that file will generate an event, even +if the accessed link belongs to an unwatched directory. +This is not the case for the Linux implementation, where only accesses +via the hard link in the watched directory will generate an event. +.Pp +If a watched directory contains multiple hard links of a file, an event +on one of the hard links will generate an inotify record for each link +in the directory. +.Pp +When a file is unlinked, no more events will be generated for that file, +even if it continues to be accessed. +By default, the Linux implementation will continue to generate events in +this case. +Thus, the +.Fx +implementation behaves as though +.Dv IN_EXCL_UNLINK +is always set. diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index badaee1479f7..f709a4818dd5 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -434,6 +434,7 @@ MAN= accept_filter.9 \ VOP_GETEXTATTR.9 \ VOP_GETPAGES.9 \ VOP_INACTIVE.9 \ + VOP_INOTIFY.9 \ VOP_IOCTL.9 \ VOP_LINK.9 \ VOP_LISTEXTATTR.9 \ @@ -2460,6 +2461,7 @@ MLINKS+=VOP_CREATE.9 VOP_MKDIR.9 \ MLINKS+=VOP_FSYNC.9 VOP_FDATASYNC.9 MLINKS+=VOP_GETPAGES.9 VOP_PUTPAGES.9 MLINKS+=VOP_INACTIVE.9 VOP_RECLAIM.9 +MLINKS+=VOP_INOTIFY.9 VOP_INOTIFY_ADD_WATCH.9 MLINKS+=VOP_LOCK.9 vn_lock.9 \ VOP_LOCK.9 VOP_ISLOCKED.9 \ VOP_LOCK.9 VOP_UNLOCK.9 diff --git a/share/man/man9/VOP_INOTIFY.9 b/share/man/man9/VOP_INOTIFY.9 new file mode 100644 index 000000000000..43b644682153 --- /dev/null +++ b/share/man/man9/VOP_INOTIFY.9 @@ -0,0 +1,60 @@ +.\"- +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2025 Klara, Inc. +.\" +.Dd May 27, 2025 +.Dt VOP_INOTIFY 9 +.Os +.Sh NAME +.Nm VOP_INOTIFY +.Nd vnode inotify interface +.Sh SYNOPSIS +.In sys/param.h +.In sys/vnode.h +.Ft int +.Fo VOP_INOTIFY +.Fa struct vnode *vp +.Fa struct vnode *dvp +.Fa struct componentname *cnp +.Fa int event +.Fa uint32_t cookie +.Fc +.Ft int +.Fo VOP_INOTIFY_ADD_WATCH +.Fa struct vnode *vp +.Fa struct inotify_softc *sc +.Fa uint32_t mask +.Fa uint32_t *wdp +.Fa struct thread *td +.Fc +.Sh DESCRIPTION +The +.Fn VOP_INOTIFY +operation notifies the +.Xr inotify 2 +subsystem of a file system event on a vnode. +The +.Fa dvp +and +.Fa cnp +arguments are optional and are only used to obtain a file name for the event. +If they are omitted, the inotify subsystem will use the file name cache to +find a name for the vnode, but this is more expensive. +.Pp +The +.Fn VOP_INOTIFY_ADD_WATCH +operation is for internal use by the inotify subsystem to add a watch to a +vnode. +.Sh LOCKS +The +.Fn VOP_INOTIFY +operation does not assume any particular vnode lock state. +The +.Fn VOP_INOTIFY_ADD_WATCH +operation should be called with the vnode locked. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error code is returned. +.Sh SEE ALSO +.Xr inotify 2 , +.Xr vnode 9 From nobody Fri Jul 4 14:56:03 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC81MhSz61HLj; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC752Y0z438m; Fri, 04 Jul 2025 14:56:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sL9m5bqbf8pxJFvhuE9LLzvwQGYBHUECC0OMoathkf0=; b=uCKA/c3h/2osxaZHjWBfPV6Io35dzXTLrgrstYSET+0kfcrHJuwqXoTWU4PfbIkLykfmCy 68sCu73aobFiCNfBdTXKQBuFNHl1hjkq7Bse6blIZ5pPmZkqt2T3PTHaqmgmYA4M40ew5r nfGOEiTxcCghxfwBnt/Q1S0CGOb+zRpMxPK8e98Z0uzUrrW20cerHf/+L3+YKrPFLSt67o 76mZhF1jWcMu4/A+qpbq35nZAKiHzpy/KzhJcjWaEvEXbGL80go4uNgERcYumf0DZ/dHxj yJTK7OvCy2NilMP/01L7jL+YZufKPLi7c2NZFKlyXm9E+b0HrdSaUtoiboHJRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sL9m5bqbf8pxJFvhuE9LLzvwQGYBHUECC0OMoathkf0=; b=VyuCj3NxVswqdCTbKZ6GstSnnnFZv7W0wUJalzNd8+rQCWCXykNHCLE+iFyIlToDlMhA8c OOB/KBWa03MnSIBaklSIns3WF8KfbH1REUb/i+oGVSfDduPQzwhUXf2Z9595vyNX3vXIkL h+LRqhblQ41sN7c1lJMfqTd6789RlE+yz9K9jpUWj08iZPh7eJuNIj7aFMbi8cZmzfElms Glh/giKezs+cwjKTYs2M6Q1E/wPakcRzLxvPSy01xnE6iWPxEwyag8YPkbM9dBz/Ta6sA9 di6rHfGo9wrMMZnKubomob3mXGn/ZUgzLITk8Glb3ttGGt4q2X7JqbDZe1JFoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640963; a=rsa-sha256; cv=none; b=ItSuy/4nGvorx4WIRS7NHRxZU9SwW2KBeZLlfBhtZWUx9KHEpbeqlbpCwlHavvJkyomCGL Fgt14YvS/4A+ZDFiY/FsabU1wwaU372jB7E9Y7LvcFT4M3YcTwktUlBKuZ1NNxAj9Pv1Jl sC/IdJuQ9tYMvzqWzsTAtCFgRjjsatv3RqP1eaplpnbGmIozC5J082LNewLi6eKl/lyINy CROjXd6/WfUnN/2CCqZc8vVc6QdvChG1Rv6C6GErMlA3lm0yh7abT5OD4QUiNuAEa60H8G DIcf9I4IaIcARzpMrb81mXjpHgDzuQcij7td57iCOpoKS73QmILFdJkwXswZAg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC74DjjzvXQ; Fri, 04 Jul 2025 14:56:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Eu3V0073795; Fri, 4 Jul 2025 14:56:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Eu3Xr073792; Fri, 4 Jul 2025 14:56:03 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:56:03 GMT Message-Id: <202507041456.564Eu3Xr073792@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1d8664d69041 - main - examples: Add a demo program for inotify List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d8664d6904149e0be5dbfa0ee35268de2a83f1e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1d8664d6904149e0be5dbfa0ee35268de2a83f1e commit 1d8664d6904149e0be5dbfa0ee35268de2a83f1e Author: Mark Johnston AuthorDate: 2025-07-03 20:00:55 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:34 +0000 examples: Add a demo program for inotify MFC after: 3 months Sponsored by: Klara, Inc. --- etc/mtree/BSD.usr.dist | 2 + share/examples/Makefile | 5 ++ share/examples/inotify/Makefile | 6 ++ share/examples/inotify/inotify.c | 172 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 185 insertions(+) diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 97b555e50dc1..ffdd82ae9911 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -304,6 +304,8 @@ .. indent .. + inotify + .. ipfilter .. ipfw diff --git a/share/examples/Makefile b/share/examples/Makefile index 560fdae6de5b..f0c050a36306 100644 --- a/share/examples/Makefile +++ b/share/examples/Makefile @@ -15,6 +15,7 @@ LDIRS= BSD_daemon \ find_interface \ flua \ indent \ + inotify \ ipfw \ jails \ kld \ @@ -97,6 +98,10 @@ SE_FLUA= libjail.lua SE_DIRS+= indent SE_INDENT= indent.pro +SE_DIRS+= inotify +SE_INOTIFY= inotify.c \ + Makefile + .if ${MK_IPFILTER} != "no" SUBDIR+= ipfilter .endif diff --git a/share/examples/inotify/Makefile b/share/examples/inotify/Makefile new file mode 100644 index 000000000000..c54c629c58d7 --- /dev/null +++ b/share/examples/inotify/Makefile @@ -0,0 +1,6 @@ +PROG= inotify +MAN= + +LIBADD= xo + +.include diff --git a/share/examples/inotify/inotify.c b/share/examples/inotify/inotify.c new file mode 100644 index 000000000000..b8e300bc992c --- /dev/null +++ b/share/examples/inotify/inotify.c @@ -0,0 +1,172 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 Klara, Inc. + */ + +/* + * A simple program to demonstrate inotify. Given one or more paths, it watches + * all events on those paths and prints them to standard output. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +static void +usage(void) +{ + xo_errx(1, "usage: inotify [ ...]"); +} + +static const char * +ev2str(uint32_t event) +{ + switch (event & IN_ALL_EVENTS) { + case IN_ACCESS: + return ("IN_ACCESS"); + case IN_ATTRIB: + return ("IN_ATTRIB"); + case IN_CLOSE_WRITE: + return ("IN_CLOSE_WRITE"); + case IN_CLOSE_NOWRITE: + return ("IN_CLOSE_NOWRITE"); + case IN_CREATE: + return ("IN_CREATE"); + case IN_DELETE: + return ("IN_DELETE"); + case IN_DELETE_SELF: + return ("IN_DELETE_SELF"); + case IN_MODIFY: + return ("IN_MODIFY"); + case IN_MOVE_SELF: + return ("IN_MOVE_SELF"); + case IN_MOVED_FROM: + return ("IN_MOVED_FROM"); + case IN_MOVED_TO: + return ("IN_MOVED_TO"); + case IN_OPEN: + return ("IN_OPEN"); + default: + switch (event) { + case IN_IGNORED: + return ("IN_IGNORED"); + case IN_Q_OVERFLOW: + return ("IN_Q_OVERFLOW"); + case IN_UNMOUNT: + return ("IN_UNMOUNT"); + } + warnx("unknown event %#x", event); + assert(0); + } +} + +static void +set_handler(int kq, int sig) +{ + struct kevent kev; + + (void)signal(sig, SIG_IGN); + EV_SET(&kev, sig, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL); + if (kevent(kq, &kev, 1, NULL, 0, NULL) < 0) + xo_err(1, "kevent"); +} + +int +main(int argc, char **argv) +{ + struct inotify_event *iev, *iev1; + struct kevent kev; + size_t ievsz; + int ifd, kq; + + argc = xo_parse_args(argc, argv); + if (argc < 2) + usage(); + argc--; + argv++; + + ifd = inotify_init1(IN_NONBLOCK); + if (ifd < 0) + xo_err(1, "inotify"); + for (int i = 0; i < argc; i++) { + int wd; + + wd = inotify_add_watch(ifd, argv[i], IN_ALL_EVENTS); + if (wd < 0) + xo_err(1, "inotify_add_watch(%s)", argv[i]); + } + + xo_set_version("1"); + xo_open_list("events"); + + kq = kqueue(); + if (kq < 0) + xo_err(1, "kqueue"); + + /* + * Handle signals in the event loop so that we can close the xo list. + */ + set_handler(kq, SIGINT); + set_handler(kq, SIGTERM); + set_handler(kq, SIGHUP); + set_handler(kq, SIGQUIT); + + /* + * Monitor the inotify descriptor for events. + */ + EV_SET(&kev, ifd, EVFILT_READ, EV_ADD, 0, 0, NULL); + if (kevent(kq, &kev, 1, NULL, 0, NULL) < 0) + xo_err(1, "kevent"); + + ievsz = sizeof(*iev) + NAME_MAX + 1; + iev = malloc(ievsz); + if (iev == NULL) + err(1, "malloc"); + + for (;;) { + ssize_t n; + const char *ev; + + if (kevent(kq, NULL, 0, &kev, 1, NULL) < 0) + xo_err(1, "kevent"); + if (kev.filter == EVFILT_SIGNAL) + break; + + n = read(ifd, iev, ievsz); + if (n < 0) + xo_err(1, "read"); + assert(n >= (ssize_t)sizeof(*iev)); + + for (iev1 = iev; n > 0;) { + assert(n >= (ssize_t)sizeof(*iev1)); + + ev = ev2str(iev1->mask); + xo_open_instance("event"); + xo_emit("{:wd/%3d} {:event/%16s} {:name/%s}\n", + iev1->wd, ev, iev1->name); + xo_close_instance("event"); + + n -= sizeof(*iev1) + iev1->len; + iev1 = (struct inotify_event *)(void *) + ((char *)iev1 + sizeof(*iev1) + iev1->len); + } + (void)xo_flush(); + } + + xo_close_list("events"); + + if (xo_finish() < 0) + xo_err(1, "stdout"); + exit(0); +} From nobody Fri Jul 4 14:56:04 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcC91GHDz61HNZ; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC85FBJz43Mc; Fri, 04 Jul 2025 14:56:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D/YfTzPtN9hJl0agdStyLGnmXZ2J8xXPpqqW/tHpVm8=; b=h4LWjIZ0W8mefo9gXTMtSpL1Va3T3De7gAXmS+rry0aXe3EP7ttoFKTsWceiwolrBL3L+l 9DW4aryrJhvkwqklWFqjbH416JSUVb8354WdaBLF4QCAp/z3gA5KaKRlQF+frWfHbvFeDu SEaNg0iUQU/H9pvOv7Xd3OKS02q+DTpvqDwOTDW6pzDonHYxtL0i7kTJoDhXo3EOiQM1p8 OtZX6CkqsErlhfkDgV8hBUxI+KeYeMaiyEmABBCzYi7T09++/wBG7+x5arJun2JIqdrH1D 3/5pQHWM/wcbRjR9WuBI57IKBe+/XuHG5/Bq5/U1xRRx1VflOrb/JHy9T901cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D/YfTzPtN9hJl0agdStyLGnmXZ2J8xXPpqqW/tHpVm8=; b=IV9jPdh9jogBRERwpVllC8IwP11vqO5BWdX4q5bFZXN0ib3W9uwJ/tTCBRr167hUdwXF/d WEL1V5NVWYrai1efWKNOsP91Qw3URe/7ZvPbXD+fyUpjHm5m8rRXH2Vmop2psLynF7mKee Ekhe6Zmm0jClWt/dS+K2W+6m8cP11nUM1Pmb3ZIs/7zhrw/Ok+755dFa8HbI9UdqYFZqYw +pa420rdNjVWXr8p3HRUL8qCi82vtvPdrVIULvZP5sA4Z2xIqLSzep8ApkWb5gPRpSAQ8B rLIHLD31gGnQuH7iZzRPtLayaKzIIo0G8GRVNU62XRtsJtGkZpS1A5ZJcuCjFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640964; a=rsa-sha256; cv=none; b=sHTvXgSaE8Gla1aEy3mPw5FfoE06gyZ5V31plCP9S0A94abepVmVbUa+JIr0eVFxNx7gX2 8SJgK04kZE/NsQ9ce+BWs24H3WJGMyRBwcuhGFbhUmvs3XGKcXd85D+NO40p9Q8OOsIjDX kduAwB2Ykwp0s7w2Ma7SW8dUAmG0WdcWRdfszHSv5Yuweyxj77oicoVYphc7YvukSSQ+ie RqQxUs8I5kjd/jUgDt5lrHNtYCMcwJCDv+TFufFtNcxYZC8G7LwRoySgwHhir+rWkbRuD8 wdm2yS7yTH2J03yHVdmNEDukcC0Q6JfiqkfASWdws9ym9wbd/XLE61M+QMHjdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC84prDzvm1; Fri, 04 Jul 2025 14:56:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Eu4Ub073828; Fri, 4 Jul 2025 14:56:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Eu4rO073825; Fri, 4 Jul 2025 14:56:04 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:56:04 GMT Message-Id: <202507041456.564Eu4rO073825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3965de642c29 - main - linux: Add inotify support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3965de642c29d831649c8307203303de560d721a Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3965de642c29d831649c8307203303de560d721a commit 3965de642c29d831649c8307203303de560d721a Author: Mark Johnston AuthorDate: 2025-06-06 13:25:09 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:34 +0000 linux: Add inotify support Implement the Linux inotify system calls using the native implementation in vfs_inotify.c. PR: 240874 Reviewed by: brooks MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50761 --- sys/amd64/linux/syscalls.master | 11 +++- sys/amd64/linux32/syscalls.master | 15 ++++- sys/arm64/linux/syscalls.master | 11 +++- sys/compat/linux/linux_dummy.c | 4 -- sys/compat/linux/linux_file.c | 121 ++++++++++++++++++++++++++++++++++++++ sys/compat/linux/linux_file.h | 32 ++++++++++ sys/i386/linux/syscalls.master | 15 ++++- sys/kern/vfs_inotify.c | 4 +- sys/sys/inotify.h | 4 ++ sys/x86/linux/linux_dummy_x86.c | 2 - 10 files changed, 201 insertions(+), 18 deletions(-) diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master index fd08c9b0279d..5e1394751ef6 100644 --- a/sys/amd64/linux/syscalls.master +++ b/sys/amd64/linux/syscalls.master @@ -1476,10 +1476,17 @@ int linux_inotify_init(void); } 254 AUE_NULL STD { - int linux_inotify_add_watch(void); + int linux_inotify_add_watch( + l_int fd, + const char *pathname, + uint32_t mask + ); } 255 AUE_NULL STD { - int linux_inotify_rm_watch(void); + int linux_inotify_rm_watch( + l_int fd, + uint32_t wd + ); } 256 AUE_NULL STD { int linux_migrate_pages(void); diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 92d5f09c423f..7bd522a598e8 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -1589,10 +1589,17 @@ int linux_inotify_init(void); } 292 AUE_NULL STD { - int linux_inotify_add_watch(void); + int linux_inotify_add_watch( + l_int fd, + const char *pathname, + uint32_t mask + ); } 293 AUE_NULL STD { - int linux_inotify_rm_watch(void); + int linux_inotify_rm_watch( + l_int fd, + uint32_t wd + ); } ; Linux 2.6.16: 294 AUE_NULL STD { @@ -1860,7 +1867,9 @@ ); } 332 AUE_NULL STD { - int linux_inotify_init1(void); + int linux_inotify_init1( + l_int flags + ); } ; Linux 2.6.30: 333 AUE_NULL STD { diff --git a/sys/arm64/linux/syscalls.master b/sys/arm64/linux/syscalls.master index 79c04c398e00..2babdcaf03bf 100644 --- a/sys/arm64/linux/syscalls.master +++ b/sys/arm64/linux/syscalls.master @@ -170,10 +170,17 @@ ); } 27 AUE_NULL STD { - int linux_inotify_add_watch(void); + int linux_inotify_add_watch( + l_int fd, + const char *pathname, + uint32_t mask + ); } 28 AUE_NULL STD { - int linux_inotify_rm_watch(void); + int linux_inotify_rm_watch( + l_int fd, + uint32_t wd + ); } 29 AUE_IOCTL STD { int linux_ioctl( diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c index 35d6debe0da9..19cd55849f65 100644 --- a/sys/compat/linux/linux_dummy.c +++ b/sys/compat/linux/linux_dummy.c @@ -74,9 +74,6 @@ DUMMY(kexec_load); DUMMY(add_key); DUMMY(request_key); DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); /* Linux 2.6.16: */ DUMMY(migrate_pages); DUMMY(unshare); @@ -87,7 +84,6 @@ DUMMY(vmsplice); DUMMY(move_pages); /* Linux 2.6.27: */ DUMMY(signalfd4); -DUMMY(inotify_init1); /* Linux 2.6.31: */ DUMMY(perf_event_open); /* Linux 2.6.36: */ diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 246bc26d85d4..86834a7ecea8 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -32,11 +32,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -1877,3 +1879,122 @@ linux_writev(struct thread *td, struct linux_writev_args *args) freeuio(auio); return (linux_enobufs2eagain(td, args->fd, error)); } + +static int +linux_inotify_init_flags(int l_flags) +{ + int bsd_flags; + + if ((l_flags & ~(LINUX_IN_CLOEXEC | LINUX_IN_NONBLOCK)) != 0) + linux_msg(NULL, "inotify_init1 unsupported flags 0x%x", + l_flags); + + bsd_flags = 0; + if ((l_flags & LINUX_IN_CLOEXEC) != 0) + bsd_flags |= O_CLOEXEC; + if ((l_flags & LINUX_IN_NONBLOCK) != 0) + bsd_flags |= O_NONBLOCK; + return (bsd_flags); +} + +static int +inotify_init_common(struct thread *td, int flags) +{ + struct specialfd_inotify si; + + si.flags = linux_inotify_init_flags(flags); + return (kern_specialfd(td, SPECIALFD_INOTIFY, &si)); +} + +#if defined(__i386__) || defined(__amd64__) +int +linux_inotify_init(struct thread *td, struct linux_inotify_init_args *args) +{ + return (inotify_init_common(td, 0)); +} +#endif + +int +linux_inotify_init1(struct thread *td, struct linux_inotify_init1_args *args) +{ + return (inotify_init_common(td, args->flags)); +} + +/* + * The native implementation uses the same values for inotify events as + * libinotify, which gives us binary compatibility with Linux. This simplifies + * the shim implementation a lot, as otherwise we would have to handle read(2) + * calls on inotify descriptors and translate events to Linux's ABI. + */ +_Static_assert(LINUX_IN_ACCESS == IN_ACCESS, + "IN_ACCESS mismatch"); +_Static_assert(LINUX_IN_MODIFY == IN_MODIFY, + "IN_MODIFY mismatch"); +_Static_assert(LINUX_IN_ATTRIB == IN_ATTRIB, + "IN_ATTRIB mismatch"); +_Static_assert(LINUX_IN_CLOSE_WRITE == IN_CLOSE_WRITE, + "IN_CLOSE_WRITE mismatch"); +_Static_assert(LINUX_IN_CLOSE_NOWRITE == IN_CLOSE_NOWRITE, + "IN_CLOSE_NOWRITE mismatch"); +_Static_assert(LINUX_IN_OPEN == IN_OPEN, + "IN_OPEN mismatch"); +_Static_assert(LINUX_IN_MOVED_FROM == IN_MOVED_FROM, + "IN_MOVED_FROM mismatch"); +_Static_assert(LINUX_IN_MOVED_TO == IN_MOVED_TO, + "IN_MOVED_TO mismatch"); +_Static_assert(LINUX_IN_CREATE == IN_CREATE, + "IN_CREATE mismatch"); +_Static_assert(LINUX_IN_DELETE == IN_DELETE, + "IN_DELETE mismatch"); +_Static_assert(LINUX_IN_DELETE_SELF == IN_DELETE_SELF, + "IN_DELETE_SELF mismatch"); +_Static_assert(LINUX_IN_MOVE_SELF == IN_MOVE_SELF, + "IN_MOVE_SELF mismatch"); + +_Static_assert(LINUX_IN_UNMOUNT == IN_UNMOUNT, + "IN_UNMOUNT mismatch"); +_Static_assert(LINUX_IN_Q_OVERFLOW == IN_Q_OVERFLOW, + "IN_Q_OVERFLOW mismatch"); +_Static_assert(LINUX_IN_IGNORED == IN_IGNORED, + "IN_IGNORED mismatch"); + +_Static_assert(LINUX_IN_ISDIR == IN_ISDIR, + "IN_ISDIR mismatch"); +_Static_assert(LINUX_IN_ONLYDIR == IN_ONLYDIR, + "IN_ONLYDIR mismatch"); +_Static_assert(LINUX_IN_DONT_FOLLOW == IN_DONT_FOLLOW, + "IN_DONT_FOLLOW mismatch"); +_Static_assert(LINUX_IN_MASK_CREATE == IN_MASK_CREATE, + "IN_MASK_CREATE mismatch"); +_Static_assert(LINUX_IN_MASK_ADD == IN_MASK_ADD, + "IN_MASK_ADD mismatch"); +_Static_assert(LINUX_IN_ONESHOT == IN_ONESHOT, + "IN_ONESHOT mismatch"); +_Static_assert(LINUX_IN_EXCL_UNLINK == IN_EXCL_UNLINK, + "IN_EXCL_UNLINK mismatch"); + +static int +linux_inotify_watch_flags(int l_flags) +{ + if ((l_flags & ~(LINUX_IN_ALL_EVENTS | LINUX_IN_ALL_FLAGS)) != 0) { + linux_msg(NULL, "inotify_add_watch unsupported flags 0x%x", + l_flags); + } + + return (l_flags); +} + +int +linux_inotify_add_watch(struct thread *td, + struct linux_inotify_add_watch_args *args) +{ + return (kern_inotify_add_watch(args->fd, AT_FDCWD, args->pathname, + linux_inotify_watch_flags(args->mask), td)); +} + +int +linux_inotify_rm_watch(struct thread *td, + struct linux_inotify_rm_watch_args *args) +{ + return (kern_inotify_rm_watch(args->fd, args->wd, td)); +} diff --git a/sys/compat/linux/linux_file.h b/sys/compat/linux/linux_file.h index 2e56942b0f40..7448dc597230 100644 --- a/sys/compat/linux/linux_file.h +++ b/sys/compat/linux/linux_file.h @@ -189,6 +189,38 @@ #define LINUX_HUGETLB_FLAG_ENCODE_2GB (31 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) #define LINUX_HUGETLB_FLAG_ENCODE_16GB (34U << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +/* inotify flags */ +#define LINUX_IN_ACCESS 0x00000001 +#define LINUX_IN_MODIFY 0x00000002 +#define LINUX_IN_ATTRIB 0x00000004 +#define LINUX_IN_CLOSE_WRITE 0x00000008 +#define LINUX_IN_CLOSE_NOWRITE 0x00000010 +#define LINUX_IN_OPEN 0x00000020 +#define LINUX_IN_MOVED_FROM 0x00000040 +#define LINUX_IN_MOVED_TO 0x00000080 +#define LINUX_IN_CREATE 0x00000100 +#define LINUX_IN_DELETE 0x00000200 +#define LINUX_IN_DELETE_SELF 0x00000400 +#define LINUX_IN_MOVE_SELF 0x00000800 + +#define LINUX_IN_UNMOUNT 0x00002000 +#define LINUX_IN_Q_OVERFLOW 0x00004000 +#define LINUX_IN_IGNORED 0x00008000 + +#define LINUX_IN_ONLYDIR 0x01000000 +#define LINUX_IN_DONT_FOLLOW 0x02000000 +#define LINUX_IN_EXCL_UNLINK 0x04000000 +#define LINUX_IN_MASK_CREATE 0x10000000 +#define LINUX_IN_MASK_ADD 0x20000000 +#define LINUX_IN_ISDIR 0x40000000 +#define LINUX_IN_ONESHOT 0x80000000 + +#define LINUX_IN_ALL_EVENTS 0x00000fff +#define LINUX_IN_ALL_FLAGS 0xf700e000 + +#define LINUX_IN_NONBLOCK 0x00000800 +#define LINUX_IN_CLOEXEC 0x00080000 + #if defined(_KERNEL) struct l_file_handle { l_uint handle_bytes; diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index 958336be0f08..2113ea51ac5d 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -1605,10 +1605,17 @@ int linux_inotify_init(void); } 292 AUE_NULL STD { - int linux_inotify_add_watch(void); + int linux_inotify_add_watch( + l_int fd, + const char *pathname, + uint32_t mask + ); } 293 AUE_NULL STD { - int linux_inotify_rm_watch(void); + int linux_inotify_rm_watch( + l_int fd, + uint32_t wd + ); } ; Linux 2.6.16: 294 AUE_NULL STD { @@ -1872,7 +1879,9 @@ ); } 332 AUE_NULL STD { - int linux_inotify_init1(void); + int linux_inotify_init1( + l_int flags + ); } ; Linux 2.6.30: 333 AUE_NULL STD { diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c index 929ce0426ee8..9562350c897f 100644 --- a/sys/kern/vfs_inotify.c +++ b/sys/kern/vfs_inotify.c @@ -872,7 +872,7 @@ fget_inotify(struct thread *td, int fd, const cap_rights_t *needrightsp, return (0); } -static int +int kern_inotify_add_watch(int fd, int dfd, const char *path, uint32_t mask, struct thread *td) { @@ -958,7 +958,7 @@ sys_inotify_add_watch_at(struct thread *td, uap->mask, td)); } -static int +int kern_inotify_rm_watch(int fd, uint32_t wd, struct thread *td) { struct file *fp; diff --git a/sys/sys/inotify.h b/sys/sys/inotify.h index 6a266aacce32..65dc5dba43f3 100644 --- a/sys/sys/inotify.h +++ b/sys/sys/inotify.h @@ -89,6 +89,10 @@ struct vnode; int inotify_create_file(struct thread *, struct file *, int, int *); void inotify_log(struct vnode *, const char *, size_t, int, __uint32_t); +int kern_inotify_rm_watch(int, uint32_t, struct thread *); +int kern_inotify_add_watch(int, int, const char *, uint32_t, + struct thread *); + void vn_inotify(struct vnode *, struct vnode *, struct componentname *, int, uint32_t); int vn_inotify_add_watch(struct vnode *, struct inotify_softc *, diff --git a/sys/x86/linux/linux_dummy_x86.c b/sys/x86/linux/linux_dummy_x86.c index ae1d23e811e7..221f5dbf5ba3 100644 --- a/sys/x86/linux/linux_dummy_x86.c +++ b/sys/x86/linux/linux_dummy_x86.c @@ -46,7 +46,5 @@ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); DUMMY(sysfs); DUMMY(quotactl); -/* Linux 2.6.13: */ -DUMMY(inotify_init); /* Linux 2.6.22: */ DUMMY(signalfd); From nobody Fri Jul 4 14:56:05 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcCB2TvLz61HR9; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcC96m1Wz43Kr; Fri, 04 Jul 2025 14:56:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SSTtU/NQHl9zpjLS6HjGYq1rJy/BUFAnF/Hz56CWp5U=; b=syHqPCT0V/GOkJgFf+CEUnMfL1JKmrpkEOg4l+5xOBEMIqEe77lR2AZKETY1cM6SUY77EA 0Ys3x043HK3kQLoOGfRstCrwForGsguXmICtMmswqV7xDwYwKRA46t2BmKTQcefKjOOa+M 2R7bnzFqREv88DG7DBdKuvViKcCo6zric7lQLA0GVTiM+SrNOLVNYRmXrxsq9qoD0q8I+j dl+TYXMmQqYJH/rZLoMk8QqKZHEyiPjUzsWueZB8q0D67iRDnL4ZZq/BRjpUK/yahnd9K/ HEj1gW3EuFGmM9TFGfuHPsGoZCF1Gl+BE2bc14dUPri1ooy00Z98227PMKD2Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SSTtU/NQHl9zpjLS6HjGYq1rJy/BUFAnF/Hz56CWp5U=; b=ZwsWWTpeWE+AV90GeaOcRkExYSfz2F594xfcc8Gf28p0mP0s0tIKjvGV3D5k4n9XE4hoi1 D9dMBpZBZDSpmYdYAmw2wpHvZ5I8Y367ZystyXN3+Z1Q/hI3lVKp9OlsV2v2YR7Bx08K6f +GMJAp0JSJCd+cONRWDQA2o0T99JpAjE4I+fAzRkLC1w3yKd+5AQN5bS0ixWce5R/ZwBNY k7zN6vEZek0AyAIPUYSPDC5+mDf+cnQOJDT0SEfH9cHNndApn98gThQJD9Y7gADbh59Gl5 GW3qDxb646b6Dg+uvVBPfyiXQxZn2Bsr2Yi4w1jYFJM6q6Q4oXC2/QJ12CgBiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640965; a=rsa-sha256; cv=none; b=vtAfXqQAzKz8M44gljM4LiZvbY4YQaUL3ZPJSR0c9pXITLCc/HvHxrIkw9Ri9S50XRJNP/ IBBjtvUUfsqBDbowIUU8NxOHCpRucACzKt1zY0IZq2QgSK69vTHzGIZZlj2Vp2E3/W1yGU 0mZ4PzJ3xyFMyPKHB2b6XtTHjPi3bM6322cPNS4wP4mqb2OPLJHKebQXpmZ+kZyPFBD9k6 V0ato02YnHra+vungffJLUx6V4DEETWiKlT2DhAeM1W8Hj0ZigOJn6QNYRkoUrRmRCPHlL NmVLa0Cah+Q3urwFoOKseqQ0dA+YADYbqxyAtRtP2q/bgiuknrmRqfHXrA0Cnw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcC95XzZzvRP; Fri, 04 Jul 2025 14:56:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Eu5Bp073861; Fri, 4 Jul 2025 14:56:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Eu5rF073858; Fri, 4 Jul 2025 14:56:05 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:56:05 GMT Message-Id: <202507041456.564Eu5rF073858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d7025d3a3f17 - main - linux: Regenerate system call definitions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7025d3a3f17f3c91bc14be1a9e66722949bf915 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d7025d3a3f17f3c91bc14be1a9e66722949bf915 commit d7025d3a3f17f3c91bc14be1a9e66722949bf915 Author: Mark Johnston AuthorDate: 2025-06-06 13:25:58 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:34 +0000 linux: Regenerate system call definitions Sponsored by: Klara, Inc. --- sys/amd64/linux/linux_proto.h | 7 ++-- sys/amd64/linux/linux_sysent.c | 4 +-- sys/amd64/linux/linux_systrace_args.c | 40 +++++++++++++++++++++-- sys/amd64/linux32/linux32_proto.h | 9 ++++-- sys/amd64/linux32/linux32_sysent.c | 6 ++-- sys/amd64/linux32/linux32_systrace_args.c | 54 +++++++++++++++++++++++++++++-- sys/arm64/linux/linux_proto.h | 7 ++-- sys/arm64/linux/linux_sysent.c | 4 +-- sys/arm64/linux/linux_systrace_args.c | 40 +++++++++++++++++++++-- sys/i386/linux/linux_proto.h | 9 ++++-- sys/i386/linux/linux_sysent.c | 6 ++-- sys/i386/linux/linux_systrace_args.c | 54 +++++++++++++++++++++++++++++-- 12 files changed, 210 insertions(+), 30 deletions(-) diff --git a/sys/amd64/linux/linux_proto.h b/sys/amd64/linux/linux_proto.h index 15e1dfc1a444..f1d9c96a78d7 100644 --- a/sys/amd64/linux/linux_proto.h +++ b/sys/amd64/linux/linux_proto.h @@ -914,10 +914,13 @@ struct linux_inotify_init_args { syscallarg_t dummy; }; struct linux_inotify_add_watch_args { - syscallarg_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char mask_l_[PADL_(uint32_t)]; uint32_t mask; char mask_r_[PADR_(uint32_t)]; }; struct linux_inotify_rm_watch_args { - syscallarg_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char wd_l_[PADL_(uint32_t)]; uint32_t wd; char wd_r_[PADR_(uint32_t)]; }; struct linux_migrate_pages_args { syscallarg_t dummy; diff --git a/sys/amd64/linux/linux_sysent.c b/sys/amd64/linux/linux_sysent.c index 8413d2723551..62b50cf68a32 100644 --- a/sys/amd64/linux/linux_sysent.c +++ b/sys/amd64/linux/linux_sysent.c @@ -268,8 +268,8 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_ioprio_set_args), .sy_call = (sy_call_t *)linux_ioprio_set, .sy_auevent = AUE_SETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 251 = linux_ioprio_set */ { .sy_narg = AS(linux_ioprio_get_args), .sy_call = (sy_call_t *)linux_ioprio_get, .sy_auevent = AUE_GETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 252 = linux_ioprio_get */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_init, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 253 = linux_inotify_init */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 254 = linux_inotify_add_watch */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 255 = linux_inotify_rm_watch */ + { .sy_narg = AS(linux_inotify_add_watch_args), .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 254 = linux_inotify_add_watch */ + { .sy_narg = AS(linux_inotify_rm_watch_args), .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 255 = linux_inotify_rm_watch */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_migrate_pages, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 256 = linux_migrate_pages */ { .sy_narg = AS(linux_openat_args), .sy_call = (sy_call_t *)linux_openat, .sy_auevent = AUE_OPEN_RWTC, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 257 = linux_openat */ { .sy_narg = AS(linux_mkdirat_args), .sy_call = (sy_call_t *)linux_mkdirat, .sy_auevent = AUE_MKDIRAT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 258 = linux_mkdirat */ diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c index 20322f7a8660..1dc4de019080 100644 --- a/sys/amd64/linux/linux_systrace_args.c +++ b/sys/amd64/linux/linux_systrace_args.c @@ -1918,12 +1918,19 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_inotify_add_watch */ case 254: { - *n_args = 0; + struct linux_inotify_add_watch_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = (intptr_t)p->pathname; /* const char * */ + uarg[a++] = p->mask; /* uint32_t */ + *n_args = 3; break; } /* linux_inotify_rm_watch */ case 255: { - *n_args = 0; + struct linux_inotify_rm_watch_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = p->wd; /* uint32_t */ + *n_args = 2; break; } /* linux_migrate_pages */ @@ -5860,9 +5867,32 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_add_watch */ case 254: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_inotify_rm_watch */ case 255: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_migrate_pages */ case 256: @@ -8353,8 +8383,14 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 253: /* linux_inotify_add_watch */ case 254: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_inotify_rm_watch */ case 255: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_migrate_pages */ case 256: /* linux_openat */ diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index ab0edd99df42..57a303271f1c 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -983,10 +983,13 @@ struct linux_inotify_init_args { syscallarg_t dummy; }; struct linux_inotify_add_watch_args { - syscallarg_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char mask_l_[PADL_(uint32_t)]; uint32_t mask; char mask_r_[PADR_(uint32_t)]; }; struct linux_inotify_rm_watch_args { - syscallarg_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char wd_l_[PADL_(uint32_t)]; uint32_t wd; char wd_r_[PADR_(uint32_t)]; }; struct linux_migrate_pages_args { syscallarg_t dummy; @@ -1184,7 +1187,7 @@ struct linux_pipe2_args { char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_inotify_init1_args { - syscallarg_t dummy; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_preadv_args { char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index add9844254ce..1bc8841badf3 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -307,8 +307,8 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_ioprio_set_args), .sy_call = (sy_call_t *)linux_ioprio_set, .sy_auevent = AUE_SETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 289 = linux_ioprio_set */ { .sy_narg = AS(linux_ioprio_get_args), .sy_call = (sy_call_t *)linux_ioprio_get, .sy_auevent = AUE_GETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 290 = linux_ioprio_get */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_init, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 291 = linux_inotify_init */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 292 = linux_inotify_add_watch */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 293 = linux_inotify_rm_watch */ + { .sy_narg = AS(linux_inotify_add_watch_args), .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 292 = linux_inotify_add_watch */ + { .sy_narg = AS(linux_inotify_rm_watch_args), .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 293 = linux_inotify_rm_watch */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_migrate_pages, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 294 = linux_migrate_pages */ { .sy_narg = AS(linux_openat_args), .sy_call = (sy_call_t *)linux_openat, .sy_auevent = AUE_OPEN_RWTC, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 295 = linux_openat */ { .sy_narg = AS(linux_mkdirat_args), .sy_call = (sy_call_t *)linux_mkdirat, .sy_auevent = AUE_MKDIRAT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 296 = linux_mkdirat */ @@ -347,7 +347,7 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_epoll_create1_args), .sy_call = (sy_call_t *)linux_epoll_create1, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 329 = linux_epoll_create1 */ { .sy_narg = AS(linux_dup3_args), .sy_call = (sy_call_t *)linux_dup3, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 330 = linux_dup3 */ { .sy_narg = AS(linux_pipe2_args), .sy_call = (sy_call_t *)linux_pipe2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 331 = linux_pipe2 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_init1, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 332 = linux_inotify_init1 */ + { .sy_narg = AS(linux_inotify_init1_args), .sy_call = (sy_call_t *)linux_inotify_init1, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 332 = linux_inotify_init1 */ { .sy_narg = AS(linux_preadv_args), .sy_call = (sy_call_t *)linux_preadv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 333 = linux_preadv */ { .sy_narg = AS(linux_pwritev_args), .sy_call = (sy_call_t *)linux_pwritev, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 334 = linux_pwritev */ { .sy_narg = AS(linux_rt_tgsigqueueinfo_args), .sy_call = (sy_call_t *)linux_rt_tgsigqueueinfo, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 335 = linux_rt_tgsigqueueinfo */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 7793124e6935..cbd1641c2a34 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -2036,12 +2036,19 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_inotify_add_watch */ case 292: { - *n_args = 0; + struct linux_inotify_add_watch_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = (intptr_t)p->pathname; /* const char * */ + uarg[a++] = p->mask; /* uint32_t */ + *n_args = 3; break; } /* linux_inotify_rm_watch */ case 293: { - *n_args = 0; + struct linux_inotify_rm_watch_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = p->wd; /* uint32_t */ + *n_args = 2; break; } /* linux_migrate_pages */ @@ -2379,7 +2386,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_inotify_init1 */ case 332: { - *n_args = 0; + struct linux_inotify_init1_args *p = params; + iarg[a++] = p->flags; /* l_int */ + *n_args = 1; break; } /* linux_preadv */ @@ -6536,9 +6545,32 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_add_watch */ case 292: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_inotify_rm_watch */ case 293: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_migrate_pages */ case 294: @@ -7116,6 +7148,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_init1 */ case 332: + switch (ndx) { + case 0: + p = "l_int"; + break; + default: + break; + }; break; /* linux_preadv */ case 333: @@ -9809,8 +9848,14 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 291: /* linux_inotify_add_watch */ case 292: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_inotify_rm_watch */ case 293: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_migrate_pages */ case 294: /* linux_openat */ @@ -9982,6 +10027,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_init1 */ case 332: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_preadv */ case 333: if (ndx == 0 || ndx == 1) diff --git a/sys/arm64/linux/linux_proto.h b/sys/arm64/linux/linux_proto.h index ae3d8569df58..82f57f77ffae 100644 --- a/sys/arm64/linux/linux_proto.h +++ b/sys/arm64/linux/linux_proto.h @@ -141,10 +141,13 @@ struct linux_inotify_init1_args { char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_inotify_add_watch_args { - syscallarg_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char mask_l_[PADL_(uint32_t)]; uint32_t mask; char mask_r_[PADR_(uint32_t)]; }; struct linux_inotify_rm_watch_args { - syscallarg_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char wd_l_[PADL_(uint32_t)]; uint32_t wd; char wd_r_[PADR_(uint32_t)]; }; struct linux_ioctl_args { char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)]; diff --git a/sys/arm64/linux/linux_sysent.c b/sys/arm64/linux/linux_sysent.c index 722ada465730..e54a76cfd55e 100644 --- a/sys/arm64/linux/linux_sysent.c +++ b/sys/arm64/linux/linux_sysent.c @@ -41,8 +41,8 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_dup3_args), .sy_call = (sy_call_t *)linux_dup3, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 24 = linux_dup3 */ { .sy_narg = AS(linux_fcntl_args), .sy_call = (sy_call_t *)linux_fcntl, .sy_auevent = AUE_FCNTL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 25 = linux_fcntl */ { .sy_narg = AS(linux_inotify_init1_args), .sy_call = (sy_call_t *)linux_inotify_init1, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 26 = linux_inotify_init1 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 27 = linux_inotify_add_watch */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 28 = linux_inotify_rm_watch */ + { .sy_narg = AS(linux_inotify_add_watch_args), .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 27 = linux_inotify_add_watch */ + { .sy_narg = AS(linux_inotify_rm_watch_args), .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 28 = linux_inotify_rm_watch */ { .sy_narg = AS(linux_ioctl_args), .sy_call = (sy_call_t *)linux_ioctl, .sy_auevent = AUE_IOCTL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 29 = linux_ioctl */ { .sy_narg = AS(linux_ioprio_set_args), .sy_call = (sy_call_t *)linux_ioprio_set, .sy_auevent = AUE_SETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 30 = linux_ioprio_set */ { .sy_narg = AS(linux_ioprio_get_args), .sy_call = (sy_call_t *)linux_ioprio_get, .sy_auevent = AUE_GETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 31 = linux_ioprio_get */ diff --git a/sys/arm64/linux/linux_systrace_args.c b/sys/arm64/linux/linux_systrace_args.c index 54e4dd82355d..1b946a9406a5 100644 --- a/sys/arm64/linux/linux_systrace_args.c +++ b/sys/arm64/linux/linux_systrace_args.c @@ -210,12 +210,19 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_inotify_add_watch */ case 27: { - *n_args = 0; + struct linux_inotify_add_watch_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = (intptr_t)p->pathname; /* const char * */ + uarg[a++] = p->mask; /* uint32_t */ + *n_args = 3; break; } /* linux_inotify_rm_watch */ case 28: { - *n_args = 0; + struct linux_inotify_rm_watch_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = p->wd; /* uint32_t */ + *n_args = 2; break; } /* linux_ioctl */ @@ -2780,9 +2787,32 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_add_watch */ case 27: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_inotify_rm_watch */ case 28: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_ioctl */ case 29: @@ -6455,8 +6485,14 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_add_watch */ case 27: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_inotify_rm_watch */ case 28: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_ioctl */ case 29: if (ndx == 0 || ndx == 1) diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index aa2dfbb68745..49f002a633d2 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -981,10 +981,13 @@ struct linux_inotify_init_args { syscallarg_t dummy; }; struct linux_inotify_add_watch_args { - syscallarg_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char mask_l_[PADL_(uint32_t)]; uint32_t mask; char mask_r_[PADR_(uint32_t)]; }; struct linux_inotify_rm_watch_args { - syscallarg_t dummy; + char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)]; + char wd_l_[PADL_(uint32_t)]; uint32_t wd; char wd_r_[PADR_(uint32_t)]; }; struct linux_migrate_pages_args { syscallarg_t dummy; @@ -1178,7 +1181,7 @@ struct linux_pipe2_args { char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_inotify_init1_args { - syscallarg_t dummy; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_preadv_args { char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)]; diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 7be646f34144..b8893008944b 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -306,8 +306,8 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_ioprio_set_args), .sy_call = (sy_call_t *)linux_ioprio_set, .sy_auevent = AUE_SETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 289 = linux_ioprio_set */ { .sy_narg = AS(linux_ioprio_get_args), .sy_call = (sy_call_t *)linux_ioprio_get, .sy_auevent = AUE_GETPRIORITY, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 290 = linux_ioprio_get */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_init, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 291 = linux_inotify_init */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 292 = linux_inotify_add_watch */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 293 = linux_inotify_rm_watch */ + { .sy_narg = AS(linux_inotify_add_watch_args), .sy_call = (sy_call_t *)linux_inotify_add_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 292 = linux_inotify_add_watch */ + { .sy_narg = AS(linux_inotify_rm_watch_args), .sy_call = (sy_call_t *)linux_inotify_rm_watch, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 293 = linux_inotify_rm_watch */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_migrate_pages, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 294 = linux_migrate_pages */ { .sy_narg = AS(linux_openat_args), .sy_call = (sy_call_t *)linux_openat, .sy_auevent = AUE_OPEN_RWTC, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 295 = linux_openat */ { .sy_narg = AS(linux_mkdirat_args), .sy_call = (sy_call_t *)linux_mkdirat, .sy_auevent = AUE_MKDIRAT, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 296 = linux_mkdirat */ @@ -346,7 +346,7 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_epoll_create1_args), .sy_call = (sy_call_t *)linux_epoll_create1, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 329 = linux_epoll_create1 */ { .sy_narg = AS(linux_dup3_args), .sy_call = (sy_call_t *)linux_dup3, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 330 = linux_dup3 */ { .sy_narg = AS(linux_pipe2_args), .sy_call = (sy_call_t *)linux_pipe2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 331 = linux_pipe2 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_inotify_init1, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 332 = linux_inotify_init1 */ + { .sy_narg = AS(linux_inotify_init1_args), .sy_call = (sy_call_t *)linux_inotify_init1, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 332 = linux_inotify_init1 */ { .sy_narg = AS(linux_preadv_args), .sy_call = (sy_call_t *)linux_preadv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 333 = linux_preadv */ { .sy_narg = AS(linux_pwritev_args), .sy_call = (sy_call_t *)linux_pwritev, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 334 = linux_pwritev */ { .sy_narg = AS(linux_rt_tgsigqueueinfo_args), .sy_call = (sy_call_t *)linux_rt_tgsigqueueinfo, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 335 = linux_rt_tgsigqueueinfo */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index f3e3c32a2bbf..563d1a795ae1 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -2071,12 +2071,19 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_inotify_add_watch */ case 292: { - *n_args = 0; + struct linux_inotify_add_watch_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = (intptr_t)p->pathname; /* const char * */ + uarg[a++] = p->mask; /* uint32_t */ + *n_args = 3; break; } /* linux_inotify_rm_watch */ case 293: { - *n_args = 0; + struct linux_inotify_rm_watch_args *p = params; + iarg[a++] = p->fd; /* l_int */ + uarg[a++] = p->wd; /* uint32_t */ + *n_args = 2; break; } /* linux_migrate_pages */ @@ -2410,7 +2417,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_inotify_init1 */ case 332: { - *n_args = 0; + struct linux_inotify_init1_args *p = params; + iarg[a++] = p->flags; /* l_int */ + *n_args = 1; break; } /* linux_preadv */ @@ -6604,9 +6613,32 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_add_watch */ case 292: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_inotify_rm_watch */ case 293: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "uint32_t"; + break; + default: + break; + }; break; /* linux_migrate_pages */ case 294: @@ -7172,6 +7204,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_init1 */ case 332: + switch (ndx) { + case 0: + p = "l_int"; + break; + default: + break; + }; break; /* linux_preadv */ case 333: @@ -9889,8 +9928,14 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 291: /* linux_inotify_add_watch */ case 292: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_inotify_rm_watch */ case 293: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_migrate_pages */ case 294: /* linux_openat */ @@ -10062,6 +10107,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_inotify_init1 */ case 332: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_preadv */ case 333: if (ndx == 0 || ndx == 1) From nobody Fri Jul 4 14:56:07 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcCD3h1Jz61HLp; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcCD1JVFz436T; Fri, 04 Jul 2025 14:56:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ivBG9jyMZKWMPaaELExpzW5S4h/xnKqc5Snj3CbHbGo=; b=qwOEadvOqimezz1YJi4eCRoI8yzjqL7GLD3CnNRkkZTcK8OfQ8t4Ej+v7pI4n2XbZL+K6l bPfOVR+YWQzIqRsV4XT+C7R1u8TPy2MDSLGNsi5J/EfsKOWbC861/nDGKZxmYGkTkReIUg yPz1T5jJAREoIGu4ffEzP+wRORXA+jYB6r+hIE49gE8GBwtzHdcKG2zkmVaXV/zn5z5fJk 9OmtVoD1Be13jmIRSddeIrbdmiWkHIgrAo7KGhiObUQHfcDQyFyMhzEWusrotgocxn6K5v GV3N0iqRodtCxyD8Ao8ERCH4c3TK3W8ZDuUf6G6SEf5swoYDRUUvvEOQMtGlAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ivBG9jyMZKWMPaaELExpzW5S4h/xnKqc5Snj3CbHbGo=; b=KhEAuhKoZg7WN9BR1y0WZnbn8XzZKRPQeA++Kir0MrH7IaK7yMvkSePMmpfkBuOUho0/7r 98aBT9ieUkVYDqYZRWRIgaiydP0AN/at2ip8FaBuBRjNkQk8MqnxqUzH0SuTTv2g1G9Zm2 /O2Uqa1pAZxuhwmqMqwXMqMEhPWd5NJllixgLJOtYkxd+3wqfXKx2f4yo6cnZOXHmjgqYF GfPNkEunIJJsKxmAeBMI8mbyU+T4SqJMQsOqNv4NzZC1up0YnM/A6JZ0Zb/tnVuzRilx6U dNyrb7wdxfoZ1glqqDCxekXA53idVpe11Qxg2NC5ZTlSfh/xsgZV3NCxW+uzQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640968; a=rsa-sha256; cv=none; b=Qy+YFSwQT5HxtEPDDUD6o9x0D8BvTIQHF3zl9Y1UfQb68hMzJ/PatShDq14Oa3lQafjqAl GoHo27TP2LtzsAbkE6thczh36nnxdReMMIFqEoMkvY5C2omHb2o1co/iGc9WA3x8OugR5J GWVqL+YldR2/NeopmeG4Ysuhw6yCkRpBIfWezh4yhH4pgLXQDTRPYEQjQ6lqB0x78t0EbT p8Q6WhGkDlAFBgDjMcmmx66OQChEe5Ez1hZrcCDpV+Fwu7BLOrgDrRjV76iIGBwUUdxO2i qkxWqP9yY2gaMnTwzFk03OxsVWbZt8e4RyZkxwDAMjPlFBGnLG47wVWqEde65g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcCD0CFGzvm2; Fri, 04 Jul 2025 14:56:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Eu79U073928; Fri, 4 Jul 2025 14:56:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Eu76S073925; Fri, 4 Jul 2025 14:56:07 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:56:07 GMT Message-Id: <202507041456.564Eu76S073925@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f56e0d4755c5 - main - procstat: Add handling for inotify descriptors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f56e0d4755c521b50bf313a85fd399c2b6a7a4bb Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f56e0d4755c521b50bf313a85fd399c2b6a7a4bb commit f56e0d4755c521b50bf313a85fd399c2b6a7a4bb Author: Mark Johnston AuthorDate: 2025-06-09 20:11:08 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:34 +0000 procstat: Add handling for inotify descriptors MFC after: 3 months Sponsored by: Klara, Inc. --- usr.bin/procstat/procstat.1 | 3 +++ usr.bin/procstat/procstat_files.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/usr.bin/procstat/procstat.1 b/usr.bin/procstat/procstat.1 index cc775ffe133b..1e05e235e619 100644 --- a/usr.bin/procstat/procstat.1 +++ b/usr.bin/procstat/procstat.1 @@ -377,6 +377,8 @@ eventfd fifo .It h shared memory +.It i +inotify descriptor .It k kqueue .It m @@ -862,6 +864,7 @@ procstat: procstat_getprocs() .Xr sockstat 1 , .Xr cap_enter 2 , .Xr cap_rights_limit 2 , +.Xr inotify 2 , .Xr mlock 2 , .Xr mlockall 2 , .Xr libprocstat 3 , diff --git a/usr.bin/procstat/procstat_files.c b/usr.bin/procstat/procstat_files.c index d61cf1693053..aa4850632aa7 100644 --- a/usr.bin/procstat/procstat_files.c +++ b/usr.bin/procstat/procstat_files.c @@ -226,6 +226,10 @@ static struct cap_desc { { CAP_BINDAT, "ba" }, { CAP_CONNECTAT, "ca" }, + /* Inotify descriptor rights. */ + { CAP_INOTIFY_ADD, "ina" }, + { CAP_INOTIFY_RM, "inr" }, + /* Aliases and defines that combine multiple rights. */ { CAP_PREAD, "prd" }, { CAP_PWRITE, "pwr" }, @@ -416,6 +420,11 @@ procstat_files(struct procstat *procstat, struct kinfo_proc *kipp) xo_emit("{eq:fd_type/eventfd}"); break; + case PS_FST_TYPE_INOTIFY: + str = "i"; + xo_emit("{eq:fd_type/inotify}"); + break; + case PS_FST_TYPE_NONE: str = "?"; xo_emit("{eq:fd_type/none}"); From nobody Fri Jul 4 14:56:06 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcCC1xJbz61HTW; Fri, 04 Jul 2025 14:56: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcCB6qktz43Fl; Fri, 04 Jul 2025 14:56:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8b4MrGTsYo6XEUE/fWhy/+ahGqivc3c57ZEHXHsOyHo=; b=I2LMaLj7LFGygMtFGUa+2Xbnsgn7s7gYo766uQk0z/h7AFYGXLaG5ynUCdGOcXthCIqJwR q+YWsI2VSF67vSejceWg2gSDKYFR5+N38+VXQ2u9pK7JZSuY4J1oF9asF5tepP9VnKg8Do xAl1EsuFVU16sIhce6g4b9wxWr2nQF++VAKJKttIdlb+1pH8GvC3cg81vG9rofts454u+d 3eVjBPp/rPMuowdWxATs+xBkJK8zwCx8P0m5ShtDQgch5Bt0aR8eyUhoVL0Dv44H5moP+r Xj8vPVNG2YfOg2X4LwtdieVngCXukfjJxI0SFzgdjRvVosAHt3j4IxXXrhLwlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751640967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8b4MrGTsYo6XEUE/fWhy/+ahGqivc3c57ZEHXHsOyHo=; b=RVp4a6riVtGXbxn9BUIO+DRvxHRCnCyd/JzaOU2k80AWh5TsJ0mOJzOd+rkbzodpOaW+5d jEtvGmEkebn139rWedgoYn6e3LgyESG6RxaB6QPgCgbLAFT94N7wBbDNVQHowbSE24rMJU Y3xtQERwJAc2vYbgLkq3gVmIgEWscgcQQd5eSZZKaxESGJ85ZFqw/ewonoyq9U5w6SFTJC 2dAtkmOaWk5qKhhhOvZ+PfadmYOLXuM/0t8AYaqPuVJokTQgQgO+U5Nck7GTTWakRcIDoi 2EyZoANlPD2iwQEE+IE5zVDfsLG9VHI63NduzpybEXP6aqdZ7RMf6xEUhhK+1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751640967; a=rsa-sha256; cv=none; b=ZAkGorcdtVm7aTqAwWfKs8SNBk1RlOFr1XWDkR99t5OgOjtVTvfXczADQGXlsZPu1yPgix O2D+Rylw5XgGAhygxmEAZVsveLW6yn1MGH0uLHIL6braqur3c1fZmNca8DRpH5Y/Nl4MFW zZq3PbQgMaMOP+iSr6v8ckfvq2V+L0JdU0x0eZUpAPbqgoXQ+OhDIPOBuyaB9zk2YehJdI 3I+7c1HLBxfaQcjlWPDGfxL3/z4O/cfE5dYQmRE0S87TDacF1W81YHsYn992f1pbyF4mlE cfgMyW9+gPrGhbrcLduD4OC64pUvfFxGQHdiVtv7DXI84MBah2/n5c5XDPgKjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcCB6JTvzvXR; Fri, 04 Jul 2025 14:56:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564Eu6J6073894; Fri, 4 Jul 2025 14:56:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564Eu6JI073891; Fri, 4 Jul 2025 14:56:06 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:56:06 GMT Message-Id: <202507041456.564Eu6JI073891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 79102e108099 - main - libprocstat: Add handling for inotify descriptors List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 79102e108099237b1d702e960706a739c7b071bd Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=79102e108099237b1d702e960706a739c7b071bd commit 79102e108099237b1d702e960706a739c7b071bd Author: Mark Johnston AuthorDate: 2025-06-09 20:03:08 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 14:42:34 +0000 libprocstat: Add handling for inotify descriptors MFC after: 3 months Sponsored by: Klara, Inc. --- lib/libprocstat/libprocstat.c | 5 +++++ lib/libprocstat/libprocstat.h | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 29f464ef6414..eb8137f6c76f 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -625,6 +625,10 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap type = PS_FST_TYPE_EVENTFD; data = file.f_data; break; + case DTYPE_INOTIFY: + type = PS_FST_TYPE_INOTIFY; + data = file.f_data; + break; default: continue; } @@ -717,6 +721,7 @@ kinfo_type2fst(int kftype) { KF_TYPE_SOCKET, PS_FST_TYPE_SOCKET }, { KF_TYPE_VNODE, PS_FST_TYPE_VNODE }, { KF_TYPE_EVENTFD, PS_FST_TYPE_EVENTFD }, + { KF_TYPE_INOTIFY, PS_FST_TYPE_INOTIFY }, { KF_TYPE_UNKNOWN, PS_FST_TYPE_UNKNOWN } }; #define NKFTYPES (sizeof(kftypes2fst) / sizeof(*kftypes2fst)) diff --git a/lib/libprocstat/libprocstat.h b/lib/libprocstat/libprocstat.h index 0e9a4214414c..548747f90171 100644 --- a/lib/libprocstat/libprocstat.h +++ b/lib/libprocstat/libprocstat.h @@ -71,6 +71,7 @@ #define PS_FST_TYPE_PROCDESC 13 #define PS_FST_TYPE_DEV 14 #define PS_FST_TYPE_EVENTFD 15 +#define PS_FST_TYPE_INOTIFY 16 /* * Special descriptor numbers. From nobody Fri Jul 4 15:13:58 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcbp3tfhz61KMs; Fri, 04 Jul 2025 15:13: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcbp38lMz3Fg4; Fri, 04 Jul 2025 15:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rb5NGpN3ZYRXe5e8NPv7CKYfMIqdtJurq12DCyR+MVU=; b=No1ulWtTlNymgmvoxmHzRNG1kMuZaRU9myFLH58CzKnjms0RtmRIyLOPEoPbF845rbvPOy hYutJmjfFELz5kjCYEqenep6jmsojoSF+EwcgWW0D2TjpOf4u/fH1/T0JpnpP4yUePCKH/ elldWHI0pzjqSLkPkqlMqtkKla86fCkqH4AXr+txQ5Y/uSa2Kw3Wak5V8KXjhDopj0e0bS VyA6FDGjv8n8tjOgu11mktdb1km8rd5WGvX4Ev4eb1mswEnB5u4ONOMLa7wbrNOETO0emI nb7gy47dZ3AfDV2dnxUDAVKQwiZ0S/9oLbQmwT8TcPjY/AQLt8I3wV4XRAT2nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rb5NGpN3ZYRXe5e8NPv7CKYfMIqdtJurq12DCyR+MVU=; b=uMpNNgdIZTyXpO2hjxtfNWKfSDg8u0rlYj5p3HU4IXjQqAxGLSiC783S3TJ2Grg2Jp0GEi OFZIShiX6VQ3UKkkutlj5zV5nEkFqUlJBczA0O0mHE6xWP5/6g8tJiChVo6D7MeAzD47Ei 7+r6gkb6fLx2rR19os3J8ij3RpbySGP3uphV6cgzhXjFAJXCc7fXLhAYdRcbcXMlwCARYh HlrjMrsKnEN+JP1j0L5IlNA/3VIBeHGIVZ1G6jmlE9ldO2kHZG3zEADfBkHsxS8Y3KC5/O Jqm3g0OX+KOO1NzaDkNKyA0Nzw/B5obqjWYHKHHb+5qkUUsesi/UUSttbfypwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751642038; a=rsa-sha256; cv=none; b=VIwUiU98NH10ygtwnMPWHiE1H1I+lHgkk6zvpwyDE4CbtQQJhxh8HITfhnMUAW7+GkTE0q X5jCOTHidKWZSNpwHHm46ifAviDCV5BYn00Jgo7EYrsVX5L7VI349ES1p2SCYaJtPq5Xcg 8fHmMPwkk0DsNZXu2euazP2OTKmg0WzJdd4ZIVa3XwZmm3ZGP7cbBVWxkI5k5nhmti6wg6 W/GjCEI5OX8hH2ym8VH9wM7Lj0tUc1qSQVtPJMRZr6Hqv7BAQdg+tHm9Ry5Su/gZz2E9Qp 2XnUR0RIZ/PxdA+Ofdrrom9M3TRKZnOw1+hy13NuWpa4h/9mX8Ji5HeJH1E6Eg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcbp2YJjzvYh; Fri, 04 Jul 2025 15:13:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564FDwwO011499; Fri, 4 Jul 2025 15:13:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564FDwxH011496; Fri, 4 Jul 2025 15:13:58 GMT (envelope-from git) Date: Fri, 4 Jul 2025 15:13:58 GMT Message-Id: <202507041513.564FDwxH011496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f9cf745a5084 - main - RELNOTES: Document the addition of inotify List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9cf745a5084dc0a38733db8e774252e4ed2f444 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9cf745a5084dc0a38733db8e774252e4ed2f444 commit f9cf745a5084dc0a38733db8e774252e4ed2f444 Author: Mark Johnston AuthorDate: 2025-07-04 15:13:43 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 15:13:43 +0000 RELNOTES: Document the addition of inotify --- RELNOTES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELNOTES b/RELNOTES index 4933c8392552..09696a37998b 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,9 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +f1f230439fa4: + FreeBSD now implements the inotify(2) family of system calls. + 50e733f19b37, 171f66b0c2ca: These commits helped improve utilization of NFSv4.1/4.2 delegations. The changes are only used when the NFSv4 From nobody Fri Jul 4 15:23:49 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcqB1FJZz61LkZ; Fri, 04 Jul 2025 15:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcq96Fjyz3KLs; Fri, 04 Jul 2025 15:23:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mNh5IJdrGb/mceIMmKvHLA4uFgRezxHGUYldyiIvpFg=; b=GfXUO8B9km7ErKa7o2SI+kPhyYgUeGVO/L4+zk1tDWl14FNwwY1+JPabOLWxz8VxtcBVHt t+9KGiTCTXUjEFLCVo4C/Vs1h20dQsKVk0e/p3DkGcaCZ3mTBfOoUKWCX7VhFMzszELJW0 Yk3IQxhcNlH+L3V0zOH2rgH0/V7CaDXLgSBW1UpOs2aaubff2UKajlYTmmJcki9nQGr/x3 VLvABdPbEaFaDDYRb4xqOLeTz14cHkz9YyX8IgQQhmtbVGrOMo/gphiO99Xw5L6JYYcv1Q dti31iuW1IXCI/rr1ut970QwFEp7OVzelpOd3DpoMdMh4HkKS+8Tnh8fouSBBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mNh5IJdrGb/mceIMmKvHLA4uFgRezxHGUYldyiIvpFg=; b=IK25G7L5i+hL/ZRsRKc8og7ygYbaipdalEgW9UX10SqE4wUZBuqMQxttUR0Fy4WDxBSDYG 2mzUKl3i6FdV6lFMZUhWSIlEF9Ja9o6QpVGGaRCPzgCWPVEXuXct+QwVScWjPMqRGjcXu0 mu4ntc8+d/iXCK1vzBylvVbPYJP+Nc0Uegl5v0zNR9Kpkpr8F8miOXDyYMc871eHGHURrd k043q2rGPlpmuhPiDhPnbBuBHW4mthjf1JTadfzi/9xoIOIGQCB4Wcf1+sv2qUqSMgV6F8 veGjfZpY1n+feztVCBpykGRpVcT6wrti22P/Io9piBUq/hdJukWps2kmchQhNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751642629; a=rsa-sha256; cv=none; b=fcWGJC6sjIHHwXueCFd2DVUPu311XoWcrm/JhsGQINIuYtmGKF8fY4tcjeKcdK//fJGztN BOf31UvRIkwAlkOIK+NGop7FlSqL0JsMFYRpc4YxpRi+WDNFmBhv6G0krUotF4qlUQ504j jmFWDqy9ODTttbKrwqMj9sA9OAjI+QS7h4nq1DLz+10IOGe6f4wU6fNnwYmV9Q2z4n8uPq 6KV0FL54zPGt0EHdNuN2MktOkQlP3tIBx4WkyladoI4SvfEmRJjlP3pKLRFOYlniZbmc7H 27ybStWqR0gcSPFlfxFl1cbkVhafTNJzNApZ+RkjoPQ7iQd5A8CeXDPGpE31PA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcq957qVzw5x; Fri, 04 Jul 2025 15:23:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564FNnp6030007; Fri, 4 Jul 2025 15:23:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564FNnnF030004; Fri, 4 Jul 2025 15:23:49 GMT (envelope-from git) Date: Fri, 4 Jul 2025 15:23:49 GMT Message-Id: <202507041523.564FNnnF030004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ef6ea91593eb - main - VOP_RENAME: add mp-global lock List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef6ea91593ebff73e2fc201efd9f848b71c5a125 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ef6ea91593ebff73e2fc201efd9f848b71c5a125 commit ef6ea91593ebff73e2fc201efd9f848b71c5a125 Author: Konstantin Belousov AuthorDate: 2025-06-02 07:05:06 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 15:23:42 +0000 VOP_RENAME: add mp-global lock It is before all vnode locks, but after vn_start_write(). The lock prevents parallel rename operations on the same mount point, which should in (near future) simplify a lot of code in VFS/fs that otherwise need to code with either the changing hierarchy, or with the lock order for vnodes due to changed hierarchy. On renames, the lock is taken on the lowest stacked filesystem. Otherwise rename could still occur in parallel, by performing one of op on the lower fs. Proposed by: mjg (long time ago) Reviewed by: markj, olce Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50648 --- sys/kern/vfs_mount.c | 2 ++ sys/kern/vfs_subr.c | 7 +++++++ sys/kern/vfs_syscalls.c | 20 +++++++++++++++++++- sys/sys/mount.h | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index cb18468d28bc..8e64a7fe966b 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -156,6 +156,7 @@ mount_init(void *mem, int size, int flags) mtx_init(&mp->mnt_mtx, "struct mount mtx", NULL, MTX_DEF); mtx_init(&mp->mnt_listmtx, "struct mount vlist mtx", NULL, MTX_DEF); lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0); + lockinit(&mp->mnt_renamelock, PVFS, "rename", 0, 0); mp->mnt_pcpu = uma_zalloc_pcpu(pcpu_zone_16, M_WAITOK | M_ZERO); mp->mnt_ref = 0; mp->mnt_vfs_ops = 1; @@ -170,6 +171,7 @@ mount_fini(void *mem, int size) mp = (struct mount *)mem; uma_zfree_pcpu(pcpu_zone_16, mp->mnt_pcpu); + lockdestroy(&mp->mnt_renamelock); lockdestroy(&mp->mnt_explock); mtx_destroy(&mp->mnt_listmtx); mtx_destroy(&mp->mnt_mtx); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 877931721da4..918b256e6c59 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -5853,6 +5853,8 @@ vop_rename_pre(void *ap) struct vop_rename_args *a = ap; #ifdef DEBUG_VFS_LOCKS + struct mount *tmp; + if (a->a_tvp) ASSERT_VI_UNLOCKED(a->a_tvp, "VOP_RENAME"); ASSERT_VI_UNLOCKED(a->a_tdvp, "VOP_RENAME"); @@ -5870,6 +5872,11 @@ vop_rename_pre(void *ap) if (a->a_tvp) ASSERT_VOP_LOCKED(a->a_tvp, "vop_rename: tvp not locked"); ASSERT_VOP_LOCKED(a->a_tdvp, "vop_rename: tdvp not locked"); + + tmp = NULL; + VOP_GETWRITEMOUNT(a->a_tdvp, &tmp); + lockmgr_assert(&tmp->mnt_renamelock, KA_XLOCKED); + vfs_rel(tmp); #endif /* * It may be tempting to add vn_seqc_write_begin/end calls here and diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c236f241bf20..d880733cbfe7 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3766,7 +3766,7 @@ int kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, const char *new, enum uio_seg pathseg) { - struct mount *mp = NULL; + struct mount *mp, *tmp; struct vnode *tvp, *fvp, *tdvp; struct nameidata fromnd, tond; uint64_t tondflags; @@ -3774,6 +3774,7 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, short irflag; again: + tmp = mp = NULL; bwillwrite(); #ifdef MAC if (mac_vnode_check_rename_from_enabled()) { @@ -3809,6 +3810,7 @@ again: tvp = tond.ni_vp; error = vn_start_write(fvp, &mp, V_NOWAIT); if (error != 0) { +again1: NDFREE_PNBUF(&fromnd); NDFREE_PNBUF(&tond); if (tvp != NULL) @@ -3819,11 +3821,25 @@ again: vput(tdvp); vrele(fromnd.ni_dvp); vrele(fvp); + if (tmp != NULL) { + lockmgr(&tmp->mnt_renamelock, LK_EXCLUSIVE, NULL); + lockmgr(&tmp->mnt_renamelock, LK_RELEASE, NULL); + vfs_rel(tmp); + tmp = NULL; + } error = vn_start_write(NULL, &mp, V_XSLEEP | V_PCATCH); if (error != 0) return (error); goto again; } + error = VOP_GETWRITEMOUNT(tdvp, &tmp); + if (error != 0 || tmp == NULL) + goto again1; + error = lockmgr(&tmp->mnt_renamelock, LK_EXCLUSIVE | LK_NOWAIT, NULL); + if (error != 0) { + vn_finished_write(mp); + goto again1; + } irflag = vn_irflag_read(fvp); if (((irflag & VIRF_NAMEDATTR) != 0 && tdvp != fromnd.ni_dvp) || (irflag & VIRF_NAMEDDIR) != 0) { @@ -3884,6 +3900,8 @@ out: vrele(fromnd.ni_dvp); vrele(fvp); } + lockmgr(&tmp->mnt_renamelock, LK_RELEASE, 0); + vfs_rel(tmp); vn_finished_write(mp); out1: if (error == ERESTART) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index a6f858e02395..f6480b173a5c 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -267,6 +267,7 @@ struct mount { int mnt_lazyvnodelistsize; /* (l) # of lazy vnodes */ int mnt_upper_pending; /* (i) # of pending ops on mnt_uppers */ struct lock mnt_explock; /* vfs_export walkers lock */ + struct lock mnt_renamelock; /* renames and O_RESOLVE_BENEATH */ TAILQ_HEAD(, mount_upper_node) mnt_uppers; /* (i) upper mounts over us */ TAILQ_HEAD(, mount_upper_node) mnt_notify; /* (i) upper mounts for notification */ STAILQ_ENTRY(mount) mnt_taskqueue_link; /* (d) our place in deferred unmount list */ From nobody Fri Jul 4 15:23:50 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcqC5F0Hz61LqX; Fri, 04 Jul 2025 15:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcqB6zYFz3Khd; Fri, 04 Jul 2025 15:23:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5/RA4lDLs8PhSZpmeL13233TYi3ehJ1HvVQOBCqRmzg=; b=o752DWnfcmFDJtj39E92DGqepRjjWAH9ILwnuS9sj2JX2wp/EQ/sK02Imn/qBeRmLobddO 8VTGHwI2e5pJpHTl02gg/b46geFSDvCUokNlvzYztH/Ea32Ez2O1vwDYerwEnD61ETyPTs TZKjS2Rs5kbwOmf0r6TX3WolzYyIlyYLc2tbqdkjMGLliKFbSRapHF9AOBTRetu/JaJVUk Fzk8DgLR5nnsDfN+XU9H5UQkrQLqWiwefHYu3z6g7Xw302xdmOjWHxr00ZBgG+AFd0B6JX uit3ScTx92DYHxtFh0o0CasUWFMiA28TrHh2UNHNvcC/c8j5QfdMmVgtEcsvuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5/RA4lDLs8PhSZpmeL13233TYi3ehJ1HvVQOBCqRmzg=; b=XSqeUjLowHSPxRPiLOobA6CWuHYTolJ9z6I9jdcWqLtIpmXy+qA7aHGzt/r27giVo33juH QzNZOAXuHkra2eSZ1UybOYF9nGhxpJ6anMKpp+zBiAFvGulU1oiDIA0d4HaJj8L62q5wXT 5xVdBMf14i+Y4WYAyw7ciUyC6/FuBAv/KCZ7sCnV/OdhsYnIlX05oFMxu0TD77TdphQNG8 ZeFqSpJOs6TfVVOy8LTSd56dXJYwK6YbiRSGIkst/H9PY/voT0GmVyOwdhHUct6GVZlipx qD8gwVZUG3L9hglpY0qdD/N+QN/rfYEqb1yU5YJEs/YUykflbbM0g40wjFQhNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751642631; a=rsa-sha256; cv=none; b=g43iZd2EhfSjWc/CHDl2sUZD7249FF9dBtNKAUCiCQY9hi0AVEFSSWCiIRD7TOpC1TeTEx dtIlcwuX9Kc36UcavE9rs/faxT1Gyd8+vwt0h5xgsbHnF+dZ/lJNk01+WahlAXZRKvQ7I7 xl4HveqgHtYUPml0lrsDAAYI1BZlqtsr04n/IEVeOEspWpk1pQvVmoIJSEtip7hqp4I3ny 7A4Ep4tQ4BPdjL10YXXcJJ6PCaSG4sBL3hEukENLbnvs5XGwKfGKhu2RM46AZnjnLUJx1d NQuibeVLFeCL8lOgsg/WeUOTGcjluQEw0wKQ8AJfy/XZdRrsRO1FiEjz6whERQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcqB65mqzwVr; Fri, 04 Jul 2025 15:23:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564FNood030042; Fri, 4 Jul 2025 15:23:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564FNoYR030039; Fri, 4 Jul 2025 15:23:50 GMT (envelope-from git) Date: Fri, 4 Jul 2025 15:23:50 GMT Message-Id: <202507041523.564FNoYR030039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2c17429915f2 - main - ufs: remove um_checkpath_lock List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c17429915f2e527d456600a9a2f30c528d1a305 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2c17429915f2e527d456600a9a2f30c528d1a305 commit 2c17429915f2e527d456600a9a2f30c528d1a305 Author: Konstantin Belousov AuthorDate: 2025-06-02 07:05:33 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 15:23:42 +0000 ufs: remove um_checkpath_lock It's guarantee is provided by the global rename lock now. Reviewed by: markj, olce Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50648 --- sys/ufs/ffs/ffs_vfsops.c | 3 --- sys/ufs/ufs/ufs_lookup.c | 1 - sys/ufs/ufs/ufs_vnops.c | 18 ++---------------- sys/ufs/ufs/ufsmount.h | 2 -- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 891e490a7031..75f5fe716c31 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1012,7 +1012,6 @@ ffs_mountfs(struct vnode *odevvp, struct mount *mp, struct thread *td) else ump->um_check_blkno = NULL; mtx_init(UFS_MTX(ump), "FFS", "FFS Lock", MTX_DEF); - sx_init(&ump->um_checkpath_lock, "uchpth"); fs->fs_ronly = ronly; fs->fs_active = NULL; mp->mnt_data = ump; @@ -1182,7 +1181,6 @@ out: } if (ump != NULL) { mtx_destroy(UFS_MTX(ump)); - sx_destroy(&ump->um_checkpath_lock); if (mp->mnt_gjprovider != NULL) { free(mp->mnt_gjprovider, M_UFSMNT); mp->mnt_gjprovider = NULL; @@ -1306,7 +1304,6 @@ ffs_unmount(struct mount *mp, int mntflags) vrele(ump->um_odevvp); dev_rel(ump->um_dev); mtx_destroy(UFS_MTX(ump)); - sx_destroy(&ump->um_checkpath_lock); if (mp->mnt_gjprovider != NULL) { free(mp->mnt_gjprovider, M_UFSMNT); mp->mnt_gjprovider = NULL; diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index eaf37c58756b..3f9c95e934fc 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -1412,7 +1412,6 @@ ufs_checkpath(ino_t source_ino, ino_t parent_ino, struct inode *target, vp = tvp = ITOV(target); mp = vp->v_mount; *wait_ino = 0; - sx_assert(&VFSTOUFS(mp)->um_checkpath_lock, SA_XLOCKED); if (target->i_number == source_ino) return (EEXIST); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 9aea01e70951..74cb094bdfe4 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1273,9 +1273,9 @@ ufs_rename( struct mount *mp; ino_t ino; seqc_t fdvp_s, fvp_s, tdvp_s, tvp_s; - bool checkpath_locked, want_seqc_end; + bool want_seqc_end; - checkpath_locked = want_seqc_end = false; + want_seqc_end = false; endoff = 0; mp = tdvp->v_mount; @@ -1427,10 +1427,6 @@ relock: } vfs_ref(mp); MPASS(!want_seqc_end); - if (checkpath_locked) { - sx_xunlock(&VFSTOUFS(mp)->um_checkpath_lock); - checkpath_locked = false; - } VOP_UNLOCK(fdvp); VOP_UNLOCK(fvp); vref(tdvp); @@ -1484,8 +1480,6 @@ relock: if (error) goto unlockout; - sx_xlock(&VFSTOUFS(mp)->um_checkpath_lock); - checkpath_locked = true; error = ufs_checkpath(ino, fdp->i_number, tdp, tcnp->cn_cred, &ino); /* @@ -1493,8 +1487,6 @@ relock: * everything else and VGET before restarting. */ if (ino) { - sx_xunlock(&VFSTOUFS(mp)->um_checkpath_lock); - checkpath_locked = false; VOP_UNLOCK(fdvp); VOP_UNLOCK(fvp); VOP_UNLOCK(tdvp); @@ -1574,9 +1566,6 @@ relock: vn_seqc_write_end(fdvp); want_seqc_end = false; vfs_ref(mp); - MPASS(checkpath_locked); - sx_xunlock(&VFSTOUFS(mp)->um_checkpath_lock); - checkpath_locked = false; VOP_UNLOCK(fdvp); VOP_UNLOCK(fvp); vref(tdvp); @@ -1763,9 +1752,6 @@ unlockout: vn_seqc_write_end(fdvp); } - if (checkpath_locked) - sx_xunlock(&VFSTOUFS(mp)->um_checkpath_lock); - vput(fdvp); vput(fvp); diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h index 5c7fa11dae6a..d33b01e4425e 100644 --- a/sys/ufs/ufs/ufsmount.h +++ b/sys/ufs/ufs/ufsmount.h @@ -97,8 +97,6 @@ struct ufsmount { uint64_t um_maxsymlinklen; /* (c) max size of short symlink */ struct mtx um_lock; /* (c) Protects ufsmount & fs */ - struct sx um_checkpath_lock; /* (c) Protects ufs_checkpath() - result */ struct mount_softdeps *um_softdep; /* (c) softdep mgmt structure */ struct vnode *um_quotas[MAXQUOTAS]; /* (q) pointer to quota files */ struct ucred *um_cred[MAXQUOTAS]; /* (q) quota file access cred */ From nobody Fri Jul 4 15:23:51 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcqD4dCyz61Lkc; Fri, 04 Jul 2025 15:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcqD0Qmgz3KWh; Fri, 04 Jul 2025 15:23:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4YzqdVGfpbxoGpD6jAZXaYkEYTpVWYVRBIy8DWrW0UI=; b=gOtcGIfTnZ1osHM2qPNHM5u7XacZPY8KZV6S8pXGD80hAhhKZdjNoFCxNXcymX6OkGHPkt SYUToWNN3eZjQIHX49niORB+A6tTArnhVeFglr1PqIy/zgKBuTJWYl3kROoWCqJAOq47+C fhaLE0Y7RdCNc9G9pW7rX7KTpin3rXioLW/sWfkShf76JheHdjGBzPP6VKHL4hK5v39Nn3 ijyryGEuPpVXJwi+QHrxYCkxM9Z0iedSqvUyN/6eoTAC6DdXDdBrA/jIfyeys/4z2ldlod skfCH7Hc4eJpA0l4XcP+EvuljeaKTq85jjDttaBcv7qV+jgKqF9ARF9WYf6Tww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4YzqdVGfpbxoGpD6jAZXaYkEYTpVWYVRBIy8DWrW0UI=; b=D8wrOkjPyHyElMOaIyqt1KHmZEHFuhvqgHHfe/foM2UMkrkjK91OGzjrguV8JhzsdkZcA9 TFvoDVVuxHV5wmV1/SVFd34SjZ+Vi8ZAKhapiQb2gXJeZZOwr/kDh1FN8iRd7Y2bf72LEo XOEKVoAtj9r4JQOC7c1XZ6UjgT9kTe68MQb+3fsSiZT7BFg4aroVZc+zKOFVBswJg+ikMp TmNN27N0+JC7unOVI+raFDg36UAmvVMqIqUlsj/q4iUZnzFHUvr9JElkoDqzLd3PBvd8Yd 4y9tqMGa9HgxAViagHtl8igK19Bs8ek0VA4wxcJq8nn0ukkvBDcqjLi44MJxCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751642632; a=rsa-sha256; cv=none; b=lxX8g1Xp2SyjV4MczKIgHPJGxf5+Kn+DJLS7HIixNaMaE9jNk2XDqM/HqhYYauOsWUzb8U Jb/t7r3PiVPBNX5KKmXJ2Wam2e/klDi+UvO+tParQ5xGsOhtieFJARZPJ0AMsm5hbu69Ng rt7KEf168MAAIX8mJ4FL8jLHcObJMLhTZRn5v+A3cyeKSCyo5LZgZgjH+UMvPEt/Y3p9sW dqg1FUSgwcGvoOR5yoF9CaItOuwvIUntgM8/m87T6v6kbScvTBKEE68rxvmwbh4tGdfbby NVtT4/ScAoBH3EIhV49wBeAwT7QMSGsylU8dCVMIFQnJN8yR/oKhyCNgrJVtww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcqC6zt2zw41; Fri, 04 Jul 2025 15:23:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564FNp1j030077; Fri, 4 Jul 2025 15:23:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564FNpx8030074; Fri, 4 Jul 2025 15:23:51 GMT (envelope-from git) Date: Fri, 4 Jul 2025 15:23:51 GMT Message-Id: <202507041523.564FNpx8030074@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 369a2542caa9 - main - msdosfs: remove pm_checkpath_lock List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 369a2542caa9252ce2e89b0360f85a1c28a908e0 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=369a2542caa9252ce2e89b0360f85a1c28a908e0 commit 369a2542caa9252ce2e89b0360f85a1c28a908e0 Author: Konstantin Belousov AuthorDate: 2025-06-02 07:06:16 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 15:23:42 +0000 msdosfs: remove pm_checkpath_lock Reviewed by: markj, olce Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50648 --- sys/fs/msdosfs/msdosfs_lookup.c | 1 - sys/fs/msdosfs/msdosfs_vfsops.c | 3 --- sys/fs/msdosfs/msdosfs_vnops.c | 11 +---------- sys/fs/msdosfs/msdosfsmount.h | 1 - 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index e799a5ce05f6..8ab6d35a2685 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -845,7 +845,6 @@ doscheckpath(struct denode *source, struct denode *target, daddr_t *wait_scn) *wait_scn = 0; pmp = target->de_pmp; - lockmgr_assert(&pmp->pm_checkpath_lock, KA_XLOCKED); KASSERT(pmp == source->de_pmp, ("doscheckpath: source and target on different filesystems")); diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index adcffe45df82..4431d36c8a8e 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -575,7 +575,6 @@ mountmsdosfs(struct vnode *odevvp, struct mount *mp) pmp->pm_bo = bo; lockinit(&pmp->pm_fatlock, 0, msdosfs_lock_msg, 0, 0); - lockinit(&pmp->pm_checkpath_lock, 0, "msdoscp", 0, 0); TASK_INIT(&pmp->pm_rw2ro_task, 0, msdosfs_remount_ro, pmp); @@ -871,7 +870,6 @@ error_exit: } if (pmp != NULL) { lockdestroy(&pmp->pm_fatlock); - lockdestroy(&pmp->pm_checkpath_lock); free(pmp->pm_inusemap, M_MSDOSFSFAT); free(pmp, M_MSDOSFSMNT); mp->mnt_data = NULL; @@ -971,7 +969,6 @@ msdosfs_unmount(struct mount *mp, int mntflags) dev_rel(pmp->pm_dev); free(pmp->pm_inusemap, M_MSDOSFSFAT); lockdestroy(&pmp->pm_fatlock); - lockdestroy(&pmp->pm_checkpath_lock); free(pmp, M_MSDOSFSMNT); mp->mnt_data = NULL; return (error); diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 6417b7dac16b..120b97ba72d5 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -945,7 +945,7 @@ msdosfs_rename(struct vop_rename_args *ap) struct denode *fdip, *fip, *tdip, *tip, *nip; u_char toname[12], oldname[11]; u_long to_diroffset; - bool checkpath_locked, doingdirectory, newparent; + bool doingdirectory, newparent; int error; u_long cn, pcl, blkoff; daddr_t bn, wait_scn, scn; @@ -986,8 +986,6 @@ msdosfs_rename(struct vop_rename_args *ap) if (tvp != NULL && tvp != tdvp) VOP_UNLOCK(tvp); - checkpath_locked = false; - relock: doingdirectory = newparent = false; @@ -1108,12 +1106,8 @@ relock: if (doingdirectory && newparent) { if (error != 0) /* write access check above */ goto unlock; - lockmgr(&pmp->pm_checkpath_lock, LK_EXCLUSIVE, NULL); - checkpath_locked = true; error = doscheckpath(fip, tdip, &wait_scn); if (wait_scn != 0) { - lockmgr(&pmp->pm_checkpath_lock, LK_RELEASE, NULL); - checkpath_locked = false; VOP_UNLOCK(fdvp); VOP_UNLOCK(tdvp); VOP_UNLOCK(fvp); @@ -1276,8 +1270,6 @@ relock: cache_purge(fvp); unlock: - if (checkpath_locked) - lockmgr(&pmp->pm_checkpath_lock, LK_RELEASE, NULL); vput(fdvp); vput(fvp); if (tvp != NULL) { @@ -1289,7 +1281,6 @@ unlock: vput(tdvp); return (error); releout: - MPASS(!checkpath_locked); vrele(tdvp); if (tvp != NULL) vrele(tvp); diff --git a/sys/fs/msdosfs/msdosfsmount.h b/sys/fs/msdosfs/msdosfsmount.h index fcaac544a74d..04e6b75bea2a 100644 --- a/sys/fs/msdosfs/msdosfsmount.h +++ b/sys/fs/msdosfs/msdosfsmount.h @@ -118,7 +118,6 @@ struct msdosfsmount { void *pm_u2d; /* Unicode->DOS iconv handle */ void *pm_d2u; /* DOS->Local iconv handle */ struct lock pm_fatlock; /* lockmgr protecting allocations */ - struct lock pm_checkpath_lock; /* protects doscheckpath result */ struct task pm_rw2ro_task; /* context for emergency remount ro */ }; From nobody Fri Jul 4 15:23:53 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcqG5sL6z61Lkd; Fri, 04 Jul 2025 15:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcqF3smpz3Knt; Fri, 04 Jul 2025 15:23:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QVZ+sfYeY8C05vfxvrBuYZFJ6iaPfiklsDp0rGb6v/g=; b=D+DAVlH/RRAVqWNfBuB79NG5x7AS+0zUKMsjlh5A13VNbaAsj1bySCE4IMJ2bE+GaFs2Jr Dj2FaliumRiuLdQiezE4mnXd8bZyDPnpBJt1O8jekbkOrABxTi/x/cgT9KsCi2FTHivz+3 bA630fAExvqSTyrdJn0dH5MEGKRwk3BREdEyz6THK7imWmpuKfICKBStumZegSWXwkD9b+ CwIgKsZ79Kdugk0vKTc5cV34CYSSn997/U2qzgtxMCiAaBEKIUPfp7Q/cLysio/2piAbZl 7l6rbVs7QYXlYQOgXYVdLDYRxCnnt/8tkOxX6AquZ7TuMKMuX8EQILpeJLfQ/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QVZ+sfYeY8C05vfxvrBuYZFJ6iaPfiklsDp0rGb6v/g=; b=l470nei1D64nIxlxEbVPnlmfqQ9qJxa1kasgeRaFdxaOCyX+JAmMK8uUvluMuiQr1rkW2O vqIVpb6o3JMsf4FmLOXa2G+JZjL3Y+gXsXxqrz8yBJEePEPMNYLGRX22tF9DylQ2tiuGPS aoRR2iVUyDpjm02Xb9FIWIwxrNCUNyTrOOYe8pg0OnB2I/gkdXECNRe8Fe19y+UM3bvLDC a6NcigolEVPIQdV5CbfRefKhcAD8YHGhIKEkClMRrgCPhPe0rAyO4YUToKJXmaNb15N2dI gP+laNlWv7kCyXg3RLU9j2tTeQUVGmQy/y9CjU7itt9Ma0ZPXY6HcKb+c+r4Wg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751642633; a=rsa-sha256; cv=none; b=S8d8bmqIRxRJ4oePCiMIgxMy0CJf1JFhVNOMbuoq1VoHpHTkZBGvUUZzYypsfOYzUO/Fzm yMHXVT7S+FrZujR7vWwW3lePp5859foxhDofjZ5UhmphX8giXZ8oiXGxuzPNhJI9INMpVL Le7CV7zKvmoUoiwy2BrJs8ZVFzPBCP9CzgLc4XisMlI3AKzNhKSEMEX3Jx5ZOT8ly2UJ11 xtcel7A6O650aueDhm8xv3wWFoKGCBDRJKb30hz+G0klmIpt1hrFXKZQEs74nLDU+TPkTg dFsPjao1AhGTfbaUIz87a6FO1AddmG12BcapQmceiWecG4LpcE1fK35xcZOMeg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcqF14NJzwL5; Fri, 04 Jul 2025 15:23:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564FNrm1030112; Fri, 4 Jul 2025 15:23:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564FNrWd030109; Fri, 4 Jul 2025 15:23:53 GMT (envelope-from git) Date: Fri, 4 Jul 2025 15:23:53 GMT Message-Id: <202507041523.564FNrWd030109@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2ffee9aef7c2 - main - vfs_lookup: split NDRESTART List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ffee9aef7c272d631dc072f7cfdd978c01c7dc8 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2ffee9aef7c272d631dc072f7cfdd978c01c7dc8 commit 2ffee9aef7c272d631dc072f7cfdd978c01c7dc8 Author: Konstantin Belousov AuthorDate: 2025-06-15 07:51:48 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 15:23:42 +0000 vfs_lookup: split NDRESTART to have a convenient way to clear internal and result flags without marking ndp as restarting. Reviewed by: markj, olce Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50648 --- sys/kern/vfs_lookup.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 86c7bdaa02c0..499325a3a406 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -74,15 +74,21 @@ static void NDVALIDATE_impl(struct nameidata *, int); #define NDVALIDATE(ndp) #endif +/* + * Reset ndp to its original state. + */ +#define NDRESET(ndp) do { \ + NDREINIT_DBG(ndp); \ + ndp->ni_resflags = 0; \ + ndp->ni_cnd.cn_flags &= ~NAMEI_INTERNAL_FLAGS; \ +} while (0) /* * Prepare namei() to restart. Reset components to its original state and set * ISRESTARTED flag which signals the underlying lookup code to change the root * from ABI root to actual root and prevents a further restarts. */ #define NDRESTART(ndp) do { \ - NDREINIT_DBG(ndp); \ - ndp->ni_resflags = 0; \ - ndp->ni_cnd.cn_flags &= ~NAMEI_INTERNAL_FLAGS; \ + NDRESET(ndp); \ ndp->ni_cnd.cn_flags |= ISRESTARTED; \ } while (0) From nobody Fri Jul 4 15:23:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYcqH4C0Pz61LVx; Fri, 04 Jul 2025 15:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYcqG4xGMz3Kp0; Fri, 04 Jul 2025 15:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S0HYT+XIZOgG4NqZg2ICB4IMfo95DjaGfj314rGoBMs=; b=W2sqAJnKOIPP55MIvRTrwSWV4vQBVD2Ck3iqTlWa/scspXj8lMGvUjSwUVGL5rFR04wKcG JGMEOUKphYsdWEIekKB4dQBbmPPkXhR1HJqvzTrUdhv6fgJwqVSkZnfvZJLCs434c7brKR zW9wZPEAS8q3bG6WSnU8jD4vWHVe/d8LKa2CKDZjOz5InN8S3FbfzEVwTtiIUxNbiCdzyY agZPfqHzs3iVmc+9PQvSALyF2nUooJ/WsBhY43ft4TEeqh3gZ36/NyIF6DRdH8k8mygC2K mXrac+P3iLB7JLVhug5Qe5sIF26gW1NBbLyAygdllGcOlieefDJJRWprJR3Ppw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751642634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=S0HYT+XIZOgG4NqZg2ICB4IMfo95DjaGfj314rGoBMs=; b=ufI8tTdtD1UAfo/473mJ6Q5owMXRDxBfMNLW/lA+DHN2n2VX6OCwNzTb4EXiVMDdL/Izvb HrQ0xV5alNVNol3Q6M/Z5x1SJGoG6DP3rJ/ILd1yrVngagtiJ5PIuQMpj25fAztPvwTUXr a7Io4lczaX+H/vdXgfbZ+BhutflENbBrX7+9HsFSHLUHduyo1/cGuRip0HvV69RpEjGpzP RFu++Xpn5vJsmqN9qAw2peEWY0dkrBSOIAXI95Lv4jA594MuA4sLbElCnMJE9NF53Xlaix t0JfN/GAcYDErxhz2bCsXBdFb7xeLocLfbEw+uo/sN4SyD9OG06L7Lra2bBUqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751642634; a=rsa-sha256; cv=none; b=JuIM0dsh/wWATfRvW4SW+JDMCeUFqTwVM7FoOiO7J+0UWE2VHAO2IuJJ22XoxENX31Pwt3 rMKglMkPAO53o0g562vbjmxiW7wKrK/B5kolHUi7z445cYF18QhLgiKzUjicuXFT82C0sC JNSAmooJxGQW5TfZrufiBTUfCEosz/2X9GyfCuh9bvt9AP4i6xHYIa+JQLvJnBKyEk9cRU BIethbUfYtgiv1TSICixLi/w5QTDeHvK4cwSMjrLLyIr6J3SJ4AkOTUEsjLFSP9HFug8Yj /JQ3nuJWhoLBea58NUUQOSZ7xaCG5UQzUiWnTjsug0U3CNa+XsmpaYM/SuuWXw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYcqG1hylzwC4; Fri, 04 Jul 2025 15:23:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564FNskd030147; Fri, 4 Jul 2025 15:23:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564FNsQA030144; Fri, 4 Jul 2025 15:23:54 GMT (envelope-from git) Date: Fri, 4 Jul 2025 15:23:54 GMT Message-Id: <202507041523.564FNsQA030144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2f60984053e5 - main - namei dotdot tracker: take mnt_renamelock shared to prevent parallel renames List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f60984053e5a91e2cfb45e424129297859fb11d Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2f60984053e5a91e2cfb45e424129297859fb11d commit 2f60984053e5a91e2cfb45e424129297859fb11d Author: Konstantin Belousov AuthorDate: 2025-06-02 07:26:35 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 15:23:42 +0000 namei dotdot tracker: take mnt_renamelock shared to prevent parallel renames For each visited dvp vnode, take the shared lock on mp->mnt_renamelock for the lowest stacked filesystem. This keeps the hierarchy walked by O_RELATIVE_BENEATH lookups stable. As a consequence, we no longer need to track the dvps visited, it is enough to remember the mount points only, and even this is needed only to properly unlock them afterward. Taking the lowest mp using VOP_GETWRITEMOUNT() ensures that renames on lower fs are not allowed to break the guarantees of the O_RELATIVE_BENEATH. Reviewed by: markj, olce Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50648 --- sys/kern/vfs_lookup.c | 165 ++++++++++++++++++++++++++++++-------------------- sys/sys/namei.h | 12 ++++ 2 files changed, 111 insertions(+), 66 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 499325a3a406..fb3e6a7a2534 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -168,8 +168,8 @@ static struct vop_vector crossmp_vnodeops = { */ struct nameicap_tracker { - struct vnode *dp; TAILQ_ENTRY(nameicap_tracker) nm_link; + struct mount *mp; }; /* Zone for cap mode tracker elements used for dotdot capability checks. */ @@ -198,49 +198,75 @@ SYSCTL_INT(_vfs, OID_AUTO, lookup_cap_dotdot_nonlocal, CTLFLAG_RWTUN, "enables \"..\" components in path lookup in capability mode " "on non-local mount"); -static void +static int nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) { struct nameicap_tracker *nt; + struct mount *mp; + int error; if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) - return; + return (0); + mp = NULL; + error = VOP_GETWRITEMOUNT(dp, &mp); + if (error != 0) + return (error); nt = TAILQ_LAST(&ndp->ni_cap_tracker, nameicap_tracker_head); - if (nt != NULL && nt->dp == dp) - return; + if (nt != NULL && nt->mp == mp) { + vfs_rel(mp); + return (0); + } nt = malloc(sizeof(*nt), M_NAMEITRACKER, M_WAITOK); - vhold(dp); - nt->dp = dp; - TAILQ_INSERT_TAIL(&ndp->ni_cap_tracker, nt, nm_link); + nt->mp = mp; + error = lockmgr(&mp->mnt_renamelock, LK_SHARED | LK_NOWAIT, 0); + if (error != 0) { + MPASS(ndp->ni_nctrack_mnt == NULL); + ndp->ni_nctrack_mnt = mp; + free(nt, M_NAMEITRACKER); + error = ERESTART; + } else { + TAILQ_INSERT_TAIL(&ndp->ni_cap_tracker, nt, nm_link); + } + return (error); } static void -nameicap_cleanup_from(struct nameidata *ndp, struct nameicap_tracker *first) +nameicap_cleanup(struct nameidata *ndp, int error) { struct nameicap_tracker *nt, *nt1; + struct mount *mp; + + KASSERT((ndp->ni_nctrack_mnt == NULL && + TAILQ_EMPTY(&ndp->ni_cap_tracker)) || + (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, + ("tracker active and not strictrelative")); - nt = first; - TAILQ_FOREACH_FROM_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { + TAILQ_FOREACH_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { + mp = nt->mp; + lockmgr(&mp->mnt_renamelock, LK_RELEASE, 0); + vfs_rel(mp); TAILQ_REMOVE(&ndp->ni_cap_tracker, nt, nm_link); - vdrop(nt->dp); free(nt, M_NAMEITRACKER); } -} -static void -nameicap_cleanup(struct nameidata *ndp) -{ - KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || - (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); - nameicap_cleanup_from(ndp, NULL); + mp = ndp->ni_nctrack_mnt; + if (mp != NULL) { + if (error == ERESTART) { + lockmgr(&mp->mnt_renamelock, LK_EXCLUSIVE, 0); + lockmgr(&mp->mnt_renamelock, LK_RELEASE, 0); + } + vfs_rel(mp); + ndp->ni_nctrack_mnt = NULL; + } } /* - * For dotdot lookups in capability mode, only allow the component - * lookup to succeed if the resulting directory was already traversed - * during the operation. This catches situations where already - * traversed directory is moved to different parent, and then we walk - * over it with dotdots. + * For dotdot lookups in capability mode, disallow walking over the + * directory no_rbeneath_dpp that was used as the starting point of + * the lookup. Since we take the mnt_renamelocks of all mounts we + * ever walked over during lookup, parallel renames are disabled. + * This prevents the situation where we circumvent walk over + * ni_rbeneath_dpp following dotdots. * * Also allow to force failure of dotdot lookups for non-local * filesystems, where external agents might assist local lookups to @@ -249,7 +275,6 @@ nameicap_cleanup(struct nameidata *ndp) static int nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp) { - struct nameicap_tracker *nt; struct mount *mp; if (dp == NULL || dp->v_type != VDIR || (ndp->ni_lcf & @@ -259,22 +284,16 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp) NI_LCF_CAP_DOTDOT_KTR)) == NI_LCF_STRICTREL_KTR)) NI_CAP_VIOLATION(ndp, ndp->ni_cnd.cn_pnbuf); if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0) - return (ENOTCAPABLE); + goto violation; + if (dp == ndp->ni_rbeneath_dpp) + goto violation; mp = dp->v_mount; if (lookup_cap_dotdot_nonlocal == 0 && mp != NULL && (mp->mnt_flag & MNT_LOCAL) == 0) - goto capfail; - TAILQ_FOREACH_REVERSE(nt, &ndp->ni_cap_tracker, nameicap_tracker_head, - nm_link) { - if (dp == nt->dp) { - nt = TAILQ_NEXT(nt, nm_link); - if (nt != NULL) - nameicap_cleanup_from(ndp, nt); - return (0); - } - } + goto violation; + return (0); -capfail: +violation: if (__predict_false((ndp->ni_lcf & NI_LCF_STRICTREL_KTR) != 0)) NI_CAP_VIOLATION(ndp, ndp->ni_cnd.cn_pnbuf); return (ENOTCAPABLE); @@ -400,6 +419,8 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) NI_LCF_CAP_DOTDOT; } } + if (error == 0 && (ndp->ni_lcf & NI_LCF_STRICTREL) != 0) + ndp->ni_rbeneath_dpp = *dpp; /* * If we are auditing the kernel pathname, save the user pathname. @@ -637,6 +658,7 @@ restart: error = namei_getpath(ndp); if (__predict_false(error != 0)) { namei_cleanup_cnp(cnp); + nameicap_cleanup(ndp, error); SDT_PROBE4(vfs, namei, lookup, return, error, NULL, false, ndp); return (error); @@ -667,12 +689,12 @@ restart: else if (__predict_false(pwd->pwd_adir != pwd->pwd_rdir && (cnp->cn_flags & ISRESTARTED) == 0)) { namei_cleanup_cnp(cnp); + nameicap_cleanup(ndp, ERESTART); NDRESTART(ndp); goto restart; } return (error); case CACHE_FPL_STATUS_PARTIAL: - TAILQ_INIT(&ndp->ni_cap_tracker); dp = ndp->ni_startdir; break; case CACHE_FPL_STATUS_DESTROYED: @@ -680,18 +702,21 @@ restart: error = namei_getpath(ndp); if (__predict_false(error != 0)) { namei_cleanup_cnp(cnp); + nameicap_cleanup(ndp, error); return (error); } cnp->cn_nameptr = cnp->cn_pnbuf; /* FALLTHROUGH */ case CACHE_FPL_STATUS_ABORTED: - TAILQ_INIT(&ndp->ni_cap_tracker); MPASS(ndp->ni_lcf == 0); if (*cnp->cn_pnbuf == '\0') { if ((cnp->cn_flags & EMPTYPATH) != 0) { - return (namei_emptypath(ndp)); + error = namei_emptypath(ndp); + nameicap_cleanup(ndp, error); + return (error); } namei_cleanup_cnp(cnp); + nameicap_cleanup(ndp, ENOENT); SDT_PROBE4(vfs, namei, lookup, return, ENOENT, NULL, false, ndp); return (ENOENT); @@ -699,6 +724,7 @@ restart: error = namei_setup(ndp, &dp, &pwd); if (error != 0) { namei_cleanup_cnp(cnp); + nameicap_cleanup(ndp, error); return (error); } break; @@ -711,16 +737,23 @@ restart: ndp->ni_startdir = dp; error = vfs_lookup(ndp); if (error != 0) { - if (__predict_false(pwd->pwd_adir != pwd->pwd_rdir && - error == ENOENT && - (cnp->cn_flags & ISRESTARTED) == 0)) { - nameicap_cleanup(ndp); - pwd_drop(pwd); - namei_cleanup_cnp(cnp); - NDRESTART(ndp); - goto restart; - } else + uint64_t was_restarted; + bool abi_restart; + + was_restarted = ndp->ni_cnd.cn_flags & + ISRESTARTED; + abi_restart = pwd->pwd_adir != pwd->pwd_rdir && + error == ENOENT && was_restarted == 0; + if (error != ERESTART && !abi_restart) goto out; + nameicap_cleanup(ndp, error); + pwd_drop(pwd); + namei_cleanup_cnp(cnp); + NDRESET(ndp); + if (abi_restart) + was_restarted = ISRESTARTED; + ndp->ni_cnd.cn_flags |= was_restarted; + goto restart; } /* @@ -729,7 +762,7 @@ restart: if ((cnp->cn_flags & ISSYMLINK) == 0) { SDT_PROBE4(vfs, namei, lookup, return, error, ndp->ni_vp, false, ndp); - nameicap_cleanup(ndp); + nameicap_cleanup(ndp, 0); pwd_drop(pwd); NDVALIDATE(ndp); return (0); @@ -762,10 +795,10 @@ restart: ndp->ni_vp = NULL; vrele(ndp->ni_dvp); out: - MPASS(error != 0); + MPASS(error != 0 && error != ERESTART); SDT_PROBE4(vfs, namei, lookup, return, error, NULL, false, ndp); namei_cleanup_cnp(cnp); - nameicap_cleanup(ndp); + nameicap_cleanup(ndp, error); pwd_drop(pwd); return (error); } @@ -1191,7 +1224,9 @@ dirloop: } } - nameicap_tracker_add(ndp, dp); + error = nameicap_tracker_add(ndp, dp); + if (error != 0) + goto bad; /* * Make sure degenerate names don't get here, their handling was @@ -1216,9 +1251,7 @@ dirloop: * the jail or chroot, don't let them out. * 5. If doing a capability lookup and lookup_cap_dotdot is * enabled, return ENOTCAPABLE if the lookup would escape - * from the initial file descriptor directory. Checks are - * done by ensuring that namei() already traversed the - * result of dotdot lookup. + * from the initial file descriptor directory. */ if (cnp->cn_flags & ISDOTDOT) { if (__predict_false((ndp->ni_lcf & (NI_LCF_STRICTREL_KTR | @@ -1244,7 +1277,7 @@ dirloop: NI_CAP_VIOLATION(ndp, cnp->cn_pnbuf); if ((ndp->ni_lcf & NI_LCF_STRICTREL) != 0) { error = ENOTCAPABLE; - goto capdotdot; + goto bad; } } if (isroot || ((dp->v_vflag & VV_ROOT) != 0 && @@ -1267,11 +1300,6 @@ dirloop: vn_lock(dp, enforce_lkflags(dp->v_mount, cnp->cn_lkflags | LK_RETRY)); - error = nameicap_check_dotdot(ndp, dp); - if (error != 0) { -capdotdot: - goto bad; - } } } @@ -1320,7 +1348,9 @@ unionlookup: vn_lock(dp, enforce_lkflags(dp->v_mount, cnp->cn_lkflags | LK_RETRY)); - nameicap_tracker_add(ndp, dp); + error = nameicap_tracker_add(ndp, dp); + if (error != 0) + goto bad; goto unionlookup; } @@ -1421,7 +1451,7 @@ nextname: goto dirloop; } if (cnp->cn_flags & ISDOTDOT) { - error = nameicap_check_dotdot(ndp, ndp->ni_vp); + error = nameicap_check_dotdot(ndp, ndp->ni_dvp); if (error != 0) goto bad2; } @@ -1491,8 +1521,11 @@ success: } success_right_lock: if (ndp->ni_vp != NULL) { - if ((cnp->cn_flags & ISDOTDOT) == 0) - nameicap_tracker_add(ndp, ndp->ni_vp); + if ((cnp->cn_flags & ISDOTDOT) == 0) { + error = nameicap_tracker_add(ndp, ndp->ni_vp); + if (error != 0) + goto bad2; + } if ((cnp->cn_flags & (FAILIFEXISTS | ISSYMLINK)) == FAILIFEXISTS) return (vfs_lookup_failifexists(ndp)); } diff --git a/sys/sys/namei.h b/sys/sys/namei.h index 5c245235ace5..6008d83f729d 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -108,7 +108,12 @@ struct nameidata { * through the VOP interface. */ struct componentname ni_cnd; + + /* Serving RBENEATH. */ struct nameicap_tracker_head ni_cap_tracker; + struct vnode *ni_rbeneath_dpp; + struct mount *ni_nctrack_mnt; + /* * Private helper data for UFS, must be at the end. See * NDINIT_PREFILL(). @@ -235,6 +240,10 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, panic("namei data not inited"); \ if (((arg)->ni_debugflags & NAMEI_DBG_HADSTARTDIR) != 0) \ panic("NDREINIT on namei data with NAMEI_DBG_HADSTARTDIR"); \ + if ((arg)->ni_nctrack_mnt != NULL) \ + panic("NDREINIT on namei data with leaked ni_nctrack_mnt"); \ + if (!TAILQ_EMPTY(&(arg)->ni_cap_tracker)) \ + panic("NDREINIT on namei data with leaked ni_cap_tracker"); \ (arg)->ni_debugflags = NAMEI_DBG_INITED; \ } #else @@ -259,6 +268,9 @@ do { \ _ndp->ni_resflags = 0; \ filecaps_init(&_ndp->ni_filecaps); \ _ndp->ni_rightsneeded = _rightsp; \ + _ndp->ni_rbeneath_dpp = NULL; \ + _ndp->ni_nctrack_mnt = NULL; \ + TAILQ_INIT(&_ndp->ni_cap_tracker); \ } while (0) #define NDREINIT(ndp) do { \ From nobody Fri Jul 4 16:00:11 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYdd76MZnz61QbJ; Fri, 04 Jul 2025 16:00: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYdd75RJtz3chX; Fri, 04 Jul 2025 16:00:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751644811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kb90C8pHz0UmFTO8MxWLjBchhl5QJR+tjJ+0D9i2UJU=; b=deJ+iZ/cX0NxbfYcmbu7f1/DLltVqpmOmawUAa5YsF71Q+4mqAhCRwgpiq6VBOrST4+ZXw ROYt+N6ZX39h/zrI0GsI8GCxuMjf11VJFLmxv+DOQs8+MrSLCKfMuOemwVACkypON/RhCp M+ug5x1x7k574KVeKcDcLeAl3vsQ3OvJ8sCBpNbKDfx2XvAegt69w6dwL7sokpD2ozE5+B woEGOEB800PXL24xM6eettx9DbixA4QNb/6H+e7+2SAmh9jH84RRlQSAgy8fwOjUWEPE6n aWYDPWVyxW+We1iU8gM71UJLz9AXa+L1pTP4TEkRVG854FeGlufHZ31Zm78VCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751644811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kb90C8pHz0UmFTO8MxWLjBchhl5QJR+tjJ+0D9i2UJU=; b=lhrdRYeW0KEJbJISSUPMohNQeQvYw2bAdVsylcWLIwQEgeUL5IcVQW0B8TwLdxfFLCKOOD v5KNuZufkbycQevKQBPuaLwP7rbylBmMPntySsfL6Z6vNK+O0oJ4C3hXNZJwHbYkeeOJ5m +eMYt7KtRctOmED0QDfNPgLK8q5SBMitwWD9kFuVXxy+zehSAwPjOl3cklL4HulWgdNECN IFfcY7TVV1rO8bjgX7Tq3nEfiqdoAm02+6DcTYCyvg314eMLux1Y5Bpg7t8TqEgTVu4vdN NS9EOHHGwUYegnIESE1ZiHW7/PD9ZBuBox2aX+Z77ol4H9zEz2HCEIbkGlJg8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751644811; a=rsa-sha256; cv=none; b=lgnJrVp9g+dEPAniUwPm8n7fJgQVY7Dtq0ZUNGL5c+p+J3SJw/Il5wGwkOjeUkdYvhU+c7 010tsCC88PeW3ZHsqTr1dwvAfcqpGKC7WIwnjMkdrPbWEgfpF453i8P3WYOTGz4zxfdU/X Vo9xT23bm9vXpqOPSTwZqiNoNQa7ce1uE0DQ2H/wcTcC30wm1VlB25tjbrvmF5imo/uVWw 8314onEaBr1P4hwrgCltogZijEm+KuwIZCtKPy7FiatfXYWCYnl9yeab9If4fFxqA58YKW grLyC7vOyUxB0ZXSH/rD3gJkeBEoeFdlRWjzOaMhQ63Pxg3Cv0hyqW/7+viUKQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYdd75149zwmn; Fri, 04 Jul 2025 16:00:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564G0B7W093816; Fri, 4 Jul 2025 16:00:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564G0BYK093811; Fri, 4 Jul 2025 16:00:11 GMT (envelope-from git) Date: Fri, 4 Jul 2025 16:00:11 GMT Message-Id: <202507041600.564G0BYK093811@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: deaae83da057 - main - riscv: enable allwinner RTC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: deaae83da0571af7c97acf8f1444a00350e21e3a Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=deaae83da0571af7c97acf8f1444a00350e21e3a commit deaae83da0571af7c97acf8f1444a00350e21e3a Author: Mitchell Horne AuthorDate: 2025-07-04 15:54:48 +0000 Commit: Mitchell Horne CommitDate: 2025-07-04 15:55:55 +0000 riscv: enable allwinner RTC (Second attempt.) For the Allwinner D1 (Nehza) SBC. This RTC driver is also a clock provider, which registers two fixed clocks. In all the devices we currently support, the names of the clocks are present in the "clock-output-names" property of the device tree. This is not the case for the D1 DTS, as this property does not appear in upstream. Therefore the clock definitions are statically assigned a name, which is overridden when specified. The driver also supports the older A10/A20 models, which don't export any clocks. Ensure this case is handled properly. Reviewed by: mmel Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50369 --- sys/arm/allwinner/aw_rtc.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/sys/arm/allwinner/aw_rtc.c b/sys/arm/allwinner/aw_rtc.c index 9938601f17ce..4af57ab879e8 100644 --- a/sys/arm/allwinner/aw_rtc.c +++ b/sys/arm/allwinner/aw_rtc.c @@ -134,6 +134,7 @@ static struct ofw_compat_data compat_data[] = { { "allwinner,sun7i-a20-rtc", (uintptr_t) &a20_conf }, { "allwinner,sun6i-a31-rtc", (uintptr_t) &a31_conf }, { "allwinner,sun8i-h3-rtc", (uintptr_t) &h3_conf }, + { "allwinner,sun20i-d1-rtc", (uintptr_t) &h3_conf }, { "allwinner,sun50i-h5-rtc", (uintptr_t) &h3_conf }, { "allwinner,sun50i-h6-rtc", (uintptr_t) &h3_conf }, { NULL, 0 } @@ -147,11 +148,13 @@ struct aw_rtc_softc { static struct clk_fixed_def aw_rtc_osc32k = { .clkdef.id = 0, + .clkdef.name = "osc32k", .freq = 32768, }; static struct clk_fixed_def aw_rtc_iosc = { .clkdef.id = 2, + .clkdef.name = "iosc", }; static void aw_rtc_install_clocks(struct aw_rtc_softc *sc, device_t dev); @@ -250,23 +253,33 @@ aw_rtc_install_clocks(struct aw_rtc_softc *sc, device_t dev) { int nclocks; node = ofw_bus_get_node(dev); - nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", &clknames); - /* No clocks to export */ - if (nclocks <= 0) - return; - if (nclocks != 3) { - device_printf(dev, "Having only %d clocks instead of 3, aborting\n", nclocks); + /* Nothing to do. */ + if (!OF_hasprop(node, "clocks")) return; + + /* + * If the device tree gives us specific output names for the clocks, + * use them. + */ + nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", &clknames); + if (nclocks > 0) { + if (nclocks != 3) { + device_printf(dev, + "Found %d clocks names instead of 3, aborting\n", + nclocks); + return; + } + + aw_rtc_osc32k.clkdef.name = clknames[0]; + aw_rtc_iosc.clkdef.name = clknames[2]; } clkdom = clkdom_create(dev); - aw_rtc_osc32k.clkdef.name = clknames[0]; if (clknode_fixed_register(clkdom, &aw_rtc_osc32k) != 0) device_printf(dev, "Cannot register osc32k clock\n"); - aw_rtc_iosc.clkdef.name = clknames[2]; aw_rtc_iosc.freq = sc->conf->iosc_freq; if (clknode_fixed_register(clkdom, &aw_rtc_iosc) != 0) device_printf(dev, "Cannot register iosc clock\n"); From nobody Fri Jul 4 16:26:45 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYfCn5mM0z61Ts3; Fri, 04 Jul 2025 16:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYfCn3TZHz3qDl; Fri, 04 Jul 2025 16:26:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751646405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vq6PBz0tm0meexlYdF/uh21+VSjetCt0+QponEIm8b4=; b=cqHR+61y/M2xLxmIYNxGW7hWXcSRPrd48BQqBBy72ZUvQ/uaEHxreQNnuLBf/SJCtYU7An gDRx+aeV3eWTKeq3Zjsyu9qhEWBUWM7Quv6z+2CbXRwEORmo9PhLoUL9Yz/4JeD2ClHVq3 wrU1LKKkWdLofVKkci8RSvEe15VUNDdkZMuaab+CWWOSB2jYeqf2/VJ3VrlNhqDVUXRWea YGqILBn7GFR8B1XuSj5FrJavaAtuYnnHNT9oyeNg/Xs62RFYXHebA/kFcgEXP4sFg5AqZi eKh2aA0aMTCIx7tpz++BK+dq6pHdAH1zMhiW6CjnimVLSSsImIvaMowaR4xS1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751646405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vq6PBz0tm0meexlYdF/uh21+VSjetCt0+QponEIm8b4=; b=HVKr/jeIHMSTeEKJRMTaRHD2+7Mj1y5HI3ebf2R1uMMkP7ycvkkB3cjEF7q+glhG1okxc+ nkZBSYj3X1EpE2gOKPnW6MYjHtUpX2Cpg2Up0wmQxmzb9dHYdGPcVad+r7Yx3Y5KUxG0h7 0R3m7p74JAvicV/aJaU5pKrmfPiMaZYv5tip2h6S9Tub93crSls4W6r3mxt8vSHOAv15Tk sO++t9/0/eQPtMXRiqL1BTYDLgQyXO7Tg11jeSy2r6CzqvQr4czV5jbgr4daB8vFF2HY/i isebWaHBfr+kSvzSI1nxRXASmCxndkc1rE0umyQJCsqsCKWtUigZMgi80TZD2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751646405; a=rsa-sha256; cv=none; b=XmLundLrMttBffJJzO/3VIzzYcuZ6/P9K1Byj8ra1V5ZRLxc0aB2kIbSWtb4XtGogVCWp6 2i7zXcJpRwIKt5+uCLbbkXvic8xv3Qtn//dPIn7EP1ZDuUpWEfdCuGRVxkLu/7WVkfroxK l2oZATLkXEDlIqabcdgg+9es8lSS7ER8pmgleJ5t5NurBVPoIUfINS/+TD91VOGQs1VDGQ 3KsO0Pe96I0d/oTRe93IawP5FhyNBG1CEkH8lM2rFFQ7BeZHXypKkccW5K8kkkkK9QedUA /Q5TwnbFsxhXojaEHL1CLFgYnoryBPa/mN7MYNJuWC8jpUavDjdwhLyXhWl9VA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYfCn2nk6zxcH; Fri, 04 Jul 2025 16:26:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564GQjNR043972; Fri, 4 Jul 2025 16:26:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564GQjR1043969; Fri, 4 Jul 2025 16:26:45 GMT (envelope-from git) Date: Fri, 4 Jul 2025 16:26:45 GMT Message-Id: <202507041626.564GQjR1043969@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 5fea0aec5c8e - main - riscv: add aw_rtc device to config List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5fea0aec5c8e7e8e68a3f0de6ae717588344a6b4 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=5fea0aec5c8e7e8e68a3f0de6ae717588344a6b4 commit 5fea0aec5c8e7e8e68a3f0de6ae717588344a6b4 Author: Mitchell Horne AuthorDate: 2025-03-18 17:27:15 +0000 Commit: Mitchell Horne CommitDate: 2025-07-04 16:17:45 +0000 riscv: add aw_rtc device to config Somehow dropped during a rebase. This actually enables the driver. Fixes: d88bc5f943a9 ("riscv: enable allwinner RTC") Sponsored by: The FreeBSD Foundation --- sys/riscv/allwinner/files.allwinner | 1 + sys/riscv/conf/std.allwinner | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/riscv/allwinner/files.allwinner b/sys/riscv/allwinner/files.allwinner index 423a89c10c78..73fa9660e2d2 100644 --- a/sys/riscv/allwinner/files.allwinner +++ b/sys/riscv/allwinner/files.allwinner @@ -1,5 +1,6 @@ arm/allwinner/aw_gpio.c optional gpio aw_gpio fdt +arm/allwinner/aw_rtc.c optional aw_rtc fdt arm/allwinner/aw_syscon.c optional syscon arm/allwinner/aw_sid.c optional aw_sid nvmem arm/allwinner/aw_timer.c optional aw_timer fdt diff --git a/sys/riscv/conf/std.allwinner b/sys/riscv/conf/std.allwinner index 1bf6b027a4cb..2b1e0d4e09dc 100644 --- a/sys/riscv/conf/std.allwinner +++ b/sys/riscv/conf/std.allwinner @@ -7,6 +7,7 @@ options SOC_ALLWINNER_D1 device aw_ccu # Allwinner clock controller device aw_gpio # Allwinner GPIO controller +device aw_rtc # Allwinner Real-time Clock device aw_sid # Allwinner Secure ID EFUSE device aw_timer # Allwinner Timer device aw_usbphy # Allwinner USB PHY From nobody Fri Jul 4 16:31:07 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYfJr09ZFz61VJm; Fri, 04 Jul 2025 16:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYfJq6cQbz3sBq; Fri, 04 Jul 2025 16:31:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751646667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kj5DXuKee8g8ndu+jKEtbkv0QEzNytXOmNd2XabOp+w=; b=Y02ZI9R85gqAB/niYwtjbW3xsHh3VjXJnc/RTCf0zJW2VlB5JmhX100R8mM2ioCOWLXGl9 0JDu5ohzO3YcDncHCW8Y2+XQtLEHl9tP5HFdEjv8yMzGG53EIUbSGhmfuFhCDEyxvI4Up8 47HsXU0JlIanJ1sijN+S5lHIEqVg6fmzcEBrMetI3aHAuPSz1GENVNwOVRFtzM/uf2+73M Ix+CuFgrxrzIwbaIWInBbXcwu7etNw2BGo8FJF3gUi7QSjWnnEQxBTvE7mz1rWmK9P89tz b4J0dqTcV2Cno5ZNzBzAOB7woLKwm5KNaEbZpyqUazHYnFgJoskq4TVSPXmTuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751646667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kj5DXuKee8g8ndu+jKEtbkv0QEzNytXOmNd2XabOp+w=; b=riOLzv15E2lvH4kyXOz0NyKo94UBdPrcTxF8nB9ZIjbgKuXgiIesJjj7SsNgPV4YGh2zBG VXq6Gkgp0lxC/38+dHfRdXg9q507BwFWBbtfBQWpglG1HBNUhC8F5OIfdqtX+AR/PsPVzt j4xEd2h4N9uk1WOpK7crkqMGijxKfpJlSZzenop2TMSfrXZ5Y44xM9ma2wxdpk8Ojuz448 bnNwEPWxN8Whe4Q3/PWs9rJpPkA5KzJXnOTnTeOexiLyhQxxMTWCDcQbV/GFpSDVmOiEmr TnNRVRAqIXEgf8pb0tMYDdDAnBySVUWjVkNz6a50H+InAGEGWRvty+loXMU6Gw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751646667; a=rsa-sha256; cv=none; b=CDj++1JX2RUnrli5l5Xii4YfJjNASBeTo4HmU37AY0GCH3QP66Ce1Z9lymcItXRHMb/7kQ +qpzle8vetwC7TmHF5bhLDsSFfF4g8C/gbqcQ3bO6eVStRjgSWUZZKYfw3b9Yf7pXBAR5D dPkHzOI7QgvIiW0ZbHFrG8C+jFrRWw2IzSazUmgE9vyYhVpFfMgXEkonfHvBJOIh8kE+gN 44FBoXkt4mWYjm62/tvJK6ELO7i5SILPOfiiomVk5yug2vxt25+QEMSVF2O5aPq87mBT2x Ky4RX4WTRwjTyBvsqHRLdZq7a77hOoqsrmrA0+W/dPWEgl5OgEiIAs+rlDAH5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYfJq5xDmzy2K; Fri, 04 Jul 2025 16:31:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564GV7gE056024; Fri, 4 Jul 2025 16:31:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564GV7Es056021; Fri, 4 Jul 2025 16:31:07 GMT (envelope-from git) Date: Fri, 4 Jul 2025 16:31:07 GMT Message-Id: <202507041631.564GV7Es056021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: f6e5bcd4716c - main - tests/ci: run ci-full kyua tests in parallel List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6e5bcd4716c2974c7ceb1fbbfc0ef8db8e13d8b Auto-Submitted: auto-generated The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=f6e5bcd4716c2974c7ceb1fbbfc0ef8db8e13d8b commit f6e5bcd4716c2974c7ceb1fbbfc0ef8db8e13d8b Author: Siva Mahadevan AuthorDate: 2025-07-04 14:16:09 +0000 Commit: Li-Wen Hsu CommitDate: 2025-07-04 16:27:59 +0000 tests/ci: run ci-full kyua tests in parallel By default, use all available cpus given to the VM. This can be controlled with the already available PARALLEL_JOBS make variable. Signed-off-by: Siva Mahadevan Pull Request: https://github.com/freebsd/freebsd-src/pull/1754 --- tests/ci/tools/freebsdci | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/ci/tools/freebsdci b/tests/ci/tools/freebsdci index f0030fe00aba..7b4ce9669ab2 100755 --- a/tests/ci/tools/freebsdci +++ b/tests/ci/tools/freebsdci @@ -34,6 +34,7 @@ rcvar=freebsdci_enable start_cmd="firstboot_ci_run" stop_cmd=":" os_arch=$(uname -p) +parallelism=$(nproc) tardev=/dev/vtbd1 metadir=/meta istar=$(file -s ${tardev} | grep "POSIX tar archive" | wc -l) @@ -74,7 +75,7 @@ full_tests() tar xvf ${tardev} -C ${metadir} cd /usr/tests set +e - kyua test + kyua -v parallelism=${parallelism} test rc=$? set -e if [ ${rc} -ne 0 ] && [ ${rc} -ne 1 ]; then From nobody Fri Jul 4 18:22:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhnq0zyHz61jKQ; Fri, 04 Jul 2025 18:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhnq0Ny8z3n57; Fri, 04 Jul 2025 18:22:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653375; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cD+6cai6Is1k76Tf8YgKI0f1zU8/lktZD6lDHf76eBk=; b=gJgybJmp5p61dzjqbykrwLKUnblHhUnTiaioxBm4idQWpo7Rhoa3lciFywuiRVOPR2G4vx U4W2MN/WRxFIskB00b7AYJ6tPy5lhzkurwK9zZyWjE2lkRyO8+ty+xtGiOPw52zVrVL6nO HW/D/zWJqZTH9MZgB0c5/tUMNHyT0dQCA9Dnbb3nAKVyOMiAYvsAiYiXtpPj5ZjS5vtwbT Hr1RTOqrpRPA+p5LFyoTNbpfCuta6yvlaQ9hizgaJPuzw7T0HMKn9Z0vD/YLEBzB3FzSBo 2NXfCbZR70L1CMGHbIIFO06Y8+uNGYuB1vuIYu0AS/9aw8AvTWZs2S/+3/o7lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653375; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cD+6cai6Is1k76Tf8YgKI0f1zU8/lktZD6lDHf76eBk=; b=qzJDGrIUfa0yiMdOB88SahRkQfl/U1MJwS1zs56advNRbAtXBE10U/ch4UFeOZIMd9U4NC 2l7kljGbfSMLDC9kQBG40oa41i+MQ5gWMKMsBsv2Z5t7exiX92z85EQXKF8Q1WQ9Zyck3E kwgXBnoW5XBUBswGLx4HAW3HyC9r5gZGYpcqqxgqSEN8fN591mnXO2YuAEntdQgO+wZdNm CWwvb4ItnRV3AvW67t2kt0GUXeZiMHkQ2PCZkGDfl+G+hsF60sRHzGxd0HbKuj6wSBa4jH Pf6HFGxSHzOjOv8oetVUMxkEyPdpr4kIRKAZ9J+Jr0natJrckfe0knzttRLmaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653375; a=rsa-sha256; cv=none; b=iZxbV3PXUyo+p1H1+uYM2UpQ1d5RYR5ZSZg6FTpM1yrpTLv80yHI6knH+r/OPFArM8hZfW U9gbiH0mKXXEEABXAf4++dE8SeKiWqaWPLSr9RkY6OcQnowqsnBJEOK0/O9/TxKRSqjUpX 5cy1SxT0GxKk0q9k9IpFkZShrLSoc+PtMiM7kRD2vhk5NfsmGltOMjqCkaDFV3olLmZltb RohavDan+R7jxOsIQAmMb8jwXQRoNZsrsZ7HptBWNbcfyp5858M1pvFV8MIwvUo4cJcslV H+zx0cq0IXR6qv0EqEUrQEuBTYjjPWvdQ3hE3BJBPNRR8clX6zECHRYD9KaVRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhnp75GBz126R; Fri, 04 Jul 2025 18:22:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IMspA069322; Fri, 4 Jul 2025 18:22:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IMsm8069319; Fri, 4 Jul 2025 18:22:54 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:22:54 GMT Message-Id: <202507041822.564IMsm8069319@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: b59d777bc7af - stable/14 - bhyvectl.8: Polish List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b59d777bc7af2ac815d78a4408120e96e7ec8319 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=b59d777bc7af2ac815d78a4408120e96e7ec8319 commit b59d777bc7af2ac815d78a4408120e96e7ec8319 Author: Alexander Ziaee AuthorDate: 2025-05-21 16:29:39 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:02 +0000 bhyvectl.8: Polish + Add how to find open VMs in the example, linking `apropos Pa=/dev/vmm` + Move note about additional bhyve options after options for flow + Reclaim some space by shortening to + Align options list width, tested at MANWIDTH 59 and 80 + Remove unnecessary roff quoting and tag SPDX MFC after: 3 days Reviewed by: carlavilla, markj, mhorne Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D48401 (cherry picked from commit 22348fb999385edaef38ce5e4308f44135f0326c) --- usr.sbin/bhyvectl/bhyvectl.8 | 46 ++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/usr.sbin/bhyvectl/bhyvectl.8 b/usr.sbin/bhyvectl/bhyvectl.8 index c5282a98a767..550c4f10d8e6 100644 --- a/usr.sbin/bhyvectl/bhyvectl.8 +++ b/usr.sbin/bhyvectl/bhyvectl.8 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2015 Christian Brueffer .\" All rights reserved. .\" @@ -22,12 +25,12 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 4, 2020 +.Dd May 8, 2025 .Dt BHYVECTL 8 .Os .Sh NAME .Nm bhyvectl -.Nd "control utility for bhyve instances" +.Nd control utility for bhyve instances .Sh SYNOPSIS .Nm .Fl -vm= Ns Ar @@ -37,8 +40,8 @@ .Op Fl -inject-nmi .Op Fl -force-reset .Op Fl -force-poweroff -.Op Fl -checkpoint= Ns Ar -.Op Fl -suspend= Ns Ar +.Op Fl -checkpoint= Ns Ar +.Op Fl -suspend= Ns Ar .Sh DESCRIPTION The .Nm @@ -46,17 +49,8 @@ command is a control utility for active .Xr bhyve 8 virtual machine instances. .Pp -.Em Note : -Most -.Nm -flags are intended for querying and setting the state of an active instance. -These commands are intended for development purposes, and are not documented here. -A complete list can be obtained by executing -.Nm -without any arguments. -.Pp The user-facing options are as follows: -.Bl -tag -width ".Fl d Ar argument" +.Bl -tag -width "--checkpoint=" .It Fl -vm= Ns Ar Operate on the virtual machine .Ar . @@ -72,24 +66,38 @@ Inject a non-maskable interrupt (NMI) into the VM. Force the VM to reset. .It Fl -force-poweroff Force the VM to power off. -.It Fl -checkpoint= Ns Ar +.It Fl -checkpoint= Ns Ar Save a snapshot of a virtual machine. The guest memory contents are saved in the file given in -.Ar . +.Ar . The guest device and vCPU state are saved in the file -.Ar .kern . -.It Fl -suspend= Ns Ar +.Ar .kern . +.It Fl -suspend= Ns Ar Save a snapshot of a virtual machine similar to .Fl -checkpoint . The virtual machine will terminate after the snapshot has been saved. .El +.Pp +.Em Note : +Most +.Nm +flags are intended for querying and setting +the state of an active instance. +These commands are intended for development purposes, +and are not documented here. +A complete list can be obtained by executing +.Nm +without any arguments. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES Destroy the VM called fbsd10: .Pp -.Dl "bhyvectl --vm=fbsd10 --destroy" +.Dl bhyvectl --vm=fbsd10 --destroy +.Pp +Running VMs will be visible in +.Pa /dev/vmm/ . .Sh COMPATIBILITY The snapshot file format is not yet stable and is subject to future changes. Backwards compatibility support for the current snapshot file format is not From nobody Fri Jul 4 18:22:56 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhnr44lWz61jSF; Fri, 04 Jul 2025 18:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhnr1rQfz3mxF; Fri, 04 Jul 2025 18:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Li8AcV2RDeNUxYFSp2QpNE1LH+MclFF0wWCT6vtVr/M=; b=QWs75LxFkDLh6lJ2zAjOpeEBWRG+CqEtDyNLNUuWkhq9YpuOLEGImliiF9T5qeshIWUeTr JJHHGpl8kNjDh52ZR7uxYn0uKMVFOXyijGKIfa8H2aYUBfSPWVTnNC5jNBzX12El7ONFRD Z0m0TPrEx4ISPkHNWPnfnfhcrarv3epZg8ZicrqteKf5uL9zO4Kl7vfSWVtpZByy/C+sN+ WG8ch/CbSiV0gW6olYC9JAeGKZ3/+8YOLszbJyOTSgl6EyHyGnT5tqoOVGePBlMBw5PwEt 9fVZKYeGeX0SVW4qYygaWOZqVloy8ExKLZ/CF+xFrVpLCkU+aGVRIkYmqTEQxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Li8AcV2RDeNUxYFSp2QpNE1LH+MclFF0wWCT6vtVr/M=; b=Eig3XDH7+rggNDNQWR/A0DjBlI+l1Yl5rQ9/zK6dIaOHmif+xKkyt+QYxA8V5GiG744sIY 2UjdPdzQcmem0SUuWUqPSZ2nhgB6ONoNT5JZkK9tzluieQ53ulvMqr3SWuX7kwokxXZdti HRwNCOZrGFHNWV4SrjjVNyc3G/Twsy43Ul4afK0BH9UwZSkZnjXZ/oTWG/ngVEVt+g6Zw/ xEG615RmFSDMcC8z5Jd+xWxxzZpfio9CZgcrsGeie/yscrYSonEzOQN0bvumwbiTm/w+LL zN3cGisasVBr51gFhvqx9n/Oq0c3Ppt6IRvJ5fYvI7Gwq9e8SE3c4EmTxD6A+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653376; a=rsa-sha256; cv=none; b=L3M0mm0s3drE1dn6NgJNnwvpxuED0nBzTcB+4XBHxXK0ja9+0YdThVf+cAa9FojJqwJpgS NaxKPumuo4cjlKFY5IAv77StJhD93cZkIHmwp7pOIj6xkfM7Px9VEx24m8IZbrQ6T8XUjV I1wNtg0zJlUOb/7Ujt+Q0oiHADJrX4u9gxSMxv9qsl2xV2ss0kLFX/QORlHJgQKeB0fPHq 45Yh/JpPqniSmEd71EXXV7naiEuPc6Ipr9bYq+ncOgNJlPdtpSZwKI0bQqBS6kO1mz2UnY Xc+P2mFyeYbykGlaNSmPBm3oLP1gc+pTuPXJp1Khr3rPQZUaWsXJEBGadFdxSQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhnr0dvBz11wt; Fri, 04 Jul 2025 18:22:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IMunG069357; Fri, 4 Jul 2025 18:22:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IMu4u069354; Fri, 4 Jul 2025 18:22:56 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:22:56 GMT Message-Id: <202507041822.564IMu4u069354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 9c3d1064e17e - stable/14 - SPDX: Tag BSD-4.3TAHOE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9c3d1064e17e533094d6838209b3b3c8fe2b6e50 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=9c3d1064e17e533094d6838209b3b3c8fe2b6e50 commit 9c3d1064e17e533094d6838209b3b3c8fe2b6e50 Author: Alexander Ziaee AuthorDate: 2025-05-15 13:53:21 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:02 +0000 SPDX: Tag BSD-4.3TAHOE TIL traceroute.8 has one of the oldest liceses, predating BSD-4-Clause! The SPDX tag was not even on Wikipedia. These are all the files I could find in the tree with git grep that look like the license reported on the SPDX website, including one that was misfiled. Ref: https://spdx.org/licenses/BSD-4.3TAHOE.html MFC after: 3 days Reported by: brooks Reviewed by: brooks, carlavilla, imp, ivy Approved by: carlavilla (mentor) Differential Revision: https://reviews.freebsd.org/D50362 (cherry picked from commit 7098712bbfd60df9db324decbc1a5dd8f751356f) --- lib/libc/stdtime/strftime.c | 2 ++ usr.sbin/cron/cron/popen.c | 2 ++ usr.sbin/ppp/arp.c | 2 +- usr.sbin/traceroute/traceroute.8 | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c index d19a70c42eb4..5f22b240cdf1 100644 --- a/lib/libc/stdtime/strftime.c +++ b/lib/libc/stdtime/strftime.c @@ -1,4 +1,6 @@ /* + * SPDX-License-Identifier: BSD-4.3TAHOE + * * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. * diff --git a/usr.sbin/cron/cron/popen.c b/usr.sbin/cron/cron/popen.c index dfa90252fe22..09313d594d7d 100644 --- a/usr.sbin/cron/cron/popen.c +++ b/usr.sbin/cron/cron/popen.c @@ -1,4 +1,6 @@ /* + * SPDX-License-Identifier: BSD-4.3TAHOE + * * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. * diff --git a/usr.sbin/ppp/arp.c b/usr.sbin/ppp/arp.c index fa45502f488a..3502d714a561 100644 --- a/usr.sbin/ppp/arp.c +++ b/usr.sbin/ppp/arp.c @@ -2,7 +2,7 @@ * sys-bsd.c - System-dependent procedures for setting up * PPP interfaces on bsd-4.4-ish systems (including 386BSD, NetBSD, etc.) * - * SPDX-License-Identifier: BSD-1-Clause + * SPDX-License-Identifier: BSD-4.3TAHOE * * Copyright (c) 1989 Carnegie Mellon University. * All rights reserved. diff --git a/usr.sbin/traceroute/traceroute.8 b/usr.sbin/traceroute/traceroute.8 index 6b46ec05a1c9..2ed3149152e3 100644 --- a/usr.sbin/traceroute/traceroute.8 +++ b/usr.sbin/traceroute/traceroute.8 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-4.3TAHOE +.\" .\" Copyright (c) 1989, 1995, 1996, 1997, 1999, 2000 .\" The Regents of the University of California. All rights reserved. .\" From nobody Fri Jul 4 18:22:57 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhns4XCvz61jH0; Fri, 04 Jul 2025 18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhns2824z3mxJ; Fri, 04 Jul 2025 18: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=1751653377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ganKI8ChrEmYbIAeblhGVU3HmpKykoqu24Y9x/nazTM=; b=hn9OoG3/OlidycFEkiNTHWoe5r6LPxi0J1XAgWKSS0Q62eHHi19Q6O4XfvnCCaFR0NVT2/ B+/Ka/saXO05ULQJ+B7yVtv+lxk8eQretbZTIACMQ8s7az5sU0TBsPDNM83LKKXQVeRRZf i9fjrpyYHLdSsiaUVqmXrCf2jQXnEQbxLtCsoGa2O+wlVmQGjaL01LTbgnu1lbsKhQfpWl kI06EOiQXbeM7plMHiOCvHNjWd4c4tFF3uIxXh3qGNrZjuA5RPvTySc76cmnknWa+fJP8P xpLLcNwcqTPdOSet4vUs+tFv9HJfsneZ1RqAy5R0TQ81FHImF2W9F1XKUWNXoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ganKI8ChrEmYbIAeblhGVU3HmpKykoqu24Y9x/nazTM=; b=c2f+ljisjF35KzwGHCnl7bFx9M3H/pC5RZqC0hxhRH0f9hYKEoGptLio844ihqI4OeMUo0 XJ0e3xz9tksV0Dv0pCwv17J613FmkN68ge4CMZ5F+kEQlT1tQojPsWAmR3DLtjdTrPa7Mz dehK0YDiHt8ivQih3daXasxVlsu29a6B+v1pt7KUbeA55BtfQHf2F8oBjhNRzTq3JYM+P8 YtDqhvAm4omAEQOLExDns/FOW1rXsOCpPqTvM3NWKJ8/64lpJ/K6/b+8LlNURphoVuNOaV 8ymoW2egWIRRJN8iq1/EDOvSwmuLCKC5ANBqSKVOFbpiJd9N2/Ga12nJN/MxNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653377; a=rsa-sha256; cv=none; b=Xd3Ma6w9XV0oubASpGYpQd7zN966RrPe06lHGZoYYaD9TYllRWbH+W/EBnFTMq7PQw5pxk v18BS0Rrxi8gIhwYzNmPNXR/eKlXzpaL4WTjkgJPXLIvhhRjIXRHyQU2NxiW7UIefhIICd PqfjJbXcACMpN0wCSNwkB5m5eXLHPnEAdf8PyWgAiaDtWbYi+t3ligZXvBSsG9CBCHInJg 9ihoUddaWP9etaElUVSUhC/zbzWgIDbqBDnJpwcHhhTiHZ5ks9DDxLfuuNi41I6tLmT8gv rPbpstpPbWcC4R1S9Yt89KltRrVpwFF8VATdbpeaWHRM+hed563BIYSdVAx/Ug== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhns1Y9mz11ZT; Fri, 04 Jul 2025 18:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IMvnA069393; Fri, 4 Jul 2025 18:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IMvEW069390; Fri, 4 Jul 2025 18:22:57 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:22:57 GMT Message-Id: <202507041822.564IMvEW069390@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 5f35cb47c684 - stable/14 - build.7: PORTS_MODULES incompatible with pkgbase List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5f35cb47c684493369100539c8ca35970bee4ffe Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=5f35cb47c684493369100539c8ca35970bee4ffe commit 5f35cb47c684493369100539c8ca35970bee4ffe Author: Alexander Ziaee AuthorDate: 2025-05-21 16:40:29 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:03 +0000 build.7: PORTS_MODULES incompatible with pkgbase Add a note until we can fix this. Reviewed by: carlavilla, emaste, ivy Approved by: carlavilla (mentor) Differential Revision: https://reviews.freebsd.org/D50355 (cherry picked from commit 1a060e4f1ba9b9f9363e291aba2134b37b938fae) --- share/man/man7/build.7 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 9a90a6dffafb..f180dc501f41 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -654,6 +654,10 @@ as part of the and .Cm installkernel process. +This is currently incompatible with building +.Pa src +into +.Cm packages . .Bd -literal -offset indent make PORTS_MODULES=emulators/virtualbox-ose-kmod kernel .Ed From nobody Fri Jul 4 18:22:58 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhnv1zJzz61jm2; Fri, 04 Jul 2025 18:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhnt3Q7Dz3n2v; Fri, 04 Jul 2025 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=1751653378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=x1+3IM4F9yM5tFuA2g78+VdFZLNmjxG3F1wUsqgfoqs=; b=TIL0bmY0tZXb8ssAl9v0W5/BRJH0TIFKRwcrWCa1xgZiRq396HcCqpxk9Azbr1rxcs66mC 9HzgL9AoWRrJFfa8l5oKaeP5LqfNwuB+M1iUOrxhCGk3MgHSXxUilGpF2DLNl0QNKBjqLw LXNUI4lUeffHD4DyvJKZG6hB+CS/aobeYwut5WME9ndNM7gHIUtTX9m8hFDvr3mCbkdU65 wmUWi/R4xbaBES9NyUsAZl5CQ9BQGZad3g1pcXSocxZSXXFhOPqyMov0iL0v7MPsKFxF4R I6Oen+JlGHgwS5g8f0l3Wb8YcSqovhoJ6orODNR6oYUXY3TwUxHUBpLOrl438g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=x1+3IM4F9yM5tFuA2g78+VdFZLNmjxG3F1wUsqgfoqs=; b=cM76XbOv0jV7SgKFIlnXVMYI5aieSIkkS3GQEUwAsFqQkR31wAOBwmiIQSjtn20gWw8lbq FI8u6hHLO37iROVyC6+ElUaBs483EKqZ1tIlSSkgxR/TEgNA+irqz2G1FELcqNrLzj43VC yO0vIurPvGZftyHk74neQ8XphCATFjhm3Wg74NjTlKByHPGvTaC04c21KWj6uLZKLW9RIW yD+LG/P2R/C+Wc60srORESib5EhFBC08SxtOv0wZ3AX8Hy68tpfnKdB/b1jH/lLt6oQ9Cs zCc3H6xU5d+GhFEIKhH0cZfbMVEcfEk1QsLArtmEs/FR/dBSE/tCoZibFT3xXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653378; a=rsa-sha256; cv=none; b=MYM292ZGYngOj+OjgNPEgwjud+b7IP36JPwmeoD6Uj786ep4d66QK/TT1oXFxB+GxFY+7P 6yw7r1B1FrVz+ZVc4RC3BvI9i4jzD4prDFemBAYGEhbBwqBzTPCDOmoQT/b6Gl1EXxag5P 5LXdqD/aR9CySBquKRNpFb8PfP+r5a9nYDwqXw75HnJj1LyU6S4QIziw4F4IWUUSAYrfqf rlMy6Y5az8BWI+7mYQNu4QXaLgH71BYyj/hY8sOworFpSQ110nNxCeiuq8f1Zeyu6/q69N IABrwlB9dLCnQqJIBspKUXjzwWxAdpbH2GzAcGCmx4vAJn5RaMWGRsvy5wTbMw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhnt2pCSz120T; Fri, 04 Jul 2025 18:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IMwQd069430; Fri, 4 Jul 2025 18:22:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IMwtU069426; Fri, 4 Jul 2025 18:22:58 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:22:58 GMT Message-Id: <202507041822.564IMwtU069426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 621a175adf56 - stable/14 - make.conf.5: add CPUTYPE?= note from UPDATING List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 621a175adf566b9da8abdbbd1f839112f9432fab Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=621a175adf566b9da8abdbbd1f839112f9432fab commit 621a175adf566b9da8abdbbd1f839112f9432fab Author: Alexander Ziaee AuthorDate: 2025-05-21 16:43:37 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:03 +0000 make.conf.5: add CPUTYPE?= note from UPDATING Cross-compilation needs CPUTYPE to be set with ?= to be overideable via make targets. This has historically been mentioned in the FOOTNOTES of UPDATING. Note that in the CPUTYPE documentation in make.conf(5) for discoverability. Leave it in UPDATING for now to create no regression in the doc there. MFC after: 3 days Reviewed by: carlavilla, ivy Approved by: carlavilla (mentor) Differential Revision: https://reviews.freebsd.org/D50277 (cherry picked from commit bbc0b39ef7df3007c78eec8822213fe77aae4d41) --- share/man/man5/make.conf.5 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5 index ebf1b8a119f7..46bfa91d36ba 100644 --- a/share/man/man5/make.conf.5 +++ b/share/man/man5/make.conf.5 @@ -158,6 +158,15 @@ and .Va COPTFLAGS to contain the appropriate optimization directive to .Xr cc 1 . +To set the +.Va CPUTYPE +value, use +.Dq Li ?= +instead of +.Dq Li = +so that it can be overridden by +.Xr make 1 +targets. The automatic setting of .Va CFLAGS may be overridden using the From nobody Fri Jul 4 18:22:59 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhnx0jyRz61jSJ; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhnw0PDLz3ms5; Fri, 04 Jul 2025 18: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=1751653380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iIQQuig4zZfVrkEqsujFFRYeokKAIoDKKpNtIYl0Jhs=; b=hrhnuQL/gZSa+6+mHMqNztndOagXVCxoD0uUmW5FMQ8WY1DRSZLo7c0vpsWc/Kpjr+VzJl fp37BrD4hvzxueL75RE8RbPY2c5021FNdVvZ3rlFLV4GlcE7dcZ/Iw3unPQLPrl+SKsK/Z JSDo1vn2pgVmJddpvaTM22r2xmO8cwqG6kfYV1L2QsFYTvF+vDbnPPvQez0ShkLdPyc53V IIY0fQetXW/U82YDJBYqZGnVSrK+A2ZKf6AsAPIJnzk+OiLAAzRLD+2dL909pMdPg+WE8d gjXT3x2i1oD+l5HZAzm7xaqbvdRxgm5yPyLzCS4ACtXNXiPS9/PPGukRNCSJKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iIQQuig4zZfVrkEqsujFFRYeokKAIoDKKpNtIYl0Jhs=; b=yip2AbXT63tax95JqjAYDOiX7fLziiX2Lta1eGo/G3P5TVBl3WnoHLr6azAxjYfP12eZnH hih4+rStNmbkZ6MDdOAilzO7ClPl22LwiMn+UXJ45Dv6QAf07pyZ/c/Rad6ToetWIgqm4P wgNarBGQizXnvq5zLmV7ic5+JFgClrz1lTbvDiAe47eeWbbB/vuPyMkygE1Rwz1ttox67d qefMuZA2GRHdgDPEJlsdOh61ad6lTiT7UZvP/xVV5EveFqs70MegHMkAoOwIlB+A17bfSA mWHkerKJzO3Uhp9AyAcEPIrFUkDo0oWBgVf43RnBs3SYgw/qE5gXB0s6byfbEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653380; a=rsa-sha256; cv=none; b=RxjVXij9k95mKhOJeA3H5TebmUseRhQj+UUdYHm3FAcHw7YIz0HMdbPGuvdcMzi8bHbh5l J/MKfd4Y7zEymiVstwV4TJ26NGP7mcfo3jAYuparI7U5KMV018wYaYX5nBk651ABcnCHGC hq3Ff2unghZXjG7TcaVX5oSQlmzMrasBDqFzbQthrfXsYNcFdPyVkLNjDVh0EH8bo4r5h/ AmUIWzXP7MhfTes/1/8i717Fq/ki3HkCpajqnJ2duyCl2PVVU97hnJ9OnSdhozPKrzi+G4 4KDMC+VDoq4mNtXfdpcIzlpHQ/3hCWjuOel2r3iHNHyPeltRkpLHw6YqgAwBNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhnv3lShz11ZV; Fri, 04 Jul 2025 18:22:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IMxa3069467; Fri, 4 Jul 2025 18:22:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IMxJN069464; Fri, 4 Jul 2025 18:22:59 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:22:59 GMT Message-Id: <202507041822.564IMxJN069464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 132a75025ef9 - stable/14 - scc.4: Improve acronyms + tag SPDX List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 132a75025ef91920f46202a95589d7fb30558acd Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=132a75025ef91920f46202a95589d7fb30558acd commit 132a75025ef91920f46202a95589d7fb30558acd Author: Alexander Ziaee AuthorDate: 2025-05-26 06:43:17 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:03 +0000 scc.4: Improve acronyms + tag SPDX + tag spdx + remove duplicated acronym in manual title, reword for consistency + expand acronym in HARDWARE for HW Relnotes MFC after: 3 days Reviewed by: mhorne Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D50528 (cherry picked from commit 1c7f8214e92e40907bf8faf8d43c9db0f98294a6) --- share/man/man4/scc.4 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/share/man/man4/scc.4 b/share/man/man4/scc.4 index 05e9890a0bcc..db0c6deaf6bd 100644 --- a/share/man/man4/scc.4 +++ b/share/man/man4/scc.4 @@ -1,4 +1,6 @@ .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2006 Marcel Moolenaar .\" All rights reserved. .\" @@ -23,13 +25,13 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 26, 2020 +.Dd May 26, 2025 .Dt SCC 4 .Os .\" .Sh NAME .Nm scc -.Nd driver for Serial Communications Controllers (SCC) devices +.Nd Serial Communications Controller driver .\" .Sh SYNOPSIS .Cd "device scc" @@ -48,7 +50,7 @@ take care of the details of the communication itself. .Sh HARDWARE The .Nm -driver supports the following classes of SCCs: +driver supports the following classes of Serial Communications Controllers: .Pp .Bl -bullet -compact .It From nobody Fri Jul 4 18:23:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhnx26WMz61jmF; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhnw6Dd2z3nBX; Fri, 04 Jul 2025 18: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=1751653380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UUV2jecN+9XxkbodW8ayiB5tYcqLQuowo1ixQ1AL7vU=; b=Trl9GUIM/xjamZ0DQnLKn1E2PB9wU/BMRQfgI4/BnKxoVNiOzaZmrg5pFZXD1F7hnebXjL GERJLrWRsRpryVxVBFU2mq8MLBv5AgP6B1ekErs3/dlxsLa7JiX1kWJ7NjDFgDvrWL1gLY FElOjSY1GhfvR9ILi0opc2tbIn7sJNRtEKp6mzIAw6mNq6DOl2QSmFHLsBKhuVPXXfB+ck p+WL2ugUeM4Ro+fgzY4z+IVpCk8cbcLDdgGec7GgJOqIszUuDPnytqw3tHBfBP4eekGMAV dq1SGyVgvFO7RICmEmVmkAUtl15+AF9cNh8PAayPLNMWzUdexwM6zNKo7P05lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UUV2jecN+9XxkbodW8ayiB5tYcqLQuowo1ixQ1AL7vU=; b=GG+wYLkcQbjgGs0uPFA26b7sgWJm8crZ4JWwWeaBgy2yETD6xCqwGDfkvrgCH9y9bFGr4c GTIhFB0I+FRvkxigbfYVTpNdZzgxrXyjAnaONdT77WBbezLEGD+UN8X09yc3CkS0krAtOf sdAnFZiXgaQMPtUTVeOn/Mdh6sE9xScvDDbkaiSjx3/kjCB0EdLsqzlR4ASqj1Ow9+dU6W kCwSCfQQjY/o293cdvHD7ZxnmQtNw7MszTCZppRdoA6gV/zOrGrFvI0DpGTTT43FCst3Kn 1InPq/DtknmZ0TBX4vO+BIeMVxbCljmIwkbSIlrmSx/BCUbOZnxg5YgYHLcSEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653380; a=rsa-sha256; cv=none; b=o7RIzozO8jXZlfgoNex/gqa45VxnhxQQo2ZDdRYpR+KXt7/jCzUGneRWvIBFFdc2cONyHq JKENkUT0NMgEgAjBJJacY+ncvazN/Stvc4KsAWWCuEsSLXtimV3TUViIYpVBqhySLB1MDe ABqULfH7kOwsYMqTU6YGdpp2OiQbArOuf2wDUy/1Ut+R9UjgeYZZ1Ty9Teqhcw5hiwjUBs xXHn/qCT/lr3LfBhu+rIcXcz0ZBp/NTAwEGoxl1TtEcDo0OlvV/d0tUZE6kvXOZWfEomW+ ERDAW4aD2A3L+98TD2jHc910YXiiJx9MSGVZ3Wff5sAxEwF92cfq/nGQYya0VA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhnw4Jxfz126S; Fri, 04 Jul 2025 18:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN0rg069513; Fri, 4 Jul 2025 18:23:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN0Bd069510; Fri, 4 Jul 2025 18:23:00 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:00 GMT Message-Id: <202507041823.564IN0Bd069510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 0961446b2382 - stable/14 - pam_xdg.8: Improve usage and standards List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0961446b2382ab9aad9fe2a94029ee39d3ea5082 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=0961446b2382ab9aad9fe2a94029ee39d3ea5082 commit 0961446b2382ab9aad9fe2a94029ee39d3ea5082 Author: Alexander Ziaee AuthorDate: 2025-05-28 20:43:03 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:03 +0000 pam_xdg.8: Improve usage and standards Explain the directory created by this module, its usage, and a bit more about the standard. MFC after: 3 days Reviewed by: mhorne, manu Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D50440 (cherry picked from commit 616bb0b230835e8b88d032e2026854ad031afea2) --- lib/libpam/modules/pam_xdg/pam_xdg.8 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/libpam/modules/pam_xdg/pam_xdg.8 b/lib/libpam/modules/pam_xdg/pam_xdg.8 index 9b97d3626531..9b335751a9fb 100644 --- a/lib/libpam/modules/pam_xdg/pam_xdg.8 +++ b/lib/libpam/modules/pam_xdg/pam_xdg.8 @@ -22,7 +22,7 @@ .\" * 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. -.Dd August 22, 2024 +.Dd May 20, 2025 .Dt PAM_XDG 8 .Os .Sh NAME @@ -35,17 +35,26 @@ .Pa pam_xdg .Op Ar arguments .Sh DESCRIPTION -The xdg service module for PAM sets up the runtime directory according -to the XDG specifications. +The xdg service module for PAM creates the runtime files base directory +according to the Cross Desktop Group Base Directory Specification. .Pp By default the directory is created under -.Pa /var/run/xdg/ . +.Pa /var/run/xdg/ Ns $ Ns Ev USER . .Pp The following option may be passed to the authentication module: -.Bl -tag -width ".Cm runtime_dir_prefix" +.Bl -tag -width "runtime_dir_prefix=directory" .It Cm runtime_dir_prefix Ns = Ns Ar directory Use an alternate base directory .El +.Sh ENVIRONMENT +.Bl -tag -width indent +.It Ev XDG_RUNTIME_DIR +The location of the runtime files base directory created by this module. +Note that the module does not set this environment variable. +.El +.Sh STANDARDS +The directory created by this module conforms to the +.Lk https://specifications.freedesktop.org/basedir-spec XDG Base Directory Specification . .Sh SEE ALSO .Xr pam 3 , .Xr pam.conf 5 From nobody Fri Jul 4 18:23:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhny2q2qz61jY9; Fri, 04 Jul 2025 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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhnx5b43z3n1V; Fri, 04 Jul 2025 18: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=1751653381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cs/9NtbSq3NACasg4xutfjbcjsQd1K8eXtwwQND4Qak=; b=TgXxjSTnjSfim8DyUpWRjDIyVWx5fXVGRzNmYzxy6Y5iyY2IsQxq2HulEX1NAwuwejKnA8 HdAIYOJo0OnHqdTD7qTr8+g9SKSdUIuJXxOTSJXHNbOI7YUii4Go5wOnCttb/TDbljeID/ yrWmczPPDYmFGTXbDzlf4xaHBYBQ0vZ7V1TfRHFhcNbKory+c/zPRDe9XxNuH3fkEOZ64+ p09inzSBz3a0cbfjUF5nA6CuHCuFDOBTvCRXZuSsLLzHbwiPugYSBCGXMgq598bjBrWLoU f1ZosJvpb0IBAUPpjwitZE6nEbKhsZFck34Va8sam27zgk9PXYX0wb3G063UKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cs/9NtbSq3NACasg4xutfjbcjsQd1K8eXtwwQND4Qak=; b=hK8vSYOeBn4QiMl9680sYQZRIIDNIHau+iPe2nDCKMoWdXLSPdGSmqLnO/tZbJWJE9XRXx 6nY9zp9tq9Wu9X5Yuym6vIsDS67lL6HEeHan3AOqpvWp3V7BXEKFf4aCtKWkofHiXon8ZL teQrCX/fAKUQOKPf25y1Nzt2dKCY7TJr5BoTo8WdXkp9gF3O9y2ZoTkzgsomELN1FXD6AT 1eJvNlC3ZpResNnlyj+LwZkyBHf5KgbY7WEolPSc2VKYD9SUSAUMWBmoMtWlVLkxLWVQnq cTnyoeCaWzFLK5nUanRlFstxBJHNry8MFDhY9HxSvBYDpDd8g2ADnNznhR4dFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653381; a=rsa-sha256; cv=none; b=R42X0NXPZxZ4EuBV1JVQe0n0usRFUVqft7YTJnTNZpQ9RiziTA2tvT5i4tQxibTnX8j0O+ wiPRhlzsdTkz3Bf8UXTopaTijuZOif6UrTj6ll/eCtXwuuOm4evSJYAgAyB8vu/ct5jEhk R4oBCrgbaMzCtpLYm548D92ot9YBhhkz9GbU0PYPVJ+uRUsArTCYnOOGS2plp+W2jnBWdA 24iaaQlUemutmmxgRWyU9iO4Elec2kx8TNlKRyxjokduPCpXY8V2kPZYkoVcmMtyMWEfqG 9zpxUa4DCy8y1tC2VbbN8srAlXSxopt3yERr6+gGnV29LHpbdWrIkjRPl2vILQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhnx5BkDz11NL; Fri, 04 Jul 2025 18:23:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN1Cd069549; Fri, 4 Jul 2025 18:23:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN1s0069546; Fri, 4 Jul 2025 18:23:01 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:01 GMT Message-Id: <202507041823.564IN1s0069546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 864874b5a2b7 - stable/14 - axge.4: Create a HARDWARE section List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 864874b5a2b72b453f62c753e398187d9bfdc6b2 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=864874b5a2b72b453f62c753e398187d9bfdc6b2 commit 864874b5a2b72b453f62c753e398187d9bfdc6b2 Author: Alexander Ziaee AuthorDate: 2025-05-28 20:45:39 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:04 +0000 axge.4: Create a HARDWARE section For inclusion in the HW Relnotes. MFC after: 3 days Reviewed by: mhorne Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D50523 (cherry picked from commit e3eae3b1e587ad3e99a064400b57111966a55005) --- share/man/man4/axge.4 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/share/man/man4/axge.4 b/share/man/man4/axge.4 index 9ca268d6ff83..7133ee3253eb 100644 --- a/share/man/man4/axge.4 +++ b/share/man/man4/axge.4 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-4-Clause +.\" .\" Copyright (c) 1997, 1998, 1999, 2000-2003 .\" Bill Paul . All rights reserved. .\" @@ -28,7 +31,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 4, 2023 +.Dd May 25, 2025 .Dt AXGE 4 .Os .Sh NAME @@ -121,6 +124,19 @@ Force half duplex operation. .Pp For more information on configuring this device, see .Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports the following USB Gigabit Ethernet controllers: +.Pp +.Bl -bullet -compact +.It +ASIX Electronics AX88179A +.It +ASIX Electronics AX88179 +.It +ASIX Electronics AX88178A +.El .Sh SEE ALSO .Xr altq 4 , .Xr arp 4 , From nobody Fri Jul 4 18:23:02 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhnz2hCWz61jKX; Fri, 04 Jul 2025 18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhny6bqlz3nGl; Fri, 04 Jul 2025 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=1751653382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rskPRGnzSqgBIaRwkNHEHJN41hLSK/PVOyoSk1AKkNY=; b=WxjlaxHbXMCvN+fXaC9A7aQn5VjfJHxOZAnYqRhwGQMJ+YEo14U+FaEtKKYThOvAQnfjJy +3XtM1ifU1fUH8+LlVi/f5+T2LbF/Ky5j+cSEhMUMJJOQCNfpue+0qDBvsCmEsvvTmod+3 dHCCu4SE5pJiI0p6Maz/RHQIHdYNQHRF41Y+oeRHT/VNU1w/L1regl9HkWNEywwQJY5XNn Cl/S1UjkLHKNJOKMIx/8CdZyCR/uvvFlPN6xoq22NiIGw4XKb8mrqSSKgvypLKT1IhQEXT Nh82VzKLQKl8ujX5PRkfjP7A8kCGqDPllkBJlNfDVb96qkoOcmyqDbgSSkSYuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rskPRGnzSqgBIaRwkNHEHJN41hLSK/PVOyoSk1AKkNY=; b=Zuq8++5+WdvQGGarzkom+els0VoPRdB+lOCAc5Rrnvgz7bsZXI5gcmkPuEHIjsWKW+P5de t86DfzKYR0KYhOknWfw/vTvzJpIDKz53j4eziLHyRmwZBBFWt0sHX6bVvvMNrmRLNnwkC6 5h8T0XRe/izQKmwV+4BJSMkf60CqeDmAJP9HwhlBc1SwfHq3xfwYk/e0VUPl3lf5z/u1Ns hBq4DwHhFcPAP2Aw82uWFbF8Uxl8AC5S7g9sQWoUu7xaHZChpWRFegolsWSlVZiKBAIIqb 6n48UVys0brlY24mMu5R5ZtcXT8dxeHP5uz3/a/E12V6nGBORVya/smQ3erwIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653382; a=rsa-sha256; cv=none; b=l4BrWFDW2fdhUOJHRxa13bIXhGqirM5FgDNUXf6+opezG5yxfwnLok87lIcUo7SfhZU03c KVG6hHRA717KE5ZT7UfAzCxz9SebgaoD5SEFgkSi0u5O6lZAUD/jHl8EWO8eCYi3R0r9Sh kZY8QpXWCLO5Za08pr9arREdKunVF+gObbwmHahM5te8Xoz1tZgDpBPm1/qZsrmw+VDXcf 7cFpVg9pDPsdGHPwshbQuixxfouUq1ZxcA+XVlauSaZAz9R0VS/bCICm3klmZXopr1Bc5E QNwouBTOxxQjPQZbiJ25CFanX6nF1L98Df0HG2oj0uQzWkr7nSN/Nv4o/hsQNg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhny67jGz11NN; Fri, 04 Jul 2025 18:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN2Du069586; Fri, 4 Jul 2025 18:23:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN2xJ069583; Fri, 4 Jul 2025 18:23:02 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:02 GMT Message-Id: <202507041823.564IN2xJ069583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: ce2d22ee11d8 - stable/14 - rtsx.4: Improve hardware, add history and spdx List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ce2d22ee11d81785cbb427f22818df530642a26c Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=ce2d22ee11d81785cbb427f22818df530642a26c commit ce2d22ee11d81785cbb427f22818df530642a26c Author: Alexander Ziaee AuthorDate: 2025-05-28 20:50:26 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:04 +0000 rtsx.4: Improve hardware, add history and spdx + tag spdx + massage hardware for inclusion in hardware release notes + note first appeared in 13.0R MFC after: 3 days Reviewed by: mhorne Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D50529 (cherry picked from commit 7390e96107c81212b75b50e4b5c6cbcf14e34c84) --- share/man/man4/rtsx.4 | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/share/man/man4/rtsx.4 b/share/man/man4/rtsx.4 index c9be7a6f21f4..69de84c6d707 100644 --- a/share/man/man4/rtsx.4 +++ b/share/man/man4/rtsx.4 @@ -1,4 +1,6 @@ .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2020 Henri Hennebert .\" All rights reserved. .\" @@ -22,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 26, 2022 +.Dd May 26, 2025 .Dt RTSX 4 .Os .Sh NAME @@ -53,8 +55,7 @@ Driver attaches mmc bus on card insertion and detaches it on card removing. .Sh HARDWARE The .Nm -driver supports different specification compatible chips. -The following chips have been verified to work: +driver supports the following Realtek SD card readers: .Pp .Bl -bullet -compact .It @@ -71,17 +72,12 @@ RTS525A RTS5260 .It RTL8411B -.El -.Pp -It should also work for: -.Pp -.Bl -bullet -compact .It -RTS5249 +RTS5249 (unverified) .It -RTL8402 +RTL8402 (unverified) .It -RTL8411 +RTL8411 (unverified) .El .Sh SEE ALSO .Xr mmc 4 , @@ -93,7 +89,9 @@ RTL8411 .Sh HISTORY The .Nm -driver was ported from +driver appeared in +.Fx 13.0 +and was ported from .Ox with modifications found in Linux and .Nx . From nobody Fri Jul 4 18:23:03 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhp047Cvz61jmK; Fri, 04 Jul 2025 18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp00n34z3n3r; Fri, 04 Jul 2025 18: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=1751653384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gDpkHpY/wo8rZaYLiYGeTGo53ZOeRq4T4bd45om8cJ0=; b=KVKqyn24FD0dZkAFDUQK4lh/nxDqxH8TtSLrWOVdOEY4AcUrUqgKYdi8Ry/1LhRDP+nraL o9syMS3eoLJ0GyDDFHRK+fMt/aUPvWHGIneV6pkObsAYv6Pr4wRBaqm8ntcnPwhOWLBfJf dmpbYur+FA69r+7iPLWbEL4WFdBZSMmUyWmnJH8EaAKjurbuZpYpxaSCN6B3oOw/+vxkKU 9G94o9NZh21KGBy/Wfvvik2ZLKuEM7QbfVVqjREjaA2LEcpBh4NB+RDVWrOi6L+0tX6ITQ Wj2nUdczx7t5aOSswXSY7qf1L3rPEVBI3pFlVINkKaAt0110QWiULavR5leZ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gDpkHpY/wo8rZaYLiYGeTGo53ZOeRq4T4bd45om8cJ0=; b=mHVH7tElo5vHf02HHZvfmi9cWBQ5trDOuaUxCYPl4vo4glhNVqENfSQMSIFn873NaJGNWd Ra2Gx0i5lAtWKLTF5FAnZfZk55NG9DY/orLs8CViLbnsiTGYBcek5OtVma0ykSF6te1zhI FiXxu34gEF4i/WyaDYqbqy4YGPgpGem5z/pxAZiBbOC9vYoDRx3SjTnGlBCbvWRfQ7fra6 DVMDgq2wNIF7OjsOAqpy9sv+CvC2TQNmpnKLJCV/PEWYc6wA00Dg/QMse687QkxJxMiTty pw2jM1vjJgpXWUKeVp/oHoQFQ4+Br3dMWXoJWUAc0UIHvGLFamj/QZSz0VnfTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653384; a=rsa-sha256; cv=none; b=YmLetIi+2uRQX5IsD8mOrCp9PLoBjYnRn3V9O0AM7XMOD9d8ifO21wY5iZyLa1tz21vLkb TK0ihFlPBHPwfPod6smqlbDrSpwm2JA27QaNPwc9DQ2EpeVb0XiPDbDDNles1CfLE6TMnq fxpqcEsYSUqTrrmEXMZM32gdkfHdI5dfrcMwNU0noiZ84dWtpicZ2TeTKHffdzrfirp4w9 fFMMlzQKhfZzr9X5o75qDtmGiEUc/ZdtHtfVZOMgoo7n5535Jc1MxAmFhZJ8Gn8RIsjbKJ gIYL5vFYK/H+a1M8FWLEQe8X+pCMzyA1cfD8HvuX6M7ygxIAWSutp73rSvrMWA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhnz71Xyz11NP; Fri, 04 Jul 2025 18:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN3ms069621; Fri, 4 Jul 2025 18:23:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN30E069618; Fri, 4 Jul 2025 18:23:03 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:03 GMT Message-Id: <202507041823.564IN30E069618@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 62d26d696bf0 - stable/14 - aue.4: Improve HARDWARE, specificity, and tag spdx List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 62d26d696bf0b91daea25ad6b474555485b1333e Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=62d26d696bf0b91daea25ad6b474555485b1333e commit 62d26d696bf0b91daea25ad6b474555485b1333e Author: Alexander Ziaee AuthorDate: 2025-05-28 20:53:31 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:04 +0000 aue.4: Improve HARDWARE, specificity, and tag spdx + Improve HARDWARE introductory sentence for hardware release notes. + Mention "Fast" ethernet in title for apropos. + tag SPDX MFC after: 3 days Reviewed by: mhorne Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D50540 (cherry picked from commit 420e58595d20b6fd0dfdf2f486462fbb572f3351) --- share/man/man4/aue.4 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/share/man/man4/aue.4 b/share/man/man4/aue.4 index e451315672e9..9b82fdc4ba55 100644 --- a/share/man/man4/aue.4 +++ b/share/man/man4/aue.4 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-4-Clause +.\" .\" Copyright (c) 1997, 1998, 1999 .\" Bill Paul . All rights reserved. .\" @@ -28,12 +31,12 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 24, 2015 +.Dd May 26, 2025 .Dt AUE 4 .Os .Sh NAME .Nm aue -.Nd ADMtek AN986 Pegasus USB Ethernet driver +.Nd ADMtek AN986 Pegasus USB Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -56,8 +59,8 @@ if_aue_load="YES" .Sh DESCRIPTION The .Nm -driver provides support for USB Ethernet adapters based on the ADMtek -AN986 Pegasus chipset. +driver provides support for USB Fast Ethernet adapters based on the +ADMtek AN986 Pegasus chipset. .Pp The LinkSys USB10T adapters that contain the AN986 Pegasus chipset will operate at 100Base-TX and full-duplex. @@ -125,9 +128,10 @@ half duplex mode if this media option is not specified. For more information on configuring this device, see .Xr ifconfig 8 . .Sh HARDWARE -Adapters supported by the +The .Nm -driver include: +driver supports the following USB Fast Ethernet adapters based on the +ADMtek AN986 Pegasus chipset: .Pp .Bl -bullet -compact .It From nobody Fri Jul 4 18:23:06 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhp238hsz61jM9; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp21ws9z3nMm; Fri, 04 Jul 2025 18:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iJJ/KQ6QEIEAWXYRESD6twT0aJ8D9/c5i1UzSXNWt/c=; b=cmlsYZyz7XjTMlZK1fF8jCBr3uDa4F3Y4sVKP8TEItHVlp2f/nx4/yzd8PowyjmxC7+TWx /JVVCfzg1vBBfr4qcFJEZWmVmi0kXSk10VtdBEhlmfoQdc/0Cc2BPp/qp/95RwUDkGfX6E ySnzAT4dLlyfg8+Io4DLBO0HW9Vi7Waev31Ek+5pZlXNoZvRNXny44B10SoTLT47b/CdOD sD3yILCG42hmc+Ecv+uYS3TimvV8hOFwwrQmyFeLfDXkq9IVnYeHvJpyrH1wnf8ffFAMup uCEou11lbED2mGZz10iR8EGPg9N36rDqcPfkXc63zvpI+TmdU8vslsyJYncdnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iJJ/KQ6QEIEAWXYRESD6twT0aJ8D9/c5i1UzSXNWt/c=; b=FeheBZks5gn9VCrJJZhxyDcM7/CR6+7b5LhNop0LRO/i8e+2r5woqusheJ02FdAs8UbW1j 3h+zj+aNN1fLSWRIxALEtEmjnIjGHJablaCza2ZwWTPYMkHdBWf0DuD7nYlUV+FULeZlmf cI0jER6yn+d2ZEHnFGyNhcPCyIISlfMZL2A6/a/FDLxkrAhwzPpvlHMjR6R03bKVNUCB3h uqIv8tsYCQfGqhh727Un89EZm2qFuEIZy9znai+olkhrQ5uM4Ha18j79X7YqCCLD3bSW45 GL8jw4RGnws3wZ+J0rz3gWg89PUt8KTd0awRjp+OjU5R06xAhv6oiiQOFWg3xg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653386; a=rsa-sha256; cv=none; b=X0rgSO3Sh5PBXJebSpt67mNwhsU4tNCRmrZ/EoVZYe/+/gVYZstZ/VIKGn1S5Vv49hWCFZ qrp5rX2CZKZXctMC0XZY4n+NRcvAk+TSd6fNfiEEy285nSrlmJvQCsEl8CFD8o8gP5xMEs XsVvuOPqvsnf2ffep7bEWKCXL+FyNu4DOc6qagg9/glb0NjyXxHLajHVRXio5F46P/IoaD wKUYHgIKqAIDcWw0k6PRePk0LoglBoqW85gyTD5BWARLtOluRZZGPdd+J8Cr2KlkduKJDm qfnXhtWDm7OYW80h0syPlIfmPU0JcVA8gnnGca7sVN+2RFGkfPucgV6OWXeafQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhp21WWpz126T; Fri, 04 Jul 2025 18:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN6do069689; Fri, 4 Jul 2025 18:23:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN6pA069686; Fri, 4 Jul 2025 18:23:06 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:06 GMT Message-Id: <202507041823.564IN6pA069686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: db0f3a3c3f16 - stable/14 - usb/if_mos.c: Fix incorrect SPDX ID List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: db0f3a3c3f16f414e32fba5a0f7ea01302739bb7 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=db0f3a3c3f16f414e32fba5a0f7ea01302739bb7 commit db0f3a3c3f16f414e32fba5a0f7ea01302739bb7 Author: Alexander Ziaee AuthorDate: 2025-05-16 01:53:28 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:05 +0000 usb/if_mos.c: Fix incorrect SPDX ID Fixes: 718cf2ccb995 (further adoption of SPDX) MFC after: 3 days Reviewed by: carlavilla, imp, mhorne Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D50374 (cherry picked from commit ca47411ea5e8a38ac1a9a29df25bc32ffcaa2904) --- sys/dev/usb/net/if_mos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/net/if_mos.c b/sys/dev/usb/net/if_mos.c index 442bfb27d83f..41881fb778a5 100644 --- a/sys/dev/usb/net/if_mos.c +++ b/sys/dev/usb/net/if_mos.c @@ -1,6 +1,6 @@ +/* SPDX-License-Identifier: ISC AND BSD-4-Clause */ + /*- - * SPDX-License-Identifier: (BSD-1-Clause AND BSD-4-Clause) - * * Copyright (c) 2011 Rick van der Zwet * * Permission to use, copy, modify, and distribute this software for any From nobody Fri Jul 4 18:23:04 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhp13V9fz61jmL; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp1169Cz3n8p; Fri, 04 Jul 2025 18:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8NqnwNwdT3cFKq11otN25RSo0R9WZ1zZsRf7x9wAADE=; b=fWh8XvlkBeO2hTS5nxdWlcndXL8TrKAkZ2o5vrnGp7ZH1pziU/xLop7nBAZ2xRFsByt6rl HY4R4+SD5gFygeagFISudOyjVjgqIDsj571IXyUX+5LdMPMpDfvE9xDBqreF50ItRP9oO3 k5MEbf/VIYnUtZWEoJqnkUQBUuRQH9WesdgcROeMpTU2aCx6yk3xaXvWxzRvggR78/cUTT KSq7dmiNZDVfDqq5l3WCzOrCM1zxCw1uoxcZbZ6U/NoD649VyjyFWZhJaXDFxO6qY5LPTT EbxOYfXWq8lEcAW6tLN1CbeU8SQhKJ8EgG97jApmOcDTQW8o0IAgd9YB5zEVkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8NqnwNwdT3cFKq11otN25RSo0R9WZ1zZsRf7x9wAADE=; b=j0l4F8w/Y70e4nZEAEabfrB6w9ljObyKFBOrPh60o+MXD1JmAlvLPRthN6fq//eUz8A8cA VPFBoykVkrbL8HdGkmUs7bfHgJKqXdpr53PfwAY+QNGLDTIE7A6FVnaUePhaLJv2xIsB8W vO9qseJIvPz9ieIkVhSxmwGGAqtK4Zpb3u++qVxXl8HzCHkhNNPY68ecXxfxjyyMRiKU26 osJL8fWiWupOXgT3XQRspYAnJNTIgkFf9PvrzVHXDuc2ge1pJqA12o5rnl4B3FrucTPN8y t6G1FslWH2arcfLYFzOIP1WUz1oYp++DXl3J2ShUH7AXVTzF1LV7VGzlJVzevw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653385; a=rsa-sha256; cv=none; b=bekK385onOAdMXK1VsierU27GAVUWnuh/aHS4uyPufCgwL5IKh1FYuGGyqQ6Q+qqOd05KN zp7ZVkZ0R2ft978tbc/4lv7Wlgepwm/Dvo3tKHouPboQPynihk+uW3RekpG2jeCK7H3bXI qNWMT+ZyL5nVUiddXBDDwR3R2kNtpXIpbDFaRgVkeWbXhwOfiVNtLLD1nXwTTAX+VmoFGr QRdZh1LG46lPzGQvkW9c1yo/56hYkjlYDhRYIVHZlo+IXkn25XPs6dZtKy/Tcnlv9nycJj qWui997yYugfep9g3dDOkYjto+jrDUALhVhEX4ajyXda6D9uSEJp2le2HByv0g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhp10cFxz11wv; Fri, 04 Jul 2025 18:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN4kG069655; Fri, 4 Jul 2025 18:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN4TL069652; Fri, 4 Jul 2025 18:23:04 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:04 GMT Message-Id: <202507041823.564IN4TL069652@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 5e712379ae68 - stable/14 - cdce.4: Improve HARDWARE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5e712379ae68ea1895817b8472b73598bafbc75b Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=5e712379ae68ea1895817b8472b73598bafbc75b commit 5e712379ae68ea1895817b8472b73598bafbc75b Author: Alexander Ziaee AuthorDate: 2025-05-28 20:55:27 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:04 +0000 cdce.4: Improve HARDWARE The cdce driver is the main USB tethering driver now that both Android and iPhone tethering are using USB NCM. I would like to test a recent 5G hotspot to see what those are doing. Improve the HARDWARE section to reflect this. MFC after: 3 days Reviewed by: mhorne Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D50541 (cherry picked from commit e8260f2cea3c447b0a16f1075ff580dc4ef06efc) --- share/man/man4/cdce.4 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/share/man/man4/cdce.4 b/share/man/man4/cdce.4 index 87a6f5da4b08..8c5dbb36d197 100644 --- a/share/man/man4/cdce.4 +++ b/share/man/man4/cdce.4 @@ -27,7 +27,7 @@ .\" .\" $NetBSD: cdce.4,v 1.4 2004/12/08 18:35:56 peter Exp $ .\" -.Dd May 3, 2024 +.Dd May 26, 2025 .Dt CDCE 4 .Os .Sh NAME @@ -95,12 +95,18 @@ where .Dq internet is your providers apn name. .Sh HARDWARE -The following devices are supported by the +The .Nm -driver: +driver supports USB Ethernet interfaces implementing the +USB Communication Device Class Ethernet Control Model (CDC ECM) or +Network Control Model (CDC NCM) protocol, such as: .Pp .Bl -bullet -compact .It +Android USB tethering +.It +iPhone USB tethering +.It Prolific PL-2501 Host-to-Host Bridge Controller .It Sharp Zaurus PDA From nobody Fri Jul 4 18:23:09 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhp56pdvz61jmR; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp54zppz3nG6; Fri, 04 Jul 2025 18:23:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RU5i9Pgya5bgJNYpcWMmdi6Er6T4whAuBZln2+t77m0=; b=alVCZSkptU244EibYsQxiTttDYL2+iyWapoBrzfp//nYdkr4IXRiBU5pcR/o1a2DoNanoX fbaFJPmvN4FY7iW/iSLgZDAz52uyo8/11GMbK87g4Rrt0Q3wGH8v7aA/48aqA/Jdqo69f1 zmOexIYBfrv/HCZjSGUpMA0CUxJbDjO+Fa59jCyY1RMtYwTDK86uZzSoRHwT6truUY00YP pNEpf76a3i79Qi8AE79h+4/aHbvAOPv+Kqsbh3rwB9atcvyPAeGCnEa93eIM7/i7dUQRsf cL6DKvvLxjiY4KCuFeYPComfYwVVvNhOZnHllMaHhll4ObPeNgAy4bKQFWiY+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RU5i9Pgya5bgJNYpcWMmdi6Er6T4whAuBZln2+t77m0=; b=HjEGpOEl1ks+oD5fnw5M1fXCHAqPZJfwmig+/RCuuf6Tm7z59DjM6HMLLhStu+T+EhA6Gd OmPupPjcOMDc1MxFejMsHMpv0e6pQfObIrV3G1lcmq4S56gfhnKcsgA0YuvGX/3yG9uBH3 NQmqIKrjF+lvnFyekgqkigE9XHxtlABic7Ed8YyZrjq3wl4Fmn1Jgd3I0hlwJE68YLx3QE tIjMEWQlKkx2TNXjwMPdnvhZT7RgeFsr/oGgxWuIFUKq7tZScy/W52Pk9RS6AEnRNoLgPM czliVin9VitmV9sAS9g9SYty1Kij8uUnBWedk2O2w6RjXuXUiaFuDetDgNXQPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653389; a=rsa-sha256; cv=none; b=LHUTeDm6xSfqgMx+BZlk/EDogmp++000o9qlSP0wRYMZJHeopaMbRz/WAWGibnq5lJiq8Z VyZoQ3a/gH03mF0cA4mii8pUGCqJCZ+jMQnLPLPQDjcxmSq+2SgZd4WkNuBxBOrGULtUyY TqVNVvZBJHbysYnhCdD1zlW7UEv0p+Z6dqd9F/9qKQshXXju9MMieZZh3dDsMU3FUyATog XgnzPWMHbuc1wEPLn2NYhOqbuoJ28dpTxaPDa0UwcKyOn+EPC/YpfKrK7XDbDSr5NBGsaC +UNeK7YYDJDq9tGcGKT2O/RoOeQVtROVHJLalZVg95Qpo1aGmAZXWoSCEZOVkw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhp545vkz11wx; Fri, 04 Jul 2025 18:23:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN9wt069787; Fri, 4 Jul 2025 18:23:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN9Vx069784; Fri, 4 Jul 2025 18:23:09 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:09 GMT Message-Id: <202507041823.564IN9Vx069784@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 9acbcf1f0c13 - stable/14 - snd_hda.4: Improve HARDWARE for HW Relnotes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9acbcf1f0c13fee659b647e9d63acea4d6afafd7 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=9acbcf1f0c13fee659b647e9d63acea4d6afafd7 commit 9acbcf1f0c13fee659b647e9d63acea4d6afafd7 Author: Alexander Ziaee AuthorDate: 2025-01-17 14:31:04 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:33 +0000 snd_hda.4: Improve HARDWARE for HW Relnotes Rewrite the HARDWARE section to improve the hardware release notes. Move the section to achieve the structure in mdoc(7). Tag SPDX. MFC after: 3 days Discussed with: mav Reviewed by: christos Approved by: mhorne (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D48503 (cherry picked from commit 7b34c48e036e209321174100ab9d7fef19b4932a) --- share/man/man4/snd_hda.4 | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/share/man/man4/snd_hda.4 b/share/man/man4/snd_hda.4 index 45ad2ee132ca..93bac0e5b3b9 100644 --- a/share/man/man4/snd_hda.4 +++ b/share/man/man4/snd_hda.4 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2006-2008 Joel Dahl .\" Copyright (c) 2008 Alexander Motin .\" All rights reserved. @@ -23,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 16, 2019 +.Dd January 20, 2025 .Dt SND_HDA 4 .Os .Sh NAME @@ -384,6 +387,15 @@ Run-time equivalent of the .Va hint.pcm.%d.rec.autosrc tunable. .El +.Sh HARDWARE +The +.Nm +driver supports PCI class 04h +.Pq multimedia , +subclass 03h +.Pq HDA +audio controllers and codecs compatible with the +Intel High Definition Audio 1.0 specification. .Sh EXAMPLES Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. This system has two audio connectors on a front side, three audio connectors @@ -583,17 +595,6 @@ other random inputs Controls have different precision. Some could be just an on/off triggers. Most of controls use logarithmic scale. -.Sh HARDWARE -The -.Nm -driver supports controllers having PCI class 4 (multimedia) and -subclass 3 (HDA), compatible with Intel HDA specification. -.Pp -The -.Nm -driver supports more than two hundred different controllers and CODECs. -There is no sense to list all of them here, as in most cases specific CODEC -configuration and wiring are more important then type of the CODEC itself. .Sh SEE ALSO .Xr snd_ich 4 , .Xr sound 4 , From nobody Fri Jul 4 18:23:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhp53GCHz61jZy; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp43r4Fz3nND; Fri, 04 Jul 2025 18:23:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=80C+Usu696mKd8zob1o/1nElOX5VSEkwY0jXiNrv1I8=; b=ZdU2ClmOMur1db+Fd/IKjTGxy7C8wfM/UochcZ0iBpwdR8e9pHaaNiFT6C0jzE8p0Rlzi7 m5sfclMAITmWQwwjJjHQH2euVLO4hpuSDi+Cqh248gr6HnSUNQkW2JRdBxTOxT27b49ANf QlBgYK+hExDZI1SYxRmzV+1LLe3DYyxgv87PBu5c+o+inB/XNSNLZHEexdGXUsCKSATvrc 1MoPG72lX7JZTkDR+vENv1Z1LNKWsJrhYwaBfJHyG/FP5RO7SBYZoIrXV5yegAzT438kVf BufC3+SAR3m2+mL8Emv6lJEU1yoK/1WazKPit2LtUrvl82IoMKutykGwZxCB3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=80C+Usu696mKd8zob1o/1nElOX5VSEkwY0jXiNrv1I8=; b=jZTeDpUSuAOSz7BLMz/iUiZTn2U1V6HxsSAcoY5dBiEAfxTDloabWp8BjsoqnZ0f00L5Va UopOcrJ0Pf39TxTHQUX8aLPu+ki+j2c1VUFmHmtk7qJjo5zIcBfulfOVprGgfaT/0gHAsE toa9jA/pUflokuwpuUfgtVSwmyBXchmC8s+r/7hwj4WImZcBI03tghEbEgL3/ks7N6mjgW KWU6RAZeU881boxRtdxLh98yH78mJ/yiVWMsYNmiJ/vgG39Vv+YewVq6gebJp7pdY5+BFD S/rGrAiDb/qNswVCfYKaDVnq5xxs3ovNw1ROq5LQ2Ng8R3gvZhQKwGRMMVYWzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653388; a=rsa-sha256; cv=none; b=FZDOQ3fRv908WaH6gSDLOnu7V6nfOgpO9IyIQF2Rul6Hcr3V6YwXQD56sB4GWo6DhIU1Ef LEUvlWJOXGKReJFi+SzUrByuzHOcqILNoYBx2r4dCfTLfcIvPNAa/+Yg5/Bjg7YVRbW+7+ AWqbQyFwXi/00fpb0pyn5GQRzPJxInYSiY9AqcCPEBS6ga83nh10RjTFEWLCvw/yp0ABla 7gEbRSIcxFZErwCtOQ5jgNS+zjhqxMzCSK5huooEOOPSSQnfutpIKgjb0IbJMKJV1+i4zg 0uQnD6Dzq/9JY/cPYBEUcGnX4bBsVjvqXa6ZTIzf1eJNsz0T+R82YEZOTdK+fQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhp42vNsz127t; Fri, 04 Jul 2025 18:23:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN89s069755; Fri, 4 Jul 2025 18:23:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN8qL069752; Fri, 4 Jul 2025 18:23:08 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:08 GMT Message-Id: <202507041823.564IN8qL069752@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: f7776016fee8 - stable/14 - bectl: Use SPDX only license List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f7776016fee89ba73d9054b37bcf32c82c9b6363 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=f7776016fee89ba73d9054b37bcf32c82c9b6363 commit f7776016fee89ba73d9054b37bcf32c82c9b6363 Author: Alexander Ziaee AuthorDate: 2025-02-19 19:44:57 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:33 +0000 bectl: Use SPDX only license bectl.8 had a truncated license without the required disclaimer. Correct it consistently by converting all bectl licenses to SPDX form. Approved by: kevans Approved by: Kyle Kneitinger Approved by: Wes Maag Approved by: mhorne (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D49066 (cherry picked from commit 54d2737e7fe48226c908dcccfbda2ca1c08e07fc) --- lib/libbe/be.c | 25 ++----------------------- lib/libbe/be.h | 25 ++----------------------- lib/libbe/be_access.c | 25 ++----------------------- lib/libbe/be_error.c | 25 ++----------------------- lib/libbe/be_impl.h | 25 ++----------------------- lib/libbe/be_info.c | 25 ++----------------------- sbin/bectl/bectl.8 | 12 +----------- sbin/bectl/bectl.c | 25 ++----------------------- sbin/bectl/bectl.h | 25 ++----------------------- sbin/bectl/bectl_jail.c | 25 ++----------------------- sbin/bectl/bectl_list.c | 25 ++----------------------- sbin/bectl/tests/bectl_test.sh | 23 +---------------------- 12 files changed, 22 insertions(+), 263 deletions(-) diff --git a/lib/libbe/be.c b/lib/libbe/be.c index a9838f2200bf..de98f3b5e69e 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -1,28 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2017 Kyle J. Kneitinger * - * 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 REGENTS 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 REGENTS 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. + * SPDX-License-Identifier: BSD-2-Clause */ #include diff --git a/lib/libbe/be.h b/lib/libbe/be.h index 0e4486fbb6d2..01ee94fd03ca 100644 --- a/lib/libbe/be.h +++ b/lib/libbe/be.h @@ -1,28 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2017 Kyle J. Kneitinger * - * 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 REGENTS 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 REGENTS 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. + * SPDX-License-Identifier: BSD-2-Clause */ #ifndef _LIBBE_H diff --git a/lib/libbe/be_access.c b/lib/libbe/be_access.c index 44e7eb1e651c..a7eb6b703cda 100644 --- a/lib/libbe/be_access.c +++ b/lib/libbe/be_access.c @@ -1,30 +1,9 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2017 Kyle J. Kneitinger * Copyright (c) 2018 Kyle Evans * Copyright (c) 2019 Wes Maag * - * 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 REGENTS 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 REGENTS 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. + * SPDX-License-Identifier: BSD-2-Clause */ #include diff --git a/lib/libbe/be_error.c b/lib/libbe/be_error.c index f515fe136f12..bb1e1ed88c5d 100644 --- a/lib/libbe/be_error.c +++ b/lib/libbe/be_error.c @@ -1,28 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2017 Kyle J. Kneitinger * - * 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 REGENTS 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 REGENTS 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. + * SPDX-License-Identifier: BSD-2-Clause */ #include diff --git a/lib/libbe/be_impl.h b/lib/libbe/be_impl.h index d5fd26c4f072..88dd1c4333f3 100644 --- a/lib/libbe/be_impl.h +++ b/lib/libbe/be_impl.h @@ -1,28 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2017 Kyle J. Kneitinger * - * 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 REGENTS 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 REGENTS 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. + * SPDX-License-Identifier: BSD-2-Clause */ #ifndef _LIBBE_IMPL_H diff --git a/lib/libbe/be_info.c b/lib/libbe/be_info.c index 88a9b17bf421..cc62c609840b 100644 --- a/lib/libbe/be_info.c +++ b/lib/libbe/be_info.c @@ -1,29 +1,8 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2017 Kyle J. Kneitinger * Copyright (c) 2018 Kyle Evans * - * 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 REGENTS 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 REGENTS 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. + * SPDX-License-Identifier: BSD-2-Clause */ #include diff --git a/sbin/bectl/bectl.8 b/sbin/bectl/bectl.8 index b511d5a637b6..a77039c94d26 100644 --- a/sbin/bectl/bectl.8 +++ b/sbin/bectl/bectl.8 @@ -1,17 +1,7 @@ .\" -.\" SPDX-License-Identifier: BSD-2-Clause -.\" .\" Copyright (c) 2017 Kyle J. Kneitinger .\" -.\" 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. -.\" +.\" SPDX-License-Identifier: BSD-2-Clause .\" .\" @(#)be.1 .\" diff --git a/sbin/bectl/bectl.c b/sbin/bectl/bectl.c index 63c3bb369b56..be95ca5cd36a 100644 --- a/sbin/bectl/bectl.c +++ b/sbin/bectl/bectl.c @@ -1,28 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2017 Kyle J. Kneitinger * - * 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 REGENTS 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 REGENTS 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. + * SPDX-License-Identifier: BSD-2-Clause */ #include diff --git a/sbin/bectl/bectl.h b/sbin/bectl/bectl.h index b8b824b18010..355110bcd6d3 100644 --- a/sbin/bectl/bectl.h +++ b/sbin/bectl/bectl.h @@ -1,28 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2018 Kyle Evans * - * 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 ``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 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. + * SPDX-License-Identifier: BSD-2-Clause */ int usage(bool explicit); diff --git a/sbin/bectl/bectl_jail.c b/sbin/bectl/bectl_jail.c index ae48202163de..9feb1e23628a 100644 --- a/sbin/bectl/bectl_jail.c +++ b/sbin/bectl/bectl_jail.c @@ -1,28 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2018 Kyle Evans * - * 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 ``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 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. + * SPDX-License-Identifier: BSD-2-Clause */ #include diff --git a/sbin/bectl/bectl_list.c b/sbin/bectl/bectl_list.c index 0fcb5deb37f3..3e4c658f60e7 100644 --- a/sbin/bectl/bectl_list.c +++ b/sbin/bectl/bectl_list.c @@ -1,28 +1,7 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * +/* * Copyright (c) 2018 Kyle Evans * - * 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 ``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 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. + * SPDX-License-Identifier: BSD-2-Clause */ #include diff --git a/sbin/bectl/tests/bectl_test.sh b/sbin/bectl/tests/bectl_test.sh index 0f167829cf46..45e9714e9adc 100755 --- a/sbin/bectl/tests/bectl_test.sh +++ b/sbin/bectl/tests/bectl_test.sh @@ -1,28 +1,7 @@ # -# SPDX-License-Identifier: BSD-2-Clause -# # Copyright (c) 2018 Kyle Evans # -# 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. +# SPDX-License-Identifier: BSD-2-Clause # ZPOOL_NAME_FILE=zpool_name From nobody Fri Jul 4 18:23:07 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhp40rkpz61jMD; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp33WSqz3n6h; Fri, 04 Jul 2025 18:23:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rT/cTBXFyR48ZouR7Cnjr98ms7b2h2c030NTXN2zZKU=; b=Bd2H7bSzHyhxUUCMZmOEfiINtSOorRvqBnTC30SxFMbB5KWr+fnBVUROI5ZDujeotv7ko9 Qd8W715/KukOMDG4PN+GDd/qwjRZBbEslpSPAdtWO9eKAvqlo+IjxDEx1iAYSYruq4Ux3U qDGLgKPhfuJ700dZHL9rWmz2jpfUMQRNndC6M1abz80oJ0wMoAOjz/8tCa6ZKGWN5RQ+ej +/vkx4ZwoVg/Ag4DD+F6gFykHlPdbU0I5HAzaW+piLubTxitWp5ZWt26HHh20+kcb1niSA +jEQ6Pt9NyMrCJYgvfyJWB+7n1nyrDh+vrvhlE3CslCVc4Ca3Vtb7nhXsekXDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rT/cTBXFyR48ZouR7Cnjr98ms7b2h2c030NTXN2zZKU=; b=bldtofMxW+C54P0yYQAdshJBPy4OhXOmAV6DqhpC3kFPFq5PTiTISiCtHC7Shbbw0GKbCx 0Nhos6WJFYcC2DwCuGLk2VqXCs97L7ceuHev46q7XOkYRJv9cYNI/xNV7K+X4j6HAtWTfd X5+3c9fFnTwbrU6AJEOmAb28IbeY5Uu71PDco/Yfjk8OyCOfIOcKxZXm4rZ5hnJnI5hX/o I7229l2YuEPK9ZePSbcku+WB9DtrZeJ8wkrk051dRNH+1BuCziKbs+u2Wiv8dB+xl2fsZT NfV1G6zr/KNtewFIFGUPqOc0BhqaftaUwtfcFy+obq/mgGlQ60qWdKlJ3a4+kw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653387; a=rsa-sha256; cv=none; b=IX1+J/xKM1QgNzIFpDSzdVfw1XALphEDpT74FufkUL9kWaJJLjEVd00ZbKuN3zFlaj7eRW M1Lb5whSnnb3V7VB1zHrTzRWiiKUy7edeXjAA2dPq161N952rGV47JlYyC5AJ+sezYlwRG 8x05/biLJKlI4tbjlld17iriZwA3zD5tEl+d7B31IibQLH9Z6RFQJ/CBoLprBIR4uIH+7P NtuxPBICiYmLq4Hjf8x7jLPS+oEuQNDhNX0495Q6oXd5P9T/4srrtHS1APzJdYZ07ZGSAW jT212O9H/4+XWn2mIw9vwSKm+w8IGUCutkqSXRCy9bNbJSbfhdq4u0OIu19iDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhp32WFHz11ww; Fri, 04 Jul 2025 18:23:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564IN7Gc069722; Fri, 4 Jul 2025 18:23:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564IN7Xm069719; Fri, 4 Jul 2025 18:23:07 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:07 GMT Message-Id: <202507041823.564IN7Xm069719@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: cf647f23c4b7 - stable/14 - mlx.4: Improve specificity for apropos + hw notes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cf647f23c4b774e81144ebe2a4df958bc74580d7 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=cf647f23c4b774e81144ebe2a4df958bc74580d7 commit cf647f23c4b774e81144ebe2a4df958bc74580d7 Author: Alexander Ziaee AuthorDate: 2025-06-02 20:31:14 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:30 +0000 mlx.4: Improve specificity for apropos + hw notes + There are decades of SCSIs, these are Ultra-SCSI + Remove generalizations from the end of HARDWARE + Tag SPDX MFC after: 3 days Reviewed by: mhorne Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D50545 (cherry picked from commit e3307d05311e8c042e7e7ea2157fc51f50297369) --- share/man/man4/mlx.4 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/share/man/man4/mlx.4 b/share/man/man4/mlx.4 index f7a0d64e9e73..f6eb33d7c7d0 100644 --- a/share/man/man4/mlx.4 +++ b/share/man/man4/mlx.4 @@ -1,4 +1,6 @@ .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2003 David O'Brien .\" Copyright (c) 2000 Jeroen Ruigrok van der Werven .\" Copyright (c) 2000 Michael Smith @@ -23,12 +25,12 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd February 15, 2017 +.Dd May 27, 2025 .Dt MLX 4 .Os .Sh NAME .Nm mlx -.Nd Mylex DAC-family RAID driver +.Nd Mylex DAC-family Ultra-SCSI RAID driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -50,9 +52,9 @@ The driver provides support for Mylex DAC-family PCI to SCSI RAID controllers, including versions relabeled by Digital/Compaq. .Sh HARDWARE -Controllers supported by the +The .Nm -driver include: +driver supports the following Ultra-SCSI RAID controllers: .Pp .Bl -bullet -compact .It @@ -79,13 +81,6 @@ Mylex eXtremeRAID 1100 (DAC1164P) RAIDarray 230 controllers, aka the Ultra-SCSI DEC KZPAC-AA (1-ch, 4MB cache), KZPAC-CA (3-ch, 4MB), KZPAC-CB (3-ch, 8MB cache) .El -.Pp -All major firmware revisions (2.x, 3.x, 4.x and 5.x) are supported, however -it is always advisable to upgrade to the most recent firmware -available for the controller. -.Pp -Compatible Mylex controllers not listed should work, but have not been -verified. .Sh DIAGNOSTICS .Ss Controller initialisation phase .Bl -diag From nobody Fri Jul 4 18:23:10 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhp73LgPz61jmW; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp65mHhz3nNd; Fri, 04 Jul 2025 18:23:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i21TUAMJCmOWl0yw/lWObONvaw2RnpDlim0ZS4PH8kA=; b=gumjk8ivvDBUw58WFxOAAX7jkdgayNHUaJb1vd3URIXoytLS10PH5Zi0eEqa47kap6JM9E 2yE+CI5cY+4eqGBg5ams2tEVjwiLQdf1nm7Id41W4TNoG2dcZbimNAkU/mKSiFmmREDgQR jbzN63yejLmdcnKwgzpe01YedG6/Cu/Mcri9YFCgGpCzJ8E6esDOgTub1kqfMPm2rR93zE 81wKvYWUEu6GHtGl+SRDQceKo0pGA5NPj8qi4AugwFj2YDejdTIa4UeGuoE64Sxl13DYlZ LfIkazmSRdnt7U+vLwzHihnx7ctzBm2LQI2mvJOqbsQCzSf4om3MFRHP2kdUgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i21TUAMJCmOWl0yw/lWObONvaw2RnpDlim0ZS4PH8kA=; b=wBSLmiLOF54tbCjIrBZrA68f7l7sLHTK5LLlFEXOenxBJ4KUu+FTztue/zTWbo3C/hAKxz Z2cXEbXXys632ihhyYfa/t1OkUkpWoWMSRtomhhqek11b2Ek0hpYlokMgJwEAUA7OFVXrN 9gX/v3ZwFjRljYULW4CU23wzLPfQU+alrA/W/S33lApkPpEIG4HvfDuxSQ04Ex7p6NdDFE KH82+pl+ohRGYl0Y0mUC4fE+tuUdD6U5LQjUn62SAErztp9Aqh1FEzdxZNc8yo4+1u1xVc hqclt6OvRsNC94v+yEYBa9CywtKNJjzfp25urxLavSrB3qiXRUp6rHV8gDRaOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653390; a=rsa-sha256; cv=none; b=tet1ZFczwjgIspbnXxyHRv09tXWIqaz6ObaH5jen/TGsGLbhVEN5xcb4mRwAzXf5SnEIy4 rMpozuyxZdNStUzpWO8rzzdrV8Rm/Wr2w8cT0k3my/jXVJp7K+fN928d2T9CmTz9DVyC4P rCHpPhOI5jXr9PNPpOkU1+St7Y0/GIdERDPntKbvc42c4XJjfmsBn2tmXxIi0Ljaw4AF7k gXPCi8QeqK2QQCn0JQHl0tZv49EbG1uaeb5rI0p3v9Fi5xSZCmOUuowznpsM2yVnS2sXGv tpwrQKaXYRYiTmf4M9Rh56TvX6k2YMY2XmStb3rNMqRFWpqH/JWfkFwrVIaMIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhp65448z11cJ; Fri, 04 Jul 2025 18:23:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564INAPv069822; Fri, 4 Jul 2025 18:23:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564INAMY069818; Fri, 4 Jul 2025 18:23:10 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:10 GMT Message-Id: <202507041823.564INAMY069818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 992be3acfe68 - stable/14 - ctfconvert.1: Minor cleanup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 992be3acfe68d315e081ba27f7087e8261dc4ecf Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=992be3acfe68d315e081ba27f7087e8261dc4ecf commit 992be3acfe68d315e081ba27f7087e8261dc4ecf Author: Alexander Ziaee AuthorDate: 2025-04-18 00:41:29 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:33 +0000 ctfconvert.1: Minor cleanup Alphabetize option table to improve first glance access. Markup semantics to differentiate them and add them to apropos. MFC after: 3 days Reviewed by: Pau Amma Approved by: mhorne (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D49883 (cherry picked from commit 3fd42db26c3dd0882cf69c54850a59e79b027e33) --- cddl/usr.bin/ctfconvert/ctfconvert.1 | 40 +++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/cddl/usr.bin/ctfconvert/ctfconvert.1 b/cddl/usr.bin/ctfconvert/ctfconvert.1 index 7697513d0740..8baf9895b0e1 100644 --- a/cddl/usr.bin/ctfconvert/ctfconvert.1 +++ b/cddl/usr.bin/ctfconvert/ctfconvert.1 @@ -1,4 +1,6 @@ .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2010 The FreeBSD Foundation .\" All rights reserved. .\" @@ -31,44 +33,48 @@ .Os .Sh NAME .Nm ctfconvert -.Nd convert debug data to CTF data +.Nd convert debug data to Compact C Type Format data .Sh SYNOPSIS .Nm .Op Fl gis -.Fl l Ar label .Fl L Ar labelenv +.Fl l Ar label .Op Fl o Ar outfile object_file .Sh DESCRIPTION The .Nm -utility converts debug information from a binary file to CTF (Compact C Type -Format) data and replaces the debug section of that file with a CTF section +utility converts debug information from a binary file to CTF +.Pq Compact C Type Format +data and replaces the debug section of that file with a CTF section called SUNW_ctf. -This new section is added to the input file, unless the -o +This new section is added to the input file, unless the +.Fl o option is present. You can also opt to keep the original debugging section with the --g option. +.Fl g +option. .Pp The following options are available: -.Bl -tag -width indent -.It Fl l Ar label -Sets the label as -.Ar label . -.It Fl L Ar labelenv -Instructs -.Nm -to read the label from the environment variable -.Ar labelenv . +.Bl -tag -width "-L labelenv" .It Fl g Don't delete the original debugging section. .It Fl i Ignore object files built from other languages than C. -.It Fl s -Use the .dynsym ELF section instead of the .symtab ELF section. +.It Fl L Ar labelenv +Instructs +.Nm +to read the label from the +.Ev labelenv +environment variable. +.It Fl l Ar label +Sets the label as +.Ar label . .It Fl o Ar outfile Write the output to file in .Ar outfile . +.It Fl s +Use the .dynsym ELF section instead of the .symtab ELF section. .El .Sh EXIT STATUS .Ex -std From nobody Fri Jul 4 18:23:11 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhp82SWXz61jmX; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp76PL6z3nJ2; Fri, 04 Jul 2025 18:23:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653391; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HxnxJsSIB8Y0u3NNJWJB0h1IcArQVBLVqxoo+/lkAMA=; b=T7Kt4wIThtgLwq1NgE+trXpiTLQ513gAr3kJrZF6IMvq3rIWEUoDzVcDpcbYyM4OOyRspt +8hUQ4upjFmsoO/8/KPRxSQyJMgR1Y7R5iTOFNu8iRVqWwqWIQJnR14weQnv/n8dThELJh 9w+OkpOzy4fLkaCIlJT+wFlGZEoOkYB5fQJaBKQFgN9UYsyaKxqlFnfocOkO/ZZ1AyOH1Z Q1fIR2Pxx+6VCVAch4lzhV0c3yRFIRlKTdrynla0+ixX0nmhYIp3cHvmz29RWXSsrQpzpq kzZdlWsVXQ0pcH9PXNu5pANNzSPyNquTO73XFuUFAWS66tf1haqXVBBsP+MBsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653391; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HxnxJsSIB8Y0u3NNJWJB0h1IcArQVBLVqxoo+/lkAMA=; b=KqHlXy3lHN5p09AEaypkugEUcKFlO34HhwPTtpwc7g8q2H6kl6pR49NiqB3ICkN8gtT+N5 dHdpMfOp9yYGNGyYZhT5mu6zJxOyHh6vRJ5BTkqiFBtucGaFoTZEC0teS/kTPCLPCmSs2N sXW1xYmQEPWi5fZISy0Fkbz0KTnTqrjvVOX4uggMLVf4VScX5waJDDvZR4V0kpOratVMpz OJbK3cAB3TROuuUZiAxKBQJ88LaWPOn+TLi2edYgDZ4dV/A5zMZg1lh2evKviXviX72gDu 7J3Hm3Lbhl0+uMXSaFENQF+6sxR2rVabe1UEj6a3Oq+h3KdHgjJcF1Dr2Qd4kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653391; a=rsa-sha256; cv=none; b=M/iQbvzz73sx8QkyIGkukVoFFZXpIb1+h1jV8cAL2APAKg85BEB02ydhSlfuKFQbJlYsee DJVZ/x/lBMTziLFzYk3d/R/utIRniEC44J2VswNsPB3JKYb8YKYFrCqfwZvPnFanaAj5mH EVp4h0yADw8LnpST9CWkjzJaJ5Hvv7B3NcqG1v/FyFmPJDwvL/j+XAu7y1YOTC9kwRS8uv ot+QxO7gQi1nzH0O8ny0G0cWyp3IsE03KDAd5hJNUyx7JcPstJEUJsl3v2MmoYxg1cR/1U jSP137qaD+4pEaGAxwWfIfsLBCXQxJEtqhRiJsb37x0wtYM1vEsYEHU7PsEmlg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhp75znMz120V; Fri, 04 Jul 2025 18:23:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564INBhR069855; Fri, 4 Jul 2025 18:23:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564INBi1069852; Fri, 4 Jul 2025 18:23:11 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:11 GMT Message-Id: <202507041823.564INBi1069852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 89acc594cef7 - stable/14 - mlx.4: Improve HARDWARE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 89acc594cef77db141ede18038fe3c8ed1916264 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=89acc594cef77db141ede18038fe3c8ed1916264 commit 89acc594cef77db141ede18038fe3c8ed1916264 Author: Alexander Ziaee AuthorDate: 2025-06-14 20:54:59 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:33 +0000 mlx.4: Improve HARDWARE These are paralel scsi adapters, list what kind the hardware supports. MFC after: 3 days Fixes: e3307d05311e8c (mlx.4: Improve specificity) Reported by: kbowling Reviewed by: kbowling Approved by: mhorne (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D50654 (cherry picked from commit 63e98e05fcdbcf3a34113a2e6acab2f8cc23bba9) --- share/man/man4/mlx.4 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/share/man/man4/mlx.4 b/share/man/man4/mlx.4 index f6eb33d7c7d0..24683054e662 100644 --- a/share/man/man4/mlx.4 +++ b/share/man/man4/mlx.4 @@ -30,7 +30,7 @@ .Os .Sh NAME .Nm mlx -.Nd Mylex DAC-family Ultra-SCSI RAID driver +.Nd Mylex DAC-family Parallel SCSI RAID driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -54,29 +54,29 @@ including versions relabeled by Digital/Compaq. .Sh HARDWARE The .Nm -driver supports the following Ultra-SCSI RAID controllers: +driver supports the following Parallel SCSI RAID controllers: .Pp .Bl -bullet -compact .It -Mylex DAC960P +Mylex DAC960P (Wide Fast SCSI-2) .It -Mylex DAC960PD / DEC KZPSC (Fast Wide) +Mylex DAC960PD / DEC KZPSC (Wide Fast SCSI-2) .It -Mylex DAC960PDU +Mylex DAC960PDU (Ultra SCSI-3) .It -Mylex DAC960PL +Mylex DAC960PL (Wide Fast SCSI-2) .It -Mylex DAC960PJ +Mylex DAC960PJ (Wide Ultra SCSI-3) .It -Mylex DAC960PG +Mylex DAC960PG (Wide Ultra SCSI-3) .It -Mylex DAC960PU / DEC PZPAC (Ultra Wide) +Mylex DAC960PU / DEC PZPAC (Wide Ultra SCSI-3) .It -Mylex AcceleRAID 150 (DAC960PRL) +Mylex AcceleRAID 150 (DAC960PRL) (Wide Ultra2 SCSI) .It -Mylex AcceleRAID 250 (DAC960PTL1) +Mylex AcceleRAID 250 (DAC960PTL1) (Wide Ultra2 SCSI) .It -Mylex eXtremeRAID 1100 (DAC1164P) +Mylex eXtremeRAID 1100 (DAC1164P) (Wide Ultra2 SCSI) .It RAIDarray 230 controllers, aka the Ultra-SCSI DEC KZPAC-AA (1-ch, 4MB cache), KZPAC-CA (3-ch, 4MB), KZPAC-CB (3-ch, 8MB cache) From nobody Fri Jul 4 18:23:12 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhpB00T9z61jQ3; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhp91ZLrz3nV2; Fri, 04 Jul 2025 18:23:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aU7/RQHAGVoZaDvwGmUClilUoKySo1FHXqSRk2Xssek=; b=u7hVm8cpQG2s8mR/ZuAaoJp4Hwm82GaKGV5OFvZlicO0lm/iVonaU/3VCuGoWFst+rYyfF bs3HPCs0MTNoov3XkE60b4nJZnc/Hp1FzkZUxYlKUMWRgwvOQOqDoYM53Pbd2NQxrUhbln E1f8teImWqTiRdH07XBFs7jGrQRWHus+57fJzHm+749ryH0OBaIPZ4GGMtQSqNG0nLPM+v gsd7O5P5mfRKn2xYgP2TGIJEGS8fWr7G3yH/EdT4yhmpaxLNwoDvDz13ulAJd0AORp0/L8 4WSOP0PLHdzcl865xJ654W0LWK/rklRnTOYxTLFCgsT8XzqmwoMbNZe0ghfu+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aU7/RQHAGVoZaDvwGmUClilUoKySo1FHXqSRk2Xssek=; b=CcwWfY/VCO53cP5pJiWTKtOpt9zEczdJOjUDBL/rVHkfNSck1ivyM7jonsmbU5K4sZnZVH Jp7LcGTYQOcYiPCeoytTMz49OzKSgm33+xeiDu9UlvjNCyzxzJsVENQNNuM2gpIvxtWdyQ klAYFf5vTEgML4nJZQMnb+WmjEl4Riy0w7GxK75Gbz3n+L7pHiOT2F8Xxw6iKdqJ6r2w7Q JBktI5rnruPE4ApRazZzNBNAQBeFY+9MzPDsd+UKrD+u69Qpbow3XxOwYdLLNupQCofjO6 L51I1dGuX5l9kSK3LGzTT+z1e6TCWxhGuc64O0LVTgFe+JrbOTsS6leWzT3Vvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653393; a=rsa-sha256; cv=none; b=qdeK0MHlhP17pKfTck1OyiDd8D57xUc1ZeZgLrU4V/bV1KNormuF6ecv8NMitxiizLyUei xbyRqUyqIPTd/7exi+83R/SdFXjVl5T24q0vuLNBDjYOMle443Lvdbaq0KPs+AXJvRe0Ol pOYbQLCUYbFBHRxYGe+AkqTMwxr0R8TysLVPeMZ08axmqW0S3K8chlUJZO4hiwrapJWTtB /RT+TiV6jE6RIVuoNTplPSKNcly8ElkFOetbIGf5mPXiibZB4VzhQ8tig+DgEb4D8H18I2 Y0KVJWgmnwFfTBRJpP0wn25DRrqTmcRNENnhqMMrESFQ0V9njqTdGLmA0SFT7A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhp871VWz11rm; Fri, 04 Jul 2025 18:23:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564INCpG069887; Fri, 4 Jul 2025 18:23:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564INC2p069884; Fri, 4 Jul 2025 18:23:12 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:12 GMT Message-Id: <202507041823.564INC2p069884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 3e235a37e550 - stable/14 - ng_patch.4: Clarify relative_offset List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3e235a37e550233e9a04ccb8ca63708da97f5868 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=3e235a37e550233e9a04ccb8ca63708da97f5868 commit 3e235a37e550233e9a04ccb8ca63708da97f5868 Author: Felix Johnson AuthorDate: 2025-06-25 04:49:51 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:34 +0000 ng_patch.4: Clarify relative_offset While here, fix an extra space typo. PR: 251833 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51033 (cherry picked from commit eab94b59a7743113c7f101846f498e539b2d094d) --- share/man/man4/ng_patch.4 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ng_patch.4 b/share/man/man4/ng_patch.4 index 7a8543fd7dd8..9c0d7a8ee512 100644 --- a/share/man/man4/ng_patch.4 +++ b/share/man/man4/ng_patch.4 @@ -80,7 +80,7 @@ Sets the data link type on the .Va in hook (to help calculate relative offset). Currently, supported types are .Cm DLT_RAW -(raw IP datagrams , no offset applied, the default) and +(raw IP datagrams, no offset applied, the default) and .Cm DLT_EN10MB (Ethernet). DLT_ definitions can be found in .In net/bpf.h . @@ -135,6 +135,17 @@ corresponding checksum before transmitting packet on output interface. The .Nm node does not do any checksum correction by itself. +.Pp +The +.Va offset +value for the +.Vt ng_patch_op +structure is calculated from zero by default (the first byte of +packet headers). +If +.Va relative_offset +is enabled (set to 1) during configuration, the operation will have an +additional amount added to the offset based on the data link type. .It Dv NGM_PATCH_GETCONFIG Pq Ic getconfig This control message returns the current set of modify operations, in the form of a From nobody Fri Jul 4 18:23:13 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhpB2Jkdz61jQ5; Fri, 04 Jul 2025 18:23:14 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhpB16brz3nJP; Fri, 04 Jul 2025 18:23:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SIRxe9P9ANwXIOWuZ68PQM64pBzN2nvjPF4T0Lt5CLI=; b=BCJJ3n6egn09GxN/EG2RAxjsvINnG7tKhEanyFOdXGUPd6hXb8+AehDBSqifcQMmBrNjCp XvgXwTXnkd/4DpXZflWYgoohpW0ZBl1hRTIcIqzlQsnc3gG3YBOL4iWdpJboQQp2j8vTWE 5pQe7DIDELJWrzGwvCnYlj4cO57iRw7g9hql1/NGtPOp9ayA4ZYuD97C2zt2ATy01lhGz4 bl2rJW2umC/nmCetU3z3KH+o3XFni6jRu/VXIS342bn1hnqA1lIK1riYrWeQxTzbzRmbzb 9UjfvzFWPletnQIJFxf58ZCG7qqk+oe0KPLjJkH22kknTdkPIC2+W8CsRid/wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SIRxe9P9ANwXIOWuZ68PQM64pBzN2nvjPF4T0Lt5CLI=; b=mkpS2J0REoNRBmPB9A6XW8xQkN/aaZ+Oxmv8bpcUOSD+TnsIWWwI82TX61cyQjPalWEvqr 1vZwXzcqViQzHgMeqvXcakTyK56v6eMO59KyGy9jgriKIrh5kQHemQaT67ImDKzg36RI0T p7Q23xkDyi5KN6kQZhSgNXDLtG/zfJ0KUdPqJyV0Roe3It/IUH5jQnoXRzPIT6E38XEmhE /RHQxgGpjWXJ83ItqeKCV3DLvA8mtk62djrMEO5V/qiPCddHznj0n3u5cA6MxYd1Zo8/A7 OC3x+/Z1sLkn+wkwZK0sBisG9CMOOf7FkSKN83G1/DAy5CkzqlGt47Qg3sp62A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653394; a=rsa-sha256; cv=none; b=Yh9yiHRGHkvDl6CFf+/MDQNB0oiZCJkS1mT6bf6XTFDfA8D3k0s/d7vLoQjtZu95oJxspd /aa3mlgWvlNVhS3ZhpP4Vwz3MrVyQmhP2Phl16M1yzUIzwdH+g4agYmy4c/JzeLLocgcIU 7r21cMHYgTPv4sZ7tpWif2xtFK7eyN+CqTHgI9UUm2XxdL7o9Mgp16zWBUJUkrolV8RYWB JwPOFpIHUCBWmA3CE9p/BtGJfSq2vtdET+JJ5uXNbX5bakItAnvh5s1mJGB9ZXmOyUbj85 wkrU0c2xhDyiBzJy0RFAAiMp62V996srl4sCHQWnrIj+Z+sgr77+Kloh1TH7cw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhpB0X2tz11ZW; Fri, 04 Jul 2025 18:23:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564INDk7069919; Fri, 4 Jul 2025 18:23:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564INDcX069916; Fri, 4 Jul 2025 18:23:13 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:13 GMT Message-Id: <202507041823.564INDcX069916@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: f74d99809359 - stable/14 - uftdi.4: Makeover! List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f74d998093596c09d6216c91b6435a590dcc14a0 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=f74d998093596c09d6216c91b6435a590dcc14a0 commit f74d998093596c09d6216c91b6435a590dcc14a0 Author: Alexander Ziaee AuthorDate: 2025-05-30 01:54:15 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:34 +0000 uftdi.4: Makeover! + tag SPDX + rewrite document description to one line in contemporary style + rewrite synopsis in vt/iwx/mtw/uart's style, adding all sysctls for brevity, in the future I will call this "possibilities style" + move ioctls into an ioctl section (we should use these more) + add a sysctl section listing all sysctls and their defaults + remove list of specific 20 year old usb serial adapters from hardware + move list of supported controllers to the hardware section + explain how the driver is loaded in description, and give usage hints MFC after: 3 days Thanks: cperciva (devd calls devmatch at runtime) Thanks: linimon (you dont need to be able to read *) Thanks: adrian (here, you can find things in the code) Reviewed by: adrian, ivy, mhorne (previous version) Differential Revision: https://reviews.freebsd.org/D50608 (cherry picked from commit 7176e1e3b5474a209f54cfd5d567a523bce3b9f6) --- share/man/man4/uftdi.4 | 119 +++++++++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 54 deletions(-) diff --git a/share/man/man4/uftdi.4 b/share/man/man4/uftdi.4 index 9bd3d4a4a293..b526143eaa25 100644 --- a/share/man/man4/uftdi.4 +++ b/share/man/man4/uftdi.4 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" $NetBSD: uftdi.4,v 1.5 2002/02/07 03:15:08 ross Exp $ .\" .\" Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -27,61 +30,90 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 26, 2017 +.Dd June 25, 2025 .Dt UFTDI 4 .Os .Sh NAME .Nm uftdi -.Nd USB support for serial adapters based on the FTDI family of USB -serial adapter chips. +.Nd Future Technology Devices International USB to serial UART driver .Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your -kernel configuration file: -.Bd -ragged -offset indent .Cd "device usb" .Cd "device ucom" .Cd "device uftdi" -.Ed .Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -uftdi_load="YES" -.Ed +In +.Xr rc.conf 5 : +.Cd kld_list="uftdi" +.Pp +In +.Xr sysctl.conf 5 : +.Cd hw.usb.uftdi.debug=1 +.Cd hw.usb.uftdi.skip_jtag_interfaces=0 .Sh DESCRIPTION The .Nm -driver provides support for various serial adapters based on the -following FTDI chips: +driver supports FTDI USB to serial UART devices. +If the appropriate hardware is detected, +the driver will be loaded automatically by +.Xr devmatch 8 . +To load the driver manually, add it to the +.Ic kld_list +in +.Xr rc.conf 5 , +or use +.Xr kldload 8 +at runtime. +The device is accessed through the +.Xr ucom 4 +driver which makes it behave like a +.Xr tty 4 . +.Pp +Call out through this interface with applications like +.Xr cu 1 +or +.Xr tip 1 . +.Sh HARDWARE +The +.Nm +driver supports the following USB to serial UART controllers: .Pp .Bl -bullet -compact .It -FT8U100AX +FTDI FT4232H .It -FT8U232AM +FTDI FT232R .It -FT8U232BM +FTDI FT230X .It -FT232R +FTDI FT2232H .It -FT2232C +FTDI FT2232D .It -FT2232D +FTDI FT2232C .It -FT2232H +FTDI FT8U232BM .It -FT4232H +FTDI FT8U232AM .It -FT230X +FTDI FT8U100AX .El -.Pp -The device is accessed through the -.Xr ucom 4 -driver which makes it behave like a -.Xr tty 4 . -.Pp +.Sh SYSCTL VARIABLES +These settings can be entered in the +.Xr loader 8 +prompt, set in +.Xr loader.conf 5 , +.Xr sysctl.conf 5 , +or changed at runtime with +.Xr sysctl 8 : +.Bl -tag -width "hw.usb.uftdi.skip_jtag_interfaces" +.It Va hw.usb.uftdi.debug +Enable debugging messages, default +.Ql 0 +.It Va hw.usb.uftdi.skip_jtag_interfaces +Ignore JTAG interfaces, default +.Ql 1 +.El +.Sh IOCTLS Many of the supported chips provide additional functionality such as bitbang mode and the MPSSE engine for serial bus emulation. The @@ -219,27 +251,6 @@ ioctl, you must pass the special value .Dv UFTDI_CONFIRM_ERASE as the argument to this ioctl. .El -.Sh HARDWARE -The -.Nm -driver supports the following adapters: -.Pp -.Bl -bullet -compact -.It -B&B Electronics USB->RS422/485 adapter -.It -Elexol USB MOD1 and USB MOD3 -.It -HP USB-Serial adapter shipped with some HP laptops -.It -Inland UAS111 -.It -QVS USC-1000 -.It -Buffalo PC-OP-RS / Kurouto-shikou KURO-RS universal remote -.It -Prologix GPIB-USB Controller -.El .Sh FILES .Bl -tag -width "/dev/ttyU*.init" -compact .It Pa /dev/ttyU* @@ -255,14 +266,14 @@ for callout ports corresponding callout initial-state and lock-state devices .El .Sh SEE ALSO +.Xr cu 1 , .Xr tty 4 , .Xr ucom 4 , .Xr usb 4 .Sh HISTORY The .Nm -driver -appeared in +driver appeared in .Fx 4.8 from .Nx 1.5 . From nobody Fri Jul 4 18:23:15 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYhpC4swcz61jMS; Fri, 04 Jul 2025 18:23: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYhpC1shxz3nS9; Fri, 04 Jul 2025 18:23:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OjlCKh6tHJNTwJseCnyOhwAGH3ZSt8p57NkHHMrczeI=; b=X715utP/28bsDdIo005cQ1mwgHFuj+nK29xhZjCKROD6w94BRR9Sln9yr6SYcyq6mKZkl6 7h3ovgXWKHCxYpHZQHq/SGDthnmOzKQshycVHsXiNghJWUTmzRRFkzidN7MPrZ1OtWjlFc cnp8moLl/QtctEpoisIs1rIHsmxu9b2J2/Iis4GlmjPDpyVllkxS4ApXVUSVrbs3pyE4OQ eWGDrEulCt5cB3TwX6Pu1b6AEPcCB4IH2VtsNInnI2dYhEN43FPlj1eq5C0XISOB/Hd4by rp7H3yGqn5B5sFrGtKg2jI6KFBtrx84G2d20QrsCCcHGnkfVrKj1RpNcdR7rYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751653395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OjlCKh6tHJNTwJseCnyOhwAGH3ZSt8p57NkHHMrczeI=; b=Nw2t5U8Lugr3OP+JzqEwLw84M0b3DtpRVlXx0pmQnsizl6XoaXRIGnHSdXw5TkZNbzMAD8 S7tUmk+XvVovIS5R4l0jPvDZ6IKic0Ae0H5jp6b3DSVkk06mrmyilKcKPHbROGynMNiUEY RuG0OriAsj6ZjylnTxHeG00njx6WcPIo+wbXGk0MGmWg0EhqDoeig2L01d8naCnK7vR1r9 hh9pKFqzjo54Op/h5ONW4DCcDw6G5B7g//hNZzySl7lykRQc7cDy1v3bdvrARZsfpSb3Am yXzTD/4AzmSZJd4XadgpJZaIUFusxPUnIL9wWgK4TBsK+b8KrNA4Me9xwNt4mw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751653395; a=rsa-sha256; cv=none; b=Oycfx3+XNEr6A+UsFPamBO1SBI+yG4f5EQhU2z5WvU0DGiEYIbapmD0Kcdrggwrnxzbcq/ RFK8Jfb43fySIVUtDUY9axP1bbdw0NO1ni9iYp+X9PNtjyWA7X8bhwqu5y+/GB5gMRJjra P/oqZ49AXzglChrgxAc8pzML4SBUVO5C40iKznhtbhbgL0jShNScPHykAV4fSxgDFdw7DC Gq3LeBqpRa0xkvcrldwKsj6+X2sAV89O/JDJod377FYZxZP0dZ4zZZXZ15GY0ZjmFzLM6l bSQDu5i3H8MdZDAXndpuMcwR7nYWsanyxAXQXYq2yr4ELA+oKvXCWj6nozZfow== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYhpC1Tffz120W; Fri, 04 Jul 2025 18:23:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564INFAO069951; Fri, 4 Jul 2025 18:23:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564INFAA069948; Fri, 4 Jul 2025 18:23:15 GMT (envelope-from git) Date: Fri, 4 Jul 2025 18:23:15 GMT Message-Id: <202507041823.564INFAA069948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Ziaee Subject: git: 293e4c54b536 - stable/14 - pf.4/pfsync.4: Separate sysctl/tunables >> SYNOPSIS List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 293e4c54b5363394b5c70db4e5e32aca8e9b5094 Auto-Submitted: auto-generated The branch stable/14 has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=293e4c54b5363394b5c70db4e5e32aca8e9b5094 commit 293e4c54b5363394b5c70db4e5e32aca8e9b5094 Author: Alexander Ziaee AuthorDate: 2025-06-25 23:19:14 +0000 Commit: Alexander Ziaee CommitDate: 2025-07-04 18:20:56 +0000 pf.4/pfsync.4: Separate sysctl/tunables >> SYNOPSIS MFC after: 3 days Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D50856 (cherry picked from commit dca2ab32e831dd5cedab182da8c5c51aaa828967) --- share/man/man4/pf.4 | 37 ++++++++++++++++++++++++++++++++++--- share/man/man4/pfsync.4 | 30 ++++++++++++++++++++++++------ 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/share/man/man4/pf.4 b/share/man/man4/pf.4 index cd87b98ea45d..e0526552507c 100644 --- a/share/man/man4/pf.4 +++ b/share/man/man4/pf.4 @@ -35,6 +35,19 @@ .Sh SYNOPSIS .Cd "device pf" .Cd "options PF_DEFAULT_TO_DROP" +.Pp +In +.Xr loader.conf 5 : +.Cd net.pf.states_hashsize +.Cd net.pf.source_nodes_hashsize +.Cd net.pf.rule_tag_hashsize +.Cd net.pf.udpendpoint_hashsize +.Cd net.pf.default_to_drop +.Pp +In +.Xr sysctl.conf 5 : +.Cd net.pf.request_maxcount +.Cd net.pf.filter_local .Sh DESCRIPTION Packet filtering takes place in the kernel. A pseudo-device, @@ -74,10 +87,28 @@ separated by characters, similar to how file system hierarchies are laid out. The final component of the anchor path is the anchor under which operations will be performed. -.Sh SYSCTL VARIABLES AND LOADER TUNABLES -The following +.Sh SYSCTL VARIABLES +The following variables can be entered at the +.Xr loader 8 +prompt, set in +.Xr loader.conf 5 , +.Xr sysctl.conf 5 , +or changed at runtime with +.Xr sysctl 8 : +.Bl -tag -width indent +.It Va net.pf.filter_local +This tells +.Nm +to also filter on the loopback output hook. +This is typically used to allow redirect rules to adjust the source address. +.It Va net.pf.request_maxcount +The maximum number of items in a single ioctl call. +.El +.Sh LOADER TUNABLES +The following tunables can be entered at the .Xr loader 8 -tunables are available. +prompt, or set in +.Xr loader.conf 5 : .Bl -tag -width indent .It Va net.pf.states_hashsize Size of hash tables that store states. diff --git a/share/man/man4/pfsync.4 b/share/man/man4/pfsync.4 index b4b96ee133bf..46d239d421c0 100644 --- a/share/man/man4/pfsync.4 +++ b/share/man/man4/pfsync.4 @@ -32,6 +32,14 @@ .Nd packet filter state table sychronisation interface .Sh SYNOPSIS .Cd "device pfsync" +.Pp +In +.Xr loader.conf 5 : +.Cd net.pfsync.pfsync_buckets +.Pp +In +.Xr sysctl.conf 5 : +.Cd net.pfsync.carp_demotion_factor .Sh DESCRIPTION The .Nm @@ -155,12 +163,14 @@ Compatibility with FreeBSD 13.1 has been verified. .It Cm 1400 FreeBSD release 14.0. .El -.Pp -.Nm -has the following -.Xr sysctl 8 -tunables: -.Bl -tag -width ".Va net.pfsync" +.Sh SYSCTL VARIABLES +The following variables can be entered at the +.Xr loader 8 +prompt, set in +.Xr loader.conf 5 , +or changed at runtime with +.Xr sysctl 8 : +.Bl -tag -width indent .It Va net.pfsync.carp_demotion_factor Value added to .Va net.inet.carp.demotion @@ -171,6 +181,14 @@ See .Xr carp 4 for more information. Default value is 240. +.El +.Sh LOADER TUNABLES +The following tunable may be set in +.Xr loader.conf 5 +or at the +.Xr loader 8 +prompt: +.Bl -tag -width indent .It Va net.pfsync.pfsync_buckets The number of .Nm From nobody Fri Jul 4 19:19:19 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYk2w4LzVz60bhD; Fri, 04 Jul 2025 19:19: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYk2w27mMz3FF3; Fri, 04 Jul 2025 19:19:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751656760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9oQ5wytrZhM5ENLjLClUrvMlUYefHFgTHuJMgkv0riI=; b=PO851SIHb2ddbhPVR/IYC5g45ysDcIAJs9Qlo3CThAn4Biie9opN2yCJmwuD4IKoCVrGU8 Pa3uRDhjYBcVTvs09RzKQ6QFsN8wFlF4bW1iI3gEDzExafxBTePqZHKq5NmDC9guKimRia eObmDz2d6i9xFYOXZY35ZV4yDjTD9vu6HDIu965hLQ5xS0AfrZJf7R2XKAUU8cOZS0Bcf0 DdRLqe9YRCcsM1t/L/p4bXZD6yQHhEZLp3+wJkeyWcKau+47fSRMw3Zfc+HtXWPd6Ok5Cs xKFXiApUuhK+ZyYrgyQqwb+goPWpKpooVki/vdZl0rQV6ik1LLEZuPVWwC67ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751656760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9oQ5wytrZhM5ENLjLClUrvMlUYefHFgTHuJMgkv0riI=; b=Pr8feZ0YcidpBrCnvK5YAxm7FCn1xZAOyFI9dP47MmVrrv1VkmPZ7i06C8ZqsK9IqhlgFm MphJZqPZqaBk4HLwCMlwpTM2xaA1fQ3g/RW74PSGwBKBbKs6JdGdQ2ED378CmtcbNF3liL PQbbZHbGMcbUzDf/oj+orHX/Sm6XeJAifnelR255pAa1lmwvdHQ71JfudYq3Nvu0iBxgNm dvZM7F7jFnZpseec5I/t2ReCssRiAkbdHDwO2Ls61kx3abdPZj3gYVEsKFHo7zXDjZ2+gN oOWJQQ6oUo17M0CFDpgHF/Sdy7U7Gmw3iZKyVnP13FQ4VKqPXLONfyRRQxMiHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751656760; a=rsa-sha256; cv=none; b=ccQGLrBl6tzGAxBBbpnXbCqfxOBVR+9Px2Tc6jdxASVRhe1V57QMRhohvRDjKwhiE2yVnl YIlsNczreV1F/S/ABMiz0JNeW20+gEZm9242QGS0q4T2U7m4nqEGzeHf0dzUn9DyGK5HUj AAm5Zdprp3h6E0Af2EHalxa5L0SnkO7tGqvv51l6IBYOxC4BHTk8RLteck3wSsxsqjUY1X SiSvxvhxlmAGQ4j6Vq1blhf5w0zxJlbmAIdq23t01mpunclX4zIMnGcWoxLuKwx05Qd1Kh kIdO3IDmPKNS3etH0Oaek1VK1dTjzs9AhlxhSRwj3yyIeo7iU5rI15mX4pY2RQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYk2w1JJxz13Kk; Fri, 04 Jul 2025 19:19:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564JJJw1065470; Fri, 4 Jul 2025 19:19:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564JJJ0o065467; Fri, 4 Jul 2025 19:19:19 GMT (envelope-from git) Date: Fri, 4 Jul 2025 19:19:19 GMT Message-Id: <202507041919.564JJJ0o065467@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: bc3338985af9 - main - sockstat: microoptimize cap-getnameinfo List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc3338985af92914a9b6929c631551a527049acf Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=bc3338985af92914a9b6929c631551a527049acf commit bc3338985af92914a9b6929c631551a527049acf Author: Alan Somers AuthorDate: 2025-07-03 21:41:47 +0000 Commit: Alan Somers CommitDate: 2025-07-04 19:18:34 +0000 sockstat: microoptimize cap-getnameinfo Revert a change to the cap_getnameinfo, accidentally introduced in 0726c6574f8, that caused cap_getnameinfo to populate a buffer which was about to be thrown away. Fixes: 0726c6574f889507e5030173bf4c82c80911394d Sponsored by: ConnectWise Reviewed by: Damin Rido Pull Request: https://github.com/freebsd/freebsd-src/pull/1753 --- usr.bin/sockstat/sockstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index 52243910a31c..1a24ff67c321 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -951,7 +951,7 @@ formataddr(struct sockaddr_storage *ss, char *buf, size_t bufsize) } if (addrstr[0] == '\0') { error = cap_getnameinfo(capnet, sstosa(ss), ss->ss_len, - addrstr, sizeof(addrstr), buf, bufsize, NI_NUMERICHOST); + addrstr, sizeof(addrstr), NULL, 0, NI_NUMERICHOST); if (error) errx(1, "cap_getnameinfo()"); } From nobody Fri Jul 4 19:25:11 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYk9g572wz60c7M; Fri, 04 Jul 2025 19:25: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYk9g41yhz3Hw2; Fri, 04 Jul 2025 19:25:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751657111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CAcfq7GXZZcpN7N1GGkSrSEJ7QYXVPLfhjKLTLeUeI4=; b=QrtmMiNWPZ+jhhR/XlxAqjlnmKMVG3rPMSsOxl0Z1O4q2Eez3584OHbEVTor7m5t6gF8cP /1iHVftp1KNaQ4G8AI3fGQyFBw452jjcR3PlwTX6Yhxq2U25nYESBFhqKBTyLbYB86Kfkn mGz/Fnw1zraw3w4i5uHM6bQt+Pw+c3FJ8OHYXUwFV7zW/T9hnmZHDigYiUErlySTnxK172 M6EbMAB1BirpdZYFCvGnasjBnSVZ5X+671sFXsf2GLVwFEs6QJ1K20OBoLFW0paXZoVcep xAtWmzAYRdFNbnM2MOhYTA88AAO2QKo/sF5eXFOVzasRuGPLbAaNv7On9aM0gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751657111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CAcfq7GXZZcpN7N1GGkSrSEJ7QYXVPLfhjKLTLeUeI4=; b=RjGNxeqzAGuPlLTEQZc9vlDoKL269IP2r3ydg7feoHlu4OLmLkOmuuomrQS3BWmQqRT9z/ b8OiVFRUBLHc8PgdKTWPB3WbkbssGJhIB2/W3/DSMZpc08VTicARe6MCnfqO5//EMfyL1+ gtq/UUT6QKJ6lHU7e0iuRntpxa2HXiHEqf/mZRP73/cafCUj3z64sgjh9fwOWX2+zfGcvu 1cjSIKz7z59W1o4Co0xkejaTqZ655Fq7TpMdcuT4nrns/qvJjjNYE11/fnxLRbO8fBoEDp 9jbR/ddSQit2iXjRouM8fMs4PUZ+jcysLMP9uaI0wNurDwNynEmG+Hc6McydqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751657111; a=rsa-sha256; cv=none; b=qtknTAC7nTH/fj4jxpz44JpPlL/YXNyeKhwJGxU37edIjY6R9ZuB+7ggmoVDd+mnYF5s49 eDvVubvDggMyg3jdw6b2acwtQjvR0WAnb4TAcFHHt+yI7GhFqRTtq5UAUhXmCtqKf2GxI/ fuw12CjGpNpjY5THuoieHDK+jCFwAyJlnRJgJegfh9kK0xtZ08w5NubGtgMmjbzxwxSuRZ qi5k+1xr+uqcZE7jhoKb/fhdpCdOjnVsbDf/vz/wRxxmwDGQqwUow3pQpD5iLsp5q1sFg5 a5HSGDHLOUUi2HRBt82Qn7VZl0vpAsVHOpXF76LZQKwiJcqcaVFO2DGxyn62rQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYk9g3bwnz138l; Fri, 04 Jul 2025 19:25:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564JPBnB083959; Fri, 4 Jul 2025 19:25:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564JPBVi083956; Fri, 4 Jul 2025 19:25:11 GMT (envelope-from git) Date: Fri, 4 Jul 2025 19:25:11 GMT Message-Id: <202507041925.564JPBVi083956@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3b1c4cb1bfff - main - sys_generic.c: convert EINVALs to EXTERROR(EINVAL) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b1c4cb1bfff6efa363919de6c05765c24607b83 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3b1c4cb1bfff6efa363919de6c05765c24607b83 commit 3b1c4cb1bfff6efa363919de6c05765c24607b83 Author: Konstantin Belousov AuthorDate: 2025-07-04 06:42:34 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-04 19:24:52 +0000 sys_generic.c: convert EINVALs to EXTERROR(EINVAL) Sponsored by: The FreeBSD Foundation --- sys/kern/sys_generic.c | 63 ++++++++++++++++++++++++++++---------------------- sys/sys/exterr_cat.h | 1 + 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 5d09ba3f37f7..94e44d888181 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -37,7 +37,7 @@ #include "opt_capsicum.h" #include "opt_ktrace.h" -#define EXTERR_CATEGORY EXTERR_CAT_FILEDESC +#define EXTERR_CATEGORY EXTERR_CAT_GENIO #include #include #include @@ -196,7 +196,7 @@ sys_read(struct thread *td, struct read_args *uap) int error; if (uap->nbyte > IOSIZE_MAX) - return (EINVAL); + return (EXTERROR(EINVAL, "length > iosize_max")); aiov.iov_base = uap->buf; aiov.iov_len = uap->nbyte; auio.uio_iov = &aiov; @@ -234,7 +234,7 @@ kern_pread(struct thread *td, int fd, void *buf, size_t nbyte, off_t offset) int error; if (nbyte > IOSIZE_MAX) - return (EINVAL); + return (EXTERROR(EINVAL, "length > iosize_max")); aiov.iov_base = buf; aiov.iov_len = nbyte; auio.uio_iov = &aiov; @@ -330,7 +330,7 @@ kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset) error = ESPIPE; else if (offset < 0 && (fp->f_vnode == NULL || fp->f_vnode->v_type != VCHR)) - error = EINVAL; + error = EXTERROR(EINVAL, "neg offset"); else error = dofileread(td, fd, fp, auio, offset, FOF_OFFSET); fdrop(fp, td); @@ -397,7 +397,7 @@ sys_write(struct thread *td, struct write_args *uap) int error; if (uap->nbyte > IOSIZE_MAX) - return (EINVAL); + return (EXTERROR(EINVAL, "length > iosize_max")); aiov.iov_base = (void *)(uintptr_t)uap->buf; aiov.iov_len = uap->nbyte; auio.uio_iov = &aiov; @@ -436,7 +436,7 @@ kern_pwrite(struct thread *td, int fd, const void *buf, size_t nbyte, int error; if (nbyte > IOSIZE_MAX) - return (EINVAL); + return (EXTERROR(EINVAL, "length > iosize_max")); aiov.iov_base = (void *)(uintptr_t)buf; aiov.iov_len = nbyte; auio.uio_iov = &aiov; @@ -532,7 +532,7 @@ kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset) error = ESPIPE; else if (offset < 0 && (fp->f_vnode == NULL || fp->f_vnode->v_type != VCHR)) - error = EINVAL; + error = EXTERROR(EINVAL, "neg offset"); else error = dofilewrite(td, fd, fp, auio, offset, FOF_OFFSET); fdrop(fp, td); @@ -603,14 +603,14 @@ kern_ftruncate(struct thread *td, int fd, off_t length) AUDIT_ARG_FD(fd); if (length < 0) - return (EINVAL); + return (EXTERROR(EINVAL, "negative length")); error = fget(td, fd, &cap_ftruncate_rights, &fp); if (error) return (error); AUDIT_ARG_FILE(td->td_proc, fp); if (!(fp->f_flag & FWRITE)) { fdrop(fp, td); - return (EINVAL); + return (EXTERROR(EINVAL, "non-writable")); } error = fo_truncate(fp, length, td->td_ucred, td); fdrop(fp, td); @@ -841,8 +841,10 @@ kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) int error; AUDIT_ARG_FD(fd); - if (offset < 0 || len <= 0) - return (EINVAL); + if (offset < 0) + return (EXTERROR(EINVAL, "negative offset")); + if (len <= 0) + return (EXTERROR(EINVAL, "negative length")); /* Check for wrap. */ if (offset > OFF_MAX - len) return (EFBIG); @@ -899,16 +901,21 @@ kern_fspacectl(struct thread *td, int fd, int cmd, AUDIT_ARG_FFLAGS(flags); if (rqsr == NULL) - return (EINVAL); + return (EXTERROR(EINVAL, "no range")); rmsr = *rqsr; if (rmsrp != NULL) *rmsrp = rmsr; - if (cmd != SPACECTL_DEALLOC || - rqsr->r_offset < 0 || rqsr->r_len <= 0 || - rqsr->r_offset > OFF_MAX - rqsr->r_len || - (flags & ~SPACECTL_F_SUPPORTED) != 0) - return (EINVAL); + if (cmd != SPACECTL_DEALLOC) + return (EXTERROR(EINVAL, "cmd", cmd)); + if (rqsr->r_offset < 0) + return (EXTERROR(EINVAL, "neg offset")); + if (rqsr->r_len <= 0) + return (EXTERROR(EINVAL, "neg len")); + if (rqsr->r_offset > OFF_MAX - rqsr->r_len) + return (EXTERROR(EINVAL, "offset too large")); + if ((flags & ~SPACECTL_F_SUPPORTED) != 0) + return (EXTERROR(EINVAL, "reserved flags", flags)); error = fget_write(td, fd, &cap_pwrite_rights, &fp); if (error != 0) @@ -965,7 +972,7 @@ kern_specialfd(struct thread *td, int type, void *arg) break; } default: - error = EINVAL; + error = EXTERROR(EINVAL, "invalid type", type); break; } @@ -987,7 +994,7 @@ sys___specialfd(struct thread *td, struct __specialfd_args *args) struct specialfd_eventfd ae; if (args->len != sizeof(struct specialfd_eventfd)) { - error = EINVAL; + error = EXTERROR(EINVAL, "eventfd params ABI"); break; } error = copyin(args->req, &ae, sizeof(ae)); @@ -995,7 +1002,7 @@ sys___specialfd(struct thread *td, struct __specialfd_args *args) break; if ((ae.flags & ~(EFD_CLOEXEC | EFD_NONBLOCK | EFD_SEMAPHORE)) != 0) { - error = EINVAL; + error = EXTERROR(EINVAL, "reserved flag"); break; } error = kern_specialfd(td, args->type, &ae); @@ -1015,7 +1022,7 @@ sys___specialfd(struct thread *td, struct __specialfd_args *args) break; } default: - error = EINVAL; + error = EXTERROR(EINVAL, "unknown type", args->type); break; } return (error); @@ -1191,7 +1198,7 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, int error, lf, ndu; if (nd < 0) - return (EINVAL); + return (EXTERROR(EINVAL, "negative ndescs")); fdp = td->td_proc->p_fd; ndu = nd; lf = fdp->fd_nfiles; @@ -1284,7 +1291,7 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, rtv = *tvp; if (rtv.tv_sec < 0 || rtv.tv_usec < 0 || rtv.tv_usec >= 1000000) { - error = EINVAL; + error = EXTERROR(EINVAL, "invalid timeval"); goto done; } if (!timevalisset(&rtv)) @@ -1516,7 +1523,7 @@ sys_poll(struct thread *td, struct poll_args *uap) if (uap->timeout != INFTIM) { if (uap->timeout < 0) - return (EINVAL); + return (EXTERROR(EINVAL, "invalid timeout")); ts.tv_sec = uap->timeout / 1000; ts.tv_nsec = (uap->timeout % 1000) * 1000000; tsp = &ts; @@ -1541,7 +1548,7 @@ kern_poll_kfds(struct thread *td, struct pollfd *kfds, u_int nfds, precision = 0; if (tsp != NULL) { if (!timespecvalid_interval(tsp)) - return (EINVAL); + return (EXTERROR(EINVAL, "invalid timespec")); if (tsp->tv_sec == 0 && tsp->tv_nsec == 0) sbt = 0; else { @@ -1644,7 +1651,7 @@ kern_poll(struct thread *td, struct pollfd *ufds, u_int nfds, int error; if (kern_poll_maxfds(nfds)) - return (EINVAL); + return (EXTERROR(EINVAL, "too large nfds")); if (nfds > nitems(stackfds)) kfds = mallocarray(nfds, sizeof(*kfds), M_TEMP, M_WAITOK); else @@ -1821,7 +1828,7 @@ selsocket(struct socket *so, int events, struct timeval *tvp, struct thread *td) rtv = *tvp; if (rtv.tv_sec < 0 || rtv.tv_usec < 0 || rtv.tv_usec >= 1000000) - return (EINVAL); + return (EXTERROR(EINVAL, "invalid timeval")); if (!timevalisset(&rtv)) asbt = 0; else if (rtv.tv_sec <= INT32_MAX) { @@ -2198,7 +2205,7 @@ kern_kcmp(struct thread *td, pid_t pid1, pid_t pid2, int type, (uintptr_t)p2->p_vmspace); break; default: - error = EINVAL; + error = EXTERROR(EINVAL, "unknown op"); break; } diff --git a/sys/sys/exterr_cat.h b/sys/sys/exterr_cat.h index ddc635a116c0..cab94ac511a5 100644 --- a/sys/sys/exterr_cat.h +++ b/sys/sys/exterr_cat.h @@ -17,6 +17,7 @@ file into kern_ktrace.c */ #define EXTERR_CAT_FUSE 4 #define EXTERR_CAT_INOTIFY 5 +#define EXTERR_CAT_GENIO 6 #endif From nobody Fri Jul 4 20:11:24 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlC04vsnz60jKk; Fri, 04 Jul 2025 20:11: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlC03RDTz3jDS; Fri, 04 Jul 2025 20:11:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751659884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gOVMIR9ke6AjUAmtpFmv4QR4mTKcGEtRN+DAq0FT5bQ=; b=XCl/DcIPqGvm05xeiOJUCVSFRKwV8EFpG7rVEmLrD0TsxJ94+8JU6QdBI0xAsM4QDZ7qpn QLnMdCXeuWohHA2b0mh2fPPVF1Jghv3Qg3+Z32quwmpzJZnrz6ylnLrfADJM+uvQE9Bag9 LkpZEi/PoQM2RrQdgQwg6Av8WhPrsYO5MfIWyEx0kHl2zEHJoqRcX0QWIFGQpHafwEUKpV dPUwxzWLcJfZTRsCSPMb2X6lFxrYPdtAcM+mvTBFLf1kCu+45hZGcyOXCh0tAZGKTgib62 AdZhC4c7HWRsvhMsuucUQifCSbYLUGg4Z2SBO6mlJVhDQx6xkJCRRHgzmY+6jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751659884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gOVMIR9ke6AjUAmtpFmv4QR4mTKcGEtRN+DAq0FT5bQ=; b=EBFQr4SF1TVLIP20e9s4fwv25VCvO1ZGkm0v9HJpRk60LNKcqc4U6m+XWcEyzjoG4WRsna XA525FtAhhaQMGPH/mrImk6Wbso2TTFhATH0sUgvrYqum/Q8GfYE88nSbsFXBWmbweFeSC kqrr/bmjZ2V7DpTPFP5oSRuI4gQyiznvLugq/x+iTL5IO1uJU6509WD1XFGTihw5EELvic RMuRclYqR6skt14SK8iwBvYQ0rh9TKEu7uIrFzqGGP5fkYvvcfXmpkP4/TXPYV5JrJbUl/ 3oe0hbXjgQIn62HFF5bKgCrQOpMPnLR4I3szzIHVNwi5kkozC+WrAN/7blT9sA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751659884; a=rsa-sha256; cv=none; b=vKSeGJR4HOurrsjVPYX6bIYYPvL3TpdvkhaKz7f+1YM0ts8u2YnH2BDtqL4sExff9EUUOL gXmzWnNV4Nmmgmz9/1kW8b3X+sMJdagcoqF/vHL9t8esb4lOXha/zgXXkYRIdEBuEcxn2V t19PnL98KNSzuouyNKf4O86sWj+CFfpS1PVpmHO+P/qvc692uqK97eS+kEfW20zivwEzYb UpAyBFWd0X0uoQNxsDC+7zaJZ1qhdNegPXcI98pEF+aAJTka69bs23SNCiyO9bSoRcRIFC JWSHt/E6FjKrXMUSbNY6kqIA+TbnKpJYdrQtXuc7UFNRfE9qc1QV1Sv1qSDhrw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlC02szNz13x9; Fri, 04 Jul 2025 20:11:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KBOkU074010; Fri, 4 Jul 2025 20:11:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KBOGH074007; Fri, 4 Jul 2025 20:11:24 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:11:24 GMT Message-Id: <202507042011.564KBOGH074007@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 88d94ead7f7c - main - lposix: Use reentrant passwd and group lookup functions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88d94ead7f7cfb7ea7c4134b4cd2f89da670a8e1 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=88d94ead7f7cfb7ea7c4134b4cd2f89da670a8e1 commit 88d94ead7f7cfb7ea7c4134b4cd2f89da670a8e1 Author: Mark Johnston AuthorDate: 2025-07-04 19:06:10 +0000 Commit: Mark Johnston CommitDate: 2025-07-04 20:11:12 +0000 lposix: Use reentrant passwd and group lookup functions The implementation of chown() in the posix module handles user and group names as well as numeric IDs. When resolving names, be sure to use reentrant lookup functions rather than assuming it's safe to clobber the internal buffers used by getpwnam() and getgrnam(). Fix some style nits while here. Reviewed by: imp, bapt MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46555 --- libexec/flua/modules/lposix.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/libexec/flua/modules/lposix.c b/libexec/flua/modules/lposix.c index 816d4bc688d2..9edc7e687786 100644 --- a/libexec/flua/modules/lposix.c +++ b/libexec/flua/modules/lposix.c @@ -88,18 +88,23 @@ static int lua_chown(lua_State *L) { const char *path; - uid_t owner = (uid_t) -1; - gid_t group = (gid_t) -1; + uid_t owner = (uid_t)-1; + gid_t group = (gid_t)-1; + int error; enforce_max_args(L, 3); path = luaL_checkstring(L, 1); if (lua_isinteger(L, 2)) - owner = (uid_t) lua_tointeger(L, 2); + owner = (uid_t)lua_tointeger(L, 2); else if (lua_isstring(L, 2)) { - struct passwd *p = getpwnam(lua_tostring(L, 2)); - if (p != NULL) - owner = p->pw_uid; + char buf[4096]; + struct passwd passwd, *pwd; + + error = getpwnam_r(lua_tostring(L, 2), &passwd, + buf, sizeof(buf), &pwd); + if (error == 0) + owner = pwd->pw_uid; else return (luaL_argerror(L, 2, lua_pushfstring(L, "unknown user %s", @@ -112,11 +117,15 @@ lua_chown(lua_State *L) } if (lua_isinteger(L, 3)) - group = (gid_t) lua_tointeger(L, 3); + group = (gid_t)lua_tointeger(L, 3); else if (lua_isstring(L, 3)) { - struct group *g = getgrnam(lua_tostring(L, 3)); - if (g != NULL) - group = g->gr_gid; + char buf[4096]; + struct group gr, *grp; + + error = getgrnam_r(lua_tostring(L, 3), &gr, buf, sizeof(buf), + &grp); + if (error == 0) + group = grp->gr_gid; else return (luaL_argerror(L, 3, lua_pushfstring(L, "unknown group %s", From nobody Fri Jul 4 20:26:06 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlWz0jjYz60lK3; Fri, 04 Jul 2025 20:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlWy4W6Gz3syl; Fri, 04 Jul 2025 20:26:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yg2wSEJTYSuzKOmDTtTq/7wDTUJaOxh/g3Lz0VG3bfg=; b=Cw9CYb4K1Ft+rEDgG3mSzIBQevSVGdb/kNCY7iwWCB56/j95uuHDU16RKqy2csVpzX4XeN +JSclp4+VJrSfUvhMnjG4oNM8PdNV/hMDLTzwEJQ9wxCOaL0RtYXpI/yr+uqZLp6txn1nI QsxwBTUSxc7pAN0vgC3wgNEGBbFMWQ/coPkHLriJCYbdlMBB/2i3QEkac0QIqSkRHP9w4m 2gQqWIAHj3pIlCw1d+rGhW5PkdGHlMJCHqqaHZqmJIjRm1KNLe3mIZv3ENqboGKzLmzsAo jvgb38t3YukTzGf9HKoja30VKhE0EZT4UNjotR1cOYFSRkWvFPtSGw/RudFNBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yg2wSEJTYSuzKOmDTtTq/7wDTUJaOxh/g3Lz0VG3bfg=; b=bBemKZ1utVk+8ExXd2kg2aN5sM2UhoKTzW0D3vE8ThgiqU/Sec2uj9ZibLMsgZRQAoiDeM sr8cmgzhIAxR6woZpAJ2YYAQ1fHJH03WA+5Xm433d1EBhW8h4lkI8O7tQ9u7FwRYFIhayq LIIqTHPb79A8U9/76Mq2ac9mx9UKu49PSP0nRQciPq5oj4iPSJ0yR9DgRappFYeX5knr/C /wK2DpEOD6uLp9hdcaG9Be6CcrhZe6HO7cuR3HOznC83npNy0GVB0eeSfuYK+zj2tvylqx MVRlMU4oKLM/a/fjiYMBYngTgifd2xM/HsghsX+SlpOP+MQmYP7Ue6rE+wX5zQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751660766; a=rsa-sha256; cv=none; b=vcz+GMb/X0kFa4Xzu0I6riLmekOZvmC5qERmSqBZ/ofPsPxsLB00hVNhTYqx3BNMvUm85D LTRgkvXKxFGVk5bD7Vq/t+ikfvtze+ebMOaA2ZPeqIGdAn1gm9AhLM514hjOsqlSrsfxHk lADw05d5cVBBlQ55mBxCAWHJpWB2MjUypW7Bdce7Ycylix7x7dGZCbTS7ABPPiZSa0vdMk Z2aaJyj9HnusiG/fGp+4WusFDHzOj10MQEOBftIajlitbODTmq8h57/vhyIda1XWvdmF3Z t35OpiABSQA1NzQCkWrCbq0af8HiVDj9Lf8XXJLEOG0gvVdkjFMpbHZqmnvDEA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlWy3pqSz14Qn; Fri, 04 Jul 2025 20:26:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KQ6gG096763; Fri, 4 Jul 2025 20:26:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KQ61o096760; Fri, 4 Jul 2025 20:26:06 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:26:06 GMT Message-Id: <202507042026.564KQ61o096760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: ed50879c4a95 - main - gpiobus: gpiobus_acquire_pin: panic on invalid pin List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed50879c4a9591d075890f61c7f8f7c29d5c6f3a Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=ed50879c4a9591d075890f61c7f8f7c29d5c6f3a commit ed50879c4a9591d075890f61c7f8f7c29d5c6f3a Author: Ahmad Khalifa AuthorDate: 2025-06-19 13:42:56 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 20:24:31 +0000 gpiobus: gpiobus_acquire_pin: panic on invalid pin It is a programming error to call this function with an invalid pin. Also return proper error value on failure. Suggested by: mmel Reviewed by: imp, mmel Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50940 --- sys/dev/gpio/gpiobus.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 6b5379b6084a..ab849ca3db98 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -401,14 +401,13 @@ gpiobus_acquire_pin(device_t bus, uint32_t pin) sc = device_get_softc(bus); /* Consistency check. */ if (pin >= sc->sc_npins) { - device_printf(bus, - "invalid pin %d, max: %d\n", pin, sc->sc_npins - 1); - return (-1); + panic("%s: invalid pin %d, max: %d", + device_get_nameunit(bus), pin, sc->sc_npins - 1); } /* Mark pin as mapped and give warning if it's already mapped. */ if (sc->sc_pins[pin].mapped) { device_printf(bus, "warning: pin %d is already mapped\n", pin); - return (-1); + return (EBUSY); } sc->sc_pins[pin].mapped = 1; From nobody Fri Jul 4 20:26:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlX137SGz60lGW; Fri, 04 Jul 2025 20:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlX05Kv1z3sr0; Fri, 04 Jul 2025 20:26:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hXCOIUj2g249aoN+IwQR7OO/KnuBNEiA9lKAkrwCZN4=; b=lLR+MykMMqXUHC2w8MVye1Nw1/nxV3ikbFYjPIspIOAgezCKJQgI1u/hymhzq/Pqn8LehQ SkRy9tILavg7dzIZkn4yAq3XxE4zN88Kl7CoyDHEpQuCt74pTniQEL5k8VdfxOTaTDuVkj 2otL0yZFE2JMq0mtjZkIewxeTAnKgzsiPuxtk3Bk35az/UCyVf6ayEIK9JtzJPaPz3qKDv Hy2xFnlcbw5WGoA98WSh//iD1YUfxnknzeSneGCZy/M5jbOcbsKBXOQU3Zo9mo7RdbWqNb CeZDo0aiG2kJvowIouNPU2jLmEys4dihtL9gL8PIT5P9YW+504AxVZUeDssgnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hXCOIUj2g249aoN+IwQR7OO/KnuBNEiA9lKAkrwCZN4=; b=on8rsC6mlr1dZ4ia4nXx9HWPt2RfrlmMBOjcDgPnVMzc/P+T8I8LW7gDu0EyWWM5E/mm7z j5l7rbkzrI9oL8VBKaRl0UQcDMf2vwe8YVhx99jQRsgmyfB5KmZsjhDWsEMNi65TzDKe0x ZGaQ3MAPMW5i/kPcweDmHkniPz4kKV17iEszsPYz7R7ug6WcPFo5uUnJYp2z4uGPMl1HK6 qo+HMcDfSy1Zhgou/1XGd3kQ9Hd85kPkH0W6pM9Y915UgAEUYWwgcfEHUUyMg/xr4IVv2G h6FJvinO8HQKQpKrlRK1MZW4Z3RnPwigCrwjlaxmqXMckX2N7hrj7Wg7Ulu/dQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751660768; a=rsa-sha256; cv=none; b=Xw5/waU0WeXrIsUgZACxny8jtHV6V11CDEyZQJJatM/qs8n1V0q8fMH+/PeCiu6GdCxZYF yCHr6kjvcerY+Vsb3DsGyNfx7mrU2ngncb8vkHz7OcofnbtM7IQobNcTTdCMDYPR9bRKOx mhH5SZrjf8wFoRKDf64Gzv+H+J0WJ0Osvxo3IbwMrHOkgfAAmKqZhrISpOQ/HHIoFBSllz w2kf3pqR6sYJRkzYG+xXwoeImZlTzi3y6nwma7VoBycToFcJlWXCksrBdz9JYZS65AWSlO n+rJgJ1z8jA3v4jNvZJxpHJ8Y9ayZ7EgGPNTg7MHp4pTafyQHjYLUi9Y9SqVCA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlX04vvdz155x; Fri, 04 Jul 2025 20:26:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KQ8qV096831; Fri, 4 Jul 2025 20:26:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KQ8re096828; Fri, 4 Jul 2025 20:26:08 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:26:08 GMT Message-Id: <202507042026.564KQ8re096828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 92b352f694e8 - main - gpiobus: gpio_pin_release: convert checks to KASSERTs List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92b352f694e83827252d42a58df3c6e4dd0e0164 Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=92b352f694e83827252d42a58df3c6e4dd0e0164 commit 92b352f694e83827252d42a58df3c6e4dd0e0164 Author: Ahmad Khalifa AuthorDate: 2025-07-04 20:02:57 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 20:24:31 +0000 gpiobus: gpio_pin_release: convert checks to KASSERTs Reviewed by: mmel, imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50868 --- sys/dev/gpio/gpiobus.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index e919561340a8..c28fac66115b 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -218,15 +218,13 @@ gpio_pin_release(gpio_pin_t gpio) { device_t busdev; - if (gpio == NULL) - return; - + KASSERT(gpio != NULL, ("GPIO pin is NULL.")); KASSERT(gpio->dev != NULL, ("GPIO pin device is NULL.")); busdev = GPIO_GET_BUS(gpio->dev); - if (busdev != NULL) - gpiobus_release_pin(busdev, gpio->pin); + KASSERT(busdev != NULL, ("gpiobus dev is NULL.")); + gpiobus_release_pin(busdev, gpio->pin); free(gpio, M_DEVBUF); } From nobody Fri Jul 4 20:26:07 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlX00ZMQz60lK6; Fri, 04 Jul 2025 20:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlWz4Rj9z3t6N; Fri, 04 Jul 2025 20:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KjSZTmbUMBnOttEGIFTrFGqYacs80TpX9R9gPIuKzJQ=; b=UG5FPRW88pG36fSsYYBHDpHZ6jVi74c0EItdxgO5V4dr7i+qhmfFBJ4I09PIEL6j7XQEy6 Iymfu/RbanoMUwDeSiLrP/TZRu9jTQoiL4KBKwEbcXCLb0BZt51v2/N2mN5WtNwNQQraKB qOrW421lw0CYFESU2ScLql/DxKeEWmoEJXw/uHQ4Tj/hBUMktt6NDBV5zgogqK/uO15VHB fzGL7jnyET+zAw7tmWYqjqqgnqhGGInizHyBokzmLwt212vfIoP9hWerz6ozFsh+29vGIH w4x3rwRinlS0yo7QZkW/uhSARSEeEWsx6BxwD1o0LnvHqvfexi5cBftwarq1nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KjSZTmbUMBnOttEGIFTrFGqYacs80TpX9R9gPIuKzJQ=; b=jh5HemmR2UBdzaOqQeaJwpub3sVgwC9XroL6OHfkBT1xLR84AEo6ConKPb1PfQbeNOAVVZ V23HKv5OULImbizRLhz8ueTWY5uf323INeDWxhjxTFZS8XrdHeyVEr5BMlIMvF6I4eGX8s dildG9KBXvB7pdW40hK/mBO5K6VsfsX+WRTr8ng5uF7EqRMz2CMN1R5vdpCO+ONNQ98pc0 F3WfGuPm0hKmSjTmkTPTFZULROI+Lhx4NpwpRKk9iaUq/4ka6Opb71HBOmNqraERg/QaNa dn8mmzcSd2m54sPpJxfqcf26HZINVixtRBFhxQ9u3SUkzDBb/sPaFPWe6UmiIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751660767; a=rsa-sha256; cv=none; b=WXY/xv1+JnE8nIfnmaqx6ti+gyhqknC2E68xsXyq9yFW2z5QhN2DYfu5VIFGgjKthdlnZX lDrRJQtpTMeVvuddY/wBQZ2ktojxyAedFvnEaFRlykJ8m+NHmshXlI2QjcCujcWmIRXj6q bj7JfHCqvIRBzI+iaS5X579Oa6/Fd3EFz38RVVuWMMx64bschNtxetWO5hXQDXWlY03Myi 7cQ+MkS8yaRfmLfEGRQyWL9FyW4BprVrOePVnS1iwesM4Abla97f+jdOp0F5u6tR4ti/B6 yyR4uppY46pj5Xe5o7L+UYAPwMaWlTXDCRZtiKCtGk+P6V23QFKnIfZw01+13Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlWz42Bnz14cB; Fri, 04 Jul 2025 20:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KQ73s096796; Fri, 4 Jul 2025 20:26:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KQ79m096793; Fri, 4 Jul 2025 20:26:07 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:26:07 GMT Message-Id: <202507042026.564KQ79m096793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: a2bfb7cff243 - main - gpiobus: gpiobus_release_pin: convert errors to panic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2bfb7cff243bdafebde5ea8629810fe507a2aea Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=a2bfb7cff243bdafebde5ea8629810fe507a2aea commit a2bfb7cff243bdafebde5ea8629810fe507a2aea Author: Ahmad Khalifa AuthorDate: 2025-07-04 20:01:29 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 20:24:31 +0000 gpiobus: gpiobus_release_pin: convert errors to panic These are programming errors. Suggested by: mmel Reviewed by: imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50939 --- sys/dev/gpio/gpiobus.c | 21 ++++++++------------- sys/dev/gpio/gpiobusvar.h | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index ab849ca3db98..e919561340a8 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -415,7 +415,7 @@ gpiobus_acquire_pin(device_t bus, uint32_t pin) } /* Release mapped pin */ -int +void gpiobus_release_pin(device_t bus, uint32_t pin) { struct gpiobus_softc *sc; @@ -423,19 +423,15 @@ gpiobus_release_pin(device_t bus, uint32_t pin) sc = device_get_softc(bus); /* Consistency check. */ if (pin >= sc->sc_npins) { - device_printf(bus, - "invalid pin %d, max=%d\n", - pin, sc->sc_npins - 1); - return (-1); + panic("%s: invalid pin %d, max: %d", + device_get_nameunit(bus), pin, sc->sc_npins - 1); } - if (!sc->sc_pins[pin].mapped) { - device_printf(bus, "pin %d is not mapped\n", pin); - return (-1); - } - sc->sc_pins[pin].mapped = 0; + if (!sc->sc_pins[pin].mapped) + panic("%s: pin %d is not mapped", device_get_nameunit(bus), + pin); - return (0); + sc->sc_pins[pin].mapped = 0; } static int @@ -450,8 +446,7 @@ gpiobus_acquire_child_pins(device_t dev, device_t child) device_printf(child, "cannot acquire pin %d\n", devi->pins[i]); while (--i >= 0) { - (void)gpiobus_release_pin(dev, - devi->pins[i]); + gpiobus_release_pin(dev, devi->pins[i]); } gpiobus_free_ivars(devi); return (EBUSY); diff --git a/sys/dev/gpio/gpiobusvar.h b/sys/dev/gpio/gpiobusvar.h index 3ae0767466c9..975788e84a83 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -182,7 +182,7 @@ int gpiobus_alloc_ivars(struct gpiobus_ivar *); void gpiobus_free_ivars(struct gpiobus_ivar *); int gpiobus_read_ivar(device_t, device_t, int, uintptr_t *); int gpiobus_acquire_pin(device_t, uint32_t); -int gpiobus_release_pin(device_t, uint32_t); +void gpiobus_release_pin(device_t, uint32_t); extern driver_t gpiobus_driver; From nobody Fri Jul 4 20:26:10 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlX32mgQz60l8T; Fri, 04 Jul 2025 20:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlX30xXwz3t4h; Fri, 04 Jul 2025 20:26:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yWT9gb8zojP/VWahLnHAKK6KZrSoVhWAKDFOn/7fR+8=; b=RjlyzOf5+suAhFmBkXBAx8ZBa7ZpoJbEYTaF7To5EuSzIk7bGVY9WuPNszI1ub4SQ/fpwC 3ooT5JyONKU5k5SCBdqzncowfR8sfmcnPa3MkKdlldOE1Yv9OJD3/8OkA6EHuXPl1RhAjx jx3A8qdMtAAfWI7P2fOVju9LkV94LRSG7nwg+0vvbZfgj9oO5Bn2S6ENc58F6Mv4nW66G4 d/WkCXihXUat6GrnXS8jTwRC+6zPkR8/izW0KBtRdqIpo3QQ5T/bhg9T4+MHDaywtTV64J qHJPSuwmAGQFeeJQvPvHfmpu1I5nCxCe4SjdGHrXESxaJrZGzJcTm0AZBv/OZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yWT9gb8zojP/VWahLnHAKK6KZrSoVhWAKDFOn/7fR+8=; b=A9SUmdKWlN7DvEnSgcbitpIcSY7XF4sMWYx62mNvz6CXiVIyfHqkykWifi0qVv7MSdtA5a V0sD5LZXTgtDxNr5xIx0SXAZqibC4rRmxM9lftVvTDEdaRLM2B5bPAgNTQ2HXoSU0MHFl8 Q4HrNEkBAH1/8rDlJ4JCh6ZuFIoWTMMz7K6EjRlTFGyml8soefQfxu52gaT8sGim84UhPl ygQecbBHLmpRZ1uzDNiVJ/6gF+yrAfTQKvnlOjWGKFCLUILV/qSVx02+yrIQBXpFwA/smz mtNxXYSB+KGSrAmdG3c/IqHHK1KHVDDtJhA2RcInha1VJbh4ThyRjxdnjbjmkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751660771; a=rsa-sha256; cv=none; b=XZXSQLlG+89nwYm5hm5E2lcxbJRxV8+PAjXCv0ibpDw3H+2qw4chIhS4vQTLOKyHCC4utx Hgoic/1z+8BlX0qdWaAJBNTboIKZaZoV1KGSgEKW4cS2Q8YWrWA0WIvT4eltuAZkvlaQ19 S9N5uri7dLeCw02bK+NYPZd3cy9a1A/N3Ysk2QS1V44/IKe5nKCl6tit7Q6bDiyTp+OtYn 3KNUOME+HAb1U+kzyV+DX5AvmWJTfULhTWk+pbHxqfG9895R1xO1Xat2nPxhSwEfmT3kxp LOmvW/kVLlxNUSbjmbCJFRjnLV5V1vz4XsCrY2py8fUomIcVN4IHvBzTP4dakA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlX26nmLz14j6; Fri, 04 Jul 2025 20:26:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KQAf2096897; Fri, 4 Jul 2025 20:26:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KQAV1096894; Fri, 4 Jul 2025 20:26:10 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:26:10 GMT Message-Id: <202507042026.564KQAV1096894@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 7f297cdae380 - main - regulator: don't use internal gpiobus function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f297cdae380022bcdc72b3b11d1ecb7a902e578 Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=7f297cdae380022bcdc72b3b11d1ecb7a902e578 commit 7f297cdae380022bcdc72b3b11d1ecb7a902e578 Author: Ahmad Khalifa AuthorDate: 2025-07-04 20:03:10 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 20:24:31 +0000 regulator: don't use internal gpiobus function gpiobus_acquire_pin is only meant to be used internally by gpiobus. Use gpio_pin_acquire instead. Reviewed by: manu, mmel Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50870 --- sys/dev/regulator/regulator_fixed.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/dev/regulator/regulator_fixed.c b/sys/dev/regulator/regulator_fixed.c index 0a76da7140a0..55cdb5e4aeae 100644 --- a/sys/dev/regulator/regulator_fixed.c +++ b/sys/dev/regulator/regulator_fixed.c @@ -100,12 +100,8 @@ static struct gpio_entry * regnode_get_gpio_entry(struct gpiobus_pin *gpio_pin) { struct gpio_entry *entry, *tmp; - device_t busdev; int rv; - busdev = GPIO_GET_BUS(gpio_pin->dev); - if (busdev == NULL) - return (NULL); entry = malloc(sizeof(struct gpio_entry), M_FIXEDREGULATOR, M_WAITOK | M_ZERO); @@ -122,8 +118,8 @@ regnode_get_gpio_entry(struct gpiobus_pin *gpio_pin) } /* Reserve pin. */ - /* XXX Can we call gpiobus_acquire_pin() with gpio_list_mtx held? */ - rv = gpiobus_acquire_pin(busdev, gpio_pin->pin); + /* XXX Can we call gpio_pin_acquire() with gpio_list_mtx held? */ + rv = gpio_pin_acquire(gpio_pin); if (rv != 0) { mtx_unlock(&gpio_list_mtx); free(entry, M_FIXEDREGULATOR); From nobody Fri Jul 4 20:26:09 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlX23cTJz60lC0; Fri, 04 Jul 2025 20:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlX16ZMGz3t4Z; Fri, 04 Jul 2025 20:26:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VUcVd91vdELQUi6d1Ea9V9tG5Lqi1fMc2D8eL5WFTrA=; b=rKQ9BHAetv6wUD0cdaaLwTRNH+tcKlLRrwYbW6gN0aFlwkkoAgs95MwThvwPG/cfImfsXY daNc8y2nhV6BlfC1a//9jwwrOiYFRrK2+JtxM6lCvfIP7sfHbdzpwP8DS5RRMrWbZZrA7b 5mjs1lRAkUz/KhwZe0uGDSkSgeOyC2btuWhaEUOsN8EBZdAhsPLT9UVrgIbpGpTizcno/7 Prs0rLc1nrl9vZRJ5nC3TB2PJ0Qp2W8eLsEdxVH7W3kdMMo3JQ6KLRGELfzBY8I5vHQEBj 5d+riH6hUPNmI3FmZjmOtGQBPfKwcLMBMuNnNJMxdjMSj23MalsH+y7rm8Jnsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VUcVd91vdELQUi6d1Ea9V9tG5Lqi1fMc2D8eL5WFTrA=; b=NlHIwc0VQlz2+FyDWABp/cQO7zsPwpx7P6LHyA1Pp3QETGB4Zy4PoA3qxLLNo/FSoimVA7 S52y4Mx+LdcS73MLnViqKzmyTzmogEKsOpCQeNTw4HdvN5NEfRAWiu2ouy+il1atnkZ/yz epueyCagP5f5UAttIA3H2iVbYB7OuoAjsQU4ZP8xZWDxa5Es9HQytMDab6rISJzEG7hJMz INp1cakuE2p9oxWsCdqWlKEjgunFemXQ376ox/eoR9m8dQKnLmlE31CtJ9cNmeVk3GG1Pw Uzrn9uPxLFuT0KB6AnOT9y2UB9czcA8GlKRNRRyBbVwDlrMQ9c9q3saANkQt4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751660769; a=rsa-sha256; cv=none; b=GZtIavnzRO1YAjBWoT6mmbX9lF/4EhY3s55nxl3b0HGjoh5Naftb+Z62e6L6z/0NK/Kuxe NhduG77J9UAc4xxw/+cyy9nTP9Agw+BHHnzx0jXpZb2XlIdThxVRe9SM2M55PMom1zYzSI amBo/e/+mx+wLMm7GwZlBckyOCK+UxgXc/wb1Jwp20GKrKcr2Vlu/wJoQGWC/dp+GY4eWF ZlzclMPaxi+Y2GFpeLM5F8ilnpE4cF28JtQI2FAL4LMoDCOemMD7W44TxaQhlwyliV6FFu BkoN2qq40SnFlvWQhGjgfKKalQN+KYC3AeyLhlBiGiGmQA73nH0sZUvKoOgF+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlX15sswz155y; Fri, 04 Jul 2025 20:26:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KQ9BZ096865; Fri, 4 Jul 2025 20:26:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KQ9to096862; Fri, 4 Jul 2025 20:26:09 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:26:09 GMT Message-Id: <202507042026.564KQ9to096862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 4a21713278a8 - main - gpiobus: add gpio_pin_acquire List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a21713278a865906e853b69357cf59a379df93a Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=4a21713278a865906e853b69357cf59a379df93a commit 4a21713278a865906e853b69357cf59a379df93a Author: Ahmad Khalifa AuthorDate: 2025-07-04 20:03:04 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 20:24:31 +0000 gpiobus: add gpio_pin_acquire In some cases, drivers may need to acquire an existing gpio_pin_t. With the functions gpiobus currently exposes, this isn't possible as they allocate a new pin then acquire that. Add a new gpio_pin_acquire function which accepts an existing gpiobus_pin structure. Reviewed by: mmel, imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50869 --- sys/dev/gpio/gpiobus.c | 22 ++++++++++++++++++++++ sys/dev/gpio/gpiobusvar.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index c28fac66115b..84980f3d6546 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -213,6 +213,28 @@ gpio_pin_is_active(gpio_pin_t pin, bool *active) return (0); } +/* + * Note that this function should only + * be used in cases where a pre-existing + * gpiobus_pin structure exists. In most + * cases, the gpio_pin_get_by_* functions + * suffice. + */ +int +gpio_pin_acquire(gpio_pin_t gpio) +{ + device_t busdev; + + KASSERT(gpio != NULL, ("GPIO pin is NULL.")); + KASSERT(gpio->dev != NULL, ("GPIO pin device is NULL.")); + + busdev = GPIO_GET_BUS(gpio->dev); + if (busdev == NULL) + return (ENXIO); + + return (gpiobus_acquire_pin(busdev, gpio->pin)); +} + void gpio_pin_release(gpio_pin_t gpio) { diff --git a/sys/dev/gpio/gpiobusvar.h b/sys/dev/gpio/gpiobusvar.h index 975788e84a83..972e1f196399 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -156,6 +156,8 @@ int gpio_pin_get_by_bus_pinnum(device_t _bus, uint32_t _pinnum, gpio_pin_t *_gp) /* Acquire a pin by child and index (used by direct children of gpiobus). */ int gpio_pin_get_by_child_index(device_t _child, uint32_t _idx, gpio_pin_t *_gp); +/* Acquire a pin from an existing gpio_pin_t. */ +int gpio_pin_acquire(gpio_pin_t gpio); /* Release a pin acquired via any gpio_pin_get_xxx() function. */ void gpio_pin_release(gpio_pin_t gpio); From nobody Fri Jul 4 20:26:11 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlX53zxYz60l1c; Fri, 04 Jul 2025 20:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlX46Y1xz3tBr; Fri, 04 Jul 2025 20:26:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gExnEWnwpIkwg1vLqNXj1Rxii+oQq23UFji0M6Pie4E=; b=riAfkcdp73dyccVceZwgfcpicOe6tJHRstffx3rdFyMBP5MpWTZQPomtlp2nZqdkfcGSKL 5QIFuVip9XhEG+9Uo1V5nYDyUx5a8+9s7qXCq9JsPGltbsOtB1HOGSvZ0u+59FyFj5JmPR yflSTDI1j+KDtvHFFghEuaHksWRSISJA5zONnfmQ61FfcaDH+PY2Vx+rkHf1j0/kglCF60 /YkEDKmhO6PjtyOcs60tfdT9xEMwAgk9ifRP16BRE+Q/pxIvLCceeWGOjJar6x/jpqTqJD uEnHMNR/hpmFsP3Rked7FjfPiMptWF50bIkz7bVy6bD48G519F5WauFszYc5Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gExnEWnwpIkwg1vLqNXj1Rxii+oQq23UFji0M6Pie4E=; b=cCqkkSxogpDaATLQhv8TVpm0N+hSaj3BrhUUsA1tGco6mVkbmpM2NidcbIixMSHv64WHHO ub4MWPSjSEU1sXXZuwzr5HjPlYPzz1O2/UY7LIbT/k0ZCy6A483wzZamFrtKWrerzqx8mN 6YnletvP7pxJtlYqLv2QtQDQzFkE75HobkFEFetwcUQVGANKdKBXC8Zd+Lz3O6MLeyPxsh 1Nk+j7gOv+btM7zhV0eGoMpvW3dijuisQpS17yB1Sfq0pQ8LEtjmEYkfgb1tzWAHX3Svp7 jkoRYu60tUBpcfegbB/ij/uOVGG44x7mNl1A7gD+ho56kmYpSDhWE5XGu3Q3/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751660773; a=rsa-sha256; cv=none; b=t/TbHP23J3f7g0yPovRl0SB8NojRi8/7dtJUG280Ph90AzOwaoGStrP7y+qUSky2DNuqgk tmoPpVkqn/+EWTuP3xdRYgGnAdekrDIyw4P/Im7Mg6Q5ApGVcdrgq/pzDHhFx+IJvdOMyL QWIjZpMsAnA1LB5TP40MVn8t/RfsayPGZ5f+2/hav/WpXqbC/SbOZMUhln85R35jSTiqYn ZyFqR0258t2LHPtQpZ1LXgtKS0OIRIVm56RVpbtISWUwiXFef8vOCVknDIonPyPvtAxRP4 81XEZASfc+5nQR+eLA9ZE65Zd/vU0QvFTfFrtEAALagwSjFb0Mm1z95VBOG+xA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlX40cYgz14y7; Fri, 04 Jul 2025 20:26:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KQBcc096935; Fri, 4 Jul 2025 20:26:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KQBvd096932; Fri, 4 Jul 2025 20:26:11 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:26:11 GMT Message-Id: <202507042026.564KQBvd096932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: ff826f8ed434 - main - gpiopps: don't use internal gpiobus function List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff826f8ed434c03f9f122eee16a060472d4860d5 Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=ff826f8ed434c03f9f122eee16a060472d4860d5 commit ff826f8ed434c03f9f122eee16a060472d4860d5 Author: Ahmad Khalifa AuthorDate: 2025-07-04 20:03:18 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 20:24:31 +0000 gpiopps: don't use internal gpiobus function gpiobus_release_pin is only meant to be used internally by gpiobus. Use gpio_pin_release instead. This also fixes a memory leak since gpio_pin_get_by_ofw_idx returns a malloc'd pointer, which gpio_pin_release now frees. Reviewed by: wulf, imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50871 --- sys/dev/gpio/gpiopps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/gpio/gpiopps.c b/sys/dev/gpio/gpiopps.c index bb8afa5e062c..82620a50a798 100644 --- a/sys/dev/gpio/gpiopps.c +++ b/sys/dev/gpio/gpiopps.c @@ -160,7 +160,7 @@ gpiopps_detach(device_t dev) if (sc->ires != NULL) bus_release_resource(dev, SYS_RES_IRQ, sc->irid, sc->ires); if (sc->gpin != NULL) - gpiobus_release_pin(GPIO_GET_BUS(sc->gpin->dev), sc->gpin->pin); + gpio_pin_release(sc->gpin); return (0); } From nobody Fri Jul 4 20:26:13 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYlX53DNqz60l1Y; Fri, 04 Jul 2025 20:26: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYlX529Fyz3tFP; Fri, 04 Jul 2025 20:26:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6kKsp+vrEdbYrupJSWpB3AMi+zeByboxq5TVQOi4dz4=; b=Yt1jqkDtNKVOoL5w6K0aYF71/yUPicjfMoxxAWPQRhDVWLjJbczAuODGTl270+ZNaFgExT 4pZmGk6SsH2jiKbZC8nxKGL7G85zq8dV6VQ1lJrIwTRVC4F7KLsoCpqOe1Tfc+6KlS4A6F 4mzuttamEffbD7fh53TOVP4qAhCz/owfj9NY3yS6E+jwcGuXEM4OZBajXCDMt/tq0YqDk3 FPlaOVXt36FrJ0z+i7UR6zSMCf+6l0L2YUieWNbN5lPQ4miM3Y13b+4YG7rwgfh9vRcmGK s5Y1YiXdQgP85wzfFj0BugmCtsvYGIruwZRF0CI9acYLzgEKzWUCsvoRhLqKLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751660773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6kKsp+vrEdbYrupJSWpB3AMi+zeByboxq5TVQOi4dz4=; b=lv8EnaT8fZlWx95NzAyRaI5DpRB0SA+bgcVVgDSqwGevKgb3b9pJTjOKBs7zNwDrQM212o tQf9Wg3e8xQGQsxyvAURT8f7/nCdaDSRC/3QTfME4RwvYKBUDLjd39jQVFGNCpbWSQOTKD 9vdcKihXeqNrfcmKT6F39Ayd3A3HTf2SlQbj3BmiJgFGHqJ8uEHI5o4xAYen1FbKjMx0BK Jk2molLar7gGub99QrekBd9c9EHo5z1bKKJGil64mknKWxDcwaOcMMQADQQl05sJ8OyOM7 RuKdS6/WtjlsRz/Sf1ImUzh2P8AO1xvj83W0Fu0FdbrGqlW4+jU86u7gazsg+Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751660773; a=rsa-sha256; cv=none; b=n8Ob4IHqWYEw0TPIKzKbD2acMV/VAoIWcMzjYFfMfe4wyEFnKw/KIKwL532OzsGFfA3COr X/Hx07GVf6A75UxkhPTXzeX13MKn0xh2ImYtorAfWKdmzsvHZLDjFi2Xh9J0lcMioXPzcc BFw+qUhpwKBbGayZXV4QJKC1nJ/UqTfLLwJhb3Eb+hxWck0Hed+eDwd3ZUZSnA5NStXvcP oZAHz8SmcnQzXIVrgCqMw9Erf044/7Vxbx/lKJfS8YYti5I4x65Nkj6bysA2qS3fSzbuWd QEHDFvckWG0On6iAsCI/IwTpu6K8wKkRhIa6+ALjSLBHXNWqtrC6YpvX93VrHQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYlX51bDvz14gW; Fri, 04 Jul 2025 20:26:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564KQDLx096968; Fri, 4 Jul 2025 20:26:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564KQD3P096965; Fri, 4 Jul 2025 20:26:13 GMT (envelope-from git) Date: Fri, 4 Jul 2025 20:26:13 GMT Message-Id: <202507042026.564KQD3P096965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 9c2509f831e8 - main - gpio: hide internal gpiobus symbols List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c2509f831e8194ef8c30aa5d839a7eb2197ff7f Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=9c2509f831e8194ef8c30aa5d839a7eb2197ff7f commit 9c2509f831e8194ef8c30aa5d839a7eb2197ff7f Author: Ahmad Khalifa AuthorDate: 2025-07-04 20:03:34 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 20:24:31 +0000 gpio: hide internal gpiobus symbols Move functions and variables internal to gpiobus to their own header to avoid namespace pollution and misuse. Reviewed by: wulf, imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50872 --- sys/dev/gpio/acpi_gpiobus.c | 1 + sys/dev/gpio/gpiobus.c | 1 + sys/dev/gpio/gpiobus_internal.h | 47 +++++++++++++++++++++++++++++++++++++++++ sys/dev/gpio/gpiobusvar.h | 14 ------------ sys/dev/gpio/ofw_gpiobus.c | 1 + 5 files changed, 50 insertions(+), 14 deletions(-) diff --git a/sys/dev/gpio/acpi_gpiobus.c b/sys/dev/gpio/acpi_gpiobus.c index 2987af634866..f9468e0deda0 100644 --- a/sys/dev/gpio/acpi_gpiobus.c +++ b/sys/dev/gpio/acpi_gpiobus.c @@ -36,6 +36,7 @@ #include #include +#include #include "gpiobus_if.h" diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 84980f3d6546..ab7f13177969 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -39,6 +39,7 @@ #include #include +#include #include "gpiobus_if.h" diff --git a/sys/dev/gpio/gpiobus_internal.h b/sys/dev/gpio/gpiobus_internal.h new file mode 100644 index 000000000000..de3f57663132 --- /dev/null +++ b/sys/dev/gpio/gpiobus_internal.h @@ -0,0 +1,47 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2009 Oleksandr Tymoshenko + * All rights reserved. + * + * 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. + * + */ + +#ifndef __GPIOBUS_INTERNAL_H__ +#define __GPIOBUS_INTERNAL_H__ + +/* + * Functions shared between gpiobus and other bus classes that derive from it; + * these should not be called directly by other drivers. + */ +int gpiobus_attach(device_t); +int gpiobus_detach(device_t); +int gpiobus_init_softc(device_t); +int gpiobus_alloc_ivars(struct gpiobus_ivar *); +void gpiobus_free_ivars(struct gpiobus_ivar *); +int gpiobus_read_ivar(device_t, device_t, int, uintptr_t *); +int gpiobus_acquire_pin(device_t, uint32_t); +void gpiobus_release_pin(device_t, uint32_t); + +extern driver_t gpiobus_driver; +#endif diff --git a/sys/dev/gpio/gpiobusvar.h b/sys/dev/gpio/gpiobusvar.h index 972e1f196399..7f504236a774 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -169,23 +169,9 @@ int gpio_pin_setflags(gpio_pin_t pin, uint32_t flags); struct resource *gpio_alloc_intr_resource(device_t consumer_dev, int *rid, u_int alloc_flags, gpio_pin_t pin, uint32_t intr_mode); -/* - * Functions shared between gpiobus and other bus classes that derive from it; - * these should not be called directly by other drivers. - */ int gpio_check_flags(uint32_t, uint32_t); device_t gpiobus_add_bus(device_t); device_t gpiobus_attach_bus(device_t); int gpiobus_detach_bus(device_t); -int gpiobus_attach(device_t); -int gpiobus_detach(device_t); -int gpiobus_init_softc(device_t); -int gpiobus_alloc_ivars(struct gpiobus_ivar *); -void gpiobus_free_ivars(struct gpiobus_ivar *); -int gpiobus_read_ivar(device_t, device_t, int, uintptr_t *); -int gpiobus_acquire_pin(device_t, uint32_t); -void gpiobus_release_pin(device_t, uint32_t); - -extern driver_t gpiobus_driver; #endif /* __GPIOBUS_H__ */ diff --git a/sys/dev/gpio/ofw_gpiobus.c b/sys/dev/gpio/ofw_gpiobus.c index 32dc5b55e698..fc5fb03d6824 100644 --- a/sys/dev/gpio/ofw_gpiobus.c +++ b/sys/dev/gpio/ofw_gpiobus.c @@ -36,6 +36,7 @@ #include #include +#include #include #include "gpiobus_if.h" From nobody Fri Jul 4 23:22:34 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bYqRb4VdDz618sW; Fri, 04 Jul 2025 23:22: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYqRb0Z7Nz49Xy; Fri, 04 Jul 2025 23:22:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751671355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gegiNBM2C1pWqveMRttNACwLu2hWWaxHWa5U2s872U4=; b=A5xSwEFJQD5cuJ44GsCJJe0d0VPOSM9qvH3NZ3ZMm+cPj0RMIGVufKiF5DSV0ZhA34af0w +O0ojQD2vuW7iTnajL7moL5nCtE1zGKIPzUlUeeA0dCiczIp1KKrjqUrvFKJD5PTgoEv5t SEdTHdjd7j5cWeKQLqvAn8duShZZ7n5lgJHreg3uMM80+oXeKve0866IZ5/U29HPRkjWvi rehPVXDNlmgVrTRPAQK5vUU/cY0JdinNut50Z6MuepVpk8gkra3ZX8RH/ssMRj23DTY+qm qzbeshNCBtXoHvYJ68wq7VHma4jqLUYl96Vz8ZApPCX4cIFCgPFtgAj4azc/eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751671355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gegiNBM2C1pWqveMRttNACwLu2hWWaxHWa5U2s872U4=; b=iUNB9MF1SkRXSEv3Z8GYhd+VWqQrgJe7IQusFbAQWMelKRl/xLCzL+tFQqzVs6dunebsRl sxiMcK8Cw5HXYt0QKexWuROxJYJXuw3vTsIAw8oCG8U+ATFQJHJ8IK8KI8UVkD1l6/8usP DTcgvaZnQfpX+QpgVHIyknWd9RGVYMxMl59yZLzkw0/vWJe8hlaYUn7RFuTuVSdYCUaMLs 5c6UErnZ/wNN/zKGY7qFhxQz7Eu9Te+HdG1XIfu2SNbJhLTS1i3rfmlzkINcDFrwYULYhC wgyWIbVRSqhB0mb+ReNa8xQNkKFfXUrJxGdNLDE+a+pSP4vm64W/WKUz5nuy/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751671355; a=rsa-sha256; cv=none; b=llHy4nLqrDVrUxJehSjEbqgDCGFNoA86xFpRzOaDwt1ZfsCOSA3JKKOB7NXCzohVf4uhM/ oRSAed9ZijKPXBthFqeioqgJMpiF4UvscLPktxf4u2/UDbRyfFnSQG0BmGUsSVpE5zb25i 8KWr4qHDdEEJ2NQYapb/Qjqwt+DLZMeUAMNKzW2Xvm26R/ruhB78834rwHBA0//wm+bS0s mKOOSkWCiyvFQJn8Q2PusYCPN/ad3T6IzM8LXK5EPwGMF9acbMyw+n6W34gIYlqIvARg2X PDwz9i9p8h2KGDkaAtmUxge/9C34tnwudD+bRb602Y3Vb7+aldOUweaJPg7abA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bYqRZ73Hpz19Bh; Fri, 04 Jul 2025 23:22:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564NMYjM034709; Fri, 4 Jul 2025 23:22:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564NMY4w034706; Fri, 4 Jul 2025 23:22:34 GMT (envelope-from git) Date: Fri, 4 Jul 2025 23:22:34 GMT Message-Id: <202507042322.564NMY4w034706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 533c0d345b93 - main - sys/net: move DOT1Q_VID_* constants to ethernet.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 533c0d345b93ecf6832c9f689f5401c3fb182229 Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=533c0d345b93ecf6832c9f689f5401c3fb182229 commit 533c0d345b93ecf6832c9f689f5401c3fb182229 Author: Lexi Winter AuthorDate: 2025-07-02 01:19:34 +0000 Commit: Lexi Winter CommitDate: 2025-07-04 23:21:51 +0000 sys/net: move DOT1Q_VID_* constants to ethernet.h These are generally useful to anything dealing with 802.1q and aren't specific to if_vlan, so move them to and remove the _KERNEL gate. While here, document what they actually mean. Reviewed by: kp, des Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D50570 --- sys/net/ethernet.h | 17 +++++++++++++++++ sys/net/if_vlan_var.h | 7 ------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/sys/net/ethernet.h b/sys/net/ethernet.h index 6eefedba8775..cf4f75bd0b6c 100644 --- a/sys/net/ethernet.h +++ b/sys/net/ethernet.h @@ -80,6 +80,23 @@ struct ether_addr { (((addr)[0] | (addr)[1] | (addr)[2] | \ (addr)[3] | (addr)[4] | (addr)[5]) == 0x00) +/* + * 802.1q VID constants from IEEE 802.1Q-2014, table 9-2. + */ + +/* Null VID: The tag contains only PCP (priority) and DEI information. */ +#define DOT1Q_VID_NULL 0x0 +/* The default PVID for a bridge port. NB: bridge(4) does not honor this. */ +#define DOT1Q_VID_DEF_PVID 0x1 +/* The default SR_PVID for SRP Stream related traffic. */ +#define DOT1Q_VID_DEF_SR_PVID 0x2 +/* A VID reserved for implementation use, not permitted on the wire. */ +#define DOT1Q_VID_RSVD_IMPL 0xfff +/* The lowest valid VID. */ +#define DOT1Q_VID_MIN 0x1 +/* The highest valid VID. */ +#define DOT1Q_VID_MAX 0xffe + /* * This is the type of the VLAN ID inside the tag, not the tag itself. */ diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index f0b09445d04b..695bb81f77b3 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -126,13 +126,6 @@ struct vlanreq { #define VLAN_PCP_MAX 7 -#define DOT1Q_VID_NULL 0x0 -#define DOT1Q_VID_DEF_PVID 0x1 -#define DOT1Q_VID_DEF_SR_PVID 0x2 -#define DOT1Q_VID_RSVD_IMPL 0xfff -#define DOT1Q_VID_MIN 1 /* minimum valid vlan id */ -#define DOT1Q_VID_MAX 4094 /* maximum valid vlan id */ - /* * 802.1q full tag. Proto and vid are stored in host byte order. */ From nobody Sat Jul 5 07:13:15 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ1th1Hr5z61BG3; Sat, 05 Jul 2025 07:13: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ1th0dMQz44C1; Sat, 05 Jul 2025 07:13:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hN4AxM9F4WSM+LYi75BewUwPMfehVNzz33dNm9yu960=; b=jPxoNGf8dGEOVOgmoDt/WH8AuLmqnAigBhjR4MFvQI77vdf+nMbu+dCI1ZEZj98aNknhDy AeYF6WunX+ZwTN0w4I4jgdyNCkOOWnckeX0iyWuUrWJi6m/eJotOQs1zjpi8cpmlrHpUfv NznNzLWv9ZihJhNqDPSEtwDlsxpPOxnA/s6SN5AIPAKM4klVWhN78rMyyFTvjCGw0LFUz0 ZoH/kufgRs9pLKraPsbqgC2Iq8gsptHMN0X5OWrycAqJRFeozmWCwMWDi+PTq68sW59/yr d+JeGL3KpvK0RvCubKUiCuJl8jPBcCQ0qGasNPoIKvRNI2LLKZhibPIlrHnLCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hN4AxM9F4WSM+LYi75BewUwPMfehVNzz33dNm9yu960=; b=ZPReOJGEaxox0MHkV/inb308EUKeej62EsXaEJicjfvp1NhevZDn5QskeX7+UdO60IQmec KO1kH/iT7X/CeR6uKqE4LkC6PFGhNTf4vTBchszmlDqajcVMG/GpIHUbGRy2MGBdjAywCf aPjScrfIy2AoPnIQYrIJJklrStvWwqIKMMhsP4r+3uy+wwrTY2Turo4UbpYVYlNaN3564w s6Y6pik2SLGrSUuEm/bhAm9bGRo/rmljQjU3oRTo4SVuTaEmAnfFkQVBMf+SnW6+8qYVu4 AZSFNtQzzDCdXrv6PONnMKakDxRDo95nb/biPKPkKj3dCwhWwGklIV4RqH4tLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751699596; a=rsa-sha256; cv=none; b=CBXynxQRkZxCH9p+fVAfxm8vXGwaYFTGEYCWSUal63giFE8a6PLxfK5TFAnMBtGGiHOwXd pCNSZQc7Cjcfj1wUmti0rXNxzo+q+C0n2PVm2f/MxXoq2ccWpN4zXrPI7OX0R+/uda+S1r +2Fh3Lhj54vLdNTVRAXXRCJOpdzBRuZ+54gsbCF9b5926YITRoY2VaRxFl68KItYQveBnd TW9hGNW2Qrt7yjIKsvI4aB/QTNKjfNH+1mxchf19vcSZ9HbDcfaPO56uak3ErdiaV/9zGl 0PPbsqsjzNdLNntyhn4gkyQl+C0Pfy3pphGvEicrTi49gdaeDbo7yncl0uAg6w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ1tg75dlz9SJ; Sat, 05 Jul 2025 07:13:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5657DF6I017479; Sat, 5 Jul 2025 07:13:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5657DFtc017476; Sat, 5 Jul 2025 07:13:15 GMT (envelope-from git) Date: Sat, 5 Jul 2025 07:13:15 GMT Message-Id: <202507050713.5657DFtc017476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 65ed1a035ceb - main - bridge: allow member interface vlan to be configured List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 65ed1a035ceb8f7c323c0bc0c7344a7fa7cadc9f Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=65ed1a035ceb8f7c323c0bc0c7344a7fa7cadc9f commit 65ed1a035ceb8f7c323c0bc0c7344a7fa7cadc9f Author: Lexi Winter AuthorDate: 2025-07-05 04:27:25 +0000 Commit: Lexi Winter CommitDate: 2025-07-05 07:04:22 +0000 bridge: allow member interface vlan to be configured Add two new bridge(4) interface options, 'vlanfilter' and 'untagged': # ifconfig bridge0 vlanfilter ix0 # ifconfig bridge0 -vlanfilter ix0 # ifconfig bridge0 untagged ix0 20 # ifconfig bridge0 -untagged ix0 Setting 'vlanfilter' causes the bridge to filter ingress and egress traffic on that interface based on the frame's VLAN, rather than simply passing all frames. By default, an interface is not permitted on any VLANs, so all frames will be dropped. Setting 'untagged' allows the interface to send and receive untagged traffic in the given VLAN, allowing two (or more) interfaces in the same VLAN to communicate with each other, but not with any other interface. Setting 'untagged' on an interface automatically enables 'vlanfilter' as well. The untagged VLAN may be removed using the '-untagged' option, but this does not disable VLAN filtering automatically. Tagged frames may not be sent or received on a port with VLAN filtering enabled. Update bridge.4 to document this change, and also add an overview of the existing vlan/.1q support in if_bridge. Basic tests for the new functionality are included. Bump __FreeBSD_version for struct ibfreq ABI change. Reviewed by: kevans, kp Approved by: kevans (mentor) Differential Revision: https://reviews.freebsd.org/D49993 --- sbin/ifconfig/ifbridge.c | 59 +++++++++++++++++- sbin/ifconfig/ifconfig.8 | 21 ++++++- share/man/man4/bridge.4 | 31 ++++++++- sys/net/if_bridge.c | 135 ++++++++++++++++++++++++++++++++++++---- sys/net/if_bridgevar.h | 5 +- sys/sys/param.h | 2 +- tests/sys/net/if_bridge_test.sh | 126 +++++++++++++++++++++++++++++++++++++ 7 files changed, 362 insertions(+), 17 deletions(-) diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c index 2d0af1255a73..a60ddabcbdd4 100644 --- a/sbin/ifconfig/ifbridge.c +++ b/sbin/ifconfig/ifbridge.c @@ -211,6 +211,8 @@ bridge_status(if_ctx *ctx) else printf(" ", state); } + if (member->ifbr_untagged != 0) + printf(" untagged %u", (unsigned)member->ifbr_untagged); printf("\n"); } @@ -576,6 +578,45 @@ setbridge_ifpathcost(if_ctx *ctx, const char *ifn, const char *cost) err(1, "BRDGSIFCOST %s", cost); } +static void +setbridge_untagged(if_ctx *ctx, const char *ifn, const char *vlanid) +{ + struct ifbreq req; + u_long val; + + memset(&req, 0, sizeof(req)); + + if (get_val(vlanid, &val) < 0) + errx(1, "invalid VLAN identifier: %s", vlanid); + + /* + * Reject vlan 0, since it's not a valid vlan identifier and has a + * special meaning in the kernel interface. + */ + if (val == 0) + errx(1, "invalid VLAN identifier: %lu", val); + + strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); + req.ifbr_untagged = val; + + if (do_cmd(ctx, BRDGSIFUNTAGGED, &req, sizeof(req), 1) < 0) + err(1, "BRDGSIFUNTAGGED %s", vlanid); +} + +static void +unsetbridge_untagged(if_ctx *ctx, const char *ifn, int dummy __unused) +{ + struct ifbreq req; + + memset(&req, 0, sizeof(req)); + + strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); + req.ifbr_untagged = 0; + + if (do_cmd(ctx, BRDGSIFUNTAGGED, &req, sizeof(req), 1) < 0) + err(1, "BRDGSIFUNTAGGED"); +} + static void setbridge_ifmaxaddr(if_ctx *ctx, const char *ifn, const char *arg) { @@ -612,17 +653,27 @@ setbridge_timeout(if_ctx *ctx, const char *arg, int dummy __unused) static void setbridge_private(if_ctx *ctx, const char *val, int dummy __unused) { - do_bridgeflag(ctx, val, IFBIF_PRIVATE, 1); } static void unsetbridge_private(if_ctx *ctx, const char *val, int dummy __unused) { - do_bridgeflag(ctx, val, IFBIF_PRIVATE, 0); } +static void +setbridge_vlanfilter(if_ctx *ctx, const char *val, int dummy __unused) +{ + do_bridgeflag(ctx, val, IFBIF_VLANFILTER, 1); +} + +static void +unsetbridge_vlanfilter(if_ctx *ctx, const char *val, int dummy __unused) +{ + do_bridgeflag(ctx, val, IFBIF_VLANFILTER, 0); +} + static struct cmd bridge_cmds[] = { DEF_CMD_ARG("addm", setbridge_add), DEF_CMD_ARG("deletem", setbridge_delete), @@ -659,6 +710,10 @@ static struct cmd bridge_cmds[] = { DEF_CMD_ARG2("ifpriority", setbridge_ifpriority), DEF_CMD_ARG2("ifpathcost", setbridge_ifpathcost), DEF_CMD_ARG2("ifmaxaddr", setbridge_ifmaxaddr), + DEF_CMD_ARG("vlanfilter", setbridge_vlanfilter), + DEF_CMD_ARG("-vlanfilter", unsetbridge_vlanfilter), + DEF_CMD_ARG2("untagged", setbridge_untagged), + DEF_CMD_ARG("-untagged", unsetbridge_untagged), DEF_CMD_ARG("timeout", setbridge_timeout), DEF_CMD_ARG("private", setbridge_private), DEF_CMD_ARG("-private", unsetbridge_private), diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index e3f094a336fb..490da7b2ce2c 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 24, 2025 +.Dd July 5, 2025 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2696,6 +2696,25 @@ source addresses are dropped until an existing host cache entry expires or is removed. Set to 0 to disable. .El +.Ss Bridge VLAN Filtering Parameters +The behaviour of these options is described in the +.Dq VLAN SUPPORT +section of +.Xr bridge 4 . +.Bl -tag -width indent +.It Cm vlanfilter Ar interface +Enable VLAN filtering on an interface. +.It Cm -vlanfilter Ar interface +Disable VLAN filtering on an interface. +.It Cm untagged Ar interface Ar vlan-id +Set the untagged VLAN identifier for an interface. +.Pp +Setting +.Cm untagged +will automatically enable VLAN filtering on the interface. +.It Cm -untagged Ar interface Ar vlan-id +Clear the untagged VLAN identifier for an interface. +.El .Ss Link Aggregation and Link Failover Parameters The following parameters are specific to lagg interfaces: .Bl -tag -width indent diff --git a/share/man/man4/bridge.4 b/share/man/man4/bridge.4 index 7ce734ae87eb..73e7fd56af78 100644 --- a/share/man/man4/bridge.4 +++ b/share/man/man4/bridge.4 @@ -36,7 +36,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 28, 2025 +.Dd July 5, 2025 .Dt IF_BRIDGE 4 .Os .Sh NAME @@ -271,6 +271,35 @@ by setting the .Va net.link.bridge.log_stp node using .Xr sysctl 8 . +.Sh VLAN SUPPORT +The +.Nm +driver has limited support for virtual LANs (VLANs). +The bridge implements independent VLAN learning, i.e. MAC addresses are +learned on a per-VLAN basis, and the same MAC address may be learned on +multiple interfaces on different VLANs. +Incoming frames with an 802.1Q tag will be assigned to the appropriate +VLAN. +.Pp +By default no access control is enabled, so any interface may +participate in any VLAN. +.Pp +VLAN filtering may be enabled on an interface using the +.Xr ifconfig 8 +.Cm vlanfilter +option. +When VLAN filtering is enabled, an interface may only send and receive +untagged frames. +The interface's untagged VLAN ID may be configured using the +.Xr ifconfig 8 +.Cm untagged +option. +If an untagged VLAN ID is configured, incoming frames will be assigned +to that VLAN, and the interface may receive outgoing untagged frames +in that VLAN. +.Pp +There is no support for adding or removing 802.1Q tags from frames +processed by the bridge. .Sh PACKET FILTERING Packet filtering can be used with any firewall package that hooks in via the .Xr pfil 9 diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index bc421a8e156d..d8eff929e47b 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -254,6 +254,7 @@ struct bridge_iflist { uint32_t bif_addrcnt; /* cur. # of addresses */ uint32_t bif_addrexceeded;/* # of address violations */ struct epoch_context bif_epoch_ctx; + ether_vlanid_t bif_untagged; /* untagged vlan id */ }; /* @@ -335,13 +336,12 @@ static int bridge_enqueue(struct bridge_softc *, struct ifnet *, static void bridge_rtdelete(struct bridge_softc *, struct ifnet *ifp, int); static void bridge_forward(struct bridge_softc *, struct bridge_iflist *, - struct mbuf *m); + struct mbuf *m, ether_vlanid_t vlan); static bool bridge_member_ifaddrs(void); - static void bridge_timer(void *); static void bridge_broadcast(struct bridge_softc *, struct ifnet *, - struct mbuf *, int); + struct mbuf *, int, ether_vlanid_t); static void bridge_span(struct bridge_softc *, struct mbuf *); static int bridge_rtupdate(struct bridge_softc *, const uint8_t *, @@ -353,6 +353,8 @@ static void bridge_rtage(struct bridge_softc *); static void bridge_rtflush(struct bridge_softc *, int); static int bridge_rtdaddr(struct bridge_softc *, const uint8_t *, ether_vlanid_t); +static bool bridge_vfilter_out(const struct bridge_iflist *, + const struct mbuf *, ether_vlanid_t); static void bridge_rtable_init(struct bridge_softc *); static void bridge_rtable_fini(struct bridge_softc *); @@ -400,6 +402,7 @@ static int bridge_ioctl_sma(struct bridge_softc *, void *); static int bridge_ioctl_sifprio(struct bridge_softc *, void *); static int bridge_ioctl_sifcost(struct bridge_softc *, void *); static int bridge_ioctl_sifmaxaddr(struct bridge_softc *, void *); +static int bridge_ioctl_sifuntagged(struct bridge_softc *, void *); static int bridge_ioctl_addspan(struct bridge_softc *, void *); static int bridge_ioctl_delspan(struct bridge_softc *, void *); static int bridge_ioctl_gbparam(struct bridge_softc *, void *); @@ -618,6 +621,8 @@ static const struct bridge_control bridge_control_table[] = { { bridge_ioctl_sifmaxaddr, sizeof(struct ifbreq), BC_F_COPYIN|BC_F_SUSER }, + { bridge_ioctl_sifuntagged, sizeof(struct ifbreq), + BC_F_COPYIN|BC_F_SUSER }, }; static const int bridge_control_table_size = nitems(bridge_control_table); @@ -1495,6 +1500,7 @@ bridge_ioctl_gifflags(struct bridge_softc *sc, void *arg) req->ifbr_addrcnt = bif->bif_addrcnt; req->ifbr_addrmax = bif->bif_addrmax; req->ifbr_addrexceeded = bif->bif_addrexceeded; + req->ifbr_untagged = bif->bif_untagged; /* Copy STP state options as flags */ if (bp->bp_operedge) @@ -1872,6 +1878,25 @@ bridge_ioctl_sifmaxaddr(struct bridge_softc *sc, void *arg) return (0); } +static int +bridge_ioctl_sifuntagged(struct bridge_softc *sc, void *arg) +{ + struct ifbreq *req = arg; + struct bridge_iflist *bif; + + bif = bridge_lookup_member(sc, req->ifbr_ifsname); + if (bif == NULL) + return (ENOENT); + + if (req->ifbr_untagged > DOT1Q_VID_MAX) + return (EINVAL); + + if (req->ifbr_untagged != DOT1Q_VID_NULL) + bif->bif_flags |= IFBIF_VLANFILTER; + bif->bif_untagged = req->ifbr_untagged; + return (0); +} + static int bridge_ioctl_addspan(struct bridge_softc *sc, void *arg) { @@ -2376,7 +2401,7 @@ bridge_transmit(struct ifnet *ifp, struct mbuf *m) NULL) { error = bridge_enqueue(sc, dst_if, m); } else - bridge_broadcast(sc, ifp, m, 0); + bridge_broadcast(sc, ifp, m, 0, DOT1Q_VID_NULL); return (error); } @@ -2430,12 +2455,11 @@ bridge_qflush(struct ifnet *ifp __unused) */ static void bridge_forward(struct bridge_softc *sc, struct bridge_iflist *sbif, - struct mbuf *m) + struct mbuf *m, ether_vlanid_t vlan) { struct bridge_iflist *dbif; struct ifnet *src_if, *dst_if, *ifp; struct ether_header *eh; - uint16_t vlan; uint8_t *dst; int error; @@ -2446,7 +2470,6 @@ bridge_forward(struct bridge_softc *sc, struct bridge_iflist *sbif, if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); - vlan = VLANTAGOF(m); if ((sbif->bif_flags & IFBIF_STP) && sbif->bif_stp.bp_state == BSTP_IFSTATE_DISCARDING) @@ -2535,7 +2558,7 @@ bridge_forward(struct bridge_softc *sc, struct bridge_iflist *sbif, } if (dst_if == NULL) { - bridge_broadcast(sc, src_if, m, 1); + bridge_broadcast(sc, src_if, m, 1, vlan); return; } @@ -2555,6 +2578,10 @@ bridge_forward(struct bridge_softc *sc, struct bridge_iflist *sbif, if (sbif->bif_flags & dbif->bif_flags & IFBIF_PRIVATE) goto drop; + /* Do VLAN filtering. */ + if (!bridge_vfilter_out(dbif, m, vlan)) + goto drop; + if ((dbif->bif_flags & IFBIF_STP) && dbif->bif_stp.bp_state == BSTP_IFSTATE_DISCARDING) goto drop; @@ -2636,6 +2663,27 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) return (NULL); } + /* Do VLAN filtering. */ + if (bif->bif_flags & IFBIF_VLANFILTER) { + /* + * If the frame was received with a tag, drop it, since we only + * support untagged ports which shouldn't be receiving tagged + * frames. + * + * If the frame was received without a tag, and the port doesn't + * have an untagged vlan configured, drop it. + */ + if (vlan != DOT1Q_VID_NULL || + bif->bif_untagged == DOT1Q_VID_NULL) { + if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); + m_freem(m); + return (NULL); + } + + /* Otherwise, assign the untagged frame to the correct vlan. */ + vlan = bif->bif_untagged; + } + bridge_span(sc, m); if (m->m_flags & (M_BCAST|M_MCAST)) { @@ -2662,7 +2710,7 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) } /* Perform the bridge forwarding function with the copy. */ - bridge_forward(sc, bif, mc); + bridge_forward(sc, bif, mc, vlan); #ifdef DEV_NETMAP /* @@ -2801,7 +2849,7 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) #undef GRAB_OUR_PACKETS /* Perform the bridge forwarding function. */ - bridge_forward(sc, bif, m); + bridge_forward(sc, bif, m, vlan); return (NULL); } @@ -2839,7 +2887,7 @@ bridge_inject(struct ifnet *ifp, struct mbuf *m) */ static void bridge_broadcast(struct bridge_softc *sc, struct ifnet *src_if, - struct mbuf *m, int runfilt) + struct mbuf *m, int runfilt, ether_vlanid_t vlan) { struct bridge_iflist *dbif, *sbif; struct mbuf *mc; @@ -2867,6 +2915,10 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *src_if, if (sbif && (sbif->bif_flags & dbif->bif_flags & IFBIF_PRIVATE)) continue; + /* Do VLAN filtering. */ + if (!bridge_vfilter_out(dbif, m, vlan)) + continue; + if ((dbif->bif_flags & IFBIF_STP) && dbif->bif_stp.bp_state == BSTP_IFSTATE_DISCARDING) continue; @@ -2950,6 +3002,67 @@ bridge_span(struct bridge_softc *sc, struct mbuf *m) } } +/* + * Outgoing VLAN filtering. Given a frame, its vlan, and the member interface + * we intend to send it to, decide whether the port configuration allows it to + * be sent. + */ +static bool +bridge_vfilter_out(const struct bridge_iflist *dbif, const struct mbuf *m, + ether_vlanid_t vlan) +{ + struct ether_header *eh; + + NET_EPOCH_ASSERT(); + + /* If VLAN filtering isn't enabled, pass everything. */ + if ((dbif->bif_flags & IFBIF_VLANFILTER) == 0) + return (true); + + /* + * Always allow untagged 802.1D STP frames, even if they would + * otherwise be dropped. This is required for STP to work on + * a filtering bridge. + * + * Tagged STP (Cisco PVST+) is a non-standard extension, so + * handle those frames via the normal filtering path. + */ + eh = mtod(m, struct ether_header *); + if (vlan == DOT1Q_VID_NULL && + memcmp(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN) == 0) + return (true); + + /* + * If the frame wasn't assigned to a vlan at ingress, drop it. + * We can't forward these frames to filtering ports because we + * don't know what VLAN they're supposed to be in. + */ + if (vlan == DOT1Q_VID_NULL) + return (false); + + /* + * If the frame was received with a vlan tag then drop it, + * since we only support untagged ports. + * + * If the egress port doesn't have an untagged vlan configured, + * it doesn't want untagged frames, so drop it. + */ + if (VLANTAGOF(m) != DOT1Q_VID_NULL || + dbif->bif_untagged == DOT1Q_VID_NULL) + return (false); + + /* + * Make sure the frame's vlan matches the port's untagged vlan. + */ + if (vlan != dbif->bif_untagged) + return (false); + + /* + * Everything looks fine, so pass this frame. + */ + return (true); +} + /* * bridge_rtupdate: * diff --git a/sys/net/if_bridgevar.h b/sys/net/if_bridgevar.h index 90beb6c96d82..c72afcc1785d 100644 --- a/sys/net/if_bridgevar.h +++ b/sys/net/if_bridgevar.h @@ -122,6 +122,7 @@ #define BRDGSPROTO 28 /* set protocol (ifbrparam) */ #define BRDGSTXHC 29 /* set tx hold count (ifbrparam) */ #define BRDGSIFAMAX 30 /* set max interface addrs (ifbreq) */ +#define BRDGSIFUNTAGGED 31 /* set if untagged vlan */ /* * Generic bridge control request. @@ -139,6 +140,7 @@ struct ifbreq { uint32_t ifbr_addrcnt; /* member if addr number */ uint32_t ifbr_addrmax; /* member if addr max */ uint32_t ifbr_addrexceeded; /* member if addr violations */ + ether_vlanid_t ifbr_untagged; /* member if untagged vlan */ uint8_t pad[32]; }; @@ -155,10 +157,11 @@ struct ifbreq { #define IFBIF_BSTP_ADMEDGE 0x0200 /* member stp admin edge enabled */ #define IFBIF_BSTP_ADMCOST 0x0400 /* member stp admin path cost */ #define IFBIF_PRIVATE 0x0800 /* if is a private segment */ +#define IFBIF_VLANFILTER 0x1000 /* if does vlan filtering */ #define IFBIFBITS "\020\001LEARNING\002DISCOVER\003STP\004SPAN" \ "\005STICKY\014PRIVATE\006EDGE\007AUTOEDGE\010PTP" \ - "\011AUTOPTP" + "\011AUTOPTP\015VLANFILTER" #define IFBIFMASK ~(IFBIF_BSTP_EDGE|IFBIF_BSTP_AUTOEDGE|IFBIF_BSTP_PTP| \ IFBIF_BSTP_AUTOPTP|IFBIF_BSTP_ADMEDGE| \ IFBIF_BSTP_ADMCOST) /* not saved */ diff --git a/sys/sys/param.h b/sys/sys/param.h index 57eb8ebcf12c..af116d6e3f7a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -74,7 +74,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1500050 +#define __FreeBSD_version 1500051 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 2c6b039048e3..c6fa0a69ea7c 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -829,6 +829,129 @@ member_ifaddrs_vlan_cleanup() vnet_cleanup } +atf_test_case "vlan_pvid" "cleanup" +vlan_pvid_head() +{ + atf_set descr 'bridge with two ports with pvid set' + atf_set require.user root +} + +vlan_pvid_body() +{ + vnet_init + vnet_init_bridge + + epone=$(vnet_mkepair) + eptwo=$(vnet_mkepair) + + vnet_mkjail one ${epone}b + vnet_mkjail two ${eptwo}b + + jexec one ifconfig ${epone}b 192.0.2.1/24 up + jexec two ifconfig ${eptwo}b 192.0.2.2/24 up + + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${epone}a up + ifconfig ${eptwo}a up + ifconfig ${bridge} addm ${epone}a untagged ${epone}a 20 + ifconfig ${bridge} addm ${eptwo}a untagged ${eptwo}a 20 + + # With VLAN filtering enabled, traffic should be passed. + atf_check -s exit:0 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:0 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 + + # Removed the untagged VLAN on one port; traffic should not be passed. + ifconfig ${bridge} -untagged ${epone}a + atf_check -s exit:2 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:2 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 +} + +vlan_pvid_cleanup() +{ + vnet_cleanup +} + +atf_test_case "vlan_pvid_filtered" "cleanup" +vlan_pvid_filtered_head() +{ + atf_set descr 'bridge with two ports with different pvids' + atf_set require.user root +} + +vlan_pvid_filtered_body() +{ + vnet_init + vnet_init_bridge + + epone=$(vnet_mkepair) + eptwo=$(vnet_mkepair) + + vnet_mkjail one ${epone}b + vnet_mkjail two ${eptwo}b + + jexec one ifconfig ${epone}b 192.0.2.1/24 up + jexec two ifconfig ${eptwo}b 192.0.2.2/24 up + + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${epone}a up + ifconfig ${eptwo}a up + ifconfig ${bridge} addm ${epone}a untagged ${epone}a 20 + ifconfig ${bridge} addm ${eptwo}a untagged ${eptwo}a 30 + + atf_check -s exit:2 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:2 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 +} + +vlan_pvid_filtered_cleanup() +{ + vnet_cleanup +} + +atf_test_case "vlan_pvid_tagged" "cleanup" +vlan_pvid_tagged_head() +{ + atf_set descr 'bridge pvid with tagged frames for pvid' + atf_set require.user root +} + +vlan_pvid_tagged_body() +{ + vnet_init + vnet_init_bridge + + epone=$(vnet_mkepair) + eptwo=$(vnet_mkepair) + + vnet_mkjail one ${epone}b + vnet_mkjail two ${eptwo}b + + # Create two tagged interfaces on the appropriate VLANs + jexec one ifconfig ${epone}b up + jexec one ifconfig ${epone}b.20 create 192.0.2.1/24 up + jexec two ifconfig ${eptwo}b up + jexec two ifconfig ${eptwo}b.20 create 192.0.2.2/24 up + + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${epone}a up + ifconfig ${eptwo}a up + ifconfig ${bridge} addm ${epone}a untagged ${epone}a 20 + ifconfig ${bridge} addm ${eptwo}a untagged ${eptwo}a 20 + + # Tagged frames should not be passed. + atf_check -s exit:2 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:2 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 +} + +vlan_pvid_tagged_cleanup() +{ + vnet_cleanup +} atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -847,4 +970,7 @@ atf_init_test_cases() atf_add_test_case "member_ifaddrs_enabled" atf_add_test_case "member_ifaddrs_disabled" atf_add_test_case "member_ifaddrs_vlan" + atf_add_test_case "vlan_pvid" + atf_add_test_case "vlan_pvid_filtered" + atf_add_test_case "vlan_pvid_tagged" } From nobody Sat Jul 5 07:13:18 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ1tk4WSnz61BdJ; Sat, 05 Jul 2025 07:13: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ1tk1nmGz43wq; Sat, 05 Jul 2025 07:13:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9JLB0LNoORBG5tFVJ8EvjHL66k6rOgiiPHr1kNlwZUs=; b=lCqytNKngTSU70vPzrJvIvLkLVf6Z+QWjSl/VQQ2XEKZUnP/Gqk9SfMufMeNLmEvbPuCKu KrKhRUrQI49RnbRG75QrN1H7Motpr7QDSq+lIjLSrMc/zYmZCVXafQWozyMZkPKXOXD8hB VL0Hv44G9vnw6yRqdbA8zMytkQHKvgDvAUB/mG/vT6SW/TxXa1Plu2+ipVDIVnvf84PWbb qhoK8hIxFaCEMl29L3fZ2ASDimKzc3CzhLElfAwb0ouBmz0cX5yO9Pk3kFT/2gCbYl1dIN aQ63RNc3f9y72hNxRKKnlzGKiUgaO3jmuhOtRiitV9KFWXoqMltF69W+Nzxbgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9JLB0LNoORBG5tFVJ8EvjHL66k6rOgiiPHr1kNlwZUs=; b=Qe1C1ab0TFGYG1TwZhvlalsy92cpKhd4z/OlYIz1SnoGIZLwtdkuqMDNpsEcF4owvAETTi MjYyknplEj+YYTygeEzThk/pMJKbVtaJRUyNmqU5UXgM7RBORj0cNgZnSVM4i7hxdJt0US +tL+aNdPcKwS+MR8KUY6+rtzVgjNMe1U6M+PmrqOO7ntQZ9YjgDyxhMfbSUYvVWPN5dwPv 2nXhYBVfbKsGK/gpk2oeadbk8HXgTj1+e46vqySrngBIeg6JCCvhH5S7ZZru5WXK/REIcW IVZMA6B+gOByRGYvEOMXZvexBE9pO948FTtIaj4OKzLS/n3AUKAfhuKrcmLN+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751699598; a=rsa-sha256; cv=none; b=Vy4W8ZFf7fKbt6pq5p2vj6yRpHTsIfpmPQIDR8kvQ0dH2wbkDWmA4XWeDfjg39/sDLfb0b L9mv6PlmZQe1b0b17vuS+wyipiqlINO4UacEzctK9/SgN8yXsRDOSfRgLHkU/O38LVvzoq tlfeTGwFq0YoZtfytFT6eVEwGAvPgflcuKfw+XZ0R3QyZ75Qz9hmF7LNJa9MSf/LIjAsjR n4RSbA7cRhkjVOduP6ShCm7fZTFIkL4bRTbMcYcWTDfxiJu16yTiDZdFhVSNpALXIDUfUP zz+DiGRt1wLIBc6igllg6ldadAxxMprVqYd8sVQxYZ5nY6tB6ubjKS8eQ1gGaA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ1tk1Bl2z9K9; Sat, 05 Jul 2025 07:13:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5657DItC017544; Sat, 5 Jul 2025 07:13:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5657DIU8017541; Sat, 5 Jul 2025 07:13:18 GMT (envelope-from git) Date: Sat, 5 Jul 2025 07:13:18 GMT Message-Id: <202507050713.5657DIU8017541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 032d32c2c276 - main - bridge: add per-interface vlan access list List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 032d32c2c276983ce680ffaa6e7d6c12a9584fab Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=032d32c2c276983ce680ffaa6e7d6c12a9584fab commit 032d32c2c276983ce680ffaa6e7d6c12a9584fab Author: Lexi Winter AuthorDate: 2025-05-28 07:57:33 +0000 Commit: Lexi Winter CommitDate: 2025-07-05 07:04:31 +0000 bridge: add per-interface vlan access list The new ifconfig options 'tagged', '+tagged' and '-tagged' allow the vlan access list of a bridge interface to be configured: - Incoming tagged frames will be dropped if the vlan tag isn't in the interface's access list. - Outgoing frames will be dropped if the vlan tag isn't in the interface's access list (e.g., for BUM traffic). This has no effect if vlan filtering is not enabled on the interface. Since we now add a tag to untagged frames at ingress, remove the vlan argument from bridge_vfilter_out() and use VLANTAGOF instead. Reviewed by: des, kp, adrian Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D50503 --- lib/libifconfig/libifconfig.h | 2 + lib/libifconfig/libifconfig_bridge.c | 54 +++++++---- sbin/ifconfig/ifbridge.c | 125 +++++++++++++++++++++++++ sbin/ifconfig/ifconfig.8 | 32 +++++++ share/man/man4/bridge.4 | 13 ++- sys/net/if_bridge.c | 173 ++++++++++++++++++++++++++++------- sys/net/if_bridgevar.h | 24 +++++ tests/sys/net/if_bridge_test.sh | 129 ++++++++++++++++++++++++++ 8 files changed, 503 insertions(+), 49 deletions(-) diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index 8d5ca01b0ce6..fc835485a51e 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -29,6 +29,7 @@ #include #include +#include /* for ifbvlan_set_t */ #include #include @@ -64,6 +65,7 @@ struct lagg_reqport; struct ifconfig_bridge_status { struct ifbropreq *params; /**< current operational parameters */ struct ifbreq *members; /**< list of bridge members */ + ifbvlan_set_t *member_vlans; /**< bridge member vlan sets */ size_t members_count; /**< how many member interfaces */ uint32_t cache_size; /**< size of address cache */ uint32_t cache_lifetime; /**< address cache entry lifetime */ diff --git a/lib/libifconfig/libifconfig_bridge.c b/lib/libifconfig/libifconfig_bridge.c index 2a9bbc35858b..b4a920f488c5 100644 --- a/lib/libifconfig/libifconfig_bridge.c +++ b/lib/libifconfig/libifconfig_bridge.c @@ -66,40 +66,37 @@ ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h, { struct ifbifconf members; struct ifbrparam cache_param; - struct _ifconfig_bridge_status *bridge; - char *buf; + struct _ifconfig_bridge_status *bridge = NULL; + char *buf = NULL; + members.ifbic_buf = NULL; *bridgep = NULL; bridge = calloc(1, sizeof(struct _ifconfig_bridge_status)); if (bridge == NULL) { h->error.errtype = OTHER; h->error.errcode = ENOMEM; - return (-1); + goto err; } bridge->inner.params = &bridge->params; if (ifconfig_bridge_ioctlwrap(h, name, BRDGGCACHE, &cache_param, sizeof(cache_param), false) != 0) { - free(bridge); - return (-1); + goto err; } bridge->inner.cache_size = cache_param.ifbrp_csize; if (ifconfig_bridge_ioctlwrap(h, name, BRDGGTO, &cache_param, sizeof(cache_param), false) != 0) { - free(bridge); - return (-1); + goto err; } bridge->inner.cache_lifetime = cache_param.ifbrp_ctime; if (ifconfig_bridge_ioctlwrap(h, name, BRDGPARAM, &bridge->params, sizeof(bridge->params), false) != 0) { - free(bridge); - return (-1); + goto err; } - members.ifbic_buf = NULL; for (size_t len = 8192; (buf = realloc(members.ifbic_buf, len)) != NULL; len *= 2) { @@ -107,27 +104,52 @@ ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h, members.ifbic_len = len; if (ifconfig_bridge_ioctlwrap(h, name, BRDGGIFS, &members, sizeof(members), false) != 0) { - free(buf); - free(bridge); - return (-1); + goto err; } if ((members.ifbic_len + sizeof(*members.ifbic_req)) < len) break; } if (buf == NULL) { - free(members.ifbic_buf); - free(bridge); h->error.errtype = OTHER; h->error.errcode = ENOMEM; - return (-1); + goto err; } bridge->inner.members = members.ifbic_req; bridge->inner.members_count = members.ifbic_len / sizeof(*members.ifbic_req); + bridge->inner.member_vlans = calloc(bridge->inner.members_count, + sizeof(ifbvlan_set_t)); + if (bridge->inner.member_vlans == NULL) { + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + goto err; + } + for (size_t i = 0; i < bridge->inner.members_count; ++i) { + struct ifbif_vlan_req vreq; + memset(&vreq, 0, sizeof(vreq)); + strlcpy(vreq.bv_ifname, bridge->inner.members[i].ifbr_ifsname, + sizeof(vreq.bv_ifname)); + + if (ifconfig_bridge_ioctlwrap(h, name, BRDGGIFVLANSET, &vreq, + sizeof(vreq), false) != 0) { + goto err; + } + + __BIT_COPY(BRVLAN_SETSIZE, &vreq.bv_set, + &bridge->inner.member_vlans[i]); + } + *bridgep = &bridge->inner; return (0); + +err: + free(members.ifbic_buf); + if (bridge) + free(bridge->inner.member_vlans); + free(bridge); + return (-1); } void diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c index a60ddabcbdd4..ce5d2f4894fa 100644 --- a/sbin/ifconfig/ifbridge.c +++ b/sbin/ifconfig/ifbridge.c @@ -146,6 +146,36 @@ bridge_addresses(if_ctx *ctx, const char *prefix) free(inbuf); } +static void +print_vlans(ifbvlan_set_t *vlans) +{ + unsigned printed = 0; + + for (unsigned vlan = DOT1Q_VID_MIN; vlan <= DOT1Q_VID_MAX;) { + unsigned last; + + if (!BRVLAN_TEST(vlans, vlan)) { + ++vlan; + continue; + } + + last = vlan; + while (last < DOT1Q_VID_MAX && BRVLAN_TEST(vlans, last + 1)) + ++last; + + if (printed == 0) + printf(" tagged "); + else + printf(","); + + printf("%u", vlan); + if (last != vlan) + printf("-%u", last); + ++printed; + vlan = last + 1; + } +} + static void bridge_status(if_ctx *ctx) { @@ -213,6 +243,7 @@ bridge_status(if_ctx *ctx) } if (member->ifbr_untagged != 0) printf(" untagged %u", (unsigned)member->ifbr_untagged); + print_vlans(&bridge->member_vlans[i]); printf("\n"); } @@ -674,6 +705,97 @@ unsetbridge_vlanfilter(if_ctx *ctx, const char *val, int dummy __unused) do_bridgeflag(ctx, val, IFBIF_VLANFILTER, 0); } +static int +parse_vlans(ifbvlan_set_t *set, const char *str) +{ + char *s, *token; + + /* "none" means the empty vlan set */ + if (strcmp(str, "none") == 0) { + __BIT_ZERO(BRVLAN_SETSIZE, set); + return (0); + } + + /* "all" means all vlans, except for 0 and 4095 which are reserved */ + if (strcmp(str, "all") == 0) { + __BIT_FILL(BRVLAN_SETSIZE, set); + BRVLAN_CLR(set, DOT1Q_VID_NULL); + BRVLAN_CLR(set, DOT1Q_VID_RSVD_IMPL); + return (0); + } + + if ((s = strdup(str)) == NULL) + return (-1); + + while ((token = strsep(&s, ",")) != NULL) { + unsigned long first, last; + char *p, *lastp; + + if ((lastp = strchr(token, '-')) != NULL) + *lastp++ = '\0'; + + first = last = strtoul(token, &p, 10); + if (*p != '\0') + goto err; + if (first < DOT1Q_VID_MIN || first > DOT1Q_VID_MAX) + goto err; + + if (lastp) { + last = strtoul(lastp, &p, 10); + if (*p != '\0') + goto err; + if (last < DOT1Q_VID_MIN || last > DOT1Q_VID_MAX || + last < first) + goto err; + } + + for (unsigned vlan = first; vlan <= last; ++vlan) + BRVLAN_SET(set, vlan); + } + + free(s); + return (0); + +err: + free(s); + return (-1); +} + +static void +set_bridge_vlanset(if_ctx *ctx, const char *ifn, const char *vlans, int op) +{ + struct ifbif_vlan_req req; + + memset(&req, 0, sizeof(req)); + + if (parse_vlans(&req.bv_set, vlans) != 0) + errx(1, "invalid vlan set: %s", vlans); + + strlcpy(req.bv_ifname, ifn, sizeof(req.bv_ifname)); + req.bv_op = op; + + if (do_cmd(ctx, BRDGSIFVLANSET, &req, sizeof(req), 1) < 0) + err(1, "BRDGSIFVLANSET %s", vlans); +} + +static void +setbridge_tagged(if_ctx *ctx, const char *ifn, const char *vlans) +{ + set_bridge_vlanset(ctx, ifn, vlans, BRDG_VLAN_OP_SET); +} + +static void +addbridge_tagged(if_ctx *ctx, const char *ifn, const char *vlans) +{ + set_bridge_vlanset(ctx, ifn, vlans, BRDG_VLAN_OP_ADD); +} + +static void +delbridge_tagged(if_ctx *ctx, const char *ifn, const char *vlans) +{ + set_bridge_vlanset(ctx, ifn, vlans, BRDG_VLAN_OP_DEL); +} + static struct cmd bridge_cmds[] = { DEF_CMD_ARG("addm", setbridge_add), DEF_CMD_ARG("deletem", setbridge_delete), @@ -714,6 +836,9 @@ static struct cmd bridge_cmds[] = { DEF_CMD_ARG("-vlanfilter", unsetbridge_vlanfilter), DEF_CMD_ARG2("untagged", setbridge_untagged), DEF_CMD_ARG("-untagged", unsetbridge_untagged), + DEF_CMD_ARG2("tagged", setbridge_tagged), + DEF_CMD_ARG2("+tagged", addbridge_tagged), + DEF_CMD_ARG2("-tagged", delbridge_tagged), DEF_CMD_ARG("timeout", setbridge_timeout), DEF_CMD_ARG("private", setbridge_private), DEF_CMD_ARG("-private", unsetbridge_private), diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index 490da7b2ce2c..3fb8b5f02b76 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -2714,6 +2714,38 @@ Setting will automatically enable VLAN filtering on the interface. .It Cm -untagged Ar interface Ar vlan-id Clear the untagged VLAN identifier for an interface. +.It Cm tagged Ar interface Ar vlan-list +Set the interface's VLAN access list to the provided list of VLANs. +The list should be a comma-separated list of one or more VLAN IDs +or ranges formatted as +.Ar first-last , +the value +.Dq none +meaning the empty set, +or the value +.Dq all +meaning all VLANs (1-4094). +.Pp +Setting +.Cm tagged +will automatically enable VLAN filtering on the interface. +.It Cm +tagged Ar interface Ar vlan-list +Add the provided list of VLAN IDs to the interface's VLAN access list. +The list should be formatted as described for +.Cm tagged . +.Pp +Setting +.Cm +tagged +will automatically enable VLAN filtering on the interface. +.It Cm -tagged Ar interface Ar vlan-list +Remove the provided list of VLAN IDs from the interface's VLAN access +list. +The list should be formatted as described for +.Cm tagged . +.Pp +Setting +.Cm -tagged +will automatically enable VLAN filtering on the interface. .El .Ss Link Aggregation and Link Failover Parameters The following parameters are specific to lagg interfaces: diff --git a/share/man/man4/bridge.4 b/share/man/man4/bridge.4 index 6fae37004efe..06f7fed06477 100644 --- a/share/man/man4/bridge.4 +++ b/share/man/man4/bridge.4 @@ -289,7 +289,8 @@ VLAN filtering may be enabled on an interface using the .Cm vlanfilter option. When VLAN filtering is enabled, an interface may only send and receive -untagged frames. +frames based on its configured VLAN access list. +.Pp The interface's untagged VLAN ID may be configured using the .Xr ifconfig 8 .Cm untagged @@ -298,6 +299,16 @@ If an untagged VLAN ID is configured, incoming frames will be assigned to that VLAN, and the interface may receive outgoing untagged frames in that VLAN. .Pp +The tagged VLAN access list may be configured using the +.Cm tagged , +.Cm +tagged +and +.Cm -tagged +options to +.Xr ifconfig 8 . +An interface may send and receive tagged frames for any VLAN in its +access list. +.Pp The bridge will automatically insert or remove 802.1q tags as needed, based on the interface configuration, when forwarding frames between interfaces. diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 5b54c119eabf..ba4e0425c945 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -255,6 +255,7 @@ struct bridge_iflist { uint32_t bif_addrexceeded;/* # of address violations */ struct epoch_context bif_epoch_ctx; ether_vlanid_t bif_untagged; /* untagged vlan id */ + ifbvlan_set_t bif_vlan_set; /* allowed tagged vlans */ }; /* @@ -353,8 +354,9 @@ static void bridge_rtage(struct bridge_softc *); static void bridge_rtflush(struct bridge_softc *, int); static int bridge_rtdaddr(struct bridge_softc *, const uint8_t *, ether_vlanid_t); +static bool bridge_vfilter_in(const struct bridge_iflist *, struct mbuf *); static bool bridge_vfilter_out(const struct bridge_iflist *, - const struct mbuf *, ether_vlanid_t); + const struct mbuf *); static void bridge_rtable_init(struct bridge_softc *); static void bridge_rtable_fini(struct bridge_softc *); @@ -403,6 +405,8 @@ static int bridge_ioctl_sifprio(struct bridge_softc *, void *); static int bridge_ioctl_sifcost(struct bridge_softc *, void *); static int bridge_ioctl_sifmaxaddr(struct bridge_softc *, void *); static int bridge_ioctl_sifuntagged(struct bridge_softc *, void *); +static int bridge_ioctl_sifvlanset(struct bridge_softc *, void *); +static int bridge_ioctl_gifvlanset(struct bridge_softc *, void *); static int bridge_ioctl_addspan(struct bridge_softc *, void *); static int bridge_ioctl_delspan(struct bridge_softc *, void *); static int bridge_ioctl_gbparam(struct bridge_softc *, void *); @@ -623,6 +627,12 @@ static const struct bridge_control bridge_control_table[] = { { bridge_ioctl_sifuntagged, sizeof(struct ifbreq), BC_F_COPYIN|BC_F_SUSER }, + + { bridge_ioctl_sifvlanset, sizeof(struct ifbif_vlan_req), + BC_F_COPYIN|BC_F_SUSER }, + + { bridge_ioctl_gifvlanset, sizeof(struct ifbif_vlan_req), + BC_F_COPYIN|BC_F_COPYOUT }, }; static const int bridge_control_table_size = nitems(bridge_control_table); @@ -959,6 +969,7 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct ifbaconf ifbaconf; struct ifbrparam ifbrparam; struct ifbropreq ifbropreq; + struct ifbif_vlan_req ifvlanreq; } args; struct ifdrv *ifd = (struct ifdrv *) data; const struct bridge_control *bc; @@ -1897,6 +1908,65 @@ bridge_ioctl_sifuntagged(struct bridge_softc *sc, void *arg) return (0); } +static int +bridge_ioctl_sifvlanset(struct bridge_softc *sc, void *arg) +{ + struct ifbif_vlan_req *req = arg; + struct bridge_iflist *bif; + + bif = bridge_lookup_member(sc, req->bv_ifname); + if (bif == NULL) + return (ENOENT); + + /* Reject invalid VIDs. */ + if (BRVLAN_TEST(&req->bv_set, DOT1Q_VID_NULL) || + BRVLAN_TEST(&req->bv_set, DOT1Q_VID_RSVD_IMPL)) + return (EINVAL); + + switch (req->bv_op) { + /* Replace the existing vlan set with the new set */ + case BRDG_VLAN_OP_SET: + BIT_COPY(BRVLAN_SETSIZE, &req->bv_set, &bif->bif_vlan_set); + break; + + /* Modify the existing vlan set to add the given vlans */ + case BRDG_VLAN_OP_ADD: + BIT_OR(BRVLAN_SETSIZE, &bif->bif_vlan_set, &req->bv_set); + break; + + /* Modify the existing vlan set to remove the given vlans */ + case BRDG_VLAN_OP_DEL: + BIT_ANDNOT(BRVLAN_SETSIZE, &bif->bif_vlan_set, &req->bv_set); + break; + + /* Invalid or unknown operation */ + default: + return (EINVAL); + } + + /* + * The only reason to modify the VLAN access list is to use VLAN + * filtering on this interface, so enable it automatically. + */ + bif->bif_flags |= IFBIF_VLANFILTER; + + return (0); +} + +static int +bridge_ioctl_gifvlanset(struct bridge_softc *sc, void *arg) +{ + struct ifbif_vlan_req *req = arg; + struct bridge_iflist *bif; + + bif = bridge_lookup_member(sc, req->bv_ifname); + if (bif == NULL) + return (ENOENT); + + BIT_COPY(BRVLAN_SETSIZE, &bif->bif_vlan_set, &req->bv_set); + return (0); +} + static int bridge_ioctl_addspan(struct bridge_softc *sc, void *arg) { @@ -2606,7 +2676,7 @@ bridge_forward(struct bridge_softc *sc, struct bridge_iflist *sbif, goto drop; /* Do VLAN filtering. */ - if (!bridge_vfilter_out(dbif, m, vlan)) + if (!bridge_vfilter_out(dbif, m)) goto drop; if ((dbif->bif_flags & IFBIF_STP) && @@ -2691,27 +2761,13 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) } /* Do VLAN filtering. */ - if (bif->bif_flags & IFBIF_VLANFILTER) { - /* - * If the frame was received with a tag, drop it, since we only - * support untagged ports which shouldn't be receiving tagged - * frames. - * - * If the frame was received without a tag, and the port doesn't - * have an untagged vlan configured, drop it. - */ - if (vlan != DOT1Q_VID_NULL || - bif->bif_untagged == DOT1Q_VID_NULL) { - if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); - m_freem(m); - return (NULL); - } - - /* Otherwise, assign the untagged frame to the correct vlan. */ - vlan = bif->bif_untagged; - m->m_pkthdr.ether_vtag = bif->bif_untagged; - m->m_flags |= M_VLANTAG; + if (!bridge_vfilter_in(bif, m)) { + if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); + m_freem(m); + return (NULL); } + /* bridge_vfilter_in() may add a tag */ + vlan = VLANTAGOF(m); bridge_span(sc, m); @@ -2922,12 +2978,10 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *src_if, struct mbuf *mc; struct ifnet *dst_if; int used = 0, i; - ether_vlanid_t vlan; NET_EPOCH_ASSERT(); sbif = bridge_lookup_member_if(sc, src_if); - vlan = VLANTAGOF(m); /* Filter on the bridge interface before broadcasting */ if (runfilt && PFIL_HOOKED_OUT_46) { @@ -2947,7 +3001,7 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *src_if, continue; /* Do VLAN filtering. */ - if (!bridge_vfilter_out(dbif, m, vlan)) + if (!bridge_vfilter_out(dbif, m)) continue; if ((dbif->bif_flags & IFBIF_STP) && @@ -3033,16 +3087,63 @@ bridge_span(struct bridge_softc *sc, struct mbuf *m) } } +/* + * Incoming VLAN filtering. Given a frame and the member interface it was + * received on, decide whether the port configuration allows it. + */ +static bool +bridge_vfilter_in(const struct bridge_iflist *sbif, struct mbuf *m) +{ + ether_vlanid_t vlan; + + vlan = VLANTAGOF(m); + /* Make sure the vlan id is reasonable. */ + if (vlan > DOT1Q_VID_MAX) + return (false); + + /* If VLAN filtering isn't enabled, pass everything. */ + if ((sbif->bif_flags & IFBIF_VLANFILTER) == 0) + return (true); + + if (vlan == DOT1Q_VID_NULL) { + /* + * The frame doesn't have a tag. If the interface does not + * have an untagged vlan configured, drop the frame. + */ + if (sbif->bif_untagged == DOT1Q_VID_NULL) + return (false); + + /* + * Otherwise, insert a new tag based on the interface's + * untagged vlan id. + */ + m->m_pkthdr.ether_vtag = sbif->bif_untagged; + m->m_flags |= M_VLANTAG; + } else { + /* + * The frame has a tag, so check it matches the interface's + * vlan access list. We explicitly do not accept tagged + * frames for the untagged vlan id here (unless it's also + * in the access list). + */ + if (!BRVLAN_TEST(&sbif->bif_vlan_set, vlan)) + return (false); + } + + /* Accept the frame. */ + return (true); +} + /* * Outgoing VLAN filtering. Given a frame, its vlan, and the member interface * we intend to send it to, decide whether the port configuration allows it to * be sent. */ static bool -bridge_vfilter_out(const struct bridge_iflist *dbif, const struct mbuf *m, - ether_vlanid_t vlan) +bridge_vfilter_out(const struct bridge_iflist *dbif, const struct mbuf *m) { struct ether_header *eh; + ether_vlanid_t vlan; NET_EPOCH_ASSERT(); @@ -3050,6 +3151,8 @@ bridge_vfilter_out(const struct bridge_iflist *dbif, const struct mbuf *m, if ((dbif->bif_flags & IFBIF_VLANFILTER) == 0) return (true); + vlan = VLANTAGOF(m); + /* * Always allow untagged 802.1D STP frames, even if they would * otherwise be dropped. This is required for STP to work on @@ -3072,15 +3175,21 @@ bridge_vfilter_out(const struct bridge_iflist *dbif, const struct mbuf *m, return (false); /* - * Make sure the frame's vlan matches the port's untagged vlan. + * If the frame's vlan matches the interfaces's untagged vlan, + * allow it. */ - if (vlan != dbif->bif_untagged) - return (false); + if (vlan == dbif->bif_untagged) + return (true); /* - * Everything looks fine, so pass this frame. + * If the frame's vlan is on the interface's tagged access list, + * allow it. */ - return (true); + if (BRVLAN_TEST(&dbif->bif_vlan_set, vlan)) + return (true); + + /* The frame was not permitted, so drop it. */ + return (false); } /* diff --git a/sys/net/if_bridgevar.h b/sys/net/if_bridgevar.h index c72afcc1785d..97b63e3d4416 100644 --- a/sys/net/if_bridgevar.h +++ b/sys/net/if_bridgevar.h @@ -78,6 +78,8 @@ #define _NET_IF_BRIDGEVAR_H_ #include +#include +#include #include #include #include @@ -123,6 +125,8 @@ #define BRDGSTXHC 29 /* set tx hold count (ifbrparam) */ #define BRDGSIFAMAX 30 /* set max interface addrs (ifbreq) */ #define BRDGSIFUNTAGGED 31 /* set if untagged vlan */ +#define BRDGSIFVLANSET 32 /* set if vlan set */ +#define BRDGGIFVLANSET 33 /* get if vlan set */ /* * Generic bridge control request. @@ -307,6 +311,26 @@ struct ifbpstpconf { eaddr[5] = pv >> 0; \ } while (0) +/* + * Bridge VLAN access request. + */ +#define BRVLAN_SETSIZE 4096 +typedef __BITSET_DEFINE(ifbvlan_set, BRVLAN_SETSIZE) ifbvlan_set_t; + +#define BRVLAN_SET(set, bit) __BIT_SET(BRVLAN_SETSIZE, (bit), set) +#define BRVLAN_CLR(set, bit) __BIT_CLR(BRVLAN_SETSIZE, (bit), set) +#define BRVLAN_TEST(set, bit) __BIT_ISSET(BRVLAN_SETSIZE, (bit), set) + +#define BRDG_VLAN_OP_SET 1 /* replace current vlan set */ +#define BRDG_VLAN_OP_ADD 2 /* add vlans to current set */ +#define BRDG_VLAN_OP_DEL 3 /* remove vlans from current set */ + +struct ifbif_vlan_req { + char bv_ifname[IFNAMSIZ]; + uint8_t bv_op; + ifbvlan_set_t bv_set; +}; + #ifdef _KERNEL #define BRIDGE_INPUT(_ifp, _m) do { \ diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 90cc91ac594f..4815c1aef570 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -997,6 +997,133 @@ vlan_pvid_1q_cleanup() vnet_cleanup } +# +# Test vlan filtering. +# +atf_test_case "vlan_filtering" "cleanup" +vlan_filtering_head() +{ + atf_set descr 'tagged traffic with filtering' + atf_set require.user root +} + +vlan_filtering_body() +{ + vnet_init + vnet_init_bridge + + epone=$(vnet_mkepair) + eptwo=$(vnet_mkepair) + + vnet_mkjail one ${epone}b + vnet_mkjail two ${eptwo}b + + jexec one ifconfig ${epone}b up + jexec one ifconfig ${epone}b.20 create 192.0.2.1/24 up + jexec two ifconfig ${eptwo}b up + jexec two ifconfig ${eptwo}b.20 create 192.0.2.2/24 up + + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${epone}a up + ifconfig ${eptwo}a up + ifconfig ${bridge} addm ${epone}a vlanfilter ${epone}a + ifconfig ${bridge} addm ${eptwo}a vlanfilter ${eptwo}a + + # Right now there are no VLANs on the access list, so everything + # should be blocked. + atf_check -s exit:2 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:2 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 + + # Set the untagged vlan on both ports to 20 and make sure traffic is + # still blocked. We intentionally do not pass tagged traffic for the + # untagged vlan. + atf_check -s exit:0 ifconfig ${bridge} untagged ${epone}a 20 + atf_check -s exit:0 ifconfig ${bridge} untagged ${eptwo}a 20 + + atf_check -s exit:2 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:2 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 + + atf_check -s exit:0 ifconfig ${bridge} -untagged ${epone}a + atf_check -s exit:0 ifconfig ${bridge} -untagged ${eptwo}a + + # Add VLANs 10-30 to the access list; now access should be allowed. + ifconfig ${bridge} +tagged ${epone}a 10-30 + ifconfig ${bridge} +tagged ${eptwo}a 10-30 + atf_check -s exit:0 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:0 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 + + # Remove vlan 20 from the access list, now access should be blocked + # again. + ifconfig ${bridge} -tagged ${epone}a 20 + ifconfig ${bridge} -tagged ${eptwo}a 20 + atf_check -s exit:2 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:2 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 +} + +vlan_filtering_cleanup() +{ + vnet_cleanup +} + +# +# Test the ifconfig 'tagged' option. +# +atf_test_case "vlan_ifconfig_tagged" "cleanup" +vlan_ifconfig_tagged_head() +{ + atf_set descr 'test the ifconfig tagged option' + atf_set require.user root +} + +vlan_ifconfig_tagged_body() +{ + vnet_init + vnet_init_bridge + + ep=$(vnet_mkepair) + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} addm ${ep}a vlanfilter ${ep}a up + ifconfig ${ep}a up + + # To start with, no vlans should be configured. + atf_check -s exit:0 -o not-match:"tagged" ifconfig ${bridge} + + # Add vlans 100-149. + atf_check -s exit:0 ifconfig ${bridge} tagged ${ep}a 100-149 + atf_check -s exit:0 -o match:"tagged 100-149" ifconfig ${bridge} + + # Replace the vlan list with 139-199. + atf_check -s exit:0 ifconfig ${bridge} tagged ${ep}a 139-199 + atf_check -s exit:0 -o match:"tagged 139-199" ifconfig ${bridge} + + # Add vlans 100-170. + atf_check -s exit:0 ifconfig ${bridge} +tagged ${ep}a 100-170 + atf_check -s exit:0 -o match:"tagged 100-199" ifconfig ${bridge} + + # Remove vlans 104, 105, and 150-159 + atf_check -s exit:0 ifconfig ${bridge} -tagged ${ep}a 104,105,150-159 + atf_check -s exit:0 -o match:"tagged 100-103,106-149,160-199" \ + ifconfig ${bridge} + + # Remove the entire vlan list. + atf_check -s exit:0 ifconfig ${bridge} tagged ${ep}a none + atf_check -s exit:0 -o not-match:"tagged" ifconfig ${bridge} + + # Test some invalid vlans sets. + for bad_vlan in -1 0 4096 4097 foo 0-10 4000-5000 foo-40 40-foo; do + atf_check -s exit:1 -e ignore \ + ifconfig ${bridge} tagged "$bad_vlan" + done +} + +vlan_ifconfig_tagged_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -1019,4 +1146,6 @@ atf_init_test_cases() atf_add_test_case "vlan_pvid_1q" atf_add_test_case "vlan_pvid_filtered" atf_add_test_case "vlan_pvid_tagged" + atf_add_test_case "vlan_filtering" + atf_add_test_case "vlan_ifconfig_tagged" } From nobody Sat Jul 5 07:13:19 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ1tm3gCJz61Bbf; Sat, 05 Jul 2025 07:13: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ1tl30F5z4451; Sat, 05 Jul 2025 07:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699599; h=from:from:reply-to:subject:subject: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/qY6InaSWwkCS6249m4IiO0aRQGhHNlzlHRYRJ2kxA=; b=gE0sAs0HArx3C/AKDHZKM15xOUokhzJhnH/wyJm8DVxhVeV8uKgOXFPCVwySY9FniEYpZT lnJsCTCSDL/J6MpN38CpAbHhpoFN1LICLDqIYXNKH7WUlh3FUea+ZBuGB+bn7iwdpgT8tm lrpXQcaAmbOzhLI+nq4BHPG5zngBI6w6qIYuixG6YmcunPaBVj7qBfERLkU8A44Go2oozp m8rGaIsWRDy7eJ12gk2/uiXb7nhcTgpv+RdqPDxmQC2CihHzteheoldv5OJjjQbjeQruIB zrE02c/ChCmCAeZPXqOax1kKmpFvooVy66sXvUBd/YtDx5aJaipqk14CaapaBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699599; h=from:from:reply-to:subject:subject: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/qY6InaSWwkCS6249m4IiO0aRQGhHNlzlHRYRJ2kxA=; b=iuSzDLbXcmnbHyy2bIEGeiPrUpAhk2uC+T6tHA4xedxI6wFpuQxkEnNMVx+VILL+Fk9YDI fmlTni+jLGVXMLO4+80RHj1TyLpD3ZPZrfCzZOBrZ7evysAgHtUTEC2XQsa826B+c7TOtk Y+nX6Uo+MpSYVjCQVYP9w6Ut4NDuFaWCeJ7uLNjukHhxayv9c/X/QDMV5yfd10motJrKLn nOih4PhrUiGHe5cNVXa2qapOBEGrpINBd7k+qfLj29muc1vb4VV9TosqQT/+2mehGLwBF7 UDmtP1REGRDGysZyRBIm1JYM3Me0xPk05kK5vIExpj6UKbwkizrquBVibkxX4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751699599; a=rsa-sha256; cv=none; b=hbM5fYs1LPV/mvn5fcUGdP+VOSFvZpnp78JjoN+Ex7WL3F8mKBNwwnRSzurmIMUtn8xTYd xDK8s26lF6zTkWF3bfG/0dask9cDFTdEPU8xgOlJ88GZt4l/i+yvKYey59XM/aMDL7GTgj JwTAwYv8gor9/XaNlkLvDg0GXGH1dl5uNMbI+k512rbk4CatQclt0q5yQD1lS6SPjlgLGz GboAl4XMvRmIfT+dqTjkCDdTx0YJq0UjoN5wsR0oB0T42HHgjszLxqY8RMduNQ0n6Th8vR dpfZhLGWbQylf52Zs2LPYhSgAFxP05+5NYuYJbAob+fmHQXQ0gRa7veSZbVq7g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ1tl27YXz9yc; Sat, 05 Jul 2025 07:13:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5657DJHS017577; Sat, 5 Jul 2025 07:13:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5657DJvk017574; Sat, 5 Jul 2025 07:13:19 GMT (envelope-from git) Date: Sat, 5 Jul 2025 07:13:19 GMT Message-Id: <202507050713.5657DJvk017574@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 95e7d47a4bce - main - bridge: allow vlan(4) interfaces on a bridge List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95e7d47a4bcea741f44aac4cbdcdb41bbbff6d70 Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=95e7d47a4bcea741f44aac4cbdcdb41bbbff6d70 commit 95e7d47a4bcea741f44aac4cbdcdb41bbbff6d70 Author: Lexi Winter AuthorDate: 2025-07-05 06:36:00 +0000 Commit: Lexi Winter CommitDate: 2025-07-05 07:04:31 +0000 bridge: allow vlan(4) interfaces on a bridge A vlan interface on top of a bridge will act as a layer 3 port for bridge traffic on that vlan, sometimes called an "SVI". This allows the host to send/receive traffic on that vlan without having to create a separate epair(4) and vlan(4) to tag and untag the traffic. Reviewed by: zlei, kp, des Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D50504 --- share/man/man4/bridge.4 | 6 ++++++ sys/net/if_bridge.c | 39 +++++++++++++++++++++++++++++++++++++-- sys/net/if_vlan.c | 1 + tests/sys/net/if_bridge_test.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/share/man/man4/bridge.4 b/share/man/man4/bridge.4 index 06f7fed06477..d3dea9eaa938 100644 --- a/share/man/man4/bridge.4 +++ b/share/man/man4/bridge.4 @@ -281,6 +281,11 @@ multiple interfaces on different VLANs. Incoming frames with an 802.1Q tag will be assigned to the appropriate VLAN. .Pp +Traffic sent to or from the host is not assigned to a VLAN by default. +To allow the host to communicate on a VLAN, configure a +.Xr vlan 4 +interface on the bridge and (if necessary) assign IP addresses there. +.Pp By default no access control is enabled, so any interface may participate in any VLAN. .Pp @@ -581,6 +586,7 @@ ifconfig bridge0 addm fxp0 addm gif0 up .Xr ipfw 4 , .Xr netmap 4 , .Xr pf 4 , +.Xr vlan 4 , .Xr ifconfig 8 .Sh HISTORY The diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index ba4e0425c945..5b3ee740d75e 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -847,6 +847,7 @@ bridge_clone_create(struct if_clone *ifc, char *name, size_t len, ifp->if_softc = sc; if_initname(ifp, bridge_name, ifd->unit); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_capabilities = ifp->if_capenable = IFCAP_VLAN_HWTAGGING; ifp->if_ioctl = bridge_ioctl; #ifdef ALTQ ifp->if_start = bridge_altq_start; @@ -2484,16 +2485,17 @@ bridge_transmit(struct ifnet *ifp, struct mbuf *m) struct ether_header *eh; struct ifnet *dst_if; int error = 0; + ether_vlanid_t vlan; sc = ifp->if_softc; ETHER_BPF_MTAP(ifp, m); eh = mtod(m, struct ether_header *); + vlan = VLANTAGOF(m); if (((m->m_flags & (M_BCAST|M_MCAST)) == 0) && - (dst_if = bridge_rtlookup(sc, eh->ether_dhost, DOT1Q_VID_NULL)) != - NULL) { + (dst_if = bridge_rtlookup(sc, eh->ether_dhost, vlan)) != NULL) { error = bridge_enqueue(sc, dst_if, m, NULL); } else bridge_broadcast(sc, ifp, m, 0); @@ -2894,6 +2896,15 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) } \ if ((iface) != bifp) \ ETHER_BPF_MTAP(iface, m); \ + /* Pass tagged packets to if_vlan, if it's loaded */ \ + if (VLANTAGOF(m) != 0) { \ + if (bifp->if_vlantrunk == NULL) { \ + m_freem(m); \ + return (NULL); \ + } \ + (*vlan_input_p)(bifp, m); \ + return (NULL); \ + } \ return (m); \ } \ \ @@ -2950,6 +2961,30 @@ bridge_inject(struct ifnet *ifp, struct mbuf *m) { struct bridge_softc *sc; + if (ifp->if_type == IFT_L2VLAN) { + /* + * vlan(4) gives us the vlan ifnet, so we need to get the + * bridge softc to get a pointer to ether_input to send the + * packet to. + */ + struct ifnet *bifp = NULL; + + if (vlan_trunkdev_p == NULL) { + m_freem(m); + return; + } + + bifp = vlan_trunkdev_p(ifp); + if (bifp == NULL) { + m_freem(m); + return; + } + + sc = if_getsoftc(bifp); + sc->sc_if_input(ifp, m); + return; + } + KASSERT((if_getcapenable(ifp) & IFCAP_NETMAP) != 0, ("%s: iface %s is not running in netmap mode", __func__, if_name(ifp))); diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index e9e1c82cb688..22fcb7bf7c64 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1673,6 +1673,7 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid, */ if (p->if_type != IFT_ETHER && p->if_type != IFT_L2VLAN && + p->if_type != IFT_BRIDGE && (p->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) return (EPROTONOSUPPORT); if ((p->if_flags & VLAN_IFFLAGS) != VLAN_IFFLAGS) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index 4815c1aef570..d057d2997486 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -1124,6 +1124,46 @@ vlan_ifconfig_tagged_cleanup() vnet_cleanup } +# +# Test a vlan(4) "SVI" interface on top of a bridge. +# +atf_test_case "vlan_svi" "cleanup" +vlan_svi_head() +{ + atf_set descr 'vlan bridge with an SVI' + atf_set require.user root +} + +vlan_svi_body() +{ + vnet_init + vnet_init_bridge + + epone=$(vnet_mkepair) + + vnet_mkjail one ${epone}b + + jexec one ifconfig ${epone}b up + jexec one ifconfig ${epone}b.20 create 192.0.2.1/24 up + + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${epone}a up + ifconfig ${bridge} addm ${epone}a tagged ${epone}a 20 + + svi=$(vnet_mkvlan) + ifconfig ${svi} vlan 20 vlandev ${bridge} + ifconfig ${svi} inet 192.0.2.2/24 up + + atf_check -s exit:0 -o ignore ping -c 3 -t 1 192.0.2.1 +} + +vlan_svi_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -1148,4 +1188,5 @@ atf_init_test_cases() atf_add_test_case "vlan_pvid_tagged" atf_add_test_case "vlan_filtering" atf_add_test_case "vlan_ifconfig_tagged" + atf_add_test_case "vlan_svi" } From nobody Sat Jul 5 07:13:20 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ1tp5SC3z61Bbg; Sat, 05 Jul 2025 07:13: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ1tm3y4xz449d; Sat, 05 Jul 2025 07:13:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vllYTQYZprXvwyRGovdZo+jmDemggrdNot9wZKahgY0=; b=s6oljb2Pw8e/lBYVFUJpabw1bnuxeffQEH5lofxWEmeS5krmwyH8ykFOnD2/e4RB1V9SmI ChUPcD/RLHyuWcLY4zQPpX9kEyijIJWH3h1szONpSy/jycu7SXJZvT5335PBzA6mTwSyB6 J+JgcyYWsoPnREHNlpKFc7Ri59XXeVnpJoJl35xwIj/UDV94ZlXQ2iPWGvwPIXavObI4ug 2lHWJDSkZux8KYaEavvMpxgaKYSN1S17upCD2+qfaOmrDfGf1MuckyxG1Cj/fSM4gXv/aa Bb5IoVGc+48E0v/R1YVTjAFYGviPnZAH5uiixcqJfqzjJCFtxQBXVulyseHcwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vllYTQYZprXvwyRGovdZo+jmDemggrdNot9wZKahgY0=; b=Q1G7hHkeJ5bpgCnXfVItyUWl7X0YarB0PXmIfMCJzJKBOUgPYEc+alC2uP2ek8AcjM64s8 LIm4i2JlR12V+V6zUHTw+AQiH3IdWDHhSqtLzvpt5D5cqr2UIzOIy+5H5DNAzDMVkbM7JA ynqviCF5yx8ogPzY4MuF/yfIR1EQT1sUu6v0sbHv6wHY7fVYefoT24KmXonOTuNzKpLYo7 2jZrozOgdpc34xDUCsBsEI58KWg51ESfGoMvnXKzsJo41hQqsYFldDWS7eK2PYrT1g83H7 x3ehg+TNoOURc/BQ/OoX4m/nMlF2yT9blMb+1k3UfIHWL9sRTKrmnXD0ERlXdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751699600; a=rsa-sha256; cv=none; b=lgPHv7yS6zjEuzVt3zfeRMwZ3ybXGAyAS21IDgofMte6+GjqtHjcrZNVNUf7Z6k+Ol+sFu LeBJOsT0UB2foRzC4nEPIR9oDSSeHpmUcuq6tOb9KeupOA2ZkRM+n/XHZxlP1hxfyGoNIf eSE/3nHneZ9oTYR14dplE8LVEZcMGkuoZrOTihVs21dtyMU19ZjT6c2CnsVbKaMtBul6JI qvPpM6qH42AIkgN1VnCjX5e8KbcXTXt8kzHz8HZo8TADggu6a4pPSbVmhi31N2/mMTZWgz us3ErA1bhvDTz1B4/63YprtENpseBR6G/G/tGR+Y7pThP8Pu3B2HIl9h6y5VUw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ1tm3Mqdz9H2; Sat, 05 Jul 2025 07:13:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5657DKaa017615; Sat, 5 Jul 2025 07:13:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5657DKJW017612; Sat, 5 Jul 2025 07:13:20 GMT (envelope-from git) Date: Sat, 5 Jul 2025 07:13:20 GMT Message-Id: <202507050713.5657DKJW017612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 47a10c0f4824 - main - bridge.4: clarify vlan support status List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 47a10c0f48240948dc493c229656914193440036 Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=47a10c0f48240948dc493c229656914193440036 commit 47a10c0f48240948dc493c229656914193440036 Author: Lexi Winter AuthorDate: 2025-07-05 06:56:13 +0000 Commit: Lexi Winter CommitDate: 2025-07-05 07:08:03 +0000 bridge.4: clarify vlan support status We now have "full support" for VLANs in bridge(4), rather than "limited support". Reviewed by: zlei, kp, des, p.mousavizadeh@protonmail.com Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D50505 --- share/man/man4/bridge.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/bridge.4 b/share/man/man4/bridge.4 index d3dea9eaa938..2dff393ebc29 100644 --- a/share/man/man4/bridge.4 +++ b/share/man/man4/bridge.4 @@ -274,7 +274,7 @@ node using .Sh VLAN SUPPORT The .Nm -driver has limited support for virtual LANs (VLANs). +driver has full support for virtual LANs (VLANs). The bridge implements independent VLAN learning, i.e. MAC addresses are learned on a per-VLAN basis, and the same MAC address may be learned on multiple interfaces on different VLANs. From nobody Sat Jul 5 07:13:21 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ1tq1t4mz61BdR; Sat, 05 Jul 2025 07:13: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ1tp0GqVz44J3; Sat, 05 Jul 2025 07:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/mXVxV1wWaaM0fiZPH3Mxm5udfebajqJkxHsu+IbjEI=; b=TAbw/BpKTq/xfogfq8SbuwKUiq1I3ByyA3cVqCzogu8Tr/GQqfWJ6Rog7V2nDJgiIcgjpk BVP9Qw6blLpzk1ZC2B1xRbVKcB+1Ob0XQEcSfWv0sL1+r+FjlNGb8JtND8+6ewbZ4GguP6 Kop6ILyNOw7QG+2yQdhxt1PE639cTfUsUWWl0q9pZOkM/RAWuYL/AkMTKniR9lEntwmke5 RW0YsnokmiX955VTwq0fBrkzdPC9P0lCWV3qDX2LUP+NFtW5652Cf77Il67m8POca4S+60 Uw7ydagc2yWwSA8/Af15eGT5R9rM0WhbS6XmwDgiImM7kEUvoVPFF+P42942Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751699602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/mXVxV1wWaaM0fiZPH3Mxm5udfebajqJkxHsu+IbjEI=; b=dbQ/ZCSZccCihXIe7zmlqCZs+Dne17NowXCFfcxeE0pJB4h8Q8SaWU38pO28p17d5Qj7on 576riv4vxIPTOdeA0YdFqPgHqo00frtzv1KOqb+vQcBJs7ofkqYOKSbDVAW3unGbF54LYp 8T9VDLDkxgagrKxZVwsJNBdN5UErRriimFEoZ8nATIMV8osBVFbAZxZCEqPfRC8Z+hIp9d iUOW7WVPsqAVLHrnPdtOL3L062YG90eLvLqG0xuJvr0rZKQS/I0NIJ5obuusXPJ0dzCaas RzneZNWiCgmHJ3HQ0NE9dFvxOmL+i6aknbtnOPTYjF1vH9I3hd1pPmS6asz7kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751699602; a=rsa-sha256; cv=none; b=vAoOqStjBioAqdODI9i5ec7hEL4iXrwidZjscBvwiC3Mwz6yBDw31WQ2fkeYMLhygww8bN n3N4QR839nVUN3vROBIXEPPYXXxtYTJTLsyIrSImsmS5SM2ZmrtfFi9KtY7PmG6wP8q7rG d0W89VzguL0RgKcRnpysCv+NMPUWofZdx6gpU1L5svb1lYApvcToCtUQx9vkEsVr7lujGA YdDuAtfJabLzvb+RrADQNN+lzI7PjN0Y4B6B3VG2EdGxLcUPSzlkZm5ADvUv84rihuv0Q9 Lz17aLgJGXyyaysOko+/mSaflXpjrSk1pQCTRkTL5261ymD3V5yRWWQIYwWxsg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ1tn3rhfz9Y9; Sat, 05 Jul 2025 07:13:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5657DL4i017648; Sat, 5 Jul 2025 07:13:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5657DLF1017645; Sat, 5 Jul 2025 07:13:21 GMT (envelope-from git) Date: Sat, 5 Jul 2025 07:13:21 GMT Message-Id: <202507050713.5657DLF1017645@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: c5f5d0cf49bf - main - if_bridge_test: add a test for QinQ (802.1ad) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5f5d0cf49bfa042aa6f8416449010370853e2bc Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=c5f5d0cf49bfa042aa6f8416449010370853e2bc commit c5f5d0cf49bfa042aa6f8416449010370853e2bc Author: Lexi Winter AuthorDate: 2025-07-05 06:57:33 +0000 Commit: Lexi Winter CommitDate: 2025-07-05 07:08:09 +0000 if_bridge_test: add a test for QinQ (802.1ad) Reviewed by: kp, des Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D50577 --- tests/sys/net/if_bridge_test.sh | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh index d057d2997486..cc0b212aebd2 100755 --- a/tests/sys/net/if_bridge_test.sh +++ b/tests/sys/net/if_bridge_test.sh @@ -1164,6 +1164,63 @@ vlan_svi_cleanup() vnet_cleanup } +# +# Test QinQ (802.1ad). +# +atf_test_case "vlan_qinq" "cleanup" +vlan_qinq_head() +{ + atf_set descr 'vlan filtering with QinQ traffic' + atf_set require.user root +} + +vlan_qinq_body() +{ + vnet_init + vnet_init_bridge + + epone=$(vnet_mkepair) + eptwo=$(vnet_mkepair) + + vnet_mkjail one ${epone}b + vnet_mkjail two ${eptwo}b + + # Create a QinQ trunk between the two jails. The outer (provider) tag + # is 5, and the inner tag is 10. + + jexec one ifconfig ${epone}b up + jexec one ifconfig ${epone}b.5 create vlanproto 802.1ad up + jexec one ifconfig ${epone}b.5.10 create inet 192.0.2.1/24 up + + jexec two ifconfig ${eptwo}b up + jexec two ifconfig ${eptwo}b.5 create vlanproto 802.1ad up + jexec two ifconfig ${eptwo}b.5.10 create inet 192.0.2.2/24 up + + bridge=$(vnet_mkbridge) + + ifconfig ${bridge} up + ifconfig ${epone}a up + ifconfig ${eptwo}a up + ifconfig ${bridge} addm ${epone}a vlanfilter ${epone}a + ifconfig ${bridge} addm ${eptwo}a vlanfilter ${eptwo}a + + # Right now there are no VLANs on the access list, so everything + # should be blocked. + atf_check -s exit:2 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:2 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 + + # Add the provider tag to the access list; now traffic should be passed. + ifconfig ${bridge} +tagged ${epone}a 5 + ifconfig ${bridge} +tagged ${eptwo}a 5 + atf_check -s exit:0 -o ignore jexec one ping -c 3 -t 1 192.0.2.2 + atf_check -s exit:0 -o ignore jexec two ping -c 3 -t 1 192.0.2.1 +} + +vlan_qinq_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" @@ -1189,4 +1246,5 @@ atf_init_test_cases() atf_add_test_case "vlan_filtering" atf_add_test_case "vlan_ifconfig_tagged" atf_add_test_case "vlan_svi" + atf_add_test_case "vlan_qinq" } From nobody Sat Jul 5 08:36:42 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ3ky5MbGz61NLq; Sat, 05 Jul 2025 08:36: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ3ky2rmjz3pfC; Sat, 05 Jul 2025 08:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751704602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fxdafYMt4+EeJ/JDKBbRks3fjZBTzDJiNCQBEjKmpH8=; b=EB1cmxw/IjYCMt2t9TyOBkibQ+1OmgjCBAenW8wGnAop1npBfnKTcWhyFUyqFuQBnu0LCl SADGpsHw5rRx9eyw+x19hewLQ55Mht/unlKDrB+DONLDDeNovZS6a441z+Syw4kveb3t6o 59zyvO4oYWd3u3gNaKKfytkdcnOdWhfAkCpqmVErym8A8oMDO4buvicFuYS26xnyRAcVe7 NB8ycguv39HAYyb1x/HZ717eoEqCBPmKtDLeIZmW+yR3fKdc/S30MaiEcZ4vWPyAbx3HnN g7Xb22bpUEgi6VM6ARkDpzifrgZ+XPPeJfK3AroTOCPMXGZfq+LGs8iOi9F5Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751704602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fxdafYMt4+EeJ/JDKBbRks3fjZBTzDJiNCQBEjKmpH8=; b=U+7S/P6/jRkpB4NP3ny+2DQuTXhTFJ5IcGaNAbX7iLm6elPMF8HFzOlb5B8RpK8plUSJj4 0qaGjXLpCakIdEVIJq4IMRXXDyUFhcJEK0BFpO66ZtIqci8MoYm7QnN8sFYYZHUMt1fALE eKIh7bB6gO+KxoAJcuHOgCXVJ+kT5RNzBvE5V0Fp47xFQkMTQLtdk/IaKxTS/QsZfyCz1n iBLwAw/XkQMNqDQPRRi5AKboMtZ4MPvjUNCyU6szksSsaupgCsrrWyiWGyXLNzCbnx8PbB HtsUUYRaMmBlARFj4JkZYZMuKLCnfajU1wnYH70vPfIYzW9ff5P3vrhNEQ9FeA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751704602; a=rsa-sha256; cv=none; b=w4XRk3fpChCloQX/VX6IOh4HC4xduyhUM8N6T0Nma81hMit8d4zdKol/RNlkHkwEm+4JUe fb2no818CNvTv7AvhCh5Zg3DfRQhKIJKCDUskq2bO1H2EdTJkwdPxdXkkwAk9c21Z/3lz7 /WCF39Po3mUsqrZBgt4igBMR0xcISXgr6FA9zqVWhDGLUyPFKqtfF2PjIoQmPx/+U1VGNA wTykE23tRfy03HkLByqAiTpwMpBuN5AN71uAwnB7IsWCE5TWPSBIIQyriWppsfA2HHDvmK /l4qA2MLeO9W0nDLLNVlSnlsWAjmgylZev+I5RQXeUqccLrn+TxrvKqBIwmDdQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ3ky24WyzCWs; Sat, 05 Jul 2025 08:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5658agrJ067971; Sat, 5 Jul 2025 08:36:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5658agwx067968; Sat, 5 Jul 2025 08:36:42 GMT (envelope-from git) Date: Sat, 5 Jul 2025 08:36:42 GMT Message-Id: <202507050836.5658agwx067968@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ca554a7dea3f - main - dev/mem: use sx instead of rw lock List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca554a7dea3f90f39fc2b7d25813d0be944e12e2 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ca554a7dea3f90f39fc2b7d25813d0be944e12e2 commit ca554a7dea3f90f39fc2b7d25813d0be944e12e2 Author: Konstantin Belousov AuthorDate: 2025-06-22 16:35:23 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-05 08:35:53 +0000 dev/mem: use sx instead of rw lock Some ops require sleepable context to success, like DMAP demotion. Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50970 --- sys/dev/mem/memutil.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sys/dev/mem/memutil.c b/sys/dev/mem/memutil.c index cf9714d6ec8f..20ce337df0ab 100644 --- a/sys/dev/mem/memutil.c +++ b/sys/dev/mem/memutil.c @@ -26,15 +26,14 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include #include -#include -#include +#include -static struct rwlock mr_lock; +static struct sx mr_lock; /* * Implementation-neutral, kernel-callable functions for manipulating @@ -46,7 +45,7 @@ mem_range_init(void) if (mem_range_softc.mr_op == NULL) return; - rw_init(&mr_lock, "memrange"); + sx_init(&mr_lock, "memrange"); mem_range_softc.mr_op->init(&mem_range_softc); } @@ -56,7 +55,7 @@ mem_range_destroy(void) if (mem_range_softc.mr_op == NULL) return; - rw_destroy(&mr_lock); + sx_destroy(&mr_lock); } int @@ -67,12 +66,12 @@ mem_range_attr_get(struct mem_range_desc *mrd, int *arg) if (mem_range_softc.mr_op == NULL) return (EOPNOTSUPP); nd = *arg; - rw_rlock(&mr_lock); + sx_slock(&mr_lock); if (nd == 0) *arg = mem_range_softc.mr_ndesc; else bcopy(mem_range_softc.mr_desc, mrd, nd * sizeof(*mrd)); - rw_runlock(&mr_lock); + sx_sunlock(&mr_lock); return (0); } @@ -83,8 +82,8 @@ mem_range_attr_set(struct mem_range_desc *mrd, int *arg) if (mem_range_softc.mr_op == NULL) return (EOPNOTSUPP); - rw_wlock(&mr_lock); + sx_xlock(&mr_lock); ret = mem_range_softc.mr_op->set(&mem_range_softc, mrd, arg); - rw_wunlock(&mr_lock); + sx_xunlock(&mr_lock); return (ret); } From nobody Sat Jul 5 08:36:43 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ3kz5QDgz61NPV; Sat, 05 Jul 2025 08:36: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ3kz3Hv9z3pYC; Sat, 05 Jul 2025 08:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751704603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/f5ui/XrQQHvBTOXhHoBlZOBGNkXVPD21B1xXm7zeZM=; b=qtGegE9p1NZUQIhTXqsLufOeZeTC0s9UT4KxS+OIA2hVzEnracEmcV9GogHrdJiujYUad2 4FiF1wvkpp0cVtrLV3glbd3YlwHe5tove9gGkcnA7XJeGqBLFC7nkSgq0eWISwy0aF5b3e fnf1VAQLa8KPFSqlNRXY1wsgi8/gu0bPmyao5ijHmlyGmnVs5WWiOJT43fUDFt4+IsvUCH AjEzTd7XkwPVH++VxAzev32pjuZcxDTceHYQcstG3nVgpfMk0pzFfL/wFrRUzZNRqG274K z4gU5j7exA99e3mtmKcMJrGCUrq+GCpm07t0vfbuf5RzLsZlNAYjXWJYbVlDcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751704603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/f5ui/XrQQHvBTOXhHoBlZOBGNkXVPD21B1xXm7zeZM=; b=BeRrxqIZrbTIBUKGwl9M3qMn14vbvL7Gkg8mQmrT0HuEz+kHg0yI5jQCrn0FtvJznX63ze 5GwXLdDiruQRKbZ++DY+1sQmq0U6OuPb2f9vOKQDDCjveLAg1/ER/RGHU1B1yZgzgpOGmq 6+sjE2MMEqgt8nwGV2omRg1CwdSPQLQDen9ke8n1oKxGMQVvvwcJCteHXPDucaAySw1PK/ hJ7lHXMNGzWyZJYMeXinb5yAhTOKi5Wkg8gXtq2tZNKLfndZu8KxgHLTNORFTl63v1V5P+ hJtUGbFsZ/8hGRlMkDZuxCRwYUO5xjDCv3hCgFk6WPzdphBwUItltz0uuslEFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751704603; a=rsa-sha256; cv=none; b=gUiTi67H6O1OkMGC++BC/0MsU2rHXujdXrMq841BBiRVY2YoV2PCllXwuwZt1rzlJ0T+iF ccc27Fun0u8LH8NsG10qwihgxUufcHVu2mSm4RNZvs/2P3S5UVUwTujCKApAR13X+14gSS K2jUHSyFmvJIfKgFA/6UwxdmLkgwtpybAWy5DpJfFc182I/iV1u+IiOE2xuAOHEQcCzZsn DK6i8eIWY97uAkpKthNsL5YppYVSVi/pmIslw/YBVU/hMNl88hF87X3/BfRUoeaY2P3S9P gYRQ5t0pRw68nA7RJj9S8ePrMwCzfVBDfzEjlmpeVorXALhpCj0MnYMbsnNuzA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ3kz2jRLzCkD; Sat, 05 Jul 2025 08:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5658ahdq068004; Sat, 5 Jul 2025 08:36:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5658ah39068001; Sat, 5 Jul 2025 08:36:43 GMT (envelope-from git) Date: Sat, 5 Jul 2025 08:36:43 GMT Message-Id: <202507050836.5658ah39068001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 6eb141a2c473 - main - amd64 pmap: preallocate pt page for pmap_demote_pdpe() in pmap_demote_DMAP() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6eb141a2c4731130bfac670708a8b90f7cdff742 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6eb141a2c4731130bfac670708a8b90f7cdff742 commit 6eb141a2c4731130bfac670708a8b90f7cdff742 Author: Konstantin Belousov AuthorDate: 2025-06-22 03:38:12 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-05 08:36:01 +0000 amd64 pmap: preallocate pt page for pmap_demote_pdpe() in pmap_demote_DMAP() Allocate the page outside the kernel_pmap locked region with waiting, and pass it to pmap_demote_pdpe() to use as pt page, instead of panicing if VM_ALLOC_INTERRUPT failing. Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50970 --- sys/amd64/amd64/pmap.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 2ab8c3b17e22..443273b42f4d 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1302,7 +1302,7 @@ static bool pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static bool pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); static bool pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, - vm_offset_t va); + vm_offset_t va, vm_page_t m); static int pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, struct rwlock **lockp); static int pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, @@ -9547,7 +9547,7 @@ pmap_unmapdev(void *p, vm_size_t size) * Tries to demote a 1GB page mapping. */ static bool -pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va) +pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va, vm_page_t m) { pdp_entry_t newpdpe, oldpdpe; pd_entry_t *firstpde, newpde, *pde; @@ -9564,12 +9564,19 @@ pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va) oldpdpe = *pdpe; KASSERT((oldpdpe & (PG_PS | PG_V)) == (PG_PS | PG_V), ("pmap_demote_pdpe: oldpdpe is missing PG_PS and/or PG_V")); - pdpg = pmap_alloc_pt_page(pmap, va >> PDPSHIFT, - VM_ALLOC_WIRED | VM_ALLOC_INTERRUPT); - if (pdpg == NULL) { - CTR2(KTR_PMAP, "pmap_demote_pdpe: failure for va %#lx" - " in pmap %p", va, pmap); - return (false); + if (m == NULL) { + pdpg = pmap_alloc_pt_page(pmap, va >> PDPSHIFT, + VM_ALLOC_WIRED); + if (pdpg == NULL) { + CTR2(KTR_PMAP, + "pmap_demote_pdpe: failure for va %#lx in pmap %p", + va, pmap); + return (false); + } + } else { + pdpg = m; + pdpg->pindex = va >> PDPSHIFT; + pmap_pt_page_count_adj(pmap, 1); } pdpgpa = VM_PAGE_TO_PHYS(pdpg); firstpde = (pd_entry_t *)PHYS_TO_DMAP(pdpgpa); @@ -9779,7 +9786,7 @@ pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, tmpva += NBPDP; continue; } - if (!pmap_demote_pdpe(kernel_pmap, pdpe, tmpva)) + if (!pmap_demote_pdpe(kernel_pmap, pdpe, tmpva, NULL)) return (ENOMEM); } pde = pmap_pdpe_to_pde(pdpe, tmpva); @@ -9948,6 +9955,7 @@ pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate) { pdp_entry_t *pdpe; pd_entry_t *pde; + vm_page_t m; vm_offset_t va; bool changed; @@ -9956,17 +9964,28 @@ pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate) KASSERT(powerof2(len), ("pmap_demote_DMAP: len is not a power of 2")); KASSERT((base & (len - 1)) == 0, ("pmap_demote_DMAP: base is not a multiple of len")); + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "pmap_demote_DMAP"); + if (len < NBPDP && base < dmaplimit) { va = PHYS_TO_DMAP(base); changed = false; + + /* + * Assume that it is fine to sleep there. + * The only existing caller of pmap_demote_DMAP() is the + * x86_mr_split_dmap() function. + */ + m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_WAITOK); + PMAP_LOCK(kernel_pmap); pdpe = pmap_pdpe(kernel_pmap, va); if ((*pdpe & X86_PG_V) == 0) panic("pmap_demote_DMAP: invalid PDPE"); if ((*pdpe & PG_PS) != 0) { - if (!pmap_demote_pdpe(kernel_pmap, pdpe, va)) + if (!pmap_demote_pdpe(kernel_pmap, pdpe, va, m)) panic("pmap_demote_DMAP: PDPE failed"); changed = true; + m = NULL; } if (len < NBPDR) { pde = pmap_pdpe_to_pde(pdpe, va); @@ -9981,6 +10000,10 @@ pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate) if (changed && invalidate) pmap_invalidate_page(kernel_pmap, va); PMAP_UNLOCK(kernel_pmap); + if (m != NULL) { + vm_page_unwire_noq(m); + vm_page_free(m); + } } } From nobody Sat Jul 5 08:36:44 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ3l10VXLz61NG0; Sat, 05 Jul 2025 08:36: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ3l04Y02z3phf; Sat, 05 Jul 2025 08:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751704604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OeODtc7pUj+KtQT9W0XiJt+qCsmhbdSXqrbRhKVquIk=; b=ouwyW12gf2J9y8/7tUyYEHg4M9YnaBSBx03/r18y/yWf+ehxiQP+fRYNp04dvJjBNJxILp jScVpHKtc3xJFhPHaT6yqEPGfJPWy/JdvLP3Lxj/Ms9Zq9AR66JFpLC+4ALdqpnv2IHbqg EYdxvH+cfvee067oqCuIwUfTnb8r6OV1myotaLJn2k+53FmkNdWp7hqL0msnGRgKw9pcNI Vh92WwsBi8lOwYdk/twlIr8KhWZcv1gWK+1NBWGSqrPoeZcp0JxKkNjbyuaI1qpQ+NIfcK 39aLK9jwby+c2FarNZeNgTyN/B3RGP6A+uXygnZwb8rBwwHKxJrJWHm0zgs22Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751704604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OeODtc7pUj+KtQT9W0XiJt+qCsmhbdSXqrbRhKVquIk=; b=c0gSvS32HYnsGFrqla50ai7JqBraH3OiOsz3BZfUdQ9fsgz2AUKYcFvVm6Uy7CrzwYlTvt V/vV/PLCElaKulBEs6JeA87UeCztUz6I8cGhekZHMRQKWNqwSw37TXULLNus4+MXEswvfn jY7M/5KgMGP3EfJWVhqJMREKkJksBHYErNG82DAunJn9OEOdQLjIC2xLi6tWOlptb023tn SoRQHRtJ3AWQUVv0yk0e0xg6BpdUrAJ6UYcOm+Jb7pr5EiZFksjIejZg8V4WV32j9+HJwy m8RZdfNEzJ71t01viY5dyKOOsxCT84wL+7sKbt1sFntKynQnTiScWSXvzDnIMA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751704604; a=rsa-sha256; cv=none; b=nb1Nr0umy+LQ6UlPpOGl4sS5mA1HMwxEj+ktT/efeFJqH6/RIkn/q7Q5CG/SdiRLmNtS97 Ci6QKSG5f2qu4EUFk0DBYTBZujyQGGTrhwfvZDjrSvRd2YMrqBjyQLMzmCvGeGgXDHjUvU NhfRP8J0Ps6bZxlufC8WCDGtenUp7+Y8tGVH1TUOpLKKHZHYgFxa0Gz9m5R9gQ0gMUAAr1 vzHUip2mJdyOlsgwLEwE6hEGB8TJpKIxXX37UOUBUWjFreW3xOGOuzF4jGMQ9H6aSG/p99 PDTm8rlDKXT8n6Q2M/Ax2GkMws58K3NE3dUQRV+Zm0rLhqAUF4O2M1dYSkLK8Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ3l03svQzCtW; Sat, 05 Jul 2025 08:36:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5658airT068037; Sat, 5 Jul 2025 08:36:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5658aiEa068034; Sat, 5 Jul 2025 08:36:44 GMT (envelope-from git) Date: Sat, 5 Jul 2025 08:36:44 GMT Message-Id: <202507050836.5658aiEa068034@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ee502c853183 - main - amd64 pmap: update comment in pmap_demote_DMAP() explaining the len List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee502c8531833d7a0d4bc4c72cc05227f4a3715a Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ee502c8531833d7a0d4bc4c72cc05227f4a3715a commit ee502c8531833d7a0d4bc4c72cc05227f4a3715a Author: Konstantin Belousov AuthorDate: 2025-06-22 16:49:45 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-05 08:36:08 +0000 amd64 pmap: update comment in pmap_demote_DMAP() explaining the len NBPDP. Since the demotion does not + * change any attributes of the mapping, a TLB invalidation is not + * mandatory. The caller may, however, request a TLB invalidation. */ void pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate) From nobody Sat Jul 5 08:36:45 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZ3l22pnqz61NPW; Sat, 05 Jul 2025 08:36: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZ3l15FCSz3pbj; Sat, 05 Jul 2025 08:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751704605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZB4oQ3FjIcIHyuAU9GzVl81Erv8jcnI7zDbN9ZUARsg=; b=Y1InRCcdQmupZMG8XFop7sW/GrlWGljIeB3L7uxLN9UEWzXN+qi+l7KnBhShLeKsCiid+k VOzW3Pu9eTgrHeFFoYNB9CqtLgO/N2ID8Juak26TMG+NwK9h3B+Hcc5PqTd65e6L7zCcPa oH2LtrkCEJC+xDiI4kNSjc9KsvWsLSW33sQ9nMzK1kDN/hV97HzwiqeGS5szGKxhLyBvIG eD6JPlJCFuF8sewFqkIwQs0X36ZFuBaQLsY1qnFNImtKwk39A+Nd688deIRwZ0qvSFgA8y 5cfDlN2kw+0taYRe/VYsT+E5rI7nFA8//MXYa8p1J6CGNm7qWmdn4AZ77evwag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751704605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZB4oQ3FjIcIHyuAU9GzVl81Erv8jcnI7zDbN9ZUARsg=; b=lWXriVSE96NhGoveKrCBZRbWB+S80dGF7YPNYQaKIsm11oINNB0akoVAoIVB1iyCGx5lmM qCdsiY4QHUCjRKABHfhJm8vG9GV+FdZ2oKCKssjnB7iRbrJxvrhKwHd3R+Kp1AmFsmQqL7 yoZvIhoHbw3vXSPGDDztBFs/cec0+WprM9IIZ6yozb2kw1+2cpzizvksjgfClZf1FZCpWC nHrkFSkrVqKObEwSRQfIC+S8I/5DFyz+ibNntLlC0zHmI9e1NcQjYBng26OvENxfWMLHkn f7rq9P3SS+L3qUsXqb8OKTxgVdA/ShF+a59yWjfOvT7VS1i3lxZYmkGfa/Br6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751704605; a=rsa-sha256; cv=none; b=qlCyEt47eDVR2bqJh5aOI4N6ND3OnIrCtXx/S4vWTGEfVI+aXegZAqEsv+pjb/jVFGzKiF S20ZcyIA5a0FtP7lXJ7V2uLPh65GQsuRh1JRunzeqJGhBOhgA+KeN6yt3DIR8UXz+c6IfR 4oJn9dVizRLGwhrnDt5NXuE0OLwUV3zS38IbYLYm7rKfcTE6sdx1wKdyP5AABCMibra5/q 3zPQosYWhGL+g1CxNZPQyw3wMWFyJD8gfhtnDtpemjJGM3TD0Ysx+W7pSzgWTsN1i28ii3 0yi0xF8QvVFPvNqumxERPZQKRdkdgavDBiZgzkAzjUsdq4s1Brmeb1a28yXzRA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZ3l14dPfzCwy; Sat, 05 Jul 2025 08:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5658ajLd068073; Sat, 5 Jul 2025 08:36:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5658ajQ7068070; Sat, 5 Jul 2025 08:36:45 GMT (envelope-from git) Date: Sat, 5 Jul 2025 08:36:45 GMT Message-Id: <202507050836.5658ajQ7068070@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 476d2d8f290f - main - amd64 pmap: do not panic on inability to insert ptp into trie List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 476d2d8f290f60cbbe6b546272a3485ef0316356 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=476d2d8f290f60cbbe6b546272a3485ef0316356 commit 476d2d8f290f60cbbe6b546272a3485ef0316356 Author: Konstantin Belousov AuthorDate: 2025-06-24 22:58:32 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-05 08:36:17 +0000 amd64 pmap: do not panic on inability to insert ptp into trie When pmap_enter_pde() needs to destroy existing kernel superpage mapping, do not remove saved pt page from the pm_root trie. Then the pt page does not need to be re-inserted into the trie. If the kernel region is not mapped with the superpage, try to insert the pt page into pm_root trie before clearing ptes. If failed, we can return failure without a need to rewind. Suggested by: alc Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50970 --- sys/amd64/amd64/pmap.c | 54 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 6b883ae33b68..0044f27729f6 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1334,7 +1334,7 @@ static pdp_entry_t *pmap_pti_pdpe(vm_offset_t va); static pd_entry_t *pmap_pti_pde(vm_offset_t va); static void pmap_pti_wire_pte(void *pte); static int pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, - struct spglist *free, struct rwlock **lockp); + bool remove_pt, struct spglist *free, struct rwlock **lockp); static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva, pd_entry_t ptepde, struct spglist *free, struct rwlock **lockp); static vm_page_t pmap_remove_pt_page(pmap_t pmap, vm_offset_t va); @@ -5999,7 +5999,7 @@ pmap_demote_pde_abort(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, SLIST_INIT(&free); sva = trunc_2mpage(va); - pmap_remove_pde(pmap, pde, sva, &free, lockp); + pmap_remove_pde(pmap, pde, sva, true, &free, lockp); if ((oldpde & pmap_global_bit(pmap)) == 0) pmap_invalidate_pde_page(pmap, sva, oldpde); vm_page_free_pages_toq(&free, true); @@ -6153,7 +6153,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, * pmap_remove_kernel_pde: Remove a kernel superpage mapping. */ static void -pmap_remove_kernel_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) +pmap_remove_kernel_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, + bool remove_pt) { pd_entry_t newpde; vm_paddr_t mptepa; @@ -6161,7 +6162,10 @@ pmap_remove_kernel_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) KASSERT(pmap == kernel_pmap, ("pmap %p is not kernel_pmap", pmap)); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - mpte = pmap_remove_pt_page(pmap, va); + if (remove_pt) + mpte = pmap_remove_pt_page(pmap, va); + else + mpte = vm_radix_lookup(&pmap->pm_root, pmap_pde_pindex(va)); if (mpte == NULL) panic("pmap_remove_kernel_pde: Missing pt page."); @@ -6193,7 +6197,7 @@ pmap_remove_kernel_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) * pmap_remove_pde: do the things to unmap a superpage in a process */ static int -pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, +pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, bool remove_pt, struct spglist *free, struct rwlock **lockp) { struct md_page *pvh; @@ -6234,7 +6238,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, } } if (pmap == kernel_pmap) { - pmap_remove_kernel_pde(pmap, pdq, sva); + pmap_remove_kernel_pde(pmap, pdq, sva, remove_pt); } else { mpte = pmap_remove_pt_page(pmap, sva); if (mpte != NULL) { @@ -6476,7 +6480,8 @@ pmap_remove1(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, bool map_delete) */ if ((ptpaddr & PG_G) == 0) anyvalid = 1; - pmap_remove_pde(pmap, pde, sva, &free, &lock); + pmap_remove_pde(pmap, pde, sva, true, &free, + &lock); continue; } else if (!pmap_demote_pde_locked(pmap, pde, sva, &lock)) { @@ -7552,13 +7557,36 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, /* * The reference to the PD page that was acquired by * pmap_alloc_pde() ensures that it won't be freed. - * However, if the PDE resulted from a promotion, then + * However, if the PDE resulted from a promotion, and + * the mapping is not from kernel_pmap, then * a reserved PT page could be freed. */ - (void)pmap_remove_pde(pmap, pde, va, &free, lockp); + (void)pmap_remove_pde(pmap, pde, va, + pmap != kernel_pmap, &free, lockp); if ((oldpde & PG_G) == 0) pmap_invalidate_pde_page(pmap, va, oldpde); } else { + if (va >= VM_MAXUSER_ADDRESS) { + /* + * Try to save the ptp in the trie + * before any changes to mappings are + * made. Abort on failure. + */ + mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME); + if (pmap_insert_pt_page(pmap, mt, false, false)) { + if (pdpg != NULL) + pdpg->ref_count--; + CTR1(KTR_PMAP, + "pmap_enter_pde: cannot ins kern ptp va %#lx", + va); + return (KERN_RESOURCE_SHORTAGE); + } + /* + * Both pmap_remove_pde() and + * pmap_remove_ptes() will zero-fill + * the kernel page table page. + */ + } pmap_delayed_invl_start(); if (pmap_remove_ptes(pmap, va, va + NBPDR, pde, &free, lockp)) @@ -7572,14 +7600,6 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, } else { KASSERT(SLIST_EMPTY(&free), ("pmap_enter_pde: freed kernel page table page")); - - /* - * Both pmap_remove_pde() and pmap_remove_ptes() will - * leave the kernel page table page zero filled. - */ - mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME); - if (pmap_insert_pt_page(pmap, mt, false, false)) - panic("pmap_enter_pde: trie insert failed"); } } From nobody Sat Jul 5 14:55:26 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZD7y6j7hz610cZ; Sat, 05 Jul 2025 14:55: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZD7y50Gkz3xBT; Sat, 05 Jul 2025 14:55:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751727326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FdVU6VkGkKPVtp4XNt7f+aWzSa+GfMjxmxecU8thRj0=; b=CYI4AnWCrgXSAgxHbvpV0tGKuCaclJVr+l1NyAr8L+oV5FPTY3vL9dzNez3tqzhBQTf+QP qVVAXr4re5bdIJk6crrYwdhdw/v7ffpBZ7zYMb3A8G1eeJBrTRx4MLeI9Z7BAReyABLzJZ oepEnJZHAslIqsUTlMfHvuuRdrH7VoWQ42SCHO6PhRPL6pkis/CL/2JRSoYaRuPaYaEnrJ /h0FbvcqnyhsPIxrJz0jN14e68SobR1SeiZfFgdPEM5MNPyA35D8BhUucv93A7kIqKsTJ1 PnPaWBtqDDnsy8z9WI5FOXROUeg7725mFX+bXh4GJgZIxN2G7pYMBntYKOw1NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751727326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FdVU6VkGkKPVtp4XNt7f+aWzSa+GfMjxmxecU8thRj0=; b=LhwHwYbPctYaPJVzjI3cKqZ1Wqx8021/nMGdfL+wWVvl3d56auhWaCwr1PCQos4GTTpf4g Ca0/6QgBJZ6bOJdtBzNkdk2Jem3Ejjl/5d2+IKvPFED5T8I3yWnf/L7d/jv1yBW4v8zGEs 17NeEPblbExwt34VZ8wQUrygLu+OKpirLXFeJiPycEBrIMWM4fXffNzuukWdtdFW6fLYFt vX+Bx5F0rNgm//jxZAOl/nqLGxzrhZKwdZCVydtEElkj39pMSbEWZTqy0v46+NQrWeersJ EGnouBMxqTf6gRmuBIEB7ctO1b0COENKLlWFUp53aYVcGenTdEIBBKMqtfkTVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751727326; a=rsa-sha256; cv=none; b=pZM3HGtRWdC7fM6r/q3WBZiyY2VN/sJmL62fwMYqxTfe2tvTQCIcu6DIwy/g7dMZitMq7L YgkVyoWBPYPZZ+aCGcznadDrH8gbang90NqEAYxWwUbDBHEwZ3ZCQg384lWU3zAdngdYML x4HLcH+dGIuNYNBXeR2bo7239tMaRTxh+Vx1wEilO4e29t5aI+1IS9GOmcvq/ZABM4I8S2 tyIcme4CNFVCHRcYDfnTCpnypKSo9PttTYWiG71AxAVZUjEGtUmVJ1kAocRMcrmkfSVE1m ZmcRorjCETTThxVoygf/WbdiIGG2mpMtwkZln5R5y9VB5zFmS3meYk7OjfHs8w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZD7y3WGSzgtP; Sat, 05 Jul 2025 14:55:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 565EtQ9H083030; Sat, 5 Jul 2025 14:55:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 565EtQf9083027; Sat, 5 Jul 2025 14:55:26 GMT (envelope-from git) Date: Sat, 5 Jul 2025 14:55:26 GMT Message-Id: <202507051455.565EtQf9083027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 667ef8875bad - main - nuageinit: Add wrappers for chmod and chown List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 667ef8875bad115d334a85c1023db0cf4d8379ba Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=667ef8875bad115d334a85c1023db0cf4d8379ba commit 667ef8875bad115d334a85c1023db0cf4d8379ba Author: Mark Johnston AuthorDate: 2025-07-05 14:54:07 +0000 Commit: Mark Johnston CommitDate: 2025-07-05 14:54:07 +0000 nuageinit: Add wrappers for chmod and chown In the wrappers, check for errors and abort if one is raised. At some point it may be useful to have a mechanism to ignore errors, but I'm not sure yet how that should look. For chmod, let the mode be specified as an octal number, otherwise it's hard to understand what's happening. Note that this must be specified as a string, otherwise tonumber() will raise an error. Reviewed by: bapt MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51159 --- libexec/nuageinit/nuage.lua | 35 +++++++++++++++++++++++++---------- libexec/nuageinit/nuageinit | 7 +++---- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua index 11958e8b5cc2..493ae11d6ca7 100644 --- a/libexec/nuageinit/nuage.lua +++ b/libexec/nuageinit/nuage.lua @@ -56,6 +56,21 @@ local function errmsg(str, prepend) os.exit(1) end +local function chmod(path, mode) + local mode = tonumber(mode, 8) + local _, err, msg = sys_stat.chmod(path, mode) + if err then + errmsg("chmod(" .. path .. ", " .. mode .. ") failed: " .. msg) + end +end + +local function chown(path, owner, group) + local _, err, msg = unistd.chown(path, owner, group) + if err then + errmsg("chown(" .. path .. ", " .. owner .. ", " .. group .. ") failed: " .. msg) + end +end + local function dirname(oldpath) if not oldpath then return nil @@ -252,12 +267,12 @@ local function addsshkey(homedir, key) f:write(key .. "\n") f:close() if chownak then - sys_stat.chmod(ak_path, 384) - unistd.chown(ak_path, dirattrs.uid, dirattrs.gid) + chmod(ak_path, "0600") + chown(ak_path, dirattrs.uid, dirattrs.gid) end if chowndotssh then - sys_stat.chmod(dotssh_path, 448) - unistd.chown(dotssh_path, dirattrs.uid, dirattrs.gid) + chmod(dotssh_path, "0700") + chown(dotssh_path, dirattrs.uid, dirattrs.gid) end end @@ -296,10 +311,10 @@ local function addsudo(pwd) end f:close() if chmodsudoers then - sys_stat.chmod(sudoers, 416) + chmod(sudoers, "0640") end if chmodsudoersd then - sys_stat.chmod(sudoers, 480) + chmod(sudoers, "0740") end end @@ -521,16 +536,14 @@ local function addfile(file, defer) end f:close() if file.permissions then - -- convert from octal to decimal - local perm = tonumber(file.permissions, 8) - sys_stat.chmod(filepath, perm) + chmod(filepath, file.permissions) end if file.owner then local owner, group = string.match(file.owner, "([^:]+):([^:]+)") if not owner then owner = file.owner end - unistd.chown(filepath, owner, group) + chown(filepath, owner, group) end return true end @@ -538,6 +551,8 @@ end local n = { warn = warnmsg, err = errmsg, + chmod = chmod, + chown = chown, dirname = dirname, mkdir_p = mkdir_p, sethostname = sethostname, diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index 84133d4373c5..0fcdc7274db3 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -7,7 +7,6 @@ local nuage = require("nuage") local ucl = require("ucl") local yaml = require("lyaml") -local sys_stat = require("posix.sys.stat") if #arg ~= 2 then nuage.err("Usage: " .. arg[0] .. " ( | )", false) @@ -157,7 +156,7 @@ local function ssh_keys(obj) sshkey:close() end if keytype == "private" then - sys_stat.chmod(path, 384) + nuage.chmod(path, "0600") end end end @@ -281,7 +280,7 @@ local function runcmd(obj) end if f ~= nil then f:close() - sys_stat.chmod(root .. "/var/cache/nuageinit/runcmds", 493) + nuage.chmod(root .. "/var/cache/nuageinit/runcmds", "0755") end end @@ -503,5 +502,5 @@ if line == "#cloud-config" then end elseif line:sub(1, 2) == "#!" then -- delay for execution at rc.local time -- - sys_stat.chmod(root .. "/var/cache/nuageinit/user_data", 493) + nuage.chmod(root .. "/var/cache/nuageinit/user_data", "0755") end From nobody Sat Jul 5 17:07:24 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZH4D2mXHz61J11; Sat, 05 Jul 2025 17:07: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZH4D1mgyz3Vcy; Sat, 05 Jul 2025 17:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751735244; h=from:from:reply-to:subject:subject: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/XTmNn2J8CHSQ9IdlpJAyTNqDcN9qZIEWQhkesO27g=; b=OnmOeGv0xJhEzwu5GDBsyUYY4lzzRxe3Lrd0Ws8XLc77Z4blmlBqkp86lOZDqJFOWENX/K my/BZhFfRLQdk+ypqXIqt5ErExYVe6WndJoOef4tZTDZsFWxoPm7GCone+VrXIf1QDBjT3 LFUSDVxCyJ0jYfz92OV9fFgD9fIyA4E88mnhxhR2n5ht1pqNfhvhxDV7o4MufufiPHyLpa GUHwHpTdIAIADn0VX/K03+6RFhT6obDJbjsQv5pU0FtBF/mohiOpmHpK78lOhXe+JNM6DO MOtiU4EqsHyjx7nQ54YNa9HvVcBgkM6TcXHgzX8/bQBQL8SZekJXx7XupGx0/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751735244; h=from:from:reply-to:subject:subject: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/XTmNn2J8CHSQ9IdlpJAyTNqDcN9qZIEWQhkesO27g=; b=XEpnMvsHxsTxYCKaWWoF95e65dEdG5atwy3brKYXURfVuq2cx1pzLuUinuppcgifCUvb1O p9h4v2XSH5sMOUtKQpcPncDQM/mIdRY5lO9xhiKh7ZaebW+62w4BwOcHMvh/g+i1TnTNqa 4iakBihJQ5vc4Aja55ZZupk/vDfWXuTBZ4DmqiRwnVnWMHR30xqregE0H8e0NYUM0ghN+u ev37vvvEpYWDgDI6TF37FsSxG5TUtRG4m3BYAnUhQNihd6v0G+jAuSw7M3d+5d3GjFuLAV BljnG4DJF6ZM+YssQOCNq1jEdLA7R3sBjiv4ib6GtW1IMc4v16XEMtcQXR2u0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751735244; a=rsa-sha256; cv=none; b=ZVtBm181Iisk24UEn5KJ7Bq7/4ujYvSFoA0by2kijPUGO88D/AERWoatSWSi+TaRB3SDhK WbUqw3aB6TmS1eVUxukp/ysDlpb1neAEtnGFsU0wT/6GCv97UThU6Jv5KdsJAceZ9WVoy5 Ox04z0kUojtZOtjjyV5qbAcCZb97NertQogUaRb3+CJznY+1s/zOB1ODaC4Qia7XKJ6mUU oD4JxXH6HmTOayVbzLqY15NwwU7j2juvJScL9F4nTQENc+JyGIeeAH/T/bds5acvYCFbZC KQS5cq++slkhhGR+pVjnMOiEAZacSApA3nhDLH0GtZ5zhMGvSThQI4KpMnP5cw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZH4D12mqzkXy; Sat, 05 Jul 2025 17:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 565H7OaN029005; Sat, 5 Jul 2025 17:07:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 565H7O6d029002; Sat, 5 Jul 2025 17:07:24 GMT (envelope-from git) Date: Sat, 5 Jul 2025 17:07:24 GMT Message-Id: <202507051707.565H7O6d029002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 7134ad650bc4 - main - kern: add some extra metadata to the coredump devctl notification List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7134ad650bc47d8f7719c059e2f14f647af803d7 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=7134ad650bc47d8f7719c059e2f14f647af803d7 commit 7134ad650bc47d8f7719c059e2f14f647af803d7 Author: Kyle Evans AuthorDate: 2025-07-05 03:25:14 +0000 Commit: Kyle Evans CommitDate: 2025-07-05 17:07:17 +0000 kern: add some extra metadata to the coredump devctl notification We already have a chance of cutting it close to the devctl limit depending on the path, but this should be less than 50 bytes extra on average. The jid gives us enough for userland to be able to actually locate the corefile on disk in case it was produced in a jailed process, the rest is just icing on the cake. We could extract pid/signo from the core itself, but it's nice to be able to do some pre-filtering before we even touch the core. I'd like to use this in a (near-future) ucored port that will hoover up corefiles from all over the system depending on some criteria. Reviewed by: imp (earlier version), kib Differential Revision: https://reviews.freebsd.org/D51164 --- sys/kern/kern_sig.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 4565abc4b540..a61ebfc5c7c8 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -4139,7 +4139,7 @@ coredump(struct thread *td) struct flock lf; struct vattr vattr; size_t fullpathsize; - int error, error1, locked; + int error, error1, jid, locked, ppid, sig; char *name; /* name of corefile */ void *rl_cookie; off_t limit; @@ -4168,6 +4168,10 @@ coredump(struct thread *td) PROC_UNLOCK(p); return (EFBIG); } + + ppid = p->p_oppid; + sig = p->p_sig; + jid = p->p_ucred->cr_prison->pr_id; PROC_UNLOCK(p); error = corefile_open(p->p_comm, cred->cr_uid, p->p_pid, td, @@ -4253,6 +4257,9 @@ coredump(struct thread *td) } devctl_safe_quote_sb(sb, name); sbuf_putc(sb, '"'); + + sbuf_printf(sb, " jid=%d pid=%d ppid=%d signo=%d", + jid, p->p_pid, ppid, sig); if (sbuf_finish(sb) == 0) devctl_notify("kernel", "signal", "coredump", sbuf_data(sb)); out2: From nobody Sat Jul 5 21:19:18 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZNfv3rKpz60sSn; Sat, 05 Jul 2025 21:19: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZNfv0pFrz44Gn; Sat, 05 Jul 2025 21:19:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751750359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=66utnKF/sziLUhVvO0smbjLoNfDiiuDo8xU432HpePw=; b=mQ+c9UTg/5IFkIFlaCTfjTPgeaS+mZmq4Rsg+0+/STbM1f6JESWKSM5UuQyjluZ91NZ6he iFrkyvQcmo8zvEDRJpZPLqDumEb8OGyn+JZ8kRYH5RCk1Znk0XOIV1FiUTN3Va/BFHvPv0 7ulpMQulyvDGXqjX/MS0Flu7MLDDaZjLGYQ1Qqx+r6noO6vISdXMbtX/dNvFHSzIOutGAh 1kf3Js5vnarDj9m/AT3PlqFYctx9bgrvLvmLWqhLWy0YDyr/MGGQK4yy0Qpf7tW07Q597Z u/W2kft8y/AT5YGU1vOMtNWiza/18FauNc3o9JM+6jgKjWZBsBkV2hmqT50nmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751750359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=66utnKF/sziLUhVvO0smbjLoNfDiiuDo8xU432HpePw=; b=vubc8gJYJ92YLxFO6cv2PFZCshtFNhlHVQA63cLZ+XNlZPGfkmJ3vV/oaaf8L0q000vuCp Ah8gXgSDLbJ/rlHoVQ0D4cHunz0/xRbhAP3VYJpPLKcxieXSQb+LLKAUYLdhajUfLN6jez l2CIs7CfYYN0MkH1OItXQ/RgOa4qJ0saLILcaL4vZFvzMKEQ4PDFUeqKEsFwNJ367rIiuR 1F949ErGlRxuxjbXEnpBh4209YNuzUBzpjsKK4BFdb1Ng1BiMXKRlDDAUQWTE1OX9WEVJA CXWLzC3kig4/t6ZGaywbvawwVnMHuZuhyn/YVpbBlSYWdSSwuDDqJV9S19GXpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751750359; a=rsa-sha256; cv=none; b=xe0TWk1mx5jIr+tU9fkjZyrrLXKmclLg15B4rM8gPW09aQNQibdyvxK6h6Zdy4Xr+X/INV /r8ZGU5IkUt4xVUbFgwkQmbQ6xX8/yErp9ESIdA1EXpcayCTx+W9B6T/PegBtPLj3jy/Ma 43mZC3b/qbWqFsaONl+Bk3+ywEtB6/hEUoM/z5ZyCPMDOxQp+y9qqnahKHj3E49AWZcFrh uvA5BMgcboi8EQK27YFPzXDgRnZ0nH6OkUnLhGL9F/q1o+54PZ0go0+Vfpcp4tsejLXgvp Ci5ofzZarA6myZK9fp2aJ0rtk8FzECPID+hpBF6XeCvL2m7mbefxbL3DDfymHQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZNft6zTqzsZd; Sat, 05 Jul 2025 21:19:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 565LJIDe099928; Sat, 5 Jul 2025 21:19:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 565LJIrH099925; Sat, 5 Jul 2025 21:19:18 GMT (envelope-from git) Date: Sat, 5 Jul 2025 21:19:18 GMT Message-Id: <202507052119.565LJIrH099925@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4685fa8e4bef - main - aio: handle errors from fork List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4685fa8e4bef169e6a1ceaf07f149232326de805 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4685fa8e4bef169e6a1ceaf07f149232326de805 commit 4685fa8e4bef169e6a1ceaf07f149232326de805 Author: Konstantin Belousov AuthorDate: 2025-07-04 18:30:31 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-05 21:18:43 +0000 aio: handle errors from fork Do not try to fork forever if fork() failed. Propagate the error up. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/vfs_aio.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index d7c23122b4d8..66ea50eee77b 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -301,7 +301,7 @@ static TAILQ_HEAD(,kaiocb) aio_jobs; /* (c) Async job list */ static struct unrhdr *aiod_unr; static void aio_biocleanup(struct bio *bp); -static void aio_init_aioinfo(struct proc *p); +static int aio_init_aioinfo(struct proc *p); static int aio_onceonly(void); static int aio_free_entry(struct kaiocb *job); static void aio_process_rw(struct kaiocb *job); @@ -422,10 +422,11 @@ aio_onceonly(void) * Init the per-process aioinfo structure. The aioinfo limits are set * per-process for user limit (resource) management. */ -static void +static int aio_init_aioinfo(struct proc *p) { struct kaioinfo *ki; + int error; ki = uma_zalloc(kaio_zone, M_WAITOK); mtx_init(&ki->kaio_mtx, "aiomtx", NULL, MTX_DEF | MTX_NEW); @@ -451,8 +452,13 @@ aio_init_aioinfo(struct proc *p) uma_zfree(kaio_zone, ki); } - while (num_aio_procs < MIN(target_aio_procs, max_aio_procs)) - aio_newproc(NULL); + error = 0; + while (num_aio_procs < MIN(target_aio_procs, max_aio_procs)) { + error = aio_newproc(NULL); + if (error != 0) + break; + } + return (error); } static int @@ -1490,8 +1496,11 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, int fd, kqfd; u_short evflags; - if (p->p_aioinfo == NULL) - aio_init_aioinfo(p); + if (p->p_aioinfo == NULL) { + error = aio_init_aioinfo(p); + if (error != 0) + goto err1; + } ki = p->p_aioinfo; @@ -2213,8 +2222,11 @@ kern_lio_listio(struct thread *td, int mode, struct aiocb * const *uacb_list, if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); - if (p->p_aioinfo == NULL) - aio_init_aioinfo(p); + if (p->p_aioinfo == NULL) { + error = aio_init_aioinfo(p); + if (error != 0) + return (error); + } ki = p->p_aioinfo; @@ -2503,8 +2515,11 @@ kern_aio_waitcomplete(struct thread *td, struct aiocb **ujobp, timo = tvtohz(&atv); } - if (p->p_aioinfo == NULL) - aio_init_aioinfo(p); + if (p->p_aioinfo == NULL) { + error = aio_init_aioinfo(p); + if (error != 0) + return (error); + } ki = p->p_aioinfo; error = 0; From nobody Sat Jul 5 21:19:17 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZNft0xphz60sQm; Sat, 05 Jul 2025 21:19: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZNfs6sdBz440B; Sat, 05 Jul 2025 21:19:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751750358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+cb1zrs37BLcUWK+T56g+SRf7k3Fn1YOWQF+/QIqMqc=; b=SzzcMmjAgITvJ4JAE4Arzfi/3QJEcN7idz7qO3vYXJv1rWEk0mvcEpRQEgpAVUOD0B1He4 t0YGBmdZMsY4CNRawXcW5Osf+gK2vm0i76QHr7hI3xUXjHx5vBo57enaWQYXP7IAYXjVqH eXXQFWHdhqRP8K3emITQVxCxhTh0AM4j214KUPQvAFfoYsCZmxvIkGIgW9kQjTbMlvcALd 5WHifEKAy5Y1C2U5Ouif/OHBP7XTSXnumoHpcSCXi3mb+AhGGWaJLc5lqCLpDze/VsocNO jy6jcJg5dACVDs6k83D59q5pp6JFioED7Gcyk/f9MMrt9wLcxyAVlunCAapJQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751750358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+cb1zrs37BLcUWK+T56g+SRf7k3Fn1YOWQF+/QIqMqc=; b=SQdLEvyFtku9aeVMub36k9CnJiRAsEhJvKm6THe51Zo9Wc3AtOc6yLSnWXJdWsifMY8ykm 5D6fle39xB9K5FvFz2q7Xp/9hiN93/myPHbUXVQFAcnCSPRV9Zk41X8/O+lVNLzMcXKrKy UxSSfCyo9fOZtnwXzFLHT+9moV+aKO8aHurY6pcsOcTy1s8ODLVWmt4XAtSNHNobtsELsG Gs6JVcFijpscwH8dpegGGDufDeP73ew5V6I0VkCc6ktMlNc1drTqRtM7gYpFpc0DMmscIa Fl3PfEHmWKKuirWNGPV0IzE2GXSShUCFXt/ickUbrSGCNggT0ps/9FfQVup4ng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751750358; a=rsa-sha256; cv=none; b=K/K8e1ewHkz7lTkbopfHs6sjNA423MAg1WBFE7C2t8Ma1Z9H537dQJr1AX7h4ojRpXUvXH r5y8K59LsMOkXBh6Bc4+Yy+5CpNlM2tjOe4nU6j67GIbre2gih5EaZFS0nupe+aA+c27G0 k0BLTvdBHOZheyNVH398iz+iWF4jao5pVkpelhwZS7WYo7Y5T4Up/Gedns5qGaS/Z5F3Wg kJoCu6TDVNPley5aAl2CjMn/M3M4u+DMYBnNuKLYqnt0I5onP1uU8Wyck3H4UthXcTWVdo xcghtevvkedXoIz1/XFU/CokVMu3vgMq/XrdSzSiGCg/UrSRlj4JPc2jW2yDQg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZNfs6S1nzsgw; Sat, 05 Jul 2025 21:19:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 565LJH04099889; Sat, 5 Jul 2025 21:19:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 565LJHwe099886; Sat, 5 Jul 2025 21:19:17 GMT (envelope-from git) Date: Sat, 5 Jul 2025 21:19:17 GMT Message-Id: <202507052119.565LJHwe099886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c44439942cdb - main - aio: make aio_init_aioinfo() and aio_aqueue() static List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c44439942cdb56cad8c7630444ff84447ca3866a Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c44439942cdb56cad8c7630444ff84447ca3866a commit c44439942cdb56cad8c7630444ff84447ca3866a Author: Konstantin Belousov AuthorDate: 2025-07-04 18:32:01 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-05 21:18:36 +0000 aio: make aio_init_aioinfo() and aio_aqueue() static Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/vfs_aio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 97dc854c9386..d7c23122b4d8 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -301,7 +301,7 @@ static TAILQ_HEAD(,kaiocb) aio_jobs; /* (c) Async job list */ static struct unrhdr *aiod_unr; static void aio_biocleanup(struct bio *bp); -void aio_init_aioinfo(struct proc *p); +static void aio_init_aioinfo(struct proc *p); static int aio_onceonly(void); static int aio_free_entry(struct kaiocb *job); static void aio_process_rw(struct kaiocb *job); @@ -309,7 +309,7 @@ static void aio_process_sync(struct kaiocb *job); static void aio_process_mlock(struct kaiocb *job); static void aio_schedule_fsync(void *context, int pending); static int aio_newproc(int *); -int aio_aqueue(struct thread *td, struct aiocb *ujob, +static int aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lio, int type, struct aiocb_ops *ops); static int aio_queue_file(struct file *fp, struct kaiocb *job); static void aio_biowakeup(struct bio *bp); @@ -422,7 +422,7 @@ aio_onceonly(void) * Init the per-process aioinfo structure. The aioinfo limits are set * per-process for user limit (resource) management. */ -void +static void aio_init_aioinfo(struct proc *p) { struct kaioinfo *ki; @@ -1476,7 +1476,7 @@ static struct aiocb_ops aiocb_ops_osigevent = { * Queue a new AIO request. Choosing either the threaded or direct bio VCHR * technique is done in this code. */ -int +static int aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, int type, struct aiocb_ops *ops) { From nobody Sat Jul 5 23:36:20 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZRj06w2Jz61B1t; Sat, 05 Jul 2025 23:36: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZRj05yzzz41bs; Sat, 05 Jul 2025 23:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751758580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YNxRHV0V/vFU4OlC3vgZACaRGbgQnRNzs8y/z88MSfs=; b=i3EEV0+kWD3BC21h0rCX2jPw5lyd8EZmDmCwN47ew8xayIbhXKVW62En2whwdbC2JG/gam DFoPJCh3oRhLWEDvcJy6YjKvwUd7b5wgGbsw0pNo6Zn4/4sjFjP1YPQEYx8eF7sCWjKIoJ mLyDi3b6QpbSeZK2dMGcJ3pYcG5SwMlMumipGHI032n4ESPkBCVXr9CkQwG3X+P+UT8GeJ FkmJcaiWwAKMrCH7cIxujF0QRDDkC+IjuMOWVEzMa8AQsW7FdVhVnB8R5YeHHQxm9pHhON 9vVB+75NaHpLRh9L0mOANEyHd6bjcU7jkq6o2zt3zAQMDyq5DUZEhK09lWQV8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751758580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YNxRHV0V/vFU4OlC3vgZACaRGbgQnRNzs8y/z88MSfs=; b=EcVgecEmdzBZS1BNhg5GaKTOIXQS1h+Dwrw7lR7woEiAMQ1Bmz7NNus0Ghjvif+csdfkWR 0ZEWIw3VJaMTziVBSJ93sY7YYWmCIt9OjpAXqUDkHC68vMmCITh67gzVi9ATwYQmKYch+7 sSHaUgjqI2Dr/LEsn68bnvstJAS0dZ0VRE7NGYoLP3rfm8BwUfMltvWg4yGG/2TCow2cq5 UqXLpxFYS4LlR3F6JFQEyeJ3rk4JkWt9yvoEJ57GAkCZ869GsuZ5347D2c5eNNNToA+cci uS4oo66v8d1fmQOrqyrpkyVzFIickYDKM8cDPGL6y1XNnVc2nERDil+JmrmMzw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751758580; a=rsa-sha256; cv=none; b=Ogl1uKuZTxVmr96HJz0Nk89R7UE3CQV45qTE42Q0SokZO3n0oy1jpMhXU539aaywRxEdYO bXvsNYhjiVNBXXTZwCfzSoQmiFTPm5EP+84ylXU5xoPBjWVy80X69IVHQaBrc8A06ZppEp 2EIjOQJghC765WYeecapn8owgmBoICY1YYatC7d276k9JGDv+1J4bHB57mxQnzCaf4ZhAd F2dPv9ZJoBYBsw6T/fxt2YPMaAqFN1nfSIoGmEOp/numZ141qYmJUu5WZsfUKxJQaRegro TyVRTudKs7n6VC+hwvpjV80NtN+hbxQo7lhuHxZKnW2pfBzZkP3YxdFGw9u4Jw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZRj05HlrzwyG; Sat, 05 Jul 2025 23:36:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 565NaKtm061579; Sat, 5 Jul 2025 23:36:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 565NaKKS061576; Sat, 5 Jul 2025 23:36:20 GMT (envelope-from git) Date: Sat, 5 Jul 2025 23:36:20 GMT Message-Id: <202507052336.565NaKKS061576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: afd5bc630930 - main - pathconf: Add a new variable for hidden/system List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: afd5bc6309306da48b87d5557ab526b1d4a61bb6 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=afd5bc6309306da48b87d5557ab526b1d4a61bb6 commit afd5bc6309306da48b87d5557ab526b1d4a61bb6 Author: Rick Macklem AuthorDate: 2025-07-05 23:33:16 +0000 Commit: Rick Macklem CommitDate: 2025-07-05 23:33:16 +0000 pathconf: Add a new variable for hidden/system For the NFSv4 server to implement the "hidden" and "system" attributes, it needs to know if UF_HIDDEN, UF_SYSTEM are supported for the file. This patch adds a new pathconf variable called _PC_HAS_HIDDENSYSTEM to do that. The ZFS patch will be handled separately as a OpenZFS pull request. Although this pathconf variable may be queried by applications using pathconf(2), the current interface where chflags(2) returns EOPNOTSUPP may still be used to check if the flags are set. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51172 --- sys/fs/msdosfs/msdosfs_vnops.c | 3 +++ sys/fs/smbfs/smbfs_vnops.c | 3 +++ sys/fs/tmpfs/tmpfs_vnops.c | 4 ++++ sys/kern/vfs_default.c | 1 + sys/sys/unistd.h | 1 + sys/ufs/ufs/ufs_vnops.c | 3 +++ 6 files changed, 15 insertions(+) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 120b97ba72d5..5db61c8951f6 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1942,6 +1942,9 @@ msdosfs_pathconf(struct vop_pathconf_args *ap) case _PC_NO_TRUNC: *ap->a_retval = 0; return (0); + case _PC_HAS_HIDDENSYSTEM: + *ap->a_retval = 1; + return (0); default: return (vop_stdpathconf(ap)); } diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index c30995508c00..5d412cabadb8 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -810,6 +810,9 @@ smbfs_pathconf(struct vop_pathconf_args *ap) case _PC_NO_TRUNC: *retval = 1; break; + case _PC_HAS_HIDDENSYSTEM: + *retval = 1; + break; default: error = vop_stdpathconf(ap); } diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index c99d0732be50..9d2a587b177a 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1691,6 +1691,10 @@ tmpfs_pathconf(struct vop_pathconf_args *v) *retval = PAGE_SIZE; break; + case _PC_HAS_HIDDENSYSTEM: + *retval = 1; + break; + default: error = vop_stdpathconf(v); } diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 2a01ec1e307e..fd6202a1424c 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -456,6 +456,7 @@ vop_stdpathconf(struct vop_pathconf_args *ap) case _PC_MAC_PRESENT: case _PC_NAMEDATTR_ENABLED: case _PC_HAS_NAMEDATTR: + case _PC_HAS_HIDDENSYSTEM: *ap->a_retval = 0; return (0); default: diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h index f5caea2e3919..c12343e5d0fd 100644 --- a/sys/sys/unistd.h +++ b/sys/sys/unistd.h @@ -156,6 +156,7 @@ #define _PC_DEALLOC_PRESENT 65 #define _PC_NAMEDATTR_ENABLED 66 #define _PC_HAS_NAMEDATTR 67 +#define _PC_HAS_HIDDENSYSTEM 68 #endif /* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */ diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 74cb094bdfe4..53fac4b0665e 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2720,6 +2720,9 @@ ufs_pathconf( case _PC_SYMLINK_MAX: *ap->a_retval = MAXPATHLEN; break; + case _PC_HAS_HIDDENSYSTEM: + *ap->a_retval = 1; + break; default: error = vop_stdpathconf(ap); From nobody Sun Jul 6 10:31:28 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZkDx2wNLz616bT; Sun, 06 Jul 2025 10:31: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZkDx0sLWz3nZD; Sun, 06 Jul 2025 10:31:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751797889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F+G6zKLmw86NzHkLSK4B9WLaDv3uzaDcwmKnI64b0rE=; b=c9hPP36vV0Kd9ITazGYhaxChTQMkrDVrr70lG7lwP0nZnfRws4mXrKZ7rVlFm0oaAfVCJw +q9cbnZDoUeovad6KcF2GHg2VbumYAECAiSJJdrirnZcDjmK9k223vIkrt9i4ckh3yqojj YB5bq935rOedPlT5eqLiwNiyn9pw+ycQ+Ln2xDQeQY5hCWsCJiRgRXX2BFG7Li5PHe8pPb hQ1U2+rsH2xqzd2vjqriUC/eStnmsE0aVEueT3K3ESmb5Chs54GA1zdyDgG0PUk6QKQ3yN 8oBONN2Y5HQEeldsmK4zUJWi7GTnvjLqYnf+YeG5Fpnb3KYzS44/50r7E4ZYmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751797889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F+G6zKLmw86NzHkLSK4B9WLaDv3uzaDcwmKnI64b0rE=; b=mKxb3XU8nQoNoBpzRMzGvXmPEvmSA7labbVHFgBnvYWtAXv924/hCK85ruxLGdMZwp1reJ H5uj+Pk1eEzUEApH942CIYfj1hU6+4KCacQuYL1AQTV6eBN+arAXtYhLUUYWst4BDo6W8F FL5O3L9zxmKWeKF1WRmzpF3fDukF5pcXgcyEPARgoKkGWgaNgMJfw09WdLPU4tGkqjql37 d26QA8vbZSPBrIcJqove9dOcHYoKXcwUwruKTET5kJB4NFQhd9/0MRfuChyLOF0C4vzbek jt+imKfbcy06BLr6q63qmlJx6k3bJKgV1qrSJJ8vul0dCtYIu1A3LUudKHWsyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751797889; a=rsa-sha256; cv=none; b=YmTz1VDdRJk8S29aR5It/Hk4UXahyhdVFgon2iyBAisN2aJeB3xy3dDz+sC5AVhyDdxhBF kB09QgN/Y6L4y/T9iWpSioIE01WUIhN3tUIdr4WyqpRMFUn699d4GMLxRg+Ezc41G0a39a koBJeoLTlDe4uNJKQHMxlUzfrwPSZbYqdBNSfLuK0jrwNwRfTUD/oZ/4yxH8PMKp5m8bw2 gDu4v682F+dmo52RjFutZg6U68unKn37HxzqBXHbzFzWaNUeQII6iU8MIBphevSSzbA4wQ Hn/cj6k93N7+YJZRlEPNnpaxUajvwEnH0UJ2nEo6G+p0Bhw+8zWduPI6Ml+tKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZkDx0Frfz1GYB; Sun, 06 Jul 2025 10:31:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566AVSnN090284; Sun, 6 Jul 2025 10:31:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566AVS6Z090281; Sun, 6 Jul 2025 10:31:28 GMT (envelope-from git) Date: Sun, 6 Jul 2025 10:31:28 GMT Message-Id: <202507061031.566AVS6Z090281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 842fde22b018 - main - src.conf.5: Add WITH_RUN_TESTS description List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 842fde22b0185acb5b9b319b83d265994b2974e4 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=842fde22b0185acb5b9b319b83d265994b2974e4 commit 842fde22b0185acb5b9b319b83d265994b2974e4 Author: Ed Maste AuthorDate: 2025-07-05 15:43:50 +0000 Commit: Ed Maste CommitDate: 2025-07-06 01:57:48 +0000 src.conf.5: Add WITH_RUN_TESTS description Fixes: 8e1e989c77d4 ("Add host.test.mk for DIRDEPS_BUILD") Sponosred by: The FreeBSD Foundation --- share/man/man5/src.conf.5 | 4 +++- tools/build/options/WITH_RUN_TESTS | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index aecdde416578..63e9f471f1f1 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,5 +1,5 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. -.Dd June 20, 2025 +.Dd July 5, 2025 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1570,6 +1570,8 @@ utility. Build .Xr rpcbind 8 with warmstart support. +.It Va WITH_RUN_TESTS +Run tests as part of the build. .It Va WITHOUT_SCTP_SUPPORT Disable support in the kernel for the .Xr sctp 4 diff --git a/tools/build/options/WITH_RUN_TESTS b/tools/build/options/WITH_RUN_TESTS new file mode 100644 index 000000000000..91b30522a3d3 --- /dev/null +++ b/tools/build/options/WITH_RUN_TESTS @@ -0,0 +1 @@ +Run tests as part of the build. From nobody Sun Jul 6 12:43:46 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZn9Z44T4z61NZ5; Sun, 06 Jul 2025 12:43: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZn9Z2n4jz3pS8; Sun, 06 Jul 2025 12:43:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751805826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pZYnuB/v8x8bLvI26i+GeeDULx64y29+ehZHnQlwQDU=; b=gxY8B+YEass7wLAbh+Y1zx9vhhiKQgLJtmOjWP6Zai+q/szV+qMuFyrLQ6KtD6rLnHs96C rDmwu8dvG8DexZI7vTcMpQKEBi2WNcOnMVQ/WKELADIt+sjAY9erV5DCXs0WITW5xEtZCp HaJTX+uiYR7P1knta3JZxEPbAIsePWrtJ/hep6HcglkQRqJnbipqjDBzb7fyJFc1NxhscV g5Is3/8aCdvA/AB1wtudc+Vwy5tudsD2RWsvlxCjbzi7Y6KhfUGrRAoJ9poE4ePbIOpajd f+0X9U6aBAU5PRagN3XjKpewMoVfJmVlVTbalWAWYuM2NW9GOiNxdnnRRaZ/tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751805826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pZYnuB/v8x8bLvI26i+GeeDULx64y29+ehZHnQlwQDU=; b=hFawvUBfgIFWm4S/IyDSiGbAdh4zmq0xd13JODkgaiwzw2OrHf+8k/dRsh+oWo7gBvhKs7 PtMWnvanlHK9Pt20goJMpE7UUJbTTSb9fR9AV9VvAykxA5leHabAeJc2cERysQBylzf3Vq XCfTUmsZIJnIcMVzvKmfndQXsNIDDi96m3AM7oXkinclN9tobB+R6jBqzQ6uj/tdijl2DA Cv2uHsK5YbkSIVxGJOTSFPMdbJCmfdsGCh93UU2BvzdAcwcmy8kziLhKO36zPVNU1HH8fr Hy1zu9FUNvRP3tGMrg4HAwCT9OVdJgAK48YoLswbxGevbfWz9zt7S2z9I6vlYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751805826; a=rsa-sha256; cv=none; b=eJwVlfklIdrn7/SZWBFdSCOmLsURS/5EmIS3Uu1baDY08+CfZJrbMUzhcsvQLMveavHIWh ZK7JlSDp11CHxlMXqkbuaWlC3lExarz9IXVq/vcVStF6bLrGzZFRXsKGnIVFLMl2Ys6eD4 lvJOSSIrR6V/HNkbEC3ueHc8jKHIMyNO/PQsOSnu+ygcb8uRH5WlV0J82sgIJlYqJ9ayrc Tw+qJXLP0blwzDIqJNqULB1/E6zJBEegT6yV2x+gKpiMCFfaWizSTB+u2Qn/z1264azfLQ t/QUuGAulzu/HyC3xBizsMz4+6iytHqA3HwCj4VlU9jy9vuC0Dqj4YWaqD1e5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZn9Z2HxGz1KrS; Sun, 06 Jul 2025 12:43:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566ChkYO042348; Sun, 6 Jul 2025 12:43:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566Chk4G042345; Sun, 6 Jul 2025 12:43:46 GMT (envelope-from git) Date: Sun, 6 Jul 2025 12:43:46 GMT Message-Id: <202507061243.566Chk4G042345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: be0b4916f193 - main - .cirrus.yml: Switch to manual mode for internal CI List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be0b4916f1933665ec5fe6a726e70725d4393b10 Auto-Submitted: auto-generated The branch main has been updated by bofh: URL: https://cgit.FreeBSD.org/src/commit/?id=be0b4916f1933665ec5fe6a726e70725d4393b10 commit be0b4916f1933665ec5fe6a726e70725d4393b10 Author: Muhammad Moinur Rahman AuthorDate: 2025-07-06 12:40:24 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2025-07-06 12:40:24 +0000 .cirrus.yml: Switch to manual mode for internal CI Pre-commit CI task using the FreeBSD internal CI system silences the build logs. This is hard to decode the actual problem on why a build is failing without any clue as the buildlogs are removed once the task fails. For now disable the tasks using manual trigger_type. Approved by: emaste (irc) --- .cirrus.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index d6c4df7a9776..b03fac2b26b5 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -194,11 +194,13 @@ precommit_task: matrix: - name: amd64 smoke test using internal ci systems only_if: $CIRRUS_REPO_FULL_NAME != 'freebsd/freebsd-src' || $CIRRUS_BRANCH =~ 'pull/.*' + trigger_type: manual env: TARGET: amd64 TARGET_ARCH: amd64 - name: aarch64 smoke test using internal ci systems only_if: $CIRRUS_REPO_FULL_NAME != 'freebsd/freebsd-src' || $CIRRUS_BRANCH =~ 'pull/.*' + trigger_type: manual env: TARGET: arm64 TARGET_ARCH: aarch64 From nobody Sun Jul 6 13:09:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkh4LYCz61RWZ; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkh3DrQz44Cb; Sun, 06 Jul 2025 13:09:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pIGaCtVXBOaV1aTtMN7sTVRKd4ul3ArcIBQvykdp95c=; b=l9D8nPuVJLTFmuGZBq3qJg6MAOKDfhzYRs4tAnxp5L2Bq3J2Q0EGkFYv8TCVVxXOxI3LAt /artna4fYMP1eu5Cp9WCYIv8ZD7P1CfWhYxOYv7WPLKPb2UEMcTIzSvDrZTX0biSdlJMfN fYSeJXMBKWiKq8XfIrixM50WtHd0CRWpB5Ah9MkbCOvH+fLAQOpgDYRqf5OaqyIkaPhFUc +BjtEGSdl3TuACrvgKp32wzNOFzYtltNf3T3QYJnGt4GVpuseXSkJysUAKRvU2Il/DyFVH baV98TVpQOMwI7s3MyFe2AK295+WYq16BrsiD99FEBb/XAf5cTe9+cus2OU0oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pIGaCtVXBOaV1aTtMN7sTVRKd4ul3ArcIBQvykdp95c=; b=jMYUTrDrdbt/NziJM+JzTo3/RmMSMi2aaidtK/f1rIwo95V7VXXwmMupADvvN0YYrqGkh9 YSjmUa9tOFpNmolNlWLTPNHOdwviDlemkfA2Kh7CAJT+Z6Fw55Ck0WmAt5Ztpr0NqkvyQb aE/vRvEuSfyGE78gDHWIAJ0zeO9pRgB6s5dW5qeCKOo0ATdT/pWr3w4ym7UF2RfcONHDS4 MAI8aJ0qT1yBCyb4JTgG6q1Os7c6E5YtHJnAy1H65aj4Dqs8eCWjs5a3CqwWVKQriApxJo gNRdjQnQEKgVAoaNydxqgaKqzR7sXqSwdUfZCPcjfXHJtq7CBIyMjPha5Ry95w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807340; a=rsa-sha256; cv=none; b=jS32nJbAHqev7BxMpj/4JZ9bz7cJ5KUui/NsdXHKoG/BH1ONmMdfdCWzUNiPPYLlA3cllf A4R0+UGJwnQUCVw4B4wQVuRi1TastM/MGbPL4+aWE77GK1g/K7MsCa+Y2UgJQBfn6S3pks qNyfnNcLR18Fcwr8ewKSe0v8GucX3GNAZIvfTfDlh6f7UOlBvZqpsoexAfdBaBvuXjkG08 83DuyHrJkz1KWh8iADU5QDMPtb9pq+5OnK676MQ1Gl9Obt+3zTK1QUHOZhV5IcxYlEcCPo jSSQJYcehKy2kFGY0JcESOFIbxQqImaO4P3j6BYugHRo/9PnYAyKAynpTfOx+w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkh2bGFz1LSF; Sun, 06 Jul 2025 13:09:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D90cE083097; Sun, 6 Jul 2025 13:09:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D903P083094; Sun, 6 Jul 2025 13:09:00 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:00 GMT Message-Id: <202507061309.566D903P083094@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 79b968063998 - main - sound: Retire the MIDI sequencer List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 79b968063998e67a3c65b580908da640c4544a56 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=79b968063998e67a3c65b580908da640c4544a56 commit 79b968063998e67a3c65b580908da640c4544a56 Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:10 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:10 +0000 sound: Retire the MIDI sequencer The in-kernel MIDI sequencer is not used anymore, since this is done by userland applications nowadays. It also contains bugs, and we are not exactly sure how it works, or if it worked properly in the first place. Sponsored by: The FreeBSD Foundation Reviewed by: vishwin, markj Differential Revision: https://reviews.freebsd.org/D50605 --- sys/conf/files | 1 - sys/dev/sound/midi/midi.c | 14 - sys/dev/sound/midi/midi.h | 1 - sys/dev/sound/midi/sequencer.c | 2107 -------------------------------------- sys/dev/sound/midi/sequencer.h | 89 -- sys/dev/sound/pcm/sndstat.c | 3 - sys/dev/sound/pcm/sound.h | 1 - sys/modules/sound/sound/Makefile | 2 +- 8 files changed, 1 insertion(+), 2217 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index dd6f9a3021d4..7c023af39b2a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3173,7 +3173,6 @@ dev/sound/midi/midi.c optional sound dev/sound/midi/mpu401.c optional sound dev/sound/midi/mpu_if.m optional sound dev/sound/midi/mpufoi_if.m optional sound -dev/sound/midi/sequencer.c optional sound dev/sound/midi/synth_if.m optional sound dev/spibus/acpi_spibus.c optional acpi spibus dev/spibus/ofw_spibus.c optional fdt spibus diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index fbfb69de2913..93a535b940a2 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -1441,8 +1441,6 @@ exit0: return retval; } -extern int seq_modevent(module_t mod, int type, void *data); - static int midi_modevent(module_t mod, int type, void *data) { @@ -1453,14 +1451,10 @@ midi_modevent(module_t mod, int type, void *data) switch (type) { case MOD_LOAD: retval = midi_load(); - if (retval == 0) - retval = seq_modevent(mod, type, data); break; case MOD_UNLOAD: retval = midi_unload(); - if (retval == 0) - retval = seq_modevent(mod, type, data); break; default: @@ -1470,14 +1464,6 @@ midi_modevent(module_t mod, int type, void *data) return retval; } -kobj_t -midimapper_addseq(void *arg1, int *unit, void **cookie) -{ - unit = NULL; - - return (kobj_t)arg1; -} - int midimapper_open_locked(void *arg1, void **cookie) { diff --git a/sys/dev/sound/midi/midi.h b/sys/dev/sound/midi/midi.h index 2254fab690e9..8becc20d35e6 100644 --- a/sys/dev/sound/midi/midi.h +++ b/sys/dev/sound/midi/midi.h @@ -51,7 +51,6 @@ int midi_uninit(struct snd_midi *_m); int midi_out(struct snd_midi *_m, uint8_t *_buf, int _size); int midi_in(struct snd_midi *_m, uint8_t *_buf, int _size); -kobj_t midimapper_addseq(void *arg1, int *unit, void **cookie); int midimapper_open_locked(void *arg1, void **cookie); int midimapper_open(void *arg1, void **cookie); int midimapper_close(void *arg1, void *cookie); diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c deleted file mode 100644 index 03b71688175c..000000000000 --- a/sys/dev/sound/midi/sequencer.c +++ /dev/null @@ -1,2107 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2003 Mathew Kanner - * Copyright (c) 1993 Hannu Savolainen - * All rights reserved. - * - * 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. - */ - -/* - * The sequencer personality manager. - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include /* for DATA_SET */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for DELAY */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_KERNEL_OPTION_HEADERS -#include "opt_snd.h" -#endif - -#include -#include -#include "synth_if.h" - -#include - -#define TMR_TIMERBASE 13 - -#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM - * synthesizer and MIDI output) */ -#define SND_DEV_MUSIC 8 /* /dev/music, level 2 interface */ - -/* Length of a sequencer event. */ -#define EV_SZ 8 -#define IEV_SZ 8 - -/* Lookup modes */ -#define LOOKUP_EXIST (0) -#define LOOKUP_OPEN (1) -#define LOOKUP_CLOSE (2) - -#define MIDIDEV(y) (dev2unit(y) & 0x0f) - -/* These are the entries to the sequencer driver. */ -static d_open_t mseq_open; -static d_close_t mseq_close; -static d_ioctl_t mseq_ioctl; -static d_read_t mseq_read; -static d_write_t mseq_write; -static d_poll_t mseq_poll; - -static struct cdevsw seq_cdevsw = { - .d_version = D_VERSION, - .d_open = mseq_open, - .d_close = mseq_close, - .d_read = mseq_read, - .d_write = mseq_write, - .d_ioctl = mseq_ioctl, - .d_poll = mseq_poll, - .d_name = "sequencer", -}; - -struct seq_softc { - KOBJ_FIELDS; - - struct mtx seq_lock, q_lock; - struct cv empty_cv, reset_cv, in_cv, out_cv, state_cv, th_cv; - - MIDIQ_HEAD(, u_char) in_q, out_q; - - u_long flags; - /* Flags (protected by flag_mtx of mididev_info) */ - int fflags; /* Access mode */ - int music; - - int out_water; /* Sequence output threshould */ - snd_sync_parm sync_parm; /* AIOSYNC parameter set */ - struct thread *sync_thread; /* AIOSYNCing thread */ - struct selinfo in_sel, out_sel; - int midi_number; - struct cdev *seqdev, *musicdev; - int unit; - int maxunits; - kobj_t *midis; - int *midi_flags; - kobj_t mapper; - void *mapper_cookie; - struct timeval timerstop, timersub; - int timerbase, tempo; - int timerrun; - int done; - int playing; - int recording; - int busy; - int pre_event_timeout; - int waiting; -}; - -/* - * Module specific stuff, including how many sequecers - * we currently own. - */ - -SYSCTL_NODE(_hw_midi, OID_AUTO, seq, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, - "Midi sequencer"); - -int seq_debug; -/* XXX: should this be moved into debug.midi? */ -SYSCTL_INT(_hw_midi_seq, OID_AUTO, debug, CTLFLAG_RW, &seq_debug, 0, ""); - -midi_cmdtab cmdtab_seqevent[] = { - {SEQ_NOTEOFF, "SEQ_NOTEOFF"}, - {SEQ_NOTEON, "SEQ_NOTEON"}, - {SEQ_WAIT, "SEQ_WAIT"}, - {SEQ_PGMCHANGE, "SEQ_PGMCHANGE"}, - {SEQ_SYNCTIMER, "SEQ_SYNCTIMER"}, - {SEQ_MIDIPUTC, "SEQ_MIDIPUTC"}, - {SEQ_DRUMON, "SEQ_DRUMON"}, - {SEQ_DRUMOFF, "SEQ_DRUMOFF"}, - {SEQ_ECHO, "SEQ_ECHO"}, - {SEQ_AFTERTOUCH, "SEQ_AFTERTOUCH"}, - {SEQ_CONTROLLER, "SEQ_CONTROLLER"}, - {SEQ_BALANCE, "SEQ_BALANCE"}, - {SEQ_VOLMODE, "SEQ_VOLMODE"}, - {SEQ_FULLSIZE, "SEQ_FULLSIZE"}, - {SEQ_PRIVATE, "SEQ_PRIVATE"}, - {SEQ_EXTENDED, "SEQ_EXTENDED"}, - {EV_SEQ_LOCAL, "EV_SEQ_LOCAL"}, - {EV_TIMING, "EV_TIMING"}, - {EV_CHN_COMMON, "EV_CHN_COMMON"}, - {EV_CHN_VOICE, "EV_CHN_VOICE"}, - {EV_SYSEX, "EV_SYSEX"}, - {-1, NULL}, -}; - -midi_cmdtab cmdtab_seqioctl[] = { - {SNDCTL_SEQ_RESET, "SNDCTL_SEQ_RESET"}, - {SNDCTL_SEQ_SYNC, "SNDCTL_SEQ_SYNC"}, - {SNDCTL_SYNTH_INFO, "SNDCTL_SYNTH_INFO"}, - {SNDCTL_SEQ_CTRLRATE, "SNDCTL_SEQ_CTRLRATE"}, - {SNDCTL_SEQ_GETOUTCOUNT, "SNDCTL_SEQ_GETOUTCOUNT"}, - {SNDCTL_SEQ_GETINCOUNT, "SNDCTL_SEQ_GETINCOUNT"}, - {SNDCTL_SEQ_PERCMODE, "SNDCTL_SEQ_PERCMODE"}, - {SNDCTL_FM_LOAD_INSTR, "SNDCTL_FM_LOAD_INSTR"}, - {SNDCTL_SEQ_TESTMIDI, "SNDCTL_SEQ_TESTMIDI"}, - {SNDCTL_SEQ_RESETSAMPLES, "SNDCTL_SEQ_RESETSAMPLES"}, - {SNDCTL_SEQ_NRSYNTHS, "SNDCTL_SEQ_NRSYNTHS"}, - {SNDCTL_SEQ_NRMIDIS, "SNDCTL_SEQ_NRMIDIS"}, - {SNDCTL_SEQ_GETTIME, "SNDCTL_SEQ_GETTIME"}, - {SNDCTL_MIDI_INFO, "SNDCTL_MIDI_INFO"}, - {SNDCTL_SEQ_THRESHOLD, "SNDCTL_SEQ_THRESHOLD"}, - {SNDCTL_SYNTH_MEMAVL, "SNDCTL_SYNTH_MEMAVL"}, - {SNDCTL_FM_4OP_ENABLE, "SNDCTL_FM_4OP_ENABLE"}, - {SNDCTL_PMGR_ACCESS, "SNDCTL_PMGR_ACCESS"}, - {SNDCTL_SEQ_PANIC, "SNDCTL_SEQ_PANIC"}, - {SNDCTL_SEQ_OUTOFBAND, "SNDCTL_SEQ_OUTOFBAND"}, - {SNDCTL_TMR_TIMEBASE, "SNDCTL_TMR_TIMEBASE"}, - {SNDCTL_TMR_START, "SNDCTL_TMR_START"}, - {SNDCTL_TMR_STOP, "SNDCTL_TMR_STOP"}, - {SNDCTL_TMR_CONTINUE, "SNDCTL_TMR_CONTINUE"}, - {SNDCTL_TMR_TEMPO, "SNDCTL_TMR_TEMPO"}, - {SNDCTL_TMR_SOURCE, "SNDCTL_TMR_SOURCE"}, - {SNDCTL_TMR_METRONOME, "SNDCTL_TMR_METRONOME"}, - {SNDCTL_TMR_SELECT, "SNDCTL_TMR_SELECT"}, - {SNDCTL_MIDI_PRETIME, "SNDCTL_MIDI_PRETIME"}, - {AIONWRITE, "AIONWRITE"}, - {AIOGSIZE, "AIOGSIZE"}, - {AIOSSIZE, "AIOSSIZE"}, - {AIOGFMT, "AIOGFMT"}, - {AIOSFMT, "AIOSFMT"}, - {AIOGMIX, "AIOGMIX"}, - {AIOSMIX, "AIOSMIX"}, - {AIOSTOP, "AIOSTOP"}, - {AIOSYNC, "AIOSYNC"}, - {AIOGCAP, "AIOGCAP"}, - {-1, NULL}, -}; - -midi_cmdtab cmdtab_timer[] = { - {TMR_WAIT_REL, "TMR_WAIT_REL"}, - {TMR_WAIT_ABS, "TMR_WAIT_ABS"}, - {TMR_STOP, "TMR_STOP"}, - {TMR_START, "TMR_START"}, - {TMR_CONTINUE, "TMR_CONTINUE"}, - {TMR_TEMPO, "TMR_TEMPO"}, - {TMR_ECHO, "TMR_ECHO"}, - {TMR_CLOCK, "TMR_CLOCK"}, - {TMR_SPP, "TMR_SPP"}, - {TMR_TIMESIG, "TMR_TIMESIG"}, - {-1, NULL}, -}; - -midi_cmdtab cmdtab_seqcv[] = { - {MIDI_NOTEOFF, "MIDI_NOTEOFF"}, - {MIDI_NOTEON, "MIDI_NOTEON"}, - {MIDI_KEY_PRESSURE, "MIDI_KEY_PRESSURE"}, - {-1, NULL}, -}; - -midi_cmdtab cmdtab_seqccmn[] = { - {MIDI_CTL_CHANGE, "MIDI_CTL_CHANGE"}, - {MIDI_PGM_CHANGE, "MIDI_PGM_CHANGE"}, - {MIDI_CHN_PRESSURE, "MIDI_CHN_PRESSURE"}, - {MIDI_PITCH_BEND, "MIDI_PITCH_BEND"}, - {MIDI_SYSTEM_PREFIX, "MIDI_SYSTEM_PREFIX"}, - {-1, NULL}, -}; - -#ifndef KOBJMETHOD_END -#define KOBJMETHOD_END { NULL, NULL } -#endif - -/* - * static const char *mpu401_mprovider(kobj_t obj, struct mpu401 *m); - */ - -static kobj_method_t seq_methods[] = { - /* KOBJMETHOD(mpu_provider,mpu401_mprovider), */ - KOBJMETHOD_END -}; - -DEFINE_CLASS(sequencer, seq_methods, 0); - -/* The followings are the local function. */ -static int seq_convertold(u_char *event, u_char *out); - -/* - * static void seq_midiinput(struct seq_softc * scp, void *md); - */ -static void seq_reset(struct seq_softc *scp); -static int seq_sync(struct seq_softc *scp); - -static int seq_processevent(struct seq_softc *scp, u_char *event); - -static int seq_timing(struct seq_softc *scp, u_char *event); -static int seq_local(struct seq_softc *scp, u_char *event); - -static int seq_chnvoice(struct seq_softc *scp, kobj_t md, u_char *event); -static int seq_chncommon(struct seq_softc *scp, kobj_t md, u_char *event); -static int seq_sysex(struct seq_softc *scp, kobj_t md, u_char *event); - -static int seq_fetch_mid(struct seq_softc *scp, int unit, kobj_t *md); -void seq_copytoinput(struct seq_softc *scp, u_char *event, int len); -int seq_modevent(module_t mod, int type, void *data); -struct seq_softc *seqs[10]; -static struct mtx seqinfo_mtx; -static u_long nseq = 0; - -static void timer_start(struct seq_softc *t); -static void timer_stop(struct seq_softc *t); -static void timer_setvals(struct seq_softc *t, int tempo, int timerbase); -static void timer_wait(struct seq_softc *t, int ticks, int wait_abs); -static int timer_now(struct seq_softc *t); - -static void -timer_start(struct seq_softc *t) -{ - t->timerrun = 1; - getmicrotime(&t->timersub); -} - -static void -timer_continue(struct seq_softc *t) -{ - struct timeval now; - - if (t->timerrun == 1) - return; - t->timerrun = 1; - getmicrotime(&now); - timevalsub(&now, &t->timerstop); - timevaladd(&t->timersub, &now); -} - -static void -timer_stop(struct seq_softc *t) -{ - t->timerrun = 0; - getmicrotime(&t->timerstop); -} - -static void -timer_setvals(struct seq_softc *t, int tempo, int timerbase) -{ - t->tempo = tempo; - t->timerbase = timerbase; -} - -static void -timer_wait(struct seq_softc *t, int ticks, int wait_abs) -{ - struct timeval now, when; - int ret; - unsigned long long i; - - while (t->timerrun == 0) { - SEQ_DEBUG(2, printf("Timer wait when timer isn't running\n")); - /* - * The old sequencer used timeouts that only increased - * the timer when the timer was running. - * Hence the sequencer would stick (?) if the - * timer was disabled. - */ - cv_wait(&t->reset_cv, &t->seq_lock); - if (t->playing == 0) - return; - } - - i = ticks * 60ull * 1000000ull / (t->tempo * t->timerbase); - - when.tv_sec = i / 1000000; - when.tv_usec = i % 1000000; - -#if 0 - printf("timer_wait tempo %d timerbase %d ticks %d abs %d u_sec %llu\n", - t->tempo, t->timerbase, ticks, wait_abs, i); -#endif - - if (wait_abs != 0) { - getmicrotime(&now); - timevalsub(&now, &t->timersub); - timevalsub(&when, &now); - } - if (when.tv_sec < 0 || when.tv_usec < 0) { - SEQ_DEBUG(3, - printf("seq_timer error negative time %lds.%06lds\n", - (long)when.tv_sec, (long)when.tv_usec)); - return; - } - i = when.tv_sec * 1000000ull; - i += when.tv_usec; - i *= hz; - i /= 1000000ull; -#if 0 - printf("seq_timer usec %llu ticks %llu\n", - when.tv_sec * 1000000ull + when.tv_usec, i); -#endif - t->waiting = 1; - ret = cv_timedwait(&t->reset_cv, &t->seq_lock, i + 1); - t->waiting = 0; - - if (ret != EWOULDBLOCK) - SEQ_DEBUG(3, printf("seq_timer didn't timeout\n")); - -} - -static int -timer_now(struct seq_softc *t) -{ - struct timeval now; - unsigned long long i; - int ret; - - if (t->timerrun == 0) - now = t->timerstop; - else - getmicrotime(&now); - - timevalsub(&now, &t->timersub); - - i = now.tv_sec * 1000000ull; - i += now.tv_usec; - i *= t->timerbase; -/* i /= t->tempo; */ - i /= 1000000ull; - - ret = i; - /* - * printf("timer_now: %llu %d\n", i, ret); - */ - - return ret; -} - -static void -seq_eventthread(void *arg) -{ - struct seq_softc *scp = arg; - u_char event[EV_SZ]; - - mtx_lock(&scp->seq_lock); - SEQ_DEBUG(2, printf("seq_eventthread started\n")); - while (scp->done == 0) { -restart: - while (scp->playing == 0) { - cv_wait(&scp->state_cv, &scp->seq_lock); - if (scp->done) - goto done; - } - - while (MIDIQ_EMPTY(scp->out_q)) { - cv_broadcast(&scp->empty_cv); - cv_wait(&scp->out_cv, &scp->seq_lock); - if (scp->playing == 0) - goto restart; - if (scp->done) - goto done; - } - - MIDIQ_DEQ(scp->out_q, event, EV_SZ); - - if (MIDIQ_AVAIL(scp->out_q) < scp->out_water) { - cv_broadcast(&scp->out_cv); - selwakeup(&scp->out_sel); - } - seq_processevent(scp, event); - } - -done: - cv_broadcast(&scp->th_cv); - mtx_unlock(&scp->seq_lock); - SEQ_DEBUG(2, printf("seq_eventthread finished\n")); - kproc_exit(0); -} - -/* - * seq_processevent: This maybe called by the event thread or the IOCTL - * handler for queued and out of band events respectively. - */ -static int -seq_processevent(struct seq_softc *scp, u_char *event) -{ - int ret; - kobj_t m; - - ret = 0; - - if (event[0] == EV_SEQ_LOCAL) - ret = seq_local(scp, event); - else if (event[0] == EV_TIMING) - ret = seq_timing(scp, event); - else if (event[0] != EV_CHN_VOICE && - event[0] != EV_CHN_COMMON && - event[0] != EV_SYSEX && - event[0] != SEQ_MIDIPUTC) { - ret = 1; - SEQ_DEBUG(2, printf("seq_processevent not known %d\n", - event[0])); - } else if (seq_fetch_mid(scp, event[1], &m) != 0) { - ret = 1; - SEQ_DEBUG(2, printf("seq_processevent midi unit not found %d\n", - event[1])); - } else - switch (event[0]) { - case EV_CHN_VOICE: - ret = seq_chnvoice(scp, m, event); - break; - case EV_CHN_COMMON: - ret = seq_chncommon(scp, m, event); - break; - case EV_SYSEX: - ret = seq_sysex(scp, m, event); - break; - case SEQ_MIDIPUTC: - mtx_unlock(&scp->seq_lock); - ret = SYNTH_WRITERAW(m, &event[2], 1); - mtx_lock(&scp->seq_lock); - break; - } - return ret; -} - -static int -seq_addunit(void) -{ - struct seq_softc *scp; - int ret; - u_char *buf; - - gone_in(15, "Warning! MIDI sequencer to be removed soon: no longer " - "needed or used\n"); - - /* Allocate the softc. */ - ret = ENOMEM; - scp = malloc(sizeof(*scp), M_DEVBUF, M_NOWAIT | M_ZERO); - if (scp == NULL) { - SEQ_DEBUG(1, printf("seq_addunit: softc allocation failed.\n")); - goto err; - } - kobj_init((kobj_t)scp, &sequencer_class); - - buf = malloc(sizeof(*buf) * EV_SZ * 1024, M_TEMP, M_NOWAIT | M_ZERO); - if (buf == NULL) - goto err; - MIDIQ_INIT(scp->in_q, buf, EV_SZ * 1024); - buf = malloc(sizeof(*buf) * EV_SZ * 1024, M_TEMP, M_NOWAIT | M_ZERO); - if (buf == NULL) - goto err; - MIDIQ_INIT(scp->out_q, buf, EV_SZ * 1024); - ret = EINVAL; - - scp->midis = malloc(sizeof(kobj_t) * 32, M_TEMP, M_NOWAIT | M_ZERO); - scp->midi_flags = malloc(sizeof(*scp->midi_flags) * 32, M_TEMP, - M_NOWAIT | M_ZERO); - - if (scp->midis == NULL || scp->midi_flags == NULL) - goto err; - - scp->flags = 0; - - mtx_init(&scp->seq_lock, "seqflq", NULL, 0); - cv_init(&scp->state_cv, "seqstate"); - cv_init(&scp->empty_cv, "seqempty"); - cv_init(&scp->reset_cv, "seqtimer"); - cv_init(&scp->out_cv, "seqqout"); - cv_init(&scp->in_cv, "seqqin"); - cv_init(&scp->th_cv, "seqstart"); - - /* - * Init the damn timer - */ - - scp->mapper = midimapper_addseq(scp, &scp->unit, &scp->mapper_cookie); - if (scp->mapper == NULL) - goto err; - - scp->seqdev = make_dev(&seq_cdevsw, SND_DEV_SEQ, UID_ROOT, GID_WHEEL, - 0666, "sequencer%d", scp->unit); - - scp->musicdev = make_dev(&seq_cdevsw, SND_DEV_MUSIC, UID_ROOT, - GID_WHEEL, 0666, "music%d", scp->unit); - - if (scp->seqdev == NULL || scp->musicdev == NULL) - goto err; - /* - * TODO: Add to list of sequencers this module provides - */ - - ret = - kproc_create - (seq_eventthread, scp, NULL, RFHIGHPID, 0, - "sequencer %02d", scp->unit); - - if (ret) - goto err; - - scp->seqdev->si_drv1 = scp->musicdev->si_drv1 = scp; - - SEQ_DEBUG(2, printf("sequencer %d created scp %p\n", scp->unit, scp)); - - ret = 0; - - mtx_lock(&seqinfo_mtx); - seqs[nseq++] = scp; - mtx_unlock(&seqinfo_mtx); - - goto ok; - -err: - if (scp != NULL) { - if (scp->seqdev != NULL) - destroy_dev(scp->seqdev); - if (scp->musicdev != NULL) - destroy_dev(scp->musicdev); - /* - * TODO: Destroy mutex and cv - */ - if (scp->midis != NULL) - free(scp->midis, M_TEMP); - if (scp->midi_flags != NULL) - free(scp->midi_flags, M_TEMP); - if (scp->out_q.b) - free(scp->out_q.b, M_TEMP); - if (scp->in_q.b) - free(scp->in_q.b, M_TEMP); - free(scp, M_DEVBUF); - } -ok: - return ret; -} - -static int -seq_delunit(int unit) -{ - struct seq_softc *scp = seqs[unit]; - int i; - - //SEQ_DEBUG(4, printf("seq_delunit: %d\n", unit)); - SEQ_DEBUG(1, printf("seq_delunit: 1 \n")); - mtx_lock(&scp->seq_lock); - - scp->playing = 0; - scp->done = 1; - cv_broadcast(&scp->out_cv); - cv_broadcast(&scp->state_cv); - cv_broadcast(&scp->reset_cv); - SEQ_DEBUG(1, printf("seq_delunit: 2 \n")); - cv_wait(&scp->th_cv, &scp->seq_lock); - SEQ_DEBUG(1, printf("seq_delunit: 3.0 \n")); - mtx_unlock(&scp->seq_lock); - SEQ_DEBUG(1, printf("seq_delunit: 3.1 \n")); - - cv_destroy(&scp->state_cv); - SEQ_DEBUG(1, printf("seq_delunit: 4 \n")); - cv_destroy(&scp->empty_cv); - SEQ_DEBUG(1, printf("seq_delunit: 5 \n")); - cv_destroy(&scp->reset_cv); - SEQ_DEBUG(1, printf("seq_delunit: 6 \n")); - cv_destroy(&scp->out_cv); - SEQ_DEBUG(1, printf("seq_delunit: 7 \n")); - cv_destroy(&scp->in_cv); - SEQ_DEBUG(1, printf("seq_delunit: 8 \n")); - cv_destroy(&scp->th_cv); - - SEQ_DEBUG(1, printf("seq_delunit: 10 \n")); - if (scp->seqdev) - destroy_dev(scp->seqdev); - SEQ_DEBUG(1, printf("seq_delunit: 11 \n")); - if (scp->musicdev) - destroy_dev(scp->musicdev); - SEQ_DEBUG(1, printf("seq_delunit: 12 \n")); - scp->seqdev = scp->musicdev = NULL; - if (scp->midis != NULL) - free(scp->midis, M_TEMP); - SEQ_DEBUG(1, printf("seq_delunit: 13 \n")); - if (scp->midi_flags != NULL) - free(scp->midi_flags, M_TEMP); - SEQ_DEBUG(1, printf("seq_delunit: 14 \n")); - free(scp->out_q.b, M_TEMP); - SEQ_DEBUG(1, printf("seq_delunit: 15 \n")); - free(scp->in_q.b, M_TEMP); - - SEQ_DEBUG(1, printf("seq_delunit: 16 \n")); - - mtx_destroy(&scp->seq_lock); - SEQ_DEBUG(1, printf("seq_delunit: 17 \n")); - free(scp, M_DEVBUF); - - mtx_lock(&seqinfo_mtx); - for (i = unit; i < (nseq - 1); i++) - seqs[i] = seqs[i + 1]; - nseq--; - mtx_unlock(&seqinfo_mtx); - - return 0; -} - -int -seq_modevent(module_t mod, int type, void *data) -{ - int retval, r; - - retval = 0; - - switch (type) { - case MOD_LOAD: - mtx_init(&seqinfo_mtx, "seqmod", NULL, 0); - retval = seq_addunit(); - break; - - case MOD_UNLOAD: - while (nseq) { - r = seq_delunit(nseq - 1); - if (r) { - retval = r; - break; - } - } - if (nseq == 0) { - retval = 0; - mtx_destroy(&seqinfo_mtx); - } - break; - - default: - break; - } - - return retval; -} - -static int -seq_fetch_mid(struct seq_softc *scp, int unit, kobj_t *md) -{ - - if (unit >= scp->midi_number || unit < 0) - return EINVAL; - - *md = scp->midis[unit]; - - return 0; -} - -int -mseq_open(struct cdev *i_dev, int flags, int mode, struct thread *td) -{ - struct seq_softc *scp = i_dev->si_drv1; - int i; - - gone_in(15, "Warning! MIDI sequencer to be removed soon: no longer " - "needed or used\n"); - - if (scp == NULL) - return ENXIO; - - SEQ_DEBUG(3, printf("seq_open: scp %p unit %d, flags 0x%x.\n", - scp, scp->unit, flags)); - - /* - * Mark this device busy. - */ - - midistat_lock(); - mtx_lock(&scp->seq_lock); - if (scp->busy) { - mtx_unlock(&scp->seq_lock); - midistat_unlock(); - SEQ_DEBUG(2, printf("seq_open: unit %d is busy.\n", scp->unit)); - return EBUSY; - } - scp->fflags = flags; - /* - if ((scp->fflags & O_NONBLOCK) != 0) - scp->flags |= SEQ_F_NBIO; - */ - scp->music = MIDIDEV(i_dev) == SND_DEV_MUSIC; - - /* - * Enumerate the available midi devices - */ - scp->midi_number = 0; - scp->maxunits = midimapper_open_locked(scp->mapper, &scp->mapper_cookie); - - if (scp->maxunits == 0) - SEQ_DEBUG(2, printf("seq_open: no midi devices\n")); - - for (i = 0; i < scp->maxunits; i++) { - scp->midis[scp->midi_number] = - midimapper_fetch_synth_locked(scp->mapper, - scp->mapper_cookie, i); - if (scp->midis[scp->midi_number]) { - if (SYNTH_OPEN(scp->midis[scp->midi_number], scp, - scp->fflags) != 0) - scp->midis[scp->midi_number] = NULL; - else { - scp->midi_flags[scp->midi_number] = - SYNTH_QUERY(scp->midis[scp->midi_number]); - scp->midi_number++; - } - } - } - midistat_unlock(); - - timer_setvals(scp, 60, 100); - - timer_start(scp); - timer_stop(scp); - /* - * actually, if we're in rdonly mode, we should start the timer - */ - /* - * TODO: Handle recording now - */ - - scp->out_water = MIDIQ_SIZE(scp->out_q) / 2; - - scp->busy = 1; - mtx_unlock(&scp->seq_lock); - - SEQ_DEBUG(2, printf("seq_open: opened, mode %s.\n", - scp->music ? "music" : "sequencer")); - SEQ_DEBUG(2, - printf("Sequencer %d %p opened maxunits %d midi_number %d:\n", - scp->unit, scp, scp->maxunits, scp->midi_number)); - for (i = 0; i < scp->midi_number; i++) - SEQ_DEBUG(3, printf(" midi %d %p\n", i, scp->midis[i])); - - return 0; -} - -/* - * mseq_close - */ -int -mseq_close(struct cdev *i_dev, int flags, int mode, struct thread *td) -{ - int i; - struct seq_softc *scp = i_dev->si_drv1; - int ret; - - if (scp == NULL) - return ENXIO; - - SEQ_DEBUG(2, printf("seq_close: unit %d.\n", scp->unit)); - - mtx_lock(&scp->seq_lock); - - ret = ENXIO; - if (scp->busy == 0) - goto err; - - seq_reset(scp); - seq_sync(scp); - - for (i = 0; i < scp->midi_number; i++) - if (scp->midis[i]) - SYNTH_CLOSE(scp->midis[i]); - - midimapper_close(scp->mapper, scp->mapper_cookie); - - timer_stop(scp); - - scp->busy = 0; - ret = 0; - -err: - SEQ_DEBUG(3, printf("seq_close: closed ret = %d.\n", ret)); - mtx_unlock(&scp->seq_lock); - return ret; -} - -int -mseq_read(struct cdev *i_dev, struct uio *uio, int ioflag) -{ - int retval, used; - struct seq_softc *scp = i_dev->si_drv1; - -#define SEQ_RSIZE 32 - u_char buf[SEQ_RSIZE]; - - if (scp == NULL) - return ENXIO; - - SEQ_DEBUG(7, printf("mseq_read: unit %d, resid %zd.\n", - scp->unit, uio->uio_resid)); - - mtx_lock(&scp->seq_lock); - if ((scp->fflags & FREAD) == 0) { - SEQ_DEBUG(2, printf("mseq_read: unit %d is not for reading.\n", - scp->unit)); - retval = EIO; - goto err1; *** 1364 LINES SKIPPED *** From nobody Sun Jul 6 13:09:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkj4Gcyz61Rdw; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkj3Rlvz445Q; Sun, 06 Jul 2025 13:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CRt0jz9xX8q4/61xC9OdSPuxhsc0chwWYR/jfEvuwBQ=; b=h6GE/5DZVgTcqExJ8eIB9dPi13fplznNb/9a0kUC8YkVPuHDg7c5COvLAqfdOohfQ3o2p5 bv9h0yiM7grUkiUnFHYPRZ8d2iBaQJomYZUM41zxwQWg5bT5v2Y0TwPWxcd79YsWxFrRI8 tiU0lAx56T1sfFo1DJPU6KRLIEKuzBCMAGvGd71NMHXBS7Z+RlwYb48cIj9b9RGRIpIRRg z5zRdDJJ8VA51tj3dJMdc5wV2YMbVdNY5hY0NuTIWk0dmWAOdotzF8kG1znZGsFLFr4nnu w5yG7AwGivc9NfC43VDDFomMwBkugFaaN47ZUJO77SPukb+SWZW88i6MDcsOeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CRt0jz9xX8q4/61xC9OdSPuxhsc0chwWYR/jfEvuwBQ=; b=Lt9uQ9K988abqpRZojM9sHXbPns5V/vmU3vNSbAUgLWPHliSOr77J0pF1dLOBB43rl8eV+ C7kAakseh0U+g0ZhG2ESCz/6KFr76rBVYL2CwiGWP6/F93+ijSeHjzrzN3RebHDnzsww5e eBtt2ZfptHQlbIGHVV5Jc9o7RcA0CUMIWvOmTACb5NTQ7n+u7/a+Rgzd4kh77JGskRUvOh zQbpSZD2OGToO4qf2p87uEykmHrhvhRyceNdfGCJtX7tXQnygwWpiSEk+VCUa0X+zmuZx8 ITCxqpha9JTqkLuEvkFPOKF3wUpsgf/si6V7FTaB6zkijzSIf2kOcA9v8rf7gA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807341; a=rsa-sha256; cv=none; b=s++ulHwQ7yky0zvCe1sFjRPrxoUbVxyfyAMLPJX/j+cQPNaxBAvY0cTlrZoT6BDmSqCJIa WlC2mUUMHL6gzMH5Ewom2KzbxtN5VzyFsWVAFnDy1ohBHW3wJ12oXlVNEzmuNbxwEb4J5F 07GzNYs6ChxAKecAAgbS3AKMJKWRx7tj4Z8uoqfySDzm3cD2CRzzzELPGXAs17tzG5Jz5k Bvp1gJcGnce+T3evlPssVJY/IHRzV5/W6aHTCLRHB43Nali/XYS4C7APVto4knKeg4erCf gzoKTr/mWzLbsR79/7Z4zSUry47Px16nwsVTH2r2k0FPYHY33qJqOFiayAMcDA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkj2sq6z1LTx; Sun, 06 Jul 2025 13:09:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D915f083131; Sun, 6 Jul 2025 13:09:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D91Wp083128; Sun, 6 Jul 2025 13:09:01 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:01 GMT Message-Id: <202507061309.566D91Wp083128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 6cdd3226c718 - main - sound: Retire midisynth List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6cdd3226c7186f91d3495aa5233ce559a880ad9d Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6cdd3226c7186f91d3495aa5233ce559a880ad9d commit 6cdd3226c7186f91d3495aa5233ce559a880ad9d Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:18 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:18 +0000 sound: Retire midisynth Unused code since we retired the sequencer. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50609 --- sys/conf/files | 1 - sys/dev/sound/midi/midi.c | 390 --------------------------------------- sys/dev/sound/midi/midi.h | 6 - sys/dev/sound/midi/synth_if.m | 312 ------------------------------- sys/modules/sound/sound/Makefile | 4 +- 5 files changed, 2 insertions(+), 711 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 7c023af39b2a..866901ba4c51 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3173,7 +3173,6 @@ dev/sound/midi/midi.c optional sound dev/sound/midi/mpu401.c optional sound dev/sound/midi/mpu_if.m optional sound dev/sound/midi/mpufoi_if.m optional sound -dev/sound/midi/synth_if.m optional sound dev/spibus/acpi_spibus.c optional acpi spibus dev/spibus/ofw_spibus.c optional fdt spibus dev/spibus/spibus.c optional spibus \ diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index 93a535b940a2..bbb1ff3dd8dc 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -66,7 +66,6 @@ #include "mpu_if.h" #include -#include "synth_if.h" MALLOC_DEFINE(M_MIDI, "midi buffers", "Midi data allocation area"); #ifndef KOBJMETHOD_END @@ -115,41 +114,9 @@ struct snd_midi { * complete command packets. */ struct proc *async; struct cdev *dev; - struct synth_midi *synth; - int synth_flags; TAILQ_ENTRY(snd_midi) link; }; -struct synth_midi { - KOBJ_FIELDS; - struct snd_midi *m; -}; - -static synth_open_t midisynth_open; -static synth_close_t midisynth_close; -static synth_writeraw_t midisynth_writeraw; -static synth_killnote_t midisynth_killnote; -static synth_startnote_t midisynth_startnote; -static synth_setinstr_t midisynth_setinstr; -static synth_alloc_t midisynth_alloc; -static synth_controller_t midisynth_controller; -static synth_bender_t midisynth_bender; - -static kobj_method_t midisynth_methods[] = { - KOBJMETHOD(synth_open, midisynth_open), - KOBJMETHOD(synth_close, midisynth_close), - KOBJMETHOD(synth_writeraw, midisynth_writeraw), - KOBJMETHOD(synth_setinstr, midisynth_setinstr), - KOBJMETHOD(synth_startnote, midisynth_startnote), - KOBJMETHOD(synth_killnote, midisynth_killnote), - KOBJMETHOD(synth_alloc, midisynth_alloc), - KOBJMETHOD(synth_controller, midisynth_controller), - KOBJMETHOD(synth_bender, midisynth_bender), - KOBJMETHOD_END -}; - -DEFINE_CLASS(midisynth, midisynth_methods, 0); - /* * Module Exports & Interface * @@ -326,9 +293,6 @@ midi_init(kobj_class_t cls, int unit, int channel, void *cookie) MIDI_DEBUG(1, printf("midiinit #2: unit %d/%d.\n", unit, channel)); m = malloc(sizeof(*m), M_MIDI, M_WAITOK | M_ZERO); - m->synth = malloc(sizeof(*m->synth), M_MIDI, M_WAITOK | M_ZERO); - kobj_init((kobj_t)m->synth, &midisynth_class); - m->synth->m = m; kobj_init((kobj_t)m, cls); inqsize = MPU_INQSIZE(m, cookie); outqsize = MPU_OUTQSIZE(m, cookie); @@ -393,7 +357,6 @@ err2: if (MIDIQ_BUF(m->outq)) free(MIDIQ_BUF(m->outq), M_MIDI); err1: - free(m->synth, M_MIDI); free(m, M_MIDI); err0: midistat_unlock(); @@ -1069,298 +1032,6 @@ midi_cmdname(int cmd) #endif /* notdef */ -/* - * midisynth - */ - -int -midisynth_open(void *n, void *arg, int flags) -{ - struct snd_midi *m = ((struct synth_midi *)n)->m; - int retval; - - MIDI_DEBUG(1, printf("midisynth_open %s %s\n", - flags & FREAD ? "M_RX" : "", flags & FWRITE ? "M_TX" : "")); - - if (m == NULL) - return ENXIO; - - mtx_lock(&m->lock); - mtx_lock(&m->qlock); - - retval = 0; - - if (flags & FREAD) { - if (MIDIQ_SIZE(m->inq) == 0) - retval = ENXIO; - else if (m->flags & M_RX) - retval = EBUSY; - if (retval) - goto err; - } - if (flags & FWRITE) { - if (MIDIQ_SIZE(m->outq) == 0) - retval = ENXIO; - else if (m->flags & M_TX) - retval = EBUSY; - if (retval) - goto err; - } - m->busy++; - - /* - * TODO: Consider m->async = 0; - */ - - if (flags & FREAD) { - m->flags |= M_RX | M_RXEN; - /* - * Only clear the inq, the outq might still have data to drain - * from a previous session - */ - MIDIQ_CLEAR(m->inq); - m->rchan = 0; - } - - if (flags & FWRITE) { - m->flags |= M_TX; - m->wchan = 0; - } - m->synth_flags = flags & (FREAD | FWRITE); - - MPU_CALLBACK(m, m->cookie, m->flags); - -err: mtx_unlock(&m->qlock); - mtx_unlock(&m->lock); - MIDI_DEBUG(2, printf("midisynth_open: return %d.\n", retval)); - return retval; -} - -int -midisynth_close(void *n) -{ - struct snd_midi *m = ((struct synth_midi *)n)->m; - int retval; - int oldflags; - - MIDI_DEBUG(1, printf("midisynth_close %s %s\n", - m->synth_flags & FREAD ? "M_RX" : "", - m->synth_flags & FWRITE ? "M_TX" : "")); - - if (m == NULL) - return ENXIO; - - mtx_lock(&m->lock); - mtx_lock(&m->qlock); - - if ((m->synth_flags & FREAD && !(m->flags & M_RX)) || - (m->synth_flags & FWRITE && !(m->flags & M_TX))) { - retval = ENXIO; - goto err; - } - m->busy--; - - oldflags = m->flags; - - if (m->synth_flags & FREAD) - m->flags &= ~(M_RX | M_RXEN); - if (m->synth_flags & FWRITE) - m->flags &= ~M_TX; - - if ((m->flags & (M_TXEN | M_RXEN)) != (oldflags & (M_RXEN | M_TXEN))) - MPU_CALLBACK(m, m->cookie, m->flags); - - MIDI_DEBUG(1, printf("midi_close: closed, busy = %d.\n", m->busy)); - - mtx_unlock(&m->qlock); - mtx_unlock(&m->lock); - retval = 0; -err: return retval; -} - -/* - * Always blocking. - */ - -int -midisynth_writeraw(void *n, uint8_t *buf, size_t len) -{ - struct snd_midi *m = ((struct synth_midi *)n)->m; - int retval; - int used; - int i; - - MIDI_DEBUG(4, printf("midisynth_writeraw\n")); - - retval = 0; - - if (m == NULL) - return ENXIO; - - mtx_lock(&m->lock); - mtx_lock(&m->qlock); - - if (!(m->flags & M_TX)) - goto err1; - - if (midi_dumpraw) - printf("midi dump: "); - - while (len > 0) { - while (MIDIQ_AVAIL(m->outq) == 0) { - if (!(m->flags & M_TXEN)) { - m->flags |= M_TXEN; - MPU_CALLBACK(m, m->cookie, m->flags); - } - mtx_unlock(&m->lock); - m->wchan = 1; - MIDI_DEBUG(3, printf("midisynth_writeraw msleep\n")); - retval = msleep(&m->wchan, &m->qlock, - PCATCH | PDROP, "midi TX", 0); - /* - * We slept, maybe things have changed since last - * dying check - */ - if (retval == EINTR) - goto err0; - - if (retval) - goto err0; - mtx_lock(&m->lock); - mtx_lock(&m->qlock); - m->wchan = 0; - if (!m->busy) - goto err1; - } - - /* - * We are certain than data can be placed on the queue - */ - - used = MIN(MIDIQ_AVAIL(m->outq), len); - used = MIN(used, MIDI_WSIZE); - MIDI_DEBUG(5, - printf("midi_synth: resid %zu len %jd avail %jd\n", - len, (intmax_t)MIDIQ_LEN(m->outq), - (intmax_t)MIDIQ_AVAIL(m->outq))); - - if (midi_dumpraw) - for (i = 0; i < used; i++) - printf("%x ", buf[i]); - - MIDIQ_ENQ(m->outq, buf, used); - len -= used; - - /* - * Inform the bottom half that data can be written - */ - if (!(m->flags & M_TXEN)) { - m->flags |= M_TXEN; - MPU_CALLBACK(m, m->cookie, m->flags); - } - } - /* - * If we Made it here then transfer is good - */ - if (midi_dumpraw) - printf("\n"); - - retval = 0; -err1: mtx_unlock(&m->qlock); - mtx_unlock(&m->lock); -err0: return retval; -} - -static int -midisynth_killnote(void *n, uint8_t chn, uint8_t note, uint8_t vel) -{ - u_char c[3]; - - if (note > 127 || chn > 15) - return (EINVAL); - - if (vel > 127) - vel = 127; - - if (vel == 64) { - c[0] = 0x90 | (chn & 0x0f); /* Note on. */ - c[1] = (u_char)note; - c[2] = 0; - } else { - c[0] = 0x80 | (chn & 0x0f); /* Note off. */ - c[1] = (u_char)note; - c[2] = (u_char)vel; - } - - return midisynth_writeraw(n, c, 3); -} - -static int -midisynth_setinstr(void *n, uint8_t chn, uint16_t instr) -{ - u_char c[2]; - - if (instr > 127 || chn > 15) - return EINVAL; - - c[0] = 0xc0 | (chn & 0x0f); /* Progamme change. */ - c[1] = instr + midi_instroff; - - return midisynth_writeraw(n, c, 2); -} - -static int -midisynth_startnote(void *n, uint8_t chn, uint8_t note, uint8_t vel) -{ - u_char c[3]; - - if (note > 127 || chn > 15) - return EINVAL; - - if (vel > 127) - vel = 127; - - c[0] = 0x90 | (chn & 0x0f); /* Note on. */ - c[1] = (u_char)note; - c[2] = (u_char)vel; - - return midisynth_writeraw(n, c, 3); -} -static int -midisynth_alloc(void *n, uint8_t chan, uint8_t note) -{ - return chan; -} - -static int -midisynth_controller(void *n, uint8_t chn, uint8_t ctrlnum, uint16_t val) -{ - u_char c[3]; - - if (ctrlnum > 127 || chn > 15) - return EINVAL; - - c[0] = 0xb0 | (chn & 0x0f); /* Control Message. */ - c[1] = ctrlnum; - c[2] = val; - return midisynth_writeraw(n, c, 3); -} - -static int -midisynth_bender(void *n, uint8_t chn, uint16_t val) -{ - u_char c[3]; - - if (val > 16383 || chn > 15) - return EINVAL; - - c[0] = 0xe0 | (chn & 0x0f); /* Pitch bend. */ - c[1] = (u_char)val & 0x7f; - c[2] = (u_char)(val >> 7) & 0x7f; - - return midisynth_writeraw(n, c, 3); -} - /* * Single point of midi destructions. */ @@ -1381,7 +1052,6 @@ midi_destroy(struct snd_midi *m, int midiuninit) free(MIDIQ_BUF(m->outq), M_MIDI); mtx_destroy(&m->qlock); mtx_destroy(&m->lock); - free(m->synth, M_MIDI); free(m, M_MIDI); return 0; } @@ -1464,65 +1134,5 @@ midi_modevent(module_t mod, int type, void *data) return retval; } -int -midimapper_open_locked(void *arg1, void **cookie) -{ - int retval = 0; - struct snd_midi *m; - - midistat_lockassert(); - TAILQ_FOREACH(m, &midi_devs, link) { - retval++; - } - - return retval; -} - -int -midimapper_open(void *arg1, void **cookie) -{ - int retval; - - midistat_lock(); - retval = midimapper_open_locked(arg1, cookie); - midistat_unlock(); - - return retval; -} - -int -midimapper_close(void *arg1, void *cookie) -{ - return 0; -} - -kobj_t -midimapper_fetch_synth_locked(void *arg, void *cookie, int unit) -{ - struct snd_midi *m; - int retval = 0; - - midistat_lockassert(); - TAILQ_FOREACH(m, &midi_devs, link) { - if (unit == retval) - return (kobj_t)m->synth; - retval++; - } - - return NULL; -} - -kobj_t -midimapper_fetch_synth(void *arg, void *cookie, int unit) -{ - kobj_t synth; - - midistat_lock(); - synth = midimapper_fetch_synth_locked(arg, cookie, unit); - midistat_unlock(); - - return synth; -} - DEV_MODULE(midi, midi_modevent, NULL); MODULE_VERSION(midi, 1); diff --git a/sys/dev/sound/midi/midi.h b/sys/dev/sound/midi/midi.h index 8becc20d35e6..286e84264ef3 100644 --- a/sys/dev/sound/midi/midi.h +++ b/sys/dev/sound/midi/midi.h @@ -51,10 +51,4 @@ int midi_uninit(struct snd_midi *_m); int midi_out(struct snd_midi *_m, uint8_t *_buf, int _size); int midi_in(struct snd_midi *_m, uint8_t *_buf, int _size); -int midimapper_open_locked(void *arg1, void **cookie); -int midimapper_open(void *arg1, void **cookie); -int midimapper_close(void *arg1, void *cookie); -kobj_t midimapper_fetch_synth_locked(void *arg, void *cookie, int unit); -kobj_t midimapper_fetch_synth(void *arg, void *cookie, int unit); - #endif diff --git a/sys/dev/sound/midi/synth_if.m b/sys/dev/sound/midi/synth_if.m deleted file mode 100644 index a763b3422bc6..000000000000 --- a/sys/dev/sound/midi/synth_if.m +++ /dev/null @@ -1,312 +0,0 @@ -#- -# Copyright (c) 2003 Mathew Kanner -# All rights reserved. -# -# 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. -# -# - -INTERFACE synth; - -#include - -CODE { - -synth_killnote_t nokillnote; -synth_startnote_t nostartnote; -synth_setinstr_t nosetinstr; -synth_hwcontrol_t nohwcontrol; -synth_aftertouch_t noaftertouch; -synth_panning_t nopanning; -synth_controller_t nocontroller; -synth_volumemethod_t novolumemethod; -synth_bender_t nobender; -synth_setupvoice_t nosetupvoice; -synth_sendsysex_t nosendsysex; -synth_allocvoice_t noallocvoice; -synth_writeraw_t nowriteraw; -synth_reset_t noreset; -synth_shortname_t noshortname; -synth_open_t noopen; -synth_close_t noclose; -synth_query_t noquery; -synth_insync_t noinsync; -synth_alloc_t noalloc; - - int - nokillnote(void *_kobj, uint8_t _chn, uint8_t _note, uint8_t _vel) - { - printf("nokillnote\n"); - return 0; - } - - int - noopen(void *_kobj, void *_arg, int mode) - { - printf("noopen\n"); - return 0; - } - - int - noquery(void *_kboj) - { - printf("noquery\n"); - return 0; - } - - int - nostartnote(void *_kb, uint8_t _voice, uint8_t _note, uint8_t _parm) - { - printf("nostartnote\n"); - return 0; - } - - int - nosetinstr(void *_kb, uint8_t _chn, uint16_t _patchno) - { - printf("nosetinstr\n"); - return 0; - } - - int - nohwcontrol(void *_kb, uint8_t *_event) - { - printf("nohwcontrol\n"); - return 0; - } - - int - noaftertouch ( void /* X */ * _kobj, uint8_t _x1, uint8_t _x2) - { - printf("noaftertouch\n"); - return 0; - } - - int - nopanning ( void /* X */ * _kobj, uint8_t _x1, uint8_t _x2) - { - printf("nopanning\n"); - return 0; - } - - int - nocontroller ( void /* X */ * _kobj, uint8_t _x1, uint8_t _x2, uint16_t _x3) - { - printf("nocontroller\n"); - return 0; - } - - int - novolumemethod ( - void /* X */ * _kobj, - uint8_t _x1) - { - printf("novolumemethod\n"); - return 0; - } - - int - nobender ( void /* X */ * _kobj, uint8_t _voice, uint16_t _bend) - { - printf("nobender\n"); - return 0; - } - - int - nosetupvoice ( void /* X */ * _kobj, uint8_t _voice, uint8_t _chn) - { - - printf("nosetupvoice\n"); - return 0; - } - - int - nosendsysex ( void /* X */ * _kobj, void * _buf, size_t _len) - { - printf("nosendsysex\n"); - return 0; - } - - int - noallocvoice ( void /* X */ * _kobj, uint8_t _chn, uint8_t _note, void *_x) - { - printf("noallocvoice\n"); - return 0; - } - - int - nowriteraw ( void /* X */ * _kobjt, uint8_t * _buf, size_t _len) - { - printf("nowriteraw\n"); - return 1; - } - - int - noreset ( void /* X */ * _kobjt) - { - - printf("noreset\n"); - return 0; - } - - char * - noshortname (void /* X */ * _kobjt) - { - printf("noshortname\n"); - return "noshortname"; - } - - int - noclose ( void /* X */ * _kobjt) - { - - printf("noclose\n"); - return 0; - } - - int - noinsync (void /* X */ * _kobjt) - { - - printf("noinsync\n"); - return 0; - } - - int - noalloc ( void /* x */ * _kbojt, uint8_t _chn, uint8_t _note) - { - printf("noalloc\n"); - return 0; - } -} - -METHOD int killnote { - void /* X */ *_kobj; - uint8_t _chan; - uint8_t _note; - uint8_t _vel; -} DEFAULT nokillnote; - -METHOD int startnote { - void /* X */ *_kobj; - uint8_t _voice; - uint8_t _note; - uint8_t _parm; -} DEFAULT nostartnote; - -METHOD int setinstr { - void /* X */ *_kobj; - uint8_t _chn; - uint16_t _patchno; -} DEFAULT nosetinstr; - -METHOD int hwcontrol { - void /* X */ *_kobj; - uint8_t *_event; -} DEFAULT nohwcontrol; - -METHOD int aftertouch { - void /* X */ *_kobj; - uint8_t _x1; - uint8_t _x2; -} DEFAULT noaftertouch; - -METHOD int panning { - void /* X */ *_kobj; - uint8_t _x1; - uint8_t _x2; -} DEFAULT nopanning; - -METHOD int controller { - void /* X */ *_kobj; - uint8_t _x1; - uint8_t _x2; - uint16_t _x3; -} DEFAULT nocontroller; - -METHOD int volumemethod { - void /* X */ *_kobj; - uint8_t _x1; -} DEFAULT novolumemethod; - -METHOD int bender { - void /* X */ *_kobj; - uint8_t _voice; - uint16_t _bend; -} DEFAULT nobender; - -METHOD int setupvoice { - void /* X */ *_kobj; - uint8_t _voice; - uint8_t _chn; -} DEFAULT nosetupvoice; - -METHOD int sendsysex { - void /* X */ *_kobj; - void *_buf; - size_t _len; -} DEFAULT nosendsysex; - -METHOD int allocvoice { - void /* X */ *_kobj; - uint8_t _chn; - uint8_t _note; - void *_x; -} DEFAULT noallocvoice; - -METHOD int writeraw { - void /* X */ *_kobjt; - uint8_t *_buf; - size_t _len; -} DEFAULT nowriteraw; - -METHOD int reset { - void /* X */ *_kobjt; -} DEFAULT noreset; - -METHOD char * shortname { - void /* X */ *_kobjt; -} DEFAULT noshortname; - -METHOD int open { - void /* X */ *_kobjt; - void *_sythn; - int _mode; -} DEFAULT noopen; - -METHOD int close { - void /* X */ *_kobjt; -} DEFAULT noclose; - -METHOD int query { - void /* X */ *_kobjt; -} DEFAULT noquery; - -METHOD int insync { - void /* X */ *_kobjt; -} DEFAULT noinsync; - -METHOD int alloc { - void /* x */ *_kbojt; - uint8_t _chn; - uint8_t _note; -} DEFAULT noalloc; diff --git a/sys/modules/sound/sound/Makefile b/sys/modules/sound/sound/Makefile index c62427e1622f..f3978e9bd9cc 100644 --- a/sys/modules/sound/sound/Makefile +++ b/sys/modules/sound/sound/Makefile @@ -13,8 +13,8 @@ SRCS+= feeder.c feeder_rate.c feeder_volume.c SRCS+= feeder_chain.c feeder_eq.c feeder_format.c SRCS+= feeder_matrix.c feeder_mixer.c SRCS+= feeder_eq_gen.h feeder_rate_gen.h snd_fxdiv_gen.h -SRCS+= mpu_if.h mpufoi_if.h synth_if.h -SRCS+= mpu_if.c mpufoi_if.c synth_if.c +SRCS+= mpu_if.h mpufoi_if.h +SRCS+= mpu_if.c mpufoi_if.c SRCS+= ac97.c buffer.c channel.c dsp.c SRCS+= mixer.c sndstat.c sound.c vchan.c SRCS+= midi.c mpu401.c From nobody Sun Jul 6 13:09:02 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkk4wdTz61RTR; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkk4B9bz447F; Sun, 06 Jul 2025 13:09:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k+/UN/yQYy2nWGqjtbp/GyYFUcokHDdZD1YMI1Hp4Uw=; b=Q5l5pVH8jwcLgWbVqksQLky+WcYCEvjh80SAYLRyNSAE/QxPD4WKYycyl2SXF+S70ONXyf CyNnGNJzBoW6T6BxmlVsKhA3huBoM91XOX6Zm3tx10lpT23eIGVtX4vnoHqyeMJrAtEW9d 0QPjyit/XCpu7w5v9nbui/9eGGk4Z0C+d/juG/GsWNdYf8Jyn9iPnkBYWM37AsteVSCq+h 3tElOlAtRllqrWRdKzZC8pZY942pYvBgZEgB/iWg4qVWNEGpF3maVKVTg9AOJczv6Z9B3p dt4edo46tgrcSca2djZngV53Il1MGthFSqEZRFqZiOE02yYiEG3yD8PS/sT/7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k+/UN/yQYy2nWGqjtbp/GyYFUcokHDdZD1YMI1Hp4Uw=; b=k07KnLCv/eUPWKY3e4pMG0qhtzJJjDd4XuUK2eWYp0b1MIMB82MD7o20XPJIjJWED52kW0 8ei2PjBVgz8VyQWU5nVg9Ys+H081wnkaZoKHDAL40mIqU0Kkh5CiIFTMvglWmXvebpgUvp hO99ynURFfs3aCUfrZlrVrflkK/2hEdR1JxZ0KRrjUIS5F6nbKtrhUo1Pg0AYA7Gzp18IT 2jUolK4jlwOiZmUvyHWWzc7KozkbAkY5ZMohcbv463TH6Tm5/HKKy8Wja1uc1AW0LuD3Wu boZabdk7D7unCrwquAxjTHOZCVOiM2VwfFRqscAT8U8xYUPtkz0fb6kA1XtcSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807342; a=rsa-sha256; cv=none; b=k8iKzWWVSzr3rQtEZ38pbB6WwjK05hrQjZ7kYDewrtwmlBzdc7t45DlT8gD3xjQwtAi7gW 3WnvdOocpI/Y4v/4KBIKSbxUPUnpVdbzMfIdbkxdbCV5Yn3uaH325cfNCPUJHX33zOslHw dRB9h+mNg9b88A0vo2uCQF52tLSb9Ph7asvBkDGjuRg08aBU3Fz10xID/9z8INewyydZRS Pr4HZz0dQQ0p7XTDnwk8tduU9jJNWJXU6H7j58wtZD7VbuRxFaDRGIhWPYAzmnnCER8PGM Z3px+ZY8HH2ruxyXdcqavGvb5SqQ9zqqDV9+PzOHPPukS4uOgln8VkAjXVjhcA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkk3mRmz1LlL; Sun, 06 Jul 2025 13:09:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D92V0083165; Sun, 6 Jul 2025 13:09:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D92lD083162; Sun, 6 Jul 2025 13:09:02 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:02 GMT Message-Id: <202507061309.566D92lD083162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 7f1426971e30 - main - sound: Retire /dev/midistat List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f1426971e302a50a6a992064b03a1951921b250 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=7f1426971e302a50a6a992064b03a1951921b250 commit 7f1426971e302a50a6a992064b03a1951921b250 Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:22 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:22 +0000 sound: Retire /dev/midistat This doesn't register all MIDI devices, for example USB ones, and is not widely used in the first place. In the future all MIDI devices will register to sndstat, where we already have defined a MIDI device type, but we haven't made use of it yet. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50610 --- sys/dev/sound/midi/midi.c | 145 +--------------------------------------------- 1 file changed, 2 insertions(+), 143 deletions(-) diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index bbb1ff3dd8dc..60d44bb6dbf1 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -140,32 +140,8 @@ struct snd_midi { TAILQ_HEAD(, snd_midi) midi_devs; -/* - * /dev/midistat variables and declarations, protected by midistat_lock - */ - struct sx mstat_lock; -static int midistat_isopen = 0; -static struct sbuf midistat_sbuf; -static struct cdev *midistat_dev; - -/* - * /dev/midistat dev_t declarations - */ - -static d_open_t midistat_open; -static d_close_t midistat_close; -static d_read_t midistat_read; - -static struct cdevsw midistat_cdevsw = { - .d_version = D_VERSION, - .d_open = midistat_open, - .d_close = midistat_close, - .d_read = midistat_read, - .d_name = "midistat", -}; - /* * /dev/rmidi dev_t declarations, struct variable access is protected by * locks contained within the structure. @@ -194,7 +170,6 @@ static struct cdevsw midi_cdevsw = { */ static int midi_destroy(struct snd_midi *, int); -static int midistat_prepare(struct sbuf * s); static int midi_load(void); static int midi_unload(void); @@ -203,8 +178,6 @@ static int midi_unload(void); */ SYSCTL_NODE(_hw, OID_AUTO, midi, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Midi driver"); -static SYSCTL_NODE(_hw_midi, OID_AUTO, stat, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, - "Status device"); int midi_debug; /* XXX: should this be moved into debug.midi? */ @@ -216,10 +189,6 @@ SYSCTL_INT(_hw_midi, OID_AUTO, dumpraw, CTLFLAG_RW, &midi_dumpraw, 0, ""); int midi_instroff; SYSCTL_INT(_hw_midi, OID_AUTO, instroff, CTLFLAG_RW, &midi_instroff, 0, ""); -int midistat_verbose; -SYSCTL_INT(_hw_midi_stat, OID_AUTO, verbose, CTLFLAG_RW, - &midistat_verbose, 0, ""); - #define MIDI_DEBUG(l,a) if(midi_debug>=l) a /* * CODE START @@ -896,104 +865,6 @@ midi_poll(struct cdev *i_dev, int events, struct thread *td) return (revents); } -/* - * /dev/midistat device functions - * - */ -static int -midistat_open(struct cdev *i_dev, int flags, int mode, struct thread *td) -{ - int error; - - MIDI_DEBUG(1, printf("midistat_open\n")); - - midistat_lock(); - if (midistat_isopen) { - midistat_unlock(); - return EBUSY; - } - midistat_isopen = 1; - sbuf_new(&midistat_sbuf, NULL, 4096, SBUF_AUTOEXTEND); - error = (midistat_prepare(&midistat_sbuf) > 0) ? 0 : ENOMEM; - if (error) - midistat_isopen = 0; - midistat_unlock(); - return error; -} - -static int -midistat_close(struct cdev *i_dev, int flags, int mode, struct thread *td) -{ - MIDI_DEBUG(1, printf("midistat_close\n")); - midistat_lock(); - if (!midistat_isopen) { - midistat_unlock(); - return EBADF; - } - sbuf_delete(&midistat_sbuf); - midistat_isopen = 0; - midistat_unlock(); - return 0; -} - -static int -midistat_read(struct cdev *i_dev, struct uio *uio, int flag) -{ - long l; - int err; - - MIDI_DEBUG(4, printf("midistat_read\n")); - midistat_lock(); - if (!midistat_isopen) { - midistat_unlock(); - return EBADF; - } - if (uio->uio_offset < 0 || uio->uio_offset > sbuf_len(&midistat_sbuf)) { - midistat_unlock(); - return EINVAL; - } - err = 0; - l = lmin(uio->uio_resid, sbuf_len(&midistat_sbuf) - uio->uio_offset); - if (l > 0) { - err = uiomove(sbuf_data(&midistat_sbuf) + uio->uio_offset, l, - uio); - } - midistat_unlock(); - return err; -} - -/* - * Module library functions - */ - -static int -midistat_prepare(struct sbuf *s) -{ - struct snd_midi *m; - - midistat_lockassert(); - - sbuf_printf(s, "FreeBSD Midi Driver (midi2)\n"); - if (TAILQ_EMPTY(&midi_devs)) { - sbuf_printf(s, "No devices installed.\n"); - sbuf_finish(s); - return sbuf_len(s); - } - sbuf_printf(s, "Installed devices:\n"); - - TAILQ_FOREACH(m, &midi_devs, link) { - mtx_lock(&m->lock); - sbuf_printf(s, "%s [%d/%d:%s]", m->name, m->unit, m->channel, - MPU_PROVIDER(m, m->cookie)); - sbuf_printf(s, "%s", MPU_DESCR(m, m->cookie, midistat_verbose)); - sbuf_printf(s, "\n"); - mtx_unlock(&m->lock); - } - - sbuf_finish(s); - return sbuf_len(s); -} - #ifdef notdef /* * Convert IOCTL command to string for debugging @@ -1056,19 +927,12 @@ midi_destroy(struct snd_midi *m, int midiuninit) return 0; } -/* - * Load and unload functions, creates the /dev/midistat device - */ - static int midi_load(void) { sx_init(&mstat_lock, "midistat lock"); TAILQ_INIT(&midi_devs); - midistat_dev = make_dev(&midistat_cdevsw, MIDI_DEV_MIDICTL, UID_ROOT, - GID_WHEEL, 0666, "midistat"); - return 0; } @@ -1081,9 +945,6 @@ midi_unload(void) MIDI_DEBUG(1, printf("midi_unload()\n")); retval = EBUSY; midistat_lock(); - if (midistat_isopen) - goto exit0; - TAILQ_FOREACH_SAFE(m, &midi_devs, link, tmp) { mtx_lock(&m->lock); if (m->busy) @@ -1091,10 +952,9 @@ midi_unload(void) else retval = midi_destroy(m, 1); if (retval) - goto exit1; + goto exit; } midistat_unlock(); - destroy_dev(midistat_dev); /* * Made it here then unload is complete @@ -1102,9 +962,8 @@ midi_unload(void) sx_destroy(&mstat_lock); return 0; -exit1: +exit: mtx_unlock(&m->lock); -exit0: midistat_unlock(); if (retval) MIDI_DEBUG(2, printf("midi_unload: failed\n")); From nobody Sun Jul 6 13:09:03 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkm16Tqz61Rf3; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkl5QtTz445X; Sun, 06 Jul 2025 13:09:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pVJxg96EnnvmSOZV9BNhJl0LIDlqWV5Md3Tcm4qqkHY=; b=j/dC80VMyUBg1wF8iguM3MiCj4qBp/oFzb2MOrsZVfAd3ZZcKGc1ZY0BWD964MtOD2b1Ih Y9QFymSfzwtudQaTkGdTv8j+l1dg0ompRZSF1Hpx5sZA/2Qk6VpmFboPgy5FBnfuz/zj3Z poBVa03tnO+/i61Bzf+4s4cBjog9mHwdqyuWsi1lDxPpon5Yf2YEfHJ2Q53M5FZicjWOQy yzbc+sIlCw/oF7hW/YhkTveh/X7+BaPRdHE5VuMv21kzZsbJkEtNcZOVHCF6KA9FGwedT3 wL40nrSjcIWXv/tpyeKJ/dZp+5Vryr+jwptNU0pxmYi+SPSzLWgNV+rAMcuIiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pVJxg96EnnvmSOZV9BNhJl0LIDlqWV5Md3Tcm4qqkHY=; b=V5I4MiqxcFatS3xaiO0EeFW63mCidls93AIJ+QUs05BpAxAXwC52Ft0jsS+EiZj6bH9Vd/ wXUAxIflFxm7H9AFXV+wK7uOq+7Xa8ER52CEEh1dk1my83BrwV74nSAFHpRWhPIzyP3rLb XTj0FxotJYlrANjH8acO9s1c0ODzQrG1DYXznc4pfER0TSL1LHtE3SewMdfPdRuDhAqGBD iOOb9bVndFPpmmJQd5xsUh6J2Q2PjNygBORVCZF5g5/PDoiwcwH+XTs2Fgk65CESR7QEZL TmrsghJIx+LqBeZFZ+o2voh9O8GZTFjNNm2G8VE57kJG4OFPJJaBa0IxL962qw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807343; a=rsa-sha256; cv=none; b=pKG6OZLlPfOH6WiZkzI66zCJKkaG9UR5WU7AZ35ng4HjYjs3Y5If1Qh83XEeii/XlDl1Rg AZLxb7gqNQvSij1z7RgHZrU8kFAY2z+B1Qm44jXSddZxV4NKlo7+auXEVyakJRKVsTPn2r DPi57r7W7/+opoyfKso/xuBnFrWGf5IjFNGzcXnU2621ozn5gci/D8t4jzcvFKysK1i1qz 9Wr+5Q29Ub8b8dvskN6QxLa0rsqT4B0g+mkj/fpzgDUrSXq7/D1Ca3Cf6tqk39nfQP/M2f hHC2FUlGSW4pQxftTQiGKhXZi+h24d0p53rrZ3HgRVdmQOB/WUvQy1yNwAvljQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkl4j26z1LSG; Sun, 06 Jul 2025 13:09:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D93BM083206; Sun, 6 Jul 2025 13:09:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D93Uo083203; Sun, 6 Jul 2025 13:09:03 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:03 GMT Message-Id: <202507061309.566D93Uo083203@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 0ca9410eab24 - main - sound: Retire unused MIDI sysctls List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ca9410eab24f5905a235bf1e283f543333a0d15 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=0ca9410eab24f5905a235bf1e283f543333a0d15 commit 0ca9410eab24f5905a235bf1e283f543333a0d15 Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:26 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:26 +0000 sound: Retire unused MIDI sysctls Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50611 --- sys/dev/sound/midi/midi.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index 60d44bb6dbf1..bbdd8facd6cc 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -183,12 +183,6 @@ int midi_debug; /* XXX: should this be moved into debug.midi? */ SYSCTL_INT(_hw_midi, OID_AUTO, debug, CTLFLAG_RW, &midi_debug, 0, ""); -int midi_dumpraw; -SYSCTL_INT(_hw_midi, OID_AUTO, dumpraw, CTLFLAG_RW, &midi_dumpraw, 0, ""); - -int midi_instroff; -SYSCTL_INT(_hw_midi, OID_AUTO, instroff, CTLFLAG_RW, &midi_instroff, 0, ""); - #define MIDI_DEBUG(l,a) if(midi_debug>=l) a /* * CODE START From nobody Sun Jul 6 13:09:04 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkn68ttz61RWj; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkn0hNVz449S; Sun, 06 Jul 2025 13:09:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Qxd5VwH7kvdyVMdQ/Gsj5v9zsBIFq4ta/OVXOs7D0Q=; b=sL6ac4m8RwBbcuUiqufmXHuQKN98AYl21WUwdnw400xPlAnWBBloFEG7qFAHycu64qfgqv tYZd8/4JEvX8zaZvt5al2iQXwWhOqwL0TAUBDry1PpE2AKwn4rR2kiRlA3SpPp7CHEZEH9 /c2xgzH/lnZIBP/6nwFbZcfwUdui1p7XH40hO7yWRWo98/4160LbhkOAoWDVQgfWyXw1B1 9QdNZK7fbQPuUsYMiFFQt+Z3ilKEvvVTgvxOT8vF+8216ijgD3atCXZdIVfteHrgjFN1Ic 6KkHIE80PCM6X0bFGTjpOselk4etn37Y0PGEum4PWCyQVFlW6/19wvdJKXg+AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Qxd5VwH7kvdyVMdQ/Gsj5v9zsBIFq4ta/OVXOs7D0Q=; b=qh60RPCiix/naJDRwR6ZXjNH1NEceTxYOVCRqOGP0eybW1QCxyKnOnppZKuRQCFqSWMnNx /OafMiVGtY36skZoCziYe+itGUP1eTnB9d4IYGl90LSUFJbf77ONU4POVosMU4HDGHg2S8 qnkm4iAUOhsnIiEb4KyJWAjNEiC43HWmq53NiRWxDwSEGpzVn+72yx9QNi7DsLoBFypdGK 6s+fqN1RpV3IBzFa68LggORKGfqrjA/yGSJCLmxslHuZKnb+Gj44eXtIBt5TwXqKc0C1Vw pbDVbcGpZ8dgmvGRRe8ZLpOQ0X9lkbw4HAcW7Qb0eyOfNq/ze7FxVjFjiQrlXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807345; a=rsa-sha256; cv=none; b=E0lIcjf6XLQFG12skb+9TpxNVyvWs6mMkz9ChG4GcdqxHvjMscNqqf9O49J3+Dq71PZu6T GgoXpLjGGQ6f1mClvE8ZQUkhgQy3mq5KYuNj73yxxbLseQlMvtBXkVDaFuaHGtL8OgldFz GIur43BXb7WRV4quVPfntEc0onUwwJ8Y4Z8nPko99IWlAomWH+vY7wpZ/WtPmF4Uwf3nZw iGA6Nb2ekK5cHq9CahXC0u0EfRq34RwJ2KyJN+v6uAIC299br1xUEXi6mRP2oizc9ibRmq AmA3F91ptHG8e1wpq93rfY/OR7ABiGpGr/GlzNkQy14oHj+TGv0U+DKLhaozOQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkm5Yndz1LSH; Sun, 06 Jul 2025 13:09:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D94Sl083240; Sun, 6 Jul 2025 13:09:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D94cG083237; Sun, 6 Jul 2025 13:09:04 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:04 GMT Message-Id: <202507061309.566D94cG083237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: fa20737ed1b7 - main - sound: Remove unused mpu_if methods List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa20737ed1b7973062ec503b43857d7af0443070 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=fa20737ed1b7973062ec503b43857d7af0443070 commit fa20737ed1b7973062ec503b43857d7af0443070 Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:30 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:30 +0000 sound: Remove unused mpu_if methods Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50612 --- sys/dev/sound/midi/mpu401.c | 17 ----------------- sys/dev/sound/midi/mpu_if.m | 11 ----------- 2 files changed, 28 deletions(-) diff --git a/sys/dev/sound/midi/mpu401.c b/sys/dev/sound/midi/mpu401.c index 2be285bc0040..9dc9c4d27750 100644 --- a/sys/dev/sound/midi/mpu401.c +++ b/sys/dev/sound/midi/mpu401.c @@ -88,8 +88,6 @@ static int mpu401_minqsize(struct snd_midi *, void *); static int mpu401_moutqsize(struct snd_midi *, void *); static void mpu401_mcallback(struct snd_midi *, void *, int); static void mpu401_mcallbackp(struct snd_midi *, void *, int); -static const char *mpu401_mdescr(struct snd_midi *, void *, int); -static const char *mpu401_mprovider(struct snd_midi *, void *); static kobj_method_t mpu401_methods[] = { KOBJMETHOD(mpu_init, mpu401_minit), @@ -98,8 +96,6 @@ static kobj_method_t mpu401_methods[] = { KOBJMETHOD(mpu_outqsize, mpu401_moutqsize), KOBJMETHOD(mpu_callback, mpu401_mcallback), KOBJMETHOD(mpu_callbackp, mpu401_mcallbackp), - KOBJMETHOD(mpu_descr, mpu401_mdescr), - KOBJMETHOD(mpu_provider, mpu401_mprovider), KOBJMETHOD_END }; @@ -281,16 +277,3 @@ mpu401_mcallbackp(struct snd_midi *sm, void *arg, int flags) /* printf("mpu401_callbackp\n"); */ mpu401_mcallback(sm, arg, flags); } - -static const char * -mpu401_mdescr(struct snd_midi *sm, void *arg, int verbosity) -{ - - return "descr mpu401"; -} - -static const char * -mpu401_mprovider(struct snd_midi *m, void *arg) -{ - return "provider mpu401"; -} diff --git a/sys/dev/sound/midi/mpu_if.m b/sys/dev/sound/midi/mpu_if.m index b7cb586c5dd0..835d887f703a 100644 --- a/sys/dev/sound/midi/mpu_if.m +++ b/sys/dev/sound/midi/mpu_if.m @@ -56,17 +56,6 @@ METHOD void callback { int _flags; }; -METHOD const char * provider { - struct snd_midi *_kobj; - void *_cookie; -}; - -METHOD const char * descr { - struct snd_midi *_kobj; - void *_cookie; - int _verbosity; -}; - METHOD int uninit { struct snd_midi *_kobj; void *_cookie; From nobody Sun Jul 6 13:09:06 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkq5kVXz61Rbw; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkq0qfXz44Lp; Sun, 06 Jul 2025 13:09:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oKgqkdJ2I6AR0US7r8/HgY/bKtC+MvepA1XWJXC3zk0=; b=rhEcIZcVu+FoLNpxPAbdmdE4zBX6OiX4aI8+tNvdj4SIbm420EF4/M4q8KjrPNZhadjLXH 7LPWvFiSxhHw7DUeTT8N0tK0D40jw4SzflWD8e9jEp/vruOoRKhYTydthdtTfbXI/W0Yhg O+0AbwvDc7qZOD0JHgtykLsJJXxUFhR1EHyCaiaLxH+yBQyxNik5z2wB9a7bOMKsHLYsDr GqpedX3DDK9okD1aHkNAlBuVOOiZQmOLZhzXpMJfKpYEhOw8yuITSXh7RVuw48m/j9RpUy ciT6hPFdf6o15HPZbLyvZQuXNtLFPYCzXipV/1pbIuocNrFs4Ke/cwLmgMP9BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oKgqkdJ2I6AR0US7r8/HgY/bKtC+MvepA1XWJXC3zk0=; b=RwY24ROxn1qu9IEmS2MakJHG1R5U/5HF0UC4ZmoKr/ABxclOq4Jt0vzwdk/N8gDJkz/Vc2 3DmEQ+n+IliNdGUNi/jouslJ+kzBi5ka/Z2yEr04/DBV0TbUI0Jnjb7NKnKBNxNeXXQJxa ovLtQHFzB/L+wxHclXUH6YF8BRm1sUPknNZ1TmjWIvXJ4h+gFynEl4YhgK2yqnSqsv00Nr jGGaqdm4wqyvB1bkLpmaGrFkodm+3S6VqYikWBMkLMuFPZ0JE1j7mBoTiuAO9bGi0+TM+l urWyGlAVHkHFsp3RUL7Zb4L6AE2KhpyAAlyl/4Dt0IIbE1VuL922KGHPNE6zAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807347; a=rsa-sha256; cv=none; b=Je/qJSJq91j1rQcKs/zsNQgwuwWIk9gyu3/WxYHChMEflf3E3KU8/i8CAodJDXmARs+jOY +bZz5VoCqU8NTRgiZHFboWXfKApoUHXUAr2iucZUYEMQ+JjyWWGCftpSBiLpDL5RurJ487 khnr9QWCvbOLsN5DtRk5rOXl7krp/6fILyuGILQHxRF7J26XkU/GtNJ6tjvBXhiLoC/05B v9i34wWyXiskEm/pptqJ7cuaLo6+7bUYlbq2LGoGnlFoVyPMmdPDeGkjsBNNLztVEh+cA8 VB7pMYRKzNcjxLN+ts8EeDFR+FZde+lj0n9w8oPzm9DZv8nLOcKZN1Rsu0aSnA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkq0Lg8z1Lcs; Sun, 06 Jul 2025 13:09:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D96xX083306; Sun, 6 Jul 2025 13:09:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D96Vv083303; Sun, 6 Jul 2025 13:09:06 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:06 GMT Message-Id: <202507061309.566D96Vv083303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: c566edbceb69 - main - sound: Remove unnecessary comments from midi/midi.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c566edbceb6925a72c80c3d562e9f2c659449686 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=c566edbceb6925a72c80c3d562e9f2c659449686 commit c566edbceb6925a72c80c3d562e9f2c659449686 Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:37 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:37 +0000 sound: Remove unnecessary comments from midi/midi.c Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50615 --- sys/dev/sound/midi/midi.c | 74 ++++------------------------------------------- 1 file changed, 6 insertions(+), 68 deletions(-) diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index 0fd8fec92658..d1f06028035e 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -30,12 +30,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ - /* - * Parts of this file started out as NetBSD: midi.c 1.31 - * They are mostly gone. Still the most obvious will be the state - * machine midi_in - */ - #include #include #include @@ -78,10 +72,6 @@ enum midi_states { MIDI_IN_START, MIDI_IN_SYSEX, MIDI_IN_DATA }; -/* - * /dev/rmidi Structure definitions - */ - #define MIDI_NAMELEN 16 struct snd_midi { KOBJ_FIELDS; @@ -110,36 +100,10 @@ struct snd_midi { TAILQ_ENTRY(snd_midi) link; }; -/* - * Module Exports & Interface - * - * struct midi_chan *midi_init(MPU_CLASS cls, int unit, int chan, - * void *cookie) - * int midi_uninit(struct snd_midi *) - * - * 0 == no error - * EBUSY or other error - * - * int midi_in(struct snd_midi *, char *buf, int count) - * int midi_out(struct snd_midi *, char *buf, int count) - * - * midi_{in,out} return actual size transfered - * - */ - -/* - * midi_devs tailq, holder of all rmidi instances protected by midistat_lock - */ - TAILQ_HEAD(, snd_midi) midi_devs; struct sx mstat_lock; -/* - * /dev/rmidi dev_t declarations, struct variable access is protected by - * locks contained within the structure. - */ - static d_open_t midi_open; static d_close_t midi_close; static d_ioctl_t midi_ioctl; @@ -158,17 +122,10 @@ static struct cdevsw midi_cdevsw = { .d_name = "rmidi", }; -/* - * Prototypes of library functions - */ - static int midi_destroy(struct snd_midi *, int); static int midi_load(void); static int midi_unload(void); -/* - * Misc declr. - */ SYSCTL_NODE(_hw, OID_AUTO, midi, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Midi driver"); @@ -177,9 +134,6 @@ int midi_debug; SYSCTL_INT(_hw_midi, OID_AUTO, debug, CTLFLAG_RW, &midi_debug, 0, ""); #define MIDI_DEBUG(l,a) if(midi_debug>=l) a -/* - * CODE START - */ void midistat_lock(void) @@ -208,9 +162,6 @@ midistat_lockassert(void) * what unit number is used. * * It is an error to call midi_init with an already used unit/channel combo. - * - * Returns NULL on error - * */ struct snd_midi * midi_init(kobj_class_t cls, int unit, int channel, void *cookie) @@ -324,9 +275,7 @@ err0: * midi_uninit does not call MIDI_UNINIT, as since this is the implementors * entry point. midi_uninit if fact, does not send any methods. A call to * midi_uninit is a defacto promise that you won't manipulate ch anymore - * */ - int midi_uninit(struct snd_midi *m) { @@ -359,13 +308,6 @@ exit: return err; } -/* - * midi_in: process all data until the queue is full, then discards the rest. - * Since midi_in is a state machine, data discards can cause it to get out of - * whack. Process as much as possible. It calls, wakeup, selnotify and - * psignal at most once. - */ - #ifdef notdef static int midi_lengths[] = {2, 2, 2, 2, 1, 1, 2, 0}; @@ -379,6 +321,12 @@ static int midi_lengths[] = {2, 2, 2, 2, 1, 1, 2, 0}; #define MIDI_SYSEX_START 0xF0 #define MIDI_SYSEX_END 0xF7 +/* + * midi_in: process all data until the queue is full, then discards the rest. + * Since midi_in is a state machine, data discards can cause it to get out of + * whack. Process as much as possible. It calls, wakeup, selnotify and + * psignal at most once. + */ int midi_in(struct snd_midi *m, uint8_t *buf, int size) { @@ -546,9 +494,6 @@ midi_out(struct snd_midi *m, uint8_t *buf, int size) return used; } -/* - * /dev/rmidi#.# device access functions - */ int midi_open(struct cdev *i_dev, int flags, int mode, struct thread *td) { @@ -853,10 +798,6 @@ midi_poll(struct cdev *i_dev, int events, struct thread *td) } #ifdef notdef -/* - * Convert IOCTL command to string for debugging - */ - static char * midi_cmdname(int cmd) { @@ -943,9 +884,6 @@ midi_unload(void) } midistat_unlock(); - /* - * Made it here then unload is complete - */ sx_destroy(&mstat_lock); return 0; From nobody Sun Jul 6 13:09:05 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkp3RPGz61RYl; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkp0LMSz44GZ; Sun, 06 Jul 2025 13:09:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dR7GNRviUOkcd64RwyEp98wEe/wr06yVKGs9CHAfWYc=; b=ssCLhUmOFviNdKnQ9P8ebmJQHiYvEFXoSq37A1E4JhEfEdxw5AT9r+XyL0z85QgHeqZjbx HywybcR+QZhhBwcn2sJxN+TIB3/VmRGDIpgihXjFR/qQEzL9PZ6kj7eWVsGzYfD2pAco5T 5rRmZ1P5E4jgEqcYdiXRkzE88r9pgFyH3+aOvyEbtnzlKx9hQsFbSbDYUegOvKWzKCXfy7 5lWJrkyDHKS7XtXm2vC3v34OhIvOibr7JXmyGGn0tRgn5ebVqZSlxUpTgtaDYD0kX7VLCS caoPYEVp5sHHf7SwPSjbWrcH0y6xxIFtU4AhNhYN6Qb/2NYyeiGM6KoBLB89sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dR7GNRviUOkcd64RwyEp98wEe/wr06yVKGs9CHAfWYc=; b=FYBmeN5Omtv/u/m0XNFJzJc7dNDVasydugSBgDa8SZrvO9ocdcmo+O6nkBU1yvroxApymx I+iRuJL457lJ1q/IyFznk8GlJ5geVvDAUFboBKPNFdQijPVDIdLCAXi2NzmiJDTqP8Feg9 NoVwWfM4jKpWX+hLwI2lIhuPkZNUMi7R3QQvPqU5u1rTjLL8mI97L0VJ+qOFIoAKwHA1zI bstoNpCuHcrZI3f6Ic3da+5KygKziNErFdIBu6aTuXdjZ7ZdTFscs7ILlfcjLzqXCLlqmn J22whmUMj2OX6g65cHLgrUUXZ4Zlt+Ei4LluBMTz1V5SLMQIo55WrumzEeGZWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807346; a=rsa-sha256; cv=none; b=bsud5L65yNdWOoMyV8sn6GVvJRV17FX//zvPX7MixdfVC+u1VG7UTUKbYg90e0/sk5acrD Vk11ckkGJhuUTfJr3F+E7J+PLroI1gkzaAnTgyPE09OWP4Do0RFoxbwzJMOTEQNxXnw5Qo Su0Pu9ZU79QCgLcYOe34+zNBJ88tvP1V8mSJhAmmiTWIxJcaeRq89OYevpBSSieux6SzL2 dtcgrOgv/2CdT3K2BPrvoCJX91uwe1y4+N6OICNQTnm+UVRO5b5B612MGEpcTgvzhApbr7 8m0u+wU5u/23dqRROMwVuwZ9q0Bw87KDlnC/cGVdJnFTfQ1Ah/3pmko9XU8cMQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkn6Zj2z1LZC; Sun, 06 Jul 2025 13:09:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D95Fo083273; Sun, 6 Jul 2025 13:09:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D95Rn083270; Sun, 6 Jul 2025 13:09:05 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:05 GMT Message-Id: <202507061309.566D95Rn083270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 17b38023ea25 - main - sound: Remove duplicate mpu_if.h include List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17b38023ea253c3a876284230521eff6ce2deadf Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=17b38023ea253c3a876284230521eff6ce2deadf commit 17b38023ea253c3a876284230521eff6ce2deadf Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:34 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:34 +0000 sound: Remove duplicate mpu_if.h include Sponsored by: The FreeBSD Foundation Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D50613 --- sys/dev/sound/midi/midi.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index bbdd8facd6cc..0fd8fec92658 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -78,13 +78,6 @@ enum midi_states { MIDI_IN_START, MIDI_IN_SYSEX, MIDI_IN_DATA }; -/* - * The MPU interface current has init() uninit() inqsize() outqsize() - * callback() : fiddle with the tx|rx status. - */ - -#include "mpu_if.h" - /* * /dev/rmidi Structure definitions */ From nobody Sun Jul 6 13:09:09 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnks4tNhz61RTd; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnks2knLz44PT; Sun, 06 Jul 2025 13:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ML5al0NqFbrGGGhcntK524dr0a0xtzrMPXbitX2BYT8=; b=SjWe+pjqL7fl9FwdSC34CkTma3NC1t5ReesA+0i8P7MuxfXx60zytfx6T7EVFHr+AreRx3 Lr1pzZcevA3juKI1qqf5YeZxZUwVd79fBdP6kBT5f/3zqFGQJfdQePcfrhf2eD9jM1jiml JcMdtCSqQOG3qxdpAI/asX23B1cghKuYofHIJr9hF+C5GrCwBnlvAg66F7BuruOatW5LsE LLwph8cDJJX5MWtxY7TdvnGWU9ZTuBdjdLx2Rb+sk6Qfc3n6Umb0pWgr7ywVxCFbA69D35 wRqBJkiWRIKnMXoaS1y/lB79E6bP0puQDlzf3gJb626Xqs4BQwnnxOb/qnpXcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ML5al0NqFbrGGGhcntK524dr0a0xtzrMPXbitX2BYT8=; b=TcGG7kkKmrIXGEaMnTIDNLfdoZidB47Y49in87buFXqMdwFvZiaMy/xBkORye6qAZwJAva KGhLrvEcSPkaYHocrwcww3cedbi3Qbfd+z3edy7Jv32foz3nA2aF1KvGGOCnjM3dgWFc8E o/Vo1jG6T1485PT9VNSc0y2LAswj8wWYMNzZnhJJ/PLiQsp3cX/eDB6O3whdPZuduFjqzx M/YcTziY3PUzPoCWYxAX0Bzdbsk//vIzUhRsZOYB8ylsb3jCv7WBLDtc232fzVqOFPUmHG 0aXGOIiJTEpX52v6HlBIGYtqHSr+SxBPdtYDOgGaygyT8jZXChrp0t8KHurdHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807349; a=rsa-sha256; cv=none; b=BIfww4TTD240a9mIBGBkI/Xhlu6r21vghVhASVDs8dOhU4G4wu+Mh4mhTancwofZYHmPhh zli7CwdjLnMYTfjSulzwntPhG+YJtCBYfaVRBb4+aPIONtwL0t4GLUFTbHMa0rGvuPHxdw iFNDRDtDRNB7rEX10gZAMSUC4WkQxTNhlC376EsrNa2HdModvBiKQBaWlGeLLV7knKMV/Z 9kyhxmDyrHiTm2CaFnj1Nqy6AlgDIjePEMN9TIp5/1hkqapvffq+nbFW0mEVQgCzAHxx16 NQ6SM/dt9I5CJYXqHOzCot6PHDEx50t7H8ZfaU/vog79XDAqScs+zMCHyOm83Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnks2JCdz1Lcv; Sun, 06 Jul 2025 13:09:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D99Nt083373; Sun, 6 Jul 2025 13:09:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D99wl083370; Sun, 6 Jul 2025 13:09:09 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:09 GMT Message-Id: <202507061309.566D99wl083370@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 92336491ccc2 - main - sound: Remove dead printfs from midi/mpu401.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92336491ccc2115a3c81a2c6442ddb6c53c3e378 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=92336491ccc2115a3c81a2c6442ddb6c53c3e378 commit 92336491ccc2115a3c81a2c6442ddb6c53c3e378 Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:46 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:46 +0000 sound: Remove dead printfs from midi/mpu401.c Sponsored by: The FreeBSD Foundation Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D50617 --- sys/dev/sound/midi/mpu401.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/sys/dev/sound/midi/mpu401.c b/sys/dev/sound/midi/mpu401.c index 9dc9c4d27750..224ebb1b01f4 100644 --- a/sys/dev/sound/midi/mpu401.c +++ b/sys/dev/sound/midi/mpu401.c @@ -118,24 +118,12 @@ mpu401_intr(struct mpu401 *m) int i; int s; -/* - printf("mpu401_intr\n"); -*/ #define RXRDY(m) ( (STATUS(m) & MPU_INPUTBUSY) == 0) #define TXRDY(m) ( (STATUS(m) & MPU_OUTPUTBUSY) == 0) -#if 0 -#define D(x,l) printf("mpu401_intr %d %x %s %s\n",l, x, x&MPU_INPUTBUSY?"RX":"", x&MPU_OUTPUTBUSY?"TX":"") -#else -#define D(x,l) -#endif i = 0; s = STATUS(m); - D(s, 1); while ((s & MPU_INPUTBUSY) == 0 && i < MPU_INTR_BUF) { b[i] = READ(m); -/* - printf("mpu401_intr in i %d d %d\n", i, b[i]); -*/ i++; s = STATUS(m); } @@ -144,15 +132,9 @@ mpu401_intr(struct mpu401 *m) i = 0; while (!(s & MPU_OUTPUTBUSY) && i < MPU_INTR_BUF) { if (midi_out(m->mid, b, 1)) { -/* - printf("mpu401_intr out i %d d %d\n", i, b[0]); -*/ WRITE(m, *b); } else { -/* - printf("mpu401_intr write: no output\n"); -*/ return 0; } i++; @@ -258,13 +240,7 @@ static void mpu401_mcallback(struct snd_midi *sm, void *arg, int flags) { struct mpu401 *m = arg; -#if 0 - printf("mpu401_callback %s %s %s %s\n", - flags & M_RX ? "M_RX" : "", - flags & M_TX ? "M_TX" : "", - flags & M_RXEN ? "M_RXEN" : "", - flags & M_TXEN ? "M_TXEN" : ""); -#endif + if (flags & M_TXEN && m->si) { callout_reset(&m->timer, 1, mpu401_timeout, m); } @@ -274,6 +250,5 @@ mpu401_mcallback(struct snd_midi *sm, void *arg, int flags) static void mpu401_mcallbackp(struct snd_midi *sm, void *arg, int flags) { -/* printf("mpu401_callbackp\n"); */ mpu401_mcallback(sm, arg, flags); } From nobody Sun Jul 6 13:09:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkr5WVTz61RhV; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkr1wp0z44Rw; Sun, 06 Jul 2025 13:09:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1rZtEd+aNznCBikhH4SR2asg97pn2a8hX5U31UADKqs=; b=fIvQm3YuzmEqDEjP2M/5E9RDcrkux+4tXCgHuoh5Oaspy4+5CjHgPCsQvO+QdtwHb9NknJ LyPSId7bwJdoUVqE6zncKIeFKVLgD5nvBTAq9VTrXcSqiT36w4OwOYbMl/WmObMCTb7Hxc +Wqh30ULN9qxLN0/VTdFu79vx2sHN7ORvY3d6taOvGt3Lz18oPynuj3OrA4MmRrB67kVuW cfrYkXyCmmvCCigvTBiQUKgEMect9U1nhfrfxxD+SpUqXjH3mTcin/K5/PElM2Q1S78qnB QnDv/NxYbD7Ql/LCU2tSmATLbeXQQU+vjdluT0GRHdILg++S4USeaPgvJz/g4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1rZtEd+aNznCBikhH4SR2asg97pn2a8hX5U31UADKqs=; b=wvmvOm0MBHV1+UN+iDvQtyl3ljh3JpI3y7aSoI6grT4ovQY1z10ZBb23BpxO9EmV10dDSM OeZxTTmaNhH7KPAKmAkeuACNv9IO9IwZSt7nvqjXL+IRr02Wvh9HwnQC3Rh3ylecJVDpEP RAebvJpa4FJ/kVxszKzLVjjcDjzarGs5T8E+4A1yeVz0ZU5SO4UjaeQRYIHlOCsF1oizlC jI4r//wz3Z6tZiHv7rE7wLjBr1xzAKTD7TCfuvVb9Wb8eF7oig1l8aiqV5eJlvJd0eMHPl +gUr48YUPcji7oZ5OPNSfXTn8aitXZDvaHwl6PHgwY+eTD2GpY2lQP1s8Lws3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807348; a=rsa-sha256; cv=none; b=i+7alSWGlx+P5zCU4owXs7z09o4YfSDEf7ZKV/NZnkQf8ktLHEE5j1B8dZmfKuR7zNWPTb RNV5OpURleYNCPLJR5zGhwa/6C5w3uZ+kXVPWs3ATgLXezScRJMxAUwjmFDdLUbRgbzh+4 1nxNz6XMAIQwh03OHXP/YLSDBgvurdYkG/E9zhSEbyEsRHf/3nP5yuKE+fiwfBhmA0bgMN DT5zVjUQQi2/5aQX8dtp6X6Ha33RG19gGqGK9d7ubgM1fqD84SAYoUoo3GwB93pWcV3EN5 0yY+5DWZYH+DIXxr04Ob5Dv5d3V03pu8217KEh1hZpA94mKYoqLrHNcniqSQvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkr1GzPz1Lct; Sun, 06 Jul 2025 13:09:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D98SP083339; Sun, 6 Jul 2025 13:09:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D98in083336; Sun, 6 Jul 2025 13:09:08 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:08 GMT Message-Id: <202507061309.566D98in083336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 9a138abb21e1 - main - sound: Remove unused midi_cmdname() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a138abb21e17cabb8823f2cefab983d2926d82b Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=9a138abb21e17cabb8823f2cefab983d2926d82b commit 9a138abb21e17cabb8823f2cefab983d2926d82b Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:42 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:42 +0000 sound: Remove unused midi_cmdname() Sponsored by: The FreeBSD Foundation Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D50616 --- sys/dev/sound/midi/midi.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index d1f06028035e..6753f864ba9c 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -797,40 +797,6 @@ midi_poll(struct cdev *i_dev, int events, struct thread *td) return (revents); } -#ifdef notdef -static char * -midi_cmdname(int cmd) -{ - static struct { - int cmd; - char *name; - } *tab, cmdtab_midiioctl[] = { -#define A(x) {x, ## x} - /* - * Once we have some real IOCTLs define, the following will - * be relavant. - * - * A(SNDCTL_MIDI_PRETIME), A(SNDCTL_MIDI_MPUMODE), - * A(SNDCTL_MIDI_MPUCMD), A(SNDCTL_SYNTH_INFO), - * A(SNDCTL_MIDI_INFO), A(SNDCTL_SYNTH_MEMAVL), - * A(SNDCTL_FM_LOAD_INSTR), A(SNDCTL_FM_4OP_ENABLE), - * A(MIOSPASSTHRU), A(MIOGPASSTHRU), A(AIONWRITE), - * A(AIOGSIZE), A(AIOSSIZE), A(AIOGFMT), A(AIOSFMT), - * A(AIOGMIX), A(AIOSMIX), A(AIOSTOP), A(AIOSYNC), - * A(AIOGCAP), - */ -#undef A - { - -1, "unknown" - }, - }; - - for (tab = cmdtab_midiioctl; tab->cmd != cmd && tab->cmd != -1; tab++); - return tab->name; -} - -#endif /* notdef */ - /* * Single point of midi destructions. */ From nobody Sun Jul 6 13:09:10 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZnkv06HGz61RYy; Sun, 06 Jul 2025 13:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZnkt3lmvz448G; Sun, 06 Jul 2025 13:09:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WYvnoWP58DIGeF38+BqOT/QXPCktkaYB488vPIKgEzs=; b=AnZTc8Jp+M/RYlhe3eN0BisXATjyt5XoEpzyyKYUiWvficsC056cHdnKIaHqCKPSsXM2BJ xqrCW+Mk0xCuOYpe61L8A/KjRfVjQwrRBKNeI5LJ/f3R2Zo7T7rxqXxAsCYGMxjb7LU7tm oE2w+7ae1Lwv4TFuF+JS7ruKCQaD6JPuSRzj+yt2v1J3QiDRuIpoyL0UF62OUC48Y4rFen JqnTUGCuHivTvgJl4dhb3k7AsQjB2l/rfqeHVwbrQcHTvDRR97agrik/dIR5Y6qF/l17he DyHwcKUQpf/FbVYk15TfHwHqj/WRpvJQrDZ1ot+AK4UwZi0X6NXYlRcFcxeAVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751807350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WYvnoWP58DIGeF38+BqOT/QXPCktkaYB488vPIKgEzs=; b=Dmabsq2YoB/VPkAmB0O1bCYk1+7IiupMShmu4AUXHQBBb3app7Xqnpap3tR35ksDQUx45v xbY2nUigIZhMBEGo74ds8LFjYb640/KmkH+TJDWfgypB715guyo5TRfV9PX0FWlMPnTGSf Zm0EWR3gDqgbQDmZ3MeiNqvVbVdMtM165hPtWXQxK0dW0z4LWPzp9XwPqN/3ktYzl/cGTT 2aE87P8Z9egVSwvjkvRUaxNg50Zfn4/RuT5ivA5oxkY9Hrc76Tm0ehDDZ7onFpBj08Mh6f I3VaSciAn7I49fzdGLY8fDCR1B63T/MtNkVUhMxgSe1FGg1pCmgYMWPkX5vZCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751807350; a=rsa-sha256; cv=none; b=s2g8GpjDZheL/wwjipwDUvI9nLi0ZnwxGNBifluaBIB/kJdJlT8hCCEHXTTE5Z6kRjuxQU kbJFAEGMTzWkBRLQmCrMm6sECR6ZgcrVHp5TXpUP+47SmItmHZ45QMcp+4GB6nTqbYvBu0 H6gieE3fpVCwXOVE+YQ8c9WDpnP6zxjgDu5UromzFgolh//3Qyfr9Qq76VDp1CL2+CuoQI nEEwTI/C4DRRlEsw0neiZp3hrZU8iKH1aT6siCyLXwkUuAGB5b6TS6FI7iFAJXeIWhaccW /4Mqe3nJ4nXKZLwJHHMFXMcECV359u6WA7aHUvFWDqst4/6Ew2T3qZkZuJ/ziw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZnkt3M2Xz1LTy; Sun, 06 Jul 2025 13:09:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566D9ATx083409; Sun, 6 Jul 2025 13:09:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566D9AF4083406; Sun, 6 Jul 2025 13:09:10 GMT (envelope-from git) Date: Sun, 6 Jul 2025 13:09:10 GMT Message-Id: <202507061309.566D9AF4083406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 3ba480f41801 - main - sound: Retire SND_DEV_* List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ba480f4180149da9ec7dc8869df2a51335b66d0 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=3ba480f4180149da9ec7dc8869df2a51335b66d0 commit 3ba480f4180149da9ec7dc8869df2a51335b66d0 Author: Christos Margiolis AuthorDate: 2025-07-06 13:08:50 +0000 Commit: Christos Margiolis CommitDate: 2025-07-06 13:08:50 +0000 sound: Retire SND_DEV_* Specifying unit numbers is not needed anymore, and half of those weren't used anymore in the first place. Sponsored by: The FreeBSD Foundation Reviewed by: adrian, markj, emaste Differential Revision: https://reviews.freebsd.org/D50690 --- sys/dev/sound/pcm/mixer.c | 4 ++-- sys/dev/sound/pcm/sndstat.c | 4 ++-- sys/dev/sound/pcm/sound.h | 7 ------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 092af3298f0e..f281dff36248 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -750,8 +750,8 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) mixer_setrecsrc(m, 0); /* Set default input. */ - pdev = make_dev(&mixer_cdevsw, SND_DEV_CTL, UID_ROOT, GID_WHEEL, 0666, - "mixer%d", unit); + pdev = make_dev(&mixer_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "mixer%d", + unit); pdev->si_drv1 = m; snddev->mixer_dev = pdev; diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index a11c6f53f58b..51d0fb3bb686 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -1438,8 +1438,8 @@ static void sndstat_sysinit(void *p) { sx_init(&sndstat_lock, "sndstat lock"); - sndstat_dev = make_dev(&sndstat_cdevsw, SND_DEV_STATUS, - UID_ROOT, GID_WHEEL, 0644, "sndstat"); + sndstat_dev = make_dev(&sndstat_cdevsw, 0, UID_ROOT, GID_WHEEL, 0644, + "sndstat"); } SYSINIT(sndstat_sysinit, SI_SUB_DRIVERS, SI_ORDER_FIRST, sndstat_sysinit, NULL); diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 5256916aaab3..6bd435d0ea25 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -148,13 +148,6 @@ struct snd_mixer; #define RANGE(var, low, high) (var) = \ (((var)<(low))? (low) : ((var)>(high))? (high) : (var)) -enum { - SND_DEV_CTL = 0, /* Control port /dev/mixer */ - SND_DEV_MIDIN, /* Raw midi access */ - SND_DEV_DSP, /* Digitized voice /dev/dsp */ - SND_DEV_STATUS, /* /dev/sndstat */ -}; - #define DSP_DEFAULT_SPEED 8000 extern int snd_unit; From nobody Sun Jul 6 17:09:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZv3c6Byrz61Gnf; Sun, 06 Jul 2025 17:09: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZv3c3X6Lz3JW7; Sun, 06 Jul 2025 17:09:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751821740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/MM2mG4pnfhIGc0ZMJlHHBZcFWcQzHC3YEo/9FVyd08=; b=Xqe9n1K7f+ocOkkvZv6QtGkRn+5Avf60RRQRykEQItY3ySIy8IfMLKUZPwxuHmSpM6OX/i jgzDevm5AgicqeWqh8ta99FZH/1b63EIRHFY5pn5XOFBGXprqq/VzWUyXh8+id1sgdB9dE kxd/yzQpMHxiQ/77C2vqroPzlKYYiMovbZeRTWXdmbA27j4605ZfEgcc+ldpMcvdiyKG1k WeDmZdsF9bLb2ENYmT5jrjGijSRNyF7LGYZM8IJhcHRRUg8PjdxqhCTz/TbQJDjr9CLlT7 Q0AExKNW1J4NzE3119mSTIP8rfae+cepITtBuLkRO32avOu26pz+t4YZVbsiqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751821740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/MM2mG4pnfhIGc0ZMJlHHBZcFWcQzHC3YEo/9FVyd08=; b=h6V1fle4EvMXda1Wk/uZsVQGZOYW56khaUvUp1XORz9B3UULSFMmxX4+Xu4wEQOLxhcwCU n/jb3r+PqXESV+ih+E8dEZ+dII17fFpmIDAdEzsTszBm6bL1yZylHMm7XU2GJiYLazbTga 0H5gx/YQIjJrYPGdzjP8SwUjSo1g32AwoJbhyqaZCZpaoDKqv8AKIUsGyKHXAvPO7HI1Vr jT3GmpLnujN7hKBptghNqfjqBm4A1oQMhwseuklJYX724CEvhp/l6Ikt+orM2HPB69IDkJ F/7Xx+k5Gs6U7UnFjfWHRexwMgMD3Lh42NEyO8Xr73ISJGNrLLVHTNVI+/236w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751821740; a=rsa-sha256; cv=none; b=lWhxz34azkCjmbK7Om22L60JycKCqRLWnZ4xR5ZZgUe+cvcw/IG0Ipxn4j7I067isLp7qk p+1BHhks1eYiDg0IcVXsIKkacTX8x+pozmFg38HBQ9eGu2pw79xzsY+ApKEtB7dt757QfW C0HCOg/Na7pCtjLLNyr0tGvLBBPoekK10cWqsMz+jf6GrROAPyFcgZxe2FBG4gzfsu7vx8 AH/9/gUVuk2WCUUFvOuRgxpbFkg/dSF7Zn8jWI8dnUTH7XwCbQ4X8keZJcDXpUq2GLU3oE RMcMLjP9U8tqA+wWBSF8S7u7+lpZKYA2dtsUU+h/6w8KmEjNPleXG5ya/4RFRA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZv3c2b5Lz1S8v; Sun, 06 Jul 2025 17:09:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566H9042034519; Sun, 6 Jul 2025 17:09:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566H90Yc034516; Sun, 6 Jul 2025 17:09:00 GMT (envelope-from git) Date: Sun, 6 Jul 2025 17:09:00 GMT Message-Id: <202507061709.566H90Yc034516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 88c8cba04395 - main - amd64 pmap: preallocate another page table page in pmap_demote_DMAP() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88c8cba0439599c00d9d3d586a66a035004e6e84 Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=88c8cba0439599c00d9d3d586a66a035004e6e84 commit 88c8cba0439599c00d9d3d586a66a035004e6e84 Author: Alan Cox AuthorDate: 2025-06-30 07:36:12 +0000 Commit: Alan Cox CommitDate: 2025-07-06 17:08:37 +0000 amd64 pmap: preallocate another page table page in pmap_demote_DMAP() To avoid a possible panic in pmap_demote_DMAP(), preallocate the page table page that may be needed by pmap_demote_pde() before acquiring the kernel pmap lock, so that we can wait until the allocation succeeds. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51091 --- sys/amd64/amd64/pmap.c | 121 +++++++++++++++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 48 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 0044f27729f6..cae5436a1ff2 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1301,6 +1301,8 @@ static int pmap_change_props_locked(vm_offset_t va, vm_size_t size, static bool pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static bool pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); +static bool pmap_demote_pde_mpte(pmap_t pmap, pd_entry_t *pde, + vm_offset_t va, struct rwlock **lockp, vm_page_t mpte); static bool pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va, vm_page_t m); static int pmap_enter_2mpage(pmap_t pmap, vm_offset_t va, vm_page_t m, @@ -6010,12 +6012,18 @@ pmap_demote_pde_abort(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, static bool pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp) +{ + return (pmap_demote_pde_mpte(pmap, pde, va, lockp, NULL)); +} + +static bool +pmap_demote_pde_mpte(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, + struct rwlock **lockp, vm_page_t mpte) { pd_entry_t newpde, oldpde; pt_entry_t *firstpte, newpte; pt_entry_t PG_A, PG_G, PG_M, PG_PKU_MASK, PG_RW, PG_V; vm_paddr_t mptepa; - vm_page_t mpte; int PG_PTE_CACHE; bool in_kernel; @@ -6028,61 +6036,65 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, PG_PKU_MASK = pmap_pku_mask_bit(pmap); PMAP_LOCK_ASSERT(pmap, MA_OWNED); - in_kernel = va >= VM_MAXUSER_ADDRESS; oldpde = *pde; KASSERT((oldpde & (PG_PS | PG_V)) == (PG_PS | PG_V), ("pmap_demote_pde: oldpde is missing PG_PS and/or PG_V")); - - /* - * Invalidate the 2MB page mapping and return "failure" if the - * mapping was never accessed. - */ - if ((oldpde & PG_A) == 0) { - KASSERT((oldpde & PG_W) == 0, - ("pmap_demote_pde: a wired mapping is missing PG_A")); - pmap_demote_pde_abort(pmap, va, pde, oldpde, lockp); - return (false); - } - - mpte = pmap_remove_pt_page(pmap, va); + KASSERT((oldpde & PG_MANAGED) == 0 || lockp != NULL, + ("pmap_demote_pde: lockp for a managed mapping is NULL")); + in_kernel = va >= VM_MAXUSER_ADDRESS; if (mpte == NULL) { - KASSERT((oldpde & PG_W) == 0, - ("pmap_demote_pde: page table page for a wired mapping" - " is missing")); - /* - * If the page table page is missing and the mapping - * is for a kernel address, the mapping must belong to - * the direct map. Page table pages are preallocated - * for every other part of the kernel address space, - * so the direct map region is the only part of the - * kernel address space that must be handled here. + * Invalidate the 2MB page mapping and return "failure" if the + * mapping was never accessed. */ - KASSERT(!in_kernel || (va >= DMAP_MIN_ADDRESS && - va < DMAP_MAX_ADDRESS), - ("pmap_demote_pde: No saved mpte for va %#lx", va)); - - /* - * If the 2MB page mapping belongs to the direct map - * region of the kernel's address space, then the page - * allocation request specifies the highest possible - * priority (VM_ALLOC_INTERRUPT). Otherwise, the - * priority is normal. - */ - mpte = pmap_alloc_pt_page(pmap, pmap_pde_pindex(va), - (in_kernel ? VM_ALLOC_INTERRUPT : 0) | VM_ALLOC_WIRED); - - /* - * If the allocation of the new page table page fails, - * invalidate the 2MB page mapping and return "failure". - */ - if (mpte == NULL) { + if ((oldpde & PG_A) == 0) { + KASSERT((oldpde & PG_W) == 0, + ("pmap_demote_pde: a wired mapping is missing PG_A")); pmap_demote_pde_abort(pmap, va, pde, oldpde, lockp); return (false); } - if (!in_kernel) - mpte->ref_count = NPTEPG; + mpte = pmap_remove_pt_page(pmap, va); + if (mpte == NULL) { + KASSERT((oldpde & PG_W) == 0, + ("pmap_demote_pde: page table page for a wired mapping is missing")); + + /* + * If the page table page is missing and the mapping + * is for a kernel address, the mapping must belong to + * the direct map. Page table pages are preallocated + * for every other part of the kernel address space, + * so the direct map region is the only part of the + * kernel address space that must be handled here. + */ + KASSERT(!in_kernel || (va >= DMAP_MIN_ADDRESS && + va < DMAP_MAX_ADDRESS), + ("pmap_demote_pde: No saved mpte for va %#lx", va)); + + /* + * If the 2MB page mapping belongs to the direct map + * region of the kernel's address space, then the page + * allocation request specifies the highest possible + * priority (VM_ALLOC_INTERRUPT). Otherwise, the + * priority is normal. + */ + mpte = pmap_alloc_pt_page(pmap, pmap_pde_pindex(va), + (in_kernel ? VM_ALLOC_INTERRUPT : 0) | + VM_ALLOC_WIRED); + + /* + * If the allocation of the new page table page fails, + * invalidate the 2MB page mapping and return "failure". + */ + if (mpte == NULL) { + pmap_demote_pde_abort(pmap, va, pde, oldpde, + lockp); + return (false); + } + + if (!in_kernel) + mpte->ref_count = NPTEPG; + } } mptepa = VM_PAGE_TO_PHYS(mpte); firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa); @@ -9977,8 +9989,8 @@ pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate) { pdp_entry_t *pdpe; pd_entry_t *pde; - vm_page_t m; vm_offset_t va; + vm_page_t m, mpte; bool changed; if (len == 0) @@ -9998,6 +10010,11 @@ pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate) * x86_mr_split_dmap() function. */ m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_WAITOK); + if (len < NBPDR) { + mpte = vm_page_alloc_noobj(VM_ALLOC_WIRED | + VM_ALLOC_WAITOK); + } else + mpte = NULL; PMAP_LOCK(kernel_pmap); pdpe = pmap_pdpe(kernel_pmap, va); @@ -10014,9 +10031,13 @@ pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate) if ((*pde & X86_PG_V) == 0) panic("pmap_demote_DMAP: invalid PDE"); if ((*pde & PG_PS) != 0) { - if (!pmap_demote_pde(kernel_pmap, pde, va)) + mpte->pindex = pmap_pde_pindex(va); + pmap_pt_page_count_adj(kernel_pmap, 1); + if (!pmap_demote_pde_mpte(kernel_pmap, pde, va, + NULL, mpte)) panic("pmap_demote_DMAP: PDE failed"); changed = true; + mpte = NULL; } } if (changed && invalidate) @@ -10026,6 +10047,10 @@ pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate) vm_page_unwire_noq(m); vm_page_free(m); } + if (mpte != NULL) { + vm_page_unwire_noq(mpte); + vm_page_free(mpte); + } } } From nobody Sun Jul 6 19:25:49 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZy5T39wxz61bGb; Sun, 06 Jul 2025 19:25: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZy5T21Wqz3Jc4; Sun, 06 Jul 2025 19:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751829949; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F5EFDV9dFTADE8hjxZBFFrAQbl/FoNH1trhmXUJW7BI=; b=hsiyDqj66TWPQ/RkRS+ql7PGXEsCnjAjeLSenS2GcFhaJyXOiY8TtogDdGoLsq2iMdCK6S dGT+aXOGE4rQYT9IxQWeyB+WhqK4lAzr8N2T7SECMOEcbp3Xh/1L01wAI7ltCvK0wuKU1W jAmQsZ8OjMJ8uBmgOKU0AJev+bXAFuXSUTy5UY0SylpbUIoYafA95UmIIDTJQJpvG74jA2 YtrJMwd/b7RLKSnnIeHar19bHe8nWSEbOsiSJBJKx0lbNCiGsWu4m2ji9gEIIb7mxVtRsE gpogaQFQKhBOohhmojT/lkbrwRVoI1Dj/iftsbJh8/NJn2XohJehGWRuHtD1Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751829949; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F5EFDV9dFTADE8hjxZBFFrAQbl/FoNH1trhmXUJW7BI=; b=kEpTMb+V5drF/uoIFCT0cHBbGE2QroJYBcf5tWAvHrprI3yQsdcp+CJETsLHRpPxGyarwx hZ9G4KZOfbtCU0d8s7TdjDR3NrixKXgsGsU4nxdZJZuYq3IhQbNBrzI3yZbyKd7HTabTbK +KswvXwuk58c1N8aBnhQ8iLLVD5cA8W5tGBl8eidX8Gm2CxJBf/uyT3CICapwml7aTipjM uud3d0BJeDxKGPxFouyhPPkV1iCqwua0JBPtgSAezQ8jOT3GAvypK0A2WukWu5ACRE5cKf AZC1R4hEAb9XAnfA/V/ZzzvPKOwiLJinRLuWS1btU5Svbb20R6dtaXQHSCSbjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751829949; a=rsa-sha256; cv=none; b=SX4hjp2GVxK45hzaBNM21PdUuznCKumDMBeRzSpsLGdvB4tk5AAQIHQ88srBtouXqQ0MQl JfsO0QPdMijwpWH5InyC4sLZuLsI+LmQOFHVkfe+mEIZDRoV1ntdsWYrRPu3B3j9kjq+JR /qtapqCzGCtmSoMnp3eg87bt/eGL5CSjTP9Mlp9+PSHmoXgXhsUcpT7y/V8igEV9bg3D11 3IHEPl9QUy+4kM18FaMbjvfXDA97EXa53bntdAteGk48OiSZGtMG6QAUYCZOny/F9TKrh6 ojTNf/8TCk/p1uu6kdDTtLJnPmhhb2c8caV3L3dqcvoU9KU2gN5OXz4zAC+Ifg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZy5T1SNGz3MT; Sun, 06 Jul 2025 19:25:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566JPn2P096029; Sun, 6 Jul 2025 19:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566JPnwl096026; Sun, 6 Jul 2025 19:25:49 GMT (envelope-from git) Date: Sun, 6 Jul 2025 19:25:49 GMT Message-Id: <202507061925.566JPnwl096026@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: ac64cd191c3f - main - pathconf.2: Document the _PC_HAS_HIDDENSYSTEM name List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac64cd191c3f49efe900b8e90657f51578503265 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ac64cd191c3f49efe900b8e90657f51578503265 commit ac64cd191c3f49efe900b8e90657f51578503265 Author: Rick Macklem AuthorDate: 2025-07-06 19:23:05 +0000 Commit: Rick Macklem CommitDate: 2025-07-06 19:23:05 +0000 pathconf.2: Document the _PC_HAS_HIDDENSYSTEM name Commit afd5bc630930 added a new pathconf name _PC_HAS_HIDDENSYSTEM. This patch documents this new name. This is a content change. Reviewed by: kib, ziaee (manpages) Differential Revision: https://reviews.freebsd.org/D51175 Fixes: afd5bc630930 ("pathconf: Add a new variable for hidden/system") --- lib/libsys/pathconf.2 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/libsys/pathconf.2 b/lib/libsys/pathconf.2 index 4c562b9c2c9a..79ac8310000d 100644 --- a/lib/libsys/pathconf.2 +++ b/lib/libsys/pathconf.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 3, 2025 +.Dd July 5, 2025 .Dt PATHCONF 2 .Os .Sh NAME @@ -179,6 +179,14 @@ otherwise 0. Return 1 if named attributes are enabled for the file system, otherwise 0. .It Li _PC_HAS_NAMEDATTR Return 1 if one or more named attributes exist for the file, otherwise 0. +.It Li _PC_HAS_HIDDENSYSTEM +Return 1 if both +.Dv UF_HIDDEN +and +.Dv UF_SYSTEM +flags can be set by +.Xr chflags 2 , +otherwise 0. .El .Sh RETURN VALUES If the call to @@ -255,6 +263,7 @@ An I/O error occurred while reading from or writing to the file system. Corrupted data was detected while reading from the file system. .El .Sh SEE ALSO +.Xr chflags 2 , .Xr lseek 2 , .Xr sysctl 3 .Sh HISTORY From nobody Sun Jul 6 19:28:20 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZy8N6PbGz61bQJ; Sun, 06 Jul 2025 19:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZy8N5hSPz3KH3; Sun, 06 Jul 2025 19:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751830100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YzW4UFupVxyR9020zP4DCgmb7Qd9UX/yaQSxLjGB2k0=; b=P+G3+k3IgJmCMek7PMnlXbXKgJTQRsxqUHNAkh8wIzKQCYGL/MZfQhh31vfqwsiVyMEOSW V9r+NIT4FX+YXl/lWfK3JfxT2vnY0oRZwYu4yDjE/WfA2S/djqsaobzlBzihOvB9TZDep8 Ha+xwflflB+3RugDCM1Ia/BHazugAbPmTkzKiCiYoiusEYIPd/IYktmL2VABeMP36soUrw /NOPhXaNgUwqiTpYR7fkHSQ+Oyn03BBukhDQGpEd3EAfFwYVZRovZyvjW82yAWiwqfHzyx YoFxLDkDKQPAZstpfx8DxcRoDRHoVebjcRpxCAM0hZePysc2G/sRg8LehlLLLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751830100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YzW4UFupVxyR9020zP4DCgmb7Qd9UX/yaQSxLjGB2k0=; b=HmInr0yvau9Ca2M8MBgPAKRi/Lz8RKU2iVX0MEH+gKICaLZFnZj0Jjq3/zj11uBZsFw81X qWrAV0zCkkot2M4W4YlBQEyW1jap2NxXNz4KCa4TLUpdxpRpzDOy6tTDgtLLW0okgkZNk7 T8k/znyb85eJ5a4Xp4r6UWLMe0pBLcLUswIaYQ9ffZoJRE2GeXSqonsj9V0StrBmlvMpXI 12pJ+p2ghe3GgTN1mUqdAS8P6Vz2lx61Npg0unBJD5KK7D2W6UNMWOUdpdkjgGg/xSTezx oYilMIGgKZ5MWSX5o/IOKhj5D98GZ4QvGdwJGMAQoSQBBOgPgPSjSB5Zit+e2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751830100; a=rsa-sha256; cv=none; b=xCvtPljECLMhQuzq4LsSW1lL40eeXyHJ2Qo0hWRiLTbqyYuVK1PN4xn58hZiUbWBmwWAs6 wEqW+/xyCoc8eorQ/0150YGSJjP4M9N6SyPQl1o8jLcFe1iBqLwkP//oV4n9U2kVRaXAb5 hoXnhtNYJ/BPb5ktRLWhOlABJnIv9dM1i+IusQpndsEh/zlCGpWG9Kis9eAY1IfwVFVN+o RklGhD/NiIkCE1Dk5l2v2vgQCacUj92IXDGfvj99N+4Ejq4bavzsSSm6lNtz9wW16JySUV MhK7q2MstRAhTs1P1Hnq0Iwa9k3Tu1xJEXgiMiaERb4+olfw/uiC3xfKibLQ+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZy8N5HhYz3XC; Sun, 06 Jul 2025 19:28:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566JSKJb096932; Sun, 6 Jul 2025 19:28:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566JSKDt096929; Sun, 6 Jul 2025 19:28:20 GMT (envelope-from git) Date: Sun, 6 Jul 2025 19:28:20 GMT Message-Id: <202507061928.566JSKDt096929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: efe5907279e1 - main - amd64: fix physmap entry addition logic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: efe5907279e1aa1781fc4d5260204888cd235cc2 Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=efe5907279e1aa1781fc4d5260204888cd235cc2 commit efe5907279e1aa1781fc4d5260204888cd235cc2 Author: Ahmad Khalifa AuthorDate: 2025-07-06 19:09:15 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-06 19:26:07 +0000 amd64: fix physmap entry addition logic Since physmap_idx points to the next slot, we should make sure both 'i' and 'insert_idx' are less than physmap_idx, but never equal to it. Also allow physmap_idx to reach PHYS_AVAIL_ENTRIES so the last slot can be populated. Reviewed by: kib, markj Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D51173 --- sys/amd64/amd64/machdep.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 032a134bbd4b..9724a6acb130 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -645,7 +645,7 @@ add_physmap_entry(uint64_t base, uint64_t length, vm_paddr_t *physmap, * NB: physmap_idx points to the next free slot. */ insert_idx = physmap_idx; - for (i = 0; i <= physmap_idx; i += 2) { + for (i = 0; i < physmap_idx; i += 2) { if (base < physmap[i + 1]) { if (base + length <= physmap[i]) { insert_idx = i; @@ -659,7 +659,7 @@ add_physmap_entry(uint64_t base, uint64_t length, vm_paddr_t *physmap, } /* See if we can prepend to the next entry. */ - if (insert_idx <= physmap_idx && base + length == physmap[insert_idx]) { + if (insert_idx < physmap_idx && base + length == physmap[insert_idx]) { physmap[insert_idx] = base; return (1); } @@ -670,8 +670,6 @@ add_physmap_entry(uint64_t base, uint64_t length, vm_paddr_t *physmap, return (1); } - physmap_idx += 2; - *physmap_idxp = physmap_idx; if (physmap_idx == PHYS_AVAIL_ENTRIES) { printf( "Too many segments in the physical address map, giving up\n"); @@ -682,11 +680,14 @@ add_physmap_entry(uint64_t base, uint64_t length, vm_paddr_t *physmap, * Move the last 'N' entries down to make room for the new * entry if needed. */ - for (i = (physmap_idx - 2); i > insert_idx; i -= 2) { + for (i = physmap_idx; i > insert_idx; i -= 2) { physmap[i] = physmap[i - 2]; physmap[i + 1] = physmap[i - 1]; } + physmap_idx += 2; + *physmap_idxp = physmap_idx; + /* Insert the new entry. */ physmap[insert_idx] = base; physmap[insert_idx + 1] = base + length; From nobody Sun Jul 6 19:28:21 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZy8Q1cnpz61bKB; Sun, 06 Jul 2025 19:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZy8P6SzPz3K8n; Sun, 06 Jul 2025 19:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751830101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/z4HWvAQF/ie7NvORTlO6DQn6QOn9abbBQ4DepaaHWo=; b=g/R0RyFa8H/YMmi6jYkiu96bYqgfm/Kx4VC56yv4f3LcCgjbiQe+iCXmLCAO6+fY673+O1 XmCoGwzUXRxroX0KlcoLGmDNdEnYIxiB1YC1p9a+xOYcwlOweW4aZp4bNTPxcAqTB8QH7P /091kuOyRNXMECRATIUIBwhtq92edivJbuuJY5oi/k893MnEOybtEyclmagk4pbg6+BmBm WgCZi5gX1j3Dnflj+lypR2dReBHOScYnccDZnY1VGHBx8eAgzfXgEnCdE75YyD1aLwF2gW wo0rRFQWB4dlYksDZfPBjtLP21LfCqVJ/P4041YFMKVcfVtCK3YKFJm8KRvFMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751830101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/z4HWvAQF/ie7NvORTlO6DQn6QOn9abbBQ4DepaaHWo=; b=GPw+tMgQfDRiIGbi74zTtm8q2cEJRmuMGNLeNZzw0wycbpVjiV2AbroK2zL+k0tHBm/PKh i/ka392T/rVbgLMfq84jHv/DxWBi4AUIPCjWE893Gwl/OsKjbm/KzbARVUMzEotAvk/rvi an/MDesZNqju7so5vO4OA+xAyBL4CEshrNUaA5V69pZj3KF9owMTghxG0jvT+81TPpGhyE ziCDKBE64DWg14prgbKAsFyOQrYIO2BT1DTf92WGFp/6YrvtRSsKdpGspV2vLIp4nJ3fZx IqEfCtRZxpTFRtd2NGyW0jKdN0Fu/wscNzr4xnoZm2BUirV6do/6u03cDAR8NA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751830101; a=rsa-sha256; cv=none; b=qDyh5zYADswtmTpuuARW92+lMrDLi5JOiehQYTWneI2cF/n2boGuqKYZ6JxiAuNfaZYvpR 58KV49D86nq6GOIj9MY4LbqpqjW3A9vYpED/ASKS8N91u9sb95ob6KJ7A7VC/K+GSr6KQG IExeZQaZrWhBuVTFZmZjWFVzKQ/1dwamKHUoCxg9TYPMFUu5/CTfkemA5zMEtd8LRx5i73 v72fBKYPiydJZiD5Imr5PTN8rDIwkT/IkblUNMVO9OiaGX5Y57Rfzwhjz50uC85kDvKGMs eF2YT8aXEaBQcw+86LogFZuTLXuxV9ZnDTDreUEo/qQYOgvx7jWl0X7yQN3u5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZy8P5wVdz3QX; Sun, 06 Jul 2025 19:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566JSL6J096966; Sun, 6 Jul 2025 19:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566JSLh9096963; Sun, 6 Jul 2025 19:28:21 GMT (envelope-from git) Date: Sun, 6 Jul 2025 19:28:21 GMT Message-Id: <202507061928.566JSLh9096963@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 85dcdb7aad85 - main - amd64: allow the mapping of other regions for efirt List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 85dcdb7aad85498b3f497b8752e69b8612b27cb7 Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=85dcdb7aad85498b3f497b8752e69b8612b27cb7 commit 85dcdb7aad85498b3f497b8752e69b8612b27cb7 Author: Ahmad Khalifa AuthorDate: 2025-07-06 19:10:25 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-06 19:26:07 +0000 amd64: allow the mapping of other regions for efirt Some BIOSes access data outside of regions marked as "runtime" in their runtime EFI functions. Allow the mapping and preservation of other regions through a tunable. The tunable is a bitmap specifying the regions to map. e.g bit 3 would be set to map BootServicesCode. Currently allowed regions are: BootServicesCode BootServicesData RuntimeServicesCode RuntimeServicesData ACPIMemoryNVS PR: 287422 Reviewed by: kib Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D51146 --- sys/amd64/amd64/efirt_machdep.c | 18 +++++++++++++++++- sys/amd64/amd64/machdep.c | 8 ++++++-- sys/amd64/include/efi.h | 4 ++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c index 81a28ebe97ee..75c357f6e3df 100644 --- a/sys/amd64/amd64/efirt_machdep.c +++ b/sys/amd64/amd64/efirt_machdep.c @@ -56,6 +56,15 @@ #include #include +/* The EFI regions we're allowed to map. */ +#define EFI_ALLOWED_TYPES_MASK ( \ + 1u << EFI_MD_TYPE_BS_CODE | 1u << EFI_MD_TYPE_BS_DATA | \ + 1u << EFI_MD_TYPE_RT_CODE | 1u << EFI_MD_TYPE_RT_DATA | \ + 1u << EFI_MD_TYPE_FIRMWARE \ +) + +uint32_t efi_map_regs; + static pml5_entry_t *efi_pml5; static pml4_entry_t *efi_pml4; static vm_object_t obj_1t1_pt; @@ -198,9 +207,16 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz) pmap_pinit_pml4(efi_pmltop_page); } + if ((efi_map_regs & ~EFI_ALLOWED_TYPES_MASK) != 0) { + printf("Ignoring the following runtime EFI regions: %#x\n", + efi_map_regs & ~EFI_ALLOWED_TYPES_MASK); + efi_map_regs &= EFI_ALLOWED_TYPES_MASK; + } + for (i = 0, p = map; i < ndesc; i++, p = efi_next_descriptor(p, descsz)) { - if ((p->md_attr & EFI_MD_ATTR_RT) == 0) + if ((p->md_attr & EFI_MD_ATTR_RT) == 0 && + !EFI_MAP_BOOTTYPE_ALLOWED(p->md_type)) continue; if (p->md_virt != 0 && p->md_virt != p->md_phys) { if (bootverbose) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 9724a6acb130..1e8f9b22bd19 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -758,6 +758,7 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, printf("%23s %12s %12s %8s %4s\n", "Type", "Physical", "Virtual", "#Pages", "Attr"); + TUNABLE_INT_FETCH("machdep.efirt.regs", &efi_map_regs); for (i = 0, p = map; i < ndesc; i++, p = efi_next_descriptor(p, efihdr->descriptor_size)) { if (boothowto & RB_VERBOSE) { @@ -795,10 +796,13 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, } switch (p->md_type) { - case EFI_MD_TYPE_CODE: - case EFI_MD_TYPE_DATA: case EFI_MD_TYPE_BS_CODE: case EFI_MD_TYPE_BS_DATA: + if (EFI_MAP_BOOTTYPE_ALLOWED(p->md_type)) + continue; + /* FALLTHROUGH */ + case EFI_MD_TYPE_CODE: + case EFI_MD_TYPE_DATA: case EFI_MD_TYPE_FREE: /* * We're allowed to use any entry with these types. diff --git a/sys/amd64/include/efi.h b/sys/amd64/include/efi.h index b47c4aa27ac7..439f2f0b317d 100644 --- a/sys/amd64/include/efi.h +++ b/sys/amd64/include/efi.h @@ -53,6 +53,10 @@ #define EFI_TIME_OWNED() mtx_assert(&atrtc_time_lock, MA_OWNED) #define EFI_RT_HANDLE_FAULTS_DEFAULT 1 + +#define EFI_MAP_BOOTTYPE_ALLOWED(type) (((efi_map_regs >> (type)) & 1) != 0) + +extern uint32_t efi_map_regs; #endif struct efirt_callinfo { From nobody Sun Jul 6 19:28:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZy8R3LTJz61bKD; Sun, 06 Jul 2025 19:28: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZy8R09LXz3KBq; Sun, 06 Jul 2025 19:28:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751830103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+vyNn6xHllGSHWDCBxjto+s+S8ph/0c5NkKlwyfxitU=; b=MxHQkxEaawUjepZrXj46oidHeWwoMzpLaCaXHt0kSxzQ58+zA6qEOlA6kTqJP9e52bPR3X fa0/1O1u2Dwl+dOnC57SQecM41qVh5zWZuX8D2sVONOdoIEH0hMQeQvtxCs2JNJIGxOAO4 /WzB+RMxr7MPN5qtgnz/mm7hgTA/37JY1YIH7/rFqFoUhy1yA54Qx5A6lMRukJUHE8p334 Y9RVfml1/pGtHlHIzQTWT+IzknRvw5dNA03+TbtAzzhck4ROwtO/45iYpQkfbmUcoFDEG9 3/DzYAs0Dud3msB/LJ0LVmfRrV9kZtfWJbDZpvKixVTKJ/vtppMiP72VCGyK5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751830103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+vyNn6xHllGSHWDCBxjto+s+S8ph/0c5NkKlwyfxitU=; b=MMpRo/ahdzvvY8ZpGeol386VEtiTbYF5ohR24hpJuu3gLTxUPeiOloxgCHflgWL6Esf3DL A1W+Zvf/lOsPMUnNPVuDUaTaR37G2FJDo3iC1HOGId78OKrBcYr6b3yQhABGjx2bycwGPY 0NRAA5sz6lmKTfZH1/bOII1fEIS8BSjOEvXsugRjy4fEraqCXPn9ol/Ea6eqIxM6zdGEVI dfJPjtFiHp3fag3fcCDInkqXKddKQSQ4vFQ0l4XjbSAeNQcc+GAHubPXbgrqbdrvtjY+CU r0QLXpF768jYR55qTAWHW1uaq8piU7ZNKCoZdUiA5eaudOrbRpwgMEppCjytjQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751830103; a=rsa-sha256; cv=none; b=qeqKpBxAncYPtc3xWZVttWi9OPoYybF4HBtZZ8vbTxn8isesOyuM3I9Eh5ZNqumprwo74d e5r+4daynuba4bcal4PzZJes+arc/V7sNeg+8cHGB3UVF6CM2Fp3nZI6KkyZPByLAKXTly i0S1OU3SzVGPDT463AG4wWyKEN7WDKbsxQjrb6OUc0pMRKpbS74tKpDxRsfpJMTxzpsK11 E09sQ7fLMp/XYLTJEdaz/BbIwS7gyioAdeYGCdaRFj0QZzZVEtePVrd4Yknj519qsTkBdH KpvtRykgy7gAauHtohA3yiYyx5P7ATxSuDm8r59B+Uhlggt1F4ofWVlaE6nghQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZy8Q6nNwz3QY; Sun, 06 Jul 2025 19:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566JSMkp097001; Sun, 6 Jul 2025 19:28:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566JSMMu096998; Sun, 6 Jul 2025 19:28:22 GMT (envelope-from git) Date: Sun, 6 Jul 2025 19:28:22 GMT Message-Id: <202507061928.566JSMMu096998@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 4add1a7a46b5 - main - amd64/efirt: always map the first page List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4add1a7a46b5cb261223d1c51c94fde417cc33c0 Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=4add1a7a46b5cb261223d1c51c94fde417cc33c0 commit 4add1a7a46b5cb261223d1c51c94fde417cc33c0 Author: Ahmad Khalifa AuthorDate: 2025-07-06 19:10:58 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-06 19:26:07 +0000 amd64/efirt: always map the first page Some BIOSes tend to access physical address zero when executing runtime EFI functions. Map it regardless of the runtime attribute. PR: 287422 Reviewed by: imp, kib Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D51147 --- sys/amd64/amd64/efirt_machdep.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c index 75c357f6e3df..f70e235a0150 100644 --- a/sys/amd64/amd64/efirt_machdep.c +++ b/sys/amd64/amd64/efirt_machdep.c @@ -190,6 +190,7 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz) vm_offset_t va; uint64_t idx; int bits, i, mode; + bool map_pz = true; obj_1t1_pt = vm_pager_allocate(OBJT_PHYS, NULL, ptoa(1 + NPML4EPG + NPML4EPG * NPDPEPG + NPML4EPG * NPDPEPG * NPDEPG), @@ -272,6 +273,22 @@ efi_create_1t1_map(struct efi_md *map, int ndesc, int descsz) } } VM_OBJECT_WUNLOCK(obj_1t1_pt); + if (p->md_phys == 0) + map_pz = false; + } + + /* + * Some BIOSes tend to access phys 0 during efirt calls, + * so map it if we haven't yet. + */ + if (map_pz) { + VM_OBJECT_WLOCK(obj_1t1_pt); + pte = efi_1t1_pte(0); + /* Assume Write-Back */ + bits = pmap_cache_bits(kernel_pmap, VM_MEMATTR_WRITE_BACK, + false) | X86_PG_RW | X86_PG_V; + pte_store(pte, bits); + VM_OBJECT_WUNLOCK(obj_1t1_pt); } return (true); From nobody Sun Jul 6 19:43:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZyTX3gmTz61dP1; Sun, 06 Jul 2025 19:43:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) 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 4bZyTX1S40z3NNb; Sun, 06 Jul 2025 19:43:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) 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 566Jh0TX023876; Sun, 6 Jul 2025 22:43:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 566Jh0TX023876 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 566Jh0L4023875; Sun, 6 Jul 2025 22:43:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 6 Jul 2025 22:43:00 +0300 From: Konstantin Belousov To: Ahmad Khalifa Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 85dcdb7aad85 - main - amd64: allow the mapping of other regions for efirt Message-ID: References: <202507061928.566JSLh9096963@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202507061928.566JSLh9096963@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4bZyTX1S40z3NNb X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Sun, Jul 06, 2025 at 07:28:21PM +0000, Ahmad Khalifa wrote: > The branch main has been updated by vexeduxr: > > URL: https://cgit.FreeBSD.org/src/commit/?id=85dcdb7aad85498b3f497b8752e69b8612b27cb7 > > commit 85dcdb7aad85498b3f497b8752e69b8612b27cb7 > Author: Ahmad Khalifa > AuthorDate: 2025-07-06 19:10:25 +0000 > Commit: Ahmad Khalifa > CommitDate: 2025-07-06 19:26:07 +0000 > > amd64: allow the mapping of other regions for efirt > > Some BIOSes access data outside of regions marked as "runtime" in their > runtime EFI functions. Allow the mapping and preservation of other > regions through a tunable. > > The tunable is a bitmap specifying the regions to map. e.g bit 3 would > be set to map BootServicesCode. > > Currently allowed regions are: > BootServicesCode > BootServicesData > RuntimeServicesCode > RuntimeServicesData > ACPIMemoryNVS > > PR: 287422 > Reviewed by: kib > Approved by: imp (mentor) > Differential Revision: https://reviews.freebsd.org/D51146 > --- > sys/amd64/amd64/efirt_machdep.c | 18 +++++++++++++++++- > sys/amd64/amd64/machdep.c | 8 ++++++-- > sys/amd64/include/efi.h | 4 ++++ > 3 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c > index 81a28ebe97ee..75c357f6e3df 100644 > --- a/sys/amd64/amd64/efirt_machdep.c > +++ b/sys/amd64/amd64/efirt_machdep.c > @@ -56,6 +56,15 @@ > #include > #include > > +/* The EFI regions we're allowed to map. */ > +#define EFI_ALLOWED_TYPES_MASK ( \ > + 1u << EFI_MD_TYPE_BS_CODE | 1u << EFI_MD_TYPE_BS_DATA | \ > + 1u << EFI_MD_TYPE_RT_CODE | 1u << EFI_MD_TYPE_RT_DATA | \ > + 1u << EFI_MD_TYPE_FIRMWARE \ > +) > + > +uint32_t efi_map_regs; > + Apparently efi_map_regs must be defined in amd64/machdep.c and not in efirt_machdep.c. If efirt is compiled as module, efo_map_regs gets undefined in the kernel. From nobody Sun Jul 6 20:02:42 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZyw53dkYz61gHh; Sun, 06 Jul 2025 20:02:45 +0000 (UTC) (envelope-from ahmadkhalifa570@gmail.com) Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) (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 4bZyw50bTsz3RKJ; Sun, 06 Jul 2025 20:02:45 +0000 (UTC) (envelope-from ahmadkhalifa570@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-70a57a8ffc3so18633147b3.0; Sun, 06 Jul 2025 13:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751832163; x=1752436963; darn=freebsd.org; h=cc:to:subject:message-id:date:in-reply-to:references:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tG8QfF37L1IUR4RCFeMXEh+qgrLMtmXi7BV1vdJ3W4o=; b=SHxJ6S/YGJl+fSyIKBsq0sOlbptfELoaopFptbDTbTjLC6ysPmDZHXY1kJJznztXog Px0XkIqf1N+cPSuNl9Tl825z9jRXCLmL2qSm91JPNhk3LGAzzPC48cEUhS+oTeQF6zpQ aTBW02XprAqkoUtIeuw8poK7BXfRsKTP4Wzh9DMbiQNn+XiJHSy7rtDAMfMSEkvdqeJa hWBSiZEjtQ/sUrfJpUUmcHP8MEy0qBYzFLGW3jAfO/SfIdlq3gjMl670ryCk3sZ7p8hY 59HjabtgNqqvUxNm+CERd2q5rKMLe0DkhrLcRo2QSqWACSamdDaP8ODouSd3wrP0qN7G GSZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751832163; x=1752436963; h=cc:to:subject:message-id:date:in-reply-to:references:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tG8QfF37L1IUR4RCFeMXEh+qgrLMtmXi7BV1vdJ3W4o=; b=LaPlX6n5KT5Y51u29pdXJ5/z1oROWj1BZD8tKjaRi3XTuX5YLHacdqtmTu1KcdJod8 4f6jt3aEOcvnaYl/7AUSG+W0IXHpJAfLfoFroTPtkbdqZ+muel6vTJNSbXs+K/UZSA+h OUo//a9M0/KdhHTEb/oNoM8qVD8agiARGfov7GSMQ3uRrbBg3JQDIx7gTl9dOWFTJwuU 4/qrX1gbBh/7b1WrknnQvb9p0d4SyDg8o/RWcU6W+9MCZnyVeKsYFwXBh/kD7QBB8sM0 d6ZSytNxikzsbt8iKA07cKwNGLG60aLn1+M9rbE8cOcQA0QjB/K+rLsbJiQz7fDFYLI3 cZag== X-Forwarded-Encrypted: i=1; AJvYcCWlirHwPVEpEcL3503XJpVu+BfZJikVvppiZSHSGkTWvvUFDFGhepmV9wwXJisZcq0675NCihSVOj1+Bgpu6p4F6eN0@freebsd.org, AJvYcCXgDmxCIk9gIfYxaNh2SqOUMzYw52rNZ98Aed1J2Mvtirq8QQnY7C5OTTezaZYeO4ffedRJ9jRu0z1WreiWCrQr7b4sX50=@freebsd.org X-Gm-Message-State: AOJu0YwOhcWxcY9rwQ0gINaMgKYOIArgcbtngirtDMVc9sO1zvkcSMmD LGtK6jhFIoSk1cOTffWP8sBCfPFIHrqpe3XEjs/sVluBZN2C5mBk2N8Cvhb5GCYCS/vcnGaUivJ SC5NkfHbTxJSO6KFa3/L7fmLuJSUkHHs= X-Gm-Gg: ASbGnculrsXc8vKcVzse6SiFoQmDM2pTkMS7qUkzaXNkyIrct7tXr7/MtE5PmH2LJIg mHU/nB2WIrH2CmJeNiJublIvadVAKVXbzr0R3VZB1dJIB6Bm+PBb+st8PQD7b0HJ2mdQzk0nVKT yL5coM9RrTVq5iPZL0Y8CbTisKesKOwFfch8QswwquQCEQfA== X-Google-Smtp-Source: AGHT+IH+mitYo3NpvOfIBWZWO5VC0FXLSruKPArt2AUshevuFsLa4NOHEOaXYPc18CgtYvoJ4C73f4LjrcEJLEzvi3E= X-Received: by 2002:a05:690c:3705:b0:70e:a1e:d9c7 with SMTP id 00721157ae682-7176ca03f3fmr84470337b3.10.1751832162929; Sun, 06 Jul 2025 13:02:42 -0700 (PDT) Received: from 490177373942 named unknown by gmailapi.google.com with HTTPREST; Sun, 6 Jul 2025 13:02:42 -0700 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 From: Ahmad Khalifa X-Mailer: aerc 0.20.1 References: <202507061928.566JSLh9096963@gitrepo.freebsd.org> In-Reply-To: Date: Sun, 6 Jul 2025 13:02:42 -0700 X-Gm-Features: Ac12FXxmp0JKFwNEU5PY0g4iyJc-8AxQ7u7v3rY_GXXXKrPt3j_3AzzNlVzShDI Message-ID: Subject: Re: git: 85dcdb7aad85 - main - amd64: allow the mapping of other regions for efirt To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4bZyw50bTsz3RKJ X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] On Sun Jul 6, 2025 at 10:43 PM +0300, Konstantin Belousov wrote: > On Sun, Jul 06, 2025 at 07:28:21PM +0000, Ahmad Khalifa wrote: >> The branch main has been updated by vexeduxr: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=85dcdb7aad85498b3f497b8752e69b8612b27cb7 >> >> commit 85dcdb7aad85498b3f497b8752e69b8612b27cb7 >> Author: Ahmad Khalifa >> AuthorDate: 2025-07-06 19:10:25 +0000 >> Commit: Ahmad Khalifa >> CommitDate: 2025-07-06 19:26:07 +0000 >> >> amd64: allow the mapping of other regions for efirt >> >> Some BIOSes access data outside of regions marked as "runtime" in their >> runtime EFI functions. Allow the mapping and preservation of other >> regions through a tunable. >> >> The tunable is a bitmap specifying the regions to map. e.g bit 3 would >> be set to map BootServicesCode. >> >> Currently allowed regions are: >> BootServicesCode >> BootServicesData >> RuntimeServicesCode >> RuntimeServicesData >> ACPIMemoryNVS >> >> PR: 287422 >> Reviewed by: kib >> Approved by: imp (mentor) >> Differential Revision: https://reviews.freebsd.org/D51146 >> --- >> sys/amd64/amd64/efirt_machdep.c | 18 +++++++++++++++++- >> sys/amd64/amd64/machdep.c | 8 ++++++-- >> sys/amd64/include/efi.h | 4 ++++ >> 3 files changed, 27 insertions(+), 3 deletions(-) >> >> diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c >> index 81a28ebe97ee..75c357f6e3df 100644 >> --- a/sys/amd64/amd64/efirt_machdep.c >> +++ b/sys/amd64/amd64/efirt_machdep.c >> @@ -56,6 +56,15 @@ >> #include >> #include >> >> +/* The EFI regions we're allowed to map. */ >> +#define EFI_ALLOWED_TYPES_MASK ( \ >> + 1u << EFI_MD_TYPE_BS_CODE | 1u << EFI_MD_TYPE_BS_DATA | \ >> + 1u << EFI_MD_TYPE_RT_CODE | 1u << EFI_MD_TYPE_RT_DATA | \ >> + 1u << EFI_MD_TYPE_FIRMWARE \ >> +) >> + >> +uint32_t efi_map_regs; >> + > > Apparently efi_map_regs must be defined in amd64/machdep.c and not in > efirt_machdep.c. If efirt is compiled as module, efo_map_regs gets > undefined in the kernel. Ah, nice catch. Review opened. From nobody Sun Jul 6 20:22:12 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZzLk1nG1z61j8x; Sun, 06 Jul 2025 20:22:22 +0000 (UTC) (envelope-from ahmadkhalifa570@gmail.com) Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) (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 4bZzLh0bn9z3Tpt; Sun, 06 Jul 2025 20:22:20 +0000 (UTC) (envelope-from ahmadkhalifa570@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=UphNWpqV; spf=pass (mx1.freebsd.org: domain of ahmadkhalifa570@gmail.com designates 2607:f8b0:4864:20::b33 as permitted sender) smtp.mailfrom=ahmadkhalifa570@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-e7569ccf04cso1981176276.0; Sun, 06 Jul 2025 13:22:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751833333; x=1752438133; darn=freebsd.org; h=cc:to:subject:message-id:date:in-reply-to:references:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Gf2bDG251XWdjGKZcJl1N0RketrANiCjo81dg/wuWG4=; b=UphNWpqVYW2ORPepzrxU+vHd5YcYtk0Ke4Epn9ul1+42xWiMFFcM+tyfK2Z5uXvCYY Vk07q00XCHCR7tAWySMWosgJ/vhG2HqhmffxgRyqpWObpVU5F3FPzil3g77h0wMKInGU 1aDBuVQB76K+tWY6CkocGJAocKIhWsYNP4BMpxTY2ao/O0jT5LJfAbfYStdWLgWNZVLs y8AuVT7atxEKfrffi0XednT5TUwTszZemTbajwqHpIHxO+XxtEBbHgJ7MHdlRF544Ob1 IW8AXN64dqpBK4UH/UIIUXqVvtlcezwkQfvVRcXNabKdHzzBq/SfeyRIy6a+vPA+cNJd avzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751833333; x=1752438133; h=cc:to:subject:message-id:date:in-reply-to:references:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Gf2bDG251XWdjGKZcJl1N0RketrANiCjo81dg/wuWG4=; b=Z/nJXkSOM9HuMzanzc5KYR5tPeT+ZAiFvyT1TumJcNp9+2A38rFsKLEJbsVOR6iDxs CgFQXqltRCA6ymLCu+wHPPNOKngytbARduqmoxN36Lfp+ALQCd+leQGylbjm5QTsluee i5zpvm5eC00D+GTkyCyIvnTsEgOyOj4dyIO7WG4WfgKy6GuXfJW70IRgj2PjbPGC24jB S+WjeFwEYis+mHmiDlFEh/Tw7ni8AqYWPZag2+KQZlX71X0U0NNIH1hW20e4brwGrOoK jSRRlvQ1TuragVVEGiCyVNE40ZHUVGMoUXgo4PGdlwdHxviQF9AYXP4/Kg2NJ5+mwNOa i/yw== X-Forwarded-Encrypted: i=1; AJvYcCUKZd0lWCKYy14LYAUqh9DRVrsN/iA/tqte6KT48c3A+2EWTsWiGhijVnddAmf4eTsVy8n6wxl+ZPbq26C5LaMnyojaJW8=@freebsd.org, AJvYcCXNb3zS8UJObDTQO/wOHH56Qg1X53uch4skjdFp841BgXzfEs5F+R+7Cc6dh2AE50Up3Rkotj5ZGg6uP0YqTDpetgAY@freebsd.org X-Gm-Message-State: AOJu0YzBC6+KdX5doZ6gDjUl7G0tYWkmq/w/9MEWoAZrPp7gOp+Tud5X cKBGPCXl1RZ6zQ/Wa3oLd8hdQRy0EZVkX9kN2XPQQo8bNp4YABRmqcbMkWkBu2OyRvBU+NniCyd 1ocZnboe2iTfic4oauHPEKPDZf+ipll/6LD0k X-Gm-Gg: ASbGnctjmK8dAwd/KcFQg4NhnMiPhm7kMdwo/GiZeyiDuQwa59plTiyC9w3iHHJ5LKa hTE4MY01Ac+1ZHGb1l3K9ft0sxByjZT5w7t/UzvQpd0jbSTIZCdmYRZswUc3yqU5p92setOux2o 6Ah839QjjzIpK5k2H5+nKpa5MqM+FxaEtTT3oeyxvfvTAk6A== X-Google-Smtp-Source: AGHT+IGR72B5FSNwptu8nIdzDRz8CnDrw9iuCOSlOekEKtQ6YYvs8fHo3e9HOVhc0kBBoZGRhRMO694eEGWTeO9aimM= X-Received: by 2002:a05:6902:1b0f:b0:e87:a679:6140 with SMTP id 3f1490d57ef6-e89a0cbe333mr11807696276.37.1751833333206; Sun, 06 Jul 2025 13:22:13 -0700 (PDT) Received: from 490177373942 named unknown by gmailapi.google.com with HTTPREST; Sun, 6 Jul 2025 13:22:12 -0700 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 From: Ahmad Khalifa X-Mailer: aerc 0.20.1 References: <202507061928.566JSLh9096963@gitrepo.freebsd.org> In-Reply-To: Date: Sun, 6 Jul 2025 13:22:12 -0700 X-Gm-Features: Ac12FXy5pJFtqm3Ew0IHalv_9S7OvVnuwhr8SaAhLWPejJN4AOQa_M8nVPy0nJA Message-ID: Subject: Re: git: 85dcdb7aad85 - main - amd64: allow the mapping of other regions for efirt To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Spamd-Result: default: False [-0.25 / 15.00]; NEURAL_SPAM_LONG(0.80)[0.799]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_MEDIUM(-0.45)[-0.448]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; NEURAL_HAM_SHORT(-0.11)[-0.105]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::b33:from]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-Rspamd-Queue-Id: 4bZzLh0bn9z3Tpt X-Spamd-Bar: / On Sun Jul 6, 2025 at 11:02 PM +0300, Ahmad Khalifa wrote: > On Sun Jul 6, 2025 at 10:43 PM +0300, Konstantin Belousov wrote: >> On Sun, Jul 06, 2025 at 07:28:21PM +0000, Ahmad Khalifa wrote: >>> The branch main has been updated by vexeduxr: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=85dcdb7aad85498b3f497b8752e69b8612b27cb7 >>> >>> commit 85dcdb7aad85498b3f497b8752e69b8612b27cb7 >>> Author: Ahmad Khalifa >>> AuthorDate: 2025-07-06 19:10:25 +0000 >>> Commit: Ahmad Khalifa >>> CommitDate: 2025-07-06 19:26:07 +0000 >>> >>> amd64: allow the mapping of other regions for efirt >>> >>> Some BIOSes access data outside of regions marked as "runtime" in their >>> runtime EFI functions. Allow the mapping and preservation of other >>> regions through a tunable. >>> >>> The tunable is a bitmap specifying the regions to map. e.g bit 3 would >>> be set to map BootServicesCode. >>> >>> Currently allowed regions are: >>> BootServicesCode >>> BootServicesData >>> RuntimeServicesCode >>> RuntimeServicesData >>> ACPIMemoryNVS >>> >>> PR: 287422 >>> Reviewed by: kib >>> Approved by: imp (mentor) >>> Differential Revision: https://reviews.freebsd.org/D51146 >>> --- >>> sys/amd64/amd64/efirt_machdep.c | 18 +++++++++++++++++- >>> sys/amd64/amd64/machdep.c | 8 ++++++-- >>> sys/amd64/include/efi.h | 4 ++++ >>> 3 files changed, 27 insertions(+), 3 deletions(-) >>> >>> diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c >>> index 81a28ebe97ee..75c357f6e3df 100644 >>> --- a/sys/amd64/amd64/efirt_machdep.c >>> +++ b/sys/amd64/amd64/efirt_machdep.c >>> @@ -56,6 +56,15 @@ >>> #include >>> #include >>> >>> +/* The EFI regions we're allowed to map. */ >>> +#define EFI_ALLOWED_TYPES_MASK ( \ >>> + 1u << EFI_MD_TYPE_BS_CODE | 1u << EFI_MD_TYPE_BS_DATA | \ >>> + 1u << EFI_MD_TYPE_RT_CODE | 1u << EFI_MD_TYPE_RT_DATA | \ >>> + 1u << EFI_MD_TYPE_FIRMWARE \ >>> +) >>> + >>> +uint32_t efi_map_regs; >>> + >> >> Apparently efi_map_regs must be defined in amd64/machdep.c and not in >> efirt_machdep.c. If efirt is compiled as module, efo_map_regs gets >> undefined in the kernel. > > Ah, nice catch. Review opened. Hmm, apparently active_efi_ops has this issue too. From nobody Sun Jul 6 20:47:27 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bZzvh1dQzz61lkV; Sun, 06 Jul 2025 20:47: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bZzvh0W9zz3XrK; Sun, 06 Jul 2025 20:47:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751834848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uZmGYTDDN5CqN6D1U6NlDFThU5QJTLQ9V/aLRB5x9G4=; b=S99KkKPFrtLpljaRDf3nrUO69icZnJNyYDVMHA4awNCGyo/euB6heYDkuS3zgy0TmrysDS NoyVLh/mrEn7QSQk8h//r1tUrF+gYOqJ4NdgC+cLP85nMW0+7C9AxAmWcyyVR7IAUGNQpS D0qZPSDruTWoIsWNeNxWsSwEhHCvjIXr1DPe9xSHvdben+Yn3ie11y/rsXOo+xNFo+a17/ Kd80c95+WzkHvtswVkif5Dve/xN0CcFxfK09oTK06Cs3OU0X5atWmbpLHNpHu18Uvvo6tq afWJujkQv5D3g5pXUTKTf6nxR8Iz8s4lGHPiw1rYryqeSvS4Okmn/RprmE1nkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751834848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uZmGYTDDN5CqN6D1U6NlDFThU5QJTLQ9V/aLRB5x9G4=; b=jvkwTYiYnCA6aCBtjoDP22cMxrlHPBGqxf1oXgwg3O1pw0ws0kQruewD/LhwvFYDY3Y/x4 v5kZRZ8qtX9+9Pp4DaEvi4pxJOymqSSx0JRtDeAoj8axqLtyThxydinaLA2A7SEKZZiUeL CwwyQU0NIfC7+9QBxPD9f8N6bFyk/MK1WElQLfKkCbUHQ4cVOXHdEAGASFqOL9e4gYCGuh hV6EaFMWEyVJjkE3era/fu40xvZVyF/uw2U611OdYSZJwRDQZSogvE7x5K99GxfDAk8MC+ R25NDDfIc+LHTbcdt4AHYyVAGIxwheUJOVQs6iPCUEtcE/Cey7/bl2jIRplFPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751834848; a=rsa-sha256; cv=none; b=al1DfiVK0xhMApACtqYkcNLXpkz2QGC1H+HWhCZNisYbgLuUyp4PTMfnUrZ2UNU/6MosfG tlM1j/pfxllmXJ65JkIRpY0alK3I7hcg9huAwePYWXFSIrV30Ls/ElzXSEYx6GMtaoVULR M0Hn7MXN8ZRtUNJt8kNo202/J4du3YNzz57/Mue3mryHBpIJPohbnUUtPkENft0oswfAFq GqO2zspHX7eBI/5bUv/6RDfUuv94pVsYSPsvbSnvzJHV7HIaODcrBFUoN2GhiiBCuVcFE2 8a+Xw/u33OZnlRZ83RDg2E9iyNJol0mO3B00d9FwMyL79OOCjzg9Ao7p4JJ0fA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bZzvg6y93z55v; Sun, 06 Jul 2025 20:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566KlR6m046626; Sun, 6 Jul 2025 20:47:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566KlRUl046623; Sun, 6 Jul 2025 20:47:27 GMT (envelope-from git) Date: Sun, 6 Jul 2025 20:47:27 GMT Message-Id: <202507062047.566KlRUl046623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 2d6185cf87e8 - main - vm_fault: drop never-true busy_sleep test List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d6185cf87e815d4951a9ddcf5c535ebd07a8815 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=2d6185cf87e815d4951a9ddcf5c535ebd07a8815 commit 2d6185cf87e815d4951a9ddcf5c535ebd07a8815 Author: Doug Moore AuthorDate: 2025-07-06 20:46:00 +0000 Commit: Doug Moore CommitDate: 2025-07-06 20:46:00 +0000 vm_fault: drop never-true busy_sleep test vm_fault_busy_sleep() tests to see whether the page fs->m matches the value looked up at fs->pindex. At that point, a lock is held on fs->object, and it has been held since before vm_fault_object() also looked up fs->pindex in fs->object and stored the result in fs->m. So the values must match, and the test is not necessary. Drop it. Reviewed by: alc, markj Differential Revision: https://reviews.freebsd.org/D51179 --- sys/vm/vm_fault.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 21584abacfa3..3e57e8d4f1d0 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1441,8 +1441,7 @@ vm_fault_busy_sleep(struct faultstate *fs) } vm_object_pip_wakeup(fs->object); vm_fault_unlock_map(fs); - if (fs->m != vm_page_lookup(fs->object, fs->pindex) || - !vm_page_busy_sleep(fs->m, "vmpfw", 0)) + if (!vm_page_busy_sleep(fs->m, "vmpfw", 0)) VM_OBJECT_UNLOCK(fs->object); VM_CNT_INC(v_intrans); vm_object_deallocate(fs->first_object); From nobody Sun Jul 6 21:01:31 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb0D76zL6z61nl9; Sun, 06 Jul 2025 21:01:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) 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 4bb0D73BN2z3cw6; Sun, 06 Jul 2025 21:01:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) 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 566L1VTR082768; Mon, 7 Jul 2025 00:01:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 566L1VTR082768 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 566L1VmB082767; Mon, 7 Jul 2025 00:01:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 7 Jul 2025 00:01:31 +0300 From: Konstantin Belousov To: Ahmad Khalifa Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 85dcdb7aad85 - main - amd64: allow the mapping of other regions for efirt Message-ID: References: <202507061928.566JSLh9096963@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4bb0D73BN2z3cw6 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Sun, Jul 06, 2025 at 01:22:12PM -0700, Ahmad Khalifa wrote: > On Sun Jul 6, 2025 at 11:02 PM +0300, Ahmad Khalifa wrote: > > On Sun Jul 6, 2025 at 10:43 PM +0300, Konstantin Belousov wrote: > >> On Sun, Jul 06, 2025 at 07:28:21PM +0000, Ahmad Khalifa wrote: > >>> The branch main has been updated by vexeduxr: > >>> > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=85dcdb7aad85498b3f497b8752e69b8612b27cb7 > >>> > >>> commit 85dcdb7aad85498b3f497b8752e69b8612b27cb7 > >>> Author: Ahmad Khalifa > >>> AuthorDate: 2025-07-06 19:10:25 +0000 > >>> Commit: Ahmad Khalifa > >>> CommitDate: 2025-07-06 19:26:07 +0000 > >>> > >>> amd64: allow the mapping of other regions for efirt > >>> > >>> Some BIOSes access data outside of regions marked as "runtime" in their > >>> runtime EFI functions. Allow the mapping and preservation of other > >>> regions through a tunable. > >>> > >>> The tunable is a bitmap specifying the regions to map. e.g bit 3 would > >>> be set to map BootServicesCode. > >>> > >>> Currently allowed regions are: > >>> BootServicesCode > >>> BootServicesData > >>> RuntimeServicesCode > >>> RuntimeServicesData > >>> ACPIMemoryNVS > >>> > >>> PR: 287422 > >>> Reviewed by: kib > >>> Approved by: imp (mentor) > >>> Differential Revision: https://reviews.freebsd.org/D51146 > >>> --- > >>> sys/amd64/amd64/efirt_machdep.c | 18 +++++++++++++++++- > >>> sys/amd64/amd64/machdep.c | 8 ++++++-- > >>> sys/amd64/include/efi.h | 4 ++++ > >>> 3 files changed, 27 insertions(+), 3 deletions(-) > >>> > >>> diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c > >>> index 81a28ebe97ee..75c357f6e3df 100644 > >>> --- a/sys/amd64/amd64/efirt_machdep.c > >>> +++ b/sys/amd64/amd64/efirt_machdep.c > >>> @@ -56,6 +56,15 @@ > >>> #include > >>> #include > >>> > >>> +/* The EFI regions we're allowed to map. */ > >>> +#define EFI_ALLOWED_TYPES_MASK ( \ > >>> + 1u << EFI_MD_TYPE_BS_CODE | 1u << EFI_MD_TYPE_BS_DATA | \ > >>> + 1u << EFI_MD_TYPE_RT_CODE | 1u << EFI_MD_TYPE_RT_DATA | \ > >>> + 1u << EFI_MD_TYPE_FIRMWARE \ > >>> +) > >>> + > >>> +uint32_t efi_map_regs; > >>> + > >> > >> Apparently efi_map_regs must be defined in amd64/machdep.c and not in > >> efirt_machdep.c. If efirt is compiled as module, efo_map_regs gets > >> undefined in the kernel. > > > > Ah, nice catch. Review opened. > > Hmm, apparently active_efi_ops has this issue too. I do not think so. From nobody Sun Jul 6 21:02:58 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb0FZ4wcHz61nlJ; Sun, 06 Jul 2025 21:02: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb0FZ4Fywz3dpJ; Sun, 06 Jul 2025 21:02:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751835778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pM1Cy5Kw4UZjwy569XgkU6F+y2HlBRIJx9svrsLA9JU=; b=LSAUGytCZLbQhgXXVnU/pif926CqoeEFWIeSIkmCi5Ld/dFF2vU/AN9geAVUHj8/1v27JK AtT9t66b3Vbtc+MZNBGAqDyTju123MWDBVt+rJYO2opblvVg6Eem3AyS49uf+54CTcfQOe PXh2nvMKpbQhxDGB5bJLA2o/iZ4cyVuq8yeBCK/4DvStqmTOrof55xSIlkaoMUNLy569Hy dtrH1dk4ftqLldc9Qw+nJiv8hdThTr0agP2QqLVDt00Hpe62Q5Nkg90aH77vBOHRJ4ng9x zpeV6GlogBK3Ck9dNrSlBOvlOHAgJca+YS4htCEKozdvhMfGJATz1FsYJFysGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751835778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pM1Cy5Kw4UZjwy569XgkU6F+y2HlBRIJx9svrsLA9JU=; b=Y/OUcA1F4Q6oE68/23lJJbXstPy023TyqKN27XgL3HfeNT+YC1/8nwbrVSVtYuXDxfqGsg d986IW0DVeiJ7ROEQxDms3y4nIq03b0mi07G+RpWOg4xMk1ggGVGXYOpOs2dectiilMvVd 9ONu8VcNCZT3vs3o0mmWuKvLKFlnHyuWMDE7zJuRV/7nKjDn0BWwvpF5mPO/gvlSK5hSQ0 NaDri4Q7yoo3oSPtFE9XgSR+boD9LKfJ+SEkU7d6B9bHDaLO8BairX4+W61vtlidM03OTA I3kTTg5OndAdNmXYNJZ2L81+X68Dq3qp234m9ci2qWphGdQI3c7dFgQE42aPRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751835778; a=rsa-sha256; cv=none; b=ngBTo5nm+EMFhXv05eoGaGxz08z0EJR94WmY6ihhrrpVOjKpGeieAvgRG8TJ/YFNMR4YJq TNIEeGGp8w4nkJ26ABi95/W8hTfbnQZTpe3XSECk/wSGugRq0W+IYTBsswopvXRgyL4+i6 aDMZIRJ8TeGxNh6h+cvNuWJ36PHsONQAdyYD890FpTPo2j31wDwO4Pb9SZN25LOIRsrFiB q26VHEXt8rHFR1OKZDyxJUzuCI0taRpIGqPj8q55fl4H2uc9Y/KMB6ob27CZul8M8Anba5 8/8+V8gbrcoq3RUJJ6FHIo8e+z6L9Ki2go62Re93EIdwIq+Hv9PwAEq4j8GheA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb0FZ3lDLz64J; Sun, 06 Jul 2025 21:02:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566L2wrM084072; Sun, 6 Jul 2025 21:02:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566L2wDT084069; Sun, 6 Jul 2025 21:02:58 GMT (envelope-from git) Date: Sun, 6 Jul 2025 21:02:58 GMT Message-Id: <202507062102.566L2wDT084069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: d3c06bed2c16 - main - clang: install clang-scan-deps List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3c06bed2c16b434dd49958dee5de8c55ad00b85 Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=d3c06bed2c16b434dd49958dee5de8c55ad00b85 commit d3c06bed2c16b434dd49958dee5de8c55ad00b85 Author: Lexi Winter AuthorDate: 2025-07-06 20:42:58 +0000 Commit: Lexi Winter CommitDate: 2025-07-06 21:02:52 +0000 clang: install clang-scan-deps clang-scan-deps is used to generate dependency information from C++20 modules according to proposed standard ISO/IEC WG21 P1689R5[0]. It is required by common build tools (e.g., CMake) to build C++ sources that use modules. Since this is a core build tool, install it by default, not gated behind MK_CLANG_EXTRAS. [0] https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2022/p1689r5.html MFC after: 3 days Reviewed by: kevans, dim Approved by: kevans (mentor) Requested by: jbo Differential Revision: https://reviews.freebsd.org/D51044 --- lib/clang/libclang/Makefile | 6 +++++ usr.bin/clang/Makefile | 4 ++++ usr.bin/clang/clang-scan-deps/Makefile | 26 ++++++++++++++++++++++ .../clang-scan-deps/clang-scan-deps-driver.cpp | 18 +++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/lib/clang/libclang/Makefile b/lib/clang/libclang/Makefile index dc9e0010e309..7eb2c99b25c8 100644 --- a/lib/clang/libclang/Makefile +++ b/lib/clang/libclang/Makefile @@ -841,6 +841,11 @@ SRCS_MIN+= Tooling/ArgumentsAdjusters.cpp SRCS_MIN+= Tooling/CommonOptionsParser.cpp SRCS_MIN+= Tooling/CompilationDatabase.cpp SRCS_MIN+= Tooling/Core/Replacement.cpp +SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningFilesystem.cpp +SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningService.cpp +SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningTool.cpp +SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningWorker.cpp +SRCS_MIN+= Tooling/DependencyScanning/ModuleDepCollector.cpp SRCS_MIN+= Tooling/ExpandResponseFilesCompilationDatabase.cpp SRCS_MIN+= Tooling/FileMatchTrie.cpp SRCS_MIN+= Tooling/GuessTargetAndModeCompilationDatabase.cpp @@ -848,6 +853,7 @@ SRCS_MIN+= Tooling/Inclusions/HeaderIncludes.cpp SRCS_MIN+= Tooling/Inclusions/IncludeStyle.cpp SRCS_MIN+= Tooling/InterpolatingCompilationDatabase.cpp SRCS_MIN+= Tooling/JSONCompilationDatabase.cpp +SRCS_MIN+= Tooling/LocateToolCompilationDatabase.cpp SRCS_MIN+= Tooling/Refactoring.cpp SRCS_MIN+= Tooling/RefactoringCallbacks.cpp SRCS_MIN+= Tooling/Tooling.cpp diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile index a0cc015590f0..e2debfb8c582 100644 --- a/usr.bin/clang/Makefile +++ b/usr.bin/clang/Makefile @@ -5,6 +5,10 @@ SUBDIR+= clang .endif .if !defined(TOOLS_PREFIX) +.if ${MK_CLANG} != "no" +SUBDIR+= clang-scan-deps +.endif + # LLVM binutils are needed to support features such as LTO, so we build them # by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them # as the default binutils (ar,nm,addr2line, etc.). diff --git a/usr.bin/clang/clang-scan-deps/Makefile b/usr.bin/clang/clang-scan-deps/Makefile new file mode 100644 index 000000000000..16fecdb88867 --- /dev/null +++ b/usr.bin/clang/clang-scan-deps/Makefile @@ -0,0 +1,26 @@ +.include + +PROG_CXX= clang-scan-deps +MAN= + +SRCDIR= clang/tools/clang-scan-deps +SRCS+= ClangScanDeps.cpp \ + clang-scan-deps-driver.cpp + +.include "${SRCTOP}/lib/clang/clang.pre.mk" + +CFLAGS+= -I${.OBJDIR} +TDFILE= Opts.td +INCFILE= ${TDFILE:.td=.inc} +GENOPT= -gen-opt-parser-defs + +${INCFILE}: ${TDFILE} + ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \ + -o ${.TARGET} ${.ALLSRC} +TGHDRS+= ${INCFILE} + +DEPENDFILES+= ${TGHDRS:C/$/.d/} +DPSRCS+= ${TGHDRS} +CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} + +.include "../clang.prog.mk" diff --git a/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp b/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp new file mode 100644 index 000000000000..f941cc434ff6 --- /dev/null +++ b/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp @@ -0,0 +1,18 @@ +//===-- driver-template.cpp -----------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/LLVMDriver.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/InitLLVM.h" + +int clang_scan_deps_main(int argc, char **, const llvm::ToolContext &); + +int main(int argc, char **argv) { + llvm::InitLLVM X(argc, argv); + return clang_scan_deps_main(argc, argv, {argv[0], nullptr, false}); +} From nobody Sun Jul 6 21:14:33 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb0Vy0dk1z61pj3; Sun, 06 Jul 2025 21:14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb0Vx6nChz3g7v; Sun, 06 Jul 2025 21:14:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751836474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RlxCrDQA8XHO9e2xJzEaQ77C4mO2McoNvBCxq+7P4zo=; b=SAbOu3sMhWH92+++U/8BoiWs34ASqm3/S5wCJuzo7mkGBb5uaAutckND9O5sX1//VCvgQJ dUGqxawl7qBM4Nqf2EZ1Rd3aRWBfjUQ0oo7IRN8u7WYj13an4bqYN2r7j8ICEBu3elSjrM zRsCAqmK731JrhMGEWzbEzbcXEcolVoV7H9e9xAYzbLQx+EnJtupx8E40Up6s5P3XoTArC x6ligkvfRKmljuCGK9GJY3NAx13Rp5AkwosoMT27EfV/x5g1BKwtAcaGlVVe+aSx05bf5l tOLmz0r6VEUO+Ds+/Q/DABlNwVG/OuwbZmo4O6WEiRVhhBimLcCMu04nc6+HGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751836473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RlxCrDQA8XHO9e2xJzEaQ77C4mO2McoNvBCxq+7P4zo=; b=McjsZjj3QyKkBPRjE4FDA6T+i+/w2Dv0ZsmTRLdLxvYIreD/KBprYYwSanyrNzgBBhwl1a 98qVjg0XE1LOK+24MmU4nbISLhTHLW1KKzgh25M1KV/sSF5DVfuDPn8ROoRXHUQbizRIFB RLhhmmA6EbHPwn8zmTLsvsBM1PB2qmfEop36szPW3KGFitGpbAhQFexvlbeFHZYsz/y45W t1Lmx03k0cUtf81lOdAMs2EWn+hr3S0mpYAVXSTliwZxEHhjERxVtyV7mcOkp4Gut772Sc pY0Uxk6IuwClDi5hDOP5kHmsaarpTyTxE//cp1XuW7RndlLCvQVJQAKcOOVJ0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751836474; a=rsa-sha256; cv=none; b=VFXdcLeSfwqNmHlQPa+HsJn4co3/fXXlBacGMXKql4cjgxjostomRDJjFl2gx58DkLJ6nW QiNAJZ8wUANT7tJnCVjnPm/6wZHb0DgZIqsnKc9XTjeHGdCqe4at+ol3hFgxc2BXAnoFSW TW9EVtXcgBYQnISWgPsCSzS/2zobv0zYYF7d/MZ679F+D5O0ItSzwG67BwyNVW3VGW0RYK UczTeI28udXxUyBB3vzVeIJIVE95J5EfeUnWAIhxekM1N28ZvTVtDF7qlgrKaWxoWY/Q5C /MjNIp5Sqx/aH31/jMJJYA5MQLKURpACPmwHvq8o0C4GqByzs34P6VbgWM1M9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb0Vx6Lpkz6hD; Sun, 06 Jul 2025 21:14:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566LEXbN003080; Sun, 6 Jul 2025 21:14:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566LEXl7003077; Sun, 6 Jul 2025 21:14:33 GMT (envelope-from git) Date: Sun, 6 Jul 2025 21:14:33 GMT Message-Id: <202507062114.566LEXl7003077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 21a0a2c04ca4 - main - exterrctl(2): mark as CAPENABLED List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 21a0a2c04ca4084afb98d406e20407ec834e71aa Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=21a0a2c04ca4084afb98d406e20407ec834e71aa commit 21a0a2c04ca4084afb98d406e20407ec834e71aa Author: Konstantin Belousov AuthorDate: 2025-07-06 12:13:04 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-06 21:14:13 +0000 exterrctl(2): mark as CAPENABLED Sponsored by: The FreeBSD Foundation --- 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 2ab17e036d5c..90559fab6086 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -3349,7 +3349,7 @@ size_t size ); } -592 AUE_NULL STD { +592 AUE_NULL STD|CAPENABLED { int exterrctl( u_int op, u_int flags, From nobody Sun Jul 6 21:14:34 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb0Vz30tMz61pbN; Sun, 06 Jul 2025 21:14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb0Vz0hGfz3g6D; Sun, 06 Jul 2025 21:14:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751836475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xuHJNoWchXPWbUwE4HGXJnEhE3w5JAtqtsg5RIE7WG4=; b=RgKxIBnHyXHt4+tJFctRESnlyE66QKN7Df0KkrRps1ZVeBZP0/NSGb30xpeb5k2AcXAmr4 ZIzTBcVpHBVfWiBOaOsIkkH1Jd5PZ2UtbfgUfBi2cHuautyLHqn6Hj2TbLqGu2CvUD/mLI JxiZ/OhhydifZ5iLjR95MS+9y+IOjO9Af+ppl4KvEO2J6fsWpF9t4HtSy9/igzUgv0QwLk eR4+YPmXNv1OZPeePll2mFwTUbSGSZJ3xQNOGh+irOoJKUeDVAFV3eKFHQf6Iuym4YC78u 5gtg7B4VfJKR/3mpSg0wLDoAecc5N6Vj60j9ACE7sd1e9oIyS+HpQzyjhikVtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751836475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xuHJNoWchXPWbUwE4HGXJnEhE3w5JAtqtsg5RIE7WG4=; b=sp+CVOgs1qgXuGDE5oVYDln5llH6dtLH+dkTzy2Op0RWZanSqqV/uj2Q2yguUFdCbyufzt lQBkIXxXKP5cImw453EvowA0MOFo6XrxBM4VNPDm1AcR8swhokeACLtVr17susPrtVjnGc TVoXQqeIdXVchhcDxT+/VSovx0OAZn3l18mSfE/6tj9a9kyyE+ac6V4P114SFdHMSqlyWC 9rt7r7o5lsP4uQNlrxtlZRRrq80RgCk+SDpuahte+Saxqxsmmnj1vKgDei7v6Sy/kAFz7K jHMPD6gn66vDDTRDcjbW9XJg09mklaD5P22cEdHMflE2lxtgPsHc0VVqZWLlkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751836475; a=rsa-sha256; cv=none; b=YZ8Yhe/Tz4kRM4pg+irFm1negAyTuh70ADA9VfA5EE1D+bQ/ezHyb1O4eGLJa0D+0tHXjt swfhCJ9qX4MND5s/ebW3gpX1xVSzvjaNDQExAk/e7Kwo3neHr1KzsVvQi+DYKIxQ2Hf+xn fnQp2bQnlXRr5mQagSdyh1Ij0UVeWJu8Q6s3+8esp61NZ2rf1RgPwlIiyVyTRPuFKY36H6 g/OJ43/KU+z1xCwr62S6DlXkYZYoRDDjipwy4I0IGu0Ei2ElomcZ4F5sfAH3Fy/b9i9wP+ VffCwXVPGbZNkvyoppJbMXHv4nxe+mX0nSCjC08K3sATOyDQJ0Yn+iVarV3/9Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb0Vz08prz6hF; Sun, 06 Jul 2025 21:14:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566LEYEJ003114; Sun, 6 Jul 2025 21:14:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566LEY9U003111; Sun, 6 Jul 2025 21:14:34 GMT (envelope-from git) Date: Sun, 6 Jul 2025 21:14:34 GMT Message-Id: <202507062114.566LEY9U003111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: baa15beed7f1 - main - sys/sysent.h: use two nibbles for flags, and remove unused SY_THR_FLAGMASK List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: baa15beed7f1f51c213ae434d3655c6664da8786 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=baa15beed7f1f51c213ae434d3655c6664da8786 commit baa15beed7f1f51c213ae434d3655c6664da8786 Author: Konstantin Belousov AuthorDate: 2025-07-06 12:13:50 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-06 21:14:13 +0000 sys/sysent.h: use two nibbles for flags, and remove unused SY_THR_FLAGMASK Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/sys/sysent.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 6314b03142e7..4ddfc8516053 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -79,11 +79,10 @@ struct sysent { /* system call table */ */ #define SYF_CAPENABLED 0x00000001 -#define SY_THR_FLAGMASK 0x7 -#define SY_THR_STATIC 0x1 -#define SY_THR_DRAINING 0x2 -#define SY_THR_ABSENT 0x4 -#define SY_THR_INCR 0x8 +#define SY_THR_STATIC 0x01 +#define SY_THR_DRAINING 0x02 +#define SY_THR_ABSENT 0x04 +#define SY_THR_INCR 0x08 #ifdef KLD_MODULE #define SY_THR_STATIC_KLD 0 From nobody Sun Jul 6 21:14:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb0W13dLdz61pgK; Sun, 06 Jul 2025 21:14: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb0W050qXz3fyP; Sun, 06 Jul 2025 21:14:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751836476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2nyBtGA0SUzN+/VkDJTn9rFUCf/OXgGSnjvSO8+CqpM=; b=ylVaPI29K5vKUiFmAgkIXy6lG9F1jV23bx/3aEdgqTPxNSac39qHn/Pj6TporYdC60SHTM w229NoBxdd/VR2rly0JsRWKn7ZwkXbo+Q1/HhFbf8RC/uWBi4f6Y6StnPK1yrwE5fS3e7n ssFU8ZjK8qpL8HgQ8igaRzMXXNMOMZzMaBHkfprvPw+rfTXYn0GvkHAJATujC8fNCEQmd2 hAgS1x2eju+cRblEqPHNtZM6+plEdsChbPrIuocPE4r5OTz37XXaIRgCYMieTCwGKrEEOj l73nSbOrBhn8VtJ6swaVTi5oSiaHJOHL8I7AEAK2X3UkRCeVMdF6btZ4rfqTkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751836476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2nyBtGA0SUzN+/VkDJTn9rFUCf/OXgGSnjvSO8+CqpM=; b=q7rPq3D0ad2i1sBka0tHhaa78WXbqFN/0tDkVQr/HwK+8TDXPBmc0bOgB2kVONp9//Z0x+ 8Y/lG6QF8Dcu3RY1Xig3aXuAjefvFWiluERF8Ve9vx00lsWGOnlZ38GWkC+J3vfb9xQgqq nqAlU1d2XID7QTYeMRMP/41yV1nEaZmkaoayCvXT2KILdHPgNRJ0IHQZCei8IyNNrgQ5Sy IJ8txcwa22b/7tI8/j/LCYetfS2gUJ0mUVeRvcgMlpj0maHzT81qbJ/nTeAResmn53N11G rR+VS6gdEfj23MWMOKBj9qLuBEci5WBWGF3nM7f3rAfepGzrY1OchtTIC0lAqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751836476; a=rsa-sha256; cv=none; b=f8EWmvtXakoUMasg6eUD7Tc9QzPo+cjMrT9pcy3Rr2pZsv81OFCAzylrQmHyB0c5YiVInK d4UJxKy0zmRPjoPdMqWXAQ2mnGYaQFadnptbkkIqR1DFZY/11lzv+whDr0tNUvowP1RYH2 SRwWdpojpxSZKzBaSrpI+QIVkGRbvLiP2pE8J2s0z9HDiYn3NpuVZkqdcmpa/e4ucxsdel IPe3LhEuJ3oYZQGJB04zzlmPEzjxjV4xEVsH8YazPZZ50GBOsKbrLMHUXd8ia0oKuIbTRt ordx/JoTXUat9jEFoaikfKF/OBWxLczU3npDWNUropUAzIB7i0NrbsBM14w8cg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb0W0182Hz6Yl; Sun, 06 Jul 2025 21:14:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566LEa4o003151; Sun, 6 Jul 2025 21:14:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566LEarb003148; Sun, 6 Jul 2025 21:14:36 GMT (envelope-from git) Date: Sun, 6 Jul 2025 21:14:36 GMT Message-Id: <202507062114.566LEarb003148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 26061e4e542d - main - kern: add kern_nosys() and use it instead of type-punning the sys_nosys() arg List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26061e4e542d220c577fb3437a9a9f108dc27698 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=26061e4e542d220c577fb3437a9a9f108dc27698 commit 26061e4e542d220c577fb3437a9a9f108dc27698 Author: Konstantin Belousov AuthorDate: 2025-07-06 12:18:11 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-06 21:14:14 +0000 kern: add kern_nosys() and use it instead of type-punning the sys_nosys() arg Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_sig.c | 9 +++++++-- sys/kern/kern_syscalls.c | 5 +++-- sys/kern/sysv_msg.c | 2 +- sys/kern/sysv_sem.c | 2 +- sys/kern/sysv_shm.c | 2 +- sys/sys/syscallsubr.h | 1 + 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index a61ebfc5c7c8..5d51aa675cb7 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1050,8 +1050,7 @@ osigaction(struct thread *td, struct osigaction_args *uap) int osigreturn(struct thread *td, struct osigreturn_args *uap) { - - return (nosys(td, (struct nosys_args *)uap)); + return (kern_nosys(td, 0)); } #endif #endif /* COMPAT_43 */ @@ -4287,6 +4286,12 @@ struct nosys_args { /* ARGSUSED */ int nosys(struct thread *td, struct nosys_args *args) +{ + return (kern_nosys(td, args->dummy)); +} + +int +kern_nosys(struct thread *td, int dummy) { struct proc *p; diff --git a/sys/kern/kern_syscalls.c b/sys/kern/kern_syscalls.c index 24406763a93a..a93d711e7597 100644 --- a/sys/kern/kern_syscalls.c +++ b/sys/kern/kern_syscalls.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -50,14 +51,14 @@ int lkmnosys(struct thread *td, struct nosys_args *args) { - return (nosys(td, args)); + return (kern_nosys(td, 0)); } int lkmressys(struct thread *td, struct nosys_args *args) { - return (nosys(td, args)); + return (kern_nosys(td, 0)); } struct sysent nosys_sysent = { diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 11141d197aec..a545a0a54c25 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -1724,7 +1724,7 @@ freebsd32_msgsys(struct thread *td, struct freebsd32_msgsys_args *uap) return (sys_msgsys(td, (struct msgsys_args *)uap)); } #else - return (nosys(td, NULL)); + return (kern_nosys(td, 0)); #endif } diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index e399517010fc..a99e1a4de14e 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1904,7 +1904,7 @@ freebsd32_semsys(struct thread *td, struct freebsd32_semsys_args *uap) return (sys_semsys(td, (struct semsys_args *)uap)); } #else - return (nosys(td, NULL)); + return (kern_nosys(td, 0)); #endif } diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 60e3fe92a4b7..8d1a469127c6 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1474,7 +1474,7 @@ freebsd32_shmsys(struct thread *td, struct freebsd32_shmsys_args *uap) return (EINVAL); } #else - return (nosys(td, NULL)); + return (kern_nosys(td, 0)); #endif } diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index fe6dd9e14fb4..fd183ffbc7a4 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -257,6 +257,7 @@ int kern_munlock(struct thread *td, uintptr_t addr, size_t size); int kern_munmap(struct thread *td, uintptr_t addr, size_t size); int kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt); +int kern_nosys(struct thread *td, int dummy); int kern_ntp_adjtime(struct thread *td, struct timex *ntv, int *retvalp); int kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap, long *ploff); From nobody Sun Jul 6 21:20:55 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb0fJ3cbZz61qMJ; Sun, 06 Jul 2025 21:20: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb0fH71HSz3hVX; Sun, 06 Jul 2025 21:20:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751836856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0oScYc7wTCerMv5VgA+Ef/A4biFx0Jfd/bEkFxH7fT0=; b=wOqUi7zBgDWv0tLX0QovtEr7dJkCe2YZ6w7G7HrJJkDFMkPO624plK9PvcN/YPbSRjmPrN rozpc+ybAxIa9INqKsnMYEZPTqAm9r8mhgtbG4HZtUo+rHabG+sLqneKeT7UDPjx7+HzuV 4ADHfw1VHIYTxWwDqnIrdW4WFvZNtapPAlNmDsZGpJbZxCYszo9T+rE8nzZozenUXlGrLP lSCJvYUHz9Uo1mrKe/CSmmSAGRIk/5k1S8x2E6SiOZiWhZtAieEdXdZmB4npiFefThBXsV npaFL/RAZ68qgJSR7FRNBG65W6q3bB1tP+MjUXYUCd7IiCNqDENGpQreCc6N9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751836856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0oScYc7wTCerMv5VgA+Ef/A4biFx0Jfd/bEkFxH7fT0=; b=sJk71YaRR0tCDhiWAomxOikbaSH0CDtZAX6zw5iyNfVVCrsQq2nl/fCYL4j6YN+M1tyVtX CZR+FU5kJiheKoRLSu6xRMSYHcOcZrr4s1Amdc3Gx/VAXUrRonkXocLCP1qyBGvDtkMmNL 7O0DEpaWNtxfYkyZcAzPyCBIM8Ewk53wGugPBSn9b4mXbLmygf5hpuicegqIQ3LFtid/wo dVz5GcE2Ksy1meC3iLYMGxpxi02xwpSKNgh2Ve1WjIbU5yDQBMOwM/uqzK+Y5V9UwJFpu8 NDIWg3MiZOnEEtb19XuiSiIT//z6xVf1lFaS8BfTGmMExQX+TmI4YHzelVJ54A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751836856; a=rsa-sha256; cv=none; b=MPOrje/jcEyrkKUUJUBRCnOxfX+PUdNMXOC2wXImOr9PaPEDhSAY4p3qp/TNMZ5uk/YPpu 8w04F1wlkXgs+IJwBLAKySuhMrI1+D06haISD3bdJxbOqfJu7ewz8GsfDNqUhalO6216Hr Ask8v7psbISX9MRZbGKboPZBrnEP7SbyIzyEAV0l5PR1NwSfRTkuQNh7CHqWBOqWKSTuZ7 HeRBP1qIqW7CPKZnvrD/1A7/XWrvFS0GjbbVx/dQtH/MwCroVup0jTIUivg0gHmPJfuGTq t58zIdnTATxUlF0d0ufswR07Kmqu4YRrv0H8Hyx7Gwlg/HG0KxGvkbV8BTBWpQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb0fH68YPz6Md; Sun, 06 Jul 2025 21:20:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566LKtLE013889; Sun, 6 Jul 2025 21:20:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566LKtNw013886; Sun, 6 Jul 2025 21:20:55 GMT (envelope-from git) Date: Sun, 6 Jul 2025 21:20:55 GMT Message-Id: <202507062120.566LKtNw013886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0d011ec65367 - main - Regen. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d011ec65367fd84cea685d210bfbe4778a6fc9a Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0d011ec65367fd84cea685d210bfbe4778a6fc9a commit 0d011ec65367fd84cea685d210bfbe4778a6fc9a Author: Konstantin Belousov AuthorDate: 2025-07-06 21:20:45 +0000 Commit: Konstantin Belousov CommitDate: 2025-07-06 21:20:45 +0000 Regen. --- sys/compat/freebsd32/freebsd32_sysent.c | 2 +- sys/kern/init_sysent.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index 3718a1b0c8ee..ef0aff8bf852 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -659,7 +659,7 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(getrlimitusage_args), .sy_call = (sy_call_t *)sys_getrlimitusage, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 589 = getrlimitusage */ { .sy_narg = AS(fchroot_args), .sy_call = (sy_call_t *)sys_fchroot, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 590 = fchroot */ { .sy_narg = AS(freebsd32_setcred_args), .sy_call = (sy_call_t *)freebsd32_setcred, .sy_auevent = AUE_SETCRED, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 591 = freebsd32_setcred */ - { .sy_narg = AS(exterrctl_args), .sy_call = (sy_call_t *)sys_exterrctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 592 = exterrctl */ + { .sy_narg = AS(exterrctl_args), .sy_call = (sy_call_t *)sys_exterrctl, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 592 = exterrctl */ { .sy_narg = AS(inotify_add_watch_at_args), .sy_call = (sy_call_t *)sys_inotify_add_watch_at, .sy_auevent = AUE_INOTIFY, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 593 = inotify_add_watch_at */ { .sy_narg = AS(inotify_rm_watch_args), .sy_call = (sy_call_t *)sys_inotify_rm_watch, .sy_auevent = AUE_INOTIFY, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 594 = inotify_rm_watch */ }; diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 34e71a0665ed..91792430d24c 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -658,7 +658,7 @@ struct sysent sysent[] = { { .sy_narg = AS(getrlimitusage_args), .sy_call = (sy_call_t *)sys_getrlimitusage, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 589 = getrlimitusage */ { .sy_narg = AS(fchroot_args), .sy_call = (sy_call_t *)sys_fchroot, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 590 = fchroot */ { .sy_narg = AS(setcred_args), .sy_call = (sy_call_t *)sys_setcred, .sy_auevent = AUE_SETCRED, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 591 = setcred */ - { .sy_narg = AS(exterrctl_args), .sy_call = (sy_call_t *)sys_exterrctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 592 = exterrctl */ + { .sy_narg = AS(exterrctl_args), .sy_call = (sy_call_t *)sys_exterrctl, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 592 = exterrctl */ { .sy_narg = AS(inotify_add_watch_at_args), .sy_call = (sy_call_t *)sys_inotify_add_watch_at, .sy_auevent = AUE_INOTIFY, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 593 = inotify_add_watch_at */ { .sy_narg = AS(inotify_rm_watch_args), .sy_call = (sy_call_t *)sys_inotify_rm_watch, .sy_auevent = AUE_INOTIFY, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 594 = inotify_rm_watch */ }; From nobody Sun Jul 6 22:54:37 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb2kP5KcVz621RP; Sun, 06 Jul 2025 22:54: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb2kP4lxkz3qQP; Sun, 06 Jul 2025 22:54:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751842477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7svCGTiOC5DQRxOyo1fFAbcdN/RdngHLggED46Zha08=; b=HNIG4mZXA1chzFNjFk2/le593eSQ2ogRzfUMSDH/1haEuv2AmYdElxGKK5KmLuHb78cNmb gW6oJD75m8YgtCIveJ8FhkTxIgDClabk0hbkd6rF0t+u3ntc2dxBG9fi5CfUCIOwQyJTye cOQ9Lttu6D1Qy38zBxVUIS8LaZX4v6SRTHcCoSgSpmCsJsMrmaHMLumTM93ViPjpJaJi5f dFfNBcLJfEol1U+n3HXkVBpD/Z7oCYn+gO/MO3H7yaFNAtwJ+qt0Qmo2alHG0KdGLuC7Vz hWWjOgdLf3WiMniNY8wtFZqWt39XsP5l0n2R0lk2u8F1vK0zrEstBAb1HLTZ+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751842477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7svCGTiOC5DQRxOyo1fFAbcdN/RdngHLggED46Zha08=; b=o+S++mP4L2CMAptPmld2+4LXUV/LnaIeBiEFyPTf4YyY9yghcGpELmAJg7uCqWn3ce8Q1a 9RC9dYF48sZJB6FCK0xWCjqHbBR+w+33RSz/HO3y4BWFJnA/EPfMReH/VKbKF5a6Lp+YUw Oibt4N624bKKtvW5zuFm5aEPY99KhWWcyXKI/qIlWck1r7D9oX2xEDgFH9d6BgC6NibYO7 1/+kqyhURW7ZwIwAahqzA3NCKBn+guolZiLS/8CT0406J+1osJ+IWIEcn/GYQwifS9/KAB N8DV6x4T8A+/ZrJACRj9O7gwtlBLrD1kPZDIaEQqKMNxtBvRW/XbhfcW5FzpsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751842477; a=rsa-sha256; cv=none; b=qmSrPBHcDG98NqyLOQi0KMgjf35CRKMrF68Q2lhzzNDY2JX6eSm5COYj6eQIHDCvES9ANz VFVHUx3U/kXuwypGCWTVXylhNkT/NZoRpRqfuVMHBHQFUC1FqCYaVC55g0le/cb9/yWVHl 9bMswWLTVDTM2N3OlnB5+Nv4D3cF/wNYV2vud8U8rS/TTldmoUwzpaj5G3nZ5Y+2DAhtXe OlEgXUvv8wqlwmGLiExkgeJVlnNqsWpjAX+1z+9HVZC/Nu5qFSkZBUSsnxglRuyPplLDOM 88BiHdbtsDTBatzdYVDiQ+Er6FMHHnRkXstirMjleZKfPAbt6VmN8feJfJa6mw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb2kP42d2z8RN; Sun, 06 Jul 2025 22:54:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566MsbOm090924; Sun, 6 Jul 2025 22:54:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566MsbnL090918; Sun, 6 Jul 2025 22:54:37 GMT (envelope-from git) Date: Sun, 6 Jul 2025 22:54:37 GMT Message-Id: <202507062254.566MsbnL090918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: c5d72d29fe0e - main - nfsv4: Add support for the NFSv4 hidden and system attributes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5d72d29fe0e1a6ac1aaf622d8c4a6ca9422517a Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c5d72d29fe0e1a6ac1aaf622d8c4a6ca9422517a commit c5d72d29fe0e1a6ac1aaf622d8c4a6ca9422517a Author: Rick Macklem AuthorDate: 2025-07-06 22:49:53 +0000 Commit: Rick Macklem CommitDate: 2025-07-06 22:51:57 +0000 nfsv4: Add support for the NFSv4 hidden and system attributes There now appears to be a use for the NFSv4 hidden and system attributes for the Windows ms-nfs41 client. As such, this patch implements these using the UF_HIDDEN and UF_SYSTEM flags. Commit afd5bc630930 added support for _PC_HAS_HIDDENSYSTEM, to VOP_PATHCONF(), which is used by the server to check for support of the UF_HIDDEN and UF_SYSTEM flags. This patch only affects NFSv4 and only when the client/server on the other end supports the hidden and system attributes. --- sys/fs/nfs/nfs_commonsubs.c | 87 +++++++++++++++++++++++++++++++++-------- sys/fs/nfs/nfsproto.h | 8 ++++ sys/fs/nfsclient/nfs_clrpcops.c | 7 ++++ sys/fs/nfsclient/nfs_clvnops.c | 24 ++++++++++-- sys/fs/nfsserver/nfs_nfsdport.c | 20 +++++++--- sys/fs/nfsserver/nfs_nfsdserv.c | 33 +++++++++++++++- 6 files changed, 152 insertions(+), 27 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index f46b0d282861..4c498e96a3c0 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -630,6 +630,10 @@ nfscl_fillsattr(struct nfsrv_descript *nd, struct vattr *vap, NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_OWNERGROUP); if ((flags & NFSSATTR_FULL) && vap->va_size != VNOVAL) NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE); + if ((flags & NFSSATTR_FULL) && vap->va_flags != VNOVAL) { + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN); + NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM); + } if (vap->va_atime.tv_sec != VNOVAL) NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESSSET); if (vap->va_mtime.tv_sec != VNOVAL) @@ -1314,6 +1318,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, u_int32_t freenum = 0, tuint; u_int64_t uquad = 0, thyp, thyp2; uint16_t tui16; + long has_pathconf; #ifdef QUOTA struct dqblk dqb; uid_t savuid; @@ -1421,6 +1426,16 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, NFSCLRBIT_ATTRBIT(&checkattrbits, NFSATTRBIT_ACL); NFSCLRBIT_ATTRBIT(&checkattrbits, NFSATTRBIT_ACLSUPPORT); } + /* Some filesystems do not support uf_hidden */ + if (vp == NULL || VOP_PATHCONF(vp, + _PC_HAS_HIDDENSYSTEM, &has_pathconf) != 0) + has_pathconf = 0; + if (has_pathconf == 0) { + NFSCLRBIT_ATTRBIT(&checkattrbits, + NFSATTRBIT_HIDDEN); + NFSCLRBIT_ATTRBIT(&checkattrbits, + NFSATTRBIT_SYSTEM); + } if (!NFSEQUAL_ATTRBIT(&retattrbits, &checkattrbits) || retnotsup) *retcmpp = NFSERR_NOTSAME; @@ -1521,15 +1536,13 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); if (compare) { if (!(*retcmpp)) { - long has_named_attr; - if (vp == NULL || VOP_PATHCONF(vp, - _PC_HAS_NAMEDATTR, &has_named_attr) + _PC_HAS_NAMEDATTR, &has_pathconf) != 0) - has_named_attr = 0; - if ((has_named_attr != 0 && + has_pathconf = 0; + if ((has_pathconf != 0 && *tl != newnfs_true) || - (has_named_attr == 0 && + (has_pathconf == 0 && *tl != newnfs_false)) *retcmpp = NFSERR_NOTSAME; } @@ -1792,9 +1805,17 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, free(cp2, M_NFSSTRING); break; case NFSATTRBIT_HIDDEN: - NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); - if (compare && !(*retcmpp)) - *retcmpp = NFSERR_ATTRNOTSUPP; + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + if (compare) { + if (!(*retcmpp) && ((*tl == newnfs_true && + (nap->na_flags & UF_HIDDEN) == 0) || + (*tl == newnfs_false && + (nap->na_flags & UF_HIDDEN) != 0))) + *retcmpp = NFSERR_NOTSAME; + } else if (nap != NULL) { + if (*tl == newnfs_true) + nap->na_flags |= UF_HIDDEN; + } attrsum += NFSX_UNSIGNED; break; case NFSATTRBIT_HOMOGENEOUS: @@ -2166,9 +2187,17 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, attrsum += NFSX_HYPER; break; case NFSATTRBIT_SYSTEM: - NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); - if (compare && !(*retcmpp)) - *retcmpp = NFSERR_ATTRNOTSUPP; + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + if (compare) { + if (!(*retcmpp) && ((*tl == newnfs_true && + (nap->na_flags & UF_SYSTEM) == 0) || + (*tl == newnfs_false && + (nap->na_flags & UF_SYSTEM) != 0))) + *retcmpp = NFSERR_NOTSAME; + } else if (nap != NULL) { + if (*tl == newnfs_true) + nap->na_flags |= UF_SYSTEM; + } attrsum += NFSX_UNSIGNED; break; case NFSATTRBIT_TIMEACCESS: @@ -2634,7 +2663,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, size_t atsiz; bool xattrsupp; short irflag; - long has_named_attr; + long has_pathconf; #ifdef QUOTA struct dqblk dqb; uid_t savuid; @@ -2751,6 +2780,14 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACLSUPPORT); NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACL); } + if (cred == NULL || p == NULL || vp == NULL || + VOP_PATHCONF(vp, _PC_HAS_HIDDENSYSTEM, + &has_pathconf) != 0) + has_pathconf = 0; + if (has_pathconf == 0) { + NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN); + NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM); + } retnum += nfsrv_putattrbit(nd, &attrbits); break; case NFSATTRBIT_TYPE: @@ -2791,10 +2828,10 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, break; case NFSATTRBIT_NAMEDATTR: NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); - if (VOP_PATHCONF(vp, _PC_HAS_NAMEDATTR, &has_named_attr) - != 0) - has_named_attr = 0; - if (has_named_attr != 0) + if (VOP_PATHCONF(vp, _PC_HAS_NAMEDATTR, + &has_pathconf) != 0) + has_pathconf = 0; + if (has_pathconf != 0) *tl = newnfs_true; else *tl = newnfs_false; @@ -2899,6 +2936,14 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, *tl = 0; retnum += 2 * NFSX_UNSIGNED; break; + case NFSATTRBIT_HIDDEN: + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + if ((vap->va_flags & UF_HIDDEN) != 0) + *tl = newnfs_true; + else + *tl = newnfs_false; + retnum += NFSX_UNSIGNED; + break; case NFSATTRBIT_HOMOGENEOUS: NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); if (fsinf.fs_properties & NFSV3FSINFO_HOMOGENEOUS) @@ -3088,6 +3133,14 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp, txdr_hyper(vap->va_bytes, tl); retnum += NFSX_HYPER; break; + case NFSATTRBIT_SYSTEM: + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + if ((vap->va_flags & UF_SYSTEM) != 0) + *tl = newnfs_true; + else + *tl = newnfs_false; + retnum += NFSX_UNSIGNED; + break; case NFSATTRBIT_TIMEACCESS: NFSM_BUILD(tl, u_int32_t *, NFSX_V4TIME); txdr_nfsv4time(&vap->va_atime, tl); diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index eff53e1a384e..cb5a80e8df73 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -1142,6 +1142,7 @@ struct nfsv3_sattr { NFSATTRBM_FILESFREE | \ NFSATTRBM_FILESTOTAL | \ NFSATTRBM_FSLOCATIONS | \ + NFSATTRBM_HIDDEN | \ NFSATTRBM_HOMOGENEOUS | \ NFSATTRBM_MAXFILESIZE | \ NFSATTRBM_MAXLINK | \ @@ -1163,6 +1164,7 @@ struct nfsv3_sattr { NFSATTRBM_SPACEFREE | \ NFSATTRBM_SPACETOTAL | \ NFSATTRBM_SPACEUSED | \ + NFSATTRBM_SYSTEM | \ NFSATTRBM_TIMEACCESS | \ NFSATTRBM_TIMECREATE | \ NFSATTRBM_TIMEDELTA | \ @@ -1210,11 +1212,13 @@ struct nfsv3_sattr { */ #define NFSATTRBIT_SETABLE0 \ (NFSATTRBM_SIZE | \ + NFSATTRBM_HIDDEN | \ NFSATTRBM_ACL) #define NFSATTRBIT_SETABLE1 \ (NFSATTRBM_MODE | \ NFSATTRBM_OWNER | \ NFSATTRBM_OWNERGROUP | \ + NFSATTRBM_SYSTEM | \ NFSATTRBM_TIMECREATE | \ NFSATTRBM_TIMEACCESSSET | \ NFSATTRBM_TIMEMODIFYSET) @@ -1254,6 +1258,7 @@ struct nfsv3_sattr { NFSATTRBM_SIZE | \ NFSATTRBM_FSID | \ NFSATTRBM_FILEID | \ + NFSATTRBM_HIDDEN | \ NFSATTRBM_MAXREAD) /* @@ -1266,6 +1271,7 @@ struct nfsv3_sattr { NFSATTRBM_OWNERGROUP | \ NFSATTRBM_RAWDEV | \ NFSATTRBM_SPACEUSED | \ + NFSATTRBM_SYSTEM | \ NFSATTRBM_TIMEACCESS | \ NFSATTRBM_TIMECREATE | \ NFSATTRBM_TIMEMETADATA | \ @@ -1288,6 +1294,7 @@ struct nfsv3_sattr { NFSATTRBM_SIZE | \ NFSATTRBM_FSID | \ NFSATTRBM_FILEID | \ + NFSATTRBM_HIDDEN | \ NFSATTRBM_MAXREAD) /* @@ -1298,6 +1305,7 @@ struct nfsv3_sattr { NFSATTRBM_NUMLINKS | \ NFSATTRBM_RAWDEV | \ NFSATTRBM_SPACEUSED | \ + NFSATTRBM_SYSTEM | \ NFSATTRBM_TIMEACCESS | \ NFSATTRBM_TIMECREATE | \ NFSATTRBM_TIMEMETADATA | \ diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index c07da6f9275f..e0e66baca44d 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -4158,6 +4158,13 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, if (!NFSISSET_ATTRBIT(&dnp->n_vattr.na_suppattr, NFSATTRBIT_TIMECREATE)) NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMECREATE); + if (!NFSISSET_ATTRBIT(&dnp->n_vattr.na_suppattr, + NFSATTRBIT_HIDDEN) || + !NFSISSET_ATTRBIT(&dnp->n_vattr.na_suppattr, + NFSATTRBIT_SYSTEM)) { + NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN); + NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM); + } } /* diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 0049d7edca33..fbfcdafaa06b 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1074,15 +1074,23 @@ nfs_setattr(struct vop_setattr_args *ap) int error = 0; u_quad_t tsize; struct timespec ts; + struct nfsmount *nmp; #ifndef nolint tsize = (u_quad_t)0; #endif /* - * Setting of flags and marking of atimes are not supported. + * Only setting of UF_HIDDEN and UF_SYSTEM are supported and + * only for NFSv4 servers that support them. */ - if (vap->va_flags != VNOVAL) + nmp = VFSTONFS(vp->v_mount); + if (vap->va_flags != VNOVAL && (!NFSHASNFSV4(nmp) || + (vap->va_flags & ~(UF_HIDDEN | UF_SYSTEM)) != 0 || + ((vap->va_flags & UF_HIDDEN) != 0 && + !NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr, NFSATTRBIT_HIDDEN)) || + ((vap->va_flags & UF_SYSTEM) != 0 && + !NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr, NFSATTRBIT_SYSTEM)))) return (EOPNOTSUPP); /* @@ -1092,7 +1100,8 @@ nfs_setattr(struct vop_setattr_args *ap) vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL || vap->va_birthtime.tv_sec != VNOVAL || - vap->va_mode != (mode_t)VNOVAL) && + vap->va_mode != (mode_t)VNOVAL || + vap->va_flags != (u_long)VNOVAL) && (vp->v_mount->mnt_flag & MNT_RDONLY)) return (EROFS); if (vap->va_size != VNOVAL) { @@ -4754,6 +4763,15 @@ nfs_pathconf(struct vop_pathconf_args *ap) else *ap->a_retval = 0; break; + case _PC_HAS_HIDDENSYSTEM: + if (NFS_ISV4(vp) && NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr, + NFSATTRBIT_HIDDEN) && + NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr, + NFSATTRBIT_SYSTEM)) + *ap->a_retval = 1; + else + *ap->a_retval = 0; + break; default: error = vop_stdpathconf(ap); diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 3bf54d82b959..a81f1492ef95 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -449,6 +449,7 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap, } nvap->na_bsdflags = 0; + nvap->na_flags = 0; error = VOP_GETATTR(vp, &nvap->na_vattr, nd->nd_cred); if (lockedit != 0) NFSVOPUNLOCK(vp); @@ -3127,6 +3128,9 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap, bitpos = NFSATTRBIT_MAX; } else { bitpos = 0; + if (NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_HIDDEN) || + NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SYSTEM)) + nvap->na_flags = 0; } moderet = 0; for (; bitpos < NFSATTRBIT_MAX; bitpos++) { @@ -3163,9 +3167,11 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap, attrsum += NFSX_UNSIGNED; break; case NFSATTRBIT_HIDDEN: - NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); - if (!nd->nd_repstat) - nd->nd_repstat = NFSERR_ATTRNOTSUPP; + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + if (nd->nd_repstat == 0) { + if (*tl == newnfs_true) + nvap->na_flags |= UF_HIDDEN; + } attrsum += NFSX_UNSIGNED; break; case NFSATTRBIT_MIMETYPE: @@ -3240,9 +3246,11 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap, attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(j)); break; case NFSATTRBIT_SYSTEM: - NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); - if (!nd->nd_repstat) - nd->nd_repstat = NFSERR_ATTRNOTSUPP; + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + if (nd->nd_repstat == 0) { + if (*tl == newnfs_true) + nvap->na_flags |= UF_SYSTEM; + } attrsum += NFSX_UNSIGNED; break; case NFSATTRBIT_TIMEACCESSSET: diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 4e15d55eb312..f7564ade401b 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -403,8 +403,10 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, if (error) goto nfsmout; - /* For NFSv4, only va_uid is used from nva2. */ + /* For NFSv4, only va_uid and va_flags is used from nva2. */ NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_OWNER); + NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_HIDDEN); + NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_SYSTEM); preat_ret = nfsvno_getattr(vp, &nva2, nd, p, 1, &retbits); if (!nd->nd_repstat) nd->nd_repstat = preat_ret; @@ -463,6 +465,9 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, &nva, &attrbits, exp, p); if (!nd->nd_repstat && (nd->nd_flag & ND_NFSV4)) { + u_long oldflags; + + oldflags = nva2.na_flags; /* * For V4, try setting the attributes in sets, so that the * reply bitmap will be correct for an error case. @@ -532,6 +537,32 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_MODESETMASKED); } } + if (!nd->nd_repstat && + (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN) || + NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM))) { + if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN)) { + if ((nva.na_flags & UF_HIDDEN) != 0) + oldflags |= UF_HIDDEN; + else + oldflags &= ~UF_HIDDEN; + } + if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM)) { + if ((nva.na_flags & UF_SYSTEM) != 0) + oldflags |= UF_SYSTEM; + else + oldflags &= ~UF_SYSTEM; + } + NFSVNO_ATTRINIT(&nva2); + NFSVNO_SETATTRVAL(&nva2, flags, oldflags); + nd->nd_repstat = nfsvno_setattr(vp, &nva2, nd->nd_cred, p, + exp); + if (!nd->nd_repstat) { + if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN)) + NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_HIDDEN); + if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM)) + NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_SYSTEM); + } + } #ifdef NFS4_ACL_EXTATTR_NAME if (!nd->nd_repstat && aclp->acl_cnt > 0 && From nobody Sun Jul 6 23:18:35 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3G36ZNpz60Zrr; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3G346BNz3th3; Sun, 06 Jul 2025 23:18:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=raTMl9q9TWnE27auPEY0lyTj8njy4mit/pRgjnYhvwY=; b=c+ee2GW1T29aSOMkIkgGyPvYapiF8anftakBYdNr7STZNnriaxIz1WgBdkc3vyos8MfcR7 ntgPTZEL33RLVrICa8lRACDewMAYnEXyyV2+kThpENNqWylP7bu1CriocLHrvUBFgZ81Gc UY8BHsxAATE9u0xrD2ADJle9/jA6Y/nibQBBoSvm9FRaUx40Y0rW+Y8bELJKrwzEIBWEaK jhYJ76KCPv/c1b5pEznjNEDu+Jy6n9F3jPZqkYe7ndB1fsjUd8mYh4LaX3jLSuLz846mIY ulTE71Yvl/J6jQMkJAc7GvT0xkWNGjhclxwYZgEOxIq7cc2s3H9fC//ZDVuXTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=raTMl9q9TWnE27auPEY0lyTj8njy4mit/pRgjnYhvwY=; b=gvd+tl+jEtsynlQQnBL68L5F5aLkobV9WqZJxhQco+tOywg3gwKSP4obLNYFgYifc+5PWs DjVCQEIVn+aRmv//h9F2AZ4gxBMys/O9T399Gn6JHGbtkeeahfMnz2Qnne7tpUpGAu2LN0 xNgOxY911dfGhJPqb8RLeawPT0AnNgXGrihyx00XzhudOnXbCHzddBi3+UNFYK5vqKB11m nE/AE8xZP4PmxmdnkAKTbb3ky2Z0+WDI5Z+WJTlTPgVTVziKvGrkyrRxeaQjuYDYLUETJM 2mnHTXdrtsVgc2RRLcjbfy02DFZJD1XNtKWhWI5y6KHR5E8YkH0E5o/RtHlKYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843915; a=rsa-sha256; cv=none; b=va0cbVe21OZawhBB3EhPyeESXqWPGoyLWq04nOOVRjgeFbp2hazv2Oyd2d+Yc4CJJUrzAm MzYcEvj2rjRy+kPo1kPLugHIc47eTSZ9eBElP1kegwgRWK5RW4Bvz0AmpXaboszgLKNvlK JGMzSOzNR0TMpUaDZd1SWhvy/ub88t6VfBCXJwqXEt/nAKhNfpQOliRrEsW7Y1iF01Udkk NA4EgfEGmkB149wOLhXu6LLcpTpozn11lveitMFkvikG1SwFDR57qLaFb5+0fE6iX3v2cQ coTJwamJICV36oM6Rbs84D/1W6vsCHWNaYD4vrOOiLASQH++z8AjyNm8P0tbyA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3G32kQnz9wm; Sun, 06 Jul 2025 23:18:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIZdC031052; Sun, 6 Jul 2025 23:18:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIZbo031049; Sun, 6 Jul 2025 23:18:35 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:35 GMT Message-Id: <202507062318.566NIZbo031049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 02ffca404e65 - main - kern: Add support for POSIX O_CLOFORK flag List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02ffca404e65b2058720e1e9d5a5bc8bb2867113 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=02ffca404e65b2058720e1e9d5a5bc8bb2867113 commit 02ffca404e65b2058720e1e9d5a5bc8bb2867113 Author: Ricardo Branco AuthorDate: 2025-06-20 12:06:48 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:08:19 +0000 kern: Add support for POSIX O_CLOFORK flag Reviewed by: kib MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- sys/kern/kern_descrip.c | 28 ++++++++++++++++++++++------ sys/kern/sys_pipe.c | 2 +- sys/sys/fcntl.h | 13 +++++++++++++ sys/sys/filedesc.h | 2 ++ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index ac4b6ac3f457..bd6fa0c14075 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -511,6 +511,11 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) error = kern_dup(td, FDDUP_FCNTL, FDDUP_FLAG_CLOEXEC, fd, tmp); break; + case F_DUPFD_CLOFORK: + tmp = arg; + error = kern_dup(td, FDDUP_FCNTL, FDDUP_FLAG_CLOFORK, fd, tmp); + break; + case F_DUP2FD: tmp = arg; error = kern_dup(td, FDDUP_FIXED, 0, fd, tmp); @@ -528,6 +533,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) if (fde != NULL) { td->td_retval[0] = ((fde->fde_flags & UF_EXCLOSE) ? FD_CLOEXEC : 0) | + ((fde->fde_flags & UF_FOCLOSE) ? FD_CLOFORK : 0) | ((fde->fde_flags & UF_RESOLVE_BENEATH) ? FD_RESOLVE_BENEATH : 0); error = 0; @@ -545,6 +551,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) */ fde->fde_flags = (fde->fde_flags & ~UF_EXCLOSE) | ((arg & FD_CLOEXEC) != 0 ? UF_EXCLOSE : 0) | + ((arg & FD_CLOFORK) != 0 ? UF_FOCLOSE : 0) | ((arg & FD_RESOLVE_BENEATH) != 0 ? UF_RESOLVE_BENEATH : 0); error = 0; @@ -946,7 +953,7 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) fdp = p->p_fd; oioctls = NULL; - MPASS((flags & ~(FDDUP_FLAG_CLOEXEC)) == 0); + MPASS((flags & ~(FDDUP_FLAG_CLOEXEC | FDDUP_FLAG_CLOFORK)) == 0); MPASS(mode < FDDUP_LASTMODE); AUDIT_ARG_FD(old); @@ -971,8 +978,10 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) goto unlock; if (mode == FDDUP_FIXED && old == new) { td->td_retval[0] = new; - if (flags & FDDUP_FLAG_CLOEXEC) + if ((flags & FDDUP_FLAG_CLOEXEC) != 0) fdp->fd_ofiles[new].fde_flags |= UF_EXCLOSE; + if ((flags & FDDUP_FLAG_CLOFORK) != 0) + fdp->fd_ofiles[new].fde_flags |= UF_FOCLOSE; error = 0; goto unlock; } @@ -1047,10 +1056,9 @@ kern_dup(struct thread *td, u_int mode, int flags, int old, int new) fde_copy(oldfde, newfde); filecaps_copy_finish(&oldfde->fde_caps, &newfde->fde_caps, nioctls); - if ((flags & FDDUP_FLAG_CLOEXEC) != 0) - newfde->fde_flags = oldfde->fde_flags | UF_EXCLOSE; - else - newfde->fde_flags = oldfde->fde_flags & ~UF_EXCLOSE; + newfde->fde_flags = (oldfde->fde_flags & ~(UF_EXCLOSE | UF_FOCLOSE)) | + ((flags & FDDUP_FLAG_CLOEXEC) != 0 ? UF_EXCLOSE : 0) | + ((flags & FDDUP_FLAG_CLOFORK) != 0 ? UF_FOCLOSE : 0); #ifdef CAPABILITIES seqc_write_end(&newfde->fde_seqc); #endif @@ -2172,6 +2180,7 @@ _finstall(struct filedesc *fdp, struct file *fp, int fd, int flags, #endif fde->fde_file = fp; fde->fde_flags = ((flags & O_CLOEXEC) != 0 ? UF_EXCLOSE : 0) | + ((flags & O_CLOFORK) != 0 ? UF_FOCLOSE : 0) | ((flags & O_RESOLVE_BENEATH) != 0 ? UF_RESOLVE_BENEATH : 0); if (fcaps != NULL) filecaps_move(fcaps, &fde->fde_caps); @@ -2432,6 +2441,7 @@ fdcopy(struct filedesc *fdp) newfdp->fd_freefile = fdp->fd_freefile; FILEDESC_FOREACH_FDE(fdp, i, ofde) { if ((ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) == 0 || + (ofde->fde_flags & UF_FOCLOSE) != 0 || !fhold(ofde->fde_file)) { if (newfdp->fd_freefile == fdp->fd_freefile) newfdp->fd_freefile = i; @@ -2729,6 +2739,12 @@ fdcloseexec(struct thread *td) fdfree(fdp, i); (void) closefp(fdp, i, fp, td, false, false); FILEDESC_UNLOCK_ASSERT(fdp); + } else if (fde->fde_flags & UF_FOCLOSE) { + /* + * https://austingroupbugs.net/view.php?id=1851 + * FD_CLOFORK should not be preserved across exec + */ + fde->fde_flags &= ~UF_FOCLOSE; } } } diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 9340779918a2..ed651da96b14 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -548,7 +548,7 @@ sys_pipe2(struct thread *td, struct pipe2_args *uap) { int error, fildes[2]; - if (uap->flags & ~(O_CLOEXEC | O_NONBLOCK)) + if ((uap->flags & ~(O_CLOEXEC | O_CLOFORK | O_NONBLOCK)) != 0) return (EINVAL); error = kern_pipe(td, fildes, uap->flags, NULL, NULL); if (error) diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index dd9fccf5cf38..7234c9240c84 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -144,6 +144,10 @@ typedef __pid_t pid_t; #define O_XATTR O_NAMEDATTR /* Solaris compatibility */ #endif +#if __POSIX_VISIBLE >= 202405 +#define O_CLOFORK 0x08000000 +#endif + /* * !!! DANGER !!! * @@ -280,7 +284,13 @@ typedef __pid_t pid_t; #define F_GET_SEALS 20 #define F_ISUNIONSTACK 21 /* Kludge for libc, don't use it. */ #define F_KINFO 22 /* Return kinfo_file for this fd */ +#endif /* __BSD_VISIBLE */ +#if __POSIX_VISIBLE >= 202405 +#define F_DUPFD_CLOFORK 23 /* Like F_DUPFD, but FD_CLOFORK is set */ +#endif + +#if __BSD_VISIBLE /* Seals (F_ADD_SEALS, F_GET_SEALS). */ #define F_SEAL_SEAL 0x0001 /* Prevent adding sealings */ #define F_SEAL_SHRINK 0x0002 /* May not shrink */ @@ -292,6 +302,9 @@ typedef __pid_t pid_t; #define FD_CLOEXEC 1 /* close-on-exec flag */ #define FD_RESOLVE_BENEATH 2 /* all lookups relative to fd have O_RESOLVE_BENEATH semantics */ +#if __POSIX_VISIBLE >= 202405 +#define FD_CLOFORK 4 /* close-on-fork flag */ +#endif /* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ #define F_RDLCK 1 /* shared or read lock */ diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 55969b2ff4b3..0a388c90de26 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -149,6 +149,7 @@ struct filedesc_to_leader { */ #define UF_EXCLOSE 0x01 /* auto-close on exec */ #define UF_RESOLVE_BENEATH 0x02 /* lookups must be beneath this dir */ +#define UF_FOCLOSE 0x04 /* auto-close on fork */ #ifdef _KERNEL @@ -221,6 +222,7 @@ enum { /* Flags for kern_dup(). */ #define FDDUP_FLAG_CLOEXEC 0x1 /* Atomically set UF_EXCLOSE. */ +#define FDDUP_FLAG_CLOFORK 0x2 /* Atomically set UF_FOCLOSE. */ /* For backward compatibility. */ #define falloc(td, resultfp, resultfd, flags) \ From nobody Sun Jul 6 23:18:36 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3G504mCz60Zfj; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3G44F9rz3tSn; Sun, 06 Jul 2025 23:18:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HEsYfleZ7UenU8UXH60AB86Rf11NWrmzB81B14mhSGk=; b=YgIPvMEkxYFR/l2ngUN/w5BdGdZ9vs5cS8aHxJGQEIjt62r63j0GZYfpkC9oLNtjjuw5D7 mRg/1f1DQ3l6qXvl7+/KKc7W1djgz5NHsObySvNG9CfthTlgR+ikA6vrS3BAPRToVRiu/k meeyW9ADf15QkXP4H1AgWSeDy+eLb6lYsVfgOtMbo7SGHFgj+IR5kZqhwsftK8EJ3fV06w UKn/sT9e54vM9WRVB+uMqecAMczOkyEdKUhbOp5b5lj/iZd5H2NbvsB2vQwE3UIuXBu+cR rpgASKc1JII4/zC3iiHGJcWIpvHkmt1oHgLRhu2cVUhdo1GPQxudkW3EcyqVWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HEsYfleZ7UenU8UXH60AB86Rf11NWrmzB81B14mhSGk=; b=jAtkTWt0pv4gJFGmiw8Ck2Jp9FNhPxnxr277r+1qPyBkelPFjUEagnJAcidRg5dl7kT2P1 bLJxKBBzKV1H8fGR3bYvGrM9/Er25sXrmWRAUUKSWFiFdTfU94ugI960JfujGTOANNuuQw 8n7q1MVj4MidPM7ecrvGYB76jX5BvMwyJ9SasmU9vDO41O2Qg1yb5BmCG6nkzv34AztHoj wSXmn6KQzv07CjNp5KPJVXxoAP2sp1BPio7GKrBvWL9epQUW08ZOcIQS/OW+Q7cfgtdr9Y Q8oqcohjhYMrVcTic4uiXEatBU0I/cFdlKnDf4UHimfzsVycG68gH4OulIYQmA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843916; a=rsa-sha256; cv=none; b=jqI8Hn72Kq5n9DAPu7JBvrGif21WdhNyfj+8gPu2vwwB9q4S/z2b2Xq29IWR53NKWq5bWG Mey5TRY44HEJzw/X6M2nGvXz+sWGpCbMcifNjMIjFsbXehbUI3zuNtb9kCJ4XKD2zOQtrR xAzlw63074j6vJMMb/cImswRTwEn4qbjNl/54MtzRQJ7PybGPi4FZ4UYn0pIZvbSaT5MBn tn7nIEvE++P9GEWie16siMOBw/FTPcZ+qALLcobKWUzDHiCRwnczvfLPz/TwHGjEsjAuGC /vCDZT5LYQyyi4blKTBEL9Xmi5PHxmRKeQzkJcWPZaTxRJnxQTWrwbMMezjg+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3G43dRKz9wn; Sun, 06 Jul 2025 23:18:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIaq4031089; Sun, 6 Jul 2025 23:18:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIaeR031086; Sun, 6 Jul 2025 23:18:36 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:36 GMT Message-Id: <202507062318.566NIaeR031086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 04a481b743c5 - main - socket: Add SOCK_CLOFORK flag List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04a481b743c56392c34d5250327895bdb84b1160 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=04a481b743c56392c34d5250327895bdb84b1160 commit 04a481b743c56392c34d5250327895bdb84b1160 Author: Ricardo Branco AuthorDate: 2025-05-09 21:39:46 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:08:24 +0000 socket: Add SOCK_CLOFORK flag Reviewed by: kib MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- sys/kern/uipc_syscalls.c | 13 +++++++++++-- sys/sys/socket.h | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index ad8485028987..133724ac76c5 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -151,6 +151,10 @@ kern_socket(struct thread *td, int domain, int type, int protocol) type &= ~SOCK_CLOEXEC; oflag |= O_CLOEXEC; } + if ((type & SOCK_CLOFORK) != 0) { + type &= ~SOCK_CLOFORK; + oflag |= O_CLOFORK; + } if ((type & SOCK_NONBLOCK) != 0) { type &= ~SOCK_NONBLOCK; fflag |= FNONBLOCK; @@ -352,7 +356,8 @@ kern_accept4(struct thread *td, int s, struct sockaddr *sa, int flags, goto done; #endif error = falloc_caps(td, &nfp, &fd, - (flags & SOCK_CLOEXEC) ? O_CLOEXEC : 0, &fcaps); + ((flags & SOCK_CLOEXEC) != 0 ? O_CLOEXEC : 0) | + ((flags & SOCK_CLOFORK) != 0 ? O_CLOFORK : 0), &fcaps); if (error != 0) goto done; SOCK_LOCK(head); @@ -435,7 +440,7 @@ int sys_accept4(struct thread *td, struct accept4_args *uap) { - if (uap->flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) + if ((uap->flags & ~(SOCK_CLOEXEC | SOCK_CLOFORK | SOCK_NONBLOCK)) != 0) return (EINVAL); return (accept1(td, uap->s, uap->name, uap->anamelen, uap->flags)); @@ -557,6 +562,10 @@ kern_socketpair(struct thread *td, int domain, int type, int protocol, type &= ~SOCK_CLOEXEC; oflag |= O_CLOEXEC; } + if ((type & SOCK_CLOFORK) != 0) { + type &= ~SOCK_CLOFORK; + oflag |= O_CLOFORK; + } if ((type & SOCK_NONBLOCK) != 0) { type &= ~SOCK_NONBLOCK; fflag |= FNONBLOCK; diff --git a/sys/sys/socket.h b/sys/sys/socket.h index 5e7c554c34cf..8db981c9747c 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -111,10 +111,11 @@ typedef __uintptr_t uintptr_t; */ #define SOCK_CLOEXEC 0x10000000 #define SOCK_NONBLOCK 0x20000000 +#define SOCK_CLOFORK 0x40000000 #ifdef _KERNEL /* * Flags for accept1(), kern_accept4() and solisten_dequeue, in addition - * to SOCK_CLOEXEC and SOCK_NONBLOCK. + * to SOCK_CLOEXEC, SOCK_CLOFORK and SOCK_NONBLOCK. */ #define ACCEPT4_INHERIT 0x1 #define ACCEPT4_COMPAT 0x2 From nobody Sun Jul 6 23:18:37 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3G61Thtz60ZgW; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3G5670Jz3tNX; Sun, 06 Jul 2025 23:18:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eZdZ4OjfUhZIC3xE7gcNFolYoJ/42QU3b43jgR6+92o=; b=xy9ReEWDdPXqBSuhxkFx8HWoT5topIePJFPlo/LLhW8TMArtlXC8vnVvlNm5PWO5XRTGk8 hYvUH4ZFOTSwoyHxVcGX+H2/1+woylf+7PA39pe43v3Q6HSYtPt/JHaUeu+JE/B8ZUgN3f USLbJy6F6Jte2N3cBjXOMnjX++tW5p5/3KCEnD+vGwzORfZWFL4207Dm22iM4e5MAaGCNk IF4EdMvBhCahyIpLoqJx6+5lEmig/nAIQiSIaILio5EF4A/P+8BXIimAQ4XzNB3Imj6D+H SfN58vX9WAVdwaExpmUcx5mQ7YEoVzYkfdUnso5ofgf5ZHHDCrP4TI1M91aQDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eZdZ4OjfUhZIC3xE7gcNFolYoJ/42QU3b43jgR6+92o=; b=gK5boR8tsat6IWUUjodnf1+APGQDN4j7HvD3NiJEDfiyiVZNd3rL1Tlc3Mdebt6hOwlRLT dVaqsWGrTTyeSXIPFzOo15FcpnqAumlpP/ahz4KZWDBVdB5J3KMBy4HvO1AFWQ8bDJlOrA A4h8R9x8p24Hnd4YizXDzBMBhIJzJICto9AqnPEe6X5WL1dkIoGVr4UW5vPMKKGyXH/PbZ ARolymXj/04MRq0X0zIMcm1WBua+o+TLfEabbga2fE8CiNHcVHLR2cTEBpOk6y4RIjRRAZ Z5yyGWYUR0jj3b8oSJp5HJqAxT3wL9mJXIWG4aefejGJ7lHhq0EIYB5xVhurFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843917; a=rsa-sha256; cv=none; b=yWtAYcyc6TRD1+iutN9v3lbL7tt7jzAPjCR42qIbo0AG1Yz/9knm78usdkq5xaPyMeqeA4 6CWwHyNF7j57Y0g4W9gMVleN3iOi2Ngh8IoHcUQL7GbTT9M9uheyQ8HlesVV4qXdD2+POc c/CWOaBxr7aMjbBUjoANlp/DHhS1NpYBahefh1A+NTMNkmjNUHKHvEX3TkzB+kzJtCcFxC tYG+bXOqFhbYID+2nKW73QnN2LBZeU1p4t5dAq8VI+esouddE880T5ci6pmbyfWBlbNfRN SHq6tDZHR2iBTpwQCzzLmNAe0I5bVTvk2Z0BggoT9HbkgpopT9S3jJFsI9xE2Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3G55MP4z9ld; Sun, 06 Jul 2025 23:18:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIbbf031123; Sun, 6 Jul 2025 23:18:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIb2l031120; Sun, 6 Jul 2025 23:18:37 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:37 GMT Message-Id: <202507062318.566NIb2l031120@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: be6c405c4d34 - main - socket: Add MSG_CMSG_CLOFORK flag List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be6c405c4d34366618ab55e3a730090f6c672968 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=be6c405c4d34366618ab55e3a730090f6c672968 commit be6c405c4d34366618ab55e3a730090f6c672968 Author: Ricardo Branco AuthorDate: 2025-05-09 21:43:51 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:08:28 +0000 socket: Add MSG_CMSG_CLOFORK flag Reviewed by: kib MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- sys/kern/uipc_usrreq.c | 3 ++- sys/sys/socket.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 72bd0246db11..0056dac65c7d 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -3463,7 +3463,8 @@ unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags) UNP_LINK_UNLOCK_ASSERT(); - fdflags = (flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0; + fdflags = ((flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0) | + ((flags & MSG_CMSG_CLOFORK) ? O_CLOFORK : 0); error = 0; if (controlp != NULL) /* controlp == NULL => free control messages */ diff --git a/sys/sys/socket.h b/sys/sys/socket.h index 8db981c9747c..cdd4fa3b4b89 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -479,6 +479,9 @@ struct msghdr { #define MSG_MORETOCOME 0x00100000 /* additional data pending */ #define MSG_TLSAPPDATA 0x00200000 /* do not soreceive() alert rec. (TLS) */ #endif +#if __BSD_VISIBLE +#define MSG_CMSG_CLOFORK 0x00400000 /* make received fds close-on-fork */ +#endif /* * Header for ancillary data objects in msg_control buffer. From nobody Sun Jul 6 23:18:38 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3G738P2z60ZgZ; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3G70bx5z3th5; Sun, 06 Jul 2025 23:18:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FiIrKqfMecxS8R7f0Wx1BDlXi0pBIbS7ptJmg2icAMg=; b=qycns5PwkUTEtaNP1172w+WOJHFxRwTHrXLsDElx5Jbm7UHOGrPwWaqUlqAraXlX8xU2+M koFj0OUUtO7/RHMRENpz+fPmY6qBvqjZZVMU07OasaGdYxBsBuSrKYQM+JB1vqQ5VZoLC+ CgNO/9oFbATPzOXdrHKzk/Fm8BjqeRah83r2QL4MmOypdPoYowaXM+0CFfHeDlGN8q1YSb 1hs6LjuYmx9X1ogSBJQTRduhcQWb+lVx8FYX3MhnW35baWYpAFz6asLUTl26Yo6yisL08Q WvwXvHGzW5KGOz8xWtzex+iiZ4ikxrP/gWtLDZ34XbtqVNAQoJWioCAhaNdFDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FiIrKqfMecxS8R7f0Wx1BDlXi0pBIbS7ptJmg2icAMg=; b=Dsviro5yRcNT/eKKwkvVEtKYVpdR4bsxyU3qmc0yeQtKTSpcsIlup/0QNbAFw/dgK7/D90 PYWH2OfrrwP1qkF8lFmMNObzf47EIgcPYec/5X0Si/mgbJ/Sk9QLNkAB3jAiT0RTbJ3nKZ gEaRo0z06QNfhmE6MyPmEWq5UoMJC2+y6uw2CgH6ACfkfkDnPVQRAXnGtpzTMdG3R+0TE4 NmABoRx2d/PAxMzMjtc1Z8bhHHkjvcIXMjaztH5X5JXLf462JH4e/+pjjF98/5Jf5qZVOz vyO+xQfbRvyWp8GPvAUkMRSNgZVykLfmSITJLdY9qkRia9GFnGPNTdIQvLM8Zw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843919; a=rsa-sha256; cv=none; b=wwhKBYcuYhD63TcnYKjvoRhIBxJwKuQTkPVBsvAa79aXsD5hpAHdDb0jiTFmNcxwqyxzGM cixGJODHx+rB6ePVDFH+oqIsXOcveD6XOSB4yTs3h2h4CMA4Hx9Ii3/HpPIkv5a6akswPk sq1v1zev/J9XwbSThhWgcLzyCR9sHT8OifkZP9oOrZZnOg9QquVBclNF1jQO2EKbNEafeX 3wvljUg43MDjD2hp9JNroS4cn5gGwkywmt/rTUMLG675CfC6zS5p0J2lrew6poWtxcIjSM SWESxn8ZSiW2N72+OL1Pl8zfFJUa6ZvuwUdHUVQdlqEX5m/QoF3ZwAHmlrrajQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3G66g4Jz9VZ; Sun, 06 Jul 2025 23:18:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIcCu031163; Sun, 6 Jul 2025 23:18:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIcYS031160; Sun, 6 Jul 2025 23:18:38 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:38 GMT Message-Id: <202507062318.566NIcYS031160@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e6b64eea5e77 - main - kern: Make close_range() support CLOSE_RANGE_CLOEXEC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6b64eea5e7751b92bbabcef8470ff75547f5d0f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e6b64eea5e7751b92bbabcef8470ff75547f5d0f commit e6b64eea5e7751b92bbabcef8470ff75547f5d0f Author: Ricardo Branco AuthorDate: 2025-05-11 20:17:43 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:08:33 +0000 kern: Make close_range() support CLOSE_RANGE_CLOEXEC Reviewed by: kib MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- sys/kern/kern_descrip.c | 14 ++++++++------ sys/sys/unistd.h | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index bd6fa0c14075..e432f33d810e 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1424,13 +1424,15 @@ kern_close(struct thread *td, int fd) } static int -close_range_cloexec(struct thread *td, u_int lowfd, u_int highfd) +close_range_flags(struct thread *td, u_int lowfd, u_int highfd, int flags) { struct filedesc *fdp; struct fdescenttbl *fdt; struct filedescent *fde; - int fd; + int fd, fde_flags; + fde_flags = ((flags & CLOSE_RANGE_CLOEXEC) != 0 ? UF_EXCLOSE : 0) | + ((flags & CLOSE_RANGE_CLOFORK) != 0 ? UF_FOCLOSE : 0); fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); fdt = atomic_load_ptr(&fdp->fd_files); @@ -1442,7 +1444,7 @@ close_range_cloexec(struct thread *td, u_int lowfd, u_int highfd) for (; fd <= highfd; fd++) { fde = &fdt->fdt_ofiles[fd]; if (fde->fde_file != NULL) - fde->fde_flags |= UF_EXCLOSE; + fde->fde_flags |= fde_flags; } out_locked: FILEDESC_XUNLOCK(fdp); @@ -1500,8 +1502,8 @@ kern_close_range(struct thread *td, int flags, u_int lowfd, u_int highfd) return (EINVAL); } - if ((flags & CLOSE_RANGE_CLOEXEC) != 0) - return (close_range_cloexec(td, lowfd, highfd)); + if ((flags & (CLOSE_RANGE_CLOEXEC | CLOSE_RANGE_CLOFORK)) != 0) + return (close_range_flags(td, lowfd, highfd, flags)); return (close_range_impl(td, lowfd, highfd)); } @@ -1521,7 +1523,7 @@ sys_close_range(struct thread *td, struct close_range_args *uap) AUDIT_ARG_CMD(uap->highfd); AUDIT_ARG_FFLAGS(uap->flags); - if ((uap->flags & ~(CLOSE_RANGE_CLOEXEC)) != 0) + if ((uap->flags & ~(CLOSE_RANGE_CLOEXEC | CLOSE_RANGE_CLOFORK)) != 0) return (EINVAL); return (kern_close_range(td, uap->flags, uap->lowfd, uap->highfd)); } diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h index c12343e5d0fd..c291c1dc2b95 100644 --- a/sys/sys/unistd.h +++ b/sys/sys/unistd.h @@ -211,6 +211,7 @@ * close_range() options. */ #define CLOSE_RANGE_CLOEXEC (1<<2) +#define CLOSE_RANGE_CLOFORK (1<<3) #endif /* __BSD_VISIBLE */ From nobody Sun Jul 6 23:18:39 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3G93qdtz60Zrw; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3G81R8fz3tcS; Sun, 06 Jul 2025 23:18:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0Qb41BXZjwvzHltCrXyQOlNO99L/CteCmLubOibr2Zs=; b=esZ8/Izqsh1jnarKuZ9pelNbVykWAGWWeno3ZS1PQZtVY7fOrz7KMV1gEHhIEdODcQR3bp f1KUkHwhH3KFG6M8Z2+CHFrS59FPHN7ph7XdH86p6AVbuaIM57uYdPjcFrxpnAzAEJ0e2f OwUemEOdxPO+y9brctyNzteFcACgWnwMBb7zoibL4627qgTfeN6xKAEhRocVHjd1w7NcNw c7rMjcaxwYqcxWGqwR6LmnYSQGKa+fDL1ZyRsuywnrPDox/XH+CAI8ocaxVZ11/DarWSy6 fMn7XS1aXnKkZKuWWqlwrAj5ggHfPoim1EoKw97mJRLs1fqcTWOzQwrIxOQqEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0Qb41BXZjwvzHltCrXyQOlNO99L/CteCmLubOibr2Zs=; b=tapQIFnSjYDQHcNilVYLoDTtbhTdZ0TNJi3+qb/1YQYXZbT8RUxZLUm1c2ggSgZ5+yzeye P9dAf4nfCNVbRHsZiVWGIoSkHWxjS5obmFH5BMUneoa6cdbf5ktxUTWVNZlY4VYWlyOqfe qEwHPvfCzoc6Qs7pBVNlv5EeZBRju6CGcK01B3kfZQNP/Y9y/J7v5ta0bYl9mSJQ9KZZMx bxeLsQDs7N9lWNA86HQJ/MgwuDA/pPx3CugyF1DpFmpwWfYFegJm9xT7NNYr/UoB474LWd beModO/kSdEoQpjB9BiTmTIzHR08CLAbPQOeEnxe4N0GlTnbjs/RiUWNMo1RoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843920; a=rsa-sha256; cv=none; b=mXUAlY2wZDVnIw5y265oIMT52A7hkKLwscfIgf2Qmgxw2YvRJRoUkjyCr0tQEVKtbcKEQ3 o5+IwvhtpUhbwV77VYW1kJHD7tNVn00Nu98O0VcwD8neM6Ed6G08ZvCFlBbskFU9NJrtUR z8z/wuebmLIvmdxlMx5tiug83R+MAJoAefAwS+T4koYerdqp/zbNaotQ+HoKw8nTjbplMN vLG9frmhK8mEXaucYEkoYa9MKqjBBjRzpAJbbC4NTAbpDCrlFf+mOuY/IobA6Lwue1yOL2 RWUiYriOCPKenUhDXKxoygfHqylY4MqCs3n4aoRsGKQH9GhWZA46Ot2/PhZWcg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3G76Rg9z9Vb; Sun, 06 Jul 2025 23:18:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIdSU031198; Sun, 6 Jul 2025 23:18:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIdea031195; Sun, 6 Jul 2025 23:18:39 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:39 GMT Message-Id: <202507062318.566NIdea031195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 971f738679e2 - main - kern: Make dup3() support O_CLOFORK List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 971f738679e2e57114366c0f69af99e07150f1ff Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=971f738679e2e57114366c0f69af99e07150f1ff commit 971f738679e2e57114366c0f69af99e07150f1ff Author: Ricardo Branco AuthorDate: 2025-05-17 09:53:10 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:08:37 +0000 kern: Make dup3() support O_CLOFORK Reviewed by: kib MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- lib/libc/gen/dup3.c | 9 +++++---- sys/kern/kern_descrip.c | 15 ++++++++++++++- sys/sys/fcntl.h | 4 ++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/libc/gen/dup3.c b/lib/libc/gen/dup3.c index fca1e99fb47b..1401c1f5b607 100644 --- a/lib/libc/gen/dup3.c +++ b/lib/libc/gen/dup3.c @@ -39,21 +39,22 @@ int __dup3(int, int, int); int __dup3(int oldfd, int newfd, int flags) { - int how; + int fdflags; if (oldfd == newfd) { errno = EINVAL; return (-1); } - if (flags & ~O_CLOEXEC) { + if ((flags & ~(O_CLOEXEC | O_CLOFORK)) != 0) { errno = EINVAL; return (-1); } - how = (flags & O_CLOEXEC) ? F_DUP2FD_CLOEXEC : F_DUP2FD; + fdflags = ((flags & O_CLOEXEC) != 0 ? FD_CLOEXEC : 0) | + ((flags & O_CLOFORK) != 0 ? FD_CLOFORK : 0); - return (_fcntl(oldfd, how, newfd)); + return (_fcntl(oldfd, F_DUP3FD | (fdflags << F_DUP3FD_SHIFT), newfd)); } __weak_reference(__dup3, dup3); diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index e432f33d810e..406236fc2723 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -38,9 +38,11 @@ #include "opt_ddb.h" #include "opt_ktrace.h" +#define EXTERR_CATEGORY EXTERR_CAT_FILEDESC #include #include #include +#include #include #include #include @@ -492,6 +494,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) int error, flg, kif_sz, seals, tmp, got_set, got_cleared; uint64_t bsize; off_t foffset; + int flags; error = 0; flg = F_POSIX; @@ -923,7 +926,17 @@ revert_f_setfl: break; default: - error = EINVAL; + if ((cmd & ((1u << F_DUP3FD_SHIFT) - 1)) != F_DUP3FD) + return (EXTERROR(EINVAL, "invalid fcntl cmd")); + /* Handle F_DUP3FD */ + flags = (cmd >> F_DUP3FD_SHIFT); + if ((flags & ~(FD_CLOEXEC | FD_CLOFORK)) != 0) + return (EXTERROR(EINVAL, "invalid flags for F_DUP3FD")); + tmp = arg; + error = kern_dup(td, FDDUP_FIXED, + ((flags & FD_CLOEXEC) != 0 ? FDDUP_FLAG_CLOEXEC : 0) | + ((flags & FD_CLOFORK) != 0 ? FDDUP_FLAG_CLOFORK : 0), + fd, tmp); break; } return (error); diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index 7234c9240c84..18d3928e91c7 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -291,6 +291,10 @@ typedef __pid_t pid_t; #endif #if __BSD_VISIBLE +#define F_DUP3FD 24 /* Used with dup3() */ + +#define F_DUP3FD_SHIFT 16 /* Shift used for F_DUP3FD */ + /* Seals (F_ADD_SEALS, F_GET_SEALS). */ #define F_SEAL_SEAL 0x0001 /* Prevent adding sealings */ #define F_SEAL_SHRINK 0x0002 /* May not shrink */ From nobody Sun Jul 6 23:18:41 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3GD61jTz60Zfr; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3GB1R3qz3tWn; Sun, 06 Jul 2025 23:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fFtFpAwwRjVfbA0nUUvEQhZHA0OqABnShi8dqzN416A=; b=ad/2fYEedhJzYoSml6KIZuoF+q+sgoFSm0P5W85/ZpV6a9JkPNnEeWhmAPYn9Wle4TzSR1 eAgpT0VJdn2b/15LBYf/fWRPVtTpzWCTv9pLi2hAkorr1qpXKLuNSX73lrBwXrbQvFtAUo DbOmJyB+zvG2Gd0M/TZtA4ExLUqg0sU81Rf7krEuKhEqLJj8c1NuEJBVPqhble1KZHGbZP NSh3HneGCwYjZTOm5caFxgHKbD/ThfiFo9JjitD4oU8NLxrWHp1QNptgW7d4PndjaEZoQo WGOb3542xxWD7i3jYKjTQvePREL8mlCbYXAXpta8xQX3ac8JQ32DRAtaDRiabA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fFtFpAwwRjVfbA0nUUvEQhZHA0OqABnShi8dqzN416A=; b=UfQc3vPFOAC+KYwqE1ezpOnFwK6kBXHK517ZOcDsb9hHOeFMVofLsqlO1ARj1fVk/G77bL Pz2z3ZQeFt+cRZe4e/2AgzJJkDULeT00yLiH4IEJSCTqjYcn7nE1gSyIh9HdjWmkBxoTEK zYABOx7McdpM9j7XGidrH+gqosHWCZ2HvoWa63K508zOzUPfzQrteIpr1gNEjFKI31ETXp 38Z3SGrh5VslC33Xz5Mf6Iv1AQD0UPnnw32nLWxwHu75RlOMdeyClH4wFODzfg7qosMwyb 3jojT+qJeQ4d1hs8OrTBu1nWnFZHGyZC3HrfuzisoUS87GwHSFnIrn2ADzA3ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843922; a=rsa-sha256; cv=none; b=CybUoAXcQxE1LrdBeKkexqKWVpVnDv1fyQNiuj+OkwN393NrezZk3G8MC6T8TxOMexqkDj rINhRePXytx6hLuvDZl/820MXWYv+9mtUDMtrRFRYTcEEn88vyeqoqscamZE243W0qs/f4 pC3vF+bz6sea6ZqUf3zIOdXrWUDjGqaJ950BYpTyMhekuepDdEurNAhOQoCcNa7jL/Oy6e 7yB5PMwa5/q0c9SztcwBpDcv4cC1nlNjgWDXRt9tnZPk5mT35JFoafxiRbQkRHdBp/6sqC 0Pm5mHAH0TQ9/fiq9IsfAXsk2soCCvg6GlAB5czuTFaGQpn+T5MOsKiX+gjlVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3GB0nMTz9bF; Sun, 06 Jul 2025 23:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIfoJ031270; Sun, 6 Jul 2025 23:18:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIfxN031267; Sun, 6 Jul 2025 23:18:41 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:41 GMT Message-Id: <202507062318.566NIfxN031267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 63503cbe5a48 - main - tests: Adapt existing tests for O_CLOEXEC to O_CLOFORK List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63503cbe5a480d1f55fc45ba7a2661ba41c2321f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=63503cbe5a480d1f55fc45ba7a2661ba41c2321f commit 63503cbe5a480d1f55fc45ba7a2661ba41c2321f Author: Ricardo Branco AuthorDate: 2025-06-03 23:07:17 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:08:46 +0000 tests: Adapt existing tests for O_CLOEXEC to O_CLOFORK MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- tests/sys/file/closefrom_test.c | 35 +++++++++++++- tests/sys/file/dup_test.c | 98 ++++++++++++++++++++++++++++++++++++++- tests/sys/kern/unix_passfd_test.c | 25 ++++++++++ 3 files changed, 156 insertions(+), 2 deletions(-) diff --git a/tests/sys/file/closefrom_test.c b/tests/sys/file/closefrom_test.c index e30c5eb3d591..7dccf858c772 100644 --- a/tests/sys/file/closefrom_test.c +++ b/tests/sys/file/closefrom_test.c @@ -144,7 +144,7 @@ main(void) pid_t pid; int fd, flags, i, start; - printf("1..21\n"); + printf("1..22\n"); /* We'd better start up with fd's 0, 1, and 2 open. */ start = devnull(); @@ -356,5 +356,38 @@ main(void) fail_err("close_range"); ok("close_range(..., CLOSE_RANGE_CLOEXEC)"); + /* test CLOSE_RANGE_CLOFORK */ + for (i = 0; i < 8; i++) + (void)devnull(); + fd = highest_fd(); + start = fd - 8; + if (close_range(start + 1, start + 4, CLOSE_RANGE_CLOFORK) < 0) + fail_err("close_range(..., CLOSE_RANGE_CLOFORK)"); + flags = fcntl(start, F_GETFD); + if (flags < 0) + fail_err("fcntl(.., F_GETFD)"); + if ((flags & FD_CLOFORK) != 0) + fail("close_range", "CLOSE_RANGE_CLOFORK set close-on-exec " + "when it should not have on fd %d", start); + for (i = start + 1; i <= start + 4; i++) { + flags = fcntl(i, F_GETFD); + if (flags < 0) + fail_err("fcntl(.., F_GETFD)"); + if ((flags & FD_CLOFORK) == 0) + fail("close_range", "CLOSE_RANGE_CLOFORK did not set " + "close-on-exec on fd %d", i); + } + for (; i < start + 8; i++) { + flags = fcntl(i, F_GETFD); + if (flags < 0) + fail_err("fcntl(.., F_GETFD)"); + if ((flags & FD_CLOFORK) != 0) + fail("close_range", "CLOSE_RANGE_CLOFORK set close-on-exec " + "when it should not have on fd %d", i); + } + if (close_range(start, start + 8, 0) < 0) + fail_err("close_range"); + ok("close_range(..., CLOSE_RANGE_CLOFORK)"); + return (0); } diff --git a/tests/sys/file/dup_test.c b/tests/sys/file/dup_test.c index b024e72d0d1a..455115eda8c8 100644 --- a/tests/sys/file/dup_test.c +++ b/tests/sys/file/dup_test.c @@ -46,6 +46,8 @@ * Test #31: check if dup3(0) fails if oldfd == newfd. * Test #32: check if dup3(O_CLOEXEC) to a fd > current maximum number of * open files limit work. + * Tests #33-43 : Same as #18-26, 30 & 32 with O_CLOFORK instead of O_CLOEXEC, + * except F_DUP2FD_CLOEXEC. */ #include @@ -82,7 +84,7 @@ main(int __unused argc, char __unused *argv[]) orgfd = getafile(); - printf("1..32\n"); + printf("1..43\n"); /* If dup(2) ever work? */ if ((fd1 = dup(orgfd)) < 0) @@ -380,5 +382,99 @@ main(int __unused argc, char __unused *argv[]) printf("ok %d - dup3(O_CLOEXEC) didn't bypass NOFILE limit\n", test); + /* Does fcntl(F_DUPFD_CLOFORK) work? */ + if ((fd2 = fcntl(fd1, F_DUPFD_CLOFORK, 10)) < 0) + err(1, "fcntl(F_DUPFD_CLOFORK)"); + if (fd2 < 10) + printf("not ok %d - fcntl(F_DUPFD_CLOFORK) returned wrong fd %d\n", + ++test, fd2); + else + printf("ok %d - fcntl(F_DUPFD_CLOFORK) works\n", ++test); + + /* Was close-on-fork cleared? */ + ++test; + if (fcntl(fd2, F_GETFD) != FD_CLOFORK) + printf( + "not ok %d - fcntl(F_DUPFD_CLOFORK) didn't set close-on-fork\n", + test); + else + printf("ok %d - fcntl(F_DUPFD_CLOFORK) set close-on-fork\n", + test); + + /* Does dup3(O_CLOFORK) ever work? */ + if ((fd2 = dup3(fd1, fd1 + 1, O_CLOFORK)) < 0) + err(1, "dup3(O_CLOFORK)"); + printf("ok %d - dup3(O_CLOFORK) works\n", ++test); + + /* Do we get the right fd? */ + ++test; + if (fd2 != fd1 + 1) + printf( + "no ok %d - dup3(O_CLOFORK) didn't give us the right fd\n", + test); + else + printf("ok %d - dup3(O_CLOFORK) returned a correct fd\n", + test); + + /* Was close-on-fork set? */ + ++test; + if (fcntl(fd2, F_GETFD) != FD_CLOFORK) + printf( + "not ok %d - dup3(O_CLOFORK) didn't set close-on-fork\n", + test); + else + printf("ok %d - dup3(O_CLOFORK) set close-on-fork\n", + test); + + /* Does dup3(0) ever work? */ + if ((fd2 = dup3(fd1, fd1 + 1, 0)) < 0) + err(1, "dup3(0)"); + printf("ok %d - dup3(0) works\n", ++test); + + /* Do we get the right fd? */ + ++test; + if (fd2 != fd1 + 1) + printf( + "no ok %d - dup3(0) didn't give us the right fd\n", + test); + else + printf("ok %d - dup3(0) returned a correct fd\n", + test); + + /* Was close-on-fork cleared? */ + ++test; + if (fcntl(fd2, F_GETFD) != 0) + printf( + "not ok %d - dup3(0) didn't clear close-on-fork\n", + test); + else + printf("ok %d - dup3(0) cleared close-on-fork\n", + test); + + /* dup3() does not allow duplicating to the same fd */ + ++test; + if (dup3(fd1, fd1, O_CLOFORK) != -1) + printf( + "not ok %d - dup3(fd1, fd1, O_CLOFORK) succeeded\n", test); + else + printf("ok %d - dup3(fd1, fd1, O_CLOFORK) failed\n", test); + + ++test; + if (dup3(fd1, fd1, 0) != -1) + printf( + "not ok %d - dup3(fd1, fd1, 0) succeeded\n", test); + else + printf("ok %d - dup3(fd1, fd1, 0) failed\n", test); + + ++test; + if (getrlimit(RLIMIT_NOFILE, &rlp) < 0) + err(1, "getrlimit"); + if ((fd2 = dup3(fd1, rlp.rlim_cur + 1, O_CLOFORK)) >= 0) + printf("not ok %d - dup3(O_CLOFORK) bypassed NOFILE limit\n", + test); + else + printf("ok %d - dup3(O_CLOFORK) didn't bypass NOFILE limit\n", + test); + return (0); } diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c index 95271c04a16b..7dc4541ad402 100644 --- a/tests/sys/kern/unix_passfd_test.c +++ b/tests/sys/kern/unix_passfd_test.c @@ -379,6 +379,30 @@ ATF_TC_BODY(simple_send_fd_msg_cmsg_cloexec, tc) closesocketpair(fd); } +/* + * Like simple_send_fd but also sets MSG_CMSG_CLOFORK and checks that the + * received file descriptor has the FD_CLOFORK flag set. + */ +ATF_TC_WITHOUT_HEAD(simple_send_fd_msg_cmsg_clofork); +ATF_TC_BODY(simple_send_fd_msg_cmsg_clofork, tc) +{ + struct stat getfd_stat, putfd_stat; + int fd[2], getfd, putfd; + + domainsocketpair(fd); + tempfile(&putfd); + dofstat(putfd, &putfd_stat); + sendfd(fd[0], putfd); + recvfd(fd[1], &getfd, MSG_CMSG_CLOFORK); + dofstat(getfd, &getfd_stat); + samefile(&putfd_stat, &getfd_stat); + ATF_REQUIRE_EQ_MSG(fcntl(getfd, F_GETFD) & FD_CLOFORK, FD_CLOFORK, + "FD_CLOFORK not set on the received file descriptor"); + close(putfd); + close(getfd); + closesocketpair(fd); +} + /* * Same as simple_send_fd, only close the file reference after sending, so that * the only reference is the descriptor in the UNIX domain socket buffer. @@ -1170,6 +1194,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, simple_send_fd); ATF_TP_ADD_TC(tp, simple_send_fd_msg_cmsg_cloexec); + ATF_TP_ADD_TC(tp, simple_send_fd_msg_cmsg_clofork); ATF_TP_ADD_TC(tp, send_and_close); ATF_TP_ADD_TC(tp, send_and_cancel); ATF_TP_ADD_TC(tp, send_and_shutdown); From nobody Sun Jul 6 23:18:40 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3GC6bRMz60Zxn; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3G90Gj6z3thX; Sun, 06 Jul 2025 23:18:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843921; h=from:from:reply-to:subject:subject: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/xnetcnyiucrqsgvnsQY7eSMryHpPp8VgjnpOzAelg=; b=C/LEhLKniNbwrZ+msYudsqqAo0ikBRozAc8+erCZVgG+zZjDLhU9hWDLGxdtcLNF4mymyU EEyUBFXPAZ03/NEZh148IbgBUerB6zHRt8+ngT8p94c0RT3BQkOmSPLP7M+mi1c2yn9Asf rnrd52io9qgFiA5eSpLeQn7aTSeAxQqqzaR5oqv+8YOdmiHM3xX2luLH4ns7OXKEOGsOiE 4KyY07sBUk5tQcdOrLOyuZ3lIStqs0F4hDa6OrgZoAtFA8ZmSXGBx3btLpPxW48syfvw/y G+PiCuX4p2uLePNEvKr/rD8L6diNtibcrskCS3x318R/KSS9O6mpDqJZRv/x3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843921; h=from:from:reply-to:subject:subject: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/xnetcnyiucrqsgvnsQY7eSMryHpPp8VgjnpOzAelg=; b=ekFU7zWdZOQQ0pVgBt9WoIaW8ZHhqJ3fXTz3glqkiO7ysZ1V7JgoWTLf8P8xgzIaMcMjfY ewJtORryA0BDtg5lOkgh3YXQvRYzG2+QFgRo9Rdf3iwZxOeBf09EZyHS1Zz2KhfbtjOjD8 SXxUBcrJEi9p65W8aiLWDNMEwz+QiDUPvbxakq1SBsBMKjdQaowH+em7mue7oi93Ozqpbl BHtavoUyVWdlFOhAlqtSVKA8F+ot+euX9Dmr9XhTEqcjRy1OmeUdOGsjx9OANJFPZvXo0t mQt4kfXEPHHn0MPM59Nr4InjW2vcR5J22dDD8AViVy2gcLCi5QpzEm0iJBvrsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843921; a=rsa-sha256; cv=none; b=kSgLf2RpuXBsTF6Fvhy+/XRWzdDfIRc8LbuhuUUEk5irulrkGNW0m1g99W68vHbhJoAFe2 7Ky+YhtmNWBdS5rSZnuc0/ScLayRvu2wfEAQo3aMRUoHW8W7wIvfhFu3tihHOfVJwOY6WX ncICw32FYawka7RjZeWzjzdd1jAGV36g+rq4nMyCB/aLyrksGB4zg+eQz8jFl2wLPDeT4N /YXY7dFnpmKQv3sDs6ENGDLbH59aV6H4GehkHjY2dVP2FOl+lnzmOShaqRVqOei6Px1la0 tjhtb4Pnaa9uiR3xOYeMK/c5Vw2scF4mcjLRSyid4ndUe/uZBiUoNUoqKkMXIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3G86gxQz9Vc; Sun, 06 Jul 2025 23:18:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIekk031236; Sun, 6 Jul 2025 23:18:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIemM031233; Sun, 6 Jul 2025 23:18:40 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:40 GMT Message-Id: <202507062318.566NIemM031233@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: efadb5c2a908 - main - Add manpages for O_CLOFORK flag and others List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: efadb5c2a908a08e98f917ef6e6e65c73e8d04af Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=efadb5c2a908a08e98f917ef6e6e65c73e8d04af commit efadb5c2a908a08e98f917ef6e6e65c73e8d04af Author: Ricardo Branco AuthorDate: 2025-05-17 17:10:19 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:08:41 +0000 Add manpages for O_CLOFORK flag and others Reviewed by: kib MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- lib/libc/gen/dup3.3 | 15 +++++++++++++-- lib/libsys/accept.2 | 14 +++++++++++++- lib/libsys/closefrom.2 | 9 ++++++++- lib/libsys/execve.2 | 7 +++++-- lib/libsys/fcntl.2 | 43 +++++++++++++++++++++++++++++++++++++++---- lib/libsys/fork.2 | 12 +++++++++++- lib/libsys/open.2 | 29 ++++++++++++++++++++++++++++- lib/libsys/pipe.2 | 9 ++++++++- lib/libsys/recv.2 | 3 ++- lib/libsys/socket.2 | 13 +++++++++++-- lib/libsys/socketpair.2 | 5 +++-- 11 files changed, 141 insertions(+), 18 deletions(-) diff --git a/lib/libc/gen/dup3.3 b/lib/libc/gen/dup3.3 index f2798930797b..338a9ae74c64 100644 --- a/lib/libc/gen/dup3.3 +++ b/lib/libc/gen/dup3.3 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 16, 2013 +.Dd May 17, 2025 .Dt DUP3 3 .Os .Sh NAME @@ -47,6 +47,11 @@ The close-on-exec flag on the new file descriptor is determined by the bit in .Fa flags . .Pp +The close-on-fork flag on the new file descriptor is determined by the +.Dv O_CLOFORK +bit in +.Fa flags . +.Pp If .Fa oldd \*(Ne @@ -91,7 +96,9 @@ argument. The .Fa flags argument has bits set other than -.Dv O_CLOEXEC . +.Dv O_CLOEXEC +or +.Dv O_CLOFORK . .El .Sh SEE ALSO .Xr accept 2 , @@ -112,3 +119,7 @@ The .Fn dup3 function appeared in .Fx 10.0 . +The +.Dv O_CLOFORK +flag appeared in +.Fx 15.0 . diff --git a/lib/libsys/accept.2 b/lib/libsys/accept.2 index 53926b3153d2..2da2af066a5b 100644 --- a/lib/libsys/accept.2 +++ b/lib/libsys/accept.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 9, 2014 +.Dd May 17, 2025 .Dt ACCEPT 2 .Os .Sh NAME @@ -85,6 +85,13 @@ and the close-on-exec flag on the new file descriptor can be set via the flag in the .Fa flags argument. +Similarly, the +.Dv O_CLOFORK +property can be set via the +.Dv SOCK_CLOFORK +flag in the +.Fa flags +argument. .Pp If no pending connections are present on the queue, and the original socket @@ -234,3 +241,8 @@ The .Fn accept4 system call appeared in .Fx 10.0 . +.Pp +The +.Dv SOCK_CLOFORK +flag appeared in +.Fx 15.0 . diff --git a/lib/libsys/closefrom.2 b/lib/libsys/closefrom.2 index aaa4c55607ac..1885a6fdeaa8 100644 --- a/lib/libsys/closefrom.2 +++ b/lib/libsys/closefrom.2 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 3, 2022 +.Dd May 17, 2025 .Dt CLOSEFROM 2 .Os .Sh NAME @@ -59,6 +59,8 @@ Supported .Bl -tag -width ".Dv CLOSE_RANGE_CLOEXEC" .It Dv CLOSE_RANGE_CLOEXEC Set the close-on-exec flag on descriptors in the range instead of closing them. +.It Dv CLOSE_RANGE_CLOFORK +Set the close-on-fork flag on descriptors in the range instead of closing them. .El .Sh RETURN VALUES Upon successful completion, @@ -90,3 +92,8 @@ The .Fn closefrom function first appeared in .Fx 8.0 . +.Pp +The +.Dv CLOSE_RANGE_CLOFORK +flag appeared in +.Fx 15.0 . diff --git a/lib/libsys/execve.2 b/lib/libsys/execve.2 index 5a35980e9555..dc85b9321e48 100644 --- a/lib/libsys/execve.2 +++ b/lib/libsys/execve.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 26, 2022 +.Dd July 02, 2025 .Dt EXECVE 2 .Os .Sh NAME @@ -127,7 +127,10 @@ flag is set (see and .Xr fcntl 2 ) . Descriptors that remain open are unaffected by -.Fn execve . +.Fn execve , +except those with the close-on-fork flag +.Dv FD_CLOFORK +which is cleared from all file descriptors. If any of the standard descriptors (0, 1, and/or 2) are closed at the time .Fn execve diff --git a/lib/libsys/fcntl.2 b/lib/libsys/fcntl.2 index 604de43e5e8c..3cf8adc29f88 100644 --- a/lib/libsys/fcntl.2 +++ b/lib/libsys/fcntl.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 5, 2025 +.Dd June 24, 2025 .Dt FCNTL 2 .Os .Sh NAME @@ -81,6 +81,13 @@ to remain open across .Xr execve 2 system calls. .It +The fork-on-exec flag +.Dv FD_CLOFORK +associated with the new file descriptor is cleared, so the file descriptor is +to remain open across +.Xr fork 2 +system calls. +.It The .Dv FD_RESOLVE_BENEATH flag, described below, will be set if it was set on the original @@ -95,6 +102,15 @@ flag associated with the new file descriptor is set, so the file descriptor is closed when .Xr execve 2 system call executes. +.It Dv F_DUPFD_CLOFORK +Like +.Dv F_DUPFD , +but the +.Dv FD_CLOFORK +flag associated with the new file descriptor is set, so the file descriptor +is closed when +.Xr fork 2 +system call executes. .It Dv F_DUP2FD It is functionally equivalent to .Bd -literal -offset indent @@ -117,6 +133,11 @@ Use .Fn dup2 instead of .Dv F_DUP2FD . +.It Dv F_DUP3FD +Used to implement the +.Fn dup3 +call. +Do not use it. .It Dv F_GETFD Get the flags associated with the file descriptor .Fa fd . @@ -128,6 +149,10 @@ The file will be closed upon execution of .Fa ( arg is ignored). Otherwise, the file descriptor will remain open. +.It Dv FD_CLOFORK +The file will be closed upon execution of the +.Fn fork +family of system calls. .It Dv FD_RESOLVE_BENEATH All path name lookups relative to that file descriptor will behave as if the lookup had @@ -153,7 +178,8 @@ descriptor to also have the flag set. Set flags associated with .Fa fd . The available flags are -.Dv FD_CLOEXEC +.Dv FD_CLOEXEC , +.Dv FD_CLOFORK and .Dv FD_RESOLVE_BENEATH . The @@ -785,8 +811,10 @@ for the reasons as stated in .Sh STANDARDS The .Dv F_DUP2FD -constant is non portable. -It is provided for compatibility with AIX and Solaris. +and +.Dv F_DUP3FD +constants are not portable. +They are provided for compatibility with AIX and Solaris. .Pp Per .St -susv4 , @@ -811,3 +839,10 @@ The .Dv F_DUP2FD constant first appeared in .Fx 7.1 . +.Pp +The +.Dv F_DUPFD_CLOFORK +and +.Dv F_DUP3FD +flags appeared in +.Fx 15.0 . diff --git a/lib/libsys/fork.2 b/lib/libsys/fork.2 index 7d548a42890d..e59b208a9ff5 100644 --- a/lib/libsys/fork.2 +++ b/lib/libsys/fork.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 5, 2021 +.Dd May 17, 2024 .Dt FORK 2 .Os .Sh NAME @@ -68,6 +68,16 @@ by the parent. This descriptor copying is also used by the shell to establish standard input and output for newly created processes as well as to set up pipes. +Any file descriptors that were marked with the close-on-fork flag, +.Dv FD_CLOFORK +.Po see +.Fn fcntl 2 +and +.Dv O_CLOFORK +in +.Fn open 2 +.Pc , +will not be present in the child process, but remain open in the parent. .It The child process' resource utilizations are set to 0; see diff --git a/lib/libsys/open.2 b/lib/libsys/open.2 index 84c4f02fce8a..a0e905a8f375 100644 --- a/lib/libsys/open.2 +++ b/lib/libsys/open.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 3, 2025 +.Dd May 17, 2025 .Dt OPEN 2 .Os .Sh NAME @@ -195,6 +195,9 @@ error if file is not a directory .It Dv O_CLOEXEC automatically close file on .Xr execve 2 +.It Dv O_CLOFORK +automatically close file on any child process created with +.Fn fork 2 .It Dv O_VERIFY verify the contents of the file with .Xr mac_veriexec 4 @@ -360,6 +363,27 @@ may be used to set .Dv FD_CLOEXEC flag for the newly returned file descriptor. .Pp +.Dv O_CLOFORK +may be used to set +.Dv FD_CLOFORK +flag for the newly returned file descriptor. +The file will be closed on any child process created with +.Fn fork 2 , +.Fn vfork 2 +or +.Fn rfork 2 +with the +.Dv RFFDG +flag, remaining open in the parent. +Both the +.Dv O_CLOEXEC +and +.Dv O_CLOFORK +flags can be modified with the +.Dv F_SETFD +.Fn fcntl 2 +command. +.Pp .Dv O_VERIFY may be used to indicate to the kernel that the contents of the file should be verified before allowing the open to proceed. @@ -846,6 +870,9 @@ function was introduced in appeared in 13.0. .Dv O_NAMEDATTR appeared in 15.0. +.Dv O_CLOFORK +appeared in +.Fx 15.0 . .Sh BUGS The .Fa mode diff --git a/lib/libsys/pipe.2 b/lib/libsys/pipe.2 index 9531c9717395..37d6eba420de 100644 --- a/lib/libsys/pipe.2 +++ b/lib/libsys/pipe.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 1, 2017 +.Dd May 17, 2025 .Dt PIPE 2 .Os .Sh NAME @@ -64,6 +64,8 @@ list, defined in .Bl -tag -width ".Dv O_NONBLOCK" .It Dv O_CLOEXEC Set the close-on-exec flag for the new file descriptors. +.It Dv O_CLOFORK +Set the close-on-fork flag for the new file descriptors. .It Dv O_NONBLOCK Set the non-blocking flag for the ends of the pipe. .El @@ -173,3 +175,8 @@ function became a wrapper around .Fn pipe2 in .Fx 11.0 . +.Pp +The +.Dv O_CLOFORK +flag appeared in +.Fx 15.0 . diff --git a/lib/libsys/recv.2 b/lib/libsys/recv.2 index f3ee60b75663..b78cd70b8a1d 100644 --- a/lib/libsys/recv.2 +++ b/lib/libsys/recv.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 30, 2022 +.Dd May 17, 2025 .Dt RECV 2 .Os .Sh NAME @@ -164,6 +164,7 @@ one or more of the values: .It Dv MSG_WAITALL Ta wait for full request or error .It Dv MSG_DONTWAIT Ta do not block .It Dv MSG_CMSG_CLOEXEC Ta set received fds close-on-exec +.It Dv MSG_CMSG_CLOFORK Ta set received fds close-on-fork .It Dv MSG_WAITFORONE Ta do not block after receiving the first message (only for .Fn recvmmsg diff --git a/lib/libsys/socket.2 b/lib/libsys/socket.2 index a383cbcc4d80..b211611c6354 100644 --- a/lib/libsys/socket.2 +++ b/lib/libsys/socket.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 15, 2023 +.Dd May 17, 2025 .Dt SOCKET 2 .Os .Sh NAME @@ -121,6 +121,7 @@ argument: .Pp .Bd -literal -offset indent -compact SOCK_CLOEXEC Set close-on-exec on the new descriptor, +SOCK_CLOFORK Set close-on-fork on the new descriptor, SOCK_NONBLOCK Set non-blocking mode on the new socket .Ed .Pp @@ -331,7 +332,10 @@ argument of .Fn socket . The .Dv SOCK_CLOEXEC -flag is expected to conform to the next revision of the +and +.Dv SOCK_CLOFORK +flags are expected to conform to +.St -p1003.1-2024 . .Tn POSIX standard. The @@ -347,3 +351,8 @@ The .Fn socket system call appeared in .Bx 4.2 . +.Pp +The +.Dv SOCK_CLOFORK +flag appeared in +.Fx 15.0 . diff --git a/lib/libsys/socketpair.2 b/lib/libsys/socketpair.2 index 5874a0791f4d..60dec74f9cc2 100644 --- a/lib/libsys/socketpair.2 +++ b/lib/libsys/socketpair.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 10, 2018 +.Dd May 17, 2025 .Dt SOCKETPAIR 2 .Os .Sh NAME @@ -56,7 +56,8 @@ and The two sockets are indistinguishable. .Pp The -.Dv SOCK_CLOEXEC +.Dv SOCK_CLOEXEC , +.Dv SOCK_CLOFORK and .Dv SOCK_NONBLOCK flags in the From nobody Sun Jul 6 23:18:44 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3GF23Hjz60ZmK; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3GD2NyMz3tfT; Sun, 06 Jul 2025 23:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vfycmGZEb1qrPXeGAXEEdgIqAgGkwq1+MwXP3Oq326c=; b=n/fuAbGpL/1Am2sok0tS7GqZlwdWzITiBDqm0ETjzbKzcS8c32cjrXYHJYX0uOMDZXs5jD 03/yNgj62lpK+9nzhC/BsqPr870F8/4jFquzm/KZduziQAloSfEDncJGT6QDnasXldvtsA 3hf0xBncRYMdeoBNlYC9OD9zqhh/yRJRz7pAjkRqrvlEBeIHD30gDiLt7UUblJf2xNExp7 JLf9Oi7S4jjZYIy1WNspEn7zN1HQvS1TvMGZQP6/B5d8PJABdqkXpI2Ft3siHlreL/x8A9 1TxqW1BpSNQiUmVBnLPR7eOiNJoDfK5hM/cMLUZ7nXaJW8BeRTFDZg64KZftNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vfycmGZEb1qrPXeGAXEEdgIqAgGkwq1+MwXP3Oq326c=; b=ZbNabDGzhnUnRD4aDB7zzdf4TJ34BEkR04K3In0ptWhNhw6JOIUIdxDIyT+Xp5B13+Emaj 7IXGQkM+d3DylNzuSLFNo+//n+M3Mgd7I3utTVfxINXMdFZxYjH0aViibOsZLmeDYiMcnb k4a8pIdreUpegcWyN2M8QZ0hLAE5mubKutntKb4cKf/bO0LSssUWob3pv4yWwDSDJTpjkE Rdvb9Xyt2IQJi1s3JruYTh3jB+/w6oRAzUj5Pv0V6d9BqQHlcVZwY7fKg0qQfLo0ixIXdZ pXef+rCcikbSqbxtybDKgZFGojaOLhe/hO+MZkT7SD9+pb8W0b0PGnyrMUoiCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843924; a=rsa-sha256; cv=none; b=wf8oFrm1qVZ+3o7wO0eRYQl2OznfcNCfIzvEsR+r2kLV4K63blaIcn5Xx5soWVETJki39o M7+Jg/dhI44Q1E6Tm0co2udVZaq9noEEkFihRaHofDwRj8CeSmYT0Vc3bxq25beJXGMO5b hkPootyWXCX1k55olZ+Z5NJG6tPbAgOvlOHk8yYgJX0fbPPBDwHsHIePhkNFZlVV4vH7ty P1E/rfosREGGu1PGjRQhuEmw6rHXbpvclZwzek+EjF+RigBLx6Cf298pimpc5Ae6Ut5WGA 0xeA5Sfg32AjjF2khz7scCDyh7+dw5hdU/TNGFOLH3Ef5OaxPiBM7gEPkBEKjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3GD1VNNz9PJ; Sun, 06 Jul 2025 23:18:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIibS031341; Sun, 6 Jul 2025 23:18:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIir0031338; Sun, 6 Jul 2025 23:18:44 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:44 GMT Message-Id: <202507062318.566NIir0031338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 20ee243707ff - main - tests: Add Illumos oclo tests for O_CLOEXEC & O_CLOFORK List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20ee243707ff826221cd588ad3c6b53ddea07415 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=20ee243707ff826221cd588ad3c6b53ddea07415 commit 20ee243707ff826221cd588ad3c6b53ddea07415 Author: Ricardo Branco AuthorDate: 2025-06-17 06:05:27 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:09:05 +0000 tests: Add Illumos oclo tests for O_CLOEXEC & O_CLOFORK Taken from last commit bb9475a199514dcace79d04d02c1eff05d65b94f from https://github.com/illumos/illumos-gate/tree/master/usr/src/test/os-tests/tests/oclo MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- .../opensolaris/tests/os-tests/tests/oclo/oclo.c | 1310 ++++++++++++++++++++ .../tests/os-tests/tests/oclo/oclo_errors.c | 193 +++ .../tests/os-tests/tests/oclo/ocloexec_verify.c | 137 ++ 3 files changed, 1640 insertions(+) diff --git a/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo.c b/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo.c new file mode 100644 index 000000000000..b21c253fca24 --- /dev/null +++ b/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo.c @@ -0,0 +1,1310 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2025 Oxide Computer Company + */ + +/* + * Verify the behavior of the various O_CLOFORK and O_CLOEXEC variants. In + * particular getting this via: + * + * - open(2): O_CLOFORK/O_CLOEXEC + * - fcntl(2): F_SETFD FD_CLOFORK/FD_CLOEXEC + * - fcntl(2): F_DUPFD_CLOFORK/F_DUPFD_CLOEXEC + * - fcntl(2): F_DUP2FD_CLOFORK/F_DUP2FD_CLOEXEC + * - dup2(3C) + * - dup3(3C): argument translation + * - pipe2(2) + * - socket(2): SOCK_CLOEXEC/SOCK_CLOFORK + * - accept(2): flags on the listen socket aren't inherited on accept + * - socketpair(3SOCKET) + * - accept4(2): SOCK_CLOEXEC/SOCK_CLOFORK + * - recvmsg(2): SCM_RIGHTS MSG_CMSG_CLOFORK/MSG_CMSG_CLOEXEC + * + * The test is designed such that we have an array of functions that are used to + * create file descriptors with different rules. This is found in the + * oclo_create array. Each file descriptor that is created is then registered + * with information about what is expected about it. A given creation function + * can create more than one file descriptor; however, our expectation is that + * every file descriptor is accounted for (ignoring stdin, stdout, and stderr). + * + * We pass a record of each file descriptor that was recorded to a verification + * program that will verify everything is correctly honored after an exec. Note + * that O_CLOFORK is cleared after exec. The original specification in POSIX has + * it being retained; however, this issue was raised after the spec was + * published as folks went to implement it and we have ended up following along + * with the divergence of other implementations. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Verification program name. + */ +#define OCLO_VERIFY "ocloexec_verify" + +/* + * This structure represents a table of ways we expect to create file + * descriptors that should have the resulting flags set when done. The table is + * ordered and subsequent iterations are allowed to assume that the ones that + * have gone ahead of them have run and are therefore allowed to access them. + * The create function is expected to return the created fd. + */ +typedef struct clo_create clo_create_t; +struct clo_create { + const char *clo_desc; + int clo_flags; + void (*clo_func)(const clo_create_t *); +}; + +/* + * This is our run-time data. We expect all file descriptors to be registered by + * our calling functions through oclo_record(). + */ +typedef struct clo_rtdata { + const clo_create_t *crt_data; + size_t crt_idx; + int crt_fd; + int crt_flags; + const char *crt_desc; +} clo_rtdata_t; + +static clo_rtdata_t *oclo_rtdata; +size_t oclo_rtdata_nents = 0; +size_t oclo_rtdata_next = 0; +static int oclo_nextfd = STDERR_FILENO + 1; + +static bool +oclo_flags_match(const clo_rtdata_t *rt, bool child) +{ + const char *pass = child ? "post-fork" : "pre-fork"; + bool fail = child && (rt->crt_flags & FD_CLOFORK) != 0; + int flags = fcntl(rt->crt_fd, F_GETFD, NULL); + + if (flags < 0) { + int e = errno; + + if (fail) { + if (e == EBADF) { + (void) printf("TEST PASSED: %s (%s): fd %d: " + "correctly closed\n", + rt->crt_data->clo_desc, pass, rt->crt_fd); + return (true); + } + + warn("TEST FAILED: %s (%s): fd %d: expected fcntl to " + "fail with EBADF, but found %s", + rt->crt_data->clo_desc, pass, rt->crt_fd, + strerrorname_np(e)); + return (false); + } + + warnx("TEST FAILED: %s (%s): fd %d: fcntl(F_GETFD) " + "unexpectedly failed", rt->crt_data->clo_desc, pass, + rt->crt_fd); + return (false); + } + + if (fail) { + warnx("TEST FAILED: %s (%s): fd %d: received flags %d, but " + "expected to fail based on flags %d", + rt->crt_data->clo_desc, pass, rt->crt_fd, flags, + rt->crt_fd); + return (false); + } + + if (flags != rt->crt_flags) { + warnx("TEST FAILED: %s (%s): fd %d: discovered flags 0x%x do " + "not match expected flags 0x%x", rt->crt_data->clo_desc, + pass, rt->crt_fd, flags, rt->crt_fd); + return (false); + } + + (void) printf("TEST PASSED: %s (%s): fd %d discovered flags match " + "(0x%x)\n", rt->crt_data->clo_desc, pass, rt->crt_fd, flags); + return (true); +} + + +static void +oclo_record(const clo_create_t *c, int fd, int exp_flags, const char *desc) +{ + if (oclo_rtdata_next == oclo_rtdata_nents) { + size_t newrt = oclo_rtdata_nents + 8; + clo_rtdata_t *rt; + rt = recallocarray(oclo_rtdata, oclo_rtdata_nents, newrt, + sizeof (clo_rtdata_t)); + if (rt == NULL) { + err(EXIT_FAILURE, "TEST_FAILED: internal error " + "expanding fd records to %zu entries", newrt); + } + + oclo_rtdata_nents = newrt; + oclo_rtdata = rt; + } + + if (fd != oclo_nextfd) { + errx(EXIT_FAILURE, "TEST FAILED: internal test error: expected " + "to record next fd %d, given %d", oclo_nextfd, fd); + } + + oclo_rtdata[oclo_rtdata_next].crt_data = c; + oclo_rtdata[oclo_rtdata_next].crt_fd = fd; + oclo_rtdata[oclo_rtdata_next].crt_flags = exp_flags; + oclo_rtdata[oclo_rtdata_next].crt_desc = desc; + + /* + * Matching errors at this phase are fatal as it means we screwed up the + * program pretty badly. + */ + if (!oclo_flags_match(&oclo_rtdata[oclo_rtdata_next], false)) { + exit(EXIT_FAILURE); + } + + oclo_rtdata_next++; + oclo_nextfd++; +} + +static int +oclo_file(const clo_create_t *c) +{ + int flags = O_RDWR, fd; + + if ((c->clo_flags & FD_CLOEXEC) != 0) + flags |= O_CLOEXEC; + if ((c->clo_flags & FD_CLOFORK) != 0) + flags |= O_CLOFORK; + fd = open("/dev/null", flags); + if (fd < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to open /dev/null", + c->clo_desc); + } + + return (fd); +} + +static void +oclo_open(const clo_create_t *c) +{ + oclo_record(c, oclo_file(c), c->clo_flags, NULL); +} + +static void +oclo_setfd_common(const clo_create_t *c, int targ_flags) +{ + int fd = oclo_file(c); + if (fcntl(fd, F_SETFD, targ_flags) < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: F_SETFD failed to set " + "flags to %d", c->clo_desc, targ_flags); + } + + oclo_record(c, fd, targ_flags, NULL); +} + +static void +oclo_setfd_none(const clo_create_t *c) +{ + oclo_setfd_common(c, 0); +} + +static void +oclo_setfd_exec(const clo_create_t *c) +{ + oclo_setfd_common(c, FD_CLOEXEC); +} + +static void +oclo_setfd_fork(const clo_create_t *c) +{ + oclo_setfd_common(c, FD_CLOFORK); +} + +static void +oclo_setfd_both(const clo_create_t *c) +{ + oclo_setfd_common(c, FD_CLOFORK | FD_CLOEXEC); +} + +/* + * Open an fd with flags in a certain form and then use one of the F_DUPFD or + * F_DUP2FD variants and ensure that flags are properly propagated as expected. + */ +static void +oclo_fdup_common(const clo_create_t *c, int targ_flags, int cmd) +{ + int dup, fd; + + fd = oclo_file(c); + oclo_record(c, fd, c->clo_flags, "base"); + switch (cmd) { + case F_DUPFD: + case F_DUPFD_CLOEXEC: + case F_DUPFD_CLOFORK: + dup = fcntl(fd, cmd, fd); + break; + case F_DUP2FD: + case F_DUP2FD_CLOEXEC: + case F_DUP2FD_CLOFORK: + dup = fcntl(fd, cmd, fd + 1); + break; + case F_DUP3FD: + dup = fcntl(fd, cmd, fd + 1, targ_flags); + break; + default: + errx(EXIT_FAILURE, "TEST FAILURE: %s: internal error: " + "unexpected fcntl cmd: 0x%x", c->clo_desc, cmd); + } + + if (dup < 0) { + err(EXIT_FAILURE, "TEST FAILURE: %s: failed to dup fd with " + "fcntl command 0x%x", c->clo_desc, cmd); + } + + oclo_record(c, dup, targ_flags, "dup"); +} + +static void +oclo_fdupfd(const clo_create_t *c) +{ + oclo_fdup_common(c, 0, F_DUPFD); +} + +static void +oclo_fdupfd_fork(const clo_create_t *c) +{ + oclo_fdup_common(c, FD_CLOFORK, F_DUPFD_CLOFORK); +} + +static void +oclo_fdupfd_exec(const clo_create_t *c) +{ + oclo_fdup_common(c, FD_CLOEXEC, F_DUPFD_CLOEXEC); +} + +static void +oclo_fdup2fd(const clo_create_t *c) +{ + oclo_fdup_common(c, 0, F_DUP2FD); +} + +static void +oclo_fdup2fd_fork(const clo_create_t *c) +{ + oclo_fdup_common(c, FD_CLOFORK, F_DUP2FD_CLOFORK); +} + +static void +oclo_fdup2fd_exec(const clo_create_t *c) +{ + oclo_fdup_common(c, FD_CLOEXEC, F_DUP2FD_CLOEXEC); +} + +static void +oclo_fdup3fd_none(const clo_create_t *c) +{ + oclo_fdup_common(c, 0, F_DUP3FD); +} + +static void +oclo_fdup3fd_exec(const clo_create_t *c) +{ + oclo_fdup_common(c, FD_CLOEXEC, F_DUP3FD); +} + +static void +oclo_fdup3fd_fork(const clo_create_t *c) +{ + oclo_fdup_common(c, FD_CLOFORK, F_DUP3FD); +} + +static void +oclo_fdup3fd_both(const clo_create_t *c) +{ + oclo_fdup_common(c, FD_CLOEXEC | FD_CLOFORK, F_DUP3FD); +} + +static void +oclo_dup_common(const clo_create_t *c, int targ_flags, bool v3) +{ + int dup, fd; + fd = oclo_file(c); + oclo_record(c, fd, c->clo_flags, "base"); + if (v3) { + int dflags = 0; + if ((targ_flags & FD_CLOEXEC) != 0) + dflags |= O_CLOEXEC; + if ((targ_flags & FD_CLOFORK) != 0) + dflags |= O_CLOFORK; + dup = dup3(fd, fd + 1, dflags); + } else { + dup = dup2(fd, fd + 1); + } + + oclo_record(c, dup, targ_flags, "dup"); +} + +static void +oclo_dup2(const clo_create_t *c) +{ + oclo_dup_common(c, 0, false); +} + +static void +oclo_dup3_none(const clo_create_t *c) +{ + oclo_dup_common(c, 0, true); +} + +static void +oclo_dup3_exec(const clo_create_t *c) +{ + oclo_dup_common(c, FD_CLOEXEC, true); +} + +static void +oclo_dup3_fork(const clo_create_t *c) +{ + oclo_dup_common(c, FD_CLOFORK, true); +} + +static void +oclo_dup3_both(const clo_create_t *c) +{ + oclo_dup_common(c, FD_CLOEXEC | FD_CLOFORK, true); +} + +static void +oclo_pipe(const clo_create_t *c) +{ + int flags = 0, fds[2]; + + if ((c->clo_flags & FD_CLOEXEC) != 0) + flags |= O_CLOEXEC; + if ((c->clo_flags & FD_CLOFORK) != 0) + flags |= O_CLOFORK; + + if (pipe2(fds, flags) < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: pipe2() with flags %d " + "failed", c->clo_desc, flags); + } + + oclo_record(c, fds[0], c->clo_flags, "pipe[0]"); + oclo_record(c, fds[1], c->clo_flags, "pipe[1]"); +} + +static void +oclo_socket(const clo_create_t *c) +{ + int type = SOCK_DGRAM, fd; + + if ((c->clo_flags & FD_CLOEXEC) != 0) + type |= SOCK_CLOEXEC; + if ((c->clo_flags & FD_CLOFORK) != 0) + type |= SOCK_CLOFORK; + fd = socket(PF_INET, type, 0); + if (fd < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to create socket " + "with flags: 0x%x\n", c->clo_desc, c->clo_flags); + } + + oclo_record(c, fd, c->clo_flags, NULL); +} + +static void +oclo_accept_common(const clo_create_t *c, int targ_flags, bool a4) +{ + int lsock, csock, asock; + int ltype = SOCK_STREAM, atype = 0; + struct sockaddr_in in; + socklen_t slen; + + if ((c->clo_flags & FD_CLOEXEC) != 0) + ltype |= SOCK_CLOEXEC; + if ((c->clo_flags & FD_CLOFORK) != 0) + ltype |= SOCK_CLOFORK; + + if ((targ_flags & FD_CLOEXEC) != 0) + atype |= SOCK_CLOEXEC; + if ((targ_flags & FD_CLOFORK) != 0) + atype |= SOCK_CLOFORK; + + lsock = socket(PF_INET, ltype, 0); + if (lsock < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to create listen " + "socket with flags: 0x%x\n", c->clo_desc, c->clo_flags); + } + + oclo_record(c, lsock, c->clo_flags, "listen"); + (void) memset(&in, 0, sizeof (in)); + in.sin_family = AF_INET; + in.sin_port = 0; + in.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind(lsock, (struct sockaddr *)&in, sizeof (in)) != 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to bind socket", + c->clo_desc); + } + + slen = sizeof (struct sockaddr_in); + if (getsockname(lsock, (struct sockaddr *)&in, &slen) != 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to discover bound " + "socket address", c->clo_desc); + } + + if (listen(lsock, 5) < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to listen on socket", + c->clo_desc); + } + + csock = socket(PF_INET, SOCK_STREAM, 0); + if (csock < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to create client " + "socket", c->clo_desc); + } + oclo_record(c, csock, 0, "connect"); + + if (connect(csock, (struct sockaddr *)&in, sizeof (in)) != 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to connect to " + "server socket", c->clo_desc); + } + + if (a4) { + asock = accept4(lsock, NULL, NULL, atype); + } else { + asock = accept(lsock, NULL, NULL); + } + if (asock < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to accept client " + "connection", c->clo_desc); + } + oclo_record(c, asock, targ_flags, "accept"); +} + +static void +oclo_accept(const clo_create_t *c) +{ + oclo_accept_common(c, 0, false); +} + +static void +oclo_accept4_none(const clo_create_t *c) +{ + oclo_accept_common(c, 0, true); +} + +static void +oclo_accept4_fork(const clo_create_t *c) +{ + oclo_accept_common(c, FD_CLOFORK, true); +} + +static void +oclo_accept4_exec(const clo_create_t *c) +{ + oclo_accept_common(c, FD_CLOEXEC, true); +} + +static void +oclo_accept4_both(const clo_create_t *c) +{ + oclo_accept_common(c, FD_CLOEXEC | FD_CLOFORK, true); +} + +/* + * Go through the process of sending ourselves a file descriptor. + */ +static void +oclo_rights_common(const clo_create_t *c, int targ_flags) +{ + int pair[2], type = SOCK_DGRAM, sflags = 0; + int tosend = oclo_file(c), recvfd; + uint32_t data = 0x7777; + struct iovec iov; + struct msghdr msg; + struct cmsghdr *cm; + + if ((c->clo_flags & FD_CLOEXEC) != 0) + type |= SOCK_CLOEXEC; + if ((c->clo_flags & FD_CLOFORK) != 0) + type |= SOCK_CLOFORK; + + if (socketpair(PF_UNIX, type, 0, pair) < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to create socket " + "pair", c->clo_desc); + } + + oclo_record(c, tosend, c->clo_flags, "send fd"); + oclo_record(c, pair[0], c->clo_flags, "pair[0]"); + oclo_record(c, pair[1], c->clo_flags, "pair[1]"); + + iov.iov_base = (void *)&data; + iov.iov_len = sizeof (data); + + (void) memset(&msg, 0, sizeof (msg)); + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_controllen = CMSG_SPACE(sizeof (int)); + + msg.msg_control = calloc(1, msg.msg_controllen); + if (msg.msg_control == NULL) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to allocate %u " + "bytes for SCM_RIGHTS control message", c->clo_desc, + msg.msg_controllen); + } + + cm = CMSG_FIRSTHDR(&msg); + cm->cmsg_len = CMSG_LEN(sizeof (int)); + cm->cmsg_level = SOL_SOCKET; + cm->cmsg_type = SCM_RIGHTS; + (void) memcpy(CMSG_DATA(cm), &tosend, sizeof (tosend)); + + if ((targ_flags & FD_CLOEXEC) != 0) + sflags |= MSG_CMSG_CLOEXEC; + if ((targ_flags & FD_CLOFORK) != 0) + sflags |= MSG_CMSG_CLOFORK; + + if (sendmsg(pair[0], &msg, 0) < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to send fd", + c->clo_desc); + } + + data = 0; + if (recvmsg(pair[1], &msg, sflags) < 0) { + err(EXIT_FAILURE, "TEST FAILED: %s: failed to get fd", + c->clo_desc); + } + + if (data != 0x7777) { + errx(EXIT_FAILURE, "TEST FAILED: %s: did not receive correct " + "data: expected 0x7777, found 0x%x", c->clo_desc, data); + } + + if (msg.msg_controllen < CMSG_SPACE(sizeof (int))) { + errx(EXIT_FAILURE, "TEST FAILED: %s: found insufficient " + "message control length: expected at least 0x%x, found " + "0x%x", c->clo_desc, CMSG_SPACE(sizeof (int)), + msg.msg_controllen); + } + + cm = CMSG_FIRSTHDR(&msg); + if (cm->cmsg_level != SOL_SOCKET || cm->cmsg_type != SCM_RIGHTS) { + errx(EXIT_FAILURE, "TEST FAILED: %s: found surprising cmsg " + "0x%x/0x%x, expected 0x%x/0x%x", c->clo_desc, + cm->cmsg_level, cm->cmsg_type, SOL_SOCKET, SCM_RIGHTS); + } + + if (cm->cmsg_len != CMSG_LEN(sizeof (int))) { + errx(EXIT_FAILURE, "TEST FAILED: %s: found unexpected " + "SCM_RIGHTS length 0x%x: expected 0x%zx", c->clo_desc, + cm->cmsg_len, CMSG_LEN(sizeof (int))); + } + + (void) memcpy(&recvfd, CMSG_DATA(cm), sizeof (recvfd)); + oclo_record(c, recvfd, targ_flags, "SCM_RIGHTS"); +} + +static void +oclo_rights_none(const clo_create_t *c) +{ + oclo_rights_common(c, 0); +} + +static void +oclo_rights_exec(const clo_create_t *c) +{ + oclo_rights_common(c, FD_CLOEXEC); +} + +static void +oclo_rights_fork(const clo_create_t *c) +{ + oclo_rights_common(c, FD_CLOFORK); +} + +static void +oclo_rights_both(const clo_create_t *c) +{ + oclo_rights_common(c, FD_CLOEXEC | FD_CLOFORK); +} + +static const clo_create_t oclo_create[] = { { + .clo_desc = "open(2), no flags", + .clo_flags = 0, + .clo_func = oclo_open +}, { + .clo_desc = "open(2), O_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_open +}, { + .clo_desc = "open(2), O_CLOFORK", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_open +}, { + .clo_desc = "open(2), O_CLOEXEC|O_CLOFORK", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_open +}, { + .clo_desc = "fcntl(F_SETFD) no flags->no flags", + .clo_flags = 0, + .clo_func = oclo_setfd_none +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOFORK|O_CLOEXEC->no flags", + .clo_flags = O_CLOFORK | O_CLOEXEC, + .clo_func = oclo_setfd_none +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOEXEC->no flags", + .clo_flags = O_CLOEXEC, + .clo_func = oclo_setfd_none +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOFORK->no flags", + .clo_flags = O_CLOFORK, + .clo_func = oclo_setfd_none +}, { + .clo_desc = "fcntl(F_SETFD) no flags->O_CLOEXEC", + .clo_flags = 0, + .clo_func = oclo_setfd_exec +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOFORK|O_CLOEXEC->O_CLOEXEC", + .clo_flags = O_CLOFORK | O_CLOEXEC, + .clo_func = oclo_setfd_exec +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOEXEC->O_CLOEXEC", + .clo_flags = O_CLOEXEC, + .clo_func = oclo_setfd_exec +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOFORK->O_CLOEXEC", + .clo_flags = O_CLOFORK, + .clo_func = oclo_setfd_exec +}, { + .clo_desc = "fcntl(F_SETFD) no flags->O_CLOFORK", + .clo_flags = 0, + .clo_func = oclo_setfd_fork +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOFORK|O_CLOEXEC->O_CLOFORK", + .clo_flags = O_CLOFORK | O_CLOEXEC, + .clo_func = oclo_setfd_fork +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOEXEC->O_CLOFORK", + .clo_flags = O_CLOEXEC, + .clo_func = oclo_setfd_fork +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOFORK->O_CLOFORK", + .clo_flags = O_CLOFORK, + .clo_func = oclo_setfd_fork +}, { + .clo_desc = "fcntl(F_SETFD) no flags->O_CLOFORK|O_CLOEXEC", + .clo_flags = 0, + .clo_func = oclo_setfd_both +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOFORK|O_CLOEXEC->O_CLOFORK|O_CLOEXEC", + .clo_flags = O_CLOFORK | O_CLOEXEC, + .clo_func = oclo_setfd_both +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOEXEC->O_CLOFORK|O_CLOEXEC", + .clo_flags = O_CLOEXEC, + .clo_func = oclo_setfd_both +}, { + .clo_desc = "fcntl(F_SETFD) O_CLOFORK->O_CLOFORK|O_CLOEXEC", + .clo_flags = O_CLOFORK, + .clo_func = oclo_setfd_both +}, { + .clo_desc = "fcntl(F_DUPFD) none->none", + .clo_flags = 0, + .clo_func = oclo_fdupfd +}, { + .clo_desc = "fcntl(F_DUPFD) FD_CLOEXEC->none", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdupfd +}, { + .clo_desc = "fcntl(F_DUPFD) FD_CLOFORK->none", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdupfd +}, { + .clo_desc = "fcntl(F_DUPFD) FD_CLOEXEC|FD_CLOFORK->none", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdupfd +}, { + .clo_desc = "fcntl(F_DUPFD_CLOFORK) none", + .clo_flags = 0, + .clo_func = oclo_fdupfd_fork +}, { + .clo_desc = "fcntl(F_DUPFD_CLOFORK) FD_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdupfd_fork +}, { + .clo_desc = "fcntl(F_DUPFD_CLOFORK) FD_CLOFORK", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdupfd_fork +}, { + .clo_desc = "fcntl(F_DUPFD_CLOFORK) FD_CLOEXEC|FD_CLOFORK", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdupfd_fork +}, { + .clo_desc = "fcntl(F_DUPFD_CLOEXEC) none", + .clo_flags = 0, + .clo_func = oclo_fdupfd_exec +}, { + .clo_desc = "fcntl(F_DUPFD_CLOEXEC) FD_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdupfd_exec +}, { + .clo_desc = "fcntl(F_DUPFD_CLOEXEC) FD_CLOFORK", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdupfd_exec +}, { + .clo_desc = "fcntl(F_DUPFD_CLOEXEC) FD_CLOEXEC|FD_CLOFORK", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdupfd_exec +}, { + .clo_desc = "fcntl(F_DUP2FD) none->none", + .clo_flags = 0, + .clo_func = oclo_fdup2fd +}, { + .clo_desc = "fcntl(F_DUP2FD) FD_CLOEXEC->none", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdup2fd +}, { + .clo_desc = "fcntl(F_DUP2FD) FD_CLOFORK->none", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdup2fd +}, { + .clo_desc = "fcntl(F_DUP2FD) FD_CLOEXEC|FD_CLOFORK->none", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdup2fd +}, { + .clo_desc = "fcntl(F_DUP2FD_CLOFORK) none", + .clo_flags = 0, + .clo_func = oclo_fdup2fd_fork +}, { + .clo_desc = "fcntl(F_DUP2FD_CLOFORK) FD_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdup2fd_fork +}, { + .clo_desc = "fcntl(F_DUP2FD_CLOFORK) FD_CLOFORK", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdup2fd_fork +}, { + .clo_desc = "fcntl(F_DUP2FD_CLOFORK) FD_CLOEXEC|FD_CLOFORK", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdup2fd_fork +}, { + .clo_desc = "fcntl(F_DUP2FD_CLOEXEC) none", + .clo_flags = 0, + .clo_func = oclo_fdup2fd_exec +}, { + .clo_desc = "fcntl(F_DUP2FD_CLOEXEC) FD_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdup2fd_exec +}, { + .clo_desc = "fcntl(F_DUP2FD_CLOEXEC) FD_CLOFORK", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdup2fd_exec +}, { + .clo_desc = "fcntl(F_DUP2FD_CLOEXEC) FD_CLOEXEC|FD_CLOFORK", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdup2fd_exec +}, { + .clo_desc = "fcntl(F_DUP3FD) none->none", + .clo_flags = 0, + .clo_func = oclo_fdup3fd_none +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOEXEC->none", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdup3fd_none +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOFORK->none", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdup3fd_none +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOEXEC|FD_CLOFORK->none", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdup3fd_none +}, { + .clo_desc = "fcntl(F_DUP3FD) none->FD_CLOEXEC", + .clo_flags = 0, + .clo_func = oclo_fdup3fd_exec +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOEXEC->FD_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdup3fd_exec +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOFORK->FD_CLOEXEC", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdup3fd_exec +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOEXEC|FD_CLOFORK->FD_CLOEXEC", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdup3fd_exec +}, { + .clo_desc = "fcntl(F_DUP3FD) none->FD_CLOFORK|FD_CLOEXEC", + .clo_flags = 0, + .clo_func = oclo_fdup3fd_both +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOEXEC->FD_CLOFORK|FD_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdup3fd_both +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOFORK->FD_CLOFORK|FD_CLOEXEC", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdup3fd_both +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOEXEC|FD_CLOFORK->" + "FD_CLOFORK|FD_CLOEXEC", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdup3fd_both +}, { + .clo_desc = "fcntl(F_DUP3FD) none->FD_CLOFORK", + .clo_flags = 0, + .clo_func = oclo_fdup3fd_fork +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOEXEC->FD_CLOFORK", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_fdup3fd_fork +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOFORK->FD_CLOFORK", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_fdup3fd_fork +}, { + .clo_desc = "fcntl(F_DUP3FD) FD_CLOEXEC|FD_CLOFORK->FD_CLOFORK", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_fdup3fd_fork +}, { + .clo_desc = "dup2() none->none", + .clo_flags = 0, + .clo_func = oclo_dup2 +}, { + .clo_desc = "dup2() FD_CLOEXEC->none", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_dup2 +}, { + .clo_desc = "dup2() FD_CLOFORK->none", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_dup2 +}, { + .clo_desc = "dup2() FD_CLOEXEC|FD_CLOFORK->none", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_dup2 +}, { + .clo_desc = "dup3() none->none", + .clo_flags = 0, + .clo_func = oclo_dup3_none +}, { + .clo_desc = "dup3() FD_CLOEXEC->none", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_dup3_none +}, { + .clo_desc = "dup3() FD_CLOFORK->none", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_dup3_none +}, { + .clo_desc = "dup3() FD_CLOEXEC|FD_CLOFORK->none", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_dup3_none +}, { + .clo_desc = "dup3() none->FD_CLOEXEC", + .clo_flags = 0, + .clo_func = oclo_dup3_exec +}, { + .clo_desc = "dup3() FD_CLOEXEC->FD_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_dup3_exec +}, { + .clo_desc = "dup3() FD_CLOFORK->FD_CLOEXEC", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_dup3_exec +}, { + .clo_desc = "dup3() FD_CLOEXEC|FD_CLOFORK->FD_CLOEXEC", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_dup3_exec +}, { + .clo_desc = "dup3() none->FD_CLOFORK|FD_CLOEXEC", + .clo_flags = 0, + .clo_func = oclo_dup3_both +}, { + .clo_desc = "dup3() FD_CLOEXEC->FD_CLOFORK|FD_CLOEXEC", + .clo_flags = FD_CLOEXEC, + .clo_func = oclo_dup3_both +}, { + .clo_desc = "dup3() FD_CLOFORK->FD_CLOFORK|FD_CLOEXEC", + .clo_flags = FD_CLOFORK, + .clo_func = oclo_dup3_both +}, { + .clo_desc = "dup3() FD_CLOEXEC|FD_CLOFORK->FD_CLOFORK|FD_CLOEXEC", + .clo_flags = FD_CLOEXEC | FD_CLOFORK, + .clo_func = oclo_dup3_both *** 695 LINES SKIPPED *** From nobody Sun Jul 6 23:18:43 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3GF5Z1xz60Zw4; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3GD1ggCz3tR5; Sun, 06 Jul 2025 23:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i9wYzVcNDC9EX+ZuTEVA4SuNrxC2Pm3kzVjGEZKQams=; b=Fm/iq/oonCkwoHGNHSRAsmevZqCSb6JiAJ02rNyUYlCwDduiSDwu2fYzrSDOHo1GnhAuB2 txOHZHJtKLpEPZ9Lw92ITi7K6jvrnxXeHoU4vxqLeCukODK/qtUsDGIjDsJq1kB3sv6C/g k8lheq2cvA9sXI+5aJR9flROxGnTm3s5PB6i9ut4U4juZTQFw5zDz18Vwabo/v3Wpm1TVw uB4UwmnbtszFpJPWUIbk7unfCR8h9EtiO15L0q69EGlJ1c8+eWN7VUnNXq5Qg4m0iNSq+o eWhDZj9nPsGgGcJtjR1eOF8YsHxQiyysd5ZZeRc4rsEwzvRpryjDsV2TAg8qeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i9wYzVcNDC9EX+ZuTEVA4SuNrxC2Pm3kzVjGEZKQams=; b=PIWvKnalU41H68qdUr6ZvqCH3b1/dov9gYmc9gqiIU9eP/zS4HrggWD87pNqbBLXnSxQ+N 3bDh+4hYa3tXcmjpp899LOzGUfLMaeLNymw+U2tbPVtIAQAjMGUe4+jijcVE8yEtcnaxYz f5uoZr8/oRBglkWvW/xQZy1X+gEu84O42HcUwZd4LMOJxxMLwIP6JRxZsh7DfVqZ+jxsbH xKuds7YxkFXa6CoPTlBeEnPEL+/PewU8KMrOqijR7zQdF6IqVBnmrKxrzPD+rw/Mc8MnrZ yYdM2N3NlSzdaFDwhe1ciQ/p/9SD2aG3WeO5OcEQGtTURGdDVWdvYVY7Kmi++w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843924; a=rsa-sha256; cv=none; b=q3O8scGXZwxkwohzmiffAPMqLSlj1q1Z80OmnJw0lAR6UXD9Dy3lCdY10msnXYyKMpPpmA DlYC3e2qnmGUV4G/iDD/rxVaP7Y2mw2BI0bdKR1b37ROyaLicdwLNzRzIrzIlf80zLqtkI esTJMv7ug0M8tRkR1TNLR51cbcPfpVlA7BAscPxaEZWASWvF1PAW7Rca6s2+XVajhLGN0r 6XgTzbXieE2jp8eCMCHKUk80YZOKf9NoRBFroJJTQz2S95+u74JATyj8isPXDMQ9bgszGo eI1KZD5fYVWCbCi50/a0q2fG3RMGdo/h1fE/RKSckd/0p2mPX8CJ0iKRE/VkXQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3GC11yPz996; Sun, 06 Jul 2025 23:18:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIhgn031308; Sun, 6 Jul 2025 23:18:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIhSM031303; Sun, 6 Jul 2025 23:18:43 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:43 GMT Message-Id: <202507062318.566NIhSM031303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 71a0af25a535 - main - libopenbsd: Add recallocarray() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71a0af25a5353f929521cb04c73a7266ac5b7b61 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=71a0af25a5353f929521cb04c73a7266ac5b7b61 commit 71a0af25a5353f929521cb04c73a7266ac5b7b61 Author: Ricardo Branco AuthorDate: 2025-06-16 21:41:48 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:09:00 +0000 libopenbsd: Add recallocarray() Reviewed by: kib MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- lib/libopenbsd/Makefile | 3 +- lib/libopenbsd/recallocarray.c | 82 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/lib/libopenbsd/Makefile b/lib/libopenbsd/Makefile index 675ed476c51d..dca1c08b0aed 100644 --- a/lib/libopenbsd/Makefile +++ b/lib/libopenbsd/Makefile @@ -2,7 +2,8 @@ PACKAGE=lib${LIB} LIB= openbsd SRCS= imsg-buffer.c \ imsg.c \ - ohash.c + ohash.c \ + recallocarray.c .if !defined(BOOTSTRAPPING) # Skip getdtablecount.c when bootstrapping since it doesn't compile for Linux # and is not used by any of the bootstrap tools diff --git a/lib/libopenbsd/recallocarray.c b/lib/libopenbsd/recallocarray.c new file mode 100644 index 000000000000..11e1fda744c7 --- /dev/null +++ b/lib/libopenbsd/recallocarray.c @@ -0,0 +1,82 @@ +/* $OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $ */ +/* + * Copyright (c) 2008, 2017 Otto Moerbeek + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include + +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) + +void *recallocarray(void *, size_t, size_t, size_t); + +void * +recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size) +{ + size_t oldsize, newsize; + void *newptr; + + if (ptr == NULL) + return calloc(newnmemb, size); + + if ((newnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + newnmemb > 0 && SIZE_MAX / newnmemb < size) { + errno = ENOMEM; + return NULL; + } + newsize = newnmemb * size; + + if ((oldnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + oldnmemb > 0 && SIZE_MAX / oldnmemb < size) { + errno = EINVAL; + return NULL; + } + oldsize = oldnmemb * size; + + /* + * Don't bother too much if we're shrinking just a bit, + * we do not shrink for series of small steps, oh well. + */ + if (newsize <= oldsize) { + size_t d = oldsize - newsize; + + if (d < oldsize / 2 && d < (size_t)getpagesize()) { + memset((char *)ptr + newsize, 0, d); + return ptr; + } + } + + newptr = malloc(newsize); + if (newptr == NULL) + return NULL; + + if (newsize > oldsize) { + memcpy(newptr, ptr, oldsize); + memset((char *)newptr + oldsize, 0, newsize - oldsize); + } else + memcpy(newptr, ptr, newsize); + + explicit_bzero(ptr, oldsize); + free(ptr); + + return newptr; +} From nobody Sun Jul 6 23:18:46 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3GG6km7z60Zfx; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3GG3cS2z3tjJ; Sun, 06 Jul 2025 23:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Cocyl7xw+KDt2Nep6L0J7OLcz1vD7aFctYWn2Lwdmxc=; b=HSlHRte0dj0Fc2kpug1FlcY+Z9NKREhvRkVOxIAV87kuEIqpkUkAWN9GnDqP3aQai0ZVlB XsM56QqWxoTo6tDSuFB0f1guZdPl8YS03Cb/N146k6eKGyabSPYB1cSOuFQntmqH7HrDrF N4znvSNN1d2LM6Plxexu3C/KLtE1rjSsLJJRn7UVvHK82HBZWVlIiiolQ9UqfKSlOJpPeA YputyF86cIvDuwwJ7UXQByqr0cXPxJqtEPMlQYoY7FnmChWaWyC3Eu9IW1O6QW6Q8WMCJw 4JI4vFRL4pa/ScgFdpbVDBQMaf8I968kqkn/uO/d9dU9PxGFdtTRCdJygEEDWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Cocyl7xw+KDt2Nep6L0J7OLcz1vD7aFctYWn2Lwdmxc=; b=sDxnjTeskMNnkTH5N38f9h6WF09s8Tx+t3iFU4dcQzlCsSc12nNqb+9osIpugOqQj+lWBB I6K1oz3uvgF9cbBYfzupNc/JEdmt+LJ69+CwyiBkz7jw+PVOQq2XbCr6TuOq5DAJCobTiY tdMbeu4Sk3PZHW+2qW5Aao9E4AxEPfBjisJDTsVy5jEsOoFURiM34nYZHK9wkkoqKsHGY6 NR1rP7xizHUI9ulkZT0V5PVPKwRe3qea7QId2VoOSvJ29CX4D+GARpu2VM5oWPpP2JkDes loNfXR6NCag6Tte0kSm6m95OxCzGL64ZzTIrgb1PqxxzkpPPhe1NNEb1iAvEfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843926; a=rsa-sha256; cv=none; b=FLn5ZLoGHiTFACfZfUW4+CaGmfqYiz3ibOoSygAp1B75Z/nWL6TtUyyLGyUW6ZFiGH7gxr y6hKLX6RauDRtC7KBk68S4LSs7ROjx7CJI3Pu1IQjvGe4A9CzCg3vmfJ8y5pYQoYjloHbf TyOmyUxFkIWsyWGm4NFusWvL1uP+OGjmOgZnBii0ofQMTIbafbXPq6X0IV+j891Ihr9Bjc BL42DdaBUU0cn4ovLfGi+5Qsb3Pdqvykk9tYrdmjG6/lhKF901/Pa4su47HXOqJnh/qITW YkdIjBgCrl6nB/vOXNPGl+U3kVum4Kn2XAnIetw29QKmUlxCV4lpsXJwKjWb3A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3GG2wdGz9PK; Sun, 06 Jul 2025 23:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIkjP031416; Sun, 6 Jul 2025 23:18:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIk37031413; Sun, 6 Jul 2025 23:18:46 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:46 GMT Message-Id: <202507062318.566NIk37031413@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ea4042246d61 - main - libsysdecode: Add O_CLOFORK flags to sysdecode List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea4042246d618ed67275ed8fc0685c1dd6bcb8e5 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ea4042246d618ed67275ed8fc0685c1dd6bcb8e5 commit ea4042246d618ed67275ed8fc0685c1dd6bcb8e5 Author: Ricardo Branco AuthorDate: 2025-05-17 18:27:37 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:09:18 +0000 libsysdecode: Add O_CLOFORK flags to sysdecode Reviewed by: kib MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- lib/libsysdecode/flags.c | 13 +++++++------ lib/libsysdecode/sysdecode_fcntl_arg.3 | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c index dc09c5747968..f8e26e6a9dae 100644 --- a/lib/libsysdecode/flags.c +++ b/lib/libsysdecode/flags.c @@ -196,7 +196,7 @@ sysdecode_vmprot(FILE *fp, int type, int *rem) } static struct name_table sockflags[] = { - X(SOCK_CLOEXEC) X(SOCK_NONBLOCK) XEND + X(SOCK_CLOEXEC) X(SOCK_CLOFORK) X(SOCK_NONBLOCK) XEND }; bool @@ -206,16 +206,17 @@ sysdecode_socket_type(FILE *fp, int type, int *rem) uintmax_t val; bool printed; - str = lookup_value(socktype, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)); + str = lookup_value(socktype, + type & ~(SOCK_CLOEXEC | SOCK_CLOFORK | SOCK_NONBLOCK)); if (str != NULL) { fputs(str, fp); *rem = 0; printed = true; } else { - *rem = type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK); + *rem = type & ~(SOCK_CLOEXEC | SOCK_CLOFORK | SOCK_NONBLOCK); printed = false; } - val = type & (SOCK_CLOEXEC | SOCK_NONBLOCK); + val = type & (SOCK_CLOEXEC | SOCK_CLOFORK | SOCK_NONBLOCK); print_mask_part(fp, sockflags, &val, &printed); return (printed); } @@ -563,7 +564,7 @@ sysdecode_nfssvc_flags(int flags) } static struct name_table pipe2flags[] = { - X(O_CLOEXEC) X(O_NONBLOCK) XEND + X(O_CLOEXEC) X(O_CLOFORK) X(O_NONBLOCK) XEND }; bool @@ -873,7 +874,7 @@ sysdecode_fcntl_cmd(int cmd) } static struct name_table fcntl_fd_arg[] = { - X(FD_CLOEXEC) X(0) XEND + X(FD_CLOEXEC) X(FD_CLOFORK) X(0) XEND }; bool diff --git a/lib/libsysdecode/sysdecode_fcntl_arg.3 b/lib/libsysdecode/sysdecode_fcntl_arg.3 index ee3a030a79e4..d5648ce0adc3 100644 --- a/lib/libsysdecode/sysdecode_fcntl_arg.3 +++ b/lib/libsysdecode/sysdecode_fcntl_arg.3 @@ -54,7 +54,8 @@ are determined by .It Sy Command Ta Fa arg Sy Type Ta Sy Output Format .It .It Dv F_SETFD Ta Vt int Ta -.Dq FD_CLOEXEC +.Dq FD_CLOEXEC , +.Dq FD_CLOFORK or the value of .Fa arg in the indicated From nobody Sun Jul 6 23:18:45 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3GG2Q16z60Zxs; Sun, 06 Jul 2025 23:18: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3GF2rZXz3td2; Sun, 06 Jul 2025 23:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gGQMkfBYJb3TvnmXa9gQ5+kiWUUx2gX26toWiS/hI+s=; b=vOSSWyMf728+eOdVNw3XTGX4g156CEr21Jjw5IjYFxEOXO/seAFO0kFwp3ijGmVj8ZCoLq dukmvA38yF96ie0Fdv97II94hJS+Vf6V9fjumd0vu7KrJv2vvi/cU9tGo5SMypzfZu9MVR 4q2ef2Lho6vXNQ1j2QvZEWsXnoJnvbs0P3bd5AjDWJqOCthHuPvGBrbBQjo3Z3Q9+rSE0U NdFak08uWTPUO8jipTE/Kh+F8/df5T+wB7ZodUh0OPrWADRI9WIlTNXA0yh1GdipfzNJrZ iF5VofGQ901niFQqJauI7AVgF6YBWAi//pGnwII7hFV8zUW9DDpB9aibs0XDnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751843925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gGQMkfBYJb3TvnmXa9gQ5+kiWUUx2gX26toWiS/hI+s=; b=WwuLHrB6ryB85WW/hJ9Bu459Q6LLXc+V8FUWv2AT7g02Pr/agdiMWlMGAFxfn/plf69+Mj 9wlv6CI/PS0euKVxDFpKe5lAijEdKJjGXIry2x/jJXUyG3fOb7asizk3sy1QkQHLbREIV8 ns2gHTxLPkiaTLOC5zhlbHkQt8wWg8Zpv1hWUWrqBEpB/qizMenlHw/cLT0o0a+UiLERll Z0fPWertGld1wftuT2xUmIPHY/Hdhfm/lzf/6pToo4g/6N8UF9Zfzc5Q8EJR1ibrjO30Ql pxMnzyMuOWnv4U8WYqXcsLH3BES4L9UsjdCSC8epfn7BYGZoh/glRkJM9uQUWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751843925; a=rsa-sha256; cv=none; b=q6hByVlqzv7qABb6+T0pWjSTXAA1JdJtCM8lHntApGFk+QIzp55pCJhaA/mxn4qu4QiyVs o+PJH9NtYqBBrP+uT0RRCJL5taosD5lle9Tneaw4A/UWc4DTy2xCAmnLvREh0i8DcZhxjs s1pB+oI24RdM/aV6lBPETLicOmsR5wcsUar4fPyRClCrTlsrUSfmkZgbAhzmosULQ3N366 5r9Dq9MsbBf28fq6p6FTmJhVm0OFPIFurV+c4KWbpZOwtShTuVpKtXyWG4R0Clwha7TcyG CheH2DDPr1fWj1vqMiISWUjdYwM3euPNs19ywK30XaoElR0KVhwZ1yXq5YtwhQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3GF21zFz9wp; Sun, 06 Jul 2025 23:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NIjvQ031383; Sun, 6 Jul 2025 23:18:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NIjw6031380; Sun, 6 Jul 2025 23:18:45 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:18:45 GMT Message-Id: <202507062318.566NIjw6031380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4140012f8369 - main - tests: Adapt oclo tests to FreeBSD List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4140012f83690e9ed9b31d87c16e4f698332e24c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4140012f83690e9ed9b31d87c16e4f698332e24c commit 4140012f83690e9ed9b31d87c16e4f698332e24c Author: Ricardo Branco AuthorDate: 2025-06-16 17:45:54 +0000 Commit: Mark Johnston CommitDate: 2025-07-06 23:09:10 +0000 tests: Adapt oclo tests to FreeBSD MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/1698 --- .../opensolaris/tests/os-tests/tests/oclo/oclo.c | 91 +++++++++++++++------- .../tests/os-tests/tests/oclo/oclo_errors.c | 25 ++++-- .../tests/os-tests/tests/oclo/ocloexec_verify.c | 47 +++++++---- tests/Makefile | 5 ++ tests/oclo/Makefile | 11 +++ 5 files changed, 126 insertions(+), 53 deletions(-) diff --git a/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo.c b/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo.c index b21c253fca24..8e6f7c726f24 100644 --- a/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo.c +++ b/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo.c @@ -45,21 +45,54 @@ * with the divergence of other implementations. */ -#include -#include -#include -#include -#include +#include +#include #include -#include -#include -#include -#include +#include + +#include +#include + +#include #include -#include -#include +#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include + +void *recallocarray(void *, size_t, size_t, size_t); + +#define strerrorname_np(e) (sys_errlist[e]) + +/* + * Get pathname to avoid reading /proc/curproc/exe + * + * Taken from procstat_getpathname_sysctl() + */ +static int +getpathname(pid_t pid, char *pathname, size_t maxlen) +{ + int error, name[4]; + size_t len; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_PATHNAME; + name[3] = pid; + len = maxlen; + error = sysctl(name, nitems(name), pathname, &len, NULL, 0); + if (error != 0 && errno != ESRCH) + warn("sysctl: kern.proc.pathname: %d", pid); + if (len == 0) + pathname[0] = '\0'; + return (error); +} /* * Verification program name. @@ -93,8 +126,8 @@ typedef struct clo_rtdata { } clo_rtdata_t; static clo_rtdata_t *oclo_rtdata; -size_t oclo_rtdata_nents = 0; -size_t oclo_rtdata_next = 0; +static size_t oclo_rtdata_nents = 0; +static size_t oclo_rtdata_next = 0; static int oclo_nextfd = STDERR_FILENO + 1; static bool @@ -267,11 +300,13 @@ oclo_fdup_common(const clo_create_t *c, int targ_flags, int cmd) break; case F_DUP2FD: case F_DUP2FD_CLOEXEC: +#ifdef F_DUP2FD_CLOFORK case F_DUP2FD_CLOFORK: +#endif dup = fcntl(fd, cmd, fd + 1); break; case F_DUP3FD: - dup = fcntl(fd, cmd, fd + 1, targ_flags); + dup = fcntl(fd, cmd | (targ_flags << F_DUP3FD_SHIFT), fd + 1); break; default: errx(EXIT_FAILURE, "TEST FAILURE: %s: internal error: " @@ -310,11 +345,13 @@ oclo_fdup2fd(const clo_create_t *c) oclo_fdup_common(c, 0, F_DUP2FD); } +#ifdef F_DUP2FD_CLOFORK static void oclo_fdup2fd_fork(const clo_create_t *c) { oclo_fdup_common(c, FD_CLOFORK, F_DUP2FD_CLOFORK); } +#endif static void oclo_fdup2fd_exec(const clo_create_t *c) @@ -604,7 +641,7 @@ oclo_rights_common(const clo_create_t *c, int targ_flags) if (msg.msg_controllen < CMSG_SPACE(sizeof (int))) { errx(EXIT_FAILURE, "TEST FAILED: %s: found insufficient " - "message control length: expected at least 0x%x, found " + "message control length: expected at least 0x%zx, found " "0x%x", c->clo_desc, CMSG_SPACE(sizeof (int)), msg.msg_controllen); } @@ -795,6 +832,7 @@ static const clo_create_t oclo_create[] = { { .clo_flags = FD_CLOEXEC | FD_CLOFORK, .clo_func = oclo_fdup2fd }, { +#ifdef F_DUP2FD_CLOFORK .clo_desc = "fcntl(F_DUP2FD_CLOFORK) none", .clo_flags = 0, .clo_func = oclo_fdup2fd_fork @@ -811,6 +849,7 @@ static const clo_create_t oclo_create[] = { { .clo_flags = FD_CLOEXEC | FD_CLOFORK, .clo_func = oclo_fdup2fd_fork }, { +#endif .clo_desc = "fcntl(F_DUP2FD_CLOEXEC) none", .clo_flags = 0, .clo_func = oclo_fdup2fd_exec @@ -1216,20 +1255,12 @@ oclo_exec(void) char dir[PATH_MAX], file[PATH_MAX]; char **argv; - ret = readlink("/proc/self/path/a.out", dir, sizeof (dir)); - if (ret < 0) { - err(EXIT_FAILURE, "TEST FAILED: failed to read our a.out path " - "from /proc"); - } else if (ret == 0) { - errx(EXIT_FAILURE, "TEST FAILED: reading /proc/self/path/a.out " - "returned 0 bytes"); - } else if (ret == sizeof (dir)) { - errx(EXIT_FAILURE, "TEST FAILED: Using /proc/self/path/a.out " - "requires truncation"); - } + ret = getpathname(getpid(), dir, sizeof(dir)); + if (ret < 0) + err(EXIT_FAILURE, "TEST FAILED: failed to read executable path"); if (snprintf(file, sizeof (file), "%s/%s", dirname(dir), OCLO_VERIFY) >= - sizeof (file)) { + (int)sizeof (file)) { errx(EXIT_FAILURE, "TEST FAILED: cannot assemble exec path " "name: internal buffer overflow"); } @@ -1270,11 +1301,11 @@ main(void) * Treat failure during this set up phase as a hard failure. There's no * reason to continue if we can't successfully create the FDs we expect. */ - for (size_t i = 0; i < ARRAY_SIZE(oclo_create); i++) { + for (size_t i = 0; i < nitems(oclo_create); i++) { oclo_create[i].clo_func(&oclo_create[i]); } - pid_t child = forkx(FORK_NOSIGCHLD | FORK_WAITPID); + pid_t child = fork(); if (child == 0) { if (!oclo_verify_fork()) { ret = EXIT_FAILURE; diff --git a/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo_errors.c b/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo_errors.c index 9d9841271856..05b0c1a0839b 100644 --- a/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo_errors.c +++ b/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/oclo_errors.c @@ -24,16 +24,21 @@ * o accept4() */ -#include +#include +#include + #include -#include -#include -#include #include -#include #include #include -#include +#include +#include +#include +#include +#include +#include + +#define strerrorname_np(e) (sys_errlist[e]) static bool oclo_check(const char *desc, const char *act, int ret, int e) @@ -42,7 +47,7 @@ oclo_check(const char *desc, const char *act, int ret, int e) warnx("TEST FAILED: %s: fd was %s!", desc, act); return (false); } else if (errno != EINVAL) { - int e = errno; + e = errno; warnx("TEST FAILED: %s: failed with %s, expected " "EINVAL", desc, strerrorname_np(e)); return (false); @@ -63,7 +68,7 @@ oclo_dup3(const char *desc, int flags) static bool oclo_dup3fd(const char *desc, int flags) { - int fd = fcntl(STDERR_FILENO, F_DUP3FD, 23, flags); + int fd = fcntl(STDERR_FILENO, F_DUP3FD | (flags << F_DUP3FD_SHIFT), 23); return (oclo_check(desc, "duplicated", fd, errno)); } @@ -77,12 +82,14 @@ oclo_pipe2(const char *desc, int flags) return (oclo_check(desc, "piped", ret, errno)); } +#if 0 static bool oclo_socket(const char *desc, int type) { int fd = socket(PF_UNIX, SOCK_STREAM | type, 0); return (oclo_check(desc, "created", fd, errno)); } +#endif static bool oclo_accept(const char *desc, int flags) @@ -169,6 +176,7 @@ main(void) ret = EXIT_FAILURE; } +#if 0 /* These tests are known to fail on FreeBSD */ if (!oclo_socket("socket(): INT32_MAX", INT32_MAX)) { ret = EXIT_FAILURE; } @@ -176,6 +184,7 @@ main(void) if (!oclo_socket("socket(): 3 << 25", 3 << 25)) { ret = EXIT_FAILURE; } +#endif if (!oclo_accept("accept4(): INT32_MAX", INT32_MAX)) { ret = EXIT_FAILURE; diff --git a/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/ocloexec_verify.c b/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/ocloexec_verify.c index ea8ad0e058b1..e33c61f03d54 100644 --- a/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/ocloexec_verify.c +++ b/cddl/contrib/opensolaris/tests/os-tests/tests/oclo/ocloexec_verify.c @@ -23,20 +23,36 @@ * properly cleared. */ +#include +#include #include -#include -#include +#include #include +#include #include -#include +#include +#include #include +#include + +#define strerrorname_np(e) (sys_errlist[e]) static int -verify_fdwalk_cb(void *arg, int fd) +getmaxfd(void) { - int *max = arg; - *max = fd; - return (0); + struct kinfo_file *files; + int i, cnt, max; + + if ((files = kinfo_getfile(getpid(), &cnt)) == NULL) + err(1, "kinfo_getfile"); + + max = -1; + for (i = 0; i < cnt; i++) + if (files[i].kf_fd > max) + max = files[i].kf_fd; + + free(files); + return (max); } /* @@ -103,7 +119,7 @@ verify_flags(int fd, int exp_flags) int main(int argc, char *argv[]) { - int maxfd = STDIN_FILENO; + int maxfd; int ret = EXIT_SUCCESS; /* @@ -112,24 +128,25 @@ main(int argc, char *argv[]) * program name, which we want to skip. Note, the last fd may not exist * because it was marked for close, hence the use of '>' below. */ - (void) fdwalk(verify_fdwalk_cb, &maxfd); + maxfd = getmaxfd(); if (maxfd - 3 > argc - 1) { errx(EXIT_FAILURE, "TEST FAILED: found more fds %d than " "arguments %d", maxfd - 3, argc - 1); } for (int i = 1; i < argc; i++) { - const char *errstr; + char *endptr; int targ_fd = i + STDERR_FILENO; - long long targ_flags = strtonumx(argv[i], 0, - FD_CLOEXEC | FD_CLOFORK, &errstr, 0); + errno = 0; + long long val = strtoll(argv[i], &endptr, 0); - if (errstr != NULL) { + if (errno != 0 || *endptr != '\0' || + (val < 0 || val > (FD_CLOEXEC | FD_CLOFORK))) { errx(EXIT_FAILURE, "TEST FAILED: failed to parse " - "argument %d: %s is %s", i, argv[i], errstr); + "argument %d: %s", i, argv[i]); } - if (!verify_flags(targ_fd, (int)targ_flags)) + if (!verify_flags(targ_fd, (int)val)) ret = EXIT_FAILURE; } diff --git a/tests/Makefile b/tests/Makefile index e8dd7793f169..451d55498a26 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,3 +1,5 @@ +.include + PACKAGE= tests TESTSDIR= ${TESTSBASE} @@ -11,6 +13,9 @@ SUBDIR+= examples SUBDIR+= include SUBDIR+= sys SUBDIR+= atf_python +.if ${MK_CDDL} != "no" +SUBDIR+= oclo +.endif SUBDIR_PARALLEL= diff --git a/tests/oclo/Makefile b/tests/oclo/Makefile new file mode 100644 index 000000000000..350c9f857c85 --- /dev/null +++ b/tests/oclo/Makefile @@ -0,0 +1,11 @@ +.PATH: ${SRCTOP}/cddl/contrib/opensolaris/tests/os-tests/tests/oclo + +TESTSDIR= ${TESTSBASE}/cddl/oclo + +PLAIN_TESTS_C= oclo oclo_errors ocloexec_verify + +SRCS.oclo= oclo.c +LIBADD.oclo+= openbsd +LIBADD.ocloexec_verify+= util + +.include From nobody Sun Jul 6 23:23:47 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bb3N36LVZz60bhs; Sun, 06 Jul 2025 23:23:47 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bb3N35WgVz3yfQ; Sun, 06 Jul 2025 23:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751844227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YphLE/fbU39Y/6fDiIRX99dqlwhtpd9Y0iXkOiPBorg=; b=ehU6XForoaAS2vGMHOgnnykmAfH3IhfRWV2JV8hO3CIa6GJ3/S9kKdMKCUffjaG0tydu+p 1EbZsx/8iuxOhjosjuyx/DT7HZfmpD/CCJVN6FGlwMRPNNXbkYA+6wBuLSPZmf6YxB3CYl RlQ6OH1GUXY49VQccahIKRxhrYFZbbC2rirkkmCAaRgvKoUN1bUj0Ev8GZKpPMPQGFbfvz /zm7sB/XubuoS0nV82hB6ch7qdjjycUcHwh+u0FsIsd7kb4E9kEuzrNyAHgnzi8riPpiGF 2qa5Uw1Mrq6YoDfsRxPs2iLEft23PlRv5dFdlx872m50BaBxe8pTWwXrK2JN3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751844227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YphLE/fbU39Y/6fDiIRX99dqlwhtpd9Y0iXkOiPBorg=; b=EFt432PfDuXg3SA+mXNRW3XeTKGMPckMATKXt/AWXbdHGWrWPABI3ytKRNGEe9GsvQnFN0 OoSfOJi+0hlzPY6ZBf2pYd3i09W6HgXuPhZSVTxALd1Nk9+VuYIDUdL715FTMPU220PP/g qp+ZXzDayWRWhmSc/chFrdl8a2+eo6Z+FEEBJdrqQsd1sG9TzBH0DFqq359tbfn8j4Juem 2qVqxyNmdyBHLrm+aBFUb6eWXSj368zgkje5zKQIVwNKoFjqy5ll+T+lqaCa7QOs0vxZgA 5OEAuAXO7LL8bcJR+CK3nzyGEwJOVvwJlDKmEw4L1cwtCrRptgyXrP30Bq2O9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751844227; a=rsa-sha256; cv=none; b=Pb5TjEw2ifghS5hnMBW5SQk7830Le3DMenpSp51WazoXqdjx2eWwl6sTysM6Eh/KSdQN1I s/BPV5QGwncwFMbMj69+cfhV59OrOp2aV1m532bPT/8G9RfjET2B6yqGZhJ7yj4AnJGO9c e1loDX2YY4C3bYPrINbM/e2bJtzgySMOxgdvGu41w0VF7oGBOYzGuIIFXQdaLDRz514g/4 7nvOAiZ0z9Izgue4bwHjEH3dTBRRqrJWDcpCLyLoF7MtZnt6PSmj8/Elvx4Fy1neIAZrWo yAZTTTH7YBIDCOAo58hwPMmX3wfoL4vDuP4F3bKfag4Vojz8nmyyqnYpUl1Yjg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bb3N35520z9mQ; Sun, 06 Jul 2025 23:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 566NNlAp048382; Sun, 6 Jul 2025 23:23:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 566NNlrs048379; Sun, 6 Jul 2025 23:23:47 GMT (envelope-from git) Date: Sun, 6 Jul 2025 23:23:47 GMT Message-Id: <202507062323.566NNlrs048379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 4b7cdb5a420f - main - deprecate RIP List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4b7cdb5a420f518fbe1968a6916b6d017f54025d Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=4b7cdb5a420f518fbe1968a6916b6d017f54025d commit 4b7cdb5a420f518fbe1968a6916b6d017f54025d Author: Lexi Winter AuthorDate: 2025-07-06 23:22:42 +0000 Commit: Lexi Winter CommitDate: 2025-07-06 23:23:41 +0000 deprecate RIP Per https://wiki.freebsd.org/DeprecationPlan, deprecate RIP in 15.0R, with the intention of removing it in 16.0R. Add a note to the manpages of routed(8), rdisc(8), rtquery(8), route6d(8) and rip6query(8) noting that they will be removed in a future release. RIP has been obsolete for over 20 years and no one is running it on modern networks. If someone really needs RIP, there are alternatives such as 'bird' or 'quagga' available from ports; there is no need to ship it in base. Relnotes: yes Reviewed by: des Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D50292 --- sbin/routed/routed.8 | 9 ++++++++- sbin/routed/rtquery/rtquery.8 | 7 ++++++- usr.sbin/rip6query/rip6query.8 | 8 +++++++- usr.sbin/route6d/route6d.8 | 7 ++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/sbin/routed/routed.8 b/sbin/routed/routed.8 index 8cf12d7b60e1..334c828b943e 100644 --- a/sbin/routed/routed.8 +++ b/sbin/routed/routed.8 @@ -27,13 +27,20 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 27, 2022 +.Dd May 20, 2025 .Dt ROUTED 8 .Os .Sh NAME .Nm routed , .Nm rdisc .Nd network RIP and router discovery routing daemon +.Sh DEPRECATION NOTICE +The +.Nm routed +and +.Nm rdisc +utilities are deprecated and will be removed in +.Fx 16.0 . .Sh SYNOPSIS .Nm .Op Fl isqdghmpAtv diff --git a/sbin/routed/rtquery/rtquery.8 b/sbin/routed/rtquery/rtquery.8 index de5e1fc7cf96..ff46a3414dcf 100644 --- a/sbin/routed/rtquery/rtquery.8 +++ b/sbin/routed/rtquery/rtquery.8 @@ -1,11 +1,16 @@ .\" $Revision: 2.27 $ .\" -.Dd June 1, 1996 +.Dd May 20, 2025 .Dt RTQUERY 8 .Os .Sh NAME .Nm rtquery .Nd query routing daemons for their routing tables +.Sh DEPRECATION NOTICE +The +.Nm +utility is deprecated and will be removed in +.Fx 16.0 . .Sh SYNOPSIS .Nm .Op Fl np1 diff --git a/usr.sbin/rip6query/rip6query.8 b/usr.sbin/rip6query/rip6query.8 index 856a59138bc1..92e49f5ade58 100644 --- a/usr.sbin/rip6query/rip6query.8 +++ b/usr.sbin/rip6query/rip6query.8 @@ -29,13 +29,19 @@ .\" .\" $Id: rip6query.8,v 1.2 2000/01/19 06:24:55 itojun Exp $ .\" -.Dd October 7, 1999 +.Dd May 20, 2025 .Dt RIP6QUERY 8 .Os .Sh NAME .Nm rip6query .Nd RIPng debugging tool .\" +.Sh DEPRECATION NOTICE +The +.Nm +utility is deprecated and will be removed in +.Fx 16.0 . +.\" .Sh SYNOPSIS .Nm .Op Fl I Ar interface diff --git a/usr.sbin/route6d/route6d.8 b/usr.sbin/route6d/route6d.8 index 3a7bc8721923..e9ad3266ba26 100644 --- a/usr.sbin/route6d/route6d.8 +++ b/usr.sbin/route6d/route6d.8 @@ -14,12 +14,17 @@ .\" LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR .\" A PARTICULAR PURPOSE. .\" -.Dd November 18, 2012 +.Dd May 20, 2025 .Dt ROUTE6D 8 .Os .Sh NAME .Nm route6d .Nd RIP6 Routing Daemon +.Sh DEPRECATION NOTICE +The +.Nm +utility is deprecated and will be removed in +.Fx 16.0 . .Sh SYNOPSIS .Nm .Op Fl adDhlnqsS