From nobody Mon Aug 11 04:52:02 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c0j0g1L8nz648c6; Mon, 11 Aug 2025 04:52: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 4c0j0g0jPcz3D0b; Mon, 11 Aug 2025 04:52:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754887923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a/suUrzl1bZTCT0ws9uJfMtRMpFG+rB1JlfeGUPtctM=; b=Hi73v0LJiGNXjM6uDNEQGzz2aBcfbqVZqwQkRPUPVq6TopexNZsgCDd2ZpLMzIdUH2LKoA d5omfX7OoHaOrMsD08WbvXH+381+GUNdp7wMF6B66qLNiLlgWUeEI75+aPchRj7fwoWqTL reY+6g5l+fwqRRWVFXtPY57pz/zt8N9r/mawUgR5mgontfukvteWlJGEbwtWlWtZuaDFOn +sz/PBnoZbeww9jvZAmEb2jezLlTys66QGkxTpQ2GLzbgMrFhGUTOcloTltXkAI3M6z8c+ 53NKrWnd90OJXmr4OaW1EOUE31aZoGB0oXLUHZ+Qn+CFAbckl8qZ90tAA8V+5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754887923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a/suUrzl1bZTCT0ws9uJfMtRMpFG+rB1JlfeGUPtctM=; b=gOG13h238oMCAM+hPjOXk3GW0OALH6EELJClOtRm9iuD6gRRsdukYaMJLBpTAJSeCMuoB7 nYiToZxs+UI+tw6rn6CnxyOYcAX2+zREC4cemIrjWWHtovWz/j90MaTwlgDCFolKge98oj 3aFYuC2XQfS2meHnCxQAvDgyk89In8l2/JBiYj7AIniPleR6rjT1KXMn8r4E1zX6vwm0Bs 4H4oSklXGe2Oj8aGR+7cxVx3Eds1w45572JmGYGi4fEfnZMw9PbbEbmbb29chVrfXafhJw RtBfbKLYYR183YHmtFK0A3ms5I/CF5vpONKraeWIjlL+UEuPfbHp6zR1higK7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754887923; a=rsa-sha256; cv=none; b=Qo7uNqbu3SaeDGTmbOBfxIS1oP/xO1Sxzk5MTYvQ5TiegOoOFrVZDYszpbiGg3+aODSNw8 OxQhGq9R/iBiHcin1zaN4Y10xVAjthE/N1Ng2y5bHAEqbqD3cJCxXrd7zgIMoGHMMk7q4h qeaLFfBJwxxgAIVShnKEorOUq+Zf0NhRr8SfQiTlV0NOpGylgaJoa1WS05RmhviyJw51/V XoOZBc3N6QTuAkn8U6ySRyBI8GU4cJBaoO+CBGeWXiB2oH2bgb4KCIhEdNyxg4OAVzhePg YNr0OTepqSC2iirZ97wkRYavWdUTbGTdoCen0G4YbehRqRzOf+e96fCoLcc68Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c0j0g02Y9zf9M; Mon, 11 Aug 2025 04:52: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 57B4q2gG071512; Mon, 11 Aug 2025 04:52:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57B4q2uq071509; Mon, 11 Aug 2025 04:52:02 GMT (envelope-from git) Date: Mon, 11 Aug 2025 04:52:02 GMT Message-Id: <202508110452.57B4q2uq071509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Romain =?utf-8?Q?Tarti=C3=A8re?= Subject: git: aa326b970e36 - stable/14 - vm_page: Fix handling of empty bad memory addresses file List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: romain X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: aa326b970e36d063abc653071ca5fccdf83e5554 Auto-Submitted: auto-generated The branch stable/14 has been updated by romain: URL: https://cgit.FreeBSD.org/src/commit/?id=aa326b970e36d063abc653071ca5fccdf83e5554 commit aa326b970e36d063abc653071ca5fccdf83e5554 Author: Romain Tartière AuthorDate: 2025-08-03 05:42:23 +0000 Commit: Romain Tartière CommitDate: 2025-08-11 04:50:54 +0000 vm_page: Fix handling of empty bad memory addresses file If a file with bad memory addresses is configured but that file is empty (0 lines, 0 bytes), when loading it we end up returning an end pointer that is just _before_ the start of the (empty) file content. Adjust the code to make it clear what pre-condition are required to set the *list / *end pointers correctly, and explicitly set them to NULL when they are not matched. Reported by: marklmi@yahoo.com Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51717 (cherry picked from commit f90940ce6eb71df40538c35a65d77ad3093c679a) --- sys/vm/vm_page.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index f013cbc84c25..1da7ddce86a6 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -391,11 +391,15 @@ vm_page_blacklist_load(char **list, char **end) ptr = preload_fetch_addr(mod); len = preload_fetch_size(mod); } - *list = ptr; - if (ptr != NULL) + + if (ptr != NULL && len > 0) { + *list = ptr; *end = ptr + len - 1; - else + } else { + *list = NULL; *end = NULL; + } + return; } From nobody Mon Aug 11 04:52:19 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c0j1058N9z648j3; Mon, 11 Aug 2025 04:52: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 4c0j0z6zkDz3DHY; Mon, 11 Aug 2025 04:52:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754887940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OfWSDLZrv9Hfq78t6rPNdhOZgrWkiZh3sOq7koTLffM=; b=e+xKUe7hIQnNDch2V/It+Fpz0C2nKfC5nXQET3V+3779WivAEa3LofaMcIdLSRBa+MVnMV ZWQA4GYY5YMQL0yAJVIxraTL44/+4fZRrQQkV9WbC17h5d2EvwMU15ZBs7xlVxtgTAB43l YnKfnB53+lPE8uaRNlV5p7DQiH6V2EDEhTI6cWwsFaf0GEub/7IW4nLcL/lxHHsxYRt3bq MtwO0ucs3CFfBTIhxZWP8DLdT+WYfIt1/PdPTglkNj5XX4iUqXz/idt2OSwW7pu2lBihji r2vA0eEPy5j+tVAHyauNHBjB7OM+fBGWRdTds64nx0I0LPzmvAy+7qsAwnEHWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754887940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OfWSDLZrv9Hfq78t6rPNdhOZgrWkiZh3sOq7koTLffM=; b=FjTE357AWBjtn+OdAFdIrB9T+obgzJHrpafWMEziAz5Mz0/7HXAO8MTTjwtFCcTF9YHSGc 0gQA4eO6zaarTjOv7tJohEFpZdngzq7asHmX4XB+cPCnVzwAbicoIN/rFttTRJcteoZdUD QtI5l2Qp0iNQWoDyJ5gY/zx8ypZ69S6WZLtx1Cd115eOlTh/eAcPgqV8TyTIVlhkqGr/2E l5sWNHMU7skS4XSPLuNI2z9fV+/DQZfN8u4OkBA8I95qIaRai0D+t+Z0y7MVmcqXHFmiYB tIdHxp8ie5xOwNRgSbtPnynZr0J+bFVgFVBwxB1HN8hdsjjgsf76ASP5q2uIyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754887940; a=rsa-sha256; cv=none; b=CMy3aOGZi1/Fo5fL7xwDa7IpOSoEJeq27uTcMNAuQV723TFXc0zpPTrcUtWi5taxURHKIe MDvOJscWtOyix5J06aZSbSOsygAInG9xkZRsUfsAMnL/1JErEgmU/ak8CTHjyMm12wa/Sv hveuxdIJIM/AKGAQ7bikeXOXXkEr8cqLY5cE4LhjbqLKSJRAvgMYicQw9i/DNtr8kps03u 5N3nep4OU925HVLL4Bmsp1s7SxNh+WLSpnVaHyJO8+1E2qqT1s632RO/Xf6UNuRMmJPdI1 lz3Kw3IG0XEBpsDNVQ+9jrPvPhTL5huvTzHTT9eKkRf81iPb/ymxWkxo5HBKjw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c0j0z6Prszdvr; Mon, 11 Aug 2025 04:52: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 57B4qJwB071697; Mon, 11 Aug 2025 04:52:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57B4qJa5071694; Mon, 11 Aug 2025 04:52:19 GMT (envelope-from git) Date: Mon, 11 Aug 2025 04:52:19 GMT Message-Id: <202508110452.57B4qJa5071694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Romain =?utf-8?Q?Tarti=C3=A8re?= Subject: git: 77a0173ca956 - stable/13 - vm_page: Fix handling of empty bad memory addresses file List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: romain X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 77a0173ca956f9f765920fe8195b951c525671c4 Auto-Submitted: auto-generated The branch stable/13 has been updated by romain: URL: https://cgit.FreeBSD.org/src/commit/?id=77a0173ca956f9f765920fe8195b951c525671c4 commit 77a0173ca956f9f765920fe8195b951c525671c4 Author: Romain Tartière AuthorDate: 2025-08-03 05:42:23 +0000 Commit: Romain Tartière CommitDate: 2025-08-11 04:51:35 +0000 vm_page: Fix handling of empty bad memory addresses file If a file with bad memory addresses is configured but that file is empty (0 lines, 0 bytes), when loading it we end up returning an end pointer that is just _before_ the start of the (empty) file content. Adjust the code to make it clear what pre-condition are required to set the *list / *end pointers correctly, and explicitly set them to NULL when they are not matched. Reported by: marklmi@yahoo.com Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51717 (cherry picked from commit f90940ce6eb71df40538c35a65d77ad3093c679a) --- sys/vm/vm_page.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index ed43a05f0e64..60295afe71cc 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -391,11 +391,15 @@ vm_page_blacklist_load(char **list, char **end) ptr = preload_fetch_addr(mod); len = preload_fetch_size(mod); } - *list = ptr; - if (ptr != NULL) + + if (ptr != NULL && len > 0) { + *list = ptr; *end = ptr + len - 1; - else + } else { + *list = NULL; *end = NULL; + } + return; } From nobody Mon Aug 11 19:22:28 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c14K059NFz64nQY; Mon, 11 Aug 2025 19:22: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 4c14K0224gz3YdC; Mon, 11 Aug 2025 19:22:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754940148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/5kmk/3XH2n34wdiR7SfIQDcpKykzEXJfqmZrKKM8eA=; b=e2JSFhyBKbMLVGo8FTBWRzd5J4mga4rNnHBGoSbCb/626xDLKX/My5Zpmyj4Twlju/FhOE Ow7XyETlDHlf5JuR5uYAtqRwlHe4X/JwXOCzYgOodqF+vgpwjnigbIzGaHa8jzwx6utbF9 3Y/IpqNsrVoSHuPSW/b73kMKTq8ws1VP/S3yOMnURO6xMV6nv5wWIlER5oS7NedoC1uEXU PvUY7VOl0UR7oBstcIsSlSKXlXjhXIGGE8dnTEMkLxTxXZyP01x1ag2RRW4Vwf2+LpDsbz g16dfgqEgl1Vlyv1dNvt0CIy1Q7vzwV1zZgftsWL6ECsuakmuIvaFo1vBfOTmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754940148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/5kmk/3XH2n34wdiR7SfIQDcpKykzEXJfqmZrKKM8eA=; b=ml5FbabJyvI4640iWShinIkTWSlXINkElsVSFl6C+3k81Tb4cqaRHnSPrUJPg8iPwAe1aK 9S//tLC2sUoJRWpjKkrFwjB1ALAp5IWe/guw0W24hq44a06UpHWSO7tOcvSM2bWPi7wg99 MI4Sv/zZ4h/G3nMzhnd+Ct8Okfpac5MESyv7WTiiyoNuEh2yHRKI9YFOUpNcXxf4Vrk5gF 9iXN6V4hkbz2B9NnH+Ux3MV+M349u1Xm2Y+KfCO53Ad1w5+AHUENPlD16ywvMO8yat2+8K 13pyqwp4taFo1FjWr+ytVejnFsSyau4QrngUADVzVrwF2HEsn8+Uxd6Cws0ltw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754940148; a=rsa-sha256; cv=none; b=xyLKuh8HzNF2Wsuten3U5NlL0cTVrVO7wAnx8+5pJHZqPkQsqWOX9yh8ivlR+S8208GgRI zvvS6ZqSROqBJf/Tdb5ScZdvNIXLSn6dn4sTiYdUxo6BeD+w3kucDe58sRJ5TNlUTu7BAR BsLxLebU6mYTDzi6SxwikrEjhcUalR1w4dOuSfZ7EnTrdulTXbW6pZ84icZ5/kJeqBZu3y ida3XXClj3SRTlBROvlfPX0b3JG4aziJ6O4pQelJjEKSkxUcuDxUPOP58LSIdlcGU8Pw0C mlgQ8fY23behrNo6uAiVD3XtO0YV+fHGUpRRzHwf6GuHKKsNvOpBnV19nauVFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c14K01ZfKz151n; Mon, 11 Aug 2025 19:22: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 57BJMS3S012229; Mon, 11 Aug 2025 19:22:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57BJMS7c012226; Mon, 11 Aug 2025 19:22:28 GMT (envelope-from git) Date: Mon, 11 Aug 2025 19:22:28 GMT Message-Id: <202508111922.57BJMS7c012226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 68669e92f5d2 - stable/14 - Add quiet/-q option to /usr/sbin/service List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 68669e92f5d2b883c0e2efaceaa1acc74424cd7b Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=68669e92f5d2b883c0e2efaceaa1acc74424cd7b commit 68669e92f5d2b883c0e2efaceaa1acc74424cd7b Author: Dan Mahoney AuthorDate: 2025-05-25 08:54:33 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-11 14:31:25 +0000 Add quiet/-q option to /usr/sbin/service Signed-off-by: Dan Mahoney Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1709 Closes: https://github.com/freebsd/freebsd-src/pull/1709 (cherry picked from commit 37983aef7c70b738cf63923bcfd2c4ae03ac5779) service: Fix repeated -v in man page Fix accidental repeated -v for -q. Fixes: 37983aef7c70 Noticed by: Gary Jennejohn (cherry picked from commit 8fa4a4eb705ccaece5aac4ae1201034001f21313) --- usr.sbin/service/service.8 | 3 +++ usr.sbin/service/service.sh | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/usr.sbin/service/service.8 b/usr.sbin/service/service.8 index 7528fa04b0f1..67597bf9258e 100644 --- a/usr.sbin/service/service.8 +++ b/usr.sbin/service/service.8 @@ -45,6 +45,7 @@ .Fl r .Nm .Op Fl j Ar jail +.Op Fl q .Op Fl v .Op Fl E Ar var=value .Ar script @@ -115,6 +116,8 @@ as in above, but list all of the files, not just what is enabled. .It Fl v Be slightly more verbose. +.It Fl q +Be quiet, redirecting output to /dev/null. .El .Sh ENVIRONMENT When used to run rc.d scripts the diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh index 8b7aa937967b..5f456418da49 100755 --- a/usr.sbin/service/service.sh +++ b/usr.sbin/service/service.sh @@ -44,17 +44,19 @@ usage () { echo "-R Stop and start enabled $local_startup services" echo "-l List all scripts in /etc/rc.d and $local_startup" echo '-r Show the results of boot time rcorder' + echo '-q quiet' echo '-v Verbose' echo '' } -while getopts 'j:E:ehlrRv' COMMAND_LINE_ARGUMENT ; do +while getopts 'j:E:ehlqrRv' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in j) JAIL="${OPTARG}" ;; E) VARS="${VARS} ${OPTARG}" ;; e) ENABLED=eopt ;; h) usage ; exit 0 ;; l) LIST=lopt ;; + q) QUIET=qopt ;; r) RCORDER=ropt ;; R) RESTART=Ropt ;; v) VERBOSE=vopt ;; @@ -69,6 +71,7 @@ if [ -n "${JAIL}" ]; then args="" [ -n "${ENABLED}" ] && args="${args} -e" [ -n "${LIST}" ] && args="${args} -l" + [ -n "${QUIET}" ] && args="${args} -q" [ -n "${RCORDER}" ] && args="${args} -r" [ -n "${RESTART}" ] && args="${args} -R" [ -n "${VERBOSE}" ] && args="${args} -v" @@ -100,14 +103,22 @@ if [ -n "$RESTART" ]; then if [ -n "$rcvar" ]; then load_rc_config_var ${name} ${rcvar} fi - checkyesno $rcvar 2>/dev/null && run_rc_script ${file} stop + if [ -n "$QUIET" ]; then + checkyesno $rcvar 2>/dev/null && run_rc_script ${file} stop >/dev/null 2>&1 + else + checkyesno $rcvar 2>/dev/null && run_rc_script ${file} stop + fi fi done for file in $files; do if grep -q ^rcvar $file; then eval `grep ^name= $file` eval `grep ^rcvar $file` - checkyesno $rcvar 2>/dev/null && run_rc_script ${file} start + if [ -n "$QUIET" ]; then + checkyesno $rcvar 2>/dev/null && run_rc_script ${file} start >/dev/null 2>&1 + else + checkyesno $rcvar 2>/dev/null && run_rc_script ${file} start + fi fi done @@ -174,7 +185,11 @@ cd / for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - exec /usr/bin/env -i -L -/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin ${VARS} "$dir/$script" "$@" + if [ -n "$QUIET" ]; then + exec /usr/bin/env -i -L -/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin ${VARS} "$dir/$script" "$@" > /dev/null 2>&1 + else + exec /usr/bin/env -i -L -/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin ${VARS} "$dir/$script" "$@" + fi fi done From nobody Mon Aug 11 19:22:29 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c14K20K5qz64nNx; Mon, 11 Aug 2025 19:22: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 4c14K12wgTz3YZv; Mon, 11 Aug 2025 19:22:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754940149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AWHLbaFsPmmRsafcH77bk1BoPO7O7GroAlh18oPReWY=; b=FPdQqJPoJ4+FRdgn2uFNCM0eC6hk1J5Xw7BNzJzXVpak8Qf6WRKCDP+JyzaFiJhXQOe9eK PiCDV3d0hWiS8j3gCzyChpQihy+BE+lhqvgD3b87NTtkjOlyOgEhWyszG5C2fZGO/TESrc YTCbRHpa+mZTsBzOmUHuOG5tz48ev22KITcjnRK8W0SVglEbKI0gKnDXMHszphGzVAt9eU OMHWl0C7hASDjc7CvePqrxMTnGm3SaiQ/2dXsTrM0uVy0Z2/F7QQ4nlyVGgA+pM8Ob8l2N mFJ9hxezUT7oatgEHfdaT41sN/jZL/p/mruX9JxBbbxGOb5hHXaoRYS0Ri71NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754940149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AWHLbaFsPmmRsafcH77bk1BoPO7O7GroAlh18oPReWY=; b=UXjxOAECyBUYHVWYRES3Do8/sluK2IfAjw35f6QCQpTgqB2gyxCtk459A5iiYUbtfp/LeL z6B5REa+frnsnv75z0+G2Ts4U5fKfK+Vca/LTFix8uxhGDhjiggpUKkewoOvjvWtm3pbM+ flkM7gMXSDKFHzRi/Qua2rlLCfPwjT4p2r7QdcmWKnFtmIPfhKBp4yPGnzUEBMiQlAzCUK PD9lHVAyiCoVU1Vxs/PH+O75WrF1OI39I9+DbeAaLf/6UhQcOAS95+q/PMlaYGJp3SmueC 5Ws9O1G3B81fqHSNQJb7PYsBdbeG2nktItMZdqwPd4pb+0TvzknSduF8tf0JJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754940149; a=rsa-sha256; cv=none; b=GPihmn9FIxfj2LzqbnpoYirL/RPRVxzsigjMRl6TcaANjzRyebrrff2JGo2K7R3SM4qmev SbvFjOLIVytcURtqT/VDEKn12ARfIbHBQU/+P/dBiuwALg7Ni/j5IhijNDXFOY6rKs0sUM BAGgW1TkL0guMxgQPnZSUoMk0fX8eSBEzICXQa+wHihLaoT22lXFukZf/AoVHNpEZzFIDS hYkdNwLNfRPKfAV4hxtqMyHwhbCPWoYwWPorTrbDnc4/kB42ucQe3tsvWKib1Gqtlej0xt 8CjOktJdMS+QjVc8e/lxx5j/kartL+jYVEsYC0q6178qWfOjlmmBBP+k9mKElw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c14K12Kjqz15FB; Mon, 11 Aug 2025 19:22: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 57BJMTYk012267; Mon, 11 Aug 2025 19:22:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57BJMT0m012264; Mon, 11 Aug 2025 19:22:29 GMT (envelope-from git) Date: Mon, 11 Aug 2025 19:22:29 GMT Message-Id: <202508111922.57BJMT0m012264@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: bb3fd5897add - stable/14 - service: Add an option to enable debugging List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: bb3fd5897add9f407f30e288d5d52082953aa1e9 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=bb3fd5897add9f407f30e288d5d52082953aa1e9 commit bb3fd5897add9f407f30e288d5d52082953aa1e9 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-02 23:59:26 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-11 14:31:26 +0000 service: Add an option to enable debugging * Add and document a -d option which enables rc script debugging. * Sort and document existing options correctly. MFC after: 1 week Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D51700 (cherry picked from commit 25fca243f2b7ca0c523aa1cf26aaea25035e68d2) --- usr.sbin/service/service.8 | 13 ++++++++----- usr.sbin/service/service.sh | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/usr.sbin/service/service.8 b/usr.sbin/service/service.8 index 67597bf9258e..be68694b1be0 100644 --- a/usr.sbin/service/service.8 +++ b/usr.sbin/service/service.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 9, 2025 +.Dd August 2, 2025 .Dt SERVICE 8 .Os .Sh NAME @@ -34,6 +34,7 @@ .Fl e .Nm .Op Fl j Ar jail +.Op Fl q .Fl R .Nm .Op Fl j Ar jail @@ -45,8 +46,7 @@ .Fl r .Nm .Op Fl j Ar jail -.Op Fl q -.Op Fl v +.Op Fl dqv .Op Fl E Ar var=value .Ar script .Op Ar command @@ -74,6 +74,8 @@ scripts, see .Pp The options are as follows: .Bl -tag -width F1 +.It Fl d +Enable debugging. .It Fl E Ar var=value Set the environment variable .Ar var @@ -106,6 +108,9 @@ this is usually .Pa /usr/local/etc/rc.d . All files will be listed whether they are an actual rc.d script or not. +.It Fl q +Be quiet, redirecting output to +.Pa /dev/null . .It Fl R Restart all enabled local services. .It Fl r @@ -116,8 +121,6 @@ as in above, but list all of the files, not just what is enabled. .It Fl v Be slightly more verbose. -.It Fl q -Be quiet, redirecting output to /dev/null. .El .Sh ENVIRONMENT When used to run rc.d scripts the diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh index 5f456418da49..9387a49051d6 100755 --- a/usr.sbin/service/service.sh +++ b/usr.sbin/service/service.sh @@ -27,17 +27,19 @@ # SUCH DAMAGE. . /etc/rc.subr -load_rc_config 'XXX' +load_rc_config usage () { echo '' echo 'Usage:' echo "${0##*/} [-j ] -e" - echo "${0##*/} [-j ] -R" - echo "${0##*/} [-j ] [-v] -l | -r" - echo "${0##*/} [-j ] [-v] [-E var=value] start|stop|etc." + echo "${0##*/} [-j ] [-q] -R" + echo "${0##*/} [-j ] [-v] -l" + echo "${0##*/} [-j ] [-v] -r" + echo "${0##*/} [-j ] [-dqv] [-E var=value] start|stop|etc." echo "${0##*/} -h" echo '' + echo "-d Enable debugging of rc.d scripts" echo "-j Perform actions within the named jail" echo "-E n=val Set variable n to val before executing the rc.d script" echo '-e Show services that are enabled' @@ -49,12 +51,13 @@ usage () { echo '' } -while getopts 'j:E:ehlqrRv' COMMAND_LINE_ARGUMENT ; do +while getopts 'dE:ehj:lqrRv' COMMAND_LINE_ARGUMENT ; do case "${COMMAND_LINE_ARGUMENT}" in - j) JAIL="${OPTARG}" ;; + d) DEBUG=dopt ;; E) VARS="${VARS} ${OPTARG}" ;; e) ENABLED=eopt ;; h) usage ; exit 0 ;; + j) JAIL="${OPTARG}" ;; l) LIST=lopt ;; q) QUIET=qopt ;; r) RCORDER=ropt ;; @@ -85,6 +88,10 @@ if [ -n "${JAIL}" ]; then exit $? fi +if [ -n "$DEBUG" ]; then + VARS="${VARS} rc_debug=yes" +fi + if [ -n "$RESTART" ]; then skip="-s nostart" if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then From nobody Tue Aug 12 12:56:11 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1Whq6Dzlz64jRy; Tue, 12 Aug 2025 12:56: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 4c1Whq5Vdjz3KNc; Tue, 12 Aug 2025 12:56:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cZx9IL+RxsIWVqaliBY22zNZaA50zYlCfgrEKJuNzxI=; b=jsZryPa8QqNo7orS1S3BWj0hK2GwtyA9WARLT+mE7KDSUBfRSIgF0V3tlXs2Mt0hwZjYFD GBXzviIQrqBmlRQoyNkuTHELSNQdvu2l1zr8XfQQxqm+I6e7faEurx1cwAdiCnHVoldHr8 gTGswep1sBj7s+gjkE9SeLkrjlGxYJdA2kPsbngu64wVXf8WnNA8/nVNkU7DdTR0EG7679 Iu+Cgor2GyV1l8Bs9oa07RsMxfnCXauuUcGywqqM/4BbRH6xZJEYjcwDZ5Z1AF7+QgG9Kt lQHydS/pf55RlL6DoDJb+MmTjGoD4JD1BzVDtT71BhTjif4RQsAzaa8BmJ5hMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cZx9IL+RxsIWVqaliBY22zNZaA50zYlCfgrEKJuNzxI=; b=ilkEEFNNmrUqC1eymqe9o1qU9uAB5f/mxqNL++DGmrziQxVCTUBFPZvAk2+Y9TIflK7FTE pFNqNkKaAXbHJHFjR1eO0YJE36/3J0WRGVC0x9ViXPYr4Wi5BVk57dt9Zi4/V7x0jWVVw0 C0GOEsIsuABYWbMbDdYsYeaky89a8lHy2QW4iJ1DWi6UiSmsKYwKbQHv5DMSFflQcKfJNm Wv+O7nT2uDkEekhtkY278H4Ax+/hYG5gdvywKT4QSPE1pRqQcvFQz5Pc0ZkfRWPcgmtVsh Yrs7dHXVKccPavwl5Xdge8eWRmz8foucMU/Y0ggyezHO7rx/Xh2ykCrfciOHJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755003371; a=rsa-sha256; cv=none; b=wvyn0WdABRJttrl4PXsrWAT/zDTAWNoV8qXCNiy0Zx4L23Lvzp7/b/i+2P9p3RsLWe3Gd+ ZL+210Ixi70UEDq+Ps84fy8oZArMTpsd1Braq+lve7oFZZXs11y2vwDfA3iUIr003PZBLe h9eILe9hjTw55rW1+4VefHC8KHqs1T3D0anYiXr+Qp29T7laEBMlQp2vkgrrIg04fBTQ0G tXGI+L4uQkvPcI1QW2vewOojaRp9yblZ6ovCfnQXAS/fh4D7391qM50Wr4TmLsGMvjwe5k 3yOqZGlcDSykY63Q201KTp/k4Jw/E5ZSQiRtGVdol26wQHEyWHnMPo8ACZSr1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1Whq4nWfzfn2; Tue, 12 Aug 2025 12:56: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 57CCuB6b088380; Tue, 12 Aug 2025 12:56:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CCuBKa088377; Tue, 12 Aug 2025 12:56:11 GMT (envelope-from git) Date: Tue, 12 Aug 2025 12:56:11 GMT Message-Id: <202508121256.57CCuBKa088377@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: f88108c7963c - stable/14 - pseudofs: Simplify pfs_readdir() and set eofflag List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: f88108c7963c1aa3c83a2c053f43dfcddb5cf4bc Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f88108c7963c1aa3c83a2c053f43dfcddb5cf4bc commit f88108c7963c1aa3c83a2c053f43dfcddb5cf4bc Author: Mark Johnston AuthorDate: 2025-07-23 01:52:38 +0000 Commit: Mark Johnston CommitDate: 2025-08-12 12:49:42 +0000 pseudofs: Simplify pfs_readdir() and set eofflag There were two loops, one to skip entries before the requested offset, and one to populate entries. Merge them and use the return value of pfs_iterate() to decide whether to set eofflag. As a side effect, this fixes a small bug: the first loop would decrement `offset` to zero, and the second loop would increment it again. However, `offset` was used to set `d_off`, and we should include the starting offset there. Add a comment explaining the use of the allproc lock. Reviewed by: des, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51462 (cherry picked from commit e9b713513a78ccb01dbfa1a3f087f94b33531787) --- sys/fs/pseudofs/pseudofs_vnops.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c index 0bdfedffafcb..8cd092118d0e 100644 --- a/sys/fs/pseudofs/pseudofs_vnops.c +++ b/sys/fs/pseudofs/pseudofs_vnops.c @@ -850,7 +850,7 @@ pfs_readdir(struct vop_readdir_args *va) struct uio *uio; struct pfsentry *pfsent, *pfsent2; struct pfsdirentlist lst; - off_t offset; + off_t coffset, offset; int error, i, resid; STAILQ_INIT(&lst); @@ -860,6 +860,9 @@ pfs_readdir(struct vop_readdir_args *va) PFS_TRACE(("%s pid %lu", pd->pn_name, (unsigned long)pid)); pfs_assert_not_owned(pd); + if (va->a_eofflag != NULL) + *va->a_eofflag = 0; + if (vn->v_type != VDIR) PFS_RETURN (ENOTDIR); KASSERT_PN_IS_DIR(pd); @@ -878,6 +881,10 @@ pfs_readdir(struct vop_readdir_args *va) if (pid != NO_PID && !pfs_lookup_proc(pid, &proc)) PFS_RETURN (ENOENT); + /* + * The allproc lock is required in pfs_iterate() for procdir + * directories. + */ sx_slock(&allproc_lock); pfs_lock(pd); @@ -897,23 +904,15 @@ pfs_readdir(struct vop_readdir_args *va) } } - /* skip unwanted entries */ - for (pn = NULL, p = NULL; offset > 0; offset -= PFS_DELEN) { + for (pn = NULL, p = NULL, coffset = 0; resid >= PFS_DELEN; + coffset += PFS_DELEN) { if (pfs_iterate(curthread, proc, pd, &pn, &p) == -1) { - /* nothing left... */ - if (proc != NULL) { - _PRELE(proc); - PROC_UNLOCK(proc); - } - pfs_unlock(pd); - sx_sunlock(&allproc_lock); - PFS_RETURN (0); + if (va->a_eofflag != NULL) + *va->a_eofflag = 1; + break; } - } - - /* fill in entries */ - while (pfs_iterate(curthread, proc, pd, &pn, &p) != -1 && - resid >= PFS_DELEN) { + if (coffset < offset) + continue; if ((pfsent = malloc(sizeof(struct pfsentry), M_IOV, M_NOWAIT | M_ZERO)) == NULL) { error = ENOMEM; From nobody Tue Aug 12 12:56:12 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1Whs1DMmz64jZW; Tue, 12 Aug 2025 12:56: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 4c1Whr6GJTz3KQ5; Tue, 12 Aug 2025 12:56:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gy9rR4XERgQyYYJsCweiNqSrfV8PSOqJD648mz8B7K0=; b=EL3uCj6r8mlmvT/2r8lgg8YG265r/GVzJSB2sZ0UwUryuZatKU56V/tX4GtE51aLeV4gZO wUOilRDBDbecQ9iB99gxLkeUdsG1i+SKRkTpuHsjal64l0znUHEMQXfGvbkf6N+X9XZyIA IWzKmPAcgbalVd4EB7yWwcLe4SciIoRSwKZeo/3GnD39EuPbTa8x2apgc12byJmlMsrIYg hLtvfUUT/q4AFTywe53RCWXfdgn63cDw4nGsrgizB+aEbX9Xl424zreG//OSjWi0ODhI0p obigVBD6LKd5C7qXmQpMOlVObsSlQ0QyNK4CS1fYqaQUQOjrWXrpn+IV+EW4uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gy9rR4XERgQyYYJsCweiNqSrfV8PSOqJD648mz8B7K0=; b=P1+t2AFdDBN1CY30q+AfyKd2iyexO0UXDTQ7qMJlRZAtzvmLgnYh0l59b2gNmys7zSef/c OOv/GGDQrIXwA7G7gj/bM1M8e12qIyjKa61xdLv2As6PWWqnRmh7xD9cXmzHtSslqIWKtq l5WI4dVTb+TSjjkePVARcO76LBhU1UNsYpRQQSAt5WrnmXc7TuXDBHMk69zbDFIDYOxpwG KVl972k5CUabcWv5PJ2Zbwz8yacjSlZqJ/OEE+xMOGHUssKWee4tnvWhLGXnKSMozRxs5g BFWCf0lVCpfrzJI4T6w9Q9KEwrv+nxmmsM/wvp8L0Cs5K+46p6vbRRf+xCaw6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755003372; a=rsa-sha256; cv=none; b=pAxBqETKeyM1AYnsfU7BLFPESkXXCUouyj6c/L3Zfi8c4w50VERYrKaAGwoO38H0DatWXX VAONFBNxOmY+AkTwfXGWWS7gcDJi0mdlvYaYFYjD6+P6sm+1RmYNrezMqQb/pzZfSalo7x gXSPUycxmuVp4j8OyEwJPxJXSdF1WyuoGI8STSV9UQDSGqkqYY2Nb6I/PbaeSIOseK6lsI y61615BGON9Zf80mXQIhCKBOsF7EPLIsVzrFlnI+NWaWwm9I42lcnxIxNRAs/XUc94JYJe IVVM2ze0Kyd1zQYLaS0Zq1yySUTZucj9iEEI7qroGmU2WzLnDVZVwAqLLlp9OQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1Whr5qbGzfn3; Tue, 12 Aug 2025 12:56: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 57CCuCiw088412; Tue, 12 Aug 2025 12:56:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CCuCcn088409; Tue, 12 Aug 2025 12:56:12 GMT (envelope-from git) Date: Tue, 12 Aug 2025 12:56:12 GMT Message-Id: <202508121256.57CCuCcn088409@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: 85f964f75eea - stable/14 - smbfs: Set eofflag in VOP_READDIR List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 85f964f75eea1f67fe2ae661014770c22adf41fd Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=85f964f75eea1f67fe2ae661014770c22adf41fd commit 85f964f75eea1f67fe2ae661014770c22adf41fd Author: Mark Johnston AuthorDate: 2025-07-23 16:19:44 +0000 Commit: Mark Johnston CommitDate: 2025-08-12 12:49:42 +0000 smbfs: Set eofflag in VOP_READDIR MFC after: 2 weeks (cherry picked from commit 619308b6fe26f56fc71c6255b13fcd9a6b8ae1f1) --- sys/fs/smbfs/smbfs_io.c | 20 +++++++++++++------- sys/fs/smbfs/smbfs_node.h | 2 +- sys/fs/smbfs/smbfs_vnops.c | 6 ++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index 35454998fc8e..8c484381ed59 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -71,7 +71,7 @@ SYSCTL_INT(_vfs_smbfs, OID_AUTO, fastlookup, CTLFLAG_RW, &smbfs_fastlookup, 0, " #define DE_SIZE (sizeof(struct dirent)) static int -smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) +smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred, int *eofp) { struct dirent de; struct componentname cn; @@ -86,6 +86,8 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) SMBVDEBUG("dirname='%s'\n", np->n_name); scred = smbfs_malloc_scred(); smb_makescred(scred, uio->uio_td, cred); + if (eofp != NULL) + *eofp = 0; offset = uio->uio_offset / DE_SIZE; /* offset in the directory */ limit = uio->uio_resid / DE_SIZE; if (uio->uio_resid < DE_SIZE || uio->uio_offset < 0) { @@ -138,8 +140,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) if (error) { smbfs_findclose(np->n_dirseq, scred); np->n_dirseq = NULL; - error = ENOENT ? 0 : error; - goto out; + goto out1; } } error = 0; @@ -170,16 +171,21 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) if (error) break; } - if (error == ENOENT) - error = 0; uio->uio_offset = offset * DE_SIZE; +out1: + if (error == ENOENT) { + if (eofp != NULL) + *eofp = 1; + error = 0; + } out: smbfs_free_scred(scred); return error; } int -smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred) +smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, + int *eofp) { struct smbmount *smp = VFSTOSMBFS(vp->v_mount); struct smbnode *np = VTOSMB(vp); @@ -209,7 +215,7 @@ smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred) lks = LK_EXCLUSIVE; /* lockstatus(vp->v_vnlock); */ if (lks == LK_SHARED) vn_lock(vp, LK_UPGRADE | LK_RETRY); - error = smbfs_readvdir(vp, uiop, cred); + error = smbfs_readvdir(vp, uiop, cred, eofp); if (lks == LK_SHARED) vn_lock(vp, LK_DOWNGRADE | LK_RETRY); return error; diff --git a/sys/fs/smbfs/smbfs_node.h b/sys/fs/smbfs/smbfs_node.h index f28f0007100a..8c8ce038b913 100644 --- a/sys/fs/smbfs/smbfs_node.h +++ b/sys/fs/smbfs/smbfs_node.h @@ -93,7 +93,7 @@ u_int32_t smbfs_hash(const u_char *name, int nmlen); int smbfs_getpages(struct vop_getpages_args *); int smbfs_putpages(struct vop_putpages_args *); -int smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred); +int smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int *eofp); int smbfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag); void smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap); int smbfs_attr_cachelookup(struct vnode *vp ,struct vattr *va); diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index c30995508c00..1fccee7983c6 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -466,7 +466,7 @@ smbfs_read(struct vop_read_args *ap) SMBVDEBUG("\n"); if (vp->v_type != VREG && vp->v_type != VDIR) return EPERM; - return smbfs_readvnode(vp, uio, ap->a_cred); + return smbfs_readvnode(vp, uio, ap->a_cred, NULL); } static int @@ -748,7 +748,6 @@ smbfs_readdir(struct vop_readdir_args *ap) { struct vnode *vp = ap->a_vp; struct uio *uio = ap->a_uio; - int error; if (vp->v_type != VDIR) return (EPERM); @@ -758,8 +757,7 @@ smbfs_readdir(struct vop_readdir_args *ap) return (EOPNOTSUPP); } #endif - error = smbfs_readvnode(vp, uio, ap->a_cred); - return error; + return (smbfs_readvnode(vp, uio, ap->a_cred, ap->a_eofflag)); } /* ARGSUSED */ From nobody Tue Aug 12 12:56:13 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1Wht3G6Bz64jVC; Tue, 12 Aug 2025 12:56: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 4c1Wht08MBz3KHb; Tue, 12 Aug 2025 12:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y/YK1xhhzgpIsYS4DZ9KxSPchxP49nFXXATg37VPtV0=; b=F44XzK1eR/IaDXViS2GaFyvjXeMAPAsKR2ftqyXIcQbijIKQYVr0DYWsfjsmGuxqqLxrnf 1MuCYjPTSVREY6YuunMWdYC8R+FcidPdV+4j/bNVxzrOVJ1+DIhcbKIo8QrnN+smkX/EPG g5uW5fbOYAbNZDupaRmqQ2ZqaxQrOE7eDEJs0nWU2zobsbEfCgG+iO7Y3BfWKTzMayrwzd 7NwIQgNHxbJME3+3OePKc8vVh/Q99Sh7864fgfVlTChUhsCzf6EpvXEpvQFGeIPIMM9hwE 9iFUfGw9RwkH1UFF06/zvj4YCePPgL2CLOu3sU1AO4/sC/KWoQBjzOjJCEar+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y/YK1xhhzgpIsYS4DZ9KxSPchxP49nFXXATg37VPtV0=; b=ZCVZDwTZ3/KL/ZcuRJNFZCdCEyQDFDp3axD3J7X9NMYnEay0fFlgHACMVE0DyedaMBLTTy U/Sgsshx85jATe/87daat/tj9gZxGxt5Vin8bD12anScyfjZvhBAfnsT7GnYTz6LXBTcvz VYHrDhP4klfOdPLTmI2P67ROQ0ylrnrRtBTNcIICFIU8czxKSry4/cSf0QGqRsvqA7TvSt gIs5GL69YR9tA7jEMpS+1E2EFxpM48yTqOqny16ZscrZC2LVuzobv6qVjvKgpyVc356gIQ psPFAueuonLjL2GixtOJnN4NmpaKA3JCJL2AgHa2wA5jWCimi9tag39aNT64vQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755003374; a=rsa-sha256; cv=none; b=uJjRg2fvYXlEZllASewO8MQpVseIcem39vQEsFWRItAYoOazHeAKZ7iWCuzGq3ksU4AEru 3FJJox7smftranpoVIzIaJSYb2+fXx7RMeQ77MO3mvFgcvfjD9hPzmTSCyZiXy1CCQwCpK vGKpp9Tn8K0DdZdRff/On2/AbwO2upr1VzjUuxaARi3pHmXT3cOXQkOGjkVP+doYFyU5rX tmP2lw0dMy8BnvEd5f5eDCfOxKToVjL9TRpGI1KscmSSyy2oRbLSOjz2ppR200IP2L1trY 6i6upaVu02f6cbkwIr4ILA/lUzrM7q1XGmA2RSeTOILCBaQf+DcyoHNLKC1B0A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1Whs6mtgzfn4; Tue, 12 Aug 2025 12:56: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 57CCuDDp088444; Tue, 12 Aug 2025 12:56:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CCuDHO088441; Tue, 12 Aug 2025 12:56:13 GMT (envelope-from git) Date: Tue, 12 Aug 2025 12:56:13 GMT Message-Id: <202508121256.57CCuDHO088441@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: 9280aa57a5d2 - stable/14 - random: Change the entropy harvest event queuing scheme List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 9280aa57a5d262f011030a042aabec97f2de3bf6 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9280aa57a5d262f011030a042aabec97f2de3bf6 commit 9280aa57a5d262f011030a042aabec97f2de3bf6 Author: Mark Johnston AuthorDate: 2025-07-07 15:02:36 +0000 Commit: Mark Johnston CommitDate: 2025-08-12 12:49:42 +0000 random: Change the entropy harvest event queuing scheme The entropy queue stores entropy gathered from environmental sources. Periodically (every 100ms currently), the random kthread will drain this queue and mix it into the CSPRNG's entropy pool(s). The old scheme uses a ring buffer with a mutex to serialize producers, while the sole consumer, the random kthread, avoids using a mutex on the basis that no serialization is needed since nothing else is updating the consumer index. On platforms without total store ordering, however, this isn't sufficient: when a producer inserts a queue entry and updates `ring.in`, there is no guarantee that the consumer will see the updated queue entry upon observing the updated producer index. That is, the update to `ring.in` may be visible before the updated queue entry is visible. As a result, we could end up mixing in zero'ed queue entries, though this race is fairly unlikely in practice given how infrequently the kthread runs. The easiest way to fix this is to make the kthread acquire the mutex as well, and hold it while processing queue entries. However, this might result in a long hold time if there are many queue entries, and we really want the hold times to be short, e.g., to avoid delaying interrupt processing. We could introduce a proper MPSC queue, but this is probably overcomplicated for a consumer which runs at 10Hz. Instead, define two buffers, always with one designated as the "active" buffer. Producers queue entries in the active buffer, and the kthread uses the mutex to atomically flip the two buffers, so it can process entries from the inactive buffer without holding the mutex. This requires more memory, but keeps mutex hold times short and lets us keep the queue implementation very simple. Reviewed by: cem MFC after: 1 month Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51112 (cherry picked from commit 9940c974029ba53fc00696b3fa1784725c48a9e9) --- sys/dev/random/random_harvestq.c | 103 +++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 57 deletions(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index 4cf40edb0ab4..f38fd8e92c36 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -132,30 +132,14 @@ static struct harvest_context { /* The context of the kernel thread processing harvested entropy */ struct proc *hc_kthread_proc; /* - * Lockless ring buffer holding entropy events - * If ring.in == ring.out, - * the buffer is empty. - * If ring.in != ring.out, - * the buffer contains harvested entropy. - * If (ring.in + 1) == ring.out (mod RANDOM_RING_MAX), - * the buffer is full. - * - * NOTE: ring.in points to the last added element, - * and ring.out points to the last consumed element. - * - * The ring.in variable needs locking as there are multiple - * sources to the ring. Only the sources may change ring.in, - * but the consumer may examine it. - * - * The ring.out variable does not need locking as there is - * only one consumer. Only the consumer may change ring.out, - * but the sources may examine it. + * A pair of buffers for queued events. New events are added to the + * active queue while the kthread processes the other one in parallel. */ - struct entropy_ring { + struct entropy_buffer { struct harvest_event ring[RANDOM_RING_MAX]; - volatile u_int in; - volatile u_int out; - } hc_entropy_ring; + u_int pos; + } hc_entropy_buf[2]; + u_int hc_active_buf; struct fast_entropy_accumulator { volatile u_int pos; uint32_t buf[RANDOM_ACCUM_MAX]; @@ -184,37 +168,41 @@ random_harvestq_fast_process_event(struct harvest_event *event) static void random_kthread(void) { - u_int maxloop, ring_out, i; + struct harvest_context *hc; - /* - * Locking is not needed as this is the only place we modify ring.out, and - * we only examine ring.in without changing it. Both of these are volatile, - * and this is a unique thread. - */ + hc = &harvest_context; for (random_kthread_control = 1; random_kthread_control;) { - /* Deal with events, if any. Restrict the number we do in one go. */ - maxloop = RANDOM_RING_MAX; - while (harvest_context.hc_entropy_ring.out != harvest_context.hc_entropy_ring.in) { - ring_out = (harvest_context.hc_entropy_ring.out + 1)%RANDOM_RING_MAX; - random_harvestq_fast_process_event(harvest_context.hc_entropy_ring.ring + ring_out); - harvest_context.hc_entropy_ring.out = ring_out; - if (!--maxloop) - break; - } + struct entropy_buffer *buf; + u_int entries; + + /* Deal with queued events. */ + RANDOM_HARVEST_LOCK(); + buf = &hc->hc_entropy_buf[hc->hc_active_buf]; + entries = buf->pos; + buf->pos = 0; + hc->hc_active_buf = (hc->hc_active_buf + 1) % + nitems(hc->hc_entropy_buf); + RANDOM_HARVEST_UNLOCK(); + for (u_int i = 0; i < entries; i++) + random_harvestq_fast_process_event(&buf->ring[i]); + + /* Poll sources of noise. */ random_sources_feed(); + /* XXX: FIX!! Increase the high-performance data rate? Need some measurements first. */ - for (i = 0; i < RANDOM_ACCUM_MAX; i++) { - if (harvest_context.hc_entropy_fast_accumulator.buf[i]) { - random_harvest_direct(harvest_context.hc_entropy_fast_accumulator.buf + i, sizeof(harvest_context.hc_entropy_fast_accumulator.buf[0]), RANDOM_UMA); - harvest_context.hc_entropy_fast_accumulator.buf[i] = 0; + for (u_int i = 0; i < RANDOM_ACCUM_MAX; i++) { + if (hc->hc_entropy_fast_accumulator.buf[i]) { + random_harvest_direct(&hc->hc_entropy_fast_accumulator.buf[i], + sizeof(hc->hc_entropy_fast_accumulator.buf[0]), RANDOM_UMA); + hc->hc_entropy_fast_accumulator.buf[i] = 0; } } /* XXX: FIX!! This is a *great* place to pass hardware/live entropy to random(9) */ - tsleep_sbt(&harvest_context.hc_kthread_proc, 0, "-", + tsleep_sbt(&hc->hc_kthread_proc, 0, "-", SBT_1S/RANDOM_KTHREAD_HZ, 0, C_PREL(1)); } random_kthread_control = -1; - wakeup(&harvest_context.hc_kthread_proc); + wakeup(&hc->hc_kthread_proc); kproc_exit(0); /* NOTREACHED */ } @@ -435,7 +423,7 @@ random_harvestq_init(void *unused __unused) hc_source_mask = almost_everything_mask; RANDOM_HARVEST_INIT_LOCK(); - harvest_context.hc_entropy_ring.in = harvest_context.hc_entropy_ring.out = 0; + harvest_context.hc_active_buf = 0; } SYSINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_THIRD, random_harvestq_init, NULL); @@ -540,9 +528,9 @@ SYSUNINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_THIRD, random_harvestq_d * This is supposed to be fast; do not do anything slow in here! * It is also illegal (and morally reprehensible) to insert any * high-rate data here. "High-rate" is defined as a data source - * that will usually cause lots of failures of the "Lockless read" - * check a few lines below. This includes the "always-on" sources - * like the Intel "rdrand" or the VIA Nehamiah "xstore" sources. + * that is likely to fill up the buffer in much less than 100ms. + * This includes the "always-on" sources like the Intel "rdrand" + * or the VIA Nehamiah "xstore" sources. */ /* XXXRW: get_cyclecount() is cheap on most modern hardware, where cycle * counters are built in, but on older hardware it will do a real time clock @@ -551,28 +539,29 @@ SYSUNINIT(random_device_h_init, SI_SUB_RANDOM, SI_ORDER_THIRD, random_harvestq_d void random_harvest_queue_(const void *entropy, u_int size, enum random_entropy_source origin) { + struct harvest_context *hc; + struct entropy_buffer *buf; struct harvest_event *event; - u_int ring_in; - KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, ("%s: origin %d invalid\n", __func__, origin)); + KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, + ("%s: origin %d invalid", __func__, origin)); + + hc = &harvest_context; RANDOM_HARVEST_LOCK(); - ring_in = (harvest_context.hc_entropy_ring.in + 1)%RANDOM_RING_MAX; - if (ring_in != harvest_context.hc_entropy_ring.out) { - /* The ring is not full */ - event = harvest_context.hc_entropy_ring.ring + ring_in; + buf = &hc->hc_entropy_buf[hc->hc_active_buf]; + if (buf->pos < RANDOM_RING_MAX) { + event = &buf->ring[buf->pos++]; event->he_somecounter = random_get_cyclecount(); event->he_source = origin; - event->he_destination = harvest_context.hc_destination[origin]++; + event->he_destination = hc->hc_destination[origin]++; if (size <= sizeof(event->he_entropy)) { event->he_size = size; memcpy(event->he_entropy, entropy, size); - } - else { + } else { /* Big event, so squash it */ event->he_size = sizeof(event->he_entropy[0]); event->he_entropy[0] = jenkins_hash(entropy, size, (uint32_t)(uintptr_t)event); } - harvest_context.hc_entropy_ring.in = ring_in; } RANDOM_HARVEST_UNLOCK(); } From nobody Tue Aug 12 12:56:14 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1Whw0sT5z64jGv; Tue, 12 Aug 2025 12:56: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 4c1Whv1dkSz3KP1; Tue, 12 Aug 2025 12:56:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003375; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dy5H3XI3RrQPy/kL0Grx274U9nsK5Up0tJRVKXIQl3E=; b=GB1DSD+m1Hzq4J9sVO9/OYXqs5UZ1DPtyLCZfOVaZIXNCp8bGw6lGaBB35PtMf4+7IGyYx ZZXOxO5c5T8FM1QL347FQ+C8R05Pcd95GWwyJo0Q5MBUEqFNYIa74qg7qecipHRHTwZbip mcE16yEnO8gCILrffXtlNLFn+Qyw9f2BiGtm7++26VUzzsREVYfjg3bkyINTyGn+mTDgw1 GJaD62UnGBMLz0tWzC2Xk8smxtdkxDapYisDXE+Uc5oW7yp8DUEoOlOMAc59ErgQbII0F4 wfY0wHMZoW+IYU7wzOK29kYh/caoHVw8EDjn3vdMLX/bDatQWzeGhPerKTa6VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003375; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dy5H3XI3RrQPy/kL0Grx274U9nsK5Up0tJRVKXIQl3E=; b=ZHJGWKZgMy4uRdNOPzxW+rvl1gCxfQimHi2cRMbWK+5FDhZ/0LRZFDVdxOcJSvhTY6Nh4g IPUoE1EBuxCr60i26wQwK+p72MDOH/yO6hUaSBvmn0glVVTal1/258mNIe6IFNitupdGxp 3XGGdpNA6RtNF1Z828li6HlvYWPJnahhc88tCjFmRU0NRsgQZ6tRmWoNO4dlL83zkhp4n6 5Ck6LxgE2NRrcOGCrwpycNrDiQEBgZdstMlp12HZqXuO5sXT+rt4ZskiRrXn23JctYq0zw GitbxkYdXN92xavTrrRHOKHKQgUiRqq6gT/11SlNna5jItd5/lJKVM7WoZVeGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755003375; a=rsa-sha256; cv=none; b=PhGpTRzzbUaotvFyFLGk3xpqe5OV7KMYFmstrFfbT24FyXnt+QK70O3BYTMlikVm9sAuuA rqWEAmPUzCADB24jVsg0YEzz5LZetHpv8/PaeY+Zf2dqcv+dL4cM6ZBsbdJPNMh84SH98Q hJXEAdRtgjIXagE+EguYbHFNcqpjZSd+JLoDBqG9yxX2Amz+n94M1qIXKfZaUK2KXUyXkm Vpom2uLT+Mu7ftdlwa5UVe1acKLisA/o/ExLiPrqjpEJcW9bQyGZ9WAfzs41i62tMx5Jwv 9eI2Pz5gyM2NWJiuV3b2nptkmrGePSQpJmw5Hz7m9qmDMPuvVkknqQLe8ZCvcw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1Whv0z0nzfn5; Tue, 12 Aug 2025 12:56: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 57CCuEEh088476; Tue, 12 Aug 2025 12:56:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CCuEuI088473; Tue, 12 Aug 2025 12:56:14 GMT (envelope-from git) Date: Tue, 12 Aug 2025 12:56:14 GMT Message-Id: <202508121256.57CCuEuI088473@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: a6059a556654 - stable/14 - qat: Revert changes to BAR indices List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: a6059a556654c033619c2a4d0f95c9ac3c92a532 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a6059a556654c033619c2a4d0f95c9ac3c92a532 commit a6059a556654c033619c2a4d0f95c9ac3c92a532 Author: Mark Johnston AuthorDate: 2025-08-01 09:29:21 +0000 Commit: Mark Johnston CommitDate: 2025-08-12 12:49:42 +0000 qat: Revert changes to BAR indices It is not clear how commit ded037e65e52 could reasonably change BAR indices, and doing so broke at least the C3000 driver. Revert that part of the change. Reported by: kp Reviewed by: kp, Haresh Sankar Raj MFC after: 3 days Fixes: ded037e65e52 ("qat: driver updates to improve code and fix bugs") Differential Revision: https://reviews.freebsd.org/D51664 (cherry picked from commit 4a8e62a1209f7d7529817c4c27b91fb97750b7b2) --- sys/dev/qat/qat_hw/qat_200xx/adf_200xx_hw_data.h | 4 ++-- sys/dev/qat/qat_hw/qat_c3xxx/adf_c3xxx_hw_data.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/qat/qat_hw/qat_200xx/adf_200xx_hw_data.h b/sys/dev/qat/qat_hw/qat_200xx/adf_200xx_hw_data.h index a7324509bea7..f8adc0dba935 100644 --- a/sys/dev/qat/qat_hw/qat_200xx/adf_200xx_hw_data.h +++ b/sys/dev/qat/qat_hw/qat_200xx/adf_200xx_hw_data.h @@ -4,8 +4,8 @@ #define ADF_200XX_HW_DATA_H_ /* PCIe configuration space */ -#define ADF_200XX_PMISC_BAR 1 -#define ADF_200XX_ETR_BAR 2 +#define ADF_200XX_PMISC_BAR 0 +#define ADF_200XX_ETR_BAR 1 #define ADF_200XX_RX_RINGS_OFFSET 8 #define ADF_200XX_TX_RINGS_MASK 0xFF #define ADF_200XX_MAX_ACCELERATORS 3 diff --git a/sys/dev/qat/qat_hw/qat_c3xxx/adf_c3xxx_hw_data.h b/sys/dev/qat/qat_hw/qat_c3xxx/adf_c3xxx_hw_data.h index cddfc3f84853..486c46a1cac7 100644 --- a/sys/dev/qat/qat_hw/qat_c3xxx/adf_c3xxx_hw_data.h +++ b/sys/dev/qat/qat_hw/qat_c3xxx/adf_c3xxx_hw_data.h @@ -4,8 +4,8 @@ #define ADF_C3XXX_HW_DATA_H_ /* PCIe configuration space */ -#define ADF_C3XXX_PMISC_BAR 1 -#define ADF_C3XXX_ETR_BAR 2 +#define ADF_C3XXX_PMISC_BAR 0 +#define ADF_C3XXX_ETR_BAR 1 #define ADF_C3XXX_RX_RINGS_OFFSET 8 #define ADF_C3XXX_TX_RINGS_MASK 0xFF #define ADF_C3XXX_MAX_ACCELERATORS 3 From nobody Tue Aug 12 12:56:16 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1Whw6W3Qz64jXS; Tue, 12 Aug 2025 12:56: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 4c1Whw2PDgz3KW2; Tue, 12 Aug 2025 12:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c3mNY61GmS2tbC9O5hyt4grvI0wFWT0qNWs24ELTs4w=; b=v3HawsqdT1qvKx32wVg903DvDzpKnL8G7LIwiy5U8QV3FmPGmOtxts1Ck6I/14dPC8uh0b 8u3+BgYjTu0dcLS+r9BPDNOmcLgrcVBn7fRhbiP4L27usnlLRk+nwk0REJIhMaqUo6C3AJ H3OzOuHFbg+MVzie7ENjotm81LrnEBrYedzBrUmv0RQuS1h4WSg7NM3n0eu1AEirVvZcQN h4za6O8B6eJKh7kSCEHMi2i8FhQyTsMKaM9abj3nD3d79ptg9p2SKKcFSW/aLMxrJuMT6y KIFX11MkLak5OZVDb4V9uPUxbJufhyIS24IZhgFbB8XAJDEKv02U660tUySq0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c3mNY61GmS2tbC9O5hyt4grvI0wFWT0qNWs24ELTs4w=; b=g8T+cgzMsAgEaS/aHStnCX2C/iujobdm3X6LnXcYgdGNgm4VCj2PJ8tnY9x72urLvpafQB 3GibWqLUX9Is06gGrDoJZAzPCol697gwxYdz51SA9j4uRVe3SGmSBeJ2A4lk1YxuIb/JnN WYPG6RMNQs9R5SlpN2b2HQPxa3Dz/EadjTOKUwU2lZI+GSLuEnDxs/XosA5CZPWsODVg7m wfvCv8aiLuGs6lkDDjnesX8jC3PIPVUHJ9NBDzR+J+D12zAlMGzFa659aeEHHq2OcWjJVd 5DyjAZ910KlUEtMC+w+aP18kSxHZA+c3NWNdLUMKcpeZJ9Ch1n+P8VJYr883lA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755003376; a=rsa-sha256; cv=none; b=V5f9/ecNaK3MKevhG+dQrAw5DgfmUXoOtRWjyTJmWxLzh7P6boEebya0kQcTmX7VZV3iE/ LaR+B/N1xNSNvnE9wo39uZUvgPmmFaspYVacSgh3MvjJNLhosOcC3klkUX1TR7M34DkyEX NhEoZ28uDStqfaPNIm9tKOh6oL3aT1mRdjSg9+/nF9rRL1zQfXN+Hp/5VkwPtXuWszyvqL ERts6qeH8lG2BYh37LbKbH/CmCi/a+PJZiyhfklzudkRCNNzQVu19fPM7jwcGvN9yHSg4Q PH/oCQ1FAJpOWR06wNx5SsQgk6H3G64Z8kCGmjEGyesPhrVZG/YDDwOQ702zfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1Whw1W48zfb8; Tue, 12 Aug 2025 12:56: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 57CCuG6C088514; Tue, 12 Aug 2025 12:56:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CCuGER088511; Tue, 12 Aug 2025 12:56:16 GMT (envelope-from git) Date: Tue, 12 Aug 2025 12:56:16 GMT Message-Id: <202508121256.57CCuGER088511@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: 4d84cefbba2c - stable/14 - udp: Fix a inpcb refcount leak in the tunnel receive path List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 4d84cefbba2cad514d581d5dfaac7a2ac3ce2912 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4d84cefbba2cad514d581d5dfaac7a2ac3ce2912 commit 4d84cefbba2cad514d581d5dfaac7a2ac3ce2912 Author: Mark Johnston AuthorDate: 2025-07-25 13:10:24 +0000 Commit: Mark Johnston CommitDate: 2025-08-12 12:49:43 +0000 udp: Fix a inpcb refcount leak in the tunnel receive path When the socket has a tunneling function attached, udp_append() drops the inpcb lock before calling it. To keep the inpcb alive, we bump the refcount. After commit 742e7210d00b we only dropped the reference if the tunnel consumed the packet, but it needs to be dropped in either case. if_ovpn is the only driver that can trigger this bug. Fixes: 742e7210d00b ("udp: allow udp_tun_func_t() to indicate it did not eat the packet") Reviewed by: kp MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51505 (cherry picked from commit e1751ef896119d7372035b1b60f18a6342bd0e3b) --- sys/netinet/udp_usrreq.c | 11 ++++++++--- sys/netinet6/udp6_usrreq.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index d65343fc9997..adf8f0afc125 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -245,7 +245,6 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, struct sockaddr_in6 udp_in6; #endif struct udpcb *up; - bool filtered; INP_LOCK_ASSERT(inp); @@ -254,13 +253,19 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, */ up = intoudpcb(inp); if (up->u_tun_func != NULL) { + bool filtered; + in_pcbref(inp); INP_RUNLOCK(inp); filtered = (*up->u_tun_func)(n, off, inp, (struct sockaddr *)&udp_in[0], up->u_tun_ctx); INP_RLOCK(inp); - if (filtered) - return (in_pcbrele_rlocked(inp)); + if (in_pcbrele_rlocked(inp)) + return (1); + if (filtered) { + INP_RUNLOCK(inp); + return (1); + } } off += sizeof(struct udphdr); diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 8ab159b4e622..4a82315ea2f0 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -143,7 +143,6 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, struct socket *so; struct mbuf *opts = NULL, *tmp_opts; struct udpcb *up; - bool filtered; INP_LOCK_ASSERT(inp); @@ -152,13 +151,19 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, */ up = intoudpcb(inp); if (up->u_tun_func != NULL) { + bool filtered; + in_pcbref(inp); INP_RUNLOCK(inp); filtered = (*up->u_tun_func)(n, off, inp, (struct sockaddr *)&fromsa[0], up->u_tun_ctx); INP_RLOCK(inp); - if (filtered) - return (in_pcbrele_rlocked(inp)); + if (in_pcbrele_rlocked(inp)) + return (1); + if (filtered) { + INP_RUNLOCK(inp); + return (1); + } } #if defined(IPSEC) || defined(IPSEC_SUPPORT) /* Check AH/ESP integrity. */ From nobody Tue Aug 12 12:56:18 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1Whz1trpz64jgB; Tue, 12 Aug 2025 12:56: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 4c1Why3qyPz3KWR; Tue, 12 Aug 2025 12:56:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7Gbbt6jJdKTMHPGOhgFon6UwWTYBLXDLk9VGTKPO0Uo=; b=O/lFInwcDVoLtqhluAV5yFvLbRE77zYvyN5vG+wwE/kbg1d5pwMheuHOvICwARGh+UrcSj H5W0Aoo8KBRB3DxI8ILuJ3FkpRvvEpfymqns8ZQrztyi31BAlZQF9uA2K70LIYWVvVG5LH TZC5zsBvKmN0EGeyrgpmmMONNvplRx9qScKcl+2mn74Wwo7fhyI++uuPRW9RVYd/u1564A oSt+CbWuSHvmiuKv4jQr13S2DBhH2ziGMoO0iH9V3JNn09GP2EHhkQ1CW1W55Qx3W4FYpq 8tRPtYW/GANxNec2+noU+IyWEhI1lyu+i3d6Ga5OejjvGEQr2Vd/bUO27xpmNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7Gbbt6jJdKTMHPGOhgFon6UwWTYBLXDLk9VGTKPO0Uo=; b=o44NCo4ow/lacrv01X6crU4Dm5E8PMZXe7ck7hhRHnY0wyNWjD/PvMyMFkzKHteo63qO4n Zxr4BBifq8+Ee4JSY2FJjzjseFWKii7Cf2Ed2japtCXHcPywpJzfGcdKBmjQLjddn4Byc/ Pi0tNTPs6iasl17aJXDjKu/KbMr6pKiRUYjkSg2gNadVmu6I8e6/Gybr0s/MiFc4/DNxXA j51DS+xzb+WFx6SxjGMo6z3tZ5T1Di2CV3hyyFnsbMhkXzpKMkQJvzHyorfZR3S20CAbhH F95mflVVZcahFAvzrX1qkejcQkDS0z5pVRAd98lrRZXihXbAq2Jn49RswzJOyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755003378; a=rsa-sha256; cv=none; b=UPR1eublnUy6mabPbWRgF3HaFrz2aBjhcENWU8RSL7llvqJMs+m3i6pgkvQFt1B/LCEssL bPAH1452+Um/Sx3uPpFVDPkvgw6H5GYhuELkfEegj1VshrReuUIKimS6THlzROv4PIcHsz lXC1zq1yfsjBOfuRVWq6OIppLefXAHVqKPq3wU/cudJnvHsmI8I2hOPQ8HmbvLA1wjZJM+ 9xgOgYMWjp4aVri3AkfMq+RQMg0WkX7Kre1D2fUltngfZNG4kQd5cu0/MLtZmuxuxU51m+ m40ixxNQyWLqYUEYQwTUweL8OMoVM4QJpsCC8dtOuKG6rVuscGdszUiMDxSOrA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1Why3MFmzf4s; Tue, 12 Aug 2025 12:56: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 57CCuIQg088579; Tue, 12 Aug 2025 12:56:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CCuIBj088576; Tue, 12 Aug 2025 12:56:18 GMT (envelope-from git) Date: Tue, 12 Aug 2025 12:56:18 GMT Message-Id: <202508121256.57CCuIBj088576@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: 3cbb5a96bd81 - stable/14 - jail: Make prison_owns_vnet() operate on a prison instead of a ucred List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 3cbb5a96bd81b5b5d59f6a0a39a2a0f447357deb Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3cbb5a96bd81b5b5d59f6a0a39a2a0f447357deb commit 3cbb5a96bd81b5b5d59f6a0a39a2a0f447357deb Author: Mark Johnston AuthorDate: 2025-07-28 15:46:26 +0000 Commit: Mark Johnston CommitDate: 2025-08-12 12:49:57 +0000 jail: Make prison_owns_vnet() operate on a prison instead of a ucred This will be useful in an upcoming change. No functional change intended. Reviewed by: jamie MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51524 (cherry picked from commit 748a4ea1caffca48c4949d5a7b964853c44fbdae) --- sys/kern/kern_jail.c | 17 +++++++---------- sys/kern/kern_sysctl.c | 2 +- sys/sys/jail.h | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index b14b3218ebb7..0af1bcd775d0 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -3423,7 +3423,7 @@ prison_check_af(struct ucred *cred, int af) pr = cred->cr_prison; #ifdef VIMAGE /* Prisons with their own network stack are not limited. */ - if (prison_owns_vnet(cred)) + if (prison_owns_vnet(pr)) return (0); #endif @@ -3488,7 +3488,7 @@ prison_if(struct ucred *cred, const struct sockaddr *sa) KASSERT(sa != NULL, ("%s: sa is NULL", __func__)); #ifdef VIMAGE - if (prison_owns_vnet(cred)) + if (prison_owns_vnet(cred->cr_prison)) return (0); #endif @@ -3605,7 +3605,7 @@ jailed_without_vnet(struct ucred *cred) if (!jailed(cred)) return (false); #ifdef VIMAGE - if (prison_owns_vnet(cred)) + if (prison_owns_vnet(cred->cr_prison)) return (false); #endif @@ -3668,20 +3668,17 @@ getjailname(struct ucred *cred, char *name, size_t len) #ifdef VIMAGE /* - * Determine whether the prison represented by cred owns - * its vnet rather than having it inherited. - * - * Returns true in case the prison owns the vnet, false otherwise. + * Determine whether the prison owns its VNET. */ bool -prison_owns_vnet(struct ucred *cred) +prison_owns_vnet(struct prison *pr) { /* * vnets cannot be added/removed after jail creation, * so no need to lock here. */ - return ((cred->cr_prison->pr_flags & PR_VNET) != 0); + return ((pr->pr_flags & PR_VNET) != 0); } #endif @@ -4343,7 +4340,7 @@ sysctl_jail_vnet(SYSCTL_HANDLER_ARGS) #ifdef VIMAGE struct ucred *cred = req->td->td_ucred; - havevnet = jailed(cred) && prison_owns_vnet(cred); + havevnet = jailed(cred) && prison_owns_vnet(cred->cr_prison); #else havevnet = 0; #endif diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 479792b4fff1..46674b9a3ed1 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -2268,7 +2268,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS) priv = PRIV_SYSCTL_WRITEJAIL; #ifdef VIMAGE else if ((oid->oid_kind & CTLFLAG_VNET) && - prison_owns_vnet(req->td->td_ucred)) + prison_owns_vnet(req->td->td_ucred->cr_prison)) priv = PRIV_SYSCTL_WRITEJAIL; #endif else diff --git a/sys/sys/jail.h b/sys/sys/jail.h index 7fbb71ee31f8..6701587f82cb 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -428,7 +428,7 @@ void prison0_init(void); bool prison_allow(struct ucred *, unsigned); int prison_check(struct ucred *cred1, struct ucred *cred2); bool prison_check_nfsd(struct ucred *cred); -bool prison_owns_vnet(struct ucred *); +bool prison_owns_vnet(struct prison *pr); int prison_canseemount(struct ucred *cred, struct mount *mp); void prison_enforce_statfs(struct ucred *cred, struct mount *mp, struct statfs *sp); From nobody Tue Aug 12 12:56:17 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1Why0nnfz64jZc; Tue, 12 Aug 2025 12:56: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 4c1Whx2k5bz3KT7; Tue, 12 Aug 2025 12:56:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KnMcot9YYzCEzszIAFPN3IdaY1AoKJwyGDL7hDuQmLI=; b=ZvDUuDrUNuus54mM26SwIHdEbeF2wnZ45isGmslWGDMmS82W2mHkaYvLhE/OeGLVJNLkJ0 eeqnRpUb6pVBnO6er8vUARjb1HAw+zGXiWo3FdjAdL+mU6yjkEeKq0bQ0yV2CztVrjStCM wu/BCWX49JRVQncaU5Nj01BKOvFPOv6nHafztf8XBeL3WdPQR+gMfjVvh1hwyL/nRjg1Ee vTykkC3yiTO+RZHm+706ncfA7aIjtSG9UjM2vJU4EukUjZyFy2corRL/JhQpssaM1RfPO+ uWN1LZ7oTWIzgsTZCZl7slJl95Jx1cUaA6kImQf9yHye3w6TDtwiuAeAI7LP4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755003377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KnMcot9YYzCEzszIAFPN3IdaY1AoKJwyGDL7hDuQmLI=; b=ahyyJmd2ZxNkcW8XbNJtC63AeDnwAo1NA0Kg11nec41V0x1TpvhmHqE3JIwyXT6iRevRvf Nv2fg8Xn3MxmlQu5mDV+PvqWC/IgAKRrls6WazprZN2goh7StsiyqmQMTTWjSSZXQtVyeC A0+urHpQrHehymramVa3JNlzDj6quygUuW2jqyH3yUL7esYhTkZHLmnybfUqPhUqrO3YgV 9UGPLMI/E+btRIvVpDx7sMwTV9wm0Xa+UUxjpyjS9mUrnZJuotjCIK+5p59EBmedYD/8T/ GhFBgarLw1G/EjHN+65ROr19zgnkcPkdAGGaw863BkZqsidWs4jnItF+6QmXiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755003377; a=rsa-sha256; cv=none; b=oOGyiWdgKgdl1+gqZ/sBORgRrGy2e8Gx17aykF6c12lF+8mMH1x8Fhvb8dsc+QBFEVfex7 x+OzbhGdwfR2M1S0QS5WT4aP/MbWQ2KhtJG1pARKcosGzEKoGyuMHrItquaJA+QsEgNvuQ wE4hewH5cUOtyFsdynzGkVcJVF9poGHyspV6DshC4+WoYPJyfkp7LPkOPM+hq2ZA/uKdVC srCKnBY4vzQoI5odrCz+qmGVkNXtaV1G4mhhdNHlqkqNZZXi2JzYj0Jke4wtVcF7nO3JWC pJXWx7JwJzOSTQRwYUdwqfWIaiZzzc3INp+hA8cd8x70NhcxLGlef4JXrjldZQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1Whx29LWzf4r; Tue, 12 Aug 2025 12:56: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 57CCuH1o088547; Tue, 12 Aug 2025 12:56:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CCuHxn088544; Tue, 12 Aug 2025 12:56:17 GMT (envelope-from git) Date: Tue, 12 Aug 2025 12:56:17 GMT Message-Id: <202508121256.57CCuHxn088544@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: 0188e350666d - stable/14 - p9fs: Set vnode state in p9fs_vget_common() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 0188e350666dbbd68e4d4b4f2f900309a4c230bc Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0188e350666dbbd68e4d4b4f2f900309a4c230bc commit 0188e350666dbbd68e4d4b4f2f900309a4c230bc Author: Mark Johnston AuthorDate: 2025-08-04 15:07:05 +0000 Commit: Mark Johnston CommitDate: 2025-08-12 12:49:47 +0000 p9fs: Set vnode state in p9fs_vget_common() Once a new vnode is visible from the mountpoint hash, we should set its state from VSTATE_UNINITIALIZED to VSTATE_CONSTRUCTED. I do not think this affects correctness at all, but the bug trips a check in vop_unlock_debugpost(), previously hidden under options DEBUG_VFS_LOCKS. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51720 (cherry picked from commit e2ac6de6e4edc1c6e7bfdfb0ec8fcf62f46d503f) --- sys/fs/p9fs/p9fs_vfsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/p9fs/p9fs_vfsops.c b/sys/fs/p9fs/p9fs_vfsops.c index 3451bc052187..e0e91e7e1709 100644 --- a/sys/fs/p9fs/p9fs_vfsops.c +++ b/sys/fs/p9fs/p9fs_vfsops.c @@ -374,7 +374,7 @@ p9fs_vget_common(struct mount *mp, struct p9fs_node *np, int flags, STAILQ_INSERT_TAIL(&vses->virt_node_list, np, p9fs_node_next); np->flags |= P9FS_NODE_IN_SESSION; P9FS_UNLOCK(vses); - + vn_set_state(vp, VSTATE_CONSTRUCTED); *vpp = vp; } else { /* From nobody Tue Aug 12 21:20:04 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1ktF0xFYz646Dp; Tue, 12 Aug 2025 21:20: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 4c1ktF08Pvz3k0C; Tue, 12 Aug 2025 21:20:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755033605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hTsVhAsX1SC6JoMfkjWr1hGNzUo5O3C/SMDDaMhPbdc=; b=M6sTenaVIQb0Q995nS0D0RftP2953BRvq5pqRU+OZNnnduDm64Cgd5SMmY0XFA2ZG1tkLl M/FjWgpkrcXncchn6Pf9lM4dGIoJmUTZQ2dWAjKDRRB3bOH96Cgkp+pQgVtKb7+ZILtaoM +2ZDDHAkGL5pGfWHZkOESQvlCBPLT39Tm61LpfDQdP5x0Cnl3rV3XUewtrzqJrIa3Fmnsi RFYI3P8n3DZJHMb0pN03FuANu/siTa1cy1wKLeWpM0NljYHZync8qXgnhBj+4oSQBqmIGI qoDVlTB7N4F7c6P1E5v7/oeRjaaK1h/Qo70yWmTYmVSZkWK0Nv+FK3d0mg4QnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755033605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hTsVhAsX1SC6JoMfkjWr1hGNzUo5O3C/SMDDaMhPbdc=; b=P4oX3tGNsbEosBBE901pAhtJr5JGKud3/gy/xyURvZfEMHRue78nNRYAJJq7eHPIGKpBVe JEIWJm8JZ/ZYbbq0T3J7F4Lpe9rizVRC/noYjXyuRK9GDUQ8QbX+NfB/suBaKG64eecT05 zCc44XLf02l0Can5p3DiC2KTfaBTxci2nC+yPMb++3QU1y8W03yYYuC9bXH3hhhvhurZ41 1kb84x+KHhyFd6yuzbPmixf9WxRXsPoBSXL/s82ndTdc2hmqImGZuSzTfO2mYw9YyPNle1 6cs+zcAuu/n1uBx5+dBTPAP3XupVzLN0R3fEeHOmmfegd3ixkG3BPPa1lApjqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755033605; a=rsa-sha256; cv=none; b=c0qsbo5n1LseYXaId9oXkYRt+AcfQWUIISzjmBP1iaImWLac4hbM6+J6Bg+YXG/zJSnjXy vvCyZjJx0l7VxhlrLjf15fXeJFBMD9KEOvvj6cVhP2S4eb7Kk2/oBu40oDjjRo4ftqCxgj 1+vHCqfe5oCM5aE1IqZM0vIR9o5Kd3JNf074CWsEn5thkO6EyT8nsrYOGkyKkEhd8PVxCM H2EAzgSn4573L78jxVGH0QwT+M9rqjegHos6sUZ1iKKIcOE9TDIGvZg6rFgOehu4at7fYQ Z606rMf0tEf6KAHh+YveY04mR++ZJEgW1CnsA0TX4Sowu/YWRRxLbK1gBhtBVw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1ktD6sCszvm9; Tue, 12 Aug 2025 21:20: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 57CLK4B0041112; Tue, 12 Aug 2025 21:20:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CLK4wS041107; Tue, 12 Aug 2025 21:20:04 GMT (envelope-from git) Date: Tue, 12 Aug 2025 21:20:04 GMT Message-Id: <202508122120.57CLK4wS041107@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jilles Tjoelker Subject: git: 5c37f7d22fa7 - stable/14 - wordexp(3): Handle ECHILD from waitpid List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jilles X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5c37f7d22fa7edd03b6cd012cb73fa6cac0880ad Auto-Submitted: auto-generated The branch stable/14 has been updated by jilles: URL: https://cgit.FreeBSD.org/src/commit/?id=5c37f7d22fa7edd03b6cd012cb73fa6cac0880ad commit 5c37f7d22fa7edd03b6cd012cb73fa6cac0880ad Author: Kenny Levinsen AuthorDate: 2025-04-21 12:13:43 +0000 Commit: Jilles Tjoelker CommitDate: 2025-08-12 21:18:42 +0000 wordexp(3): Handle ECHILD from waitpid If the calling process has used SIG_IGN as handler or set the SA_NOCLDWAIT flag for SIGCHLD, processes will be automatically reaped on exit and calls to waitpid(3) will therefore fail with ECHILD. We waitpid primarily to reap our child so that the caller does not have to worry about it. ECHILD indicates that there is no child to reap, so we can just treat that as a success and move on. Signed-off-by: Kenny Levinsen Tested by: Jan Beich Pull Request: https://github.com/freebsd/freebsd-src/pull/1675 (cherry picked from commit da9e73e5d483c47e67b3094356dd4b640749849e) --- lib/libc/gen/wordexp.c | 10 +++++++++- lib/libc/tests/gen/wordexp_test.c | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/libc/gen/wordexp.c b/lib/libc/gen/wordexp.c index f1437e30bbe2..f8080c20d121 100644 --- a/lib/libc/gen/wordexp.c +++ b/lib/libc/gen/wordexp.c @@ -265,7 +265,15 @@ cleanup: errno = serrno; return (error); } - if (wpid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) + /* + * Check process exit status, but ignore ECHILD as the child may have + * been automatically reaped if the process had set SIG_IGN or + * SA_NOCLDWAIT for SIGCHLD, and our reason for waitpid was just to + * reap our own child on behalf of the calling process. + */ + if (wpid < 0 && errno != ECHILD) + return (WRDE_NOSPACE); /* abort for unknown reason */ + if (wpid >= 0 && (!WIFEXITED(status) || WEXITSTATUS(status) != 0)) return (WRDE_NOSPACE); /* abort for unknown reason */ /* diff --git a/lib/libc/tests/gen/wordexp_test.c b/lib/libc/tests/gen/wordexp_test.c index 909097fbf51e..a8b9d5509633 100644 --- a/lib/libc/tests/gen/wordexp_test.c +++ b/lib/libc/tests/gen/wordexp_test.c @@ -292,6 +292,31 @@ ATF_TC_BODY(with_SIGCHILD_handler_test, tc) ATF_REQUIRE(r == 0); } +ATF_TC_WITHOUT_HEAD(with_SIGCHILD_ignore_test); +ATF_TC_BODY(with_SIGCHILD_ignore_test, tc) +{ + struct sigaction sa; + wordexp_t we; + int r; + + /* With SIGCHLD set to ignore so that the kernel auto-reaps zombies. */ + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sa.sa_handler = SIG_IGN; + r = sigaction(SIGCHLD, &sa, NULL); + ATF_REQUIRE(r == 0); + r = wordexp("hello world", &we, 0); + ATF_REQUIRE(r == 0); + ATF_REQUIRE(we.we_wordc == 2); + ATF_REQUIRE(strcmp(we.we_wordv[0], "hello") == 0); + ATF_REQUIRE(strcmp(we.we_wordv[1], "world") == 0); + ATF_REQUIRE(we.we_wordv[2] == NULL); + wordfree(&we); + sa.sa_handler = SIG_DFL; + r = sigaction(SIGCHLD, &sa, NULL); + ATF_REQUIRE(r == 0); +} + ATF_TC_WITHOUT_HEAD(with_unused_non_default_IFS_test); ATF_TC_BODY(with_unused_non_default_IFS_test, tc) { @@ -350,6 +375,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, WRDE_BADCHAR_test); ATF_TP_ADD_TC(tp, WRDE_SYNTAX_test); ATF_TP_ADD_TC(tp, with_SIGCHILD_handler_test); + ATF_TP_ADD_TC(tp, with_SIGCHILD_ignore_test); ATF_TP_ADD_TC(tp, with_unused_non_default_IFS_test); ATF_TP_ADD_TC(tp, with_used_non_default_IFS_test); From nobody Tue Aug 12 21:20:45 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c1kv125xYz645wD; Tue, 12 Aug 2025 21:20: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 4c1kv11W4lz3k3q; Tue, 12 Aug 2025 21:20:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755033645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jDnFVm+NYNvDsfgNbsHeMmMVW+RQA8n/+mod3MKGr14=; b=FzQa6L4yxe1JasPTSi/PvirMgTLo2YNxJmZNn7wq1xZ0f1DBW5lent71pVzvxbsF5uI39t gJmQqARjTx6r4Us4CcnADmXFk+AvDR13Gz2AVXzxcGfXl+aSpd4kMC/R/tCN5dOW54uFBe Gz0reoeM55t3IWeceLwDqR+G3LKpZdln0aseCxv5NsXaaD6NkKS930RVp+f/GH3g1LnsWX D2o41ETYNeAKrVRtxvEUU5XdO8Vlyd6ddXGHlfl5BgIXglhlOq9Wz97cP5LJUKOa7u0hiC teb0FSc0j7CBA45JDtu5T+rrHtOu/Zv/37dbAEYn49/aALXfqW/yOOPdaJdRfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755033645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jDnFVm+NYNvDsfgNbsHeMmMVW+RQA8n/+mod3MKGr14=; b=kuWDX8hYLjpqlLP1tTiVILvOAY8svlozFffTwKqGbe3H9OvLUialOTDHDe+2rCJSdnTXGl K6yMJwX5W9rs7//uK5s7lSC5Gn7HSn2phJegAGze+l7KX1CFSsR0tcpQOLGdzH9I6EEtPM hW9r5YOSWXnPoSTo/I/OtWl+XVw1dDpvVhe7nNhRSpNvTJ8gaoCUvSSvhofPTQIrh+M7z9 knnBCZTPZCdy7B6wD6PPvLrjsRurn+ISSo3ADaRGtVLfTI/L0q/0zKAfJdJLdd5fxzzmmW 8b8D4bvm6OieUX1LLU8CV2H0khypGGukSSdBv4GHkCAbeEFNwh4dBNoaQ9+Ucw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755033645; a=rsa-sha256; cv=none; b=izTm7Y9ZEZ5UjXtaYpu73JNFBH5fl3ezHne3ubjdzDudBWOebZ+HEHqefXGtOJNEkXQHrv DvDL4T5IPEzQgnGmW2zjYt0XNRh9k9MSCiNMhWkNCHC2uXroqwJ8O3EWB94zNXuDsVTvdG bJypyU6+FJ0CFoSHDEIzWnRLrVqCaMNrWMXnMuCwaec4mRFKhlpdZp/OMFRFZlGWRABYAG hd9ZE5zMSZSavQ0MT0Fjo2l0Uy1YfF67T2VAgYcjmKNTBMQDYW8JE7q27+pU4eROdqABlF +Lh+7XDLbiJKC9MsQ67h6m5xjnYRwY6AWeOGEjQ8ZpG7xRIN753zzbrkEvWZew== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c1kv1102PzvTg; Tue, 12 Aug 2025 21:20: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 57CLKjOY047454; Tue, 12 Aug 2025 21:20:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57CLKjtb047451; Tue, 12 Aug 2025 21:20:45 GMT (envelope-from git) Date: Tue, 12 Aug 2025 21:20:45 GMT Message-Id: <202508122120.57CLKjtb047451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jilles Tjoelker Subject: git: 01bb889cc1b1 - stable/13 - wordexp(3): Handle ECHILD from waitpid List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jilles X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 01bb889cc1b1863798ae65f95769c227bae297c3 Auto-Submitted: auto-generated The branch stable/13 has been updated by jilles: URL: https://cgit.FreeBSD.org/src/commit/?id=01bb889cc1b1863798ae65f95769c227bae297c3 commit 01bb889cc1b1863798ae65f95769c227bae297c3 Author: Kenny Levinsen AuthorDate: 2025-04-21 12:13:43 +0000 Commit: Jilles Tjoelker CommitDate: 2025-08-12 21:20:24 +0000 wordexp(3): Handle ECHILD from waitpid If the calling process has used SIG_IGN as handler or set the SA_NOCLDWAIT flag for SIGCHLD, processes will be automatically reaped on exit and calls to waitpid(3) will therefore fail with ECHILD. We waitpid primarily to reap our child so that the caller does not have to worry about it. ECHILD indicates that there is no child to reap, so we can just treat that as a success and move on. Signed-off-by: Kenny Levinsen Tested by: Jan Beich Pull Request: https://github.com/freebsd/freebsd-src/pull/1675 (cherry picked from commit da9e73e5d483c47e67b3094356dd4b640749849e) --- lib/libc/gen/wordexp.c | 10 +++++++++- lib/libc/tests/gen/wordexp_test.c | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/libc/gen/wordexp.c b/lib/libc/gen/wordexp.c index 0902814eb04f..fe23e563c3f5 100644 --- a/lib/libc/gen/wordexp.c +++ b/lib/libc/gen/wordexp.c @@ -266,7 +266,15 @@ cleanup: errno = serrno; return (error); } - if (wpid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) + /* + * Check process exit status, but ignore ECHILD as the child may have + * been automatically reaped if the process had set SIG_IGN or + * SA_NOCLDWAIT for SIGCHLD, and our reason for waitpid was just to + * reap our own child on behalf of the calling process. + */ + if (wpid < 0 && errno != ECHILD) + return (WRDE_NOSPACE); /* abort for unknown reason */ + if (wpid >= 0 && (!WIFEXITED(status) || WEXITSTATUS(status) != 0)) return (WRDE_NOSPACE); /* abort for unknown reason */ /* diff --git a/lib/libc/tests/gen/wordexp_test.c b/lib/libc/tests/gen/wordexp_test.c index ea8dc3d37828..f7e94b02697a 100644 --- a/lib/libc/tests/gen/wordexp_test.c +++ b/lib/libc/tests/gen/wordexp_test.c @@ -293,6 +293,31 @@ ATF_TC_BODY(with_SIGCHILD_handler_test, tc) ATF_REQUIRE(r == 0); } +ATF_TC_WITHOUT_HEAD(with_SIGCHILD_ignore_test); +ATF_TC_BODY(with_SIGCHILD_ignore_test, tc) +{ + struct sigaction sa; + wordexp_t we; + int r; + + /* With SIGCHLD set to ignore so that the kernel auto-reaps zombies. */ + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sa.sa_handler = SIG_IGN; + r = sigaction(SIGCHLD, &sa, NULL); + ATF_REQUIRE(r == 0); + r = wordexp("hello world", &we, 0); + ATF_REQUIRE(r == 0); + ATF_REQUIRE(we.we_wordc == 2); + ATF_REQUIRE(strcmp(we.we_wordv[0], "hello") == 0); + ATF_REQUIRE(strcmp(we.we_wordv[1], "world") == 0); + ATF_REQUIRE(we.we_wordv[2] == NULL); + wordfree(&we); + sa.sa_handler = SIG_DFL; + r = sigaction(SIGCHLD, &sa, NULL); + ATF_REQUIRE(r == 0); +} + ATF_TC_WITHOUT_HEAD(with_unused_non_default_IFS_test); ATF_TC_BODY(with_unused_non_default_IFS_test, tc) { @@ -351,6 +376,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, WRDE_BADCHAR_test); ATF_TP_ADD_TC(tp, WRDE_SYNTAX_test); ATF_TP_ADD_TC(tp, with_SIGCHILD_handler_test); + ATF_TP_ADD_TC(tp, with_SIGCHILD_ignore_test); ATF_TP_ADD_TC(tp, with_unused_non_default_IFS_test); ATF_TP_ADD_TC(tp, with_used_non_default_IFS_test); From nobody Wed Aug 13 12:02:02 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c26Rt5gXvz64kGy; Wed, 13 Aug 2025 12:02:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4c26Rt3QLBz3GXH; Wed, 13 Aug 2025 12:02:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755086522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VTinJDC/poZDbv1MKBa6HbSxO60VZAOcHtyJ85HhnPc=; b=FAyQr536sjCLZ08ADKF8xl/aF+IkVa212H1f16jRdwv+G2KxAfZR6/U9S38VGhx/dYdKik wbzjLdeEdD7Dch3OkTm9xXqd+YGh7lvviofB5xWx3frzuivmgefdPD3Gvwmh/QClbyeXe7 FrUGiG0zYHzPfKQOtMG8kt82Ybuxl/zhr1N8c2srwcN0mxwAFq/R14D9FSAWLSRkF0QFzG zJnikxOC/iI1BXbwtsK+cVbfaT7wzm6DiA3xwun/fue9QAomVLmU4lw/3yS46uuJO3GBs/ bXOR/fPj59duYsuVN4e39Nvz3sh31esqwMgSsGcaU1aUxVMJdMB5NXdUnzqJ5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755086522; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VTinJDC/poZDbv1MKBa6HbSxO60VZAOcHtyJ85HhnPc=; b=fjmwagW82O87wX8ageg5i3RCxN79NP9uztcM0wilfeJYJuhZGQa244eXk41jFB3+NSCnEM M3PtYTlVpFuXU+qW/zawW5/QjfWQwQPm8MfmBeXQqQ7LLf/E4pPuK1Qh7PgkwOHshvHBYv IwPa82HXiNztmtOu0KTD5rZB+iYFNG5XWuxwAl9bjn5STEk6wJIUIGtIRR7DVbd35SMSaL qKp26rJHmvrKt4bAXNRg9zN95r1gzWvQ4k0ShvDcxvrkdAMfwTslahfGH4GPtGEKC9qAyZ ZiBRwdbbp6VnlcdfMnaNAK6Ed4VooTcCJkXlHeYAasOCNcszQL9sc5zkGOpgww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755086522; a=rsa-sha256; cv=none; b=x5qNa6sIO+zlB7Sc6xwUULVseXCABC/uazT6ycukKIVug+l+4AojohxQKnmFXqo4eOu+Nx b9qIDeyTNCgImL9dcMfzuV2jtQffKTKXNLX5+dCzGEzUH2coeF2GtHsn5QgcSMFh28Jw9V xRHAk7SRgvA4yCZKu5bFgdYlejco88WPg9nZVYBXqrA0/qYV6A+kebwKGv3oasTQ46b0eq ReqVDj0tIsbIuDrmY7jWB+6K+ummrt7Y21unmlPmLKah2MOblcDQzY0y3OAI9ynGCaI52z ZLPrkcT+ZdEG5jq8t43+/O5zPCJlDaEelmASLGlxoe/tEJu4KxjnxJ5YY/g1AQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c26Rt2wNwz1LqB; Wed, 13 Aug 2025 12:02: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 57DC22A7010438; Wed, 13 Aug 2025 12:02:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57DC22NH010435; Wed, 13 Aug 2025 12:02:02 GMT (envelope-from git) Date: Wed, 13 Aug 2025 12:02:02 GMT Message-Id: <202508131202.57DC22NH010435@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: bc1696f189b5 - stable/14 - virtio_p9fs: Check for completions after enabling interrupts List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: bc1696f189b51bf3753ffb7097e03c9777399f84 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bc1696f189b51bf3753ffb7097e03c9777399f84 commit bc1696f189b51bf3753ffb7097e03c9777399f84 Author: Mark Johnston AuthorDate: 2024-10-25 17:52:22 +0000 Commit: Mark Johnston CommitDate: 2025-08-13 11:56:14 +0000 virtio_p9fs: Check for completions after enabling interrupts Otherwise we can end up with a lost interrupt, causing lost request completion wakeups and hangs in the filesystem layer. Continue processing until we enable interrupts and then observe an empty queue, like other virtio drivers do. Sponsored by: Klara, Inc. (cherry picked from commit 1f6f247b3526abd4d5927684735012220aefe373) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 67426a88bceb..24d4542e4e48 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -222,11 +222,15 @@ vt9p_intr_complete(void *xsc) P9_DEBUG(TRANS, "%s: completing\n", __func__); VT9P_LOCK(chan); +again: while ((curreq = virtqueue_dequeue(vq, NULL)) != NULL) { curreq->rc->tag = curreq->tc->tag; wakeup_one(curreq); } - virtqueue_enable_intr(vq); + if (virtqueue_enable_intr(vq) != 0) { + virtqueue_disable_intr(vq); + goto again; + } cv_signal(&chan->submit_cv); VT9P_UNLOCK(chan); } From nobody Wed Aug 13 12:02:03 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c26Rv5wm4z64kH0; Wed, 13 Aug 2025 12:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4c26Rv4MtMz3H0Y; Wed, 13 Aug 2025 12:02:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755086523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cLDlanbW/rJJBabeOwEGwQj+lxzU3+7GDgHT+7hLPsw=; b=aHqIMLq2aaP3kvtn4I+N0tvaq0W/A523Rn348RSjoGwZt+/3p376Pg96ATneWjHRROW98Q XND+0r/6GsJNugGSH2lKtl5dWWk1ZcLdn8lPZQN4T3nssFf2ZJvCzwaIYtldSMoNaG97bX V6Z9/enFwu8goypZ2K9wooHGIm4fG41gFtutM8XT4Ft05Nj/bhazPGPFF7gBfqpfS4L4Yq mi3e9yNSNSxtueCfgjxyEYW9bFQwIilXR1xo3Mjr9i7azetvDDxsCERpy5tRQbP5RNVRxd doz8KUSEpSE+cUj7TDGSIeIOBQD/nu9FGv65JmAFieR6NGMnT4AQFd+GIh0g7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755086523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cLDlanbW/rJJBabeOwEGwQj+lxzU3+7GDgHT+7hLPsw=; b=E3ivzjGKkZjBNh92fEIjY+jyjld4G1uFf9pY/awBmp4sqze5TU263USTBfjM+NjftcJnDG 7q08C6y6fLecP1hjlUKTBHHtwL99lNfVUW7OoTMrgBiz2+3CbcLSZGTQBnM6H/qBGjmr3T 1QUrT6s435PZQpP7v1bctjQ/15gyd9AC4lFhcrp/c7hVO5PhEP6ip3FYd6zMVYPT5HXOim 1WjzKk37jDa/ZpXmd5AOk63R/dOO0a/OKXKlc5G3NE5MjViwMVLGpMRnZw7X4/LixtcueK 1MqakMoKtf4SdKw4n5fs1KCCYyyzm20/hsudy7mfGKn5ETc97GM2saNFXMYCOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755086523; a=rsa-sha256; cv=none; b=UZVFGaqBGdT4O44BKTaa6Tk8VCjjG7tbrpecunsPX7+GLvuUU4uRfUgnrPVaps3nfA57jm 2FHLXcKpIQIywoWLVwr161xvylFvJpoeJznlgQyKGYm2KFA1wh7Z5IA4Y/1AoummWcZ7Md VLIqngGqp3m73yINcO61mEmB1pQYFzV83e5eSPYiz6P4jF9Cz4GD3o/6hnltXy8i+b3nzu gM7c4JGvdxjuTVUf9IgQ/J8hWVXh0AzVyNxIDNJy4aQ6e5A5D6v0qi/FoS7bK+J4m0st4Y LlEupDJawNU2emT1mQj/PAbIH+wGPOpvxYK0GtaAU64qQRPrBqJN7px/Y6kgRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c26Rv3vLQz1Lyn; Wed, 13 Aug 2025 12:02: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 57DC23aT010472; Wed, 13 Aug 2025 12:02:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57DC23hw010469; Wed, 13 Aug 2025 12:02:03 GMT (envelope-from git) Date: Wed, 13 Aug 2025 12:02:03 GMT Message-Id: <202508131202.57DC23hw010469@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: 52da74743361 - stable/14 - virtio_p9fs: Simplify vt9p_req_wait() a bit List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 52da74743361aee74de93052346bf1c951def73e Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=52da74743361aee74de93052346bf1c951def73e commit 52da74743361aee74de93052346bf1c951def73e Author: Mark Johnston AuthorDate: 2024-10-25 17:52:52 +0000 Commit: Mark Johnston CommitDate: 2025-08-13 11:56:21 +0000 virtio_p9fs: Simplify vt9p_req_wait() a bit Remove an always-false check for whether the request has already completed before sleeping. Even if the request is complete, the response tag is updated while holding the channel lock, which is also held here. No functional change intended. Sponsored by: Klara, Inc. (cherry picked from commit 28c9b13b236d25512cfe4e1902411ff421a14b64) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 24d4542e4e48..1d9b847717b7 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -110,20 +110,20 @@ SYSCTL_UINT(_vfs_9p, OID_AUTO, ackmaxidle, CTLFLAG_RW, &vt9p_ackmaxidle, 0, static int vt9p_req_wait(struct vt9p_softc *chan, struct p9_req_t *req) { - 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")); + KASSERT(req->tc->tag != req->rc->tag, + ("%s: request %p already completed", __func__, req)); + + if (msleep(req, VT9P_MTX(chan), 0, "chan lock", vt9p_ackmaxidle * hz)) { + /* + * 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, + ("%s spurious event on request %p", __func__, req)); return (0); } From nobody Wed Aug 13 13:20:17 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c28B960rzz64rr3; Wed, 13 Aug 2025 13:20: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 4c28B94vsgz3RKt; Wed, 13 Aug 2025 13:20:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755091217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QoPB5siIQHtDbzGTAuenFaSH/ckQ3eg1nksqBuD9EhQ=; b=DyffTxLfwKIXUuhHkmVY/cBizWDwJ1k+duXEQnSjwzdnWTsRg02ims8prK82wrjaVoR7oB j3QGXHoJwfwvC+HTHeL6cy3dFxuPOLnogcgYLBIzBdpX56f6ckdZ444usiPX6Bn3/YES2D 9rZNjmzLOdRKVnMvcNLuP2kHjbN1EkxrZ4vchJCpasZuWaq1KHQiO+Eq4dMk1boIJRrENE J8S9nqJUvpqqkb17MKVsm9rlaQqICUsSU1Z1gAlPCSwmVdMVUu74lp7JMaGYg8TVONDvpC +MyV3eC8ZOMC4Rqa0UL/Q3F4USVGkvRIEwdLWzNxXTzW8K9zAnP5ObRDFD9pkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755091217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QoPB5siIQHtDbzGTAuenFaSH/ckQ3eg1nksqBuD9EhQ=; b=FC+zNGFct4csxljWSQJuY3e25fiFbAXKFt5WDeEq1SBu6IjYakphbo5NoRxoYhYdgeur0d 1IlmFuqj5YO4rAGWnnRMv9LgLiZNTIiqsK9XNa4AxUJ9xQhRfoutxiLZm2kqj4szcHIimE 3eftTMMW0NIHre17og8YD+lV22ad5089EZ7lo+Qmn7uUazedARDtHSALOvd/QdsT3l761q geDiQ782EnM38kmMoIjki/eFwcOFJDO3OrstBiJZg26TAEgqlMVhoJ4irjG97b9xNnmnC7 YK+HSH6ntIc1nms7dOV60p4gER7HNZaopc7gT7hYxVZO+DroWnaVPFzUscX1Jg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755091217; a=rsa-sha256; cv=none; b=yWj7h9wGlRYad66SxHDZR9asXuWCdg1TtUA/XmROOfULlQuPqmSJG8Qb+TYYwn9zkFm1Hs qAj8x+A3NVed+doqCnMxOdNODjeQ3jP8DmA5aMhXaSLE5ex9GRyWmDY1BItC1+kdh2+Zxv EHgKnSYopN4gZAgk6pagNkJES33Ncu95ZAnWoNgGWfzjU285kaKQ0Fdk9ZlwsOBkDGdk75 wbErGDl/127cTTj0VElMu3qHxNmhRE/SiMyhnOjGMPCRbNUTJqXuIin4wSiK4xKLxyMpAC n7VCcsEkO3BcL2cNdF5tJD6dvIF9+NS6+YmXLyTYtY7JU7gCPanhyLUCqbi0cw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c28B94CdHz1NZB; Wed, 13 Aug 2025 13:20: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 57DDKHLb055994; Wed, 13 Aug 2025 13:20:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57DDKHNV055982; Wed, 13 Aug 2025 13:20:17 GMT (envelope-from git) Date: Wed, 13 Aug 2025 13:20:17 GMT Message-Id: <202508131320.57DDKHNV055982@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: 3d2cda366261 - stable/14 - sys/conf: Re-add -Wno-unused to ipfilter build flags List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 3d2cda366261dd7fdd10b329a4d042fe839894b5 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3d2cda366261dd7fdd10b329a4d042fe839894b5 commit 3d2cda366261dd7fdd10b329a4d042fe839894b5 Author: Mark Johnston AuthorDate: 2025-08-13 13:12:36 +0000 Commit: Mark Johnston CommitDate: 2025-08-13 13:12:36 +0000 sys/conf: Re-add -Wno-unused to ipfilter build flags This is still required on stable/14 because of the RCS tags defined at the top of each source file. This is a direct commit to stable/14. Fixes: 0947920999dc ("files: add new IPFILTER_C rule for netpfil/ipfilter sources") --- sys/conf/kern.pre.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 2eb3c166959d..ff19cd75d3ea 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -343,7 +343,7 @@ BNXT_C= ${BNXT_C_NOIMP} ${.IMPSRC} # IP Filter IPFILTER_CFLAGS= -I$S/netpfil/ipfilter -IPFILTER_C= ${NORMAL_C} ${IPFILTER_CFLAGS} +IPFILTER_C= ${NORMAL_C} -Wno-unused ${IPFILTER_CFLAGS} GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/} SYSTEM_CFILES= config.c env.c hints.c vnode_if.c From nobody Wed Aug 13 13:37:45 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c28ZK3FKlz64t92; Wed, 13 Aug 2025 13:37: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 4c28ZK2Vnsz3SwW; Wed, 13 Aug 2025 13:37:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755092265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IFF/j75GYC7olRkZSvv2sMq2tAbJhJzaDlS5ePmdSAE=; b=rPkUd9djUImFgensiaUZNaC3ZMMoIuxgrAqtgych2m/oRgolza9Wrz2f75e/aC2q7pYni2 Xw+NRSDi10cpIY0kZDz89/rdoQT/UbpbJnz8CGokV86jrua6t+ZK7T8cgcUc6wg6foPUG/ 5MzShXcbqabmH5yGeHxg4ItonXBNTs+ZC2p+yutchlFm9FQVRWftSeihULMtW7l4BsAA6A dPFB64Dj8n+wip+V/pI3BR4aZv8fuL2vVPAAcE+X21yeUR6ZY0aGPkh38ZM53osYz9u/h3 tnANfGOnpcphJ+84ERnPhMs1FB3aCzR/0r+s0m/gnJNqbGYwVwRXODYkdOKkxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755092265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IFF/j75GYC7olRkZSvv2sMq2tAbJhJzaDlS5ePmdSAE=; b=g+qZ8QxD+2i9VtmSeVRR+akD8YiN+ryqdGfvuACyXgcRPFi6hg+0sKvujViK6aMnHScQ1d 6EFhy1RmQ5OUVmJ5OAg1BZnPIvA0roMYMJ2lyD4cwmUjLz5a+XdeR9VqJ4drKJyQvLaN8R u/cf6JoLi0MknWNe9U7rZZJ3NjxN7o6ol3Fdi7p1jbFX9H2YRRUYK1pfLZ73/h4MGOuslQ /kK+EH1gE6pcxgbj6ThOOOHtxSXiKOsbdmgm6gJbtRTd+r+YhBFhxZi2ygeD/+CGAfmCFn uvYBKq1edc2EM1mQTwF/pNnT2xeGwP/TL3SihBOd7yTbWIg5EDhjlFOSinnpkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755092265; a=rsa-sha256; cv=none; b=VqiizpWdMDKe9nDa2hQ83Dwbzeq07Qr/Rn5ZwDOS8koWEHVK1O3vvTk/pyVXYexqRT5dao 3n72PkNUXQQ9xMp7FUb8iulk7UHy7tVMYIwmoVzyQ8z4urmmbSHlJJ0oqqddSDMOpEoOFE sdPkptXshbLP8cDWdtiRwl6/G4oIeFZ77ZOhcHG9Ba3E5+TG9EaCFPyZTOT6mTjYy8NNfA 7nHkJkJbVYo3id0S0Md/7uA/BLuJabt/1aSw59E8HG5NFWGljUJLg83NeCY9YDCIbben/i cC+UxEdd5WN4kilsKOrxN0ldtkzP0EKlIr3e/UvB/vHP31NuI7dS0py/1KqC1A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c28ZK1dGWz1P4y; Wed, 13 Aug 2025 13:37: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 57DDbjxm084579; Wed, 13 Aug 2025 13:37:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57DDbjvb084576; Wed, 13 Aug 2025 13:37:45 GMT (envelope-from git) Date: Wed, 13 Aug 2025 13:37:45 GMT Message-Id: <202508131337.57DDbjvb084576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d142a8a4f1ad - stable/14 - if_ovpn: fill out sin_len/sin6_len List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: d142a8a4f1ad877e22b37f691066cea7a3fa9e6a Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d142a8a4f1ad877e22b37f691066cea7a3fa9e6a commit d142a8a4f1ad877e22b37f691066cea7a3fa9e6a Author: Kristof Provost AuthorDate: 2025-07-22 12:41:20 +0000 Commit: Kristof Provost CommitDate: 2025-08-13 13:24:51 +0000 if_ovpn: fill out sin_len/sin6_len When we parse an nvlist sockaddr we should set the sockaddr_in(6)'s length field. This isn't currently used by anything yet, but it's reasonable to expect a sockaddr to contain its length. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit e83df5367d30761803e09bd7fcf518638dfe43d2) --- sys/net/if_ovpn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index 7d9c3bb9c951..54d7cbd22c81 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -363,6 +363,7 @@ ovpn_nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *sa) memset(in, 0, sizeof(*in)); in->sin_family = af; + in->sin_len = sizeof(*in); if (len != sizeof(in->sin_addr)) return (EINVAL); @@ -379,6 +380,7 @@ ovpn_nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *sa) memset(in6, 0, sizeof(*in6)); in6->sin6_family = af; + in6->sin6_len = sizeof(*in6); if (len != sizeof(in6->sin6_addr)) return (EINVAL); From nobody Wed Aug 13 13:37:46 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c28ZL5G7lz64t7L; Wed, 13 Aug 2025 13:37: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 4c28ZL2wt2z3St4; Wed, 13 Aug 2025 13:37:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755092266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rGoWmQonPj4Gfzg9/0vJVcpDzTGElFgotNcqbMXjo3Q=; b=hJW6f+3GHcDnBFC6ipsKHo5HjPvfNUP2T0xJibGSvGIA927voqHpDokCtltSmenol5HgdU Pyx+njjS8JziFSktsHyMb4ops+Xya71JQ7QXnMWmv52nbyAQRoU8pUdhyHBpPpAFzFr4Pq y6zzCUjltKikG9gDyyb53TZYTYLD8M2rp+1IYWFXcT0rB2+TA8Iu9OxiNP2qC3bSodxSj2 bMluGERQS26HxJ2UvH3bKoWgtp2oSLPXt857zLjtLXv38gS48yPaCxG69+B1fGOazMK59u HFdpMeTN414tZOJmAHmDESxX6iQ2atOjvWVmQmoDWzULVU/aFVR16k+luYWlhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755092266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rGoWmQonPj4Gfzg9/0vJVcpDzTGElFgotNcqbMXjo3Q=; b=HjoqNvklAjPptsT4jJF0mU7lo0U3gq6V4r2zvRCmBeKzh4g/DDn2pNCJSN3Ar3kZzGLd9d /ZxibtFuQbnChGcaH8OcxlmAw+YWuyX1Xitjanah0xpFEZd6CmLdaW8H+kU9JAOLI9pLUQ UKDIXzkND1wn8XjsPwYd1gtQQjks2wJIM9h0nwdSno+Yk7HHYq43IfHTa0RHG8yIyrY2sY zgDCcltM5ZXCHNAQ4RNvsoCEL8UOMjTS/PUgUyYn/ZEvM1kk3KHoUkvucbnO37ZpyHN4z5 EGlUAvTSQp5y3XMB7QqomK7otYx9guKYyER5H6+LOAzKyHZgQz34de7n163v9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755092266; a=rsa-sha256; cv=none; b=DOlZFPrASA6TjShWZY1Am1nEGJYQkYbof9lcYpOJq8KJtZu1rDCHEEOiT/1Il1/EgrB4OZ /jWqv0/oSKF4NxeoxHLliHoF5dtRMfeJHvpk3z17ssv+HLaWe7HFl1xUwsM1tX8rARUJCX Vwu/PMtkNhzgRxe/6q57rrV94+4R977pbtzcL/rsD9H+I0Y/3n9A5dsvhGhFjCyS9BrRex P7a+efGZe0afMSD0QQB2OKt/rgu2NjQ0t79IozlBjhM6TQ/8OrGztdJeBHy1VkQ3eyEdNk lMRV8UjuB45KWxcPJSQDC3FuPCcGxII8G+yBN7AXQ+ZSlZm5gWOZnDJ/ezxLWg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c28ZL210sz1NgF; Wed, 13 Aug 2025 13:37: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 57DDbk1R084616; Wed, 13 Aug 2025 13:37:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57DDbkBj084613; Wed, 13 Aug 2025 13:37:46 GMT (envelope-from git) Date: Wed, 13 Aug 2025 13:37:46 GMT Message-Id: <202508131337.57DDbkBj084613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: fc387ed68f3c - stable/14 - if_ovpn: support floating clients List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: fc387ed68f3c7b0b8da9bab13492b7bbafecb5bf Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fc387ed68f3c7b0b8da9bab13492b7bbafecb5bf commit fc387ed68f3c7b0b8da9bab13492b7bbafecb5bf Author: Kristof Provost AuthorDate: 2025-07-22 12:50:52 +0000 Commit: Kristof Provost CommitDate: 2025-08-13 13:24:52 +0000 if_ovpn: support floating clients If a client changes its IP address notify userspace of this. The UDP filtering function supplies the remote IP address, so we check if the address changed there. If so, we tag the packet with the new address. Once the packet is decrypted (and as part of that, has had its signature checked) we can commit to the address change. Take the write lock and notify userspace of the change. Reviewed by: markj MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D51468 (cherry picked from commit 9c52600a5a150117b4396df3b868cf2516e1674c) --- sys/net/if_ovpn.c | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++++- sys/net/if_ovpn.h | 1 + sys/sys/mbuf.h | 1 + 3 files changed, 194 insertions(+), 1 deletion(-) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index 54d7cbd22c81..f33218798eb4 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -133,6 +133,9 @@ struct ovpn_notification { /* Delete notification */ enum ovpn_del_reason del_reason; struct ovpn_peer_counters counters; + + /* Float notification */ + struct sockaddr_storage address; }; struct ovpn_softc; @@ -197,6 +200,10 @@ struct ovpn_softc { struct epoch_context epoch_ctx; }; +struct ovpn_mtag { + struct sockaddr_storage addr; +}; + static struct ovpn_kpeer *ovpn_find_peer(struct ovpn_softc *, uint32_t); static bool ovpn_udp_input(struct mbuf *, int, struct inpcb *, const struct sockaddr *, void *); @@ -208,6 +215,8 @@ static void ovpn_free_kkey_dir(struct ovpn_kkey_dir *); static bool ovpn_check_replay(struct ovpn_kkey_dir *, uint32_t); static int ovpn_peer_compare(const struct ovpn_kpeer *, const struct ovpn_kpeer *); +static bool ovpn_sockaddr_compare(const struct sockaddr *, + const struct sockaddr *); static RB_PROTOTYPE(ovpn_kpeers, ovpn_kpeer, tree, ovpn_peer_compare); static RB_GENERATE(ovpn_kpeers, ovpn_kpeer, tree, ovpn_peer_compare); @@ -285,6 +294,43 @@ ovpn_peer_compare(const struct ovpn_kpeer *a, const struct ovpn_kpeer *b) return (a->peerid - b->peerid); } +static bool +ovpn_sockaddr_compare(const struct sockaddr *a, + const struct sockaddr *b) +{ + if (a->sa_family != b->sa_family) + return (false); + MPASS(a->sa_len == b->sa_len); + + switch (a->sa_family) { + case AF_INET: { + const struct sockaddr_in *a4, *b4; + + a4 = (const struct sockaddr_in *)a; + b4 = (const struct sockaddr_in *)b; + + if (a4->sin_port != b4->sin_port) + return (false); + + return (a4->sin_addr.s_addr == b4->sin_addr.s_addr); + } + case AF_INET6: { + const struct sockaddr_in6 *a6, *b6; + + a6 = (const struct sockaddr_in6 *)a; + b6 = (const struct sockaddr_in6 *)b; + + if (a6->sin6_port != b6->sin6_port) + return (false); + + return (memcmp(&a6->sin6_addr, &b6->sin6_addr, + sizeof(a6->sin6_addr)) == 0); + } + default: + panic("Unknown address family %d", a->sa_family); + } +} + static struct ovpn_kpeer * ovpn_find_peer(struct ovpn_softc *sc, uint32_t peerid) { @@ -427,6 +473,44 @@ ovpn_rele_so(struct ovpn_softc *sc, struct ovpn_kpeer *peer) sc->so = NULL; } +static int +ovpn_add_sockaddr(nvlist_t *parent, const char *name, const struct sockaddr *s) +{ + nvlist_t *nvl; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (ENOMEM); + + nvlist_add_number(nvl, "af", s->sa_family); + + switch (s->sa_family) { + case AF_INET: { + const struct sockaddr_in *s4 = (const struct sockaddr_in *)s; + + nvlist_add_number(nvl, "port", s4->sin_port); + nvlist_add_binary(nvl, "address", &s4->sin_addr, + sizeof(s4->sin_addr)); + break; + } + case AF_INET6: { + const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *)s; + + nvlist_add_number(nvl, "port", s6->sin6_port); + nvlist_add_binary(nvl, "address", &s6->sin6_addr, + sizeof(s6->sin6_addr)); + break; + } + default: + nvlist_destroy(nvl); + return (EINVAL); + } + + nvlist_move_nvlist(parent, name, nvl); + + return (0); +} + static void ovpn_notify_del_peer(struct ovpn_softc *sc, struct ovpn_kpeer *peer) { @@ -479,6 +563,33 @@ ovpn_notify_key_rotation(struct ovpn_softc *sc, struct ovpn_kpeer *peer) } } +static int +ovpn_notify_float(struct ovpn_softc *sc, uint32_t peerid, + const struct sockaddr_storage *remote) +{ + struct ovpn_notification *n; + + n = malloc(sizeof(*n), M_OVPN, M_NOWAIT | M_ZERO); + if (n == NULL) + return (ENOMEM); + + n->peerid = peerid; + n->type = OVPN_NOTIF_FLOAT; + memcpy(&n->address, remote, sizeof(n->address)); + + if (buf_ring_enqueue(sc->notifring, n) != 0) { + free(n, M_OVPN); + return (ENOMEM); + } else if (sc->so != NULL) { + /* Wake up userspace */ + sc->so->so_error = EAGAIN; + sorwakeup(sc->so); + sowwakeup(sc->so); + } + + return (0); +} + static void ovpn_peer_release_ref(struct ovpn_kpeer *peer, bool locked) { @@ -1416,12 +1527,36 @@ opvn_get_pkt(struct ovpn_softc *sc, nvlist_t **onvl) } nvlist_add_number(nvl, "peerid", n->peerid); nvlist_add_number(nvl, "notification", n->type); - if (n->type == OVPN_NOTIF_DEL_PEER) { + switch (n->type) { + case OVPN_NOTIF_DEL_PEER: { nvlist_add_number(nvl, "del_reason", n->del_reason); /* No error handling, because we want to send the notification * even if we can't attach the counters. */ ovpn_notif_add_counters(nvl, n); + break; + } + case OVPN_NOTIF_FLOAT: { + int ret; + + ret = ovpn_add_sockaddr(nvl, "address", + (struct sockaddr *)&n->address); + + if (ret) { + /* + * Try to re-enqueue the notification. Maybe we'll + * have better luck next time. No error handling, + * because if we fail to re-enqueue there's nothing we can do. + */ + (void)ovpn_notify_float(sc, n->peerid, &n->address); + nvlist_destroy(nvl); + free(n, M_OVPN); + return (ret); + } + break; + } + default: + break; } free(n, M_OVPN); @@ -1577,6 +1712,7 @@ ovpn_finish_rx(struct ovpn_softc *sc, struct mbuf *m, struct rm_priotracker *_ovpn_lock_trackerp) { uint32_t af; + struct m_tag *mtag; OVPN_RASSERT(sc); NET_EPOCH_ASSERT(); @@ -1595,6 +1731,38 @@ ovpn_finish_rx(struct ovpn_softc *sc, struct mbuf *m, OVPN_RUNLOCK(sc); + /* Check if the peer changed to a new source address. */ + mtag = m_tag_find(m, PACKET_TAG_OVPN, NULL); + if (mtag != NULL) { + struct ovpn_mtag *ot = (struct ovpn_mtag *)(mtag + 1); + + OVPN_WLOCK(sc); + + /* + * Check the address against the peer's remote again, because we may race + * against ourselves (i.e. we may have tagged multiple packets to indicate we + * floated). + */ + if (ovpn_sockaddr_compare((struct sockaddr *)&ot->addr, + (struct sockaddr *)&peer->remote)) { + OVPN_WUNLOCK(sc); + goto skip_float; + } + + /* And notify userspace. */ + if (ovpn_notify_float(sc, peer->peerid, &ot->addr) == 0) { + /* + * Update the 'remote' for this peer, but only if + * we've actually enqueued the notification. + * Otherwise we can try again later. + */ + memcpy(&peer->remote, &ot->addr, sizeof(peer->remote)); + } + + OVPN_WUNLOCK(sc); + } + +skip_float: OVPN_COUNTER_ADD(sc, received_data_pkts, 1); OVPN_COUNTER_ADD(sc, tunnel_bytes_received, m->m_pkthdr.len); OVPN_PEER_COUNTER_ADD(peer, pkt_in, 1); @@ -2357,6 +2525,29 @@ ovpn_udp_input(struct mbuf *m, int off, struct inpcb *inp, return (true); } + /* + * If we got this from a different address than we expected tag the packet. + * We'll deal with notifiying userspace later, after we've decrypted and + * verified. + */ + if (! ovpn_sockaddr_compare((struct sockaddr *)&peer->remote, sa)) { + struct m_tag *mt; + struct ovpn_mtag *ot; + + MPASS(sa->sa_len <= sizeof(ot->addr)); + mt = m_tag_get(PACKET_TAG_OVPN, sizeof(*ot), M_NOWAIT); + /* + * If we fail to allocate here we'll just try again on the next + * packet. + */ + if (mt != NULL) { + ot = (struct ovpn_mtag *)(mt + 1); + memcpy(&ot->addr, sa, sa->sa_len); + + m_tag_prepend(m, mt); + } + } + if (key->decrypt->cipher == OVPN_CIPHER_ALG_NONE) { /* Now remove the outer headers */ m_adj_decap(m, sizeof(struct udphdr) + ohdrlen); diff --git a/sys/net/if_ovpn.h b/sys/net/if_ovpn.h index 2d6b8c1e7eff..2a24c35788a9 100644 --- a/sys/net/if_ovpn.h +++ b/sys/net/if_ovpn.h @@ -37,6 +37,7 @@ enum ovpn_notif_type { OVPN_NOTIF_DEL_PEER, OVPN_NOTIF_ROTATE_KEY, + OVPN_NOTIF_FLOAT, }; enum ovpn_del_reason { diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 65a328cb52a1..41da07fa77f9 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1390,6 +1390,7 @@ extern bool mb_use_ext_pgs; /* Use ext_pgs for sendfile */ #define PACKET_TAG_IPSEC_NAT_T_PORTS 29 /* two uint16_t */ #define PACKET_TAG_ND_OUTGOING 30 /* ND outgoing */ #define PACKET_TAG_PF_REASSEMBLED 31 +#define PACKET_TAG_OVPN 34 /* if_ovpn */ /* Specific cookies and tags. */ From nobody Wed Aug 13 13:37:47 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c28ZM5CXZz64tFM; Wed, 13 Aug 2025 13:37: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 4c28ZM3RSVz3SrB; Wed, 13 Aug 2025 13:37:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755092267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s6cVzLAp0Cca2F5jYsb3X5AqFS/AZM01qoMPgINvMQ4=; b=UN+ED5BJLpb/+XtX5vaj8C35yee+vnnBYlVXwULfyRa+0yOZHzSks8zC315XJNRoiKwWNk 3zCDNLdwIfAa7DpT2WEm29+6AB8u561n0zXMJXElLIEFPVqTWBYOYQK8Dauu8/SecmgkpF Z17dSlwcDdkCD3YXhVGI1mXWUoguI916yXlhrCwT9z2MPFIUpCibfJiVTJocsUqrXNT0xN 1NvgtylaSvzqQtcQ+ONhsKtTeAEGs+z3kvVQmzI5ePFC8hw/lH+OrLwGKU9PMgqTKbDiv0 gv8/bTbKWZ7DfkI3l7p0MHnUXkPqzG7t9fKkCn/41FPb7U0NeIJsiByBz7stkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755092267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s6cVzLAp0Cca2F5jYsb3X5AqFS/AZM01qoMPgINvMQ4=; b=oqraS+tu1F6W2Nm2zYsDi+mvBzxa9czUhOvh4wROiVfetVjpo2sPhbwmt3JmcQTjF550ww 1aphIm+oelkfu32tBSjdgTdVW2N2yHmugidR+aR1hoE3xlflFttz9ISWKgP8HDxprLnvZX 2B/JNJE0FK79ZWq0ir6u0BvzC8f4C9aoYj6/7X13hOC0vwdXphZVKu0Mg7Pj8AMG116mv4 Gb038mOFv8tjJB2UgnQgCZqkEm3qIri5urwt/UyBKcZZ2iC83KDJAKMvRBCBfa5VmWl8N4 24RcfpQNJI6FzTtlf8N+MIb0NDyoZU8sSGk47gik2CGjjE4NutVCm0b2kmna9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755092267; a=rsa-sha256; cv=none; b=K5SGJOa3FGDRPz0Uiuacaard0qALAtJhH72nK9Ox6sac7MiOeIn402qEAAUkzkVLSWHGlU isdOHALLEEY2cS6rKhSi419s/vsXG++gWyZyNxWK1EBoJk6KzFG33AkOygo6uAsY0egoaM s6VE3VLlhc3gcBQ5XvLB61J80z4LhgW49SPayAMmpSy/PXDk7ZKLgJ5zSYQ6oUui9EKTMX WphifIi4rkLq/oRhgUmzlnqPulZJ0vMPJeRpBnoA4feNGPC0PaSJAaGLROVe4z7sMeBGrv YXqGzS5Y6pR34FNP3mdcDp631uHhJPSJceM6nOesLgT5bBMAJuWMoHjElCZ3sA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c28ZM2yjlz1Nvd; Wed, 13 Aug 2025 13:37: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 57DDblmb084649; Wed, 13 Aug 2025 13:37:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57DDbl9K084646; Wed, 13 Aug 2025 13:37:47 GMT (envelope-from git) Date: Wed, 13 Aug 2025 13:37:47 GMT Message-Id: <202508131337.57DDbl9K084646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a0e5fe32d969 - stable/14 - if_ovpn tests: basic float test case List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: a0e5fe32d969c7775da4b16f8ecfa93378f589d4 Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a0e5fe32d969c7775da4b16f8ecfa93378f589d4 commit a0e5fe32d969c7775da4b16f8ecfa93378f589d4 Author: Kristof Provost AuthorDate: 2025-07-22 16:20:56 +0000 Commit: Kristof Provost CommitDate: 2025-08-13 13:24:52 +0000 if_ovpn tests: basic float test case Reviewed by: markj MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D51469 (cherry picked from commit ad1b5df8884c0fd7d265526a4980c1fd9c67fb90) --- tests/sys/net/if_ovpn/if_ovpn.sh | 91 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh index c7e2f928e340..26a81ea9100c 100644 --- a/tests/sys/net/if_ovpn/if_ovpn.sh +++ b/tests/sys/net/if_ovpn/if_ovpn.sh @@ -1280,6 +1280,96 @@ multihome6_cleanup() ovpn_cleanup } +atf_test_case "float" "cleanup" +float_head() +{ + atf_set descr 'Test peer float notification' + atf_set require.user root +} + +float_body() +{ + ovpn_init + + l=$(vnet_mkepair) + + vnet_mkjail a ${l}a + jexec a ifconfig ${l}a 192.0.2.1/24 up + jexec a ifconfig lo0 127.0.0.1/8 up + vnet_mkjail b ${l}b + jexec b ifconfig ${l}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore jexec a ping -c 1 192.0.2.2 + + ovpn_start a " + dev ovpn0 + dev-type tun + proto udp4 + + cipher AES-256-GCM + auth SHA256 + + local 192.0.2.1 + server 198.51.100.0 255.255.255.0 + ca $(atf_get_srcdir)/ca.crt + cert $(atf_get_srcdir)/server.crt + key $(atf_get_srcdir)/server.key + dh $(atf_get_srcdir)/dh.pem + + mode server + script-security 2 + auth-user-pass-verify /usr/bin/true via-env + topology subnet + + keepalive 2 10 + + management 192.0.2.1 1234 + " + ovpn_start b " + dev tun0 + dev-type tun + + client + + remote 192.0.2.1 + auth-user-pass $(atf_get_srcdir)/user.pass + + ca $(atf_get_srcdir)/ca.crt + cert $(atf_get_srcdir)/client.crt + key $(atf_get_srcdir)/client.key + dh $(atf_get_srcdir)/dh.pem + + keepalive 2 10 + " + + # Give the tunnel time to come up + sleep 10 + + atf_check -s exit:0 -o ignore jexec b ping -c 3 198.51.100.1 + + # We expect the client on 192.0.2.2 + if ! echo "status" | jexec a nc -N 192.0.2.1 1234 | grep 192.0.2.2; then + atf_fail "Client not found in status list!" + fi + + # Now change the client IP + jexec b ifconfig ${l}b 192.0.2.3/24 up + + # And wait for keepalives to trigger the float notification + sleep 5 + + # So the client now has the new address in userspace + if ! echo "status" | jexec a nc -N 192.0.2.1 1234 | grep 192.0.2.3; then + atf_fail "Client not found in status list!" + fi +} + +float_cleanup() +{ + ovpn_cleanup +} + atf_init_test_cases() { atf_add_test_case "4in4" @@ -1297,4 +1387,5 @@ atf_init_test_cases() atf_add_test_case "gcm_128" atf_add_test_case "multihome4" atf_add_test_case "multihome6" + atf_add_test_case "float" } From nobody Wed Aug 13 13:37:48 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c28ZQ0l3Lz64t7M; Wed, 13 Aug 2025 13:37: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 4c28ZN3p26z3SpK; Wed, 13 Aug 2025 13:37:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755092268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2XXzMamVtf76yysEpvKi1XndbzNHXmZxodWzXgoZRUU=; b=S8N8/HZcsGJu47O2fvafBlp1bULjApmxMxLkz9+PF8mv8QQ3hNc1sKzfffmWqmqYWltzxe EsE3QcMqmjCdcSr5Zy7zn6QC3/yEwXBHG6yUVrPoMDPye81X7LBdVYJgrlO3OHm3XS5xFy 5QQYMud3OES1BPj+I6Dk5AIIqUZEX5bNTG7w1HNjgSLT8BecZfqnh+WetsMH4ibUY77cak Ej7eODRrQv+0Z7rPVnSeMzYYIQ3bKY+QVLhn6EB5ZvkaUgE8dawhfKeVk+nSN3aRWPPZK2 qs5H6TCHiFu93f43BKvolmMD08VWmdfYWzBrMJ2etWsA+dTSc5BY6FvA3tBmOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755092268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2XXzMamVtf76yysEpvKi1XndbzNHXmZxodWzXgoZRUU=; b=UsTaEsD0JyhSCiFU1tA+sPjSHzCY5QgS4sUyUV1CPbvKkyBxrK3S5t4jkCn1Nj+RHw7QBM OOYk+0txHxkmdQqwCsWKsGgk0RrDcHtQHWOgPWlj/rKBrMkgkNDcK7WmO2pB421xJ8tV1Z dq0Se/MwWLsYeV3zLDbiwTLYThZMXa6z76g2us/ZZ/8Bk0FtoANrnkQrLEsU96FGB9bkbm KJW/gtVg2lJyG2tIFir1E7jxK5TZmfX4rWrTnv4vEwbfUsd1Fjg/6CGadbQuKUWcrt3Es3 dZTjtV9i+NSrzfX+2erF7DSWk3+U+FnfUHJ9cbEaq4gthLmpt9XgeoISBES9bA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755092268; a=rsa-sha256; cv=none; b=HckaSRn6XiCtUiKgqxUM5RAcN+rti0mfIQSs+9bFhaXAq7H7J5gPD7f0CZb5xlmgvrLeWn jkJ5hv7a0HFCJuzpAYd5EwXXDRrKHzeJakNdce7f39wM6ZakZiZRscKxfShSNafJpSkXkH tfhUCJH9SRMX2eQTwJtFPIP+RG80TqDEy7Homb4E4+Yg3W9HeJBeTdUx6eWDk3bnygP779 ZzmxNs/Q+WiPwuei5B0FBuk2J7W3XtdSya6vMfg8V+BRmrUDdy5Ge/qQR2gfUSg5zmzEXq PSb5lTmoDVuQyHECvpK3mxcJreDFgULuW15ANmZNN1+AgSCp5mDree1rtffNvg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c28ZN3LWMz1NgG; Wed, 13 Aug 2025 13:37: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 57DDbmVR084689; Wed, 13 Aug 2025 13:37:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57DDbmpW084686; Wed, 13 Aug 2025 13:37:48 GMT (envelope-from git) Date: Wed, 13 Aug 2025 13:37:48 GMT Message-Id: <202508131337.57DDbmpW084686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d60022f3c24e - stable/14 - if_ovpn: support IPv6 link-local addresses List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: d60022f3c24ea32acd1d2fb9cc583cc095bb2a60 Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d60022f3c24ea32acd1d2fb9cc583cc095bb2a60 commit d60022f3c24ea32acd1d2fb9cc583cc095bb2a60 Author: Kristof Provost AuthorDate: 2025-07-28 11:36:35 +0000 Commit: Kristof Provost CommitDate: 2025-08-13 13:24:52 +0000 if_ovpn: support IPv6 link-local addresses MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D51596 (cherry picked from commit 60e92d17cfeba02bc3c7a6edfa0bcaf7c63e5f35) --- sys/net/if_ovpn.c | 21 ++++++++++- tests/sys/net/if_ovpn/if_ovpn.sh | 76 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index f33218798eb4..13e6db2764fb 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -322,6 +322,8 @@ ovpn_sockaddr_compare(const struct sockaddr *a, if (a6->sin6_port != b6->sin6_port) return (false); + if (a6->sin6_scope_id != b6->sin6_scope_id) + return (false); return (memcmp(&a6->sin6_addr, &b6->sin6_addr, sizeof(a6->sin6_addr)) == 0); @@ -392,6 +394,8 @@ ovpn_nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *sa) { int af; + memset(sa, 0, sizeof(*sa)); + if (! nvlist_exists_number(nvl, "af")) return (EINVAL); if (! nvlist_exists_binary(nvl, "address")) @@ -432,6 +436,10 @@ ovpn_nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *sa) memcpy(&in6->sin6_addr, addr, sizeof(in6->sin6_addr)); in6->sin6_port = nvlist_get_number(nvl, "port"); + + if (nvlist_exists_number(nvl, "scopeid")) + in6->sin6_scope_id = nvlist_get_number(nvl, "scopeid"); + break; } #endif @@ -499,6 +507,7 @@ ovpn_add_sockaddr(nvlist_t *parent, const char *name, const struct sockaddr *s) nvlist_add_number(nvl, "port", s6->sin6_port); nvlist_add_binary(nvl, "address", &s6->sin6_addr, sizeof(s6->sin6_addr)); + nvlist_add_number(nvl, "scopeid", s6->sin6_scope_id); break; } default: @@ -761,7 +770,8 @@ ovpn_new_peer(struct ifnet *ifp, const nvlist_t *nvl) NET_EPOCH_ENTER(et); ret = in6_selectsrc_addr(curthread->td_proc->p_fibnum, &TO_IN6(&peer->remote)->sin6_addr, - 0, NULL, &TO_IN6(&peer->local)->sin6_addr, NULL); + TO_IN6(&peer->remote)->sin6_scope_id, NULL, + &TO_IN6(&peer->local)->sin6_addr, NULL); NET_EPOCH_EXIT(et); if (ret != 0) { goto error; @@ -2312,6 +2322,15 @@ ovpn_encap(struct ovpn_softc *sc, uint32_t peerid, struct mbuf *m) memcpy(&ip6->ip6_dst, &in6_remote->sin6_addr, sizeof(ip6->ip6_dst)); + if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src)) { + /* Local and remote must have the same scope. */ + ip6->ip6_src.__u6_addr.__u6_addr16[1] = + htons(in6_remote->sin6_scope_id & 0xffff); + } + if (IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) + ip6->ip6_dst.__u6_addr.__u6_addr16[1] = + htons(in6_remote->sin6_scope_id & 0xffff); + udp = mtodo(m, sizeof(*ip6)); udp->uh_sum = in6_cksum_pseudo(ip6, m->m_pkthdr.len - sizeof(struct ip6_hdr), diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh index 26a81ea9100c..0d5dbb908c30 100644 --- a/tests/sys/net/if_ovpn/if_ovpn.sh +++ b/tests/sys/net/if_ovpn/if_ovpn.sh @@ -481,6 +481,81 @@ atf_test_case "6in6" "cleanup" ovpn_cleanup } +atf_test_case "linklocal" "cleanup" +linklocal_head() +{ + atf_set descr 'Use IPv6 link-local addresses' + atf_set require.user root + atf_set require.progs openvpn +} + +linklocal_body() +{ + ovpn_init + + l=$(vnet_mkepair) + + vnet_mkjail a ${l}a + jexec a ifconfig ${l}a inet6 fe80::a/64 up no_dad + vnet_mkjail b ${l}b + jexec b ifconfig ${l}b inet6 fe80::b/64 up no_dad + + # Sanity check + atf_check -s exit:0 -o ignore jexec a ping6 -c 1 fe80::b%${l}a + + ovpn_start a " + dev ovpn0 + dev-type tun + proto udp6 + + cipher AES-256-GCM + auth SHA256 + + local fe80::a%${l}a + server-ipv6 2001:db8:1::/64 + + ca $(atf_get_srcdir)/ca.crt + cert $(atf_get_srcdir)/server.crt + key $(atf_get_srcdir)/server.key + dh $(atf_get_srcdir)/dh.pem + + mode server + script-security 2 + auth-user-pass-verify /usr/bin/true via-env + topology subnet + + keepalive 100 600 + " + ovpn_start b " + dev tun0 + dev-type tun + + client + + remote fe80::a%${l}b + auth-user-pass $(atf_get_srcdir)/user.pass + + ca $(atf_get_srcdir)/ca.crt + cert $(atf_get_srcdir)/client.crt + key $(atf_get_srcdir)/client.key + dh $(atf_get_srcdir)/dh.pem + + keepalive 100 600 + " + + # Give the tunnel time to come up + sleep 10 + jexec a ifconfig + + atf_check -s exit:0 -o ignore jexec b ping6 -c 3 2001:db8:1::1 + atf_check -s exit:0 -o ignore jexec b ping6 -c 3 -z 16 2001:db8:1::1 +} + +linklocal_cleanup() +{ + ovpn_cleanup +} + atf_test_case "timeout_client" "cleanup" timeout_client_head() { @@ -1378,6 +1453,7 @@ atf_init_test_cases() atf_add_test_case "6in4" atf_add_test_case "6in6" atf_add_test_case "4in6" + atf_add_test_case "linklocal" atf_add_test_case "timeout_client" atf_add_test_case "explicit_exit" atf_add_test_case "multi_client" From nobody Wed Aug 13 19:22:00 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2JCY09fVz64PCR; Wed, 13 Aug 2025 19:22: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 4c2JCX3g5Sz3GdJ; Wed, 13 Aug 2025 19:22:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755112920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hGwHb+pu8zi+vqdQLpJEasBRzBPGWL+2M76aFMgw9Es=; b=b4ainddmwL0gBMutPijL4dQ7PQx5l0zXLJyPKnj2ZesK2/H0sKV7IwFtcizJOlhigopdJB 9TmZIQR1JZxpJ+e8Vv/p90LlapK1GeBspr1BnuC23ZMHPUssPWxeE3EitbPUQoBYoqGx0i 00fKC4NLPzxJ9Och022VJ0ZDXXHsVrNE0OnuARrb5E1K3BHEGEFsHvIl/utlgYoGJBem2a WMnE9ykwlyLtkxL4CUipdo64H50HMtYbiLB+W1nJi9asDP+NOSJS4vvr2Ei5NQ1h4DaxIn hX8gyDhOfkW9iAj6rF+CKhqj5kAl/E7OOdrrYp2e9OpSgWlZ22FXqYmy+EG04g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755112920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hGwHb+pu8zi+vqdQLpJEasBRzBPGWL+2M76aFMgw9Es=; b=T1jFa8HhtBctHoZ5ZfzmkwmVXXJPjf72psjbTvEAa7XP4qR2y753lctlbePn/4R/pbjPkM OkkNvACIIxKM6O5cYF6lU6KC3l7GQdQQNs+jAw10WH2ADW+ik3MuVEL38ioq0nz+GZ6OJF 9v20FeLV01XwlOxXKZiYQpxa3CREvduDIN6vreP5jZy6CpQmt/E9dVHOWAyEALSCMBw3AD wC3jqI1S95kvY73I2EQNPH6w1LkvJ3fLj1DrzV4g8Cv4qAxeEz5+nPe2FRCqJ7z2vKHmi7 V8vUjbVqhsMckF+v7toytQKhcn7FRDq5vaiEdQgguxe1GzOtPz4O1NMYDqvbug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755112920; a=rsa-sha256; cv=none; b=frOMXey4AUykQtQnjc4YPH6ZpVhzGWxHMCThNlfT1WdBlxWsnhFtagQz0ctjTMDGHx9qoG SMflzsipb0Spl75HcDyes/Uw5ZcOlevkUIDXnQwDFEIENMHx6Kpmjb0D7sGyhta2KF/W2K BkkPL56JNq/gAzJqiyCJXfLBtJLsWnz1I6gMoVIZCdlXo3uMt7IFdjYiLFcEXpl0g9XLbr 82YOAyQVL8YRlAwotDIaGvAxg5+d9YrelSHyaTEGCq+bUA/GGlnFCUiCp+o6mo5KJDLf1z l6gkLP16CGG9ygzunYTipjyGDUAQQZuEIRwRCys29tsBEsl7fved6aWJBSOkvg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2JCX2ZWbz59f; Wed, 13 Aug 2025 19:22: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 57DJM0vA042430; Wed, 13 Aug 2025 19:22:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57DJM0vH042426; Wed, 13 Aug 2025 19:22:00 GMT (envelope-from git) Date: Wed, 13 Aug 2025 19:22:00 GMT Message-Id: <202508131922.57DJM0vH042426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 7b9f6ebb9268 - stable/14 - tcp: ensure SACK rxmit never ends up left of its hole List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 7b9f6ebb9268defdfa4403abdf4b12282110f4c8 Auto-Submitted: auto-generated The branch stable/14 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=7b9f6ebb9268defdfa4403abdf4b12282110f4c8 commit 7b9f6ebb9268defdfa4403abdf4b12282110f4c8 Author: Richard Scheffenegger AuthorDate: 2025-08-06 20:25:30 +0000 Commit: Richard Scheffenegger CommitDate: 2025-08-13 19:19:25 +0000 tcp: ensure SACK rxmit never ends up left of its hole When a RTO happens during SACK loss recovery, snd_recover can possibly pulled left. With Lost Retransmission Detection (LRD) this can lead to rxmit of a hole to end up pointing to the left of the hole, which is unexpected and leads to complications. Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51725 (cherry picked from commit 65d4a83399843cb4c6dd44061599390843c162db) --- sys/netinet/tcp_output.c | 2 +- sys/netinet/tcp_sack.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 9855083b579a..a8e2a18f72da 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1255,7 +1255,7 @@ send: * fack acks recoverypoint. */ if ((tp->t_flags & TF_LRD) && SEQ_GEQ(p->rxmit, p->end)) - p->rxmit = tp->snd_recover; + p->rxmit = SEQ_MAX(p->rxmit, tp->snd_recover); tp->sackhint.sack_bytes_rexmit += len; } if (IN_RECOVERY(tp->t_flags)) { diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index f33c7030f21e..cc02263512da 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -770,7 +770,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) cur->end = sblkp->start; cur->rxmit = SEQ_MIN(cur->rxmit, cur->end); if ((tp->t_flags & TF_LRD) && SEQ_GEQ(cur->rxmit, cur->end)) - cur->rxmit = tp->snd_recover; + cur->rxmit = SEQ_MAX(cur->rxmit, tp->snd_recover); } else { /* * ACKs some data in middle of a hole; need @@ -790,7 +790,7 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) cur->rxmit = SEQ_MIN(cur->rxmit, cur->end); if ((tp->t_flags & TF_LRD) && SEQ_GEQ(cur->rxmit, cur->end)) - cur->rxmit = tp->snd_recover; + cur->rxmit = SEQ_MAX(cur->rxmit, tp->snd_recover); delivered_data += (sblkp->end - sblkp->start); } } From nobody Thu Aug 14 13:47:37 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2mlG3CWdz64TZW; Thu, 14 Aug 2025 13:47: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 4c2mlG2DWDz4Jfd; Thu, 14 Aug 2025 13:47:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755179258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UaXBzrPnXjze7gAjXHrzqGMnEPN2OmKnBWUop58AdDc=; b=nVb2sdkWL5kFpqaH7naSbOBJpmKM2J7TrxqVrrv9luE8S5wZjyiJ0oUNxQEFqBMXqYAzQJ NLrmCL7aeKGxdS7DjZm0p54Df2Sdj4qFo4agqbnHYmlQVH6ZqQcqzLlXh9QIZOgbQR2Ys6 JJARFvGhQGppZVPYZddb5v2/o1ZCvu6P0RVBtZP9T7P9PAtAFbsIMTJfHFMI7i922FfRw3 uEU8Z+Yd/Rq00u4DUbQ/o0m0cRglm80RwW1qcevmwawBn0eCoMKwApAKoBWTyhwtzD/jO1 ibfo784d8hQ151ZNvIImEnIY+OwkTxwxCKlLvWu2dnRAQmedoyVyEZt9ckzJxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755179258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UaXBzrPnXjze7gAjXHrzqGMnEPN2OmKnBWUop58AdDc=; b=Syw1nnsOn2TEGJF+h06oSrlR3/7lvmJfTTCy7v0Ht+4XTp6jDHVaKHgOw7D5okftlean0k N6gGlVoD9Jf/IHCi8JT4KD0QoGJIBEe8T5k2f6rD07/WtYhmveWwBoIyhokoq5IG1TS9Vb yW654UR84YDx1+/wR5Z7smEOzo9Bh0Vhl05y5HImsCOFoZx+NFI5+MJ5SzvwsjRDUxk8t2 cEv/H957hC3M4NfbD7rHsi5LiZZxBTY5xcG6SPSlIPgeQ/OlD/2gYPBmp8QYATuz36cuBA eEwwWgQwPfMt6/D1omzuDwUnZaRa/oAWkEGBs7ThwknZOmnvRgXjcb2MFx4GYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755179258; a=rsa-sha256; cv=none; b=y0VOdsmhBXAqvzS1GRAJ2RIIo5ieXm7AqK9XtMdyg+OqIffCJai3HfTDF5xuDqIQLtctsf QRZ7+z0A7pBu/OkXfJFcjINuIrYZ6hsbecA+s70WHAgwnbbBPsXs13J3sgVXm2Rr3CRsVn QifLhoh0E675YgGf+s1NjAvsXuyq7iPC6YYGVxXtEkWXK2WZlX+bysHUQzmkfe+jAtX3I6 XmAxAiFrpKNKi2T5S9bUVU/4Nxm/OfAvFpOSCFi+iGroG10hPK0mAbVgehJ736ojRQfy98 Ff607oiCdSMyVbN5PYCOPMTc8LK2ZXRlgOqDekrEqZOQGlYP+I9ksu/NhXkYhg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2mlG19BGzvhv; Thu, 14 Aug 2025 13:47: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 57EDlb6P017078; Thu, 14 Aug 2025 13:47:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EDlbQF017075; Thu, 14 Aug 2025 13:47:37 GMT (envelope-from git) Date: Thu, 14 Aug 2025 13:47:37 GMT Message-Id: <202508141347.57EDlbQF017075@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: e71d494c600e - stable/14 - aio: Fix a race in sys_aio_cancel() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: e71d494c600e7cd6433f498a2ec9929ef98879fc Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e71d494c600e7cd6433f498a2ec9929ef98879fc commit e71d494c600e7cd6433f498a2ec9929ef98879fc Author: Mark Johnston AuthorDate: 2025-07-29 14:46:53 +0000 Commit: Mark Johnston CommitDate: 2025-08-14 12:45:59 +0000 aio: Fix a race in sys_aio_cancel() sys_aio_cancel() loops over pending jobs for the process, cancelling some of them. To cancel a job with a cancel callback, it must drop the job list mutex. It uses flags, KAIOCB_CANCELLING and KAIOCB_CANCELLED, to make sure that a job isn't double-cancelled. However, when iterating over the list it uses TAILQ_FOREACH_SAFE and thus assumes that the next job isn't going to be removed while the lock is dropped. Of course, this assumption is false. We could simply start search from the beginning after cancelling a job, but that might be quite expensive. Instead, introduce the notion of a marker job, used to keep track of one's position in the queue. Use it in sys_aio_cancel() to resume iteration after a job is cancelled. Reported by: syzkaller Reviewed by: kib, jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51626 (cherry picked from commit 2dde3bed347ab46685d079c2fcc1dbd1fa149286) --- sys/kern/vfs_aio.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index a14865f6b20c..8842d8409e01 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -229,6 +229,7 @@ typedef struct oaiocb { #define KAIOCB_CHECKSYNC 0x08 #define KAIOCB_CLEARED 0x10 #define KAIOCB_FINISHED 0x20 +#define KAIOCB_MARKER 0x40 /* ioflags */ #define KAIOCB_IO_FOFFSET 0x01 @@ -593,6 +594,12 @@ aio_cancel_job(struct proc *p, struct kaioinfo *ki, struct kaiocb *job) int cancelled; AIO_LOCK_ASSERT(ki, MA_OWNED); + + /* + * If we're running down the queue, the process must be single-threaded, + * and so no markers should be present. + */ + MPASS((job->jobflags & KAIOCB_MARKER) == 0); if (job->jobflags & (KAIOCB_CANCELLED | KAIOCB_FINISHED)) return (0); MPASS((job->jobflags & KAIOCB_CANCELLING) == 0); @@ -667,7 +674,7 @@ restart: } /* Wait for all running I/O to be finished */ - if (TAILQ_FIRST(&ki->kaio_jobqueue) || ki->kaio_active_count != 0) { + if (!TAILQ_EMPTY(&ki->kaio_jobqueue) || ki->kaio_active_count != 0) { ki->kaio_flags |= KAIO_WAKEUP; msleep(&p->p_aioinfo, AIO_MTX(ki), PRIBIO, "aioprn", hz); goto restart; @@ -1832,6 +1839,8 @@ aio_queue_file(struct file *fp, struct kaiocb *job) } else if (job->uaiocb.aio_lio_opcode & LIO_SYNC) { AIO_LOCK(ki); TAILQ_FOREACH(job2, &ki->kaio_jobqueue, plist) { + if ((job2->jobflags & KAIOCB_MARKER) != 0) + continue; if (job2->fd_file == job->fd_file && ((job2->uaiocb.aio_lio_opcode & LIO_SYNC) == 0) && job2->seqno < job->seqno) { @@ -2061,7 +2070,7 @@ sys_aio_cancel(struct thread *td, struct aio_cancel_args *uap) { struct proc *p = td->td_proc; struct kaioinfo *ki; - struct kaiocb *job, *jobn; + struct kaiocb *job, *jobn, marker; struct file *fp; int error; int cancelled = 0; @@ -2086,16 +2095,30 @@ sys_aio_cancel(struct thread *td, struct aio_cancel_args *uap) } } + /* + * We may have to drop the list mutex in order to cancel a job. After + * that point it is unsafe to rely on the stability of the list. We + * could restart the search from the beginning after canceling a job, + * but this may inefficient. Instead, use a marker job to keep our + * place in the list. + */ + memset(&marker, 0, sizeof(marker)); + marker.jobflags = KAIOCB_MARKER; + AIO_LOCK(ki); TAILQ_FOREACH_SAFE(job, &ki->kaio_jobqueue, plist, jobn) { - if ((uap->fd == job->uaiocb.aio_fildes) && - ((uap->aiocbp == NULL) || - (uap->aiocbp == job->ujob))) { + if (uap->fd == job->uaiocb.aio_fildes && + (uap->aiocbp == NULL || uap->aiocbp == job->ujob) && + (job->jobflags & KAIOCB_MARKER) == 0) { + TAILQ_INSERT_AFTER(&ki->kaio_jobqueue, job, &marker, + plist); if (aio_cancel_job(p, ki, job)) { cancelled++; } else { notcancelled++; } + jobn = TAILQ_NEXT(&marker, plist); + TAILQ_REMOVE(&ki->kaio_jobqueue, &marker, plist); if (uap->aiocbp != NULL) break; } From nobody Thu Aug 14 13:47:39 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2mlH3DDJz64TyW; Thu, 14 Aug 2025 13:47: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 4c2mlH1p1tz4JLV; Thu, 14 Aug 2025 13:47:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755179259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jg0hWVxqU3ZbdWOQxP+mNZw8C5+1zAu7jcjqZABS8PI=; b=QGNxuF3+2jl1V0zUr3BX/0w0yDn57EQ5qo8ZMY/a4aQZMZ/Xwm7SPrSEuqlmeEPR0++JJt 9ANad/qhp3LLzX0nSfKYzjHvtmsicYPGKi0kWNkbedJfOwHwQNHSAki14XTmRjx6zloBJJ kO1ZEotG6f7w2vTZ1mdKl6qQzQQK4APuUZoQIr2SCy+HwnICdqxrlapRPZFsu6OI9+xZBB t2TuZc7sxHIcpeJg7VHof7Fr6JoITdxOAovsEqH6TPyS/dEMKei6EIA6gWDvV8gboKbWUE wlrTwTUl2nrlaKyNA8hb/La1HEliOxetTOC8uNWYUAUWM9/ZFSHJYDZfJycawg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755179259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Jg0hWVxqU3ZbdWOQxP+mNZw8C5+1zAu7jcjqZABS8PI=; b=O8as69/a9HV3L86Fk/79dLtg9IiqIO+0EO8Ayv7W3aO1TaqNqwj5w/UXPNsleMda0R85OY 4Y3+HiLyE938JLF1zwK5K8y8e2b2w7yTf8UNC44QOvQpAgHL7O8GHugKnLDZFfV4JZtDdk LrqSqJgPV3QRqUB0MawNZzkvNBF6kQQ8jn+KOq5rsK+L8fY/ecOgouFMpjsFNUHFvJJb+t U+HDBYqrQDYpLuV4LI4GEp1Z99j9sVJ4+nauLjb4WNgZJ7z0e5kd7NFoR8GkWzC5szmQXI KkuivRMui4KkeMw6jpQsw73REqe8oEaDTEnvDWaRgDK11ckucpGMY2oBclH9HQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755179259; a=rsa-sha256; cv=none; b=YmyEdXiWF6OPE5+8bH/IwNpN6X4335AuY5W7gGyB/ijqcu+SSs/GKiUbw902ztV5XP/et/ NpygvHAe2B0IEP4Y6hmGhVeg2i/hS9kHuL27opTxro2wFHWu7kpxWBXpPI0AkiB+mQKKLB 9kL+c9l+MmzFYEF6mBtdl6aCwPmG2yGG5q9gCz1tk2H1uTE7WkyqQuGYuSCqmy7Sv0GI0/ Ew7vJ8SYL5cj/1TZ9MVurjSf5U9cisfVNoK83erXIBnv1kM9vW8tCe3JtQJChcNNazY6We 9bDg5vSj3wuTc7Ds0E8U+Ly3wDoESF6iHNkT5mQgIbd98P5fS+nv4NhPA5nwGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2mlH1B87zvts; Thu, 14 Aug 2025 13:47: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 57EDldhb017118; Thu, 14 Aug 2025 13:47:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EDldPb017115; Thu, 14 Aug 2025 13:47:39 GMT (envelope-from git) Date: Thu, 14 Aug 2025 13:47:39 GMT Message-Id: <202508141347.57EDldPb017115@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: 51dbdd1d8634 - stable/14 - rc: improve NAME_setup handling List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 51dbdd1d8634bf0d5af2a3d5a521a6576cc93a37 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=51dbdd1d8634bf0d5af2a3d5a521a6576cc93a37 commit 51dbdd1d8634bf0d5af2a3d5a521a6576cc93a37 Author: Franco Fichtner AuthorDate: 2024-05-24 16:38:56 +0000 Commit: Mark Johnston CommitDate: 2025-08-14 13:41:18 +0000 rc: improve NAME_setup handling Reload is used for service reconfiguration as well and lacks a NAME_prepend-like mechanism so it makes sense to extend the NAME_reload hook into this action. precmd may use configuration checks and blocks setup from doing its designated work (e.g. nginx). In moving the invoke of the setup script in front allows us to provide custom scripts for config file generation and fixing prior to precmd checking configuration integrity. Also introduce _run_rc_setup to separate the launcher from the main one. Let it run correctly in the case of restart_precmd and block further execution as would be the case in start due to the internal plumbing of restart being split into calling stop and start afterwards. Differential-Revsiion: https://reviews.freebsd.org/D36259 Signed-off-by: Franco Fichtner Reviewed by: imp, oshogbo Pull Request: https://github.com/freebsd/freebsd-src/pull/1258 (cherry picked from commit 11333dd580b704fb4ff0836e1d1a0634099b0cf6) --- libexec/rc/rc.subr | 72 ++++++++++++++++++++++++++++++++---------------- share/man/man8/rc.subr.8 | 11 ++++++-- 2 files changed, 57 insertions(+), 26 deletions(-) diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 75110a0313cd..239ec4707b33 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -813,7 +813,8 @@ startmsg() # # ${name}_prepend n Command added before ${command}. # -# ${name}_setup n Command executed before ${command}. +# ${name}_setup n Command executed during start, restart and +# reload before ${rc_arg}_precmd is run. # # ${name}_login_class n Login class to use, else "daemon". # @@ -1075,9 +1076,9 @@ run_rc_command() return 1 fi - # if there's a custom ${XXX_cmd}, - # run that instead of the default - # + # if there's a custom ${XXX_cmd}, + # run that instead of the default + # eval _cmd=\$${rc_arg}_cmd \ _precmd=\$${rc_arg}_precmd \ _postcmd=\$${rc_arg}_postcmd @@ -1086,6 +1087,15 @@ run_rc_command() if [ -n "$_env" ]; then eval "export -- $_env" fi + + # service can redefine all so + # check for valid setup target + if [ "$rc_arg" = 'start' -o \ + "$rc_arg" = 'restart' -o \ + "$rc_arg" = 'reload' ]; then + _run_rc_setup || \ + warn "failed to setup ${name}" + fi _run_rc_precmd || return 1 _run_rc_doit "$_cpusetcmd $_cmd $rc_extra_args" || return 1 _run_rc_postcmd @@ -1135,13 +1145,14 @@ run_rc_command() return 1 fi + _run_rc_setup || warn "failed to setup ${name}" if ! _run_rc_precmd; then warn "failed precmd routine for ${name}" return 1 fi - # setup the full command to run - # + # setup the full command to run + # startmsg "Starting ${name}." if [ -n "$_chroot" ]; then _cd= @@ -1172,24 +1183,18 @@ $_cpusetcmd $command $rc_flags $command_args" fi fi - if [ -n "$_setup" ]; then - if ! _run_rc_doit "$_setup"; then - warn "failed to setup ${name}" - fi - fi - - # Prepend default limits + # Prepend default limits _doit="$_cd limits -C $_login_class $_limits $_doit" - # run the full command - # + # run the full command + # if ! _run_rc_doit "$_doit"; then warn "failed to start ${name}" return 1 fi - # finally, run postcmd - # + # finally, run postcmd + # _run_rc_postcmd ;; @@ -1202,14 +1207,14 @@ $_cpusetcmd $command $rc_flags $command_args" _run_rc_precmd || return 1 - # send the signal to stop - # + # send the signal to stop + # echo "Stopping ${name}." _doit=$(_run_rc_killcmd "${sig_stop:-TERM}") _run_rc_doit "$_doit" || return 1 - # wait for the command to exit, - # and run postcmd. + # wait for the command to exit, + # and run postcmd. wait_for_pids $rc_pid _run_rc_postcmd @@ -1221,6 +1226,8 @@ $_cpusetcmd $command $rc_flags $command_args" return 1 fi + _run_rc_setup || warn "failed to setup ${name}" + _run_rc_precmd || return 1 _doit=$(_run_rc_killcmd "${sig_reload:-HUP}") @@ -1230,9 +1237,11 @@ $_cpusetcmd $command $rc_flags $command_args" ;; restart) - # prevent restart being called more - # than once by any given script - # + _run_rc_setup || warn "failed to setup ${name}" + + # prevent restart being called more + # than once by any given script + # if ${_rc_restart_done:-false}; then return 0 fi @@ -1346,6 +1355,7 @@ $_cpusetcmd $command $rc_flags $command_args" # _precmd R # _postcmd R # _return W +# _setup R # _run_rc_offcmd() { @@ -1391,6 +1401,20 @@ _run_rc_postcmd() return 0 } +_run_rc_setup() +{ + # prevent multiple execution on restart => stop/start split + if ! ${_rc_restart_done:-false} && [ -n "$_setup" ]; then + debug "run_rc_command: ${rc_arg}_setup: $_setup" + eval "$_setup" + _return=$? + if [ $_return -ne 0 ]; then + return 1 + fi + fi + return 0 +} + _run_rc_doit() { local _m diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8 index 844ba0356692..d61307f483b2 100644 --- a/share/man/man8/rc.subr.8 +++ b/share/man/man8/rc.subr.8 @@ -686,8 +686,15 @@ This is a generic version of or .Va ${name}_nice . .It Va ${name}_setup -Command to be run prior to -.Va command . +Optional command to be run during +.Cm start , +.Cm restart , +and +.Cm reload +prior to the respective +.Ar argument Ns Va _precmd . +If the command fails for any reason it will output a warning, +but execution will continue. .It Ar argument Ns Va _cmd Shell commands which override the default method for .Ar argument . From nobody Thu Aug 14 16:03:12 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlh2XXvz64fqL; Thu, 14 Aug 2025 16:03: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 4c2qlh1d1Rz3KK1; Thu, 14 Aug 2025 16:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Db5zarU17InNt3dr408PtJmao2+QoZmCKJ/5yFL8G9o=; b=Lo3OBYXo2hrHvWCjq9vfxeI+GZyTJfx69i6p+1T7KGr4OFviWC+6xFER9xCnl6IBW69vdJ ZtdWHxI//pndYm+dbRTuQUWCJhaVkpbiOH1KIZ4E7SyK5wbPT/BoxMa68D7UII1e0r2io7 xBcNLred3/Oz0cy+d3gTxwdT26Y28VBKU4Uy+jC4CuhjmdvzSXzuk+n1JK42l0+nGnPmMZ dIwZK0POEp4+a8yexAHIGu7janQJATUmBDBPDG2VRBwc1qez16fw26mkDPCTCSG+B5C7Ma Pqtg8A042djFWEmilR9J0WJ1mEvx7pqI+EDOB+wnlEf0htozyKc85WpnL0pRjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Db5zarU17InNt3dr408PtJmao2+QoZmCKJ/5yFL8G9o=; b=Ub5isQu+ZmByNy8ut5OgSKmW2oGbWS7LfyNwK+EqDNL7IfM4rojb4v/kPOC7OTaPGnaOAu r9uwbXC9CZ4/9+8G4GulHqDQbNqxgUrUmD8ctDxFv+pHBxTl5FmoMxPK6mqi3mtUHcsONN txDWhuPXy/CDGtzV0/1UW+KApZ9OtEDshWsOiBuG653U4YeuKfbeHjkyvVJDfHhh4KQLeU 1e0q1qYX994ZqNWboy/EYsX/kEJ+/yXtIJqKiPGzmAYDqjFiy7xXck/TxmCmc+IszlTbEy NVN7Z4GVxqwsBNZ/Za89T30LYs36N3dS+iXB/6vy+mfrHoBEEjBeFKc3GLqLcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187392; a=rsa-sha256; cv=none; b=xrMNqDQCGtiPrOkX/BVxLIQtdo826GTS3H3iD4Xu2undR/GOEho3MMvzFMBBS4Pz4kMh7Y 82HQVZOK4atK5fNtTqmylVN+8WK8a5Lh6pF1JsNRwdah9+yNOHOo7Wl1w9IXAo8cjCOAei JvIvZ/JuS/FJdv7kLOMQ6jv8XZ+vOvoiOd0GVJqNDnwoJcir6JWaSLa2oVXw6ZQD5Fjz/e PJeFVyiH9TS2cfjHvSDbqPHlJy6jKdqkJek3syO6zOp7oJHwfsKIjk5Dg/fnmKsbuydOta tjnb+HsgVdQk6Y5jY63E0qfUM+Ta7nnYwdB8xyC9zHXY9n19UfCOXi66D7hNcQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlh18HSz10pv; Thu, 14 Aug 2025 16:03: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 57EG3CNY079736; Thu, 14 Aug 2025 16:03:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3Cgl079733; Thu, 14 Aug 2025 16:03:12 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:12 GMT Message-Id: <202508141603.57EG3Cgl079733@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 4dd4999d23f7 - stable/14 - libutil: Document pidfile_signal() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 4dd4999d23f7d2a281430729fe02ddc7cb77e92b Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=4dd4999d23f7d2a281430729fe02ddc7cb77e92b commit 4dd4999d23f7d2a281430729fe02ddc7cb77e92b Author: Dag-Erling Smørgrav AuthorDate: 2025-08-03 17:31:20 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:08 +0000 libutil: Document pidfile_signal() Fixes: 287451fd0192 MFC after: 1 week Reviewed by: pauamma_gundo.com, emaste Differential Revision: https://reviews.freebsd.org/D51705 (cherry picked from commit 4e6a3e7e3240a95cda1d490831aa16ed3b9bd59b) --- lib/libutil/pidfile.3 | 68 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/lib/libutil/pidfile.3 b/lib/libutil/pidfile.3 index c4786736d28f..d28d5ed8eccb 100644 --- a/lib/libutil/pidfile.3 +++ b/lib/libutil/pidfile.3 @@ -22,14 +22,16 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 10, 2020 +.Dd August 2, 2025 .Dt PIDFILE 3 .Os .Sh NAME .Nm pidfile_open , .Nm pidfile_write , .Nm pidfile_close , -.Nm pidfile_remove +.Nm pidfile_remove , +.Nm pidfile_fileno , +.Nm pidfile_signal .Nd "library for PID files handling" .Sh LIBRARY .Lb libutil @@ -45,6 +47,8 @@ .Fn pidfile_remove "struct pidfh *pfh" .Ft int .Fn pidfile_fileno "struct pidfh *pfh" +.Ft int +.Fn pidfile_signal "const char *path" "int sig" "pid_t *pidptr" .Sh DESCRIPTION The .Nm pidfile @@ -101,6 +105,26 @@ function closes and removes a pidfile. The .Fn pidfile_fileno function returns the file descriptor for the open pidfile. +.Pp +The +.Fn pidfile_signal +function looks for the pidfile specified by +.Va path , +and if it exists and is locked, sends the signal specified by +.Va sig +to the PID it contains. +If +.Va pidptr +is not +.Dv NULL , +the PID that was found in the pidfile is stored in the location it +points to. +Note that calling +.Fn pidfile_signal +with +.Va sig +set to zero is an effective way to verify the existence of a pidfile +and of the process that owns it. .Sh RETURN VALUES The .Fn pidfile_open @@ -125,6 +149,13 @@ and sets if a NULL .Vt pidfh is specified, or if the pidfile is no longer open. +.Pp +The +.Fn pidfile_signal +function returns 0 if it successfully signaled a process, and an +appropriate +.Va errno +value otherwise. .Sh EXAMPLES The following example shows in which order these functions should be used. Note that it is safe to pass @@ -132,7 +163,7 @@ Note that it is safe to pass to .Fn pidfile_write , .Fn pidfile_remove , -.Fn pidfile_close +.Fn pidfile_close , and .Fn pidfile_fileno functions. @@ -280,7 +311,28 @@ Improper function use. Probably called not from the process which used .Fn pidfile_open . .El +.Pp +The +.Fn pidfile_signal +function will fail if: +.Bl -tag -width Er +.It Bq Er ENOENT +The pidfile does not exist, or exists but is not locked. +.It Bq Er EDOM +The pidfile contains a negative number. +.El +.Pp +The +.Fn pidfile_signal +function may also fail and return any of the +.Va errno +values specified for the +.Fn pidfile_read +function and the +.Xr kill 2 +system call. .Sh SEE ALSO +.Xr kill 2 , .Xr open 2 , .Xr daemon 3 , .Xr flopen 3 @@ -288,11 +340,19 @@ Probably called not from the process which used The functions .Fn pidfile_open , .Fn pidfile_write , -.Fn pidfile_close +.Fn pidfile_close , and .Fn pidfile_remove first appeared in .Fx 5.5 . +The +.Fn pidfile_fileno +function was added in +.Fx 9.1 . +The +.Fn pidfile_signal +function was added in +.Fx 14.0 . .Sh AUTHORS .An -nosplit The From nobody Thu Aug 14 16:03:13 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlj43FRz64g6j; Thu, 14 Aug 2025 16:03: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 4c2qlj2f4kz3K0X; Thu, 14 Aug 2025 16:03:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6wEoiguDMPnbnEukq+RJycq3i0ruTXE5pu9I6P1Wjx0=; b=Kpk+W828zMl8CR3ySvz9FcxgHl5SOpSnahdkBkU7uHd6QgxNEld44ljdvu3J+3qczb2BDD b/qkusng4w2pDtumyKn9xYGVQerpkKsYNabJvMRfDwINyLQbPCwa4etyegHcBXG6p1H2OK BxbGg/ScfdjyBPvEUB418233HHk13i56r35FS4l0kd2i651/tryjO+Kzn9l6fboGyjnKUJ 9DvKK7tifcSULfJJoGSGrrtbpJjb5jEu5rCFTmGMi3sDF+MoY0I/SAV5Q3IoYoXhe3eNhy gqJ9zVjtXrBBveMN45N3odEz6NmLJzDO+2hqlcJwATz++zXO1TJ9cZDBr4eZKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6wEoiguDMPnbnEukq+RJycq3i0ruTXE5pu9I6P1Wjx0=; b=iU/pno/hl+j19ppfs14+U+GYOek/mx+T2P/WbUxw7JMIozzDLiFiD8NJZfW53zHw+Irgua lvjOLc75j5zIM3Ap7BqN/SwAQoissJNXlXyh72BPCT3XOIv0d47YNhfnBHZ+xMkgfzMef2 QD6oURrg1TKiBSniaUWHUrgoSmvth2Bph/x3KrUi+uo5lc2GyzzNPl8umhXPZe/B9a2Hzh Q/Yx623mZ+GYiBSCrg8OqiH+GkJ/q2qirzhgFeEvD8hFDU+oVXRerSzt2+HOc0N8NsLEis qGePku5wzcXADn6I058nqnWhVIX4qckxs4lxBzDYjPiS8v4exs/OAED0u3CDog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187393; a=rsa-sha256; cv=none; b=kOW8CjkWEBDxnmRvA+XWgFTg+n9Ji0WsMfdeZQjPC59V4WdCVUJtJlltmPDGtOki7tDgma WEEMbms+LC3g+1CoRbH28bGvPRPV1jhUSFcMiMxzj3kRbxjWtm89dZqzoAvmvGVKkg/hV7 Ado2nH5+vLubMRUFQmZzocCcGg8QktZEkduycddGmyOjo7AtpMSN1xTGgFUdpYnRMjjSYj 8bcBnr1b7RdLCI5u+cXOlm6Jj1rU8rtkASjWOPVoFip1iXFREnnM4+7wNFGtyTNYG/If1T snCoIpQwNPnOPgJoIy9ZgBqPQzyCOcdt0EveZ1dVwlohBvWyBxpihmNYEiS6CA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlj2DGWz10XH; Thu, 14 Aug 2025 16:03: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 57EG3DDa079885; Thu, 14 Aug 2025 16:03:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3DdP079882; Thu, 14 Aug 2025 16:03:13 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:13 GMT Message-Id: <202508141603.57EG3DdP079882@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: f0ee68d143e5 - stable/14 - libutil: Add missing MLINKs List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: f0ee68d143e5a0a9c2c89b50e67ef94065e77610 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f0ee68d143e5a0a9c2c89b50e67ef94065e77610 commit f0ee68d143e5a0a9c2c89b50e67ef94065e77610 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-03 17:31:28 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:09 +0000 libutil: Add missing MLINKs MFC after: 1 week Reviewed by: olce, imp, emaste Differential Revision: https://reviews.freebsd.org/D51706 (cherry picked from commit 22afc767869a23f4e0ec5436ce843728fded950c) libutil: Remove manual link for nonexistent function I believe quota_statfs() was the original name of the function now called quota_check_path(). I must have forgotten to update the MLINK when I renamed it. MFC after: 1 week Fixes: 5666aadb3ddf ("Further extend the quotafile API.") Fixes: 22afc767869a ("libutil: Add missing MLINKs") Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D51863 (cherry picked from commit 7400d04407c033341ddc0b323b5ae7cd1cca358f) libutil: Fix manlint failures MFC after: 1 week Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D51864 (cherry picked from commit d0cc09fcdb4a3192fb76c95b1bd3c7f31a4cf486) ObsoleteFiles: Remove bogus manlink Fixes: 7400d04407c0 ("libutil: Remove manual link for nonexistent function") (cherry picked from commit 46f9056367596daad0b4f0065e5a8fa0bcbb907d) --- ObsoleteFiles.inc | 3 + lib/libutil/Makefile | 160 ++++++++++++++++++++++++++++++----------------- lib/libutil/login.conf.5 | 7 ++- lib/libutil/login_auth.3 | 4 +- lib/libutil/login_cap.3 | 1 + lib/libutil/pw_util.3 | 1 + lib/libutil/uucplock.3 | 1 + 7 files changed, 116 insertions(+), 61 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 249eb2b127bc..1d2ee06acdc1 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20250812: Remove a bogus manlink +OLD_FILES+=usr/share/man/man3/quota_statfs.3.gz + # 20250805: Test case renamed OLD_FILES+=usr/tests/usr.bin/xargs/regress.n2147483647.out diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile index 5bce5c158958..80562e806fe5 100644 --- a/lib/libutil/Makefile +++ b/lib/libutil/Makefile @@ -30,64 +30,112 @@ CFLAGS+= -DINET6 CFLAGS+= -I${.CURDIR} -I${SRCTOP}/lib/libc/gen/ -MAN+= cpuset.3 expand_number.3 flopen.3 fparseln.3 ftime.3 getlocalbase.3 \ - hexdump.3 humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ - kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ - login_auth.3 login_cap.3 \ - login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ - property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \ - _secure_path.3 trimdomain.3 uucplock.3 pw_util.3 -MAN+= login.conf.5 +MAN+= cpuset.3 +MLINKS+=cpuset.3 cpuset_parselist.3 +MAN+= expand_number.3 +MAN+= flopen.3 MLINKS+=flopen.3 flopenat.3 -MLINKS+=kld.3 kld_isloaded.3 kld.3 kld_load.3 -MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3 -MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \ - login_cap.3 login_getcaplist.3 login_cap.3 login_getcapnum.3 \ - login_cap.3 login_getcapsize.3 login_cap.3 login_getcapstr.3 \ - login_cap.3 login_getcaptime.3 login_cap.3 login_getclass.3 \ - login_cap.3 login_getclassbyname.3 login_cap.3 login_getpath.3 \ - login_cap.3 login_getpwclass.3 login_cap.3 login_getstyle.3 \ - login_cap.3 login_getuserclass.3 login_cap.3 login_setcryptfmt.3 -MLINKS+=login_class.3 setclasscontext.3 login_class.3 setclassenvironment.3 \ - login_class.3 setclassresources.3 login_class.3 setusercontext.3 -MLINKS+=login_ok.3 auth_hostok.3 login_ok.3 auth_timeok.3 \ - login_ok.3 auth_ttyok.3 -MLINKS+=login_times.3 in_lt.3 login_times.3 in_ltm.3 \ - login_times.3 in_ltms.3 \ - login_times.3 in_lts.3 \ - login_times.3 parse_lt.3 -MLINKS+=pidfile.3 pidfile_close.3 \ - pidfile.3 pidfile_fileno.3 \ - pidfile.3 pidfile_open.3 \ - pidfile.3 pidfile_remove.3 \ - pidfile.3 pidfile_write.3 -MLINKS+=property.3 property_find.3 property.3 properties_free.3 +MAN+= fparseln.3 +MAN+= ftime.3 +MAN+= getlocalbase.3 +MAN+= hexdump.3 +MAN+= humanize_number.3 +MAN+= kinfo_getallproc.3 +MAN+= kinfo_getfile.3 +MAN+= kinfo_getproc.3 +MAN+= kinfo_getvmmap.3 +MAN+= kinfo_getvmobject.3 +MAN+= kld.3 +MLINKS+=kld.3 kld_isloaded.3 +MLINKS+=kld.3 kld_load.3 +MAN+= login_auth.3 +MLINKS+=login_auth.3 auth_cat.3 +MLINKS+=login_auth.3 auth_checknologin.3 +MAN+= login_cap.3 +MLINKS+=login_cap.3 login_close.3 +MLINKS+=login_cap.3 login_getcapbool.3 +MLINKS+=login_cap.3 login_getcapenum.3 +MLINKS+=login_cap.3 login_getcaplist.3 +MLINKS+=login_cap.3 login_getcapnum.3 +MLINKS+=login_cap.3 login_getcapsize.3 +MLINKS+=login_cap.3 login_getcapstr.3 +MLINKS+=login_cap.3 login_getcaptime.3 +MLINKS+=login_cap.3 login_getclass.3 +MLINKS+=login_cap.3 login_getclassbyname.3 +MLINKS+=login_cap.3 login_getpath.3 +MLINKS+=login_cap.3 login_getpwclass.3 +MLINKS+=login_cap.3 login_getstyle.3 +MLINKS+=login_cap.3 login_getuserclass.3 +MLINKS+=login_cap.3 login_setcryptfmt.3 +MAN+= login_class.3 +MLINKS+=login_class.3 setclasscontext.3 +MLINKS+=login_class.3 setclasscpumask.3 +MLINKS+=login_class.3 setclassenvironment.3 +MLINKS+=login_class.3 setclassresources.3 +MLINKS+=login_class.3 setusercontext.3 +MAN+= login_ok.3 +MLINKS+=login_ok.3 auth_hostok.3 +MLINKS+=login_ok.3 auth_timeok.3 +MLINKS+=login_ok.3 auth_ttyok.3 +MAN+= login_times.3 +MLINKS+=login_times.3 in_lt.3 +MLINKS+=login_times.3 in_ltm.3 +MLINKS+=login_times.3 in_ltms.3 +MLINKS+=login_times.3 in_lts.3 +MLINKS+=login_times.3 parse_lt.3 +MAN+= login_tty.3 +MAN+= pidfile.3 +MLINKS+=pidfile.3 pidfile_close.3 +MLINKS+=pidfile.3 pidfile_fileno.3 +MLINKS+=pidfile.3 pidfile_open.3 +MLINKS+=pidfile.3 pidfile_remove.3 +MLINKS+=pidfile.3 pidfile_signal.3 +MLINKS+=pidfile.3 pidfile_write.3 +MAN+= property.3 +MLINKS+=property.3 property_find.3 +MLINKS+=property.3 properties_free.3 MLINKS+=property.3 properties_read.3 -MLINKS+=pty.3 forkpty.3 pty.3 openpty.3 -MLINKS+=quotafile.3 quota_close.3 \ - quotafile.3 quota_fsname.3 \ - quotafile.3 quota_open.3 \ - quotafile.3 quota_qfname.3 \ - quotafile.3 quota_read.3 \ - quotafile.3 quota_statfs.3 \ - quotafile.3 quota_write_limits.3 \ - quotafile.3 quota_write_usage.3 -MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \ - uucplock.3 uu_lockerr.3 uucplock.3 uu_unlock.3 -MLINKS+=pw_util.3 pw_copy.3 \ - pw_util.3 pw_dup.3 \ - pw_util.3 pw_edit.3 \ - pw_util.3 pw_equal.3 \ - pw_util.3 pw_fini.3 \ - pw_util.3 pw_init.3 \ - pw_util.3 pw_make.3 \ - pw_util.3 pw_make_v7.3 \ - pw_util.3 pw_mkdb.3 \ - pw_util.3 pw_lock.3 \ - pw_util.3 pw_scan.3 \ - pw_util.3 pw_tempname.3 \ - pw_util.3 pw_tmp.3 -MLINKS+=cpuset.3 cpuset_parselist.3 +MAN+= pty.3 +MLINKS+=pty.3 forkpty.3 +MLINKS+=pty.3 openpty.3 +MAN+= pw_util.3 +MLINKS+=pw_util.3 pw_copy.3 +MLINKS+=pw_util.3 pw_dup.3 +MLINKS+=pw_util.3 pw_edit.3 +MLINKS+=pw_util.3 pw_equal.3 +MLINKS+=pw_util.3 pw_fini.3 +MLINKS+=pw_util.3 pw_init.3 +MLINKS+=pw_util.3 pw_initpwd.3 +MLINKS+=pw_util.3 pw_make.3 +MLINKS+=pw_util.3 pw_make_v7.3 +MLINKS+=pw_util.3 pw_mkdb.3 +MLINKS+=pw_util.3 pw_lock.3 +MLINKS+=pw_util.3 pw_scan.3 +MLINKS+=pw_util.3 pw_tempname.3 +MLINKS+=pw_util.3 pw_tmp.3 +MAN+= quotafile.3 +MLINKS+=quotafile.3 quota_check_path.3 +MLINKS+=quotafile.3 quota_close.3 +MLINKS+=quotafile.3 quota_convert.3 +MLINKS+=quotafile.3 quota_fsname.3 +MLINKS+=quotafile.3 quota_maxid.3 +MLINKS+=quotafile.3 quota_off.3 +MLINKS+=quotafile.3 quota_on.3 +MLINKS+=quotafile.3 quota_open.3 +MLINKS+=quotafile.3 quota_qfname.3 +MLINKS+=quotafile.3 quota_read.3 +MLINKS+=quotafile.3 quota_write_limits.3 +MLINKS+=quotafile.3 quota_write_usage.3 +MAN+= realhostname.3 +MAN+= realhostname_sa.3 +MAN+= _secure_path.3 +MAN+= trimdomain.3 +MAN+= uucplock.3 +MLINKS+=uucplock.3 uu_lock.3 +MLINKS+=uucplock.3 uu_lock_txfr.3 +MLINKS+=uucplock.3 uu_lockerr.3 +MLINKS+=uucplock.3 uu_unlock.3 +MAN+= login.conf.5 HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/lib/libutil/login.conf.5 b/lib/libutil/login.conf.5 index d43fdfb761f3..27f37fb5fc30 100644 --- a/lib/libutil/login.conf.5 +++ b/lib/libutil/login.conf.5 @@ -380,14 +380,15 @@ If is specified, then logins are only allowed during the periods given. If .Em times.deny -is specified, then logins are denied during the periods given, regardless of whether -one of the periods specified in +is specified, then logins are denied during the periods given, +regardless of whether one of the periods specified in .Em times.allow applies. .Pp Note that .Xr login 1 -enforces only that the actual login falls within periods allowed by these entries. +enforces only that the actual login falls within periods allowed by +these entries. Further enforcement over the life of a session requires a separate daemon to monitor transitions from an allowed period to a non-allowed one. .Pp diff --git a/lib/libutil/login_auth.3 b/lib/libutil/login_auth.3 index fafe43b906e6..dd5ba3e01265 100644 --- a/lib/libutil/login_auth.3 +++ b/lib/libutil/login_auth.3 @@ -58,8 +58,8 @@ .\" .Ft int .\" .Fn auth_timesok "login_cap_t *lc" "time_t now" .Sh DESCRIPTION -This set of functions support the login class authorisation style interface provided -by +This set of functions support the login class authorisation style +interface provided by .Xr login.conf 5 . .\" .Sh RETURN VALUES .Sh SEE ALSO diff --git a/lib/libutil/login_cap.3 b/lib/libutil/login_cap.3 index 86142c3b19f9..48af0e3c9c46 100644 --- a/lib/libutil/login_cap.3 +++ b/lib/libutil/login_cap.3 @@ -31,6 +31,7 @@ .Nm login_getcaptime , .Nm login_getclass , .Nm login_getclassbyname , +.Nm login_getpath , .Nm login_getpwclass , .Nm login_getstyle , .Nm login_getuserclass , diff --git a/lib/libutil/pw_util.3 b/lib/libutil/pw_util.3 index ed05818cd16a..a6bb71600441 100644 --- a/lib/libutil/pw_util.3 +++ b/lib/libutil/pw_util.3 @@ -31,6 +31,7 @@ .Nm pw_edit , .Nm pw_equal , .Nm pw_fini , +.Nm pw_initpwd , .Nm pw_init , .Nm pw_make , .Nm pw_make_v7 , diff --git a/lib/libutil/uucplock.3 b/lib/libutil/uucplock.3 index dd19d0311b4e..ee8c9f6bb995 100644 --- a/lib/libutil/uucplock.3 +++ b/lib/libutil/uucplock.3 @@ -28,6 +28,7 @@ .Os .Sh NAME .Nm uu_lock , +.Nm uu_lock_txfr , .Nm uu_unlock , .Nm uu_lockerr .Nd acquire and release control of a serial device From nobody Thu Aug 14 16:03:13 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlj42scz64fwS; Thu, 14 Aug 2025 16:03: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 4c2qlj1vD1z3KQ8; Thu, 14 Aug 2025 16:03:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AQrwnPXxuLMj7IXp2sopIdo/nnfqcp5+zBN8AmhypXQ=; b=A+j3ef5sY+qyuwfTZ6hNlvhrAbwMqIyDD7wRdnXdk2fPWrDdBkNmqCWRnwlZqx1GPOqd4j pp6maDFb00/EqPHc6VIPr/EiuKe0IjuTaaDwz4cej2qV0m5OgXE6LGKUN/rsb+z7pRNlQ9 qtfnfmb8xX1KeODAp143RQEo5lUuwu+UQzNuD36dzZ2TWdzD1RmmJc2Y5cz2IQh8Uooazt SEpGf+Oc8OB+TFg7zx4LsLlHivhKzRlSF8f0EV4P3Sh739bTbAgJ3ItA5yHCPSe5s2S5s5 kA3s1pyRjjbAqqtRuNW1LvRjr2/nLxvj6m7lN0sg4gEwmcHiZkwm5ad94rCYEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AQrwnPXxuLMj7IXp2sopIdo/nnfqcp5+zBN8AmhypXQ=; b=xABIRvTwD01J8Qp4CvrtYOcn0ESwH3RXsN2f4dL5dvr1eAW4gsIQapZ5vIkzl4OeHqIuT8 8apU4Ho7zY/T6tY9YxE+uOqjcDDNXXwkvR9wrnmxXVBFzQnAOmEoHwLtq8V9ABtL01dWVc GzP0hVX9i56KNVbBIkA29edAA/INabtUKhwtXe7vRBSHxmg9jd0rv+s73rMWgrEm47JBFY 1xT1oY+righvSTbVOtD83HAr6WPC3w8NivObCi7zuifO0iSiJaLsaUADj9LZr1Mrs56iVX sJc54vLB60A6evhhN1y1amS4GUnaKMk1u4nF/lyv8SIShuXmk1qrjs8KJFUKvg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187393; a=rsa-sha256; cv=none; b=cD+S4kaFmQTrrBfNob1nabFy48TiLJ8NQoHDGxA5UMKKlZZ3zkTSBkLv/56VdHEAKjamc+ yWoRE5ClU5KJ68UY4XNeyIo34GiDTUXYn41kpepTnLFUaygwP79C0ws3oLyInt00e1G+Nz 9aXdrp3ncez6E0BVbZ5rWodMv3U6W0gaNiY5EUGTY8R/j56NzJyXtcXNLswhqMLFdM4cLU T68F56JoSsFX6QKsorQFPsg+HtRITIP3GtSFQ8fP271YXlqPbIhNQXsIpfR7FEPKdqKc5Z N/f9d7wsQu1Q+xd6OZHuLYgVkaLrtFtp9W/WM3/d7x0cdZm/reXk0IhX3mAwLg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlj1JTHz10XG; Thu, 14 Aug 2025 16:03: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 57EG3DOJ079852; Thu, 14 Aug 2025 16:03:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3DKt079849; Thu, 14 Aug 2025 16:03:13 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:13 GMT Message-Id: <202508141603.57EG3DKt079849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: f580383f1e3e - stable/13 - libutil: Document pidfile_signal() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: f580383f1e3e773608dcd7136ba9ebf3914b0548 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f580383f1e3e773608dcd7136ba9ebf3914b0548 commit f580383f1e3e773608dcd7136ba9ebf3914b0548 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-03 17:31:20 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:05 +0000 libutil: Document pidfile_signal() Fixes: 287451fd0192 MFC after: 1 week Reviewed by: pauamma_gundo.com, emaste Differential Revision: https://reviews.freebsd.org/D51705 (cherry picked from commit 4e6a3e7e3240a95cda1d490831aa16ed3b9bd59b) --- lib/libutil/pidfile.3 | 68 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/lib/libutil/pidfile.3 b/lib/libutil/pidfile.3 index c4786736d28f..d28d5ed8eccb 100644 --- a/lib/libutil/pidfile.3 +++ b/lib/libutil/pidfile.3 @@ -22,14 +22,16 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 10, 2020 +.Dd August 2, 2025 .Dt PIDFILE 3 .Os .Sh NAME .Nm pidfile_open , .Nm pidfile_write , .Nm pidfile_close , -.Nm pidfile_remove +.Nm pidfile_remove , +.Nm pidfile_fileno , +.Nm pidfile_signal .Nd "library for PID files handling" .Sh LIBRARY .Lb libutil @@ -45,6 +47,8 @@ .Fn pidfile_remove "struct pidfh *pfh" .Ft int .Fn pidfile_fileno "struct pidfh *pfh" +.Ft int +.Fn pidfile_signal "const char *path" "int sig" "pid_t *pidptr" .Sh DESCRIPTION The .Nm pidfile @@ -101,6 +105,26 @@ function closes and removes a pidfile. The .Fn pidfile_fileno function returns the file descriptor for the open pidfile. +.Pp +The +.Fn pidfile_signal +function looks for the pidfile specified by +.Va path , +and if it exists and is locked, sends the signal specified by +.Va sig +to the PID it contains. +If +.Va pidptr +is not +.Dv NULL , +the PID that was found in the pidfile is stored in the location it +points to. +Note that calling +.Fn pidfile_signal +with +.Va sig +set to zero is an effective way to verify the existence of a pidfile +and of the process that owns it. .Sh RETURN VALUES The .Fn pidfile_open @@ -125,6 +149,13 @@ and sets if a NULL .Vt pidfh is specified, or if the pidfile is no longer open. +.Pp +The +.Fn pidfile_signal +function returns 0 if it successfully signaled a process, and an +appropriate +.Va errno +value otherwise. .Sh EXAMPLES The following example shows in which order these functions should be used. Note that it is safe to pass @@ -132,7 +163,7 @@ Note that it is safe to pass to .Fn pidfile_write , .Fn pidfile_remove , -.Fn pidfile_close +.Fn pidfile_close , and .Fn pidfile_fileno functions. @@ -280,7 +311,28 @@ Improper function use. Probably called not from the process which used .Fn pidfile_open . .El +.Pp +The +.Fn pidfile_signal +function will fail if: +.Bl -tag -width Er +.It Bq Er ENOENT +The pidfile does not exist, or exists but is not locked. +.It Bq Er EDOM +The pidfile contains a negative number. +.El +.Pp +The +.Fn pidfile_signal +function may also fail and return any of the +.Va errno +values specified for the +.Fn pidfile_read +function and the +.Xr kill 2 +system call. .Sh SEE ALSO +.Xr kill 2 , .Xr open 2 , .Xr daemon 3 , .Xr flopen 3 @@ -288,11 +340,19 @@ Probably called not from the process which used The functions .Fn pidfile_open , .Fn pidfile_write , -.Fn pidfile_close +.Fn pidfile_close , and .Fn pidfile_remove first appeared in .Fx 5.5 . +The +.Fn pidfile_fileno +function was added in +.Fx 9.1 . +The +.Fn pidfile_signal +function was added in +.Fx 14.0 . .Sh AUTHORS .An -nosplit The From nobody Thu Aug 14 16:03:14 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlk4bSGz64fyR; Thu, 14 Aug 2025 16:03: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 4c2qlk2kTZz3K3D; Thu, 14 Aug 2025 16:03:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wBVX9MDCbKEOLOY3rNRlNYS3rV06QwFXk4ZeMpR8x5Y=; b=jVYxMbIjNFpSvN//vO+7HivkvLhqhmlsRYOFWxf0NtVjSZNLKZ1zrA5N+oMv5cAJzF2NBc s3eVELza+G52wQitBI2fhfgW66C3JnstTESLAUzji3QOrwZiUvyzF9VJO4Q9uEgZT5S3TO fxLEl4cQowcxfcQ+lPduM4raQqckoYqNKbRAY/DXoh0ans6535bwFELeWkdtuHdWRjn/Qa SO2sK6ZHlZyKhCb53dX5ux844uehnNNO/fmj5Dsw+Mn/8YbGN5/bFylWTZvLCGlxSXbWKI lSgTjHhT6DjsZe2OG8Yb79eaLP38TJSqJtdzkoWHzw5XsptjPF4EqrvarIUhmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wBVX9MDCbKEOLOY3rNRlNYS3rV06QwFXk4ZeMpR8x5Y=; b=oi+yyVEcLjjMMelujxULyqlR0L1xjTXWjl6UROGwJQSOp/H43znJINHnbhzpIy90KVlJKo Z9dBZJvTJQoUwXas1o5nc22V1rwcb3ugiBabbxSijd/Ev2RerJeXgcoHqB5mdeI2hnixyE TFHGO3hROWIvBuKM5AOBfXo0Pu94N2wRGmG6q1Y7sxLWsK81O37m7FP5OOEBK773x3qHiD PKz/Npf2Q2irLEPoNypGFURTQo8j2ez5bcc0/wUxCBpGztX+o9/2yI0hKHHGuWG2NvHAax uWb7bA4lV0TGwHcKDQPUr6DbGTHfx+qjsLoIy7TIVCDGXFEWhZv0i05JtMihZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187394; a=rsa-sha256; cv=none; b=LC0OXGMFrqZ7xeP3YfmUGZHBxj7iBp9kYqymRIfNxp5xpApYBZpf0XmLJgw8/OSy88FFpK Xp5UAWUQkuMsIdq/hROw0fI/wvgBSvEw6phQEKNKsX82/NGxEE2dzqT6craoQ5Px3lbNOI WK3kEg5trtoy5L7q9vZg7oYRa2L0Czt6CR2EqPMLtMgWRozU+seh0332pB4xOCi0zhP6Cy QbhL2PAb9vfClYU44gBy5GXAkw9L4ZqBqr4ivdIMDIGTDjSLW6SPWyW8P9B8oaCAq8cwBM c8VDFFLZMI8pxykR+tYUNJIP4xBu6d7upO+ro4Cmh2YekIrbsJvT9yHc3o9REA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlk2LP2z10XK; Thu, 14 Aug 2025 16:03: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 57EG3EH2079925; Thu, 14 Aug 2025 16:03:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3Erh079919; Thu, 14 Aug 2025 16:03:14 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:14 GMT Message-Id: <202508141603.57EG3Erh079919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: a64e03483190 - stable/13 - libutil: Add missing MLINKs List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: a64e034831903dae5811b8e4227b824be5b33525 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=a64e034831903dae5811b8e4227b824be5b33525 commit a64e034831903dae5811b8e4227b824be5b33525 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-03 17:31:28 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:05 +0000 libutil: Add missing MLINKs MFC after: 1 week Reviewed by: olce, imp, emaste Differential Revision: https://reviews.freebsd.org/D51706 (cherry picked from commit 22afc767869a23f4e0ec5436ce843728fded950c) libutil: Remove manual link for nonexistent function I believe quota_statfs() was the original name of the function now called quota_check_path(). I must have forgotten to update the MLINK when I renamed it. MFC after: 1 week Fixes: 5666aadb3ddf ("Further extend the quotafile API.") Fixes: 22afc767869a ("libutil: Add missing MLINKs") Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D51863 (cherry picked from commit 7400d04407c033341ddc0b323b5ae7cd1cca358f) libutil: Fix manlint failures MFC after: 1 week Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D51864 (cherry picked from commit d0cc09fcdb4a3192fb76c95b1bd3c7f31a4cf486) ObsoleteFiles: Remove bogus manlink Fixes: 7400d04407c0 ("libutil: Remove manual link for nonexistent function") (cherry picked from commit 46f9056367596daad0b4f0065e5a8fa0bcbb907d) --- ObsoleteFiles.inc | 3 + lib/libutil/Makefile | 156 ++++++++++++++++++++++++++++++----------------- lib/libutil/login.conf.5 | 7 ++- lib/libutil/login_auth.3 | 4 +- lib/libutil/login_cap.3 | 1 + lib/libutil/pw_util.3 | 1 + lib/libutil/uucplock.3 | 1 + 7 files changed, 113 insertions(+), 60 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 305c1707ce49..9a47a70a9324 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20250812: Remove a bogus manlink +OLD_FILES+=usr/share/man/man3/quota_statfs.3.gz + # 20250805: Test case renamed OLD_FILES+=usr/tests/usr.bin/xargs/regress.n2147483647.out diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile index 337534fd136f..07b65c970a9e 100644 --- a/lib/libutil/Makefile +++ b/lib/libutil/Makefile @@ -30,63 +30,109 @@ CFLAGS+= -DINET6 CFLAGS+= -I${.CURDIR} -I${SRCTOP}/lib/libc/gen/ -MAN+= expand_number.3 flopen.3 fparseln.3 getlocalbase.3 hexdump.3 \ - humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ - kinfo_getproc.3 kinfo_getvmmap.3 kinfo_getvmobject.3 kld.3 \ - login_auth.3 login_cap.3 \ - login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ - property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \ - _secure_path.3 trimdomain.3 uucplock.3 pw_util.3 -MAN+= login.conf.5 +MAN+= expand_number.3 +MAN+= flopen.3 MLINKS+=flopen.3 flopenat.3 -MLINKS+=kld.3 kld_isloaded.3 kld.3 kld_load.3 -MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3 -MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \ - login_cap.3 login_getcaplist.3 login_cap.3 login_getcapnum.3 \ - login_cap.3 login_getcapsize.3 login_cap.3 login_getcapstr.3 \ - login_cap.3 login_getcaptime.3 login_cap.3 login_getclass.3 \ - login_cap.3 login_getclassbyname.3 login_cap.3 login_getpath.3 \ - login_cap.3 login_getpwclass.3 login_cap.3 login_getstyle.3 \ - login_cap.3 login_getuserclass.3 login_cap.3 login_setcryptfmt.3 -MLINKS+=login_class.3 setclasscontext.3 login_class.3 setclassenvironment.3 \ - login_class.3 setclassresources.3 login_class.3 setusercontext.3 -MLINKS+=login_ok.3 auth_hostok.3 login_ok.3 auth_timeok.3 \ - login_ok.3 auth_ttyok.3 -MLINKS+=login_times.3 in_lt.3 login_times.3 in_ltm.3 \ - login_times.3 in_ltms.3 \ - login_times.3 in_lts.3 \ - login_times.3 parse_lt.3 -MLINKS+=pidfile.3 pidfile_close.3 \ - pidfile.3 pidfile_fileno.3 \ - pidfile.3 pidfile_open.3 \ - pidfile.3 pidfile_remove.3 \ - pidfile.3 pidfile_write.3 -MLINKS+=property.3 property_find.3 property.3 properties_free.3 +MAN+= fparseln.3 +MAN+= getlocalbase.3 +MAN+= hexdump.3 +MAN+= humanize_number.3 +MAN+= kinfo_getallproc.3 +MAN+= kinfo_getfile.3 +MAN+= kinfo_getproc.3 +MAN+= kinfo_getvmmap.3 +MAN+= kinfo_getvmobject.3 +MAN+= kld.3 +MLINKS+=kld.3 kld_isloaded.3 +MLINKS+=kld.3 kld_load.3 +MAN+= login_auth.3 +MLINKS+=login_auth.3 auth_cat.3 +MLINKS+=login_auth.3 auth_checknologin.3 +MAN+= login_cap.3 +MLINKS+=login_cap.3 login_close.3 +MLINKS+=login_cap.3 login_getcapbool.3 +MLINKS+=login_cap.3 login_getcapenum.3 +MLINKS+=login_cap.3 login_getcaplist.3 +MLINKS+=login_cap.3 login_getcapnum.3 +MLINKS+=login_cap.3 login_getcapsize.3 +MLINKS+=login_cap.3 login_getcapstr.3 +MLINKS+=login_cap.3 login_getcaptime.3 +MLINKS+=login_cap.3 login_getclass.3 +MLINKS+=login_cap.3 login_getclassbyname.3 +MLINKS+=login_cap.3 login_getpath.3 +MLINKS+=login_cap.3 login_getpwclass.3 +MLINKS+=login_cap.3 login_getstyle.3 +MLINKS+=login_cap.3 login_getuserclass.3 +MLINKS+=login_cap.3 login_setcryptfmt.3 +MAN+= login_class.3 +MLINKS+=login_class.3 setclasscontext.3 +MLINKS+=login_class.3 setclasscpumask.3 +MLINKS+=login_class.3 setclassenvironment.3 +MLINKS+=login_class.3 setclassresources.3 +MLINKS+=login_class.3 setusercontext.3 +MAN+= login_ok.3 +MLINKS+=login_ok.3 auth_hostok.3 +MLINKS+=login_ok.3 auth_timeok.3 +MLINKS+=login_ok.3 auth_ttyok.3 +MAN+= login_times.3 +MLINKS+=login_times.3 in_lt.3 +MLINKS+=login_times.3 in_ltm.3 +MLINKS+=login_times.3 in_ltms.3 +MLINKS+=login_times.3 in_lts.3 +MLINKS+=login_times.3 parse_lt.3 +MAN+= login_tty.3 +MAN+= pidfile.3 +MLINKS+=pidfile.3 pidfile_close.3 +MLINKS+=pidfile.3 pidfile_fileno.3 +MLINKS+=pidfile.3 pidfile_open.3 +MLINKS+=pidfile.3 pidfile_remove.3 +MLINKS+=pidfile.3 pidfile_signal.3 +MLINKS+=pidfile.3 pidfile_write.3 +MAN+= property.3 +MLINKS+=property.3 property_find.3 +MLINKS+=property.3 properties_free.3 MLINKS+=property.3 properties_read.3 -MLINKS+=pty.3 forkpty.3 pty.3 openpty.3 -MLINKS+=quotafile.3 quota_close.3 \ - quotafile.3 quota_fsname.3 \ - quotafile.3 quota_open.3 \ - quotafile.3 quota_qfname.3 \ - quotafile.3 quota_read.3 \ - quotafile.3 quota_statfs.3 \ - quotafile.3 quota_write_limits.3 \ - quotafile.3 quota_write_usage.3 -MLINKS+=uucplock.3 uu_lock.3 uucplock.3 uu_lock_txfr.3 \ - uucplock.3 uu_lockerr.3 uucplock.3 uu_unlock.3 -MLINKS+=pw_util.3 pw_copy.3 \ - pw_util.3 pw_dup.3 \ - pw_util.3 pw_edit.3 \ - pw_util.3 pw_equal.3 \ - pw_util.3 pw_fini.3 \ - pw_util.3 pw_init.3 \ - pw_util.3 pw_make.3 \ - pw_util.3 pw_make_v7.3 \ - pw_util.3 pw_mkdb.3 \ - pw_util.3 pw_lock.3 \ - pw_util.3 pw_scan.3 \ - pw_util.3 pw_tempname.3 \ - pw_util.3 pw_tmp.3 +MAN+= pty.3 +MLINKS+=pty.3 forkpty.3 +MLINKS+=pty.3 openpty.3 +MAN+= pw_util.3 +MLINKS+=pw_util.3 pw_copy.3 +MLINKS+=pw_util.3 pw_dup.3 +MLINKS+=pw_util.3 pw_edit.3 +MLINKS+=pw_util.3 pw_equal.3 +MLINKS+=pw_util.3 pw_fini.3 +MLINKS+=pw_util.3 pw_init.3 +MLINKS+=pw_util.3 pw_initpwd.3 +MLINKS+=pw_util.3 pw_make.3 +MLINKS+=pw_util.3 pw_make_v7.3 +MLINKS+=pw_util.3 pw_mkdb.3 +MLINKS+=pw_util.3 pw_lock.3 +MLINKS+=pw_util.3 pw_scan.3 +MLINKS+=pw_util.3 pw_tempname.3 +MLINKS+=pw_util.3 pw_tmp.3 +MAN+= quotafile.3 +MLINKS+=quotafile.3 quota_check_path.3 +MLINKS+=quotafile.3 quota_close.3 +MLINKS+=quotafile.3 quota_convert.3 +MLINKS+=quotafile.3 quota_fsname.3 +MLINKS+=quotafile.3 quota_maxid.3 +MLINKS+=quotafile.3 quota_off.3 +MLINKS+=quotafile.3 quota_on.3 +MLINKS+=quotafile.3 quota_open.3 +MLINKS+=quotafile.3 quota_qfname.3 +MLINKS+=quotafile.3 quota_read.3 +MLINKS+=quotafile.3 quota_write_limits.3 +MLINKS+=quotafile.3 quota_write_usage.3 +MAN+= realhostname.3 +MAN+= realhostname_sa.3 +MAN+= _secure_path.3 +MAN+= trimdomain.3 +MAN+= uucplock.3 +MLINKS+=uucplock.3 uu_lock.3 +MLINKS+=uucplock.3 uu_lock_txfr.3 +MLINKS+=uucplock.3 uu_lockerr.3 +MLINKS+=uucplock.3 uu_unlock.3 +MAN+= login.conf.5 HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/lib/libutil/login.conf.5 b/lib/libutil/login.conf.5 index a749fe5519ab..fd9a4c655350 100644 --- a/lib/libutil/login.conf.5 +++ b/lib/libutil/login.conf.5 @@ -379,14 +379,15 @@ If is specified, then logins are only allowed during the periods given. If .Em times.deny -is specified, then logins are denied during the periods given, regardless of whether -one of the periods specified in +is specified, then logins are denied during the periods given, +regardless of whether one of the periods specified in .Em times.allow applies. .Pp Note that .Xr login 1 -enforces only that the actual login falls within periods allowed by these entries. +enforces only that the actual login falls within periods allowed by +these entries. Further enforcement over the life of a session requires a separate daemon to monitor transitions from an allowed period to a non-allowed one. .Pp diff --git a/lib/libutil/login_auth.3 b/lib/libutil/login_auth.3 index fafe43b906e6..dd5ba3e01265 100644 --- a/lib/libutil/login_auth.3 +++ b/lib/libutil/login_auth.3 @@ -58,8 +58,8 @@ .\" .Ft int .\" .Fn auth_timesok "login_cap_t *lc" "time_t now" .Sh DESCRIPTION -This set of functions support the login class authorisation style interface provided -by +This set of functions support the login class authorisation style +interface provided by .Xr login.conf 5 . .\" .Sh RETURN VALUES .Sh SEE ALSO diff --git a/lib/libutil/login_cap.3 b/lib/libutil/login_cap.3 index 86142c3b19f9..48af0e3c9c46 100644 --- a/lib/libutil/login_cap.3 +++ b/lib/libutil/login_cap.3 @@ -31,6 +31,7 @@ .Nm login_getcaptime , .Nm login_getclass , .Nm login_getclassbyname , +.Nm login_getpath , .Nm login_getpwclass , .Nm login_getstyle , .Nm login_getuserclass , diff --git a/lib/libutil/pw_util.3 b/lib/libutil/pw_util.3 index ed05818cd16a..a6bb71600441 100644 --- a/lib/libutil/pw_util.3 +++ b/lib/libutil/pw_util.3 @@ -31,6 +31,7 @@ .Nm pw_edit , .Nm pw_equal , .Nm pw_fini , +.Nm pw_initpwd , .Nm pw_init , .Nm pw_make , .Nm pw_make_v7 , diff --git a/lib/libutil/uucplock.3 b/lib/libutil/uucplock.3 index dd19d0311b4e..ee8c9f6bb995 100644 --- a/lib/libutil/uucplock.3 +++ b/lib/libutil/uucplock.3 @@ -28,6 +28,7 @@ .Os .Sh NAME .Nm uu_lock , +.Nm uu_lock_txfr , .Nm uu_unlock , .Nm uu_lockerr .Nd acquire and release control of a serial device From nobody Thu Aug 14 16:03:15 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qll6XQJz64g5p; Thu, 14 Aug 2025 16:03: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 4c2qll3ldzz3JxM; Thu, 14 Aug 2025 16:03:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y5PeW8U8XtUt4gqXsb/mBZUnUWituqV7NwOVe9WXxCs=; b=S+/zjTO+A/3wZMzYgC+H3MfbjzUDQqrnm+C+T75fc/DDgmz+KJz96Xu/dEeQW3ZKKEsgbP gjRf+dmvHbBcArt2vyciVl9uIB/rL7zthRulvyWCbal3JmRUyU+rcaJcpi9eZNNvjgaHkJ wRUD+J5ub0223Z+otsRyvkdrDJdN7PI0OcyUo+c8IxiNM012g89ps2YKdPvsZNhFZ9VMTC 4GAdduIo7udtLOv09DSAsejp44HipwZAtYV1ox5krt8cPym0/QV9cR9KL9QUVPtwtIK19/ CwdIMqS0oxrpS/Gry5gcKRv1M7U/4EmVQYtxTr5c+PASA6QsQMjZnspcqYDMNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y5PeW8U8XtUt4gqXsb/mBZUnUWituqV7NwOVe9WXxCs=; b=VY1FZPBNKjqDDIkSDu/RKBeG+Pt7UCwMBlR5Hij6y5PW+sHeznNpxmrhu2JWlI9HvJudN0 +bQs7v1oGaX0I1D57BjqUbKBsTm4vOntIMyFEnZthAA6/0qpaPQ/Yyw0Nb9e3e/d///Ijf B/lJVx/i0IHlFarYsY1EdJKhP7123W2nS67m26NMqjFbeXt75/iRBjww2Ut/3tAtyf6ky/ 6jBinMlkP0+qanB6aCC9r5MIzH5ssLqXlVEwm8crtdX2rrlqWsyMaoabV2Jo/+jC5Rm5pQ Xabsr+p9j/7d45YRASy3W/SExRpT8f5YuITaj/spuOBrXzPa8GjCuKliG5G4BA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187395; a=rsa-sha256; cv=none; b=VFgj6LsJyWJ92NoUAW0JxauMTyTTsykFJ/7hOS4+kMk+nTlaxCnuDKOXhA+sv8z13ccOC/ vOX6l/CDedhz7acMggrWGaaVRqodzSSBqNXwRg027nPn8cGiHbiWqs6OaUny+Gud4qanWA NOvOnmRNkkjvm2wBnRRRX4jD4TLUHo16oBHKab2TYGg0G4Mi4ZAUpSHqncJS7X1kXzD+L0 uTNt210lhtotzhnWx9185jIyWCeUKxC6QA+A66eyPkTFx2W7zYD6DPulYDVALxAkQByhHJ TuIk0Zwp2VDU5c9Eh2tTJpj1o/GEQyKEQ9GfT45NL9HM61JJLO/CV/eNwKlJNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qll3MHNz10rT; Thu, 14 Aug 2025 16:03: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 57EG3FQF080020; Thu, 14 Aug 2025 16:03:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3FLC080012; Thu, 14 Aug 2025 16:03:15 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:15 GMT Message-Id: <202508141603.57EG3FLC080012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: ebd7ad28151b - stable/13 - hastd: Fix nv data size check List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: ebd7ad28151b4e97f469aac94388a7ffbf4f3ab0 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=ebd7ad28151b4e97f469aac94388a7ffbf4f3ab0 commit ebd7ad28151b4e97f469aac94388a7ffbf4f3ab0 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-06 13:49:37 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:06 +0000 hastd: Fix nv data size check The data size check, as currently written, can be defeated by providing a very large number that rounds up to 0, which will pass the check (because zero plus the size of the header and name is smaller than the size of the message) but cause a segfault later when used to index the data array. Rewrite the data size check to take rounding into account, and add a cast to ensure the name size can't round up to zero. MFC after: 1 week PR: 266827 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51615 (cherry picked from commit 3caee2a93f235ebcfe3a8ec99eb2c3f3e5b0438f) --- sbin/hastd/nv.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sbin/hastd/nv.c b/sbin/hastd/nv.c index fd6b56c1148d..4e50d0026e7b 100644 --- a/sbin/hastd/nv.c +++ b/sbin/hastd/nv.c @@ -98,7 +98,7 @@ struct nvhdr { } __packed; #define NVH_DATA(nvh) ((unsigned char *)nvh + NVH_HSIZE(nvh)) #define NVH_HSIZE(nvh) \ - (sizeof(struct nvhdr) + roundup2((nvh)->nvh_namesize, 8)) + (sizeof(struct nvhdr) + roundup2((size_t)(nvh)->nvh_namesize, 8)) #define NVH_DSIZE(nvh) \ (((nvh)->nvh_type & NV_ORDER_MASK) == NV_ORDER_HOST ? \ (nvh)->nvh_dsize : \ @@ -248,11 +248,8 @@ nv_validate(struct nv *nv, size_t *extrap) break; } dsize = NVH_DSIZE(nvh); - if (dsize == 0) { - error = EINVAL; - break; - } - if (size < NVH_SIZE(nvh)) { + if (roundup2(dsize, 8) == 0 || + roundup2(dsize, 8) > size - NVH_HSIZE(nvh)) { error = EINVAL; break; } From nobody Thu Aug 14 16:03:14 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlk5xctz64g5n; Thu, 14 Aug 2025 16:03: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 4c2qlk3Fd1z3K3F; Thu, 14 Aug 2025 16:03:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ArLVAJqjI3F4GBxSHa3wkv1SBxhsayi606KfoOnf3yw=; b=Et10iSGENsYkwP4AxU032gXrPuiGurkohx+GoqnU3S1U15fwXHWUx1PZviaJkuCmxzGGFw n1j5uXP7jPryS2drsge5+mmnEkBls5NmEMeipovGIzgSn3RHtCWgslNyCzSf2xr73tAdbB vcke+MWK0uq8Nb99a+fNmkU6OA4tWRal0fyMvrioJt2U4Juuw4FknGXE39Hq0+XcU4doyD IdCXVcNODeGzLTpmZ+Z98H0ZSB3umaAE6JzQm02syxB9cXYDRU3R7XrlzFu/le6PZBkfLy VFhRaPTht5Sjmt2tL4o6htQ5HF5zJSyGnko8lyljSIYpgeW+isuG4kqDRzIt2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ArLVAJqjI3F4GBxSHa3wkv1SBxhsayi606KfoOnf3yw=; b=Ak6is2jwag/yB+AMhieT1YSIQbP+UaQmk09aY2QqPw6SRubxSSxzqyvaK33FEugJD60Ta3 Ue6Bulyd5/l9csZbX4cWSlfQ7Wt2C3UaEwDmVKMe3jJCwjnu50VKTHZXcziNfYOF/zqMK3 8wd5D31JiGjPAIc3kFmHQq+GD+wrqzgeuEygkQdMry6/efrlGwYznOslcNaNNTDv0ku5YH LoQ9DJ0TEsrgqKyMKMvkBYquNEwBhP5LERr6/jklkSO9wpTIfM8Y8MkQDcgT4tCTGvMhXu pfDFqJuZKBJvnPbuSWwpqT93PG8yw5LjExqjA6eKG3waUE3s58jEwq8EC/rmnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187394; a=rsa-sha256; cv=none; b=KgWfodj4aigG+0B0/qcl4gw3VfcFHzszbukE+SMo5eFxbRy+XOEdlwmkkKr2fJdf1ZzWuP p4UonqdC4im6f2ZEpD0grHHaOyY30inHrkYn/ofCSGOpc6abQFB+E+FyhLqx4YAY7/Af0Z SqGOT07wX1FNNZD0Nktzd7yTMFg4Ggi7zCpCQzfVJ7KKlGTNZUe1mC81Yjrhd2ACZCrXwX QtUSHbFXtC9QBDce00iD6Jbuo5f/A2nMkpX6YtZKlR7FZJ+NUfC66cAKG/Fu4hN+07gaed Oxq2P7RCVjWkM9OFfTiWJNozsfVhsJegsIcAP551VQqUusjbv5MRWPlHP6ReEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlk2qfLz10XL; Thu, 14 Aug 2025 16:03: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 57EG3EQG079952; Thu, 14 Aug 2025 16:03:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3EXM079949; Thu, 14 Aug 2025 16:03:14 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:14 GMT Message-Id: <202508141603.57EG3EXM079949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 62df4a7dd8e0 - stable/14 - hastd: Fix nv data size check List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 62df4a7dd8e0cd0c27da54966f540dfb5c543658 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=62df4a7dd8e0cd0c27da54966f540dfb5c543658 commit 62df4a7dd8e0cd0c27da54966f540dfb5c543658 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-06 13:49:37 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:09 +0000 hastd: Fix nv data size check The data size check, as currently written, can be defeated by providing a very large number that rounds up to 0, which will pass the check (because zero plus the size of the header and name is smaller than the size of the message) but cause a segfault later when used to index the data array. Rewrite the data size check to take rounding into account, and add a cast to ensure the name size can't round up to zero. MFC after: 1 week PR: 266827 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51615 (cherry picked from commit 3caee2a93f235ebcfe3a8ec99eb2c3f3e5b0438f) --- sbin/hastd/nv.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sbin/hastd/nv.c b/sbin/hastd/nv.c index fd6b56c1148d..4e50d0026e7b 100644 --- a/sbin/hastd/nv.c +++ b/sbin/hastd/nv.c @@ -98,7 +98,7 @@ struct nvhdr { } __packed; #define NVH_DATA(nvh) ((unsigned char *)nvh + NVH_HSIZE(nvh)) #define NVH_HSIZE(nvh) \ - (sizeof(struct nvhdr) + roundup2((nvh)->nvh_namesize, 8)) + (sizeof(struct nvhdr) + roundup2((size_t)(nvh)->nvh_namesize, 8)) #define NVH_DSIZE(nvh) \ (((nvh)->nvh_type & NV_ORDER_MASK) == NV_ORDER_HOST ? \ (nvh)->nvh_dsize : \ @@ -248,11 +248,8 @@ nv_validate(struct nv *nv, size_t *extrap) break; } dsize = NVH_DSIZE(nvh); - if (dsize == 0) { - error = EINVAL; - break; - } - if (size < NVH_SIZE(nvh)) { + if (roundup2(dsize, 8) == 0 || + roundup2(dsize, 8) > size - NVH_HSIZE(nvh)) { error = EINVAL; break; } From nobody Thu Aug 14 16:03:15 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlm1xfNz64g6p; Thu, 14 Aug 2025 16:03: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 4c2qll4nBXz3KHn; Thu, 14 Aug 2025 16:03:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=K2MPD+dYVkoaPtrxBpivmFhS0yBn20MHsQurwo6nux8=; b=PTkS/7dlEZdKTJcyH8eP8UGZHTxjUAAoGAVZsnh6hutDvaSxTkjs+rqxCramRtk1D9endt cakl4WVBxeL4TtZYdTCDSFe+LAFmu/U2+CnBVXF6CBb4muUjU46x4mzozmS3c4yUEiDc+K BmlZv/e1ZH2fPUv/xtHfnGrGrrrlcJtwfFREcqepezM94JwgDdbBokCGYYkIVHb0Zt2H01 ZywwURKdxFUijxhCbxvVNUl0D92q+P9g6I+9IXmhAK+F25FnunVFbhtGiumvWO1FlbGTFt IZ85jElVBSvPNzV7VK39d4aZKlEZY7XtI1om0Q0oRAjZCD1oROQDY7SLjp/JFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=K2MPD+dYVkoaPtrxBpivmFhS0yBn20MHsQurwo6nux8=; b=knGEzqVeMfTiGGAhjrX/OhwpiQ3+eNGDXntxuQVwjdGOmWmyfVJFPbAg93y8bJxBYxftr2 PBWAWJFOKkwwZMDpmOrZYvZxpbs8BNgMEm3niZYJYEELcQC1pPxvyEGqaPj2Q7pfogdriZ cLfVLabFXpSAUTDNSbq1hJ5fEuh1XKxnqxc3G1vl/wc9NpEr3Low/A5Q50kqjstwK8wRlF wLgN75+IftU3GN11V9GV4iwHL4/gv4Q9sWy2/26zpcT63f93bB1kWl+39iGvt5/tYn7hKQ 7uTNSJOaKXak/9M9iV4VX6RJFP9Witiq/CmF42Myvl74VaMzesrw/dR1Zuw0Ww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187395; a=rsa-sha256; cv=none; b=nwBD+Z8CUzit7kB3QCjT9/oztBxObZ2i9Cxv4Boy+VXpAtIIfwEY5V6s71qcX5I1dZ99kt rf8GLlovKPPKRAb1ZYTjAXWjtqU3DduPxXWJ5G5SzdQWE8XsILqvyTjpEcWX7QkxyDddad 5CGnFmaZHVTYGLj+D1OWuV1cEw3SnoLJNZB1VSVomu8sItEbtgFS7i/mTN4buFKahU0F/D cl/fEKa9wwyUpjMLN6vltT5H4W82gFMemIZhsPc4xkJgVsdp4QzQzAC7gMa1q6hMI+cdE3 wqD7zh3le4Ksj6/h1Gztlb+OZ4QYMi2lhmiYWHoW9JRtEG0umYw9uJvoawsG/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 4c2qll3Kbyz10XM; Thu, 14 Aug 2025 16:03: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 57EG3FwW080021; Thu, 14 Aug 2025 16:03:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3FP0080017; Thu, 14 Aug 2025 16:03:15 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:15 GMT Message-Id: <202508141603.57EG3FP0080017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 9bdd39b9fe52 - stable/14 - indent: Simplify test script List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 9bdd39b9fe52c3fb9f7d2ec9322138defb01afcc Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=9bdd39b9fe52c3fb9f7d2ec9322138defb01afcc commit 9bdd39b9fe52c3fb9f7d2ec9322138defb01afcc Author: Dag-Erling Smørgrav AuthorDate: 2025-08-07 23:33:56 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:09 +0000 indent: Simplify test script Much of the test script was concerned with working around RCS tags and dealing with cases which don't apply to indent. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51795 (cherry picked from commit 0ecc679fd3da0720d6ba331ebcceca8e0760fa22) --- usr.bin/indent/tests/functional_test.sh | 55 +++++++++------------------------ 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/usr.bin/indent/tests/functional_test.sh b/usr.bin/indent/tests/functional_test.sh index 44538e5b6e12..3f4431038234 100755 --- a/usr.bin/indent/tests/functional_test.sh +++ b/usr.bin/indent/tests/functional_test.sh @@ -1,3 +1,5 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause # # Copyright 2016 Dell EMC # All rights reserved. @@ -29,61 +31,34 @@ SRCDIR=$(atf_get_srcdir) check() { - local tc=${1}; shift - - local indent=$(atf_config_get usr.bin.indent.test_indent /usr/bin/indent) - - # All of the files need to be in the ATF sandbox in order for the tests - # to pass. - atf_check cp ${SRCDIR}/${tc}* . + local tc=${1} + local profile_flag - # Remove $FreeBSD$ RCS expansions because they get re-indented, which - # changes the output - local out_file="${tc}.stdout" - if [ -f "${out_file}" ]; then - parsed_file=output_file.parsed + cp "${SRCDIR}/${tc%.[0-9]}".* . - atf_check -o save:$parsed_file sed -e '/\$FreeBSD.*\$/d' \ - ${tc}.stdout - out_flag="-o file:$parsed_file" - fi - local profile_file="${tc}.pro" - if [ -f "${profile_file}" ]; then - profile_flag="-P${profile_file}" + if [ -f "${tc}.pro" ]; then + profile_flag="-P${tc}.pro" else # Make sure we don't implicitly use ~/.indent.pro from the test # host, for determinism purposes. profile_flag="-npro" fi - sed -e '/\$FreeBSD.*\$/d' ${tc} > input_file.parsed - atf_check -s exit:${tc##*.} ${out_flag} ${indent} ${profile_flag} < input_file.parsed + atf_check -s exit:${tc##*.} -o file:"${tc}.stdout" \ + indent ${profile_flag} < "${tc}" } -add_testcase() +add_legacy_testcase() { local tc=${1} - local tc_escaped word - - case "${tc%.*}" in - *-*) - local IFS="-" - for word in ${tc%.*}; do - tc_escaped="${tc_escaped:+${tc_escaped}_}${word}" - done - ;; - *) - tc_escaped=${tc%.*} - ;; - esac - atf_test_case ${tc_escaped} - eval "${tc_escaped}_body() { check ${tc}; }" - atf_add_test_case ${tc_escaped} + atf_test_case ${tc%.[0-9]} + eval "${tc%.[0-9]}_body() { check ${tc}; }" + atf_add_test_case ${tc%.[0-9]} } atf_init_test_cases() { - for path in $(find -Es "${SRCDIR}" -regex '.*\.[0-9]+$'); do - add_testcase ${path##*/} + for tc in $(find -s "${SRCDIR}" -name '*.[0-9]'); do + add_legacy_testcase "${tc##*/}" done } From nobody Thu Aug 14 16:03:16 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qln00wHz64fqT; Thu, 14 Aug 2025 16:03: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 4c2qlm4XS1z3JxX; Thu, 14 Aug 2025 16:03:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJMXRzUKo1sUqnfWOrh3qcprRsLy3s6HLvHb0O4S4mo=; b=MRow3r32wsImwoB/qwgde2+zkRLMlhGdEPaahw/E4d70IHI1SrKDythrZbE37W63p77MCr mP/Z6adDXJvwJiS/yFlOCa4SdFgExHxo5TzchoP682LbSh7mkHilaRBkSvY826Nve4sDFM DulyuwwZr/WDtLhnZ6/MtVZbMkQXSpyOjxSKXefXHULl04zCC4nkIrTK6tQESMRg6dvP2R 3zkbX+mgWtj6JrWqrLi0nOr80GDF+OClaP3TISf3WX9wR3jT8mLRmaCQTNP3ZTJ3ZZjo+q JaeumVIyiRt21vlnrN596tVMfY9DcQbkeR8die1uT6bLJS3JaIlEuNuxxpfcfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lJMXRzUKo1sUqnfWOrh3qcprRsLy3s6HLvHb0O4S4mo=; b=k/738pW0VQ3fCc9Zy0e9zGnL3hfzi1KjsTQlWgVlzJbaLeYiZmeB6zpIC90Vyms7Erb0ca xMfQPf2UoG2y73MP8lUjMV1TB3IxuqMwUGClUUw7A7DdYLB5WP5IWn/QPPVheKGeRfe4qK AZboqEElalSQgEspqarGphIQp8hEespL2A+x5cfZiST4Cj9+HyuVHo197YykUPs6oJlTdd JBUiWZLEF+fhPpuV1sNRY5lNexhnqh9By5CXPkAjKiMkZxm00FGs5qXJtM1X0L/TT5P6zD sdwVLznUlqrE+HEdIremeyKDGDp6yAsrEaWrOxJWM73Rggr0Y6KSpk7ADKSYAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187396; a=rsa-sha256; cv=none; b=IG5bpsuPBQiqYKqaOuQ/9J51IDO+8viehzTEekej/XVZEoh1k5wMb8rFF+ueuggZlcq2n3 vucaWPJO3wL8DMrJz9pOry9ddci8YBtfZ5+Nq449rw9RUqyYnmgY7LbuOyQn6SeiBm7m3u 5M34dcQ8ADokM964R2fll8YrqQzdGkivJ2koXPuFUNEFaDMhshlBt3zfmM/VPugd9oTMUb aVfTuV4/L8go95Qi5BTNCPZC2WeEPnMBTUW+i7RwKCkF7kW6zh804DX0+k9/e8p51b53aM LEnYN1ZJOaVTi4Va3Fjya1fUM5OnYMuKVjNaxT/JQ40T7TXnIkYs+Gb2y2MmAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlm46Gjz10XN; Thu, 14 Aug 2025 16:03: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 57EG3GHg080063; Thu, 14 Aug 2025 16:03:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3GAP080060; Thu, 14 Aug 2025 16:03:16 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:16 GMT Message-Id: <202508141603.57EG3GAP080060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: d26dac01421e - stable/14 - indent: Fix buffer overflow List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: d26dac01421e780f673ebcb806f2c2b51531eab1 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=d26dac01421e780f673ebcb806f2c2b51531eab1 commit d26dac01421e780f673ebcb806f2c2b51531eab1 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-07 23:34:07 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:09 +0000 indent: Fix buffer overflow The function used to create a backup of the input before starting work used a static buffer and did not check that the file name it constructed did not overflow. Switch to using asprintf(), clean up the rest of the function, and update some comments that still referred to an earlier version of the code. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D51796 (cherry picked from commit eb41613d22977798f41dd979e4e4ec0965711916) --- usr.bin/indent/indent.c | 40 ++++++++++++++------------------- usr.bin/indent/tests/functional_test.sh | 18 +++++++++++++++ 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index 5d97a5069add..5e1c4f56f420 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -90,7 +90,6 @@ const char *out_name = "Standard Output"; /* will always point to name * of output file */ const char *simple_backup_suffix = ".BAK"; /* Suffix to use for backup * files */ -char bakfile[MAXPATHLEN] = ""; int main(int argc, char **argv) @@ -1238,41 +1237,35 @@ check_type: } /* - * copy input file to backup file if in_name is /blah/blah/blah/file, then - * backup file will be ".Bfile" then make the backup file the input and + * copy input file to backup file then make the backup file the input and * original input file the output */ static void bakcopy(void) { - int n, - bakchn; - char buff[8 * 1024]; - const char *p; - - /* construct file name .Bfile */ - for (p = in_name; *p; p++); /* skip to end of string */ - while (p > in_name && *p != '/') /* find last '/' */ - p--; - if (*p == '/') - p++; - sprintf(bakfile, "%s%s", p, simple_backup_suffix); + static char buff[8 * 1024]; + char *bakfile; + ssize_t len; + int bakfd; + + /* generate the backup file name */ + if (asprintf(&bakfile, "%s%s", in_name, simple_backup_suffix) < 0) + err(1, "%s%s", in_name, simple_backup_suffix); /* copy in_name to backup file */ - bakchn = creat(bakfile, 0600); - if (bakchn < 0) + bakfd = open(bakfile, O_RDWR | O_CREAT | O_TRUNC, 0600); + if (bakfd < 0) err(1, "%s", bakfile); - while ((n = read(fileno(input), buff, sizeof(buff))) > 0) - if (write(bakchn, buff, n) != n) + while ((len = read(fileno(input), buff, sizeof(buff))) > 0) + if (write(bakfd, buff, len) != len) err(1, "%s", bakfile); - if (n < 0) + if (len < 0) err(1, "%s", in_name); - close(bakchn); fclose(input); /* re-open backup file as the input file */ - input = fopen(bakfile, "r"); - if (input == NULL) + input = fdopen(bakfd, "r"); + if (input == NULL || fseek(input, 0, SEEK_SET) != 0) err(1, "%s", bakfile); /* now the original input file will be the output */ output = fopen(in_name, "w"); @@ -1280,6 +1273,7 @@ bakcopy(void) unlink(bakfile); err(1, "%s", in_name); } + free(bakfile); } static void diff --git a/usr.bin/indent/tests/functional_test.sh b/usr.bin/indent/tests/functional_test.sh index 3f4431038234..9cfe5878f69d 100755 --- a/usr.bin/indent/tests/functional_test.sh +++ b/usr.bin/indent/tests/functional_test.sh @@ -3,6 +3,7 @@ # # Copyright 2016 Dell EMC # All rights reserved. +# Copyright (c) 2025 Klara, Inc. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -56,9 +57,26 @@ add_legacy_testcase() atf_add_test_case ${tc%.[0-9]} } +atf_test_case backup_suffix +backup_suffix_body() +{ + local argmax=$(sysctl -n kern.argmax) + local suffix=$(jot -b .bak -s '' $((argmax/5))) + local code=$'int main() {}\n' + + printf "${code}" >input.c + + atf_check indent input.c + atf_check -o inline:"${code}" cat input.c.BAK + + atf_check -s exit:1 -e match:"name too long"\ + env SIMPLE_BACKUP_SUFFIX=${suffix} indent input.c +} + atf_init_test_cases() { for tc in $(find -s "${SRCDIR}" -name '*.[0-9]'); do add_legacy_testcase "${tc##*/}" done + atf_add_test_case backup_suffix } From nobody Thu Aug 14 16:03:16 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qln1YWCz64fhC; Thu, 14 Aug 2025 16:03: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 4c2qlm5tpcz3K3r; Thu, 14 Aug 2025 16:03:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sp2hdLWymnd785uLfGoJVKzUcFNqREkxL2rXnIN4n94=; b=RTc3uBu9+gbd/isjWDqdCyKkSBTXOvWHgVwfKPRq4c7vdwdQRWxdYJcGK+EUaMBy8dhSnA li+zcESa53pOjZztFHKaZ+uSnFoT0/QeLJ0hP0L3N2EyYaWcPfjbsGMdqBTqbzdZCx11EI tkhsltwkTFI6Hnumf0WMDoYsPmkkqzOdDMDJYc+ywMBTH6EIHhAx+3pGbDI7TNKAy7p+mP nhAeU28mtqEiK8G1+yqvgVoQHb4WzvMPqG5Aunwu8L1N4UOuItDdcRG5keysHOCzA+f/yx vF4TNnh2oeoReoc5c7Q2wSXvtpSg5+Po4uVy+9fcUrAkl3FoIx24930o1Okxgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sp2hdLWymnd785uLfGoJVKzUcFNqREkxL2rXnIN4n94=; b=g4Ptnom6xxjVO00R3x908AdnN0SJpVhKv4yrh3nZ9x9oxTdtZ29uJ5S9IiwPeeFrCYdg9C +Tm7pPEwI5BdKtFJw8mj3WhCGwp+EAszxL44NvrFJoEW4Fkqu8ex0KdAS91rMJnBuit1rK O+Uncr6OLib6E1NN1BR/qUA/j02X5YPSVSsbES/6o6vzMtKV9SKy0A8hLjdHqur0ksrQk5 vtQG4DObnQN1Z+QXo24RqLtn5nvTVjtMbcwxN3G/sSR0NvmJhVWPNpAoKtBYt74VLsNOEY GL7lpeiU4qEIykNPNDzaghi/hiS2U1o2uxIZ7JVvtJ57gsOwVwaIBPp5Ioywdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187396; a=rsa-sha256; cv=none; b=QwUm9DRMgYtDCGwj5bhTC0VjPOowutXjrNIEgCYt3yt2lMlqEP+lJBxfhSTNqdgKmBtHQa T752JztobpaTYbmcnutHS9FA9VZVR5OHDb7NnJHeihBw8Joz8hgduQfgmWB566xzPVkX/2 55oD79lEX0Dod3J5T+h/uD7jamql2T8h9GfquY7PFgBESetTYaS7p52eif+aRCVv9CSiVC 0SYovgcmItl9JCRpAAGeblHgCIC1MHEyrFj/+IOmoglM6cKi4zL7ghndEakocMX+pHdDh1 KbLLCw3i+Kx222NXTZ/3NS4X8YQiJcJ3s4wiSzsNyF0sc4AD52I1lgmFgSfYHQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlm4VlTz10Tk; Thu, 14 Aug 2025 16:03: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 57EG3GPC080096; Thu, 14 Aug 2025 16:03:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3GV8080093; Thu, 14 Aug 2025 16:03:16 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:16 GMT Message-Id: <202508141603.57EG3GV8080093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 831799f6d3a9 - stable/13 - indent: Simplify test script List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 831799f6d3a981ee44fabf1c4a89eb78706c1bd4 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=831799f6d3a981ee44fabf1c4a89eb78706c1bd4 commit 831799f6d3a981ee44fabf1c4a89eb78706c1bd4 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-07 23:33:56 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:06 +0000 indent: Simplify test script Much of the test script was concerned with working around RCS tags and dealing with cases which don't apply to indent. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51795 (cherry picked from commit 0ecc679fd3da0720d6ba331ebcceca8e0760fa22) --- usr.bin/indent/tests/functional_test.sh | 55 +++++++++------------------------ 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/usr.bin/indent/tests/functional_test.sh b/usr.bin/indent/tests/functional_test.sh index 44538e5b6e12..3f4431038234 100755 --- a/usr.bin/indent/tests/functional_test.sh +++ b/usr.bin/indent/tests/functional_test.sh @@ -1,3 +1,5 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause # # Copyright 2016 Dell EMC # All rights reserved. @@ -29,61 +31,34 @@ SRCDIR=$(atf_get_srcdir) check() { - local tc=${1}; shift - - local indent=$(atf_config_get usr.bin.indent.test_indent /usr/bin/indent) - - # All of the files need to be in the ATF sandbox in order for the tests - # to pass. - atf_check cp ${SRCDIR}/${tc}* . + local tc=${1} + local profile_flag - # Remove $FreeBSD$ RCS expansions because they get re-indented, which - # changes the output - local out_file="${tc}.stdout" - if [ -f "${out_file}" ]; then - parsed_file=output_file.parsed + cp "${SRCDIR}/${tc%.[0-9]}".* . - atf_check -o save:$parsed_file sed -e '/\$FreeBSD.*\$/d' \ - ${tc}.stdout - out_flag="-o file:$parsed_file" - fi - local profile_file="${tc}.pro" - if [ -f "${profile_file}" ]; then - profile_flag="-P${profile_file}" + if [ -f "${tc}.pro" ]; then + profile_flag="-P${tc}.pro" else # Make sure we don't implicitly use ~/.indent.pro from the test # host, for determinism purposes. profile_flag="-npro" fi - sed -e '/\$FreeBSD.*\$/d' ${tc} > input_file.parsed - atf_check -s exit:${tc##*.} ${out_flag} ${indent} ${profile_flag} < input_file.parsed + atf_check -s exit:${tc##*.} -o file:"${tc}.stdout" \ + indent ${profile_flag} < "${tc}" } -add_testcase() +add_legacy_testcase() { local tc=${1} - local tc_escaped word - - case "${tc%.*}" in - *-*) - local IFS="-" - for word in ${tc%.*}; do - tc_escaped="${tc_escaped:+${tc_escaped}_}${word}" - done - ;; - *) - tc_escaped=${tc%.*} - ;; - esac - atf_test_case ${tc_escaped} - eval "${tc_escaped}_body() { check ${tc}; }" - atf_add_test_case ${tc_escaped} + atf_test_case ${tc%.[0-9]} + eval "${tc%.[0-9]}_body() { check ${tc}; }" + atf_add_test_case ${tc%.[0-9]} } atf_init_test_cases() { - for path in $(find -Es "${SRCDIR}" -regex '.*\.[0-9]+$'); do - add_testcase ${path##*/} + for tc in $(find -s "${SRCDIR}" -name '*.[0-9]'); do + add_legacy_testcase "${tc##*/}" done } From nobody Thu Aug 14 16:03:17 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qln6lGBz64fqY; Thu, 14 Aug 2025 16:03: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 4c2qln5GYCz3K1H; Thu, 14 Aug 2025 16:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e2TW9PoU4/FifDrpddpXvG5tb0ozj63KlTzzjbBDpas=; b=DiduHwWLt62Ofb5fjqC77M8gR8qP76Qyc0lUoJkSTtLcjc+w0dRGg5soVOCXkjQvji2C2t rgN5V6EO62tXyNXrbS1X18uTGyuG4PXtX8jcOyT7Jxl9oxNOZvuQ7r0kMicXKSje2635PI EKygbUi9zMJslf4rcMBEUKDZ2R808J7wxbStpqXfBLDyStSr7NkYwXDwdGSkr1YJboFsCr IKIUfqLLP+hpoJJJCqDAXmnwX++UYpIXm6+ZppXQyGY77b+knNr4AmeC9SD2nJUGQfR6sO +b+WVHfDX5paKVM24xSkyEeXS9YVVeP9ui/f/FkDjuw9IH+ICuxoGseW9YzaWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=e2TW9PoU4/FifDrpddpXvG5tb0ozj63KlTzzjbBDpas=; b=wnJq757F/0cMh9INMm1Q+GM+9zGO9KSH5c0nI62TPiGLaIrrLrdY9I/jMAT9hZ1ZbrWIN7 q1Uxs6OwCNl55P2cdlL3zE2usgAL6jaPX9s/MGb6fYE3tqhju9fWl4oR3ThsOnAOLELB7a m0kWoBEzVnDhsIiFfjgYAgZwdKxJiu3gSSKkxot4di80JJJyiz69xFctL61MDxjTLRzuGF JhXD407ClRgDdzRKHrU44r+MBQXPVtmNrpTrFEU0L/QkmB5KomktL5N5DYf1KU5OmluvrZ 5ht6HZfuSKaMHIHipFmBR9+/iUwY9/5w4A6i26pvk7AgCojyb9Ciuf3v3HVI9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187397; a=rsa-sha256; cv=none; b=jYusLvsqUlSM4WxHO06ix5tXh1NbV+chx2nh2KcnJadLOqPROA+sXHyKE10YhCO//TxEp7 YQc3SVDcNed9nqZ05e+TTRye1L7RTXoNgWwhaySD4xXMHumNnv338hRwlmYLIe+l22uuUv yMA4vjFfL55TjCxFmb/4tSXvfWkvqVm+ZTe3X4/YqEAcyLRPiLs2tTUtfMVh42A4XMnJ3u vK8nAn43f3frkONJBDljC91xpTPtU1KR1+O7HZt6UDaZvI4uvnuvtGYZgm2KAimFwdN7ER B39ezE6y+Sb6KxFbH6Ju5mAujY8/faQwQccftKyHCSWAino6tXVvtC8Dzwe2wg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qln4mnDz10rV; Thu, 14 Aug 2025 16:03: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 57EG3Hf7080165; Thu, 14 Aug 2025 16:03:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3HjL080157; Thu, 14 Aug 2025 16:03:17 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:17 GMT Message-Id: <202508141603.57EG3HjL080157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 89906b9b20fd - stable/14 - stdio: Fix bug in integer-parsing FSM List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 89906b9b20fd0aaf33e4eaea14b99190179ad572 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=89906b9b20fd0aaf33e4eaea14b99190179ad572 commit 89906b9b20fd0aaf33e4eaea14b99190179ad572 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-08 22:17:19 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:09 +0000 stdio: Fix bug in integer-parsing FSM If we encounter a zero in the havezero state, we should assume octal, just like we would if we encountered any other digit below 8. MFC after: 1 week PR: 288440 Fixes: d9dc1603d6e4 ("libc: Implement N2630.") Reviewed by: mandree Differential Revision: https://reviews.freebsd.org/D51832 (cherry picked from commit 602e98dd35ea5041b800fb56a2b1ac34f6649310) --- lib/libc/stdio/vfscanf.c | 5 ++--- lib/libc/stdio/vfwscanf.c | 5 ++--- lib/libc/tests/stdio/sscanf_test.c | 25 +++++++++++++++++++++++++ lib/libc/tests/stdio/swscanf_test.c | 25 +++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index 37616e64570c..5763f5c0e815 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -321,10 +321,9 @@ parseint_fsm(int c, enum parseint_state *state, int *base) case '0': if (*state == begin || *state == havesign) { *state = havezero; - } else { - *state = any; + return 1; } - return 1; + /* FALL THROUGH */ case '1': case '2': case '3': diff --git a/lib/libc/stdio/vfwscanf.c b/lib/libc/stdio/vfwscanf.c index fff3dbeac9ea..3729c00f7aa1 100644 --- a/lib/libc/stdio/vfwscanf.c +++ b/lib/libc/stdio/vfwscanf.c @@ -303,10 +303,9 @@ parseint_fsm(wchar_t c, enum parseint_state *state, int *base) case '0': if (*state == begin || *state == havesign) { *state = havezero; - } else { - *state = any; + return 1; } - return 1; + /* FALL THROUGH */ case '1': case '2': case '3': diff --git a/lib/libc/tests/stdio/sscanf_test.c b/lib/libc/tests/stdio/sscanf_test.c index e916873d38c3..e43292820eeb 100644 --- a/lib/libc/tests/stdio/sscanf_test.c +++ b/lib/libc/tests/stdio/sscanf_test.c @@ -68,6 +68,31 @@ static const struct sscanf_test_case { { "0e", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 2 }, { 1, 0, 1 }, }, { "0f", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 2 }, { 1, 0, 1 }, }, { "0x", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, }, + // all digits with two leading zeroes + { "000", { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, }, + { "001", { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, }, + { "002", { 1, 0, 2 }, { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, }, + { "003", { 1, 0, 2 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, }, + { "004", { 1, 0, 2 }, { 1, 4, 3 }, { 1, 4, 3 }, { 1, 4, 3 }, { 1, 4, 3 }, }, + { "005", { 1, 0, 2 }, { 1, 5, 3 }, { 1, 5, 3 }, { 1, 5, 3 }, { 1, 5, 3 }, }, + { "006", { 1, 0, 2 }, { 1, 6, 3 }, { 1, 6, 3 }, { 1, 6, 3 }, { 1, 6, 3 }, }, + { "007", { 1, 0, 2 }, { 1, 7, 3 }, { 1, 7, 3 }, { 1, 7, 3 }, { 1, 7, 3 }, }, + { "008", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 8, 3 }, { 1, 8, 3 }, { 1, 0, 2 }, }, + { "009", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 9, 3 }, { 1, 9, 3 }, { 1, 0, 2 }, }, + { "00A", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 10, 3 }, { 1, 0, 2 }, }, + { "00B", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 11, 3 }, { 1, 0, 2 }, }, + { "00C", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 12, 3 }, { 1, 0, 2 }, }, + { "00D", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 13, 3 }, { 1, 0, 2 }, }, + { "00E", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 14, 3 }, { 1, 0, 2 }, }, + { "00F", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 15, 3 }, { 1, 0, 2 }, }, + { "00X", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, }, + { "00a", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 10, 3 }, { 1, 0, 2 }, }, + { "00b", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 11, 3 }, { 1, 0, 2 }, }, + { "00c", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 12, 3 }, { 1, 0, 2 }, }, + { "00d", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 13, 3 }, { 1, 0, 2 }, }, + { "00e", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 14, 3 }, { 1, 0, 2 }, }, + { "00f", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 15, 3 }, { 1, 0, 2 }, }, + { "00x", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, }, // all digits with leading one { "10", { 1, 2, 2 }, { 1, 8, 2 }, { 1, 10, 2 }, { 1, 16, 2 }, { 1, 10, 2 }, }, { "11", { 1, 3, 2 }, { 1, 9, 2 }, { 1, 11, 2 }, { 1, 17, 2 }, { 1, 11, 2 }, }, diff --git a/lib/libc/tests/stdio/swscanf_test.c b/lib/libc/tests/stdio/swscanf_test.c index f7ad30b963a7..f0638081e16f 100644 --- a/lib/libc/tests/stdio/swscanf_test.c +++ b/lib/libc/tests/stdio/swscanf_test.c @@ -71,6 +71,31 @@ static const struct swscanf_test_case { { L"0e", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 2 }, { 1, 0, 1 }, }, { L"0f", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 2 }, { 1, 0, 1 }, }, { L"0x", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, }, + // all digits with two leading zeroes + { L"000", { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, { 1, 0, 3 }, }, + { L"001", { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, }, + { L"002", { 1, 0, 2 }, { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }, }, + { L"003", { 1, 0, 2 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, }, + { L"004", { 1, 0, 2 }, { 1, 4, 3 }, { 1, 4, 3 }, { 1, 4, 3 }, { 1, 4, 3 }, }, + { L"005", { 1, 0, 2 }, { 1, 5, 3 }, { 1, 5, 3 }, { 1, 5, 3 }, { 1, 5, 3 }, }, + { L"006", { 1, 0, 2 }, { 1, 6, 3 }, { 1, 6, 3 }, { 1, 6, 3 }, { 1, 6, 3 }, }, + { L"007", { 1, 0, 2 }, { 1, 7, 3 }, { 1, 7, 3 }, { 1, 7, 3 }, { 1, 7, 3 }, }, + { L"008", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 8, 3 }, { 1, 8, 3 }, { 1, 0, 2 }, }, + { L"009", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 9, 3 }, { 1, 9, 3 }, { 1, 0, 2 }, }, + { L"00A", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 10, 3 }, { 1, 0, 2 }, }, + { L"00B", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 11, 3 }, { 1, 0, 2 }, }, + { L"00C", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 12, 3 }, { 1, 0, 2 }, }, + { L"00D", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 13, 3 }, { 1, 0, 2 }, }, + { L"00E", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 14, 3 }, { 1, 0, 2 }, }, + { L"00F", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 15, 3 }, { 1, 0, 2 }, }, + { L"00X", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, }, + { L"00a", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 10, 3 }, { 1, 0, 2 }, }, + { L"00b", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 11, 3 }, { 1, 0, 2 }, }, + { L"00c", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 12, 3 }, { 1, 0, 2 }, }, + { L"00d", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 13, 3 }, { 1, 0, 2 }, }, + { L"00e", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 14, 3 }, { 1, 0, 2 }, }, + { L"00f", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 15, 3 }, { 1, 0, 2 }, }, + { L"00x", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, }, // all digits with leading one { L"10", { 1, 2, 2 }, { 1, 8, 2 }, { 1, 10, 2 }, { 1, 16, 2 }, { 1, 10, 2 }, }, { L"11", { 1, 3, 2 }, { 1, 9, 2 }, { 1, 11, 2 }, { 1, 17, 2 }, { 1, 11, 2 }, }, From nobody Thu Aug 14 16:03:18 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlq2n8Rz64g5x; Thu, 14 Aug 2025 16:03: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 4c2qlp6xszz3Jxp; Thu, 14 Aug 2025 16:03:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187399; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i1zYbQZF6srG3FDc5/yTUy6beE93GOY4oSl4PxVDTAw=; b=D9aDjXKsNf798bKr9AWT7wECk/E1FCArGZ9HGOl1YAK/JFbPms8mMXijmdbCG4nZK4y1Mz HpivlgOPfyBaMQzxrVUv4Jr9LUp9X/pwVZ1IZnA4ojPyciZ+p3BDtBU3jGzVB78+uutUwz /wnxxEY/HxSeqbttjbrGkHCWxlpUoi8/fvdaItVJhX76rV6JbFz9tD5qC5No+dO1tHv5sL lU5ftAJPZKsHMhAcBC5/ugS9HvFSpVXc/xtQMni65WMdWcVhIdSWyVMzhNN+tBNy2DBhOy TVPBvC61jKYmn0nRN7/1FJ6B+y9J8kNTCc2mEI/uHnJWbEPc9XPDiUtUGe5x/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187399; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i1zYbQZF6srG3FDc5/yTUy6beE93GOY4oSl4PxVDTAw=; b=oymgc1278yogOdlGDaHd0PJXzcH4DMC8nLgiHHExE/2iiZEc+Cal5/zijKscPsAkYDyD6H YUoWALASnCBVnuWO8caefldl0pvSWimKXSv06WPMcVbcX4YOVsS9Z2bp0xebdijDUmO3Bn UyAGqvK1dcH/NQZR8pL9bnI8OmthteFTlgxRUtNuAc9RNCw+7KddgtmGNxK+o8eN1Dm2Dm EfDIbtQqDza7jqq1q9JH1oN5+pO46b7AblCPnrleqiSmMVibvKhPUgJ9TlbQqhqSAM2q+6 7Ke9Q740QQCqgFVaZIlLdCy6T+X+NH3r8DfMYl8GXokvNZnxW1jjjvLm+pvXFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187399; a=rsa-sha256; cv=none; b=mJ3acY0hAnSGt3cbOFiRF5ZO2GoIeC34klrFS79APQ3ZnugppQPZd0hIcHbMBPM6awefFK L3wHZu2yRpvWAd2drr0e1hW4e+0VdBHq54IzlDlX2Ebw+nFUIFrMnA9vxR9Orb4PsaZcZD 5FfFS7WI9tZA5SY0oVm1suEj9GFpIQx/lrhFpwv8fXGt1e9eYIXIWyWb43Ez3Uvqx9y0T6 2nWjcYvfNz3P12eZ+0tYzSC6lcyhMbQ43o43pHZm9nNLnGrA214pKAaBlLkeCDBAxmzDmD +H5wa/BTfzLW3AahWveUK+ykLu4MLCgdCDNCSo9J48LI9w21FsookZ9/i2uXnA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlp62nJz10F9; Thu, 14 Aug 2025 16:03: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 57EG3ISs080237; Thu, 14 Aug 2025 16:03:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3ICR080229; Thu, 14 Aug 2025 16:03:18 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:18 GMT Message-Id: <202508141603.57EG3ICR080229@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 65cbf5862ead - stable/13 - kern.post.mk: Support flavors in PORTS_MODULES List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 65cbf5862eaddd0dfccc6c43e9054252d0ca788b Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=65cbf5862eaddd0dfccc6c43e9054252d0ca788b commit 65cbf5862eaddd0dfccc6c43e9054252d0ca788b Author: Dag-Erling Smørgrav AuthorDate: 2025-08-11 13:54:51 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:06 +0000 kern.post.mk: Support flavors in PORTS_MODULES MFC after: 1 week PR: 288596 Reviewed by: pkubaj Differential Revision: https://reviews.freebsd.org/D51833 (cherry picked from commit 988426e815c12a899c8c6853090b8c8fca7ed5cd) --- share/man/man7/build.7 | 10 +++++++--- sys/conf/kern.post.mk | 10 ++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 57280f967a38..2b36d68e6397 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2024 +.Dd August 8, 2025 .Dt BUILD 7 .Os .Sh NAME @@ -619,8 +619,12 @@ as part of the and .Cm installkernel process. -.Bd -literal -offset indent -make PORTS_MODULES=emulators/virtualbox-ose-kmod kernel +Each port must be specified as +.Ar category Ns Li / Ns Ar port Ns Op Li @ Ns Ar flavor , +e.g. +.Bd -literal +PORTS_MODULES=graphics/gpu-firmware-intel-kmod@kabylake +PORTS_MODULES+=graphics/drm-66-kmod .Ed .It Va LOCAL_MODULES A list of external kernel modules that should be built and installed diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 6664afc2bf16..5301a711bcb5 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -132,7 +132,10 @@ PORTSMODULESENV=\ all: .for __i in ${PORTS_MODULES} @${ECHO} "===> Ports module ${__i} (all)" - cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B clean build + port=${__i}; flavor=$${port#*@}; port=$${port%@*}; flavor=$${flavor%$${port}}; \ + cd ${PORTSDIR:U/usr/ports}/$${port}; \ + ${PORTSMODULESENV} ${MAKE} -B $${flavor:+FLAVOR=}$${flavor} \ + clean build .endfor .for __target in install reinstall clean @@ -140,7 +143,10 @@ ${__target}: ports-${__target} ports-${__target}: .for __i in ${PORTS_MODULES} @${ECHO} "===> Ports module ${__i} (${__target})" - cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B ${__target:C/(re)?install/deinstall reinstall/} + port=${__i}; flavor=$${port#*@}; port=$${port%@*}; flavor=$${flavor%$${port}}; \ + cd ${PORTSDIR:U/usr/ports}/$${port}; \ + ${PORTSMODULESENV} ${MAKE} -B $${flavor:+FLAVOR=}$${flavor} \ + ${__target:C/(re)?install/deinstall reinstall/} .endfor .endfor .endif From nobody Thu Aug 14 16:03:17 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlp0Trxz64ffQ; Thu, 14 Aug 2025 16:03: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 4c2qln5b2kz3KFK; Thu, 14 Aug 2025 16:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=44CBOtCuHgmFI2xAZhjU1larLSiHOQTzd22G9mzjETs=; b=xP2XTMZ0/ib+jrfiEj4vFPFg4tzjG4dMSSrd72rYxtq8PhBW03vJnsGS0t6Jp9wpnW+QM0 Ulg8IcJmKBmbkbsi1fpXvpuwgAQoBwQAydQrq9L2GMhl5oygZCLftanZWebC2CNY3iu/3S QVQj4cCLMJRGfEbTxck3i14L34U+6Vo0CEYkUX0+bp9B3l6ucBl6GlpHFT+cU7Lgj4eUub EQebbUj3Ev0JmwJoGKNgGhges1nRqaAwT2FpjLTG5uKN5ySoM1gO1gsZVpTv+19gCD74M7 /dqnNu5VwVYvO0JAiaZEjZ6b1uhiRSHiN9oPAHt2bdEXgkhRHCu/bT43OZJLSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=44CBOtCuHgmFI2xAZhjU1larLSiHOQTzd22G9mzjETs=; b=awU3HI3vCjSnz22rbeytj6sf+p8V4y6j1dJ+2BDah5KuzeeuUsiE27H84XQz2SLLwI2Fix 25Zdkr0hCrLEjjSC1fNtrLGbQdllUs1iw8b8fGT8rUL9lO+rj5642DybKehiWgb7JqpscV R5HLf0mo0YIKCQ+PLPLFYdkSIDiyY9J/EAfoaq3WWiRjk23f/9sPKG+oWFTjaZxplaijDI GVk+lO6CghIyS1VC5TSEr9Vp9njLh8Hk7sLiQrrqyHnwmjF0v1sIGB0uyQBv84ADJuTzri GY9Nw93xSLOYxg7AmUqeOzYLZu6D9ni0/Ff6NeDf+7HCv3iSEokZL74+9fdAqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187397; a=rsa-sha256; cv=none; b=oOp1gR11J4eQD+ciGsynPXPjCj/gPNECNK14c0nvU5mF5JwX44d02Mf2aqel3oUo7GXT4N Z/ZMYd6Wvy+fFeuNJYGS2EIGwVQ5ojePI2+Am0++cIMDmTd748wX0Hvh2wc5KjpnCnw1XI mlOqfaEfR3F0pyuK5r1qEU0t5i3Qzbpt2mIYhOKP1ujwxaoZWVQjx3RX0YOQZ67MqKsi3v s/3YOLt1FdFsiEIjHEgNvHCxogfH+wbkxO21oUBYzl6yukK0onXZje7Qs03Nz3Y9WMjyMB bC1/OWAAVK5zcZ2TmGFaSgEc32bt7lMvxyb7hR6aj4CC6OXOA3A7a/SK1HScnA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qln543xz10Tl; Thu, 14 Aug 2025 16:03: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 57EG3Hv4080166; Thu, 14 Aug 2025 16:03:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3H4k080163; Thu, 14 Aug 2025 16:03:17 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:17 GMT Message-Id: <202508141603.57EG3H4k080163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 1229e3a06de9 - stable/13 - indent: Fix buffer overflow List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1229e3a06de93a16b46185f41e4f64db6de63896 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=1229e3a06de93a16b46185f41e4f64db6de63896 commit 1229e3a06de93a16b46185f41e4f64db6de63896 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-07 23:34:07 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:06 +0000 indent: Fix buffer overflow The function used to create a backup of the input before starting work used a static buffer and did not check that the file name it constructed did not overflow. Switch to using asprintf(), clean up the rest of the function, and update some comments that still referred to an earlier version of the code. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D51796 (cherry picked from commit eb41613d22977798f41dd979e4e4ec0965711916) --- usr.bin/indent/indent.c | 40 ++++++++++++++------------------- usr.bin/indent/tests/functional_test.sh | 18 +++++++++++++++ 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index 5d97a5069add..5e1c4f56f420 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -90,7 +90,6 @@ const char *out_name = "Standard Output"; /* will always point to name * of output file */ const char *simple_backup_suffix = ".BAK"; /* Suffix to use for backup * files */ -char bakfile[MAXPATHLEN] = ""; int main(int argc, char **argv) @@ -1238,41 +1237,35 @@ check_type: } /* - * copy input file to backup file if in_name is /blah/blah/blah/file, then - * backup file will be ".Bfile" then make the backup file the input and + * copy input file to backup file then make the backup file the input and * original input file the output */ static void bakcopy(void) { - int n, - bakchn; - char buff[8 * 1024]; - const char *p; - - /* construct file name .Bfile */ - for (p = in_name; *p; p++); /* skip to end of string */ - while (p > in_name && *p != '/') /* find last '/' */ - p--; - if (*p == '/') - p++; - sprintf(bakfile, "%s%s", p, simple_backup_suffix); + static char buff[8 * 1024]; + char *bakfile; + ssize_t len; + int bakfd; + + /* generate the backup file name */ + if (asprintf(&bakfile, "%s%s", in_name, simple_backup_suffix) < 0) + err(1, "%s%s", in_name, simple_backup_suffix); /* copy in_name to backup file */ - bakchn = creat(bakfile, 0600); - if (bakchn < 0) + bakfd = open(bakfile, O_RDWR | O_CREAT | O_TRUNC, 0600); + if (bakfd < 0) err(1, "%s", bakfile); - while ((n = read(fileno(input), buff, sizeof(buff))) > 0) - if (write(bakchn, buff, n) != n) + while ((len = read(fileno(input), buff, sizeof(buff))) > 0) + if (write(bakfd, buff, len) != len) err(1, "%s", bakfile); - if (n < 0) + if (len < 0) err(1, "%s", in_name); - close(bakchn); fclose(input); /* re-open backup file as the input file */ - input = fopen(bakfile, "r"); - if (input == NULL) + input = fdopen(bakfd, "r"); + if (input == NULL || fseek(input, 0, SEEK_SET) != 0) err(1, "%s", bakfile); /* now the original input file will be the output */ output = fopen(in_name, "w"); @@ -1280,6 +1273,7 @@ bakcopy(void) unlink(bakfile); err(1, "%s", in_name); } + free(bakfile); } static void diff --git a/usr.bin/indent/tests/functional_test.sh b/usr.bin/indent/tests/functional_test.sh index 3f4431038234..9cfe5878f69d 100755 --- a/usr.bin/indent/tests/functional_test.sh +++ b/usr.bin/indent/tests/functional_test.sh @@ -3,6 +3,7 @@ # # Copyright 2016 Dell EMC # All rights reserved. +# Copyright (c) 2025 Klara, Inc. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -56,9 +57,26 @@ add_legacy_testcase() atf_add_test_case ${tc%.[0-9]} } +atf_test_case backup_suffix +backup_suffix_body() +{ + local argmax=$(sysctl -n kern.argmax) + local suffix=$(jot -b .bak -s '' $((argmax/5))) + local code=$'int main() {}\n' + + printf "${code}" >input.c + + atf_check indent input.c + atf_check -o inline:"${code}" cat input.c.BAK + + atf_check -s exit:1 -e match:"name too long"\ + env SIMPLE_BACKUP_SUFFIX=${suffix} indent input.c +} + atf_init_test_cases() { for tc in $(find -s "${SRCDIR}" -name '*.[0-9]'); do add_legacy_testcase "${tc##*/}" done + atf_add_test_case backup_suffix } From nobody Thu Aug 14 16:03:18 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlq2mrpz64fyd; Thu, 14 Aug 2025 16:03: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 4c2qlp6d6mz3KJH; Thu, 14 Aug 2025 16:03:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t+dGOm3LZo2hRm3zfDKdjaIKvE8psnytTIETtyD+DhU=; b=uGzxso0TCtjekHn+EcUjrWVEZoP6Ik78m/FuJh7dJ+yS4QXs9pSPYNdrM1EPC6Ct+dBZbG bWb3OXteEgfh15ei4wIV2Z5bV9oOy/8lOEbIxyivzVl8LD1lx6wLpUfMqM6MweH1sS1JUi DvZsucbCwTSwBY/ZToV4l0m3CAjMqzn9pZak44Hte764GcT9qdgnujpZ5OoLT/eWfRMZlk fzfrMYgIqLAYSVcU77+4Od2woZP0wjiR4XvY+AIMZ+7UTUupS8y1uEehQapoHHQ1EHjtte qMif0yrAYYrk7wDvRettG4nRm7dJG3NVfkbv4GzqjFMA7D0xzjpuWRTZtYZc1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t+dGOm3LZo2hRm3zfDKdjaIKvE8psnytTIETtyD+DhU=; b=XUEo8t87yMhnhFjZAy+NutxyR1Y/GFXeHzHWl2Or5DkBN6kuF2nVlDxlPxDmYK3aPNfPj1 dAk1aMCsgXbD4I7/v1b5ZltRaQx2sSoC7Be1Cm8KNb5J7HrHiG2VtEYUnf6c1Kx5V6A6ET oXRuoFKFydGsQDvGuLzKfgxdJ2U8SbSeHVmn+8XNxMy5fGWinnkUK1pbQsK8QEEaDVSG1E 6WX4YOR0ZMvuGqzgUuM7uoTVWZP1OrKK/AVmydXF5Fc92+jjz/ZOAfW2L7he+XGyEgtuRv KMt3QMlf05n4svDzbMj9oI0wC2me3+/QCd4EtbGJmss1m7utt9rd7aVnSl1twg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187398; a=rsa-sha256; cv=none; b=SuFtt61TXIKCLa3ef7B8zP0geT7DI9cGZnUTk2+YEjWg3w04oHb5Coxy8FfC+WzNn/YGIB KpDiaVCzC4SC4iIkSd3LrMBlea50761AxnhaeytFAmDRrcmMxC/ZygiMJavjBtvAYYzJoR /EuicQiMlaHqCGrn67l0d9gcCfLVPhnV/XVkLsZqlN1ZSP8kFRiZHNaJmbv2zVR+Dw0LEp QLOLLXGQv0y8ucmSPEUyjZaFKnWpStV9urduGwySxiYukGzHn+mV50hUwunSxyrh3ZtS7E zqVQ3ElWjRmFvCfrUXEmrnJ3WH9VUNm1jSg8bGWykjzvYCdxQDuAfUdW7E49zw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlp5lgcz10cY; Thu, 14 Aug 2025 16:03: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 57EG3IKq080238; Thu, 14 Aug 2025 16:03:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3IS5080235; Thu, 14 Aug 2025 16:03:18 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:18 GMT Message-Id: <202508141603.57EG3IS5080235@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 64de28a52827 - stable/14 - kern.post.mk: Support flavors in PORTS_MODULES List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 64de28a52827f0ec919e470ffa6f67963c877b28 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=64de28a52827f0ec919e470ffa6f67963c877b28 commit 64de28a52827f0ec919e470ffa6f67963c877b28 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-11 13:54:51 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:09 +0000 kern.post.mk: Support flavors in PORTS_MODULES MFC after: 1 week PR: 288596 Reviewed by: pkubaj Differential Revision: https://reviews.freebsd.org/D51833 (cherry picked from commit 988426e815c12a899c8c6853090b8c8fca7ed5cd) --- share/man/man7/build.7 | 10 +++++++--- sys/conf/kern.post.mk | 10 ++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index f180dc501f41..82d3e3913bce 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 10, 2025 +.Dd August 8, 2025 .Dt BUILD 7 .Os .Sh NAME @@ -658,8 +658,12 @@ This is currently incompatible with building .Pa src into .Cm packages . -.Bd -literal -offset indent -make PORTS_MODULES=emulators/virtualbox-ose-kmod kernel +Each port must be specified as +.Ar category Ns Li / Ns Ar port Ns Op Li @ Ns Ar flavor , +e.g. +.Bd -literal +PORTS_MODULES=graphics/gpu-firmware-intel-kmod@kabylake +PORTS_MODULES+=graphics/drm-66-kmod .Ed .It Va LOCAL_MODULES A list of external kernel modules that should be built and installed diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index d74087fc7c3d..320410a337c9 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -128,7 +128,10 @@ PORTSMODULESENV=\ all: .for __i in ${PORTS_MODULES} @${ECHO} "===> Ports module ${__i} (all)" - cd ${PORTSDIR:U/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B clean build + port=${__i}; flavor=$${port#*@}; port=$${port%@*}; flavor=$${flavor%$${port}}; \ + cd ${PORTSDIR:U/usr/ports}/$${port}; \ + ${PORTSMODULESENV} ${MAKE} -B $${flavor:+FLAVOR=}$${flavor} \ + clean build .endfor .for __target in install reinstall clean @@ -136,7 +139,10 @@ ${__target}: ports-${__target} ports-${__target}: .for __i in ${PORTS_MODULES} @${ECHO} "===> Ports module ${__i} (${__target})" - cd ${PORTSDIR:U/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B ${__target:C/(re)?install/deinstall reinstall/} + port=${__i}; flavor=$${port#*@}; port=$${port%@*}; flavor=$${flavor%$${port}}; \ + cd ${PORTSDIR:U/usr/ports}/$${port}; \ + ${PORTSMODULESENV} ${MAKE} -B $${flavor:+FLAVOR=}$${flavor} \ + ${__target:C/(re)?install/deinstall reinstall/} .endfor .endfor .endif From nobody Thu Aug 14 16:03:19 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlr5pCrz64g6v; Thu, 14 Aug 2025 16:03: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 4c2qlr0Hqmz3KNS; Thu, 14 Aug 2025 16:03:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NIQwgCGaz6iVwbx2fwrNLmg/RFEJisjP56+KRuEaako=; b=H7NYcmD28IJOUodr4tAWb/3Oeel0+OIyPzqHKexeCN1d/b+N4nFC8Ivdn1ID9N0LC52f+0 wpwj+EJXkka3Q97Zec4jmbZUNa4pzCa+HF+yRNefwI0z1+9doFxOw+b2F0raAqSUubyY0i ts8hYGlVgmDF/MY9jmO+KjxSDiQFcXfBJ42GIiXi0KaLE/YkXK+XOxUW9CgvI7Gv6rGGSA hwrW/fGQFrC8COWjVUMO4ISWHfbPOA38HD/DHPoMzWWYlLyTb2uDaHfjRA9EUB1F1us7J7 P8MVZ9XmL5JkPsUK3BlQVPODkTmieKjE4sQCfn8yG/HgCnjFjIqAD9hMZRiAJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NIQwgCGaz6iVwbx2fwrNLmg/RFEJisjP56+KRuEaako=; b=AAaeCNqn+YD34Fn0rAkgUlo2/2bsVL+nyGJt8rPwYHMdf2BtLKM5hs+RcGbjWA3MQuEvDO GZHDxYvYBg44Uqdxm2gyPycuhPUJOBrvt6JpWVEBHo0R0/SASZOgNLX2rRZQcO974aq13D Chk/fz0KfkR8iqJNBScEnnNbNVBoNfrNg2Uz5cEy3Q5kFTgESR4DDrPOubSBoBRiCKUPxc wq4A03gO/bJzSmTHABxy7su6NLebKfiFSbakPBmz2oa6FYqriEY9oSeqGRzrJj/GOUjZD5 2y3jrXGT1dyNE32zgqD9iRED3e1KMFy6g2P+gJwPn6fFJZebQsPdNzCIFX0Akg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187400; a=rsa-sha256; cv=none; b=u0cfXlanNBlh4siLaUucf5ddRKc5WEcPB6uQMQ5QlBzHRT7K50/4zunqf1/45RE6paC1pE hRELxtUqYk+XYN0WtUjFnPzd4U8cYLUbArT7oXIRinKfMpnMAUSpp8poUjscReYIeciKJC HKhceR6dFK33qYhgMAMR+mSgC1bqOPIaiOU250IN0W6Ijw6VG1mszcP4dNxA+UIOWH1ep3 Gvz9A2nVts00sQW3pw21yQygBf0G86wJ8zbqnmOPnwLtaXEEfv5nDqCmPjdEIEW7Xh9yDN wndEtjKX4ONMcHlLSYYDlOaenX+2JiAtB3+SPXsAnc6YvOmQlDXZ84uQY1uRWw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlq6zFWz10RY; Thu, 14 Aug 2025 16:03: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 57EG3J1W080306; Thu, 14 Aug 2025 16:03:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3JRr080298; Thu, 14 Aug 2025 16:03:19 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:19 GMT Message-Id: <202508141603.57EG3JRr080298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 4b89029fef2a - stable/13 - bsd.man.mk: Add checkmanlinks target List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4b89029fef2a67867966a859276ecd4489bc4087 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=4b89029fef2a67867966a859276ecd4489bc4087 commit 4b89029fef2a67867966a859276ecd4489bc4087 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-12 12:54:08 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:06 +0000 bsd.man.mk: Add checkmanlinks target This target checks that every page mentioned in MLINKS exists and that every link corresponds to a (possibly commented-out) name entry in the page it links to. MFC after: 1 week Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D51862 (cherry picked from commit 18a9f83630a7d4612066bb690bcec0437c0e2e72) --- share/mk/bsd.man.mk | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index 444144e6d626..cd1fa485a5ac 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -238,11 +238,11 @@ maninstall: ${MAN} .endif .endfor -manlint: +manlint: .PHONY checkmanlinks .if defined(MAN) && !empty(MAN) .for __page in ${MAN} manlint: ${__page}lint -${__page}lint: ${__page} +${__page}lint: .PHONY ${__page} .if defined(MANFILTER) ${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} -Tlint .else @@ -250,3 +250,15 @@ ${__page}lint: ${__page} .endif .endfor .endif + +checkmanlinks: .PHONY +.if defined(MLINKS) +.for __page __link in ${MLINKS} +checkmanlinks: checkmanlinks-${__link} +checkmanlinks-${__link}: .PHONY ${__page} + @if ! egrep -q "^(\.\\\\\" )?\.Nm ${__link:R}( ,)?$$" ${.ALLSRC}; then \ + echo "LINKS: '.Nm ${__link:R}' not found in ${__page}"; \ + exit 1; \ + fi >&2 +.endfor # __page __link in ${MLINKS} +.endif # defined(MLINKS) From nobody Thu Aug 14 16:03:19 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2qlr5rwbz64fkN; Thu, 14 Aug 2025 16:03: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 4c2qlr0Hkrz3KNR; Thu, 14 Aug 2025 16:03:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gcRWGUYQMaBARZ8amdh4+GG3v10YfORJVSCMu7asryM=; b=qJ/afZlmOGoS0sBYN65bM8I6ClLai7V0HgGzaZh6E86Y9ZNRUU2ujeeC/Z3St8Flf5x3vq UNnr0tuh1PiFT7rgOkYDnmtpJJkZk8eE4VOQ2S5wXFOBbjoijAAgTx7IwLR5g/exiVE0N4 0zqAbdEaiPloAlnoyCkf7HZaijq7jVUhMK3SjITfmDP66Dc5at3kh7b4XeIaSxuUQfmMJQ fqXvyNtCXrXuGhMnvuONeqiK8N0Okf6SmZ0YNZwKPnd9FSBjPvwWbQMyezai3PNkSLiNUW eBhhw2wwADcX+KewdLKgBsDTiXuP6gwTmlU4t0lLYe98zWuD4v5/pEiQYvKPzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gcRWGUYQMaBARZ8amdh4+GG3v10YfORJVSCMu7asryM=; b=PMUUDcMGbeTnoCMnSTOmNidEBYZAkIoVDUUgAe0IoOzQSWZDZOec6Zh4xWQe3jJQtFGnc5 pEfP3I2PUR+Oosp42yIwY7KOAbewCBmRrFq9JFNdqZ5BQ+uLblvnR6up+PX8zK45Jd4ZFi 9OA+DPRMsQWZMaVv0CwOZmxVvhTLeBRc+9er+SsfolZ+CscFusvnqgsHA/4ZIK/lrbSfRG IbL2mdTSq6yz3V+WSax8XOGmMtHpcXlGZTTAKF+ZJlX+XmUnypzgD5eiavYPeZKMweb/Ht RTnxhHz+kGg62rSSD38YYwKY7nYMhyvL9sJQVk8pUDWkk3V1lYix8VVGFWSsUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187400; a=rsa-sha256; cv=none; b=W1ZCQm0zK8mqxAs7LXqg3K0z3Q6dcAvCGU0cygm4d9c0RHeMdTBELlgtwOcdXDOR9fJFFA 4LG3Yp435DK2rhHxcHNI2kIsngMbRO4L1wDmA2SD2N02pZkZOylPQo+VOl/o1rkFdA9dx0 vbnhDNXKrCvJ9v34ye5gsggyrems4pivzwon2XWoIGl93DcnlpD6L6kiSUHdG8M87gVytg xrzci2Tq85LaKDrhC4Yj2ELbazLx/gWnnmRCpJbb5mcFLeG/aonCO+CTYxFtNtzCv0WACS FV7m8jZys74KcwUt/S1A6JCO2FN7ayRg1CfFdIJqwQyubwT3jQBAyELyhJeGXw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlq6z57z10rW; Thu, 14 Aug 2025 16:03: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 57EG3Juu080307; Thu, 14 Aug 2025 16:03:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3J4q080303; Thu, 14 Aug 2025 16:03:19 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:19 GMT Message-Id: <202508141603.57EG3J4q080303@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 08559edad422 - stable/14 - bsd.man.mk: Add checkmanlinks target List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 08559edad42205ebd3b1e542c23f0a019ec63df4 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=08559edad42205ebd3b1e542c23f0a019ec63df4 commit 08559edad42205ebd3b1e542c23f0a019ec63df4 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-12 12:54:08 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:09 +0000 bsd.man.mk: Add checkmanlinks target This target checks that every page mentioned in MLINKS exists and that every link corresponds to a (possibly commented-out) name entry in the page it links to. MFC after: 1 week Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D51862 (cherry picked from commit 18a9f83630a7d4612066bb690bcec0437c0e2e72) --- share/mk/bsd.man.mk | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index 04316c46b705..e7b29b0bade1 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -241,11 +241,11 @@ maninstall: ${MAN} .endif .endfor -manlint: +manlint: .PHONY checkmanlinks .if defined(MAN) && !empty(MAN) .for __page in ${MAN} manlint: ${__page}lint -${__page}lint: ${__page} +${__page}lint: .PHONY ${__page} .if defined(MANFILTER) ${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} -Tlint .else @@ -253,3 +253,15 @@ ${__page}lint: ${__page} .endif .endfor .endif + +checkmanlinks: .PHONY +.if defined(MLINKS) +.for __page __link in ${MLINKS} +checkmanlinks: checkmanlinks-${__link} +checkmanlinks-${__link}: .PHONY ${__page} + @if ! egrep -q "^(\.\\\\\" )?\.Nm ${__link:R}( ,)?$$" ${.ALLSRC}; then \ + echo "MLINKS: '.Nm ${__link:R}' not found in ${__page}"; \ + exit 1; \ + fi >&2 +.endfor # __page __link in ${MLINKS} +.endif # defined(MLINKS) From nobody Thu Aug 14 18:32:45 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2v4F50l5z64qpf; Thu, 14 Aug 2025 18:32: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 4c2v4F2df9z3gjS; Thu, 14 Aug 2025 18:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755196365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jN6tPiV2DAs3L7J9OBXsIeW2SY48qps3wamKeik1IBc=; b=VudiQD9v8PVLzFzfmjmgq4yPbxhtIp3Ce4pd3p8ByfaT2snU9D6hic1AiAX0hVROxoZTHi kwks8jdzIAnLE9hGi2x3VNkURWiUruAGBKAjssTQfrb62AlYmvBIzRoDWz2tnKrcE1EITG +pV25X0Bd/a6bO3ih/iE4GPtx7W6c9kpo+PhmJo27fIkdyFBGaW4l7uzKdtDovA2xmRX14 1yYL7ZsXMaCj/Z/1WKtnLUgxwy1NK44Jgr9BLrXTBbvSqqKqkUBLbsGQsYib01XIiCFvpf wPzsLGabXpGjParN0Q3fwad3V6VmYyP4mAzM6sXHde6zvrIP/IaQzPWv0S3kwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755196365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jN6tPiV2DAs3L7J9OBXsIeW2SY48qps3wamKeik1IBc=; b=t5/5l8UFJ5CtHdGfhOg+oP5SxOvejRWAJZd31ZtbIlAQb0RCzhDU9l1MdQ/8ugzIbvofaF S4WefWWj7/5qJdEajA+OoEt0LFhcoZRJMuW7C7daN3ZCNp4mX8/lscyz9CQ9e6TF6OTuHb 1EXl6hzJG8Rv5DvwjEMJSq45hIU9OvdIg4h+/6O6Q8PS4H7evvvoPHEZ8kMcXJHeXAI8iY 2bgC9TUoOmtcxGLSKX2uDJm/aFKcqLnMGm/uzvYXBbT8Yqt5+2VYhpbEyr1PifApJdMbaH ktbW9ZRe+yKdYLdVyN6C0xKKxYjOMzreC3aWtmw+BRcKC6R89cPcbk0tEA7MAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755196365; a=rsa-sha256; cv=none; b=SBweRasFLXAjkJrgPbmeo8V8fAnYqAyJF93blcIKxzy7vdl8fMW7bzDhWrlqXiz4gilr1F Zt4SWssG4mcjjK/bind/fFOnyM9Dqtf0BLlKcAVLif6KVHd9i3llrGuQxmIe+VlXrTZ9TJ xTnQb0Go/OjrwHXG3DJlqIkCbrihp+MnBPUQsbAkBO3BSZzUMPikM7Zo66UbI7Ak6yyimw yje2FkMiMxf6zSwD/BuIZ4pLlNsuNNBosTXflWxdbMw66uCkx6kejFCwE4Zb1UiftClNPu nV03dohTUfF7RyZe7wj8JBf/pharTtHIBYWopJ1T/7OFpqjQWHuwIto50abWMQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2v4F29lrz14SV; Thu, 14 Aug 2025 18:32: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 57EIWjdj059793; Thu, 14 Aug 2025 18:32:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EIWj1S059790; Thu, 14 Aug 2025 18:32:45 GMT (envelope-from git) Date: Thu, 14 Aug 2025 18:32:45 GMT Message-Id: <202508141832.57EIWj1S059790@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: c28c2cd5a546 - stable/14 - Remove unused variables in msun/bsdsrc/b_tgamma.c List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: c28c2cd5a546b78fea7fe89533f9d042d4135eb4 Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=c28c2cd5a546b78fea7fe89533f9d042d4135eb4 commit c28c2cd5a546b78fea7fe89533f9d042d4135eb4 Author: Steve Kargl AuthorDate: 2025-08-09 17:24:08 +0000 Commit: Dimitry Andric CommitDate: 2025-08-14 18:32:21 +0000 Remove unused variables in msun/bsdsrc/b_tgamma.c PR: 288736 MFC after: 3 days (cherry picked from commit 53b77089e5cacb1ae863c3f70b3e6f286ca71df5) --- lib/msun/bsdsrc/b_tgamma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msun/bsdsrc/b_tgamma.c b/lib/msun/bsdsrc/b_tgamma.c index 8369477c18b7..a7e97bc777c3 100644 --- a/lib/msun/bsdsrc/b_tgamma.c +++ b/lib/msun/bsdsrc/b_tgamma.c @@ -259,7 +259,7 @@ small_gam(double x) static double smaller_gam(double x) { - double d, rhi, rlo, t, xhi, xlo; + double d, t, xhi, xlo; struct Double r; if (x < x0 + left) { From nobody Thu Aug 14 18:33:34 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2v5C1D10z64rBs; Thu, 14 Aug 2025 18:33:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4c2v5C0Twrz3gt6; Thu, 14 Aug 2025 18:33:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755196415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vXr9iMbupr+0mUgyyttWg2FDRsbJnv3czhJYkZezJ98=; b=cm8UdCxf7GXt/jKfn0iBwc43Dj9zULQTtnlLnnaa666eGpbvbwjM9yhk3nfYkgWkfQoAH8 /NwjVPGK9QzcyPHTlR0CVYyCzBScRE6ip7dvVNXqpYJIzSJ5YKtie+CDsHkzYhTE9X7u87 GdwHMj/ZfhcCaRAJ0xHMBwfyuqIS9o6qs0j5p20MGTMrkp9kYW+fybb2v8VydEhDwubdrQ YCPVDKfmYs/LQGHBb1dVYd4+VxIeHXG44RzFujnquQ59dzAF7OOZDjpEdDM1HUpT6SuGd3 +jgrz7evCWKh5uCBmIK0t3tP3BI/1V+ZH2olcPlPeRJ/IX09vAUmNvxWv3xw3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755196415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vXr9iMbupr+0mUgyyttWg2FDRsbJnv3czhJYkZezJ98=; b=qxygPKMoDEZhD8Y5VUJ47K8QEvhXUvjm0oladjrugAgjUwPEkhIdBIIpE86PSWXB1KT+jB 4ZLtlFXEl+ArvAKrNQgI8Lixbq8R1ax7BEGB92JyIJCJyLiEjU0sEzL5FFd+tR+hZA7LIn BGHm6DS8jiH7wsi/Bxn4kUkckOuWRdCf1Sr14YADzhOa7O/o6rYkY8FpcoF93CFM4yvaoh R0Hi0X7qTgIWzAAvnb5nyrUTw73PT5VHpviG+9+bbK5/UMtOOkFH21PAofuDaAt11MEqQS k8qQof6qIgL/fZfyW0l8rW8Mp/Rr/77SzOv/AJdoyeC43i54h3ThZJmtsf1YvQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755196415; a=rsa-sha256; cv=none; b=QFsopL7Ho7Abe0ZkdSLvMmvWbxwp7xEnTrAasYikeTnT2YDf7WKCkADd67BAkbDqFz2vqL zdMPlR3DIymOCpn43J61F2DG3M1s2/AdyLS31OjuWTUpj4v4tjtRM/6ePW8LhSJZjvmveC X1DX6gwK7a7RbqCo9nPobcWa2LvHCrBFnZh1+SS61YXGVmQGOD9e+rwerFJoW9LDo1OYKv y41PnpLXY1hnGX9n1qidj8hVyulsrVZ2vk4wQI290vfEPdljfEJvEdMBauZ6EcllZQknqR 9sZsWDE9gpxllf/yjoAUb3lsT2CP1W6mgth7/06cPUUTCIYldn7PL1Tyrd0yrg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2v5C05WCz14hF; Thu, 14 Aug 2025 18:33: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 57EIXYbr060170; Thu, 14 Aug 2025 18:33:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EIXYM6060167; Thu, 14 Aug 2025 18:33:34 GMT (envelope-from git) Date: Thu, 14 Aug 2025 18:33:34 GMT Message-Id: <202508141833.57EIXYM6060167@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: 22a5c54e8a90 - stable/13 - Remove unused variables in msun/bsdsrc/b_tgamma.c List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 22a5c54e8a905cb47a5ff263f0a6c0d8980b1347 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=22a5c54e8a905cb47a5ff263f0a6c0d8980b1347 commit 22a5c54e8a905cb47a5ff263f0a6c0d8980b1347 Author: Steve Kargl AuthorDate: 2025-08-09 17:24:08 +0000 Commit: Dimitry Andric CommitDate: 2025-08-14 18:32:25 +0000 Remove unused variables in msun/bsdsrc/b_tgamma.c PR: 288736 MFC after: 3 days (cherry picked from commit 53b77089e5cacb1ae863c3f70b3e6f286ca71df5) --- lib/msun/bsdsrc/b_tgamma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msun/bsdsrc/b_tgamma.c b/lib/msun/bsdsrc/b_tgamma.c index cc9f8f70297e..5ed69a28156f 100644 --- a/lib/msun/bsdsrc/b_tgamma.c +++ b/lib/msun/bsdsrc/b_tgamma.c @@ -261,7 +261,7 @@ small_gam(double x) static double smaller_gam(double x) { - double d, rhi, rlo, t, xhi, xlo; + double d, t, xhi, xlo; struct Double r; if (x < x0 + left) { From nobody Thu Aug 14 21:14:16 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2yfc4PgPz643Rx; Thu, 14 Aug 2025 21:14: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 4c2yfc3rCRz44nX; Thu, 14 Aug 2025 21:14:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755206056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XL7LlxfV3jQ/RGfg8hqs8rKpkD/wiRjzdBCixZqr+Fo=; b=xd5qar3ywPC+aZfhHtAuBpXUs7Wxoftc9P+YVfIUvM8JHkXIkAVHZkgNvDFf4SbeIM42P2 nfEHOHJDhVjnwmW1a3O+7Y9IKhZLYuMrTJprX0zIIBvAM64ABsflS2BAx8Hd+S9I/lFrkk xRAn/SXs43vw7rL09j4gXV5daNkuc+3HA17xWxRTIqV1Xuxgwjk/EdT6jw71jyz2eHTDKe XU1fguzmqAdJ+UcASGHWTaJkcfSozEaQb0lhPLThb/4VtwEDK0R8Y8l9/1c8c/DfY40oND J6p7ppJfAopoWet1psPaqSzk/d9M6pR1H63f1S2xCVur112oMU/LlCiBbOhS0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755206056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XL7LlxfV3jQ/RGfg8hqs8rKpkD/wiRjzdBCixZqr+Fo=; b=WFPDFqbumZg0WFyaqsSYUU6sZSifYTp9naNiAf+Ny/852XWCRQ5rfe8K67q5aLoZ8aLcPl bQnQa8p9eGmWBZjQc7W4hvwiZxd0uigLq9SJOofDkd2dfByuZo/w27D2UgqdofHTzGy75E OznJBgG7IPhinyBcPYExyc81Zu1WQ9nuzpaB9h3A2O7rpxd2VSGZL4TqzuwgOi5yjCmzLo v7yIWB0p6sBTMwGkDqNPmrP4lLH/c2D3FP/GDxatDKia8knmP/ejxJ+8t9kraIDcJeVAU3 Bzrbkst+Ur6XylMxyKVhHlXqp2+kkDd2TzAX81m2ug04RHUWIb24lupSMm/dkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755206056; a=rsa-sha256; cv=none; b=knft1PHM4Vhq1W+lB3EV3Pgx0U8zE2v15Mcyhd57D4k+Ad1X/E2/Hl5sm/zOHwKqDw49AE HF0TjbhIMhu0xHd4ogt6wKGEFK1L1+WDeQRMNJNBMbdyM3dO3I0kzfILuItkaMukSYj4cH QwI577eh7OGsjEyx17rtqloMIa7wxirbmm/+gkntRzDElt/MzxlMrMBpoSM4Nk46k9EG49 ZzLoYfVYDVqJ5Tv4yXqxeE0TgfKEiNhdOOd+a7s5EpXw51W2HxqYtSp2UrSiR5efDP7qeI YoDCgb1y++wtaSh9V5ZOgrsFWIlj+9hfdItU/Ux/NWhrZFEOzPn9HtjHFUotsg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2yfc3MVBz18Ll; Thu, 14 Aug 2025 21:14: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 57ELEGKm061975; Thu, 14 Aug 2025 21:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57ELEGDn061972; Thu, 14 Aug 2025 21:14:16 GMT (envelope-from git) Date: Thu, 14 Aug 2025 21:14:16 GMT Message-Id: <202508142114.57ELEGDn061972@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: 1e58eb141b9b - stable/13 - vm_pageout: Disallow invalid values for act_scan_laundry_weight List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 1e58eb141b9b391fe3953032a4c225f3f15eac4a Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1e58eb141b9b391fe3953032a4c225f3f15eac4a commit 1e58eb141b9b391fe3953032a4c225f3f15eac4a Author: Mark Johnston AuthorDate: 2025-04-18 17:31:27 +0000 Commit: Mark Johnston CommitDate: 2025-08-14 21:11:11 +0000 vm_pageout: Disallow invalid values for act_scan_laundry_weight PR: 234167 MFC after: 2 weeks (cherry picked from commit d8b03c5904faff84656d3a84a25c2b37bcbf8075) --- sys/vm/vm_pageout.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 228764ea0aae..54affafedc72 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -185,8 +185,23 @@ SYSCTL_INT(_vm, OID_AUTO, pageout_oom_seq, "back-to-back calls to oom detector to start OOM"); static int act_scan_laundry_weight = 3; -SYSCTL_INT(_vm, OID_AUTO, act_scan_laundry_weight, CTLFLAG_RWTUN, - &act_scan_laundry_weight, 0, + +static int +sysctl_act_scan_laundry_weight(SYSCTL_HANDLER_ARGS) +{ + int error, newval; + + newval = act_scan_laundry_weight; + error = sysctl_handle_int(oidp, &newval, 0, req); + if (error || req->newptr == NULL) + return (error); + if (newval < 1) + return (EINVAL); + act_scan_laundry_weight = newval; + return (0); +} +SYSCTL_PROC(_vm, OID_AUTO, act_scan_laundry_weight, CTLFLAG_RWTUN | CTLTYPE_INT, + &act_scan_laundry_weight, 0, sysctl_act_scan_laundry_weight, "I", "weight given to clean vs. dirty pages in active queue scans"); static u_int vm_background_launder_rate = 4096; From nobody Thu Aug 14 21:14:17 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c2yfd5s9hz643S0; Thu, 14 Aug 2025 21:14: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 4c2yfd563Xz44cQ; Thu, 14 Aug 2025 21:14:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755206057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U0TzAv/nA6FUVHAHLl//XRAaC+drQTG1/ajOZGyoXEY=; b=xh2Yvq5bnDFRerHbr7Pt1QeUXCoPoGZTIsRYF20ar7XiTl6MtwBAHRDrdtkGmIkKM/6yeM 5IoDsGRRC+lyLZLyNGnz++iGsQF1N9oz1iNRW5AAVFwlOpEbyEP7LgIvW5ocMeD4wVdt/O q7Ftr9QQV6UbEoAFTo206aDYjuF/SuGNU6274B8Q0nFtCTOTKIu+WtQgG9uIrogsCEM8xU SZmy2krqg0b6QUzBL38z9g5Lal0+0oa5iSliauvAR+tor38u5Jtkf9cJpKDYkdiawj1oRd NG+VTe+S+eZFW7zR8+65afGZhbAWfFW8v6R/vTE+MIIGcLrrWbs5vo1fDwkupg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755206057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U0TzAv/nA6FUVHAHLl//XRAaC+drQTG1/ajOZGyoXEY=; b=qj9gi8GZbSa3UKYrIgpCouljRIvhYDI/YXi+B06EZlGOM5XrPgBEoKwdSetT4zvTfhbEty uOOaj3iuGshWLKXcsTND9iBeVI6y6A7NqnIkrwUhdSHQZNsID4JswtskZ9S8eUOr7EjMzq xVYqgCHOkkKsg6rZy4VS130nYmDbzaDtbsb2Y7ZHj2dYPSsX8GMPBEgtUROcvCRuKai0AS wuwrioP9oL3RdRAviMOGn+/CSY3rPumaHBJ0wFt4J5c53L8km7LBBh9KSY0NgNC30Gt6GL Oy5oBxmhgEfpaevfYIOBkcTi6JHs0hfFGGrEc1HmAs8zt0mQ9LW7R4+aDkcNgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755206057; a=rsa-sha256; cv=none; b=SrSInSrkCaFrpJ5lFgDLuu8ZVLDZFcbsz5Z9KFAuA/UgI23GFO2EHUC6CecYTNeAv2ayd/ sWKoDUBgXbvL6RCCm/IshVuFSbsvEmq+AblAb2h+Lyt+oLDO6S2RVxuQoYMTgcYerNxn26 E4WTJMVpepnsGpNP2WmQ9zFy0IFuLtnFzIbrdV8c+Hpq4ulJKLdq0hmhNVgqoCwnLCB9Ft V470kOkJcOrALO9Mpu4TiFlouXL9gjNxzsOzIBRDZg+a8LR4ufUyQndT1E7uHaGYB0N68O MrVlT7Sivr/GABaKKZ+H/IwUkfRi4Ml3lR7x3yMamotZk4dXKHWhIub7sIr7+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 4c2yfd4Zhdz18XJ; Thu, 14 Aug 2025 21:14: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 57ELEHQ9062007; Thu, 14 Aug 2025 21:14:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57ELEHAS062004; Thu, 14 Aug 2025 21:14:17 GMT (envelope-from git) Date: Thu, 14 Aug 2025 21:14:17 GMT Message-Id: <202508142114.57ELEHAS062004@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: 5c567849927f - stable/13 - sys/conf: Re-add -Wno-unused to ipfilter build flags List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 5c567849927f759c36be9b880a61d9f18e1705d6 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5c567849927f759c36be9b880a61d9f18e1705d6 commit 5c567849927f759c36be9b880a61d9f18e1705d6 Author: Mark Johnston AuthorDate: 2025-08-13 13:12:36 +0000 Commit: Mark Johnston CommitDate: 2025-08-14 21:14:03 +0000 sys/conf: Re-add -Wno-unused to ipfilter build flags This is still required on stable/13 because of the RCS tags defined at the top of each source file. This is a direct commit to stable/13. Fixes: 0947920999dc ("files: add new IPFILTER_C rule for netpfil/ipfilter sources") --- sys/conf/kern.pre.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index cc32a24cf06b..8728ac269dd6 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -343,7 +343,7 @@ MLXFW_C= ${OFED_C_NOIMP} \ # IP Filter IPFILTER_CFLAGS= -I$S/netpfil/ipfilter -IPFILTER_C= ${NORMAL_C} ${IPFILTER_CFLAGS} +IPFILTER_C= ${NORMAL_C} -Wno-unused ${IPFILTER_CFLAGS} GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/} SYSTEM_CFILES= config.c env.c hints.c vnode_if.c From nobody Fri Aug 15 04:54:05 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c38s93NPZz64XTw; Fri, 15 Aug 2025 04:54: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 4c38s928G7z3sYk; Fri, 15 Aug 2025 04:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755233645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EwGAV+WHYUdGfRgzx27NM8w+LtzL15jIiC0PZjKEcyc=; b=SgaAHq9uu0bddRNpZNWsF49I4r99AYSkNA59IxEUrH1cederrVI7IKsuRGLsLqszHLecI9 FGXFZy5LO1b3pn016fEXCV98CVYg7vOZVxehTE+KEddNNcfiDzLuap3x+ZQAfBofGhZZ+b tRZYA/un+QyMS4D/7Q2ED9MwNbH0GoEHdjwhk4WupAQUbBS0k7g/Faba2X5i6AbTeOpyny 2sT9rLuLBz9NgiXVCKtLbogNppv3e1yiofY+J34aYdLEOnUanUAn3mt2HX/kN52vQICBXK ci5kTw64Y6oZvuU82gnl4QRyaPTPp1x3t2KspC4+NPHA7xImSfEUEoQ2xxBDPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755233645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EwGAV+WHYUdGfRgzx27NM8w+LtzL15jIiC0PZjKEcyc=; b=slk4Wbh0+MTZb9zxgrN5YUI6swQR4uyFnaRP4shI6SUlpFovfUpxgipmq8J/oYmKNKZYop 9xnZ2NOIJfdyGgGDK/Dl2LykQwq8m9WBqkKRWqwaywB22ZPU+j1lsd5+ZRwnyQ6uU0kaWx 676b53Yy8MIKOa6Zn6AvfC/q7cv3/7Ytbk5xQlU00ou0IVM/Qh11AB4cs8qnbMsn2Souu+ g7zZgBk5OrPIHYagA2hYKq+na3RjDlws0UOFGbV0k/v6ST2XfakpIVXJA5CX1WIVrTmKUy ZopMlYwEA4KAhpoptEzR+hwaG+Wthvj4d1ibjGrQbkeyLXpsG/PlcX8xBN6dZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755233645; a=rsa-sha256; cv=none; b=Nz+xVcP9+gCkWv8fOhnBnpmOUXjdrk5jMC2R85vB4SrTFed44AojlzDSmbUjK1Yyu+KdVa 7AOSBUZDeyAe0CoFL8eQbG/IIhb9uLsAUjq0Y9s+j5nFTXr/w5RUOHpyahVUu1bdeO2c6+ +RzU035x1tt2hyb6+zoFVc/M/WYJUvmDORyE6HbP6iH9Lu65Fwwhbd9eBlwBDtpT0ZF+s7 3u9akspEPb22UGZ9vSY46d1OsWHL/6qaIEQbVipQg7mKob3dHSg+RYnH1Rwlh88VHP6/oF UpfbupDdU5CtS+dbKyFR0BjZu8HZmyFDKlv1gTkjOh7w8x2uKuZ245lgKaD7pQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c38s91VpQz8hX; Fri, 15 Aug 2025 04:54: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 57F4s5rs025315; Fri, 15 Aug 2025 04:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57F4s5mH025312; Fri, 15 Aug 2025 04:54:05 GMT (envelope-from git) Date: Fri, 15 Aug 2025 04:54:05 GMT Message-Id: <202508150454.57F4s5mH025312@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 878d3bdb59d7 - stable/14 - ifconfig: Garbage collect unused parameter swabips List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 878d3bdb59d70b2ce077f4bbdefea0ec875d6e82 Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=878d3bdb59d70b2ce077f4bbdefea0ec875d6e82 commit 878d3bdb59d70b2ce077f4bbdefea0ec875d6e82 Author: Zhenlei Huang AuthorDate: 2025-08-01 16:33:09 +0000 Commit: Zhenlei Huang CommitDate: 2025-08-15 04:53:21 +0000 ifconfig: Garbage collect unused parameter swabips and the macro EN_SWABIPS. The macro EN_SWABIPS is identical to IFF_LINK0 (also historically IFF_LLC0) and we already have the parameter link0 to toggle IFF_LINK0. These were inherited from 386BSD 0.1 and have never been used since the very first FreeBSD release. Reviewed by: adrian, #network MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51368 (cherry picked from commit 8632e4e73a6934f3f9996a18932e36b04e6a3faf) --- sbin/ifconfig/ifconfig.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 5cf1ae6b79b7..c1e3e0af83c2 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -2028,11 +2028,6 @@ static struct cmd basic_cmds[] = { DEF_CMD("-alias", -IFF_UP, notealias), DEF_CMD("delete", -IFF_UP, notealias), DEF_CMD("remove", -IFF_UP, notealias), -#ifdef notdef -#define EN_SWABIPS 0x1000 - DEF_CMD("swabips", EN_SWABIPS, setifflags), - DEF_CMD("-swabips", EN_SWABIPS, clearifflags), -#endif DEF_CMD_ARG("netmask", setifnetmask), DEF_CMD_ARG("metric", setifmetric), DEF_CMD_ARG("broadcast", setifbroadaddr), From nobody Fri Aug 15 04:54:06 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c38sB6b4Jz64Xcc; Fri, 15 Aug 2025 04:54: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 4c38sB3Qswz3sWF; Fri, 15 Aug 2025 04:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755233646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WNIN132FOnncgrG/TQsz/2tHV7w+WsEjv5ByTA0zysA=; b=LVOvJae7slGEYD8G5a4/no0mkOntg5MAFwDiqiozzRq6Nokj5goGc4p6prphinzpKUMQ3e ndSzVqYgSCme7sHONvBMnRYpfsp/His+6ynWuv02Rb//ozijOXsTWqxyF5YXVbuObDGYRR L+u/Z3KtE4Alzni0cEWp6aAzaK5CZk3lW0lpLnDvecClsuQkG66oCXeJlZC6w4g+oY1oQU PlFOpc2hNt1IoBSmEkPmPX7cYPTmGAH6T0OEocNntiTSv1VjBVUeR/U8E3JxF39ALQPsdY Vb95E5r4+r13A+K33nhdiK3CV8/raMzrPvrB8bMUNriJuZx0I4J8rYPG6hMq4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755233646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WNIN132FOnncgrG/TQsz/2tHV7w+WsEjv5ByTA0zysA=; b=e18+T8YqHoRd/VBKds+8V0mb/spV3OXZx93dqRlXz1DJYirIH92Ief0DKD4Ja2g1PpxBuh 0ZYY8tXxwq4IJSVEl1IIqyXJPTns2ZQlW6pyHqXfH5Kwy1zRSu1b7Lta3cYq5yA49TnbDI s56nUbRGIzSGeujZ39T7J5xdMmufOeKTSF48TAM0sv3vtQ56c61DoIuGChSGh092gLXJ5e +5toqbcXe4irpdqAYt5ixygGQvBJ1101EjflvYRUk6t8NPuolBH3H/9lcPA0Sb7dNKfnc5 JetNvCSHtkmZrRS5l5cKiH3rGl6fN/RdJPBIGjuTtsjcGI7eguJ6wHtJJ6n9EA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755233646; a=rsa-sha256; cv=none; b=rxYf3vw0gEROh79BCk48WKRWt+uc3SVPhHarH7bkkjaSsV0GV4GSb+Z2spbV49Y8ehzf2P mZ4M4EFq1ZGM6w55SsCBlVg7JVqqPzSKae5M+7iisCATWb6+NiGtRQisvq5fk7lehyxWgV e+5StBYxwoRxsFIxBbALOLyVdMo8CyWZm17vg7I1UVcLkQuaHQhIwoKBjG6PorVbFhVJKn oBFFHldB4qFUel48+Gp2NXTwqT8Bi6RgATTppe3p/cXcx4Jx45QZJvd3uAAG5tVZw/t9Z4 tDsdqt9GDMNtGEbrnmbvAlJYkDMHsjGpz2r8W8xSzpIO0TXqmYUy7BR+/+dtWA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c38sB2l8Lz8hY; Fri, 15 Aug 2025 04:54: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 57F4s6d6025348; Fri, 15 Aug 2025 04:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57F4s6e4025345; Fri, 15 Aug 2025 04:54:06 GMT (envelope-from git) Date: Fri, 15 Aug 2025 04:54:06 GMT Message-Id: <202508150454.57F4s6e4025345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: c2806cddc647 - stable/14 - tests: gif(4): Add tests to cover all IPv[46] in IPv[46] setups List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c2806cddc64766b69daa42b4fb192f767e4b4705 Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=c2806cddc64766b69daa42b4fb192f767e4b4705 commit c2806cddc64766b69daa42b4fb192f767e4b4705 Author: Zhenlei Huang AuthorDate: 2025-08-01 16:33:10 +0000 Commit: Zhenlei Huang CommitDate: 2025-08-15 04:53:21 +0000 tests: gif(4): Add tests to cover all IPv[46] in IPv[46] setups While here, rename basic to 4in4 to be consistent with other tests. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51566 (cherry picked from commit 62439516cc9bba32ed2406f340326c4d37e4cc59) --- tests/sys/net/if_gif.sh | 147 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 141 insertions(+), 6 deletions(-) diff --git a/tests/sys/net/if_gif.sh b/tests/sys/net/if_gif.sh index 16b0b1a6fca0..5c7278d17e8f 100644 --- a/tests/sys/net/if_gif.sh +++ b/tests/sys/net/if_gif.sh @@ -26,14 +26,14 @@ . $(atf_get_srcdir)/../common/vnet.subr -atf_test_case "basic" "cleanup" -basic_head() +atf_test_case "4in4" "cleanup" +4in4_head() { - atf_set descr 'Basic gif(4) test' + atf_set descr 'IPv4 in IPv4 tunnel' atf_set require.user root } -basic_body() +4in4_body() { vnet_init if ! kldstat -q -m if_gif; then @@ -65,12 +65,147 @@ basic_body() jexec two ping -c 1 198.51.100.1 } -basic_cleanup() +4in4_cleanup() +{ + vnet_cleanup +} + +atf_test_case "6in4" "cleanup" +6in4_head() +{ + atf_set descr 'IPv6 in IPv4 tunnel' + atf_set require.user root +} + +6in4_body() +{ + vnet_init + if ! kldstat -q -m if_gif; then + atf_skip "This test requires if_gif" + fi + + epair=$(vnet_mkepair) + + vnet_mkjail one ${epair}a + jexec one ifconfig ${epair}a 192.0.2.1/24 up + gone=$(jexec one ifconfig gif create) + jexec one ifconfig $gone tunnel 192.0.2.1 192.0.2.2 + jexec one ifconfig $gone inet6 no_dad 2001:db8:1::1/64 up + + vnet_mkjail two ${epair}b + jexec two ifconfig ${epair}b 192.0.2.2/24 up + gtwo=$(jexec two ifconfig gif create) + jexec two ifconfig $gtwo tunnel 192.0.2.2 192.0.2.1 + jexec two ifconfig $gtwo inet6 no_dad 2001:db8:1::2/64 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 192.0.2.2 + + # Tunnel test + atf_check -s exit:0 -o ignore \ + jexec one ping -6 -c 1 2001:db8:1::2 + atf_check -s exit:0 -o ignore \ + jexec two ping -6 -c 1 2001:db8:1::1 +} + +6in4_cleanup() +{ + vnet_cleanup +} + +atf_test_case "4in6" "cleanup" +4in6_head() +{ + atf_set descr 'IPv4 in IPv6 tunnel' + atf_set require.user root +} + +4in6_body() +{ + vnet_init + if ! kldstat -q -m if_gif; then + atf_skip "This test requires if_gif" + fi + + epair=$(vnet_mkepair) + + vnet_mkjail one ${epair}a + jexec one ifconfig ${epair}a inet6 no_dad 2001:db8::1/64 up + gone=$(jexec one ifconfig gif create) + jexec one ifconfig $gone inet6 tunnel 2001:db8::1 2001:db8::2 + jexec one ifconfig $gone inet 198.51.100.1/24 198.51.100.2 up + + vnet_mkjail two ${epair}b + jexec two ifconfig ${epair}b inet6 no_dad 2001:db8::2/64 up + gtwo=$(jexec two ifconfig gif create) + jexec two ifconfig $gtwo inet6 tunnel 2001:db8::2 2001:db8::1 + jexec two ifconfig $gtwo inet 198.51.100.2/24 198.51.100.1 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + jexec one ping -6 -c 1 2001:db8::2 + + # Tunnel test + atf_check -s exit:0 -o ignore \ + jexec one ping -c 1 198.51.100.2 + atf_check -s exit:0 -o ignore \ + jexec two ping -c 1 198.51.100.1 +} + +4in6_cleanup() +{ + vnet_cleanup +} + +atf_test_case "6in6" "cleanup" +6in6_head() +{ + atf_set descr 'IPv6 in IPv6 tunnel' + atf_set require.user root +} + +6in6_body() +{ + vnet_init + if ! kldstat -q -m if_gif; then + atf_skip "This test requires if_gif" + fi + + epair=$(vnet_mkepair) + + vnet_mkjail one ${epair}a + jexec one ifconfig ${epair}a inet6 no_dad 2001:db8::1/64 up + gone=$(jexec one ifconfig gif create) + jexec one ifconfig $gone inet6 tunnel 2001:db8::1 2001:db8::2 + jexec one ifconfig $gone inet6 no_dad 2001:db8:1::1/64 up + + vnet_mkjail two ${epair}b + jexec two ifconfig ${epair}b inet6 no_dad 2001:db8::2/64 up + gtwo=$(jexec two ifconfig gif create) + jexec two ifconfig $gtwo inet6 tunnel 2001:db8::2 2001:db8::1 + jexec two ifconfig $gtwo inet6 no_dad 2001:db8:1::2/64 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + jexec one ping -6 -c 1 2001:db8::2 + + # Tunnel test + atf_check -s exit:0 -o ignore \ + jexec one ping -6 -c 1 2001:db8:1::2 + atf_check -s exit:0 -o ignore \ + jexec two ping -6 -c 1 2001:db8:1::1 +} + +6in6_cleanup() { vnet_cleanup } atf_init_test_cases() { - atf_add_test_case "basic" + atf_add_test_case "4in4" + atf_add_test_case "6in4" + atf_add_test_case "4in6" + atf_add_test_case "6in6" } From nobody Fri Aug 15 05:04:19 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c394z2ZF5z64Y85; Fri, 15 Aug 2025 05:04: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 4c394z202rz3ty5; Fri, 15 Aug 2025 05:04:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755234259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y/MzKCv4/NXOgaARZ2FfQXzUUzlXKr5q2WjN1znfIjs=; b=Ce1154STayLwE5UgswyrYrIMzDlO7OfSqCoMEBT6GD4QLJ3fr1NhlI5M0te2H9AIKQp7qO SFByBHvqGykp1tmYPhCfmMiCJsItxKVZMFGGnx1F6pgSq5CjKW78Yd4jlUMeELy3nymmVL 7ejjVmOVnzJBAjjZ1I0RehodujXDTxhGf3t9GB3qGy5Ff9UXqfvzeW9EUfp2r6BrLcuX81 myWPOVT10KSUB6JjHgqQ7u2JgCLu4TXqDwAU6ZvRNhDMHZhAfHtPYJZy6rnrN0aNfYkM+y yz703+Cp0ZcEv9uAZzs3rOzJaanSINRxd5kEAb/XkJZYkk1lZGzYl88HpBWZBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755234259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y/MzKCv4/NXOgaARZ2FfQXzUUzlXKr5q2WjN1znfIjs=; b=i+v1aJWebq1Gs26Gr84brePsTcCnQRAuXCw0ym53+M1Yd7OChLG/XHcPbWKkD8qRuomqiE 4+F0vNqTuoKTBRLhrQTOv9u2qBqVtT3cp7oWUvEqLsrtWtnyPE5qP+gaZyMgOWzDq2mShO Fu6gJowJJz4pFZMzf/4I/67nCCDh1VQ+RX//He943+VZ5x1Uxd/63LEPfpJjofAWzh66/5 8EFM/Eoin+N7yHUDbRT0Hqrmhx8Bps9h5yvpeDbNUyi9foMXKrrAGLEB7+qBMY8CI0voHn u5kwdRtp/MbQ49Xfq/elXqYP4XBCyKEfJci/VwXkMU/ulB6C7xn7UlrYRNuRrg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755234259; a=rsa-sha256; cv=none; b=Yso7t4PlsBM6W5Fg3qqjVdpg24+w8cTxCiMG6NgRzgTigd8L0u6wVgSt8OxdsvkgGztYyw 8Tky89iFw64v90EIc0/5nXAcJSGErQnvsu2s6wgZLrsBvour80z4ixGR5D6fHwgR3Ws0BU t/LmkAULEMKkxd3D82/X8zm2w0AvCnZueQhQVz3eEYoGUUAkjo8bvoBzhDxT5lVtWJC5uX TRDSGe1ObZ8iuZijPdqZYmMfUPmcOY6uZwegZUWxzoiF602LaCOMQ0FAkiEePG/XVmpSJd yLibGPfYDtlAf1jB1vhPF/VP9PZFejUxIFFeetk1Xy1btvrV9eORu+Vc31/VIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c394z1YSnz8J0; Fri, 15 Aug 2025 05:04: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 57F54JRY045703; Fri, 15 Aug 2025 05:04:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57F54JU8045700; Fri, 15 Aug 2025 05:04:19 GMT (envelope-from git) Date: Fri, 15 Aug 2025 05:04:19 GMT Message-Id: <202508150504.57F54JU8045700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 3eafc9f76fd5 - stable/14 - chroot: don't clobber the egid with the first supplemental group List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 3eafc9f76fd54fbd222d587b11752290766a0af5 Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3eafc9f76fd54fbd222d587b11752290766a0af5 commit 3eafc9f76fd54fbd222d587b11752290766a0af5 Author: Kyle Evans AuthorDate: 2025-07-26 06:11:58 +0000 Commit: Kyle Evans CommitDate: 2025-08-15 05:04:12 +0000 chroot: don't clobber the egid with the first supplemental group There are two problems here, really: 1.) If -G is specified, the egid of the runner will get clobbered by the first supplemental group 2.) If both -G and -g are specified, the first supplemental group will get clobbered by the -g group Ideally our users shouldn't have to understand the quirks of our setgroups(2) and the manpage doesn't describe the group list as needing to contain the egid, so populate the egid slot as necessary. I note that this code seems to have already been marginally aware of the historical behavior because it was allocating NGROUPS_MAX + 1, but this is an artifact of a later conversion to doing dynamic allocations instead of pushing NGROUPS_MAX arrays on the stack -- the original code did in-fact only have an NGROUPS_MAX-sized array, and the layout was still incorrect. Reviewed by: olce (cherry picked from commit 48fd05999b0f8e822fbf7069779378d103a35f5c) (cherry picked from commit babab49eee9472f628d774996de13d13d296c8c0) --- usr.sbin/chroot/chroot.c | 57 ++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c index 9fc918e38eac..b73ac65f5cad 100644 --- a/usr.sbin/chroot/chroot.c +++ b/usr.sbin/chroot/chroot.c @@ -73,7 +73,9 @@ main(int argc, char *argv[]) gid = 0; uid = 0; + gids = 0; user = group = grouplist = NULL; + gidlist = NULL; nonprivileged = false; while ((ch = getopt(argc, argv, "G:g:u:n")) != -1) { switch(ch) { @@ -89,6 +91,11 @@ main(int argc, char *argv[]) break; case 'G': grouplist = optarg; + + /* + * XXX Why not allow us to drop all of our supplementary + * groups? + */ if (*grouplist == '\0') usage(); break; @@ -120,29 +127,37 @@ main(int argc, char *argv[]) } } - ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; - if ((gidlist = malloc(sizeof(gid_t) * ngroups_max)) == NULL) - err(1, "malloc"); - for (gids = 0; - (p = strsep(&grouplist, ",")) != NULL && gids < ngroups_max; ) { - if (*p == '\0') - continue; - - if (isdigit((unsigned char)*p)) { - gidlist[gids] = (gid_t)strtoul(p, &endp, 0); - if (*endp != '\0') - goto getglist; - } else { + if (grouplist != NULL) { + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((gidlist = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); + /* Populate the egid slot in our groups to avoid accidents. */ + if (gid == 0) + gidlist[0] = getegid(); + else + gidlist[0] = gid; + for (gids = 1; (p = strsep(&grouplist, ",")) != NULL && + gids < ngroups_max; ) { + if (*p == '\0') + continue; + + if (isdigit((unsigned char)*p)) { + gidlist[gids] = (gid_t)strtoul(p, &endp, 0); + if (*endp != '\0') + goto getglist; + } else { getglist: - if ((gp = getgrnam(p)) != NULL) - gidlist[gids] = gp->gr_gid; - else - errx(1, "no such group `%s'", p); + if ((gp = getgrnam(p)) != NULL) + gidlist[gids] = gp->gr_gid; + else + errx(1, "no such group `%s'", p); + } + gids++; } - gids++; + + if (p != NULL && gids == ngroups_max) + errx(1, "too many supplementary groups provided"); } - if (p != NULL && gids == ngroups_max) - errx(1, "too many supplementary groups provided"); if (user != NULL) { if (isdigit((unsigned char)*user)) { @@ -168,7 +183,7 @@ main(int argc, char *argv[]) if (chdir(argv[0]) == -1 || chroot(".") == -1) err(1, "%s", argv[0]); - if (gids && setgroups(gids, gidlist) == -1) + if (gidlist != NULL && setgroups(gids, gidlist) == -1) err(1, "setgroups"); if (group && setgid(gid) == -1) err(1, "setgid"); From nobody Fri Aug 15 05:04:23 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c3953578Fz64Y5W; Fri, 15 Aug 2025 05:04: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 4c39533zrlz3v1g; Fri, 15 Aug 2025 05:04:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755234263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4COs3v/n8KUmm5UyxKDWhjkykJDsqpgFQnZfln9VZpI=; b=jW8LimKniQL1OrJiggrcoZQfHeM5Q6tuH/cWLlM+G+aKMH9yqQMT4/PfT7VvmQLMZ3FVKm YO9S80Gzt92dPKp+NsiRdKFQC3DuxobISf3pfUOL/9pEbPTdV2ZaRPHoQmp0HXeFnlW46v Dd6mx44efAfBmIPerzcXKYItir5qCXyTthrKWuSAFZ0votKE2ScdExqRy63aYvOBcRh9Vw nwN60SxTClBt0kDAP6ERmLrDXA1uIJwgWxWj1T6i9GJRTWXD4WyFl8p4HYjDP8kYSbIOMK EysvPae0VmKNApVF99VMs2OYucnEO6HcMvMfu5UswhELB0QCPolZ0/63kLfx3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755234263; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4COs3v/n8KUmm5UyxKDWhjkykJDsqpgFQnZfln9VZpI=; b=WZ6NLOcnoEK37cexID3hm7kXnTaZEqfsXE8K2wgWqWTyoXt7jZsacpk2cy54ZThvOZy9Mg ejfydqcgFXp6QZcO87gKr3pkcp1qcRjZmwaxabauffCidikgjvtqOi0okPNlQZy5087KUJ Aqzsplou6knkcDxDnUTWOw84PoImnOTmp/eKGBMfZzyibjaJswKGSCfpTN6LQt4bPCW2UW vBDoWw68HqkOGzBG6Zl7I8AHuMEvRFa+EhcdYHdNzlFZlev5EhT0rI7F/EFSPq28iixzYc Dis1N/0LPLMe2jiTVWft8a4L4pG4+FzD5ql6Xei6oo8LjsUnBNn2xIP514y4JQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755234263; a=rsa-sha256; cv=none; b=ch7uZo2gazU9Jm8jM5X3ndhQVOoclSpXp5CFKQRgpqSIDIhdZn/wdb+DEu9ZGljOrO95Nv xNeSvO5nNcHjSkltjeiPYHK/TXZg0lPJjiLlEzNikm2lVA66BbAUlz13wTUOY3VoXGbWXN s/EzB+8gAGj4EeKO7c1m5XA0J8Xrsfnq7Q0MyT2iusk9J3G8W9KiqWxT1ygqf9P5MH/fj/ 7KYubkmLTlw399QFRbmqO/jTcRRfgs8xUd/Af4Kx4ymUb5x55/R5LIFZJ8Y+hkeSw0NWqV 2CqmJsJnfaFiOn5T08CT/JsZ6znkhhzxJSe3PbDIHeCb/6OJhQlyJ6UQ7lfUmg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c39533Y4qz8J1; Fri, 15 Aug 2025 05:04: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 57F54Nod045838; Fri, 15 Aug 2025 05:04:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57F54NLx045835; Fri, 15 Aug 2025 05:04:23 GMT (envelope-from git) Date: Fri, 15 Aug 2025 05:04:23 GMT Message-Id: <202508150504.57F54NLx045835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: c96e754ea688 - stable/13 - chroot: don't clobber the egid with the first supplemental group List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: c96e754ea6884f5b8969861e6df66f4a33dad638 Auto-Submitted: auto-generated The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=c96e754ea6884f5b8969861e6df66f4a33dad638 commit c96e754ea6884f5b8969861e6df66f4a33dad638 Author: Kyle Evans AuthorDate: 2025-07-26 06:11:58 +0000 Commit: Kyle Evans CommitDate: 2025-08-15 05:03:24 +0000 chroot: don't clobber the egid with the first supplemental group There are two problems here, really: 1.) If -G is specified, the egid of the runner will get clobbered by the first supplemental group 2.) If both -G and -g are specified, the first supplemental group will get clobbered by the -g group Ideally our users shouldn't have to understand the quirks of our setgroups(2) and the manpage doesn't describe the group list as needing to contain the egid, so populate the egid slot as necessary. I note that this code seems to have already been marginally aware of the historical behavior because it was allocating NGROUPS_MAX + 1, but this is an artifact of a later conversion to doing dynamic allocations instead of pushing NGROUPS_MAX arrays on the stack -- the original code did in-fact only have an NGROUPS_MAX-sized array, and the layout was still incorrect. Reviewed by: olce (cherry picked from commit 48fd05999b0f8e822fbf7069779378d103a35f5c) (cherry picked from commit babab49eee9472f628d774996de13d13d296c8c0) --- usr.sbin/chroot/chroot.c | 57 ++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c index 208be32f85ab..b762157046d6 100644 --- a/usr.sbin/chroot/chroot.c +++ b/usr.sbin/chroot/chroot.c @@ -73,7 +73,9 @@ main(int argc, char *argv[]) gid = 0; uid = 0; + gids = 0; user = group = grouplist = NULL; + gidlist = NULL; nonprivileged = false; while ((ch = getopt(argc, argv, "G:g:u:n")) != -1) { switch(ch) { @@ -89,6 +91,11 @@ main(int argc, char *argv[]) break; case 'G': grouplist = optarg; + + /* + * XXX Why not allow us to drop all of our supplementary + * groups? + */ if (*grouplist == '\0') usage(); break; @@ -120,29 +127,37 @@ main(int argc, char *argv[]) } } - ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; - if ((gidlist = malloc(sizeof(gid_t) * ngroups_max)) == NULL) - err(1, "malloc"); - for (gids = 0; - (p = strsep(&grouplist, ",")) != NULL && gids < ngroups_max; ) { - if (*p == '\0') - continue; - - if (isdigit((unsigned char)*p)) { - gidlist[gids] = (gid_t)strtoul(p, &endp, 0); - if (*endp != '\0') - goto getglist; - } else { + if (grouplist != NULL) { + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((gidlist = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); + /* Populate the egid slot in our groups to avoid accidents. */ + if (gid == 0) + gidlist[0] = getegid(); + else + gidlist[0] = gid; + for (gids = 1; (p = strsep(&grouplist, ",")) != NULL && + gids < ngroups_max; ) { + if (*p == '\0') + continue; + + if (isdigit((unsigned char)*p)) { + gidlist[gids] = (gid_t)strtoul(p, &endp, 0); + if (*endp != '\0') + goto getglist; + } else { getglist: - if ((gp = getgrnam(p)) != NULL) - gidlist[gids] = gp->gr_gid; - else - errx(1, "no such group `%s'", p); + if ((gp = getgrnam(p)) != NULL) + gidlist[gids] = gp->gr_gid; + else + errx(1, "no such group `%s'", p); + } + gids++; } - gids++; + + if (p != NULL && gids == ngroups_max) + errx(1, "too many supplementary groups provided"); } - if (p != NULL && gids == ngroups_max) - errx(1, "too many supplementary groups provided"); if (user != NULL) { if (isdigit((unsigned char)*user)) { @@ -168,7 +183,7 @@ main(int argc, char *argv[]) if (chdir(argv[0]) == -1 || chroot(".") == -1) err(1, "%s", argv[0]); - if (gids && setgroups(gids, gidlist) == -1) + if (gidlist != NULL && setgroups(gids, gidlist) == -1) err(1, "setgroups"); if (group && setgid(gid) == -1) err(1, "setgid"); From nobody Sat Aug 16 00:32:37 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c3g113fyTz64WTV; Sat, 16 Aug 2025 00:32: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 4c3g112yMcz49hw; Sat, 16 Aug 2025 00:32:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755304357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Le4i9KYd6TMrln4ZX9yc6ObogjAvAZnHRGCqOgLszKc=; b=dQfzfDqnq15a7t2gYv+RFlNdfRO8UgVrxsshJEZhfQnkPF0VMLgSfCjEdEJKu4YdOyq9no CMZomkcugKeVMffyKh6HY5NiyG2fuy2sldcBsXoB/Amjwqk829UUOwCJPhGXQ0b2QdMCSL kfYNJ/g0Uy8KYITKMFkY+/FVjAQhN/lMtUTxUChETLIpQ4+mKIGwwLDhopPlGKrL7a/n2x YRG6kG81rNzf/2ixGm5JdfcaoyTnOxLsGG8upoPsU9f3m7zk6QP7glKOrQB52SfnJynZsn duWMF210wca5HwIyLY7he+MIOTeHhPjuvnUBcplhD9Itg+nsAQlbHl0GlvRzrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755304357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Le4i9KYd6TMrln4ZX9yc6ObogjAvAZnHRGCqOgLszKc=; b=SR1N5UWYkCQk7Ks9WdpWPzgU1vjTllJIAa+63WJIMeqDDBZcvMOMadRB+nPfsYmt+NBRl/ u71RPzuka5VHrCC39loDxoSJQnj/v54+T2C9iB1o8rRTfX8rZTIQAyw1NpwZHn+32jXhxw 0LIV2o0aeu8YdeSYWlcrkpDyZ9PTgR9y/8B06gBAtxkce0+7S+OLZdOoTfuuzBukk/+EMx 29R31qGambEOeVy9Sy/u+r9b1pGYX/fBFpn+2yplUeeNGfNcR1siS4bhH6dPHaI9FrK0C6 cCIyDsvAgERRoFwMxueEAMZ38MPC6BTdd9I0PQWLNyfnTcuLvOeYlfEoljqIGg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755304357; a=rsa-sha256; cv=none; b=pLq+dK5rMCAUO8hjOGa/Cp65txV2oNZYzf/S3H13taC449MBFtI7dcCp4KWJzSOYs0jFM7 3ZB136cP7A2+apV08V7BnsCbd6x6m5YNDQOd7RXafV2z1HeE1btooaDo5tJtZIJNijPKlQ oywqqFY7IKdPq+ifErPUAB0xo9FBCFxeFULfUG7Dz7LA2rVSNDHnWFik/JGcahZqogFSeL KAldvbwPtFKdqv6OSIhA/LRZqSRzSA2DFu4SB0p5dqxgpPw/ptRaNCRQXk1XZHbhjgZjJP hXa4ulUMAxaT1QTeH4HWqmy8k0OmUBPgNOl/kSwqC0eeLlY0erjJI0i+231nIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c3g112VGxz117k; Sat, 16 Aug 2025 00:32: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 57G0Wb3p043589; Sat, 16 Aug 2025 00:32:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57G0Wbo4043586; Sat, 16 Aug 2025 00:32:37 GMT (envelope-from git) Date: Sat, 16 Aug 2025 00:32:37 GMT Message-Id: <202508160032.57G0Wbo4043586@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: a0849d43d4eb - stable/14 - timerfd_read(): stop setting td_rtcgen List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: a0849d43d4eb3c6fa4d1e497a2ef81ff071299b6 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a0849d43d4eb3c6fa4d1e497a2ef81ff071299b6 commit a0849d43d4eb3c6fa4d1e497a2ef81ff071299b6 Author: Konstantin Belousov AuthorDate: 2025-08-08 22:49:28 +0000 Commit: Konstantin Belousov CommitDate: 2025-08-16 00:32:19 +0000 timerfd_read(): stop setting td_rtcgen (cherry picked from commit e8b37e754589c911fb7cdc706ba7c49a5bfb7175) --- sys/kern/sys_timerfd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c index ab7e048a2ab1..565ab3ad6ee6 100644 --- a/sys/kern/sys_timerfd.c +++ b/sys/kern/sys_timerfd.c @@ -206,7 +206,6 @@ retry: mtx_unlock(&tfd->tfd_lock); return (EAGAIN); } - td->td_rtcgen = atomic_load_acq_int(&rtc_generation); error = mtx_sleep(&tfd->tfd_count, &tfd->tfd_lock, PCATCH, "tfdrd", 0); if (error == 0) { From nobody Sun Aug 17 18:34:04 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c4kyN5vR2z655SM; Sun, 17 Aug 2025 18:34: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 4c4kyN5K4Fz49bL; Sun, 17 Aug 2025 18:34:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755455644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U9667P/Pl2NoJAnX36my3bSibmsobdGfwZOV7+afRtc=; b=GO6O+58Ex//bVc8rRueeKo9O1gt1hu1RpDA+D+X2cqBHJG4jhPemP7cWbIg5iaa/l/1OaP gaAtBpqMfPoe7ef4sj3Y2EhmDbo+8TmS26msAddy1a5mlhabkjalYXN781tgliJuaD8Mqb elQNRu7V5hhd7dDuEY/CdiQP+dP94SLIVb8iyn8cVExXDGDZ+sCf5ll5FgGvUDvnzCiAYD qwcEimcFJahmMvV2juZ9DNlAhLkAB7JY0XCv+Pl/g+wBeW672hOaEc+GjHyQ3jrLNU/Kpo Uq3RFqtTZjOXzfzoSksMoF5kQQc1I+QBq8vc3NxDAtb/oZvH6Mowx3ulphz9qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755455644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=U9667P/Pl2NoJAnX36my3bSibmsobdGfwZOV7+afRtc=; b=L+CM8iV/EP8LBzboiVxbjiFnBaMqVrNtDAHN6Xarzs5zvzb+Zl+x91926UMncxBmHC09e1 YKlkq1p9VYmLVj3qp4VpjgBpfChkGbUVcMeehfO3LYW5x+Jh6nKsX7uZW5jhTxXuQIC26j 7tV/7zWZ40b9sl9mACpJ3ZA2myRb6V1rDtapnaX2iasCH38+tCm7DDYPolKiEQTTAJXvRS 2fovZQw8RAcxuRZv8Hb0dnjSzyQkXKcXqiwEWvG0RZ+Q9XN3m3j0MmzUJ8B7HmtjN2hq6Z H17byVM0tWIluGxM45kwkxZ7ShVgDDA+SR3IdnTIerVHkFeb67vr36nehoJo1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755455644; a=rsa-sha256; cv=none; b=VlSs6NcDjPLaTh+07AbFVl+r9IR0KCbp0WLxLiX0VBITjjFXWqm61RWvgxnOSY7nfsQyhe eznkcgBVnl0wy1l55h+dTAbETujwbzvzDZ8NA5EQf65a2nwI0E0ZUbbJRziadNd9JZyv0B fLWxkTbecE8V4vMBuYDKKs8TLmM8CDiX3ii5UJVmrpp+M+/giSMBG1D8lqXC/WrKE7oI8w zTtXbrpn6ihrFyegTWuTd7Q90Z5WhSrcQYjWHsc4n8bpgUHLS/iTTzO5tLFDXQ7zya0xqo OG19eY/ou577vPR7+IqFsm3qe+7VJ4iaYN1PaOU4HaYLoC7O9mbYRl4IStybLQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c4kyN4rlfz6X3; Sun, 17 Aug 2025 18:34: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 57HIY4nk000789; Sun, 17 Aug 2025 18:34:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57HIY4TS000786; Sun, 17 Aug 2025 18:34:04 GMT (envelope-from git) Date: Sun, 17 Aug 2025 18:34:04 GMT Message-Id: <202508171834.57HIY4TS000786@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: 50e1230228d8 - stable/14 - libmsun: remove duplicates after cdefs.h added inline to __always_inline List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 50e1230228d8bf7aeb1beb11f29c2e55338940df Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=50e1230228d8bf7aeb1beb11f29c2e55338940df commit 50e1230228d8bf7aeb1beb11f29c2e55338940df Author: Ryan Libby AuthorDate: 2024-06-25 17:40:14 +0000 Commit: Dimitry Andric CommitDate: 2025-08-17 18:30:42 +0000 libmsun: remove duplicates after cdefs.h added inline to __always_inline Reviewed by: kib, olce Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D45712 (cherry picked from commit 07cc7ea7386c5428cef9e8f06d4ebd8144dec311) --- lib/msun/ld128/e_rem_pio2l.h | 2 +- lib/msun/ld128/s_logl.c | 2 +- lib/msun/ld80/e_rem_pio2l.h | 2 +- lib/msun/ld80/s_logl.c | 2 +- lib/msun/src/e_rem_pio2.c | 2 +- lib/msun/src/e_rem_pio2f.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/msun/ld128/e_rem_pio2l.h b/lib/msun/ld128/e_rem_pio2l.h index 5d1f9bde92da..c10eb36d0c24 100644 --- a/lib/msun/ld128/e_rem_pio2l.h +++ b/lib/msun/ld128/e_rem_pio2l.h @@ -55,7 +55,7 @@ pio2_2t = 2.0670321098263988236496903051604844e-43L, /* 0x127044533e63a0105df5 pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */ pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */ -static inline __always_inline int +static __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; diff --git a/lib/msun/ld128/s_logl.c b/lib/msun/ld128/s_logl.c index 4d32462e5653..e9133ec66fd2 100644 --- a/lib/msun/ld128/s_logl.c +++ b/lib/msun/ld128/s_logl.c @@ -444,7 +444,7 @@ struct ld { #endif #ifdef STRUCT_RETURN -static inline __always_inline void +static __always_inline void k_logl(long double x, struct ld *rp) #else long double diff --git a/lib/msun/ld80/e_rem_pio2l.h b/lib/msun/ld80/e_rem_pio2l.h index 88412c3d0cf9..b64c9b6ff4f4 100644 --- a/lib/msun/ld80/e_rem_pio2l.h +++ b/lib/msun/ld80/e_rem_pio2l.h @@ -67,7 +67,7 @@ pio2_2t = 6.36831716351095013979e-25L, /* 0xc51701b839a25205.0p-144 */ pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */ #endif -static inline __always_inline int +static __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; diff --git a/lib/msun/ld80/s_logl.c b/lib/msun/ld80/s_logl.c index 2c5d1e2dd08f..7141abe086d5 100644 --- a/lib/msun/ld80/s_logl.c +++ b/lib/msun/ld80/s_logl.c @@ -444,7 +444,7 @@ struct ld { #endif #ifdef STRUCT_RETURN -static inline __always_inline void +static __always_inline void k_logl(long double x, struct ld *rp) #else long double diff --git a/lib/msun/src/e_rem_pio2.c b/lib/msun/src/e_rem_pio2.c index 266ab24097f2..05ae45153aeb 100644 --- a/lib/msun/src/e_rem_pio2.c +++ b/lib/msun/src/e_rem_pio2.c @@ -46,7 +46,7 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ #ifdef INLINE_REM_PIO2 -static __inline __always_inline +static __always_inline #endif int __ieee754_rem_pio2(double x, double *y) diff --git a/lib/msun/src/e_rem_pio2f.c b/lib/msun/src/e_rem_pio2f.c index 744060f18010..11e460c1af33 100644 --- a/lib/msun/src/e_rem_pio2f.c +++ b/lib/msun/src/e_rem_pio2f.c @@ -38,7 +38,7 @@ pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */ pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ #ifdef INLINE_REM_PIO2F -static __inline __always_inline +static __always_inline #endif int __ieee754_rem_pio2f(float x, double *y) From nobody Sun Aug 17 18:34:05 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c4kyQ1nhSz655Ps; Sun, 17 Aug 2025 18:34: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 4c4kyP6YXNz49bN; Sun, 17 Aug 2025 18:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755455645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=76L6LZ0n1Vku/AE3UEVjKETupGgCm+914tw5LzDeER4=; b=AN6fOfSdN6rlcPmmuLtldSUiVeC3rJ2VvAjKSVHsDuKK5/Ln1hcrjTRFD62ql4JtzlJdlE ljASa4MBFCTKgeVCeXptmhuHpa946vnkSYeeYFWEhgUMcRVnT4pUaa0X4G6TDH8IuoSOSq sb5e5kZyO9AwglqAqFZ/5HeFDJKbp0IRYJ6A2e7+h/RALlU2X0ihQezHhsCnvb15d82UwQ u7x65W1pccVcCpc90SZEv5SjMoX+9SkusLUfttt6CLObI0fmTlZKZasE8Prjy1aOVZ/SKw D/+TOjz+PCX2TEIJN/gfQoPE+nJpUsFkpff3SdIBoJiycs2ygbFUygMgzkquHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755455645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=76L6LZ0n1Vku/AE3UEVjKETupGgCm+914tw5LzDeER4=; b=AM2fh04MKOaALGHKMRS9UWyd5HNfe4q0WLEmWPU5gATCWQPMGAI2Eq2xq6Rq+8DRjEhd27 F8SSvjUaGJ+K9e9c83p9sDJMvImow8k1F4BVlm9ZG0EMMrGpKnZK130/T0IqmLRSpjF2yA KI6Bucdf7coKmCXeA3UQQ2RN+DpeyBwTX5hrhwjGUh8UEq1aywAhNLwuLOosE3fSTSKOIZ o5QjlRyL3+FCdVDCr1Q4meZuS28ya6X3CiEgl/ZHFzNNxbC+bsBVBHXT1RalMaVnrbDu39 9zPsP65IOeL2CQLv1RCbd1ybkijeLB87NQVPXzGamyjmViIighZCdWirOECV1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755455645; a=rsa-sha256; cv=none; b=WKcz4w+Tz64UmHWaC3DV2tJ6O2ssE0gxqhtGKaIuCY+uHpbFQ8O/PengGxyojRgUseIGoC pFk/DY7xedS9FI/WPTS2DKyoPXLwyGc44f5rfUehbI1rZgmaVNdg40Hu/iszucmAiaWl46 yypcciicCLKbM8MSurzmeNgHW4cYlXwSArS7GWdePOuj95VhZKoF7qOurWy0ssntLDIbuu JWfljj5vxXFxrp64mjpji1bNPiyKm+63RQtZe06UAu6BJmLnsxw1v2HArrHeennp0XfxO1 jSlM50pCuYzD1qS1O3QX08Ih6nUTaQVbYHYQVUXJVBIX+FGRKC/T2SyirYXkpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c4kyP603hz6ZW; Sun, 17 Aug 2025 18:34: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 57HIY5be000831; Sun, 17 Aug 2025 18:34:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57HIY5k8000828; Sun, 17 Aug 2025 18:34:05 GMT (envelope-from git) Date: Sun, 17 Aug 2025 18:34:05 GMT Message-Id: <202508171834.57HIY5k8000828@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: 8b26c76a6d41 - stable/14 - Updates for ccosh[f] and csinh[f] List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 8b26c76a6d41556ecb2b2309a7332dfba47b65cf Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=8b26c76a6d41556ecb2b2309a7332dfba47b65cf commit 8b26c76a6d41556ecb2b2309a7332dfba47b65cf Author: Steve Kargl AuthorDate: 2025-08-09 17:28:07 +0000 Commit: Dimitry Andric CommitDate: 2025-08-17 18:30:42 +0000 Updates for ccosh[f] and csinh[f] * lib/msun/src/s_ccosh.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5' with '/ 2'. This reduces diff with s_ccoshf.c. . For (LDBL_MANT_DIG == 53), add weak references for ccoshl and ccosl. * lib/msun/src/s_ccoshf.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5F' with '/ 2'. This reduces diff with s_ccoshf.c. * lib/msun/src/s_csinh.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5' with '/ 2'. This reduces diff with s_csinhf.c. . For (LDBL_MANT_DIG == 53), add weak references for csinhl and csinl. * lib/msun/src/s_csinhf.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5F' with '/ 2'. This reduces diff with s_ccoshf.c. PR: 288740 MFC after: 1 week (cherry picked from commit a1d051bc878decc761b37cf8771ead100cc05768) --- lib/msun/src/s_ccosh.c | 23 ++++++++++++++++------- lib/msun/src/s_ccoshf.c | 18 +++++++++++------- lib/msun/src/s_csinh.c | 23 ++++++++++++++++------- lib/msun/src/s_csinhf.c | 18 +++++++++++------- 4 files changed, 54 insertions(+), 28 deletions(-) diff --git a/lib/msun/src/s_ccosh.c b/lib/msun/src/s_ccosh.c index 3d46c993c6f1..14a8931742dc 100644 --- a/lib/msun/src/s_ccosh.c +++ b/lib/msun/src/s_ccosh.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,7 +48,7 @@ static const double huge = 0x1p1023; double complex ccosh(double complex z) { - double x, y, h; + double c, h, s, x, y; int32_t hx, hy, ix, iy, lx, ly; x = creal(z); @@ -64,14 +64,16 @@ ccosh(double complex z) if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) return (CMPLX(cosh(x), x * y)); + + sincos(y, &s, &c); if (ix < 0x40360000) /* |x| < 22: normal case */ - return (CMPLX(cosh(x) * cos(y), sinh(x) * sin(y))); + return (CMPLX(cosh(x) * c, sinh(x) * s)); /* |x| >= 22, so cosh(x) ~= exp(|x|) */ if (ix < 0x40862e42) { /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return (CMPLX(h * cos(y), copysign(h, x) * sin(y))); + h = exp(fabs(x)) / 2; + return (CMPLX(h * c, copysign(h, x) * s)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ z = __ldexp_cexp(CMPLX(fabs(x), y), -1); @@ -79,7 +81,7 @@ ccosh(double complex z) } else { /* x >= 1455: the result always overflows */ h = huge * x; - return (CMPLX(h * h * cos(y), h * sin(y))); + return (CMPLX(h * h * c, h * s)); } } @@ -129,7 +131,9 @@ ccosh(double complex z) if (ix == 0x7ff00000 && lx == 0) { if (iy >= 0x7ff00000) return (CMPLX(INFINITY, x * (y - y))); - return (CMPLX(INFINITY * cos(y), x * sin(y))); + + sincos(y, &s, &c); + return (CMPLX(INFINITY * c, x * s)); } /* @@ -154,3 +158,8 @@ ccos(double complex z) /* ccos(z) = ccosh(I * z) */ return (ccosh(CMPLX(-cimag(z), creal(z)))); } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(ccosh, ccoshl); +__weak_reference(ccos, ccosl); +#endif diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c index aeb2dec23677..fa41fdf4c4ea 100644 --- a/lib/msun/src/s_ccoshf.c +++ b/lib/msun/src/s_ccoshf.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,7 +40,7 @@ static const float huge = 0x1p127; float complex ccoshf(float complex z) { - float x, y, h; + float c, h, s, x, y; int32_t hx, hy, ix, iy; x = crealf(z); @@ -55,14 +55,16 @@ ccoshf(float complex z) if (ix < 0x7f800000 && iy < 0x7f800000) { if (iy == 0) return (CMPLXF(coshf(x), x * y)); + + sincosf(y, &s, &c); if (ix < 0x41100000) /* |x| < 9: normal case */ - return (CMPLXF(coshf(x) * cosf(y), sinhf(x) * sinf(y))); + return (CMPLXF(coshf(x) * c, sinhf(x) * s)); /* |x| >= 9, so cosh(x) ~= exp(|x|) */ if (ix < 0x42b17218) { /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5F; - return (CMPLXF(h * cosf(y), copysignf(h, x) * sinf(y))); + h = expf(fabsf(x)) / 2; + return (CMPLXF(h * c, copysignf(h, x) * s)); } else if (ix < 0x4340b1e7) { /* x < 192.7: scale to avoid overflow */ z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); @@ -70,7 +72,7 @@ ccoshf(float complex z) } else { /* x >= 192.7: the result always overflows */ h = huge * x; - return (CMPLXF(h * h * cosf(y), h * sinf(y))); + return (CMPLXF(h * h * c, h * s)); } } @@ -86,7 +88,9 @@ ccoshf(float complex z) if (ix == 0x7f800000) { if (iy >= 0x7f800000) return (CMPLXF(INFINITY, x * (y - y))); - return (CMPLXF(INFINITY * cosf(y), x * sinf(y))); + + sincosf(y, &s, &c); + return (CMPLXF(INFINITY * c, x * s)); } return (CMPLXF(((long double)x * x) * (y - y), diff --git a/lib/msun/src/s_csinh.c b/lib/msun/src/s_csinh.c index e7ed10e7d885..11c2ec345094 100644 --- a/lib/msun/src/s_csinh.c +++ b/lib/msun/src/s_csinh.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,7 +48,7 @@ static const double huge = 0x1p1023; double complex csinh(double complex z) { - double x, y, h; + double c, h, s, x, y; int32_t hx, hy, ix, iy, lx, ly; x = creal(z); @@ -64,14 +64,16 @@ csinh(double complex z) if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) return (CMPLX(sinh(x), y)); + + sincos(y, &s, &c); if (ix < 0x40360000) /* |x| < 22: normal case */ - return (CMPLX(sinh(x) * cos(y), cosh(x) * sin(y))); + return (CMPLX(sinh(x) * c, cosh(x) * s)); /* |x| >= 22, so cosh(x) ~= exp(|x|) */ if (ix < 0x40862e42) { /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return (CMPLX(copysign(h, x) * cos(y), h * sin(y))); + h = exp(fabs(x)) / 2; + return (CMPLX(copysign(h, x) * c, h * s)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ z = __ldexp_cexp(CMPLX(fabs(x), y), -1); @@ -79,7 +81,7 @@ csinh(double complex z) } else { /* x >= 1455: the result always overflows */ h = huge * x; - return (CMPLX(h * cos(y), h * h * sin(y))); + return (CMPLX(h * c, h * h * s)); } } @@ -128,7 +130,9 @@ csinh(double complex z) if (ix == 0x7ff00000 && lx == 0) { if (iy >= 0x7ff00000) return (CMPLX(x, y - y)); - return (CMPLX(x * cos(y), INFINITY * sin(y))); + + sincos(y, &s, &c); + return (CMPLX(x * c, INFINITY * s)); } /* @@ -154,3 +158,8 @@ csin(double complex z) z = csinh(CMPLX(cimag(z), creal(z))); return (CMPLX(cimag(z), creal(z))); } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(csinh, csinhl); +__weak_reference(csin, csinl); +#endif diff --git a/lib/msun/src/s_csinhf.c b/lib/msun/src/s_csinhf.c index c4392755c482..fcfc011a2484 100644 --- a/lib/msun/src/s_csinhf.c +++ b/lib/msun/src/s_csinhf.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,7 +40,7 @@ static const float huge = 0x1p127; float complex csinhf(float complex z) { - float x, y, h; + float c, h, s, x, y; int32_t hx, hy, ix, iy; x = crealf(z); @@ -55,14 +55,16 @@ csinhf(float complex z) if (ix < 0x7f800000 && iy < 0x7f800000) { if (iy == 0) return (CMPLXF(sinhf(x), y)); + + sincosf(y, &s, &c); if (ix < 0x41100000) /* |x| < 9: normal case */ - return (CMPLXF(sinhf(x) * cosf(y), coshf(x) * sinf(y))); + return (CMPLXF(sinhf(x) * c, coshf(x) * s)); /* |x| >= 9, so cosh(x) ~= exp(|x|) */ if (ix < 0x42b17218) { /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5F; - return (CMPLXF(copysignf(h, x) * cosf(y), h * sinf(y))); + h = expf(fabsf(x)) / 2; + return (CMPLXF(copysignf(h, x) * c, h * s)); } else if (ix < 0x4340b1e7) { /* x < 192.7: scale to avoid overflow */ z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); @@ -70,7 +72,7 @@ csinhf(float complex z) } else { /* x >= 192.7: the result always overflows */ h = huge * x; - return (CMPLXF(h * cosf(y), h * h * sinf(y))); + return (CMPLXF(h * c, h * h * s)); } } @@ -86,7 +88,9 @@ csinhf(float complex z) if (ix == 0x7f800000) { if (iy >= 0x7f800000) return (CMPLXF(x, y - y)); - return (CMPLXF(x * cosf(y), INFINITY * sinf(y))); + + sincosf(y, &s, &c); + return (CMPLXF(x * c, INFINITY * s)); } return (CMPLXF(((long double)x + x) * (y - y), From nobody Sun Aug 17 18:35:59 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c4l0b6t5Xz655pX; Sun, 17 Aug 2025 18:35: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 4c4l0b65DCz3C0Z; Sun, 17 Aug 2025 18:35:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755455759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HiPTuiwRpJ6HZ9iS3plXnfvTHYHCRRj8fzKS/NYQIc4=; b=qpUkiC96dGU27PFRsbK70LhBzdCL275sXofh3sKoXkII0wAZF5EcBkamEzIVGEuvY9M87t PqS98gVb0P5AUvcJYiCfsFZEYhVQ7tOiojM2ixGlD6UcVpJG2s8rfI8YCSGdGSnc4EyoBt IPg8xzgHVfDJSNq/GlTMFckJDaRBamEVqshkwUa5VwVzgK8Qh5DNLx6kRPN3yW9iLqcOUB MH77hz9lC3fIxv/4btRG+r3p0REqAcD4KF9vFH6KYQcp+QqjRQYgWyTMJyiefX0MfTtsze NwfxnZSZwrtTjaqVJYbPBYSK7NHL3Uoqqa94wJBiWYy8tlUyTGjVYcejr1/S1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755455759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HiPTuiwRpJ6HZ9iS3plXnfvTHYHCRRj8fzKS/NYQIc4=; b=oCjNeR7bS74cGMz/M/FrrNdltVJYSZcljsCoqupzBH/pRzAQdbk0lT1P4iNNMMIFfiGz3k ftVktf3wYFdgQByzV1aGlfncKTlYz6LBGyp043soPVZFgnoVF2hPLUfU+VjCHSPoqqM8Il H3oBsByDiuQCS4z0rCfevAU9hnRZqjrP0sEW5lVNaQIkKhAgo4s9dQVMwTPoYyo8QlWpNZ ylte7ZCmmZjq8augsV2E6WKTsyPDEpvOeIiL68R15BNWDaA9a6+XAwoiiJhBjmDa4pPOv9 k1kWwXdu5Xidx2hYkSLlkcymE5+pxo3+UTpbyHWh9dHb/UBns6nJB1dHAOFgOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755455759; a=rsa-sha256; cv=none; b=WCc37yI4zw4HngFvXrrLA0pkGbAMWRcazaPiMiygWWl6MOQ0YdwgXhU02xuLxyocj3Txgk j+rns6plzNEpvRx5plpNWjbVkq5ZQf5zKJtIGIjGZ0FSaCGqGjvnDvXWuInvAwTsfUMiTg tc78NE2ZpE7jEvztNj/Lr07ypEQXmH2ltVekDns9famn1MTNv31n2Fa32MMFyFKZY7Xcvd 41faOUmNn0unxibZpHmGdA9brjOt7RA8O/3zB7dCjyjPxdbLAOSRl1ooON5K8/L1M3/FMN 948gh7rp5mRjBki+5RGdGL3hJBdv5K63SsCgvLiYvkbFC4f4xVQyk2OtBGtlcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c4l0b5fNjz6ZY; Sun, 17 Aug 2025 18:35: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 57HIZxeI001530; Sun, 17 Aug 2025 18:35:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57HIZxSc001527; Sun, 17 Aug 2025 18:35:59 GMT (envelope-from git) Date: Sun, 17 Aug 2025 18:35:59 GMT Message-Id: <202508171835.57HIZxSc001527@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: 1eea81c39a17 - stable/13 - libmsun: remove duplicates after cdefs.h added inline to __always_inline List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 1eea81c39a176ecbfe2f4ef33274c5fcc4816edb Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=1eea81c39a176ecbfe2f4ef33274c5fcc4816edb commit 1eea81c39a176ecbfe2f4ef33274c5fcc4816edb Author: Ryan Libby AuthorDate: 2024-06-25 17:40:14 +0000 Commit: Dimitry Andric CommitDate: 2025-08-17 18:32:35 +0000 libmsun: remove duplicates after cdefs.h added inline to __always_inline Reviewed by: kib, olce Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D45712 (cherry picked from commit 07cc7ea7386c5428cef9e8f06d4ebd8144dec311) --- lib/msun/ld128/e_rem_pio2l.h | 2 +- lib/msun/ld128/s_logl.c | 2 +- lib/msun/ld80/e_rem_pio2l.h | 2 +- lib/msun/ld80/s_logl.c | 2 +- lib/msun/src/e_rem_pio2.c | 2 +- lib/msun/src/e_rem_pio2f.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/msun/ld128/e_rem_pio2l.h b/lib/msun/ld128/e_rem_pio2l.h index 35ed0b865a7c..d38a027dc215 100644 --- a/lib/msun/ld128/e_rem_pio2l.h +++ b/lib/msun/ld128/e_rem_pio2l.h @@ -56,7 +56,7 @@ pio2_2t = 2.0670321098263988236496903051604844e-43L, /* 0x127044533e63a0105df5 pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */ pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */ -static inline __always_inline int +static __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; diff --git a/lib/msun/ld128/s_logl.c b/lib/msun/ld128/s_logl.c index 8961dd0c96db..734e0a8c2d4d 100644 --- a/lib/msun/ld128/s_logl.c +++ b/lib/msun/ld128/s_logl.c @@ -445,7 +445,7 @@ struct ld { #endif #ifdef STRUCT_RETURN -static inline __always_inline void +static __always_inline void k_logl(long double x, struct ld *rp) #else long double diff --git a/lib/msun/ld80/e_rem_pio2l.h b/lib/msun/ld80/e_rem_pio2l.h index d9e4d3a0941f..ee35b28c83fd 100644 --- a/lib/msun/ld80/e_rem_pio2l.h +++ b/lib/msun/ld80/e_rem_pio2l.h @@ -68,7 +68,7 @@ pio2_2t = 6.36831716351095013979e-25L, /* 0xc51701b839a25205.0p-144 */ pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */ #endif -static inline __always_inline int +static __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; diff --git a/lib/msun/ld80/s_logl.c b/lib/msun/ld80/s_logl.c index 459374d7d164..2305a906bd4e 100644 --- a/lib/msun/ld80/s_logl.c +++ b/lib/msun/ld80/s_logl.c @@ -445,7 +445,7 @@ struct ld { #endif #ifdef STRUCT_RETURN -static inline __always_inline void +static __always_inline void k_logl(long double x, struct ld *rp) #else long double diff --git a/lib/msun/src/e_rem_pio2.c b/lib/msun/src/e_rem_pio2.c index ef4107af94cb..d31cce4d6912 100644 --- a/lib/msun/src/e_rem_pio2.c +++ b/lib/msun/src/e_rem_pio2.c @@ -47,7 +47,7 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ #ifdef INLINE_REM_PIO2 -static __inline __always_inline +static __always_inline #endif int __ieee754_rem_pio2(double x, double *y) diff --git a/lib/msun/src/e_rem_pio2f.c b/lib/msun/src/e_rem_pio2f.c index 26f6bc85791b..1740b4f49a58 100644 --- a/lib/msun/src/e_rem_pio2f.c +++ b/lib/msun/src/e_rem_pio2f.c @@ -39,7 +39,7 @@ pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */ pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ #ifdef INLINE_REM_PIO2F -static __inline __always_inline +static __always_inline #endif int __ieee754_rem_pio2f(float x, double *y) From nobody Sun Aug 17 18:36:00 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c4l0d251Zz65575; Sun, 17 Aug 2025 18:36: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 4c4l0d01tcz3BxN; Sun, 17 Aug 2025 18:36:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755455761; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9L65o/gL4pQFRT3uNJBwr9RYqCa37T48JaNu8u6Ozzc=; b=fJaaODcBFZKT7nLbuDMcyO9IqNMMwHs5rU5XEzzcUdpWGQlE/tQfxQR8Vg4Z79ZOZpqBPG mtanqZNXtt1MG3driLOjyW/4ksa2+ZiZktbABBqTEQag1fY5Nhh9rtK5Bt/63vYKtZphel fNf91ca5/kw40PIB2cMdOj7DTeoLTDsGWnyh+sGbh+CP58g2bTHTXpLNyPlmQdTqk5l1L7 f+F9N+jgjtwrRmZjUiTM0+Qfj9Aaz4T0k4MwwAS8YGIqSqFrFb9XJJQUYo5y/JYsOg1HX8 ZD5H9o1/OxM0t7gUYaMSTr+AO8Pp2t63YlstHmBhZQj/QtmwAyNztmDda/rCdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755455761; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9L65o/gL4pQFRT3uNJBwr9RYqCa37T48JaNu8u6Ozzc=; b=jimrvfAqUVQLZDnk4QFKEM2LO/kyMJnV8HUQxl1Upul9s8vLG+bR2e3RMNUJJ871l8CoQv Zr+2Bj1BNO89zfy3aGLwrFOVeVHfod0+OP7Ovu271Rir4B9VAZ9ArIJbyTyRFV4jk0sJsD PokB5FIqnm/Wt0/dsmatUACEp6XTaEGYKZj+MB4eDS2trFF8WmTbOX33JkjhT5efQcm9On BQjF8AcO0FIO2Q16RM/vUI2Tg3LNE0bqJJi/HkynUGe+PMRz9FC5zINC7WTPyUstckbYW0 Dg8CgV7meVBwLUVolbgKWRhFKXyJK72LAGmMzEB3V0GuTalik+rUT804Mz0zcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755455761; a=rsa-sha256; cv=none; b=hiEh0TZxcuFO7iv8xOyEb1kVixSa/FviQaJnfzL2up325B7P5cCdgoKS6XDM2vZb8PQJfs 8oi2fsML+tCJbWwQAkPRZjEM/xDWwLy88DbJur347C6NtRe9x1vovW5FewMsBgFN1a4RoG QtBNOODZYem20BTM/fvgJYRzXaXSXcMa99EdZ3EpoH2LBZzgNz3qcyqxk2hlvdnG+JoB3E wLM80rqMYnfhN5oCEW2K1Ay78CSnG745nM0hVH0eyWSZ0mIK3LubUdPjYMcJmBOT0cbm5E nXqpbHQGutFd+/d9rfuUFH6qkaWLeteACXZ0URxgO2TIdCk95KsQGUJSnM1Vaw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c4l0c6ZfMz6X5; Sun, 17 Aug 2025 18:36: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 57HIa08Z001574; Sun, 17 Aug 2025 18:36:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57HIa04B001571; Sun, 17 Aug 2025 18:36:00 GMT (envelope-from git) Date: Sun, 17 Aug 2025 18:36:00 GMT Message-Id: <202508171836.57HIa04B001571@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: e7fa66218354 - stable/13 - Updates for ccosh[f] and csinh[f] List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: e7fa662183546cb28cf54b15e3c543b1ffe31440 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=e7fa662183546cb28cf54b15e3c543b1ffe31440 commit e7fa662183546cb28cf54b15e3c543b1ffe31440 Author: Steve Kargl AuthorDate: 2025-08-09 17:28:07 +0000 Commit: Dimitry Andric CommitDate: 2025-08-17 18:32:35 +0000 Updates for ccosh[f] and csinh[f] * lib/msun/src/s_ccosh.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5' with '/ 2'. This reduces diff with s_ccoshf.c. . For (LDBL_MANT_DIG == 53), add weak references for ccoshl and ccosl. * lib/msun/src/s_ccoshf.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5F' with '/ 2'. This reduces diff with s_ccoshf.c. * lib/msun/src/s_csinh.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5' with '/ 2'. This reduces diff with s_csinhf.c. . For (LDBL_MANT_DIG == 53), add weak references for csinhl and csinl. * lib/msun/src/s_csinhf.c: . Update Copyright years. . sin() and cos() are needed at the same time, so use sincos() to compute values. This does argument reduction once instead of twice. . Replace '* 0.5F' with '/ 2'. This reduces diff with s_ccoshf.c. PR: 288740 MFC after: 1 week (cherry picked from commit a1d051bc878decc761b37cf8771ead100cc05768) --- lib/msun/src/s_ccosh.c | 23 ++++++++++++++++------- lib/msun/src/s_ccoshf.c | 18 +++++++++++------- lib/msun/src/s_csinh.c | 23 ++++++++++++++++------- lib/msun/src/s_csinhf.c | 18 +++++++++++------- 4 files changed, 54 insertions(+), 28 deletions(-) diff --git a/lib/msun/src/s_ccosh.c b/lib/msun/src/s_ccosh.c index 95ed3a32ddd7..145d9673f392 100644 --- a/lib/msun/src/s_ccosh.c +++ b/lib/msun/src/s_ccosh.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ static const double huge = 0x1p1023; double complex ccosh(double complex z) { - double x, y, h; + double c, h, s, x, y; int32_t hx, hy, ix, iy, lx, ly; x = creal(z); @@ -65,14 +65,16 @@ ccosh(double complex z) if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) return (CMPLX(cosh(x), x * y)); + + sincos(y, &s, &c); if (ix < 0x40360000) /* |x| < 22: normal case */ - return (CMPLX(cosh(x) * cos(y), sinh(x) * sin(y))); + return (CMPLX(cosh(x) * c, sinh(x) * s)); /* |x| >= 22, so cosh(x) ~= exp(|x|) */ if (ix < 0x40862e42) { /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return (CMPLX(h * cos(y), copysign(h, x) * sin(y))); + h = exp(fabs(x)) / 2; + return (CMPLX(h * c, copysign(h, x) * s)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ z = __ldexp_cexp(CMPLX(fabs(x), y), -1); @@ -80,7 +82,7 @@ ccosh(double complex z) } else { /* x >= 1455: the result always overflows */ h = huge * x; - return (CMPLX(h * h * cos(y), h * sin(y))); + return (CMPLX(h * h * c, h * s)); } } @@ -130,7 +132,9 @@ ccosh(double complex z) if (ix == 0x7ff00000 && lx == 0) { if (iy >= 0x7ff00000) return (CMPLX(INFINITY, x * (y - y))); - return (CMPLX(INFINITY * cos(y), x * sin(y))); + + sincos(y, &s, &c); + return (CMPLX(INFINITY * c, x * s)); } /* @@ -155,3 +159,8 @@ ccos(double complex z) /* ccos(z) = ccosh(I * z) */ return (ccosh(CMPLX(-cimag(z), creal(z)))); } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(ccosh, ccoshl); +__weak_reference(ccos, ccosl); +#endif diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c index ba97a390c832..2851157ead42 100644 --- a/lib/msun/src/s_ccoshf.c +++ b/lib/msun/src/s_ccoshf.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ static const float huge = 0x1p127; float complex ccoshf(float complex z) { - float x, y, h; + float c, h, s, x, y; int32_t hx, hy, ix, iy; x = crealf(z); @@ -56,14 +56,16 @@ ccoshf(float complex z) if (ix < 0x7f800000 && iy < 0x7f800000) { if (iy == 0) return (CMPLXF(coshf(x), x * y)); + + sincosf(y, &s, &c); if (ix < 0x41100000) /* |x| < 9: normal case */ - return (CMPLXF(coshf(x) * cosf(y), sinhf(x) * sinf(y))); + return (CMPLXF(coshf(x) * c, sinhf(x) * s)); /* |x| >= 9, so cosh(x) ~= exp(|x|) */ if (ix < 0x42b17218) { /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5F; - return (CMPLXF(h * cosf(y), copysignf(h, x) * sinf(y))); + h = expf(fabsf(x)) / 2; + return (CMPLXF(h * c, copysignf(h, x) * s)); } else if (ix < 0x4340b1e7) { /* x < 192.7: scale to avoid overflow */ z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); @@ -71,7 +73,7 @@ ccoshf(float complex z) } else { /* x >= 192.7: the result always overflows */ h = huge * x; - return (CMPLXF(h * h * cosf(y), h * sinf(y))); + return (CMPLXF(h * h * c, h * s)); } } @@ -87,7 +89,9 @@ ccoshf(float complex z) if (ix == 0x7f800000) { if (iy >= 0x7f800000) return (CMPLXF(INFINITY, x * (y - y))); - return (CMPLXF(INFINITY * cosf(y), x * sinf(y))); + + sincosf(y, &s, &c); + return (CMPLXF(INFINITY * c, x * s)); } return (CMPLXF(((long double)x * x) * (y - y), diff --git a/lib/msun/src/s_csinh.c b/lib/msun/src/s_csinh.c index 1bd78b1e49bf..8ea97970af7f 100644 --- a/lib/msun/src/s_csinh.c +++ b/lib/msun/src/s_csinh.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ static const double huge = 0x1p1023; double complex csinh(double complex z) { - double x, y, h; + double c, h, s, x, y; int32_t hx, hy, ix, iy, lx, ly; x = creal(z); @@ -65,14 +65,16 @@ csinh(double complex z) if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) return (CMPLX(sinh(x), y)); + + sincos(y, &s, &c); if (ix < 0x40360000) /* |x| < 22: normal case */ - return (CMPLX(sinh(x) * cos(y), cosh(x) * sin(y))); + return (CMPLX(sinh(x) * c, cosh(x) * s)); /* |x| >= 22, so cosh(x) ~= exp(|x|) */ if (ix < 0x40862e42) { /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return (CMPLX(copysign(h, x) * cos(y), h * sin(y))); + h = exp(fabs(x)) / 2; + return (CMPLX(copysign(h, x) * c, h * s)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ z = __ldexp_cexp(CMPLX(fabs(x), y), -1); @@ -80,7 +82,7 @@ csinh(double complex z) } else { /* x >= 1455: the result always overflows */ h = huge * x; - return (CMPLX(h * cos(y), h * h * sin(y))); + return (CMPLX(h * c, h * h * s)); } } @@ -129,7 +131,9 @@ csinh(double complex z) if (ix == 0x7ff00000 && lx == 0) { if (iy >= 0x7ff00000) return (CMPLX(x, y - y)); - return (CMPLX(x * cos(y), INFINITY * sin(y))); + + sincos(y, &s, &c); + return (CMPLX(x * c, INFINITY * s)); } /* @@ -155,3 +159,8 @@ csin(double complex z) z = csinh(CMPLX(cimag(z), creal(z))); return (CMPLX(cimag(z), creal(z))); } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(csinh, csinhl); +__weak_reference(csin, csinl); +#endif diff --git a/lib/msun/src/s_csinhf.c b/lib/msun/src/s_csinhf.c index b1f333955e53..530ac63b6a27 100644 --- a/lib/msun/src/s_csinhf.c +++ b/lib/msun/src/s_csinhf.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ static const float huge = 0x1p127; float complex csinhf(float complex z) { - float x, y, h; + float c, h, s, x, y; int32_t hx, hy, ix, iy; x = crealf(z); @@ -56,14 +56,16 @@ csinhf(float complex z) if (ix < 0x7f800000 && iy < 0x7f800000) { if (iy == 0) return (CMPLXF(sinhf(x), y)); + + sincosf(y, &s, &c); if (ix < 0x41100000) /* |x| < 9: normal case */ - return (CMPLXF(sinhf(x) * cosf(y), coshf(x) * sinf(y))); + return (CMPLXF(sinhf(x) * c, coshf(x) * s)); /* |x| >= 9, so cosh(x) ~= exp(|x|) */ if (ix < 0x42b17218) { /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5F; - return (CMPLXF(copysignf(h, x) * cosf(y), h * sinf(y))); + h = expf(fabsf(x)) / 2; + return (CMPLXF(copysignf(h, x) * c, h * s)); } else if (ix < 0x4340b1e7) { /* x < 192.7: scale to avoid overflow */ z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); @@ -71,7 +73,7 @@ csinhf(float complex z) } else { /* x >= 192.7: the result always overflows */ h = huge * x; - return (CMPLXF(h * cosf(y), h * h * sinf(y))); + return (CMPLXF(h * c, h * h * s)); } } @@ -87,7 +89,9 @@ csinhf(float complex z) if (ix == 0x7f800000) { if (iy >= 0x7f800000) return (CMPLXF(x, y - y)); - return (CMPLXF(x * cosf(y), INFINITY * sinf(y))); + + sincosf(y, &s, &c); + return (CMPLXF(x * c, INFINITY * s)); } return (CMPLXF(((long double)x + x) * (y - y),