From nobody Mon Jan 13 00:41:47 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YWYNq6fxVz5k8Wb; Mon, 13 Jan 2025 00:41: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YWYNq683Fz417L; Mon, 13 Jan 2025 00:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736728907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nGoDvMa6WzpN4Mx2g7ByFlzYlaLt64c4N/Lz1v6J8/I=; b=AjmIRk/UmRNCpYhthRKgBzHceJoaCQMOr1vFKTx/WMbssRDcmDNpM2YhXtgGXRKXaAsfnb d5Q6u+rzUcGtg5cCj/Z9tvBaksUO8K8xzdWhcEKXkoXz/0o0QHl1iT+QDFwZAbFS4ZL4fV GVGSgw4xxelVBfhbml1tK/dP84NgwIRFg28N1TC+A7CVEExXddzz402zq9iS2V9DTwNEe0 x2+RgtCN13gxbDY96r1SjBywwP35s1f5tKcuSCRxDp7rF/iZWEixtK3cGmZklHi8uVToaB kvfU4r1wH29+BxPVQKorgcFac4ombo8rlLWtGGNvtTcnSpHaYSZPmkxGANB3oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736728907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nGoDvMa6WzpN4Mx2g7ByFlzYlaLt64c4N/Lz1v6J8/I=; b=r/ktsIYSC+JUsT69UyCJBoA0/UB8TcTOW4rKY/RTWl4aV6tSQd38n0+YRXWTcoSnuTQCbP AIIyXDxIkOs2L35iuvEm7lpEEt2z/CjNTfGvdPRqV9L4cCwegdOwPQol6/sSVWg1DO3YVM bRFrLyTWYnjvf2SuEHROvGKoCa1Tza9CTfstrT5oSet+UUnS3UztLAoyOmMwtPm7OTtmZM o+5aFDPEd3/0J7eS6DMl++bTOq+41Md3+YxbZt6Yc167XsxcnjI+XLjpGG/7jFFKwnFV78 VxKhVbcXWbUy08LtS4X8K+ftRHds4EpGygCjR9E8PF/yH57ArjpQrsSLxMNsrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736728907; a=rsa-sha256; cv=none; b=G/BzOdYCetX4DLxZAXBXNGNEDQJbBIVgcvbyo5/TJfSYIjOy2Ssw2f4BUjTbS7DqFSkTUx RlQb5dxOJzHyFqIw+Uo20CwL0cuq3cOF8Muq85je+4IsYBRmjV7mFodwBrqy5wL78usREF n0CiqtvuMk45fqyOovsiZWGCNHnXV4U5urOnp8MM9x/3ouSWxxp251lGkDx1hjiPdE8PCY kzFrzPojz47cWT95EpyAmoYSMbbsb+BrdE6IzEr0MYkgZJiF8gc9DW8dZVBG/4ICxU/bKO CzZn/UyqmiebnJQBEk/F4NCObW0ON/zZSAH3pe4EIp/QNSekC2STBdZCrbRiGA== 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 4YWYNq5d89z16y0; Mon, 13 Jan 2025 00:41: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 50D0flAe032958; Mon, 13 Jan 2025 00:41:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50D0flxp032955; Mon, 13 Jan 2025 00:41:47 GMT (envelope-from git) Date: Mon, 13 Jan 2025 00:41:47 GMT Message-Id: <202501130041.50D0flxp032955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 712f81feea41 - main - include: add a userland version of __assert_unreachable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 712f81feea416e9f8aaf040173883876a50a7d34 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=712f81feea416e9f8aaf040173883876a50a7d34 commit 712f81feea416e9f8aaf040173883876a50a7d34 Author: Kyle Evans AuthorDate: 2025-01-13 00:41:25 +0000 Commit: Kyle Evans CommitDate: 2025-01-13 00:41:37 +0000 include: add a userland version of __assert_unreachable The kernel has had a version of this since c79cee71363d ("kernel: provide panicky version of __unreachable"), and userland can benefit from the same. __unreachable is largely inadequate because it's *not* an assertion of any sort, so we're not really alerted to a problem that we could've anticipated. Reviewed by: emaste, imp, jhb, olce Differential Revision: https://reviews.freebsd.org/D48077 --- include/assert.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/assert.h b/include/assert.h index cc2a5f8b9e64..a3dbe933e18f 100644 --- a/include/assert.h +++ b/include/assert.h @@ -43,15 +43,22 @@ #undef assert #undef _assert +#undef __assert_unreachable #ifdef NDEBUG #define assert(e) ((void)0) #define _assert(e) ((void)0) +#if __BSD_VISIBLE +#define __assert_unreachable() __unreachable() +#endif /* __BSD_VISIBLE */ #else #define _assert(e) assert(e) #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) +#if __BSD_VISIBLE +#define __assert_unreachable() assert(0 && "unreachable segment reached") +#endif /* __BSD_VISIBLE */ #endif /* NDEBUG */ #ifndef _ASSERT_H_ From nobody Mon Jan 13 00:41:48 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YWYNs0b2vz5k8bk; Mon, 13 Jan 2025 00:41:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YWYNr72vmz41Y3; Mon, 13 Jan 2025 00:41:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736728909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f07HTyq+dIJpJ/Ey6IamamW6pCRK3xZfrIIdqYg0ZRg=; b=HDefKKTQ41EKl3qjffC4QFj0/8rtCK4y4iF4+cuXnBA6SJeb+N4KgxbsbhCrTk49AiXCMC eVlrVbWIlsXaZrrf45Hh5NxAQMhgDyZboSItChUj7LBk3fcy83N3/ZehCcKbCj3fifBZJY dgT17Sr7OuWikXMJ5PZW9sTRkSzBsyvI5m6iSUVus/wiIjG2vpyTNkjVNlZbEmkMGtsgR8 PRp75J8k7VfMNPh4WMXIEhSNVou1OcHwvwNPK7i+D+/YssIYN1nmYy60Y18uolwX4JWaS1 J6zCksTGp0hHqKTVMCY2PcYeqlW1tUf6DrgY3TYboohD8HkjlhOwZ7wNmBTf9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736728909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=f07HTyq+dIJpJ/Ey6IamamW6pCRK3xZfrIIdqYg0ZRg=; b=RzUGMx2y7IBqlgIyglGs+oWrMPdx27fLxUq5PVbxgv8sF6/2Hk/13YjAVsYIR+x40eY8Bi Tx9YL2tt8EtZF9ZRFtyBUJ6UI5FcFRJjdASzzzo6+3hQlOLgfri8erzELeWHdTIk9PQK1Q 7CJAOnxq9vQ6XVX3ZJFGUw46nu5+NVVCOh+qZQaDvrj/vorNoqvSj4Z0U56ATXRKeMKyr3 DpYq1suiKu1ReCOC7IqiLXor+rg6MvANXMhhEfnYpEteyO4Fvx+YB8TZb7RKslITm6QA32 CWau+gQO0wIV5Ntf8tUhCw5ivlj63JH1Gq2Rnu5VpomsD8Y7yNvbGWf3Yc3U/g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736728909; a=rsa-sha256; cv=none; b=y3pM1TNEBfZEkbw95wTx7C6EJlm4kaArnU2hqrtqgw30g7vq2LZ8QS696wrcFU8afpS+c0 DGFxseuOO96Ip7F5LTdYDo5YfUZZepowu/9WXAe0ct4StBIaJczDxpntdecXWIQ3hj55W3 gVjDqwVODx/ZR7+/IBwWrSDQKD2GUb48ZPMcgsuV9iymmrbn3xDKrrFhN64bG3McF2kkWX yV1A44Rx169KdN68iAjdT6pltofBj//KNQEtBsxB7djK1zMcGKOioPPUDnmCewDcovFFUY HJ4ymRvAUKwAcKrd6vqrin/D6gBZcMTNsKqckBKqzn/71LXtubN+VU/EUdHdGQ== 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 4YWYNr6bLsz16y3; Mon, 13 Jan 2025 00:41: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 50D0fmsG033047; Mon, 13 Jan 2025 00:41:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50D0fm6G033044; Mon, 13 Jan 2025 00:41:48 GMT (envelope-from git) Date: Mon, 13 Jan 2025 00:41:48 GMT Message-Id: <202501130041.50D0fm6G033044@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: b769044f300a - main - nvmf: fix build with __assert_unreachable() addition to userland List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b769044f300a2e8534d0581f4fa7b4a296f038fa Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b769044f300a2e8534d0581f4fa7b4a296f038fa commit b769044f300a2e8534d0581f4fa7b4a296f038fa Author: Kyle Evans AuthorDate: 2025-01-13 00:41:25 +0000 Commit: Kyle Evans CommitDate: 2025-01-13 00:41:37 +0000 nvmf: fix build with __assert_unreachable() addition to userland now has a usable definition, so we don't need to shim it out in the nvmf header anymore. Reviewed by: emaste, jhb Differential Revision: https://reviews.freebsd.org/D48078 --- sys/dev/nvmf/nvmf_tcp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/nvmf/nvmf_tcp.h b/sys/dev/nvmf/nvmf_tcp.h index c60be0bc1024..03b5d2445928 100644 --- a/sys/dev/nvmf/nvmf_tcp.h +++ b/sys/dev/nvmf/nvmf_tcp.h @@ -9,7 +9,6 @@ #define __NVMF_TCP_H__ #ifndef _KERNEL -#define __assert_unreachable __unreachable #define MPASS assert #endif From nobody Mon Jan 13 00:43:03 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YWYQH6yM1z5k8jK; Mon, 13 Jan 2025 00:43: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YWYQH5qYTz42ZD; Mon, 13 Jan 2025 00:43:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736728983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eJvSFKKz2V/CsAe7zx5txveQ5fgWZTe/Mns1WTMsYSg=; b=QbsGMWuasqrMhTU0KbXauPqsbR/RUDAoTLwKiQYT6SkfwhgJVtavMi6QCt40vAUkCceBnA V4v+7EvmAoszUBTUmAxsxlpeiJXzUQJXYiKLHEg9e2jwoQOlnKNojLnKU/7AjpZrD2IbDr PEX5WJI83z1839LYCOPlTqz1b1L7n7by0e1KQ/vO8kBE2BrKVC4nG2b6rTd8QMJU0IRJOW vLYKFGENZvCY+JcfK1BUDmoyD9prhOSl2s6q9fBjfpxmqQPLr1Gczg/hub4JrYCqE7Ti7m 42bjVe5OwFE+udWOmq9Sg3NAhBYQRpYi2crHOqyAt/UJg2CqffBLcH/Xm2rtEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736728983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eJvSFKKz2V/CsAe7zx5txveQ5fgWZTe/Mns1WTMsYSg=; b=UQ5/ezqHiYQ+EojoLD1IC+iZ4Mzwjr4h5gfKkWR5+/BDIYhsgQV0CerP9MBW87BQhO+5eP Jb5g48fisXfovAwCfMPvaeqQUj0fNsCPJ5aw9gSCrgr+D2JffpYVW3UUcoeejtnIIEs+fL jEOaoPweEOiH/mk/KniLmx9v0ouu/rI776cN1PoLRWu0PAWRy2Tvj0A/HLQiRiIE+MWi5J gQdUI2IRPnA0hQsDTyAWQGxdG9tutcrL9L12lIEG9gbbIZKiHkWHlVc6mxCt8TMDE6Ftwn Fet0rQzQsytg+0ML6fSIKBhKRZM4LgCJfF6MTA1uez4h9R4EeJ2iaCZrKauI1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736728983; a=rsa-sha256; cv=none; b=xZUSv7XHiSkwrf5tw7ev9wNi/D08TbbSASFGUhn9weINXZh2Nr00mrJXzzSqgA4BUUVQlm e27qVzxh5ehLD7zsyDqVrbQzWmKI9yaAY6s36MlOmiafRL9jss99BhIKoIZvUyaSEEr8BV GCjVxdifgWg74dXRjOUaPdZcbPvcwXIIvqRuUvLHScYF2A492nSVXWrhNURTVGsbVFNVfK 5bgVfigxMYa6ZdDzPBj14eUqgu4lJhLfdAJqlZrEnDgUMjcmkK4QMgFiOCJKTfHnro3FzO TPW28ySl29MCnPdnOBDpFTD5Ba13xqwQZb2wthznCCNOkPYRUO48JzMRrZke6A== 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 4YWYQH5RbRz16yF; Mon, 13 Jan 2025 00:43: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 50D0h3aY036146; Mon, 13 Jan 2025 00:43:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50D0h3wN036143; Mon, 13 Jan 2025 00:43:03 GMT (envelope-from git) Date: Mon, 13 Jan 2025 00:43:03 GMT Message-Id: <202501130043.50D0h3wN036143@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Konovalov Subject: git: 8b5058ec78a6 - main - genl: typo fixes List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: maxim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b5058ec78a6fad972f48e6cd5613c2750f43ad6 Auto-Submitted: auto-generated The branch main has been updated by maxim: URL: https://cgit.FreeBSD.org/src/commit/?id=8b5058ec78a6fad972f48e6cd5613c2750f43ad6 commit 8b5058ec78a6fad972f48e6cd5613c2750f43ad6 Author: Maxim Konovalov AuthorDate: 2025-01-13 00:40:47 +0000 Commit: Maxim Konovalov CommitDate: 2025-01-13 00:42:55 +0000 genl: typo fixes PR: 284017 --- usr.bin/genl/genl.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/genl/genl.1 b/usr.bin/genl/genl.1 index af0c6360ad83..253cc12e0dfc 100644 --- a/usr.bin/genl/genl.1 +++ b/usr.bin/genl/genl.1 @@ -57,7 +57,7 @@ Id of the available multicast group if any and it associated name Connect to the .Ar family protocol and subscribe to the -.Ar mulicast group +.Ar multicast group then print the received messages in a readable format if the protocol is known. So far only .Qq nlctrl @@ -65,7 +65,7 @@ and .Qq nlsysevent are known. If no .Ar multicast group -are provided then all the groups are subsribed to. +are provided then all the groups are subscribed to. .El .Sh SEE ALSO .Xr genetlink 4 , From nobody Mon Jan 13 00:46:59 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YWYVq6VXTz5k8xs; Mon, 13 Jan 2025 00:46: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YWYVq5TF8z43MS; Mon, 13 Jan 2025 00:46:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736729219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HkRZMapYj9cRa42IP3MHdjYzLO9sWvFNqcWZ1SRvjRM=; b=VfgLy0xDbA0Dy1eBMixGcTqlVjneMsTQHkhvyrVJvvt5WpJQikwWwt3/jco6dsx6xgCzZo 22OkH7hMr4O2ZUuDmfOZj2DulWSLTVzBmRzv7UzaLDKe8h+E4iGeLP3KpmoR9rKKyTKA21 ipzrHqPn6eEmxF/O1Twi/rM/P1WqaaiC+9b1k/jD+VluKjq7BaBCH5URykAfsvrRCzuWE0 mtsbcwnjG+C8Hi0xopxVrXWjkeXbp/qAY6aw/VTN+YyNzQN1IYOVbPpeD86r3n/MZwkilo P5y+8AQbt7375j27KStPvA39Y30bz+xQkplbgz82V3YAwXrxON/tzdvoq/rB2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736729219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HkRZMapYj9cRa42IP3MHdjYzLO9sWvFNqcWZ1SRvjRM=; b=UjV0vtrLOIu+5XvRBqfL54GTKl9fVAjiSHH6r12mklJUkg94XGpruxJ7xB9tF/6K9JWYvN vqyXJXvJxFpSWfHcH4r1ySNHRLQ48j/Dl3445no2wVrjjAxKEnNgykINCvWcKpvMJ4EK5H +Q4z4YGQhydoX+2lTI96plpT+wc65zcOnEEACjBI2arR7ki2t7C7PInsJMA0xvrELQqqvq RwQG5Q/5SMxTkBJZk9MpPzLVWu2KtEvTxBatkHL/HmMCfgJmoO777aH8RPRT/iolhtJcFe 1i/134i2gB/+WFrPKgv++arvxSCIGsiwi6hY5mU3q/Wzd4KonOoAE6Z/OJI3Ew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736729219; a=rsa-sha256; cv=none; b=P6ipQE17VteC3edAQoFRd5lZFxDRw2YvbHZ7VcCS+ctjN/bJ/6hjtbS17Sq6hgNAaXmVv5 oB7kZYJGzSgHUp2yDQK245iEr6zbkVg7sw04J096LRWHNkYR97HmE79CaqVD2qJ70Z5GSB AOLRh5ygTiOm+nKVF7fs1xuwm5FrO2oQNRqwSIcdWK73tkxQ+xRpf9dGyLF+cU8eDwYl/4 x3QBfX1fwTs6dWi4FgHg5lGbTF+ALSKe2+2LZ1D1VE5LQaM/C2xm4SlFzLAiyj8X+h9DcT Fgrrd41jTK+PO4n80jRGQh/6HFDOrsnAD2y7SGgs+LBP08tvz6gvwFnkn+P5Cg== 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 4YWYVq4llhz16kc; Mon, 13 Jan 2025 00:46: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 50D0kx1S037489; Mon, 13 Jan 2025 00:46:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50D0kxFL037486; Mon, 13 Jan 2025 00:46:59 GMT (envelope-from git) Date: Mon, 13 Jan 2025 00:46:59 GMT Message-Id: <202501130046.50D0kxFL037486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Konovalov Subject: git: 0340a8c969d1 - main - genl: formatting fix List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: maxim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0340a8c969d1619bdcbd6ef64dd9202b2269d3f8 Auto-Submitted: auto-generated The branch main has been updated by maxim: URL: https://cgit.FreeBSD.org/src/commit/?id=0340a8c969d1619bdcbd6ef64dd9202b2269d3f8 commit 0340a8c969d1619bdcbd6ef64dd9202b2269d3f8 Author: Maxim Konovalov AuthorDate: 2025-01-13 00:46:29 +0000 Commit: Maxim Konovalov CommitDate: 2025-01-13 00:46:29 +0000 genl: formatting fix --- usr.bin/genl/genl.1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/genl/genl.1 b/usr.bin/genl/genl.1 index 253cc12e0dfc..e11bfbc440ab 100644 --- a/usr.bin/genl/genl.1 +++ b/usr.bin/genl/genl.1 @@ -63,7 +63,8 @@ So far only .Qq nlctrl and .Qq nlsysevent -are known. If no +are known. +If no .Ar multicast group are provided then all the groups are subscribed to. .El From nobody Mon Jan 13 07:59:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YWl693w5wz5klhV; Mon, 13 Jan 2025 07:59: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YWl693Fnsz3QVF; Mon, 13 Jan 2025 07:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736755185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zqYFcBM4v8puvOi3n0MzBlATd6DjBuVayvKzwKpX3uk=; b=UtYsWQ+5a1GMah65+SjHJ+RM2UYxf4evNmbRZAU6PgCcfFj7gK4Y+NGZEEeBigU0WwOyD4 mGuEy16V+TqnE6e/UD3IpRwy3H3azMFsssEOl6W0uCI7UoUDuHdLQ8i8NKfTcA77PIlYFu ZjTcgH1Lhy3ofWsj7ohVz0f+F9kkc7c0D1JNGP15H+K4wtoVvnN0BifLiFsUcc96Al39Qe k7t0FFi/eueL1piP7gy91zJLId372UsQg0KxDpigQG5bgBpNS4t/y2zLUIG+9gRU50hXNg eIzZBh5dDJkf3ZSCprkDlD/jicFu2v/IPPx9MZwn4KL9sZxpqAIbpfz8gf+PnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736755185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zqYFcBM4v8puvOi3n0MzBlATd6DjBuVayvKzwKpX3uk=; b=FplUA5TuwfqdbO3u/74el03qDS5e0nWww4LbaKVJXuYYNbhUpWtUdmNcJ48CMxOfw92kn3 mV8RvBl8mt445gjHWJnDIO+NQtJPPB3bhckk5qFE1urnVXcLeKqROk2t0QQNjmouxn0VuG 6ZsHrccMtoYp4aw221Jx8NYFXtTzwJlpJFUCqgc1QOAkUb18CPG8SbpeurhHVDOvexrHqq fSnUj64O/WqvCr7hl5JCG2JIDKvz8pGlYjmW1u262QxKPmAecVdSTSBuEFTMukpL/enB1s dK5IFDUTGUfl52twtqI0mlu4FEJBhkt8UXCpENUCf0G6oUys3Z2IU5MCmfR05A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736755185; a=rsa-sha256; cv=none; b=mykiMSjJNfV1822WiEQc8cboWpD0JWAnyC8rgoV2jv5JUSZBAexwZsrcFbKDm/utJGKgoM /1cERSaFUk8ETAwtsSyRJSfL6w31eqryyih0jZYlXXxFThMy8logpnrkm2KnENBxesX2b6 FxWXEYfX9YCS4YB8/c3bBRM+TGbG+ZM6G3lB/Bp9itMAiJpG3OXQa42tE7Yhc3M7SIiQud qfZn4/E8TrsFutqKFYqnsbtZE6pmRugOPQxvcssQL9Fe0kYOXviIrW79YdUfca8tmvQIoG 7oH0m1otJHvRRECsExlLp1KnbACJA7vyN/kHmTm7mSCZqMP2lbhkdPUT0DtuHQ== 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 4YWl692KSyz5dY; Mon, 13 Jan 2025 07:59: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 50D7xjUP044450; Mon, 13 Jan 2025 07:59:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50D7xjwq044447; Mon, 13 Jan 2025 07:59:45 GMT (envelope-from git) Date: Mon, 13 Jan 2025 07:59:45 GMT Message-Id: <202501130759.50D7xjwq044447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 1f1894ed3415 - main - arm64: conf: Fix comment in std.rockchip List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f1894ed341519ced3d94c470c2cd01527af0902 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=1f1894ed341519ced3d94c470c2cd01527af0902 commit 1f1894ed341519ced3d94c470c2cd01527af0902 Author: Emmanuel Vadot AuthorDate: 2025-01-13 08:00:58 +0000 Commit: Emmanuel Vadot CommitDate: 2025-01-13 08:01:50 +0000 arm64: conf: Fix comment in std.rockchip rk808 driver is obviously for the rk808 pmic and not rk805. Reported by: flo --- sys/arm64/conf/std.rockchip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/conf/std.rockchip b/sys/arm64/conf/std.rockchip index dc4dfadfde39..857cd7ed102b 100644 --- a/sys/arm64/conf/std.rockchip +++ b/sys/arm64/conf/std.rockchip @@ -23,7 +23,7 @@ device fan53555 # Fairchild Semi FAN53555/SYR82x Regulator # Power management controllers device rk8xx # RockChip RK8XX base support device rk805 # RockChip RK805 PMIC -device rk808 # RockChip RK805 PMIC +device rk808 # RockChip RK808 PMIC device rk817 # RockChip RK817 PMIC device syr827 # Silergy SYR827 PMIC device tcs4525 # TCS 4525 PMIC From nobody Mon Jan 13 16:06:13 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YWxvV1CXmz5kS4x; Mon, 13 Jan 2025 16:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YWxvV0Vr2z45xd; Mon, 13 Jan 2025 16:06:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736784374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lWmGftcMuvQd76tTuknyhdTtLYT7hu1/0XXFeicKKfg=; b=kuhU5tSZ2PLJj2HEZEb34ToKkS1J9rd3ZaQd84KpG1MM35p5dPbMXIB31wTe142REFNQVP 2Qu3h5zDF37is7zi1EpfQs/O8aheVmyKWROXs3oBD4XrW1EYeEl3r/51b49KQwXtgRd9+c Xa22noNoUj8q/0ahGkirpkzpR1O+hrvQ83Zgv6qUi9GTpa7ELSmKdnAr+sHYJlTCFyZhpW 1p/gzrgAkq6WTpzkHK3owromNh6oIOY2tGvuVxQpH60zLXWD2t1lpJWooymFjTGuRFwBIx /6ModNWIluw8NliKC2uUbk38t6dgmpoeLEkQzOmRTdRy7/oPBTIAGctcRDvYWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736784374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lWmGftcMuvQd76tTuknyhdTtLYT7hu1/0XXFeicKKfg=; b=nkeTpFcwvSQNKkloK8ITEkW5DVnmXSNbBK9SnE0dKS+qZlugqFydFsw2QfkAb8w8nl8AXb rqzgNJI9ONMMDtsXUkEOBbd11x6I221fqjMFCWbmWRhBbYJC8qgsNU+hmWdWgvp0PikCqd XRE1FlqumF1BRN9HzATZN1hE7+yg1xrlky5GyWmc2tM64iDVU/NKFrQfrY89ufvTUbZew9 JuA1MgKV5AYl5A+/Nt7QkJdic0Q96FMdiQfXaYmYeO+P1qlwmRNLfp+iJiewZ2IbDUj8xH v1tHYbTyYhZOiZ4qAIsYoix4TBqrI7yWF/G5NZLo6C32k123WTp6GQzX9TXINg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736784374; a=rsa-sha256; cv=none; b=Y7E4Z91hcf1DHpvwtm+P5BPL8bCjctKGD/Ge/XuiSrXC61vJe3Uyz5UOVl3q15eyfXXE5V UQBenhL1FGjpRs9wuSXyAUaAcUfrvQXQHsa195FsggFnli0dpdhMxS2SwqZ1+18ok6ZhNw F0FHTXahBEdtrWLPBLiJPiFcwH2/uAuZv2z2Fs74UjGb0pEpg2lAHeczE4nKUqqs52vknm lD0GKsn34UdLSlpihhUkZ6fYc+IAVChtY7Xy9d0qQ1pCHQJ1oGKgFxJOg5gRost0Dpw/yo 8zCayZ843k+DqsjFRi/S3kF5PU6toonmRM9Z8zgEGjRVxZGNV6dKeKP/ROm0UQ== 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 4YWxvT6yz2zdDx; Mon, 13 Jan 2025 16:06: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 50DG6DGY064134; Mon, 13 Jan 2025 16:06:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DG6D8Z064132; Mon, 13 Jan 2025 16:06:13 GMT (envelope-from git) Date: Mon, 13 Jan 2025 16:06:13 GMT Message-Id: <202501131606.50DG6D8Z064132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: d57842ed2dad - main - depend-cleanup.sh: clean up after AArch64 libc SIMD merge List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d57842ed2dad1c9bb8ae7271a8b5df772ac5213b Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=d57842ed2dad1c9bb8ae7271a8b5df772ac5213b commit d57842ed2dad1c9bb8ae7271a8b5df772ac5213b Author: Robert Clausecker AuthorDate: 2025-01-13 15:20:07 +0000 Commit: Robert Clausecker CommitDate: 2025-01-13 16:05:06 +0000 depend-cleanup.sh: clean up after AArch64 libc SIMD merge This should cover all the changed functions. Event: GSoC 2024 Reported by: andrew Approved by: emaste Differential Revision: https://reviews.freebsd.org/D48443 --- tools/build/depend-cleanup.sh | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 8aee1d0e9e71..6f97747183a8 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -239,3 +239,48 @@ if [ -h "$OBJTOP"/lib/libc/jemalloc.3 ]; then echo "Removing stale jemalloc.3 object" run rm -f "$OBJTOP"/lib/libc/jemalloc.3 fi + +if [ $MACHINE_ARCH = aarch64 ]; then + # 20250110 5e7d93a60440 add strcmp SIMD implementation + clean_dep lib/libc strcmp S + + # 20250110 b91003acffe7 add strspn optimized implementation + clean_dep lib/libc strspn c + + # 20250110 f2bd390a54f1 add strcspn optimized implementation + clean_dep lib/libc strcspn c + + # 20250110 89b3872376cb add optimized strpbrk & strsep implementations + clean_dep lib/libc strpbrk c + + # 20250110 79287d783c72 strcat enable use of SIMD + clean_dep lib/libc strcat c + + # 20250110 756b7fc80837 add strlcpy SIMD implementation + clean_dep lib/libc strlcpy c + + # 20250110 25c485e14769 add strncmp SIMD implementation + clean_dep lib/libc strncmp S + + # 20250110 bad17991c06d add memccpy SIMD implementation + clean_dep lib/libc memccpy c + + # 20250110 3dc5429158cf add strncat SIMD implementation + clean_dep lib/libc strncat c + + # 20250110 bea89d038ac5 add strlcat SIMD implementation + clean_dep lib/libc strlcat c + + # 20250110 3863fec1ce2d add strlen SIMD implementation + clean_dep lib/libc strlen S + + # 20250110 79e01e7e643c add bcopy & bzero wrapper + clean_dep lib/libc bcopy c + clean_dep lib/libc bzero c + + # 20250110 f2c98669fc1b add ASIMD-enhanced timingsafe_bcmp implementation + clean_dep lib/libc timingsafe_bcmp c + + # 20250110 3f224333af16 add timingsafe_memcmp() assembly implementation + clean_dep lib/libc timingsafe_memcmp c +fi From nobody Mon Jan 13 18:15:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX0mQ6Lg5z5kcXW; Mon, 13 Jan 2025 18:15: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX0mQ5csGz3KnH; Mon, 13 Jan 2025 18:15:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=33Z404A5/fZi2pVUSqocKK76CbzypZkaEUFxZAOZyg4=; b=ivf5MHYyXGMjBoYL/ahcu2N66OYiFURAe/odkUH80QMiIxjxYYLCkLAzOve8JzSl3/Kq7F mNgBQUaSsWmDER5FfxjTQ6bEg/57xuuZ5v+PxXbjrVmmzucnElV5/hvCD4QpULTn/RAVmx Wnd2LpxNqw6QI92mIozBfC8LuGbtVpGgEtcBT9GjAFIdmXIFcm5om6ILS65FFqGKw4P6yY wPuEw17zi8xMAGu0dLcOy8fo+WWFT8aoGDNSg6DCwh6K0aBYOqaf9FfKFTVdRZoFSo72g0 YFNxHqT0myDEbXL4WK8iQf4FgKRIoJ7jydH7hCJmmFTj955Zz/ztKbFwo2g3qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=33Z404A5/fZi2pVUSqocKK76CbzypZkaEUFxZAOZyg4=; b=JPmtsZi3QOwaHUcvesX40IlG2rFW5mmJ7kWdZvTE1qVlDOqITuNERZ6mHhqS09WyQZrUHA w7tPUteT/YsaLbb/I9PbxBkJbRTYxoP4yq+xeKLJz8cm2OFtuOYPejhjrS6Vvad8WDVvnf 2UkjJYkGfqtaVAQ8j2La+KSDgB5Ec7DKlLP6BVaKhiKLzkLkrbsVLIe/YK+i1JMgiZHutE jX2DGIVSVkbq2BopDp5Qzg5QRFFEqRzllr6V4hbwaUc4hbE1D/2mZPw891gp/KLO8aJEXl Azk6frmsKN23OVK82k29MXafeKbmnIIL57hUJ4GdIgR439D44IcEH0/aeTv0lg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736792118; a=rsa-sha256; cv=none; b=w6kaHfL0nyzYFuysjSJIgvPtyM9s/u0hhy/08Qh1yA44DWXtaEUCw+pXZvlFcoDnqDuuwv M5t4zM7yHLsUS+8l3nopdIq9eCfnrqIBkMI551np65dd8SboFXF8jL73JV/sGMIl4s7Mwd Yuk6HgMwd7kAwQYpBoKouZNUM2qg81Klxn7QaGaZihRzXrbwH+jFywMh/J3VfPRqOK5MDH kr8sm9CTGYCC/nXp3W6Oaalc6YmGYv9uGdM/1RBlgmjFfSbKkDaFjfbgI/awT462jLNXzs ISmkZwp7cl3hzA8DrVeGggEia6EKCtWhwRTzebWPDKw0ZXN4YqgAbfMkLYykPg== 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 4YX0mQ57Gyzj23; Mon, 13 Jan 2025 18:15: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 50DIFIO5007935; Mon, 13 Jan 2025 18:15:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DIFIVA007932; Mon, 13 Jan 2025 18:15:18 GMT (envelope-from git) Date: Mon, 13 Jan 2025 18:15:18 GMT Message-Id: <202501131815.50DIFIVA007932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 4155be454c46 - main - sockets: virtualize kern.ipc.soacceptqueue List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4155be454c46bc1ab725aca5c6969b064b74be38 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=4155be454c46bc1ab725aca5c6969b064b74be38 commit 4155be454c46bc1ab725aca5c6969b064b74be38 Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:08:51 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 18:11:39 +0000 sockets: virtualize kern.ipc.soacceptqueue PR: 219655 Differential Revision: https://reviews.freebsd.org/D48314 --- sys/kern/uipc_socket.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 470a2b3a51e4..7a76b561389a 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -240,38 +240,39 @@ struct splice32 { * NB: The original sysctl somaxconn is still available but hidden * to prevent confusion about the actual purpose of this number. */ -static u_int somaxconn = SOMAXCONN; +VNET_DEFINE_STATIC(u_int, somaxconn) = SOMAXCONN; +#define V_somaxconn VNET(somaxconn) static int sysctl_somaxconn(SYSCTL_HANDLER_ARGS) { int error; - int val; + u_int val; - val = somaxconn; + val = V_somaxconn; error = sysctl_handle_int(oidp, &val, 0, req); if (error || !req->newptr ) return (error); /* * The purpose of the UINT_MAX / 3 limit, is so that the formula - * 3 * so_qlimit / 2 + * 3 * sol_qlimit / 2 * below, will not overflow. */ if (val < 1 || val > UINT_MAX / 3) return (EINVAL); - somaxconn = val; + V_somaxconn = val; return (0); } SYSCTL_PROC(_kern_ipc, OID_AUTO, soacceptqueue, - CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, sizeof(int), - sysctl_somaxconn, "I", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE | CTLFLAG_VNET, 0, sizeof(u_int), + sysctl_somaxconn, "IU", "Maximum listen socket pending connection accept queue size"); SYSCTL_PROC(_kern_ipc, KIPC_SOMAXCONN, somaxconn, - CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE, 0, - sizeof(int), sysctl_somaxconn, "I", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE | CTLFLAG_VNET, 0, + sizeof(u_int), sysctl_somaxconn, "IU", "Maximum listen socket pending connection accept queue size (compat)"); static int numopensockets; @@ -1523,8 +1524,8 @@ solisten_proto(struct socket *so, int backlog) so->so_options |= SO_ACCEPTCONN; listening: - if (backlog < 0 || backlog > somaxconn) - backlog = somaxconn; + if (backlog < 0 || backlog > V_somaxconn) + backlog = V_somaxconn; so->sol_qlimit = backlog; mtx_unlock(&so->so_snd_mtx); From nobody Mon Jan 13 18:15:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX0mS1ZCQz5kcd4; Mon, 13 Jan 2025 18:15: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX0mR6DH1z3L9M; Mon, 13 Jan 2025 18:15:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3OWxxXGVsZNedvDdQAMvOLMFAtkM85uFI4o+PGGkX24=; b=iqR62Y7CYLalpj2iF8HgrKITS79P6H/DnQzuilqlGfHa2sIQqNiFefDCp2rFKT3fSggD0k 7VbdcQiqYSFGs3wU9/RKOFewAdpZ9WljXoOPeQYRR5OqxahtmeabX644OYPN5MDIw46DIb wsC+72EfZ4sa3wumB/o1yUtpjNiHPhNvtQswtB2BbYoRfB06zlELdpM3AqgORCBdjWH1xs uUirGrYc+6yzfJj4/ZfAt93+oSO0hmg60HTAmbeuEu2wRKbukmCC9YjYAgRo4/6HtajRU8 0UYoxFkafiUyZe0DLRuhTJwdPlKAMn/mFERJrb2jjVH4jSMaM6nNqzFFKganIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3OWxxXGVsZNedvDdQAMvOLMFAtkM85uFI4o+PGGkX24=; b=JDstso0gV4V3FDyWiicspq4QTjUY/BpbrInR9q4i4NWytrNdpL0SZSbb9vLuWISeAbX+nm gr0QYmnAZZ2smTJx76BZ0Hhh5LwAEGpag4etAGkNsTCIIds/wVXL41iYDNBnlEo8oK3kao kTTuCqfuNlKz4YN6ASxVZ7nSHGneQh+urgHavt6bMiGZx3ivAE0HJcTMUeWYVn8x0+vJFG J5DUaFZgmHSEsGDxhtpMLy6IZWNXYPaQSW6yaaYUYJ0MK3ht3XB5qt2mVsjlcWnZbQG4lE o+EP6CW4TQlpHQ9xszEgpZnClClNAhDrnq4AoEdTB+w9p1lBnHj7PiJI2pr/tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736792119; a=rsa-sha256; cv=none; b=kO0CFp0niO4LxdciIEwtM1xwPjtH4Hebhuz/LStP7SjJ8xYSAkUNecusGsCextzrZQTFgE 5wP2TCOzdLDRTum6VmFraPNNbriDoMTGUmvEEh/8JZSoRyQBAfDzGuErV/VLYans5yzm6C JFIIR/DmajfKOhGfD0Od5/tqqyk5TslJrvSD8bikqQcCcMA7Ve8BmLnH1reQtpQXtk/sIH eD/JyncCD8VTckoZTNsN4qAzYfylDgKBPqFmrYW2JSKWJLcNZCRZmhz7TIQnRJEG1LTbG6 fqGuX+dx5LZMWiUn3iuJ9oHe3eCgh6A0FI6Cu9lKzv8ELVCnlgZb76p19mwNPQ== 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 4YX0mR5qZyzhrH; Mon, 13 Jan 2025 18:15: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 50DIFJ2q007986; Mon, 13 Jan 2025 18:15:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DIFJtu007983; Mon, 13 Jan 2025 18:15:19 GMT (envelope-from git) Date: Mon, 13 Jan 2025 18:15:19 GMT Message-Id: <202501131815.50DIFJtu007983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 59498e099cc0 - main - sockets: virtualize kern.ipc.numopensockets List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 59498e099cc055da7afca8266087b7668be6d7cb Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=59498e099cc055da7afca8266087b7668be6d7cb commit 59498e099cc055da7afca8266087b7668be6d7cb Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:08:58 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 18:11:46 +0000 sockets: virtualize kern.ipc.numopensockets To avoid breaking POLA on the host machine it reports the same value as before. In a VNET jail it now reports number of sockets in this jail. PR: 219655 Differential Revision: https://reviews.freebsd.org/D48315 --- sys/kern/uipc_socket.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 7a76b561389a..426316ac6ce8 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -275,9 +275,23 @@ SYSCTL_PROC(_kern_ipc, KIPC_SOMAXCONN, somaxconn, sizeof(u_int), sysctl_somaxconn, "IU", "Maximum listen socket pending connection accept queue size (compat)"); -static int numopensockets; -SYSCTL_INT(_kern_ipc, OID_AUTO, numopensockets, CTLFLAG_RD, - &numopensockets, 0, "Number of open sockets"); +static u_int numopensockets; +static int +sysctl_numopensockets(SYSCTL_HANDLER_ARGS) +{ + u_int val; + +#ifdef VIMAGE + if(!IS_DEFAULT_VNET(curvnet)) + val = curvnet->vnet_sockcnt; + else +#endif + val = numopensockets; + return (sysctl_handle_int(oidp, &val, 0, req)); +} +SYSCTL_PROC(_kern_ipc, OID_AUTO, numopensockets, + CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_VNET, 0, sizeof(u_int), + sysctl_numopensockets, "IU", "Number of open sockets"); /* * so_global_mtx protects so_gencnt, numopensockets, and the per-socket From nobody Mon Jan 13 18:15:21 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX0mW2JT6z5kcZq; Mon, 13 Jan 2025 18:15: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX0mV1jDyz3LHn; Mon, 13 Jan 2025 18:15:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vtj6H/CGN56bg7efba1PJ01yM8nse4jpEAHR1jL94+Q=; b=DEcpeoSs2tOa/uZqVK326m2d9LJtHYAB3w1m/IcExRPywWa12RklKyizZ1Z7D2q10u+Zyo 72byfI6xzLg77HwMgR6J+5w1wlhnENgyfdbjOUb9uprX3+75080c73dyRSHJeSp0RZYXh8 /KVpQKpGN8KXFk1X9KxuJA2cm0HmBs0B7h5G2YkM1gDrjQmgLJy//QjCnDU0zFFf52dQhP Vnuzmy3zomMKAmIRbVmBkrMtynetgvQtwdX6GcZ4FivEPdSl8G4slvltIbI5YAGgxKml1P c8EX52nmDcGRVpoHTT0ZB8A8kOhCmBPIGaGQMAwGBq0X9q5S0hwY9QisapPmyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vtj6H/CGN56bg7efba1PJ01yM8nse4jpEAHR1jL94+Q=; b=dtlmM9aHQtE5NC8bauSs0u8f/+Jg4vEsYewyUE66uoDHJMkT8n7Nqm+0JH1reYZQ5dJxrD NA7U1bFYmppz7dxDQYSrFV9GYOjHFdusqOGNDxxTOYL8GbptoKPr2Y36i/sPPuB86FbmlF I3fXJySRYu3OyRuuUzwJ8Qb4+4l4p05fB/X4CRTtvkEBxWKCvOBtBjm2z2JU/MIiOdszux Ih+wFzUqPZ+Y1cRN9Nd/gczvJQ0vjvt7oC9NsJZ3xFN58gFNAWIkpbfCy9l0TfW4tS/YAo zwKAUuRVTv6Td+DNJs2X2yWgNYZkQgRPsNJ7jHtTTfuhseU9oMzuMZlcaXKqFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736792122; a=rsa-sha256; cv=none; b=WJHFQxqf6t/BZWQaKxJtV3u2q2Q4R8Tq6wbU2MKPb/AgrV4fYnKGYtHvE4bApLdIXxlefF pwBex00LaiO3O41H+uXrgR6/x5ze5+yJL81kS18VZux6gXhtqjnoaf8V5lBoI6Xeeu1g7l abbmaRE3I1xgXjdRvjIFUVeLOBVw3hWZZa1+QrGFiQZSxMFZCRkZ9pk8RhU+LXD/KlUrAE tpsg6BAk5dwoj6E4TE8t3lhm5OEI9yM39EEF/QIJcfOuiL/lKbKt6Q/ymiYX/sruiiLtPQ DTFr8LaZuqaJ3xQuxZ3Y+K1g6SlSRJUKDoYEm/3VO3aJ7HjvSdT2is6oBHg+8Q== 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 4YX0mV0SfWzj26; Mon, 13 Jan 2025 18:15:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50DIFLqF008091; Mon, 13 Jan 2025 18:15:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DIFLpj008089; Mon, 13 Jan 2025 18:15:21 GMT (envelope-from git) Date: Mon, 13 Jan 2025 18:15:21 GMT Message-Id: <202501131815.50DIFLpj008089@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: b84f41b4e82d - main - tcp: properly reset sackhint values when SACK recovery is done List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b84f41b4e82df373f8e682d45791b6ab636cd94e Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b84f41b4e82df373f8e682d45791b6ab636cd94e commit b84f41b4e82df373f8e682d45791b6ab636cd94e Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:13:45 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 18:13:45 +0000 tcp: properly reset sackhint values when SACK recovery is done When the SACK scoreboard collapses, properly clear all the counters. The counters are used in tcp_compute_pipe(), which can be called anytime later after the SACK recovery. The returned result can be totally bogus, including both too large and too small values. PR: 283649 Reviewed by: rscheff Differential Revision: https://reviews.freebsd.org/D48236 --- sys/netinet/tcp_sack.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index f642acd4c46a..90d789f0e224 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -653,8 +653,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) * scoreboard). */ tp->snd_fack = SEQ_MAX(tp->snd_una, th_ack); - tp->sackhint.sacked_bytes = 0; /* reset */ - tp->sackhint.hole_bytes = 0; } /* * In the while-loop below, incoming SACK blocks (sack_blocks[]) and @@ -870,12 +868,26 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) } } - KASSERT(!(TAILQ_EMPTY(&tp->snd_holes) && (tp->sackhint.hole_bytes != 0)), - ("SACK scoreboard empty, but accounting non-zero\n")); - + KASSERT(delivered_data >= 0, ("delivered_data < 0")); KASSERT(notlost_bytes <= tp->sackhint.hole_bytes, ("SACK: more bytes marked notlost than in scoreboard holes")); + if (TAILQ_EMPTY(&tp->snd_holes)) { + KASSERT(tp->sackhint.hole_bytes == 0, + ("SACK scoreboard empty, but accounting non-zero\n")); + tp->sackhint.sack_bytes_rexmit = 0; + tp->sackhint.sacked_bytes = 0; + tp->sackhint.lost_bytes = 0; + } else { + KASSERT(tp->sackhint.hole_bytes > 0, + ("SACK scoreboard not empty, but has no bytes\n")); + tp->sackhint.delivered_data = delivered_data; + tp->sackhint.sacked_bytes += delivered_data - left_edge_delta; + KASSERT((tp->sackhint.sacked_bytes >= 0), ("sacked_bytes < 0")); + tp->sackhint.lost_bytes = tp->sackhint.hole_bytes - + notlost_bytes; + } + if (!(to->to_flags & TOF_SACK)) /* * If this ACK did not contain any @@ -886,11 +898,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) * for RFC6675 rescue retransmission. */ sack_changed = SACK_NOCHANGE; - tp->sackhint.delivered_data = delivered_data; - tp->sackhint.sacked_bytes += delivered_data - left_edge_delta; - tp->sackhint.lost_bytes = tp->sackhint.hole_bytes - notlost_bytes; - KASSERT((delivered_data >= 0), ("delivered_data < 0")); - KASSERT((tp->sackhint.sacked_bytes >= 0), ("sacked_bytes < 0")); return (sack_changed); } From nobody Mon Jan 13 18:15:20 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX0mT4Jxdz5kd05; Mon, 13 Jan 2025 18:15:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX0mT1m6Kz3LCY; Mon, 13 Jan 2025 18:15:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hkDzCs/nDMLxYCQSAgq1ZqQrnlXtgclp/wscZbWFnLU=; b=A2TqX0qlqbCLP0qJ1evQpNYVVoZB4sujRZgyRK1QWRcHJIEVkzrSz02QCbfrzadSiobqtr 09lmV04h2naLv9+nzvhdOXfVKbRhVQ60JEAllnQelhKY3C2z1s+lG2m8RDtygGUipqHNQB 6r5hxJpPYY2Pd8gR4sDCh9FmH3a6kXi7FyYZJ6O3os1TugbM8IWYS1xiXeHcIX1OXIo5+U MotDvlUGC9ZTwLZdAipTwrdliJxW/RV3wZ3gh2zfCLltchbSS8xtHscIS7lPKCOvA0r8Dk mKt9KCUNwDAK+Gss+i4q2xsZEt4+kFxan7suJegvAiAkqda/FLtN9RIXYRrIKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hkDzCs/nDMLxYCQSAgq1ZqQrnlXtgclp/wscZbWFnLU=; b=ANYJOagESx8Idf/IyyjGCXQ6jigvg/R2TJMYOLZ6RIICaEN+70mJG/gKE4dCkQuLYvIyDy 3iRT+14x9gquS8lvpSAezHShwkK2kfCRSjaZcvAWMk1vgqLA4cFYkfz2LKFFIwFf5HlFke GhhUzwgm3JmRz0RPegmFu50fDyD4Ny4e6A/hkTZ521y1Ul6uEq+9qGXrykfF+NtiLRiBlN /2Wg6Ih+mjMZvrayH8Cg3BFrAAdIe0+EjKDL0XubUlxdq4xRepKNw07LvyS+KUysuYQyLW XngmJmN+ltvQnWboul4uKqyKFYrr873QlGbOUuI+mtkTZsS2TF0GlBow0BX4Vg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736792121; a=rsa-sha256; cv=none; b=NRkswQ6aOWhXIRC04c7q2J6hqDixJnITnxNB+Bxw4fvq0cK/1ZlApIG8b4jdEgZlpokhCt y0+iPrRbSpdaWvEQG6jY3thICxByCyZDzcQ0tIWcWRtS9zG1RkUbteP0ptY352wXzdLYCb YZfagiZ2NudmeL1J+fmt5KIGjV2FN5xuLFBWwWAYRoHZErcRIrv7mj4Q6c1XC+S/VXh1Tn xYlbDtLiHUtDuv4Z7S+XWuE76aCwQ95qGsivqy2f7ybhQ4R/TctiuBx+oG+LcyvYyFAxyo Tqf/9PxI3p92GDiY0YexSFjZkgpB8okal21RQLSGWcW3IYQKwuAMG6Cg1/t7rg== 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 4YX0mS6W9Szj24; Mon, 13 Jan 2025 18:15:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50DIFK5j008034; Mon, 13 Jan 2025 18:15:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DIFKZN008031; Mon, 13 Jan 2025 18:15:20 GMT (envelope-from git) Date: Mon, 13 Jan 2025 18:15:20 GMT Message-Id: <202501131815.50DIFKZN008031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 72c11c40ab5b - main - tcp: make sack_rxmit in tcp_output() a bool List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72c11c40ab5b091a30cddbd4b8d007ac7c29fcf9 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=72c11c40ab5b091a30cddbd4b8d007ac7c29fcf9 commit 72c11c40ab5b091a30cddbd4b8d007ac7c29fcf9 Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:13:30 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 18:13:30 +0000 tcp: make sack_rxmit in tcp_output() a bool Also make this variable initialization, as well as accompanying sackhole pointer, slightly more readable. NFC. Reviewed by: rscheff, tuexen, rrs Differential Revision: https://reviews.freebsd.org/D48235 --- sys/netinet/tcp_output.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 9df5b3dd42b0..74a229012508 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -203,7 +203,7 @@ tcp_default_output(struct tcpcb *tp) unsigned ipoptlen, optlen, hdrlen, ulen; unsigned ipsec_optlen = 0; int idle, sendalot, curticks; - int sack_rxmit, sack_bytes_rxmt; + int sack_bytes_rxmt; struct sackhole *p; int tso, mtu; struct tcpopt to; @@ -211,6 +211,7 @@ tcp_default_output(struct tcpcb *tp) struct tcp_log_buffer *lgb; unsigned int wanted_cookie = 0; unsigned int dont_sendalot = 0; + bool sack_rxmit; #ifdef INET6 struct ip6_hdr *ip6 = NULL; const bool isipv6 = (inp->inp_vflag & INP_IPV6) != 0; @@ -287,10 +288,8 @@ again: /* * Still in sack recovery , reset rxmit flag to zero. */ - sack_rxmit = 0; sack_bytes_rxmt = 0; len = 0; - p = NULL; if ((tp->t_flags & TF_SACK_PERMIT) && (IN_FASTRECOVERY(tp->t_flags) || (SEQ_LT(tp->snd_nxt, tp->snd_max) && (tp->t_dupacks >= tcprexmtthresh))) && @@ -317,6 +316,7 @@ again: * moves past p->rxmit. */ p = NULL; + sack_rxmit = false; goto after_sack_rexmit; } else { /* Can rexmit part of the current hole */ @@ -343,12 +343,15 @@ again: * Wouldn't be here if there would have been * nothing in the scoreboard to transmit. */ - sack_rxmit = 1; if (len > 0) { off = SEQ_SUB(p->rxmit, tp->snd_una); KASSERT(off >= 0,("%s: sack block to the left of una : %d", __func__, off)); } + sack_rxmit = true; + } else { + p = NULL; + sack_rxmit = false; } after_sack_rexmit: /* @@ -409,7 +412,7 @@ after_sack_rexmit: * If sack_rxmit is true we are retransmitting from the scoreboard * in which case len is already set. */ - if (sack_rxmit == 0) { + if (!sack_rxmit) { if ((sack_bytes_rxmt == 0) || SEQ_LT(tp->snd_nxt, tp->snd_max)) { len = imin(sbavail(&so->so_snd), sendwin) - off; } else { @@ -557,7 +560,7 @@ after_sack_rexmit: if ((tp->t_flags & TF_TSO) && V_tcp_do_tso && len > tp->t_maxseg && (tp->t_port == 0) && ((tp->t_flags & TF_SIGNATURE) == 0) && - ((sack_rxmit == 0) || V_tcp_sack_tso) && + (!sack_rxmit || V_tcp_sack_tso) && (ipoptlen == 0 || (ipoptlen == ipsec_optlen && (tp->t_flags2 & TF2_IPSEC_TSO) != 0)) && !(flags & TH_SYN)) @@ -981,7 +984,7 @@ send: */ SOCK_SENDBUF_UNLOCK(so); error = EMSGSIZE; - sack_rxmit = 0; + sack_rxmit = false; goto out; } len = tp->t_maxseg - optlen - ipoptlen; @@ -1063,7 +1066,7 @@ send: if (m == NULL) { SOCK_SENDBUF_UNLOCK(so); error = ENOBUFS; - sack_rxmit = 0; + sack_rxmit = false; goto out; } @@ -1107,7 +1110,7 @@ send: SOCK_SENDBUF_UNLOCK(so); (void) m_free(m); error = ENOBUFS; - sack_rxmit = 0; + sack_rxmit = false; goto out; } } @@ -1136,7 +1139,7 @@ send: m = m_gethdr(M_NOWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; - sack_rxmit = 0; + sack_rxmit = false; goto out; } #ifdef INET6 @@ -1233,7 +1236,7 @@ send: * case, since we know we aren't doing a retransmission. * (retransmit and persist are mutually exclusive...) */ - if (sack_rxmit == 0) { + if (!sack_rxmit) { if (len || (flags & (TH_SYN|TH_FIN)) || tcp_timer_active(tp, TT_PERSIST)) th->th_seq = htonl(tp->snd_nxt); From nobody Mon Jan 13 18:15:23 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX0mX2VWsz5kcj6; Mon, 13 Jan 2025 18:15:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX0mW1stsz3KqZ; Mon, 13 Jan 2025 18:15:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r4CRESgTLiv/muXLOQBregguYpjBFhGmGhAu/uc/C0k=; b=pKcL/VB17+jr9rVXNP+A7IGFvVFOCJKiLebgl414Ih6dj6JposTKZD1JMFkJWEhUYGeXxy EdvxSrkOqjiQ1sNz+ZVzkP3uX4HD+QKw+hTh0YTTmNPKg3oJRbURnKR6HojcsjJXaPbQ7d kFbBR5MKmkO5VM+2DpcTNN7YCcZmQJB8ex5FZE6OlLm/hs/UG4LwEiqBbM6fcn08zOPdlQ CXvCR++LdMCnQ+uCLT/E9R4JFfcDfSrots7qJEmpd8Lm+jrZDzAkOLJLVQ3Bw2du1rdcQo 12PJCV8lPmWEAEHlSn+ZradrkwZezQU7UZtklEPYgGisPbbRIdLiczOG7qXS+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=r4CRESgTLiv/muXLOQBregguYpjBFhGmGhAu/uc/C0k=; b=d7PxN1kTgoiTZWqBrutdhRAdCynVK3BjJwVHFjjtauTdhCiB3ADbkS1Svwk6jmRyprNbpD hlghzXaETK/+QO9S2iH4SaqUCLA9BsCSvBmfnaEojBbGj9qlcG8G+ax2xA45tdysngQANg TRgRTCZJgfEknTJ3yt+et7XOVZ7sZOppEal7+Xj/0kU8ngGkvR0HrY8LwtOZmhxt7/WRdm D5jXppuXIGEH8boptM/jhuTjRm7MbwmmMRdCUFcIRSIfeVG3wyvez/7uyAGE+a0hrG0xlz MhDHTVWRqQ7kqfrJjTKUfGtUlR9YdtNb4cjZj1Ubr8S21ll0go65SJT9SXj76Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736792123; a=rsa-sha256; cv=none; b=ZZFPw5ZLBMDQWVSm9jUMvMPZpV7TiNbzAKwjbFx+aLjPUL7Zj7tmZp33SGqSEHj0czqUFZ pPmCMZ5eDLjJhi4K2jYt+erKpEEIUb7UDtA9MZZ0agh85gEAP+3wj01q7stBtMDYykPHvX HzUvOQbXdKCobY/mX6PBudZLXbOeHbM9QbUEMyxY69i5mKN3UJCZsCQSdPmW06/ejdUM9s jmr54nk7Ym2Gi2o8ihx8CJS28Ad0zdheBwRQmgoh7gYgsnk865c0+2BRxPEdf4ov2dd1pa QvdM5HOfRkbc0cdzpW6P7KLUa0ax88sE0hnK585I/kyC5H8ewTFTeUG0O4lflQ== 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 4YX0mW16FXzhb4; Mon, 13 Jan 2025 18:15: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 50DIFNV7008139; Mon, 13 Jan 2025 18:15:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DIFNIt008136; Mon, 13 Jan 2025 18:15:23 GMT (envelope-from git) Date: Mon, 13 Jan 2025 18:15:23 GMT Message-Id: <202501131815.50DIFNIt008136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 1043b36b2054 - main - tcp: don't send beyond receivers advertised window List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1043b36b2054ffb32aadfe1c276684bf463db59a Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=1043b36b2054ffb32aadfe1c276684bf463db59a commit 1043b36b2054ffb32aadfe1c276684bf463db59a Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:13:54 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 18:13:54 +0000 tcp: don't send beyond receivers advertised window When calculating length of data to be sent, we may do some congestion calculations, but we shall never send a byte beyond (snd_una + snd_wnd). In 7dc78150c730e we started to use tcp_compute_pipe() instead of (snd_wnd - off). This function makes an estimate of how much data is in flight. It can return a value smaller and larger than (snd_nxt - snd_una). It will return a value larger when we have retransmitted some data from SACK holes, and smaller once those retransmitted SACK holes are acked. We may use tcp_compute_pipe() for length calculation, but always capped by the send offset 'off', which (snd_nxt - snd_una). PR: 283649 Reviewed by: rscheff Differential Revision: https://reviews.freebsd.org/D48237 Fixes: 7dc78150c730e90fa2afdaba3aa645932b30c429 --- sys/netinet/tcp_output.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 74a229012508..135e7d8493e2 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -421,8 +421,9 @@ after_sack_rexmit: * sending new data, having retransmitted all the * data possible in the scoreboard. */ - len = imin(sbavail(&so->so_snd) - off, - sendwin - tcp_compute_pipe(tp)); + len = imax( + imin(sbavail(&so->so_snd), sendwin) - + imax(tcp_compute_pipe(tp), off), 0); } } From nobody Mon Jan 13 19:23:29 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX2H61GCtz5kjNH; Mon, 13 Jan 2025 19:23: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX2H60GYbz3VvM; Mon, 13 Jan 2025 19:23:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tV+l5cTHG4xfuO1q8qMSR74fPyGlUqgsSbW37LIHNt4=; b=Mz6+vzjqVrW55ondpopd9W2gCFfA9UV7D9Ld0iv6t3MM1zAGgsbsGJ23aL0kQ8awqIKMZV 6PkCsDjCnnsh1VgDZFePOuPE4/jBtVUjZr0KIkwrNWOGsDjqOR7ksGSMf73D6Q3IwKo837 72pAlR5wUgtjriXUCkBB0sMA4ldTXR6BQbWoUIPZmIbIs5A2Ej/xDX7i8CDpwCY7/YRx7U AtsmZkgne5DwLU3ZHY3B8Dq5Vow0d/up6QqwnL6NPRM4sZj9LD8v0XRZoODPE314jbN8Ir ORAZFsv53ifIJfQFZRB74eVyD9ZhLzJM+ykBf0aSzU6UZUrZR38RhJX5xAH1qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tV+l5cTHG4xfuO1q8qMSR74fPyGlUqgsSbW37LIHNt4=; b=skJFbkHAn5XDnE+7qTmUwKFWT6fWu8sno17lSK2gUwvIt3m0l0QhBZoZRFb9W92W97Gi39 cmRMpVQHgyMwDnpuOKG1BrGhcgF6d9stlIx8gvNXZJBriU7I3o4uhhG1QJVuCF6dv1Q8t+ CrgbJt5IjNWEtPJWLFyWSGPGMKADMU5ks45w1awVYkp0j1cQFqN4RfHte0O/FwVHnEvQIY sHt8GiLpg4gZGb6V7+grLtbSaFhfyq7tSNhMyE+RQYIANunYCtbZWkXrp0yeShAKRALHft YlR07uCV9ros4nxHhVwjAsi9RoK1USVpfiq3mTWX0KZ47Tw37W6AZfwfNrpBwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736796210; a=rsa-sha256; cv=none; b=tE/2PtNd+uTfjBf2lAM6j4uEvGe0dOu/r6x3nSwQVlBwMzYgOnZmbivY35uCLqzq5ja74z EPCGZIRsZBDjXaMmjx4B4VqVEMWa2F9eQx+YMDwEZNrsg32a9WUEWiH74nt/mw9BORCEsi mROW8VS6CUG1IGRP1uP/UeyZnIEHytKxOsMEh8zF1aftV2ihkJyB56g6G7Lnvr4i/bRfvZ 3O5IvqnTBHo7MTWDV0jTuyGj9QC/KtyS4QrWWGCSx/ezI+u6DlqxlW5niljuboXezYZtPg 4F826IL/sLPJ8CggvTjc3rQ5Lk5aKpeDczPrLt7J3xS2qUftO3TUCrfKE0bOoQ== 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 4YX2H56m32zjTN; Mon, 13 Jan 2025 19:23: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 50DJNTcv039230; Mon, 13 Jan 2025 19:23:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DJNTjZ039227; Mon, 13 Jan 2025 19:23:29 GMT (envelope-from git) Date: Mon, 13 Jan 2025 19:23:29 GMT Message-Id: <202501131923.50DJNTjZ039227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a57a2c01aacc - main - ffs_blkpref_ufsX(): do not iterate over startcg twice List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a57a2c01aacc5e2a29fa33d50aecc516e37cecd0 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a57a2c01aacc5e2a29fa33d50aecc516e37cecd0 commit a57a2c01aacc5e2a29fa33d50aecc516e37cecd0 Author: Konstantin Belousov AuthorDate: 2025-01-05 23:00:10 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-13 19:22:44 +0000 ffs_blkpref_ufsX(): do not iterate over startcg twice Tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48378 --- sys/ufs/ffs/ffs_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 713dcf1ca97a..01bfdb85c2e6 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1496,7 +1496,7 @@ ffs_blkpref_ufs1(struct inode *ip, fs->fs_cgrotor = cg; return (cgdata(fs, cg)); } - for (cg = 0; cg <= startcg; cg++) + for (cg = 0; cg < startcg; cg++) if (fs->fs_cs(fs, cg).cs_nbfree >= avgbfree) { fs->fs_cgrotor = cg; return (cgdata(fs, cg)); @@ -1608,7 +1608,7 @@ ffs_blkpref_ufs2(struct inode *ip, fs->fs_cgrotor = cg; return (cgdata(fs, cg)); } - for (cg = 0; cg <= startcg; cg++) + for (cg = 0; cg < startcg; cg++) if (fs->fs_cs(fs, cg).cs_nbfree >= avgbfree) { fs->fs_cgrotor = cg; return (cgdata(fs, cg)); From nobody Mon Jan 13 19:23:31 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX2H732Trz5kjNJ; Mon, 13 Jan 2025 19:23:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX2H713kvz3VvN; Mon, 13 Jan 2025 19:23:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=M9KdzXJjwlf30RTT5ZAlKK+E6v0e5Xx3XmoocNeafZw=; b=oAZl02mdflbWWKnyKjzDnZEUKRD9uodxDqFSDfLvt2q7v4Tm4kHijIVa+PEv0jd4zI0t03 zjG07gbcMH3L160sBImIKWkzr4vsJtjQDi4gElnu1uveBnat1JLX4wdwJGOgr9enEwJylQ 9AlUk6cjq/yAezY8uHteSCAdFKbQml/6HdJ8S+9VQWXNE+JqYymwFoIKl44kCUYIw2zWMS WqdJgqSfIfZlU/gj9y6lV00eN3o9QM4rGnR144W7MziRdldRQbHPLOuyJu1ufAr7HS0ygA SD6Fs65Wuf6QIp2vxtKXv26zB09vETxAkDQ+HSdqEE+j8z9Rao832cIB/yTTfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=M9KdzXJjwlf30RTT5ZAlKK+E6v0e5Xx3XmoocNeafZw=; b=Tz5LGzK5/motLXvjVucBZ50bftDY/idAhu+PPjJDrax4SwixBCasE/I6MiZLM/UBG7IkJZ q+Lbnir04CW21sLnbOeXND4MtSpB7txbeZOU3v+w+XD62nkkbfehPE4aJ/4C4xzDIeLW3z K8lD0ABkidLZZ257O6O+cmkXR50DcN0GMtoqJDCOSX+GKKTDzGAg9D7g3AbteTKY20SlGw h5lsCWUmbFN6VyyZZo+wqFjifuRxUoA99gTIIzaRJJr5VH2pG1KzqnFWtqxvRDw3jm0Sth mVZ7e8wb08bTtJ8mgFpmmDLUY/gFi/Y13tFQPIlyUPZxWPHSAxfQuqGBndZP6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736796211; a=rsa-sha256; cv=none; b=wXARqf/S6/rpucTtydEx1hODxJOQtYdkfOJf/KAk1FRRdiVPu8U9vulKwbVhiXPfESrRj+ 2pXlrQ87GSmGRwzq2IlHEVpZtA/kInhPNbwXLTE5PGaQ2rGqDYGe3g1XQUax0HamLtwgud lBIAzj+sEBGthpGonUW56mOoShGNPnrt10/nPB8X/C9YL4JZvaPG2OEGerqJB+RQJvt3JI jlfzsJVugO2mlKXDNlulVENVLNlUsvF4hM7mUlJS/CRXVAldipV6yRkWhWrnh3GG97Z8gx hTM1W+RL9wDuHbi9fv6StSv1P2weOwvx4bjpKXTe93bW40dE9XGh2RFfv7HeDQ== 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 4YX2H70gLSzkJX; Mon, 13 Jan 2025 19:23:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50DJNVHo039279; Mon, 13 Jan 2025 19:23:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DJNVnc039276; Mon, 13 Jan 2025 19:23:31 GMT (envelope-from git) Date: Mon, 13 Jan 2025 19:23:31 GMT Message-Id: <202501131923.50DJNVnc039276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: dc37121d3210 - main - ffs_reallocblks(): ensure that pref cg is valid List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc37121d3210d08c96a883ebfed780660e7e2b39 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dc37121d3210d08c96a883ebfed780660e7e2b39 commit dc37121d3210d08c96a883ebfed780660e7e2b39 Author: Konstantin Belousov AuthorDate: 2025-01-05 22:51:23 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-13 19:22:54 +0000 ffs_reallocblks(): ensure that pref cg is valid ffs_blkpref_ufsX() must return in-range pref frag number, otherwise calculated cg index is out of range for fs, causing out of range accesses to the structures sized by the number of cg, e.g. the fs_maxcluster[] array in ffs_clusteralloc(). The easiest way to trigger it is to overflow the volume. In collaboration with: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC afer: 1 week Differential revision: https://reviews.freebsd.org/D48378 --- sys/ufs/ffs/ffs_alloc.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 01bfdb85c2e6..265daef14812 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -681,6 +681,7 @@ ffs_reallocblks_ufs1( * groups that we will search. */ cg = dtog(fs, pref); + MPASS(cg < fs->fs_ncg); for (i = min(maxclustersearch, fs->fs_ncg); i > 0; i--) { if ((newblk = ffs_clusteralloc(ip, cg, pref, len)) != 0) break; @@ -947,6 +948,7 @@ ffs_reallocblks_ufs2( * groups that we will search. */ cg = dtog(fs, pref); + MPASS(cg < fs->fs_ncg); for (i = min(maxclustersearch, fs->fs_ncg); i > 0; i--) { if ((newblk = ffs_clusteralloc(ip, cg, pref, len)) != 0) break; @@ -1438,8 +1440,11 @@ ffs_blkpref_ufs1(struct inode *ip, * place it immediately following the last direct block. */ if (indx == -1 && lbn < UFS_NDADDR + NINDIR(fs) && - ip->i_din1->di_db[UFS_NDADDR - 1] != 0) + ip->i_din1->di_db[UFS_NDADDR - 1] != 0) { pref = ip->i_din1->di_db[UFS_NDADDR - 1] + fs->fs_frag; + if (dtog(fs, pref) >= fs->fs_ncg) + pref = 0; + } return (pref); } /* @@ -1450,8 +1455,11 @@ ffs_blkpref_ufs1(struct inode *ip, if (lbn == UFS_NDADDR) { pref = ip->i_din1->di_ib[0]; if (pref != 0 && pref >= cgdata(fs, inocg) && - pref < cgbase(fs, inocg + 1)) + pref < cgbase(fs, inocg + 1)) { + if (dtog(fs, pref + fs->fs_frag) >= fs->fs_ncg) + return (0); return (pref + fs->fs_frag); + } } /* * If we are at the beginning of a file, or we have already allocated @@ -1506,6 +1514,8 @@ ffs_blkpref_ufs1(struct inode *ip, /* * Otherwise, we just always try to lay things out contiguously. */ + if (dtog(fs, prevbn + fs->fs_frag) >= fs->fs_ncg) + return (0); return (prevbn + fs->fs_frag); } @@ -1550,8 +1560,11 @@ ffs_blkpref_ufs2(struct inode *ip, * place it immediately following the last direct block. */ if (indx == -1 && lbn < UFS_NDADDR + NINDIR(fs) && - ip->i_din2->di_db[UFS_NDADDR - 1] != 0) + ip->i_din2->di_db[UFS_NDADDR - 1] != 0) { pref = ip->i_din2->di_db[UFS_NDADDR - 1] + fs->fs_frag; + if (dtog(fs, pref) >= fs->fs_ncg) + pref = 0; + } return (pref); } /* @@ -1562,8 +1575,11 @@ ffs_blkpref_ufs2(struct inode *ip, if (lbn == UFS_NDADDR) { pref = ip->i_din2->di_ib[0]; if (pref != 0 && pref >= cgdata(fs, inocg) && - pref < cgbase(fs, inocg + 1)) + pref < cgbase(fs, inocg + 1)) { + if (dtog(fs, pref + fs->fs_frag) >= fs->fs_ncg) + return (0); return (pref + fs->fs_frag); + } } /* * If we are at the beginning of a file, or we have already allocated @@ -1618,6 +1634,8 @@ ffs_blkpref_ufs2(struct inode *ip, /* * Otherwise, we just always try to lay things out contiguously. */ + if (dtog(fs, prevbn + fs->fs_frag) >= fs->fs_ncg) + return (0); return (prevbn + fs->fs_frag); } @@ -1968,6 +1986,7 @@ ffs_clusteralloc(struct inode *ip, ump = ITOUMP(ip); fs = ump->um_fs; + MPASS(cg < fs->fs_ncg); if (fs->fs_maxcluster[cg] < len) return (0); UFS_UNLOCK(ump); From nobody Mon Jan 13 19:30:11 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX2Qq6w2fz5kjdL; Mon, 13 Jan 2025 19:30:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX2Qq66gMz3WTk; Mon, 13 Jan 2025 19:30:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yOUwBGEByw9UOevQfAqbChtTUhqZoDsR0mL+h381kAM=; b=h3wXWHarL6JVB48Ebc80s67Pk3UeChmapYpDmFZJP8FLdnI+Z6bJ+KrOyIcfqF4UGVXzJf oIb2Lt5oqy9Lhn28WK4c8F/Lw5/suZ0GqghsqcWpS8u8pyH94F+XBOEYSynN64f2F841pb nNcgpLNf3qabIyhnbXHwwvvY7hAWUQtKyrPbaZntj9S+h7GV1Lw8U9KcZhu9gmGwxDLnyg SvhCce96TdAfqgnNKyqFnxO5H2lYQIS1+qPkgYCEe97I3mFpjsJNKAw3jqjCl0X7pDAV5x RpfknJMQaI83RDMIvE4oOpjgBdlzKsG000Jyj5pmOE5qd6HLDNrfTgqfQIUiWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yOUwBGEByw9UOevQfAqbChtTUhqZoDsR0mL+h381kAM=; b=HHWkKEg453Gz6gZ0V8Wkm3awE8aYTPtewAgk3MpPIQzmfbUSI6RlmfrP8Mw1cX0GNJZTZ/ 20v1VNn4OWU7vkpDqrHKo9Jmg9avphqwoB9UxFuOO9BU0B05em6WeTZnmJw8ILW002pWfa FlguqQF2+jrnmKFKsr9jlp+hi70rj6RF3gM0GaYmhkSwn1CrgOWE/p21bsnEBYtJkrjoDs D5OF5ju72MOMWLCMqRdDGy6LNAZtoh5r5mdHck8F/sDtSz6pJ4XazHFNehZdxPRgnZ0QQ1 SYswY45qtilECt/JON6HeNcdCAT3ubz+6nAg8yawMCyvllT1lxBlRC3IJPRBiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736796611; a=rsa-sha256; cv=none; b=MVZ+KYpDBYuAUcxSZJ2xcDoKqIGMrx/gZgOhxoupRnHVrxoUHRz/KpkgX+IO8th+tUitvK N9E/MwAio72KkSsEhTJkeeWDO8tLLaO0baP+3rhZGeHcxzSQh4plHARGwNsmIR43Dpr4if h9jYgkM/uDxDANI4ppnuYrw59t+wfoN5wY5Vm4PjPf1qsXsMdfcP2elUgU3EJk6b2DuPd0 4uDvFrJp2jGkJYM/CgT4kJvZ4M4TcQjUAqUAQLIb1TRIq9Qi8Qarc5/YMuotSPdjy8OcoV FV5CgMayhrbzdygSbzTbnn4VtKBBl15p7fBBqMSgqRgUsHjmN9IT5YnmwqPCOw== 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 4YX2Qq5Kypzklc; Mon, 13 Jan 2025 19:30: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 50DJUBni046445; Mon, 13 Jan 2025 19:30:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DJUBQX046437; Mon, 13 Jan 2025 19:30:11 GMT (envelope-from git) Date: Mon, 13 Jan 2025 19:30:11 GMT Message-Id: <202501131930.50DJUBQX046437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: cf322978d73a - main - mb_unmapped_to_ext(): return error code on error List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf322978d73a3ed4958cb64cc4f1b47ceb53a03e Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cf322978d73a3ed4958cb64cc4f1b47ceb53a03e commit cf322978d73a3ed4958cb64cc4f1b47ceb53a03e Author: Konstantin Belousov AuthorDate: 2024-12-28 08:30:01 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-13 19:29:31 +0000 mb_unmapped_to_ext(): return error code on error to allow to distinguish the causes of failure. Reviewed by: markj Sponsored by: NVidia networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48265 --- sys/kern/kern_mbuf.c | 41 +++++++++++++++++++++++++++-------------- sys/sys/mbuf.h | 2 +- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 73c98209474a..26be33658ab9 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -936,8 +936,8 @@ mb_unmapped_free_mext(struct mbuf *m) mb_free_extpg(old_m); } -static struct mbuf * -_mb_unmapped_to_ext(struct mbuf *m) +static int +_mb_unmapped_to_ext(struct mbuf *m, struct mbuf **mres) { struct mbuf *m_new, *top, *prev, *mref; struct sf_buf *sf; @@ -947,9 +947,15 @@ _mb_unmapped_to_ext(struct mbuf *m) u_int ref_inc = 0; M_ASSERTEXTPG(m); + + if (m->m_epg_tls != NULL) { + /* can't convert TLS mbuf */ + m_freem(m); + *mres = NULL; + return (EINVAL); + } + len = m->m_len; - KASSERT(m->m_epg_tls == NULL, ("%s: can't convert TLS mbuf %p", - __func__, m)); /* See if this is the mbuf that holds the embedded refcount. */ if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) { @@ -1048,7 +1054,8 @@ _mb_unmapped_to_ext(struct mbuf *m) atomic_add_int(refcnt, ref_inc); } m_free(m); - return (top); + *mres = top; + return (0); fail: if (ref_inc != 0) { @@ -1065,13 +1072,15 @@ fail: } m_free(m); m_freem(top); - return (NULL); + *mres = NULL; + return (ENOMEM); } -struct mbuf * -mb_unmapped_to_ext(struct mbuf *top) +int +mb_unmapped_to_ext(struct mbuf *top, struct mbuf **mres) { - struct mbuf *m, *next, *prev = NULL; + struct mbuf *m, *m1, *next, *prev = NULL; + int error; prev = NULL; for (m = top; m != NULL; m = next) { @@ -1087,12 +1096,15 @@ mb_unmapped_to_ext(struct mbuf *top) */ prev->m_next = NULL; } - m = _mb_unmapped_to_ext(m); - if (m == NULL) { - m_freem(top); + error = _mb_unmapped_to_ext(m, &m1); + if (error != 0) { + if (top != m) + m_free(top); m_freem(next); - return (NULL); + *mres = NULL; + return (error); } + m = m1; if (prev == NULL) { top = m; } else { @@ -1111,7 +1123,8 @@ mb_unmapped_to_ext(struct mbuf *top) prev = m; } } - return (top); + *mres = top; + return (0); } /* diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 434f29feddcf..9373a3c3d656 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -813,7 +813,7 @@ struct mbuf *mb_alloc_ext_plus_pages(int, int); struct mbuf *mb_mapped_to_unmapped(struct mbuf *, int, int, int, struct mbuf **); int mb_unmapped_compress(struct mbuf *m); -struct mbuf *mb_unmapped_to_ext(struct mbuf *m); +int mb_unmapped_to_ext(struct mbuf *m, struct mbuf **mres); void mb_free_notready(struct mbuf *m, int count); void m_adj(struct mbuf *, int); void m_adj_decap(struct mbuf *, int); From nobody Mon Jan 13 19:30:12 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX2Qs1F18z5kjb5; Mon, 13 Jan 2025 19:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX2Qr6LRnz3WhM; Mon, 13 Jan 2025 19:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eGyCLOysHMihXzEHe3JjqyfONPhJGsL5tCmo0ow1QHo=; b=UXdVnTx1GPdufcdV+5Smoz9D414BrTjiVn72FMEeIplkMyItLYgJGUjoiVGjqJhAQxPlVs RF2LRMUxrpo4MUVp9ShZ4B6kATekdesuRu/CUx0V9We/SJ/pXdmR8fcjITAJivN6iGd3Oo lKpOYvA2DEmSNlWFP9Ak02/QyTR0+STA7HfA01aWcUA2gyH1WFb42U2aOZyytip3Hrn+sL 6nXaiDuwEqWDnQ/m7xLBSr/jHTy2d+7DEmewAKZ9tc8XKU4D5CZP1sQ43IpW4M80BrccCu Jc+Y5lvM3IYRf8hW+lFWRLQUP6bDH/O7IekIFAKBip9q2MmwkcJCeiM2gE56Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eGyCLOysHMihXzEHe3JjqyfONPhJGsL5tCmo0ow1QHo=; b=OEKb7/W+JVG9n6XFW4oGRxeUoqiy7RBfI20GFt5W7Vm6HTUnEDK5GjZtZNUgpuNI+nfY6Y thnZip4blhFjutiwNz60mPUwidJE9yYkUpVhZQs7UAbaq2DrPjzI+kWUhjeu4DDcoYXM35 8XNck2q0mvOt0S0r4mkJlpq71b6FpHydfEEurtimeWpmH6IKuJ0nnp1HoCUNxklwm7xZDa GDshaoL8sktA8rHi76KRRmfupZANvO5reouPbknPNfR5moi7ULUqHshRFmHrFVqz6RIlxl rk+BaGDUislJRRP0pS757xNPautQpli4wuchqu0PWpTDufG12V1KH4kTUyKnag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736796612; a=rsa-sha256; cv=none; b=usIgSsjJpJ/8j2zS4szAR/r+c3ei9jIT06NK3InlxyLIdvJzZB9NNAcAC6Y2uVRjxHl28R aQWe1cK3J2J2lAeZyjsqc1MX5FKYf+prWAJrob6uK6L+RU3XwG479jLkVkZkNORAyN5EnC MgXYnPd9aWUMeo5Fo2QGvQyq3VYt6HAZlfP1GPlUGGR/D9KXJEKOKxZhPNaat5+udC2Ghm YNyz6wV7q6RrDqCxrussPcAU+bGTrxm23EEsuoEM2OGU8o+AyNdtfsltN4eSLQGmwbjbaa Ibz9SiYlWEC72kElsC1AcJp4X8/TrJU3kwzhLoH99eLXhzGM0J+PTcS0SzcLPA== 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 4YX2Qr5gCzzkJY; Mon, 13 Jan 2025 19:30: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 50DJUCUY047122; Mon, 13 Jan 2025 19:30:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DJUCFg047113; Mon, 13 Jan 2025 19:30:12 GMT (envelope-from git) Date: Mon, 13 Jan 2025 19:30:12 GMT Message-Id: <202501131930.50DJUCFg047113@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b0e020764aae - main - ipsec + ktls: cannot coexists List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0e020764aae970545357b0f146dcba7b4b55864 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b0e020764aae970545357b0f146dcba7b4b55864 commit b0e020764aae970545357b0f146dcba7b4b55864 Author: Konstantin Belousov AuthorDate: 2024-12-28 08:30:49 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-13 19:29:31 +0000 ipsec + ktls: cannot coexists but instead of tripping the assert in debug kernel, and silently falling into UB for prod, skip IPSEC processing for KTLS framed packets when mb_unmapped_to_ext() failed. Reviewed by: markj Sponsored by: NVidia networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48265 --- sys/netinet/ip_output.c | 33 +++++++++++++++++++++++++-------- sys/netinet6/ip6_output.c | 34 ++++++++++++++++++++++++++-------- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 770a95dae659..4f5d8b7279ba 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -667,17 +667,25 @@ again: sendit: #if defined(IPSEC) || defined(IPSEC_SUPPORT) if (IPSEC_ENABLED(ipv4)) { - m = mb_unmapped_to_ext(m); - if (m == NULL) { - IPSTAT_INC(ips_odropped); - error = ENOBUFS; - goto bad; + struct mbuf *m1; + + error = mb_unmapped_to_ext(m, &m1); + if (error != 0) { + if (error == ENOMEM) { + IPSTAT_INC(ips_odropped); + error = ENOBUFS; + goto bad; + } + /* XXXKIB */ + goto no_ipsec; } + m = m1; if ((error = IPSEC_OUTPUT(ipv4, ifp, m, inp, mtu)) != 0) { if (error == EINPROGRESS) error = 0; goto done; } +no_ipsec:; } /* * Check if there was a route for this packet; return error if not. @@ -731,11 +739,20 @@ sendit: /* Ensure the packet data is mapped if the interface requires it. */ if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) { - m = mb_unmapped_to_ext(m); - if (m == NULL) { + struct mbuf *m1; + + error = mb_unmapped_to_ext(m, &m1); + if (error != 0) { + if (error == EINVAL) { + if_printf(ifp, "TLS packet\n"); + /* XXXKIB */ + } else if (error == ENOMEM) { + error = ENOBUFS; + } IPSTAT_INC(ips_odropped); - error = ENOBUFS; goto bad; + } else { + m = m1; } } diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 9e4985cdc6cd..c6907835bc67 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -792,18 +792,26 @@ nonh6lookup: * XXX: need scope argument. */ if (IPSEC_ENABLED(ipv6)) { - m = mb_unmapped_to_ext(m); - if (m == NULL) { - IP6STAT_INC(ip6s_odropped); - error = ENOBUFS; - goto bad; + struct mbuf *m1; + + error = mb_unmapped_to_ext(m, &m1); + if (error != 0) { + if (error == ENOMEM) { + IP6STAT_INC(ip6s_odropped); + error = ENOBUFS; + goto bad; + } + /* XXXKIB */ + goto no_ipsec; } + m = m1; if ((error = IPSEC_OUTPUT(ipv6, ifp, m, inp, mtu == 0 ? ifp->if_mtu : mtu)) != 0) { if (error == EINPROGRESS) error = 0; goto done; } +no_ipsec:; } #endif /* IPSEC */ @@ -1106,10 +1114,20 @@ passout: /* Ensure the packet data is mapped if the interface requires it. */ if ((ifp->if_capenable & IFCAP_MEXTPG) == 0) { - m = mb_unmapped_to_ext(m); - if (m == NULL) { + struct mbuf *m1; + + error = mb_unmapped_to_ext(m, &m1); + if (error != 0) { + if (error == EINVAL) { + if_printf(ifp, "TLS packet\n"); + /* XXXKIB */ + } else if (error == ENOMEM) { + error = ENOBUFS; + } IP6STAT_INC(ip6s_odropped); - return (ENOBUFS); + return (error); + } else { + m = m1; } } From nobody Mon Jan 13 19:30:13 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX2Qt1f8yz5kjg9; Mon, 13 Jan 2025 19:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX2Qs6ggqz3WWl; Mon, 13 Jan 2025 19:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G9yOrajK+CsUPvYLRwtTDogIseexOk7dTkTDQWykEis=; b=dDxFFEgkISji1yCvqdnqagYWWTprBkKVCJj7TEqDdoNqgvNDfWo8CUFJI3OgOZQCQQNwgG AFBria9G45CrSpL6d6s+0B0XWB0pUj3AS+oOJIVFTIhTnI4tVIw03z6NhIFrhqive8DisE FHJhwZ1sATRbxaUFTPglp03KbDdzhnoA6WRz1PUKoqzyBgqEqcRvwaHEP5+OGbNqTz2nED 7yd6gcZNHXIlIniF3cDp7tmnPeV0lXX0PYxGcDO24d/q1kbWqJwYpMUC4hIgkWlUvhDjvt vPVrMrTp4a0wQDYuebfqQDHYgCJdwNHdN49XWRDxmg7xgHQr5FIkn3pW+vZqoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736796613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G9yOrajK+CsUPvYLRwtTDogIseexOk7dTkTDQWykEis=; b=RGHW98MRkdRYlG6Hx50whm6z6ck3oepxhW2FRgORlIFM2babix6TBmUiBgKDSQlmOot4MY YTyWslZtGd9hG99DvzURVlhNB/MJHPE87PCDXKwjdF/xUwgyAss47VIGki2OTn63an83ly 2+q25TM5k9l0BdNhl+7fZrKpVRk8OX+oLCfMxGBv/AVqMspXRx7UTsHj632HlreifocJyJ rhw+ZFHs3aA6kTiU5pEGuxByVrPpCuW9qTtDJq06Iuol6PmAmY0AQOzZxjnpD06ej4PrkR 2itmJ/vkAaBKuJKetJ31M2hPaF4+77+SmYBuyTl4M7ZeJTzLURRWQ9JJcPVLRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736796613; a=rsa-sha256; cv=none; b=WebluRphEleI4cxZnL7yCRe9miX/+soLv3uo+BWq2/JUKzQdVPbeUQ4VVTkACuRSnz6WQa CGvgjl7MF/ynDiURXlnTHguFV4Aui4PfZoQIlbOEEkZNjMMzGCu2zhjr+ClyvdxtCXIvPf pCevZ1eoZkRsPm/LOVMuCDiHnng5m0FXvQrNv6QM3NOQyzvZ5r1j5Jw4K84vhYQatnDf/s dUMJMWAfNVgB2nhnWudgDbSs7I6lCEF6SCDj6+HtM3nO2C2Q4ykbw2cwnv3F2umatWTSmQ XkwPW9PK+xbUZVCKZkowSUjBnBBKgkSpWoC888DTVVqk3KUSCTpy1WXljTHqcQ== 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 4YX2Qs67ghzkb8; Mon, 13 Jan 2025 19:30: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 50DJUDtv047827; Mon, 13 Jan 2025 19:30:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DJUDJv047814; Mon, 13 Jan 2025 19:30:13 GMT (envelope-from git) Date: Mon, 13 Jan 2025 19:30:13 GMT Message-Id: <202501131930.50DJUDJv047814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0ff2d00d2aa3 - main - ipsec: allow it to work with unmapped mbufs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0ff2d00d2aa37cd883ffd8c7363dddef9cba267e Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0ff2d00d2aa37cd883ffd8c7363dddef9cba267e commit 0ff2d00d2aa37cd883ffd8c7363dddef9cba267e Author: Konstantin Belousov AuthorDate: 2024-12-29 07:12:26 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-13 19:29:32 +0000 ipsec: allow it to work with unmapped mbufs Only map mbuf when a policy is looked up and indicates that IPSEC needs to transform the packet. If IPSEC is inline offloaded, it is up to the interface driver to request remap if needed. Fetch the IP header using m_copydata() instead of using mtod() to select policy/SA. Reviewed by: markj Sponsored by: NVidia networking Differential revision: https://reviews.freebsd.org/D48265 --- sys/net/if_ipsec.c | 8 ++-- sys/netinet/ip_output.c | 22 +++------- sys/netinet6/ip6_output.c | 14 ------- sys/netipsec/ipsec.c | 64 +++++++++++++++-------------- sys/netipsec/ipsec.h | 14 ++++--- sys/netipsec/ipsec_output.c | 96 ++++++++++++++++++++++++++++++-------------- sys/netipsec/ipsec_support.h | 2 + sys/netipsec/subr_ipsec.c | 18 ++------- sys/netipsec/xform_tcp.c | 2 +- 9 files changed, 126 insertions(+), 114 deletions(-) diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index 849127f75de6..df10af66471c 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -353,7 +353,7 @@ ipsec_transmit(struct ifnet *ifp, struct mbuf *m) IPSEC_RLOCK_TRACKER; struct ipsec_softc *sc; struct secpolicy *sp; - struct ip *ip; + struct ip *ip, iph; uint32_t af; int error; @@ -375,7 +375,8 @@ ipsec_transmit(struct ifnet *ifp, struct mbuf *m) } /* Determine address family to correctly handle packet in BPF */ - ip = mtod(m, struct ip *); + ip = &iph; + m_copydata(m, 0, sizeof(*ip), (char *)ip); switch (ip->ip_v) { #ifdef INET case IPVERSION: @@ -415,7 +416,8 @@ ipsec_transmit(struct ifnet *ifp, struct mbuf *m) switch (af) { #ifdef INET case AF_INET: - error = ipsec4_process_packet(ifp, m, sp, NULL, ifp->if_mtu); + error = ipsec4_process_packet(ifp, m, ip, sp, NULL, + ifp->if_mtu); break; #endif #ifdef INET6 diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 4f5d8b7279ba..9317d5d57e1d 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -667,26 +667,19 @@ again: sendit: #if defined(IPSEC) || defined(IPSEC_SUPPORT) if (IPSEC_ENABLED(ipv4)) { - struct mbuf *m1; + struct ip ip_hdr; - error = mb_unmapped_to_ext(m, &m1); - if (error != 0) { - if (error == ENOMEM) { - IPSTAT_INC(ips_odropped); - error = ENOBUFS; - goto bad; - } - /* XXXKIB */ - goto no_ipsec; - } - m = m1; if ((error = IPSEC_OUTPUT(ipv4, ifp, m, inp, mtu)) != 0) { if (error == EINPROGRESS) error = 0; goto done; } -no_ipsec:; + + /* Update variables that are affected by ipsec4_output(). */ + m_copydata(m, 0, sizeof(ip_hdr), (char *)&ip_hdr); + hlen = ip_hdr.ip_hl << 2; } + /* * Check if there was a route for this packet; return error if not. */ @@ -695,9 +688,6 @@ no_ipsec:; error = EHOSTUNREACH; goto bad; } - /* Update variables that are affected by ipsec4_output(). */ - ip = mtod(m, struct ip *); - hlen = ip->ip_hl << 2; #endif /* IPSEC */ /* Jump over all PFIL processing if hooks are not active. */ diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index c6907835bc67..c48101aa2990 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -792,26 +792,12 @@ nonh6lookup: * XXX: need scope argument. */ if (IPSEC_ENABLED(ipv6)) { - struct mbuf *m1; - - error = mb_unmapped_to_ext(m, &m1); - if (error != 0) { - if (error == ENOMEM) { - IP6STAT_INC(ip6s_odropped); - error = ENOBUFS; - goto bad; - } - /* XXXKIB */ - goto no_ipsec; - } - m = m1; if ((error = IPSEC_OUTPUT(ipv6, ifp, m, inp, mtu == 0 ? ifp->if_mtu : mtu)) != 0) { if (error == EINPROGRESS) error = 0; goto done; } -no_ipsec:; } #endif /* IPSEC */ diff --git a/sys/netipsec/ipsec.c b/sys/netipsec/ipsec.c index 9b18cedc7a80..8d604a24eeea 100644 --- a/sys/netipsec/ipsec.c +++ b/sys/netipsec/ipsec.c @@ -286,8 +286,9 @@ static int ipsec_in_reject(struct secpolicy *, struct inpcb *, const struct mbuf *); #ifdef INET -static void ipsec4_get_ulp(const struct mbuf *, struct secpolicyindex *, int); -static void ipsec4_setspidx_ipaddr(const struct mbuf *, +static void ipsec4_get_ulp(const struct mbuf *, const struct ip *, + struct secpolicyindex *, int); +static void ipsec4_setspidx_ipaddr(const struct mbuf *, struct ip *, struct secpolicyindex *); #endif #ifdef INET6 @@ -488,8 +489,8 @@ ipsec_getpcbpolicy(struct inpcb *inp, u_int dir) #ifdef INET static void -ipsec4_get_ulp(const struct mbuf *m, struct secpolicyindex *spidx, - int needport) +ipsec4_get_ulp(const struct mbuf *m, const struct ip *ip1, + struct secpolicyindex *spidx, int needport) { uint8_t nxt; int off; @@ -498,21 +499,10 @@ ipsec4_get_ulp(const struct mbuf *m, struct secpolicyindex *spidx, IPSEC_ASSERT(m->m_pkthdr.len >= sizeof(struct ip), ("packet too short")); - if (m->m_len >= sizeof (struct ip)) { - const struct ip *ip = mtod(m, const struct ip *); - if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) - goto done; - off = ip->ip_hl << 2; - nxt = ip->ip_p; - } else { - struct ip ih; - - m_copydata(m, 0, sizeof (struct ip), (caddr_t) &ih); - if (ih.ip_off & htons(IP_MF | IP_OFFMASK)) - goto done; - off = ih.ip_hl << 2; - nxt = ih.ip_p; - } + if (ip1->ip_off & htons(IP_MF | IP_OFFMASK)) + goto done; + off = ip1->ip_hl << 2; + nxt = ip1->ip_p; while (off < m->m_pkthdr.len) { struct ip6_ext ip6e; @@ -565,17 +555,18 @@ done_proto: } static void -ipsec4_setspidx_ipaddr(const struct mbuf *m, struct secpolicyindex *spidx) +ipsec4_setspidx_ipaddr(const struct mbuf *m, struct ip *ip1, + struct secpolicyindex *spidx) { - ipsec4_setsockaddrs(m, &spidx->src, &spidx->dst); + ipsec4_setsockaddrs(m, ip1, &spidx->src, &spidx->dst); spidx->prefs = sizeof(struct in_addr) << 3; spidx->prefd = sizeof(struct in_addr) << 3; } static struct secpolicy * -ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir, - int needport) +ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, struct ip *ip1, + u_int dir, int needport) { struct secpolicyindex spidx; struct secpolicy *sp; @@ -583,8 +574,8 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir, sp = ipsec_getpcbpolicy(inp, dir); if (sp == NULL && key_havesp(dir)) { /* Make an index to look for a policy. */ - ipsec4_setspidx_ipaddr(m, &spidx); - ipsec4_get_ulp(m, &spidx, needport); + ipsec4_setspidx_ipaddr(m, ip1, &spidx); + ipsec4_get_ulp(m, ip1, &spidx, needport); spidx.dir = dir; sp = key_allocsp(&spidx, dir); } @@ -597,13 +588,13 @@ ipsec4_getpolicy(const struct mbuf *m, struct inpcb *inp, u_int dir, * Check security policy for *OUTBOUND* IPv4 packet. */ struct secpolicy * -ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error, - int needport) +ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, struct ip *ip1, + int *error, int needport) { struct secpolicy *sp; *error = 0; - sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_OUTBOUND, needport); + sp = ipsec4_getpolicy(m, inp, ip1, IPSEC_DIR_OUTBOUND, needport); if (sp != NULL) sp = ipsec_checkpolicy(sp, inp, error); if (sp == NULL) { @@ -630,12 +621,13 @@ ipsec4_checkpolicy(const struct mbuf *m, struct inpcb *inp, int *error, * rip_input() and sctp_input(). */ int -ipsec4_in_reject(const struct mbuf *m, struct inpcb *inp) +ipsec4_in_reject1(const struct mbuf *m, struct ip *ip1, struct inpcb *inp) { struct secpolicy *sp; #ifdef IPSEC_OFFLOAD struct ipsec_accel_in_tag *tag; #endif + struct ip ip_hdr; int result; #ifdef IPSEC_OFFLOAD @@ -643,7 +635,13 @@ ipsec4_in_reject(const struct mbuf *m, struct inpcb *inp) if (tag != NULL) return (0); #endif - sp = ipsec4_getpolicy(m, inp, IPSEC_DIR_INBOUND, 0); + + if (ip1 == NULL) { + ip1 = &ip_hdr; + m_copydata(m, 0, sizeof(*ip1), (char *)ip1); + } + + sp = ipsec4_getpolicy(m, inp, ip1, IPSEC_DIR_INBOUND, 0); result = ipsec_in_reject(sp, inp, m); key_freesp(&sp); if (result != 0) @@ -651,6 +649,12 @@ ipsec4_in_reject(const struct mbuf *m, struct inpcb *inp) return (result); } +int +ipsec4_in_reject(const struct mbuf *m, struct inpcb *inp) +{ + return (ipsec4_in_reject1(m, NULL, inp)); +} + /* * IPSEC_CAP() method implementation for IPv4. */ diff --git a/sys/netipsec/ipsec.h b/sys/netipsec/ipsec.h index 8f3e8f02d88b..f8c5b10e7bd6 100644 --- a/sys/netipsec/ipsec.h +++ b/sys/netipsec/ipsec.h @@ -325,6 +325,7 @@ VNET_DECLARE(int, natt_cksum_policy); #endif struct inpcb; +struct ip; struct m_tag; struct secasvar; struct sockopt; @@ -336,7 +337,7 @@ int ipsec_if_input(struct mbuf *, struct secasvar *, uint32_t); struct ipsecrequest *ipsec_newisr(void); void ipsec_delisr(struct ipsecrequest *); struct secpolicy *ipsec4_checkpolicy(const struct mbuf *, struct inpcb *, - int *, int); + struct ip *, int *, int); u_int ipsec_get_reqlevel(struct secpolicy *, u_int); @@ -351,12 +352,13 @@ size_t ipsec_hdrsiz_internal(struct secpolicy *); void ipsec_setspidx_inpcb(struct inpcb *, struct secpolicyindex *, u_int); -void ipsec4_setsockaddrs(const struct mbuf *, union sockaddr_union *, - union sockaddr_union *); +void ipsec4_setsockaddrs(const struct mbuf *, const struct ip *, + union sockaddr_union *, union sockaddr_union *); int ipsec4_common_input_cb(struct mbuf *, struct secasvar *, int, int); -int ipsec4_check_pmtu(struct ifnet *, struct mbuf *, struct secpolicy *, int); -int ipsec4_process_packet(struct ifnet *, struct mbuf *, struct secpolicy *, - struct inpcb *, u_long); +int ipsec4_check_pmtu(struct ifnet *, struct mbuf *, struct ip *ip1, + struct secpolicy *, int); +int ipsec4_process_packet(struct ifnet *, struct mbuf *, struct ip *ip1, + struct secpolicy *, struct inpcb *, u_long); int ipsec_process_done(struct mbuf *, struct secpolicy *, struct secasvar *, u_int); diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index 73a32c71fffc..8d8a304e7af4 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -111,14 +111,13 @@ static size_t ipsec_get_pmtu(struct secasvar *sav); #ifdef INET static struct secasvar * -ipsec4_allocsa(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, - u_int *pidx, int *error) +ipsec4_allocsa(struct ifnet *ifp, struct mbuf *m, const struct ip *ip, + struct secpolicy *sp, u_int *pidx, int *error) { struct secasindex *saidx, tmpsaidx; struct ipsecrequest *isr; struct sockaddr_in *sin; struct secasvar *sav; - struct ip *ip; /* * Check system global policy controls. @@ -142,7 +141,6 @@ next: if (isr->saidx.mode == IPSEC_MODE_TRANSPORT) { saidx = &tmpsaidx; *saidx = isr->saidx; - ip = mtod(m, struct ip *); if (saidx->src.sa.sa_len == 0) { sin = &saidx->src.sin; sin->sin_len = sizeof(*sin); @@ -188,13 +186,14 @@ next: * IPsec output logic for IPv4. */ static int -ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, - struct inpcb *inp, u_int idx, u_long mtu) +ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct ip *ip1, + struct secpolicy *sp, struct inpcb *inp, u_int idx, u_long mtu) { struct ipsec_ctx_data ctx; union sockaddr_union *dst; struct secasvar *sav; struct ip *ip; + struct mbuf *m1; int error, hwassist, i, off; bool accel; @@ -209,7 +208,7 @@ ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, * determine next transform. At the end of transform we can * release reference to SP. */ - sav = ipsec4_allocsa(ifp, m, sp, &idx, &error); + sav = ipsec4_allocsa(ifp, m, ip1, sp, &idx, &error); if (sav == NULL) { if (error == EJUSTRETURN) { /* No IPsec required */ (void)ipsec_accel_output(ifp, m, inp, sp, NULL, @@ -225,6 +224,8 @@ ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, IPSEC_INIT_CTX(&ctx, &m, inp, sav, AF_INET, IPSEC_ENC_BEFORE); if ((error = ipsec_run_hhooks(&ctx, HHOOK_TYPE_IPSEC_OUT)) != 0) goto bad; + /* Re-calculate *ip1 after potential change of m in the hook. */ + m_copydata(m, 0, sizeof(*ip1), (char *)ip1); hwassist = 0; accel = ipsec_accel_output(ifp, m, inp, sp, sav, AF_INET, mtu, @@ -240,16 +241,23 @@ ipsec4_perform_request(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, } #if defined(SCTP) || defined(SCTP_SUPPORT) if ((m->m_pkthdr.csum_flags & CSUM_SCTP & ~hwassist) != 0) { - struct ip *ip; - - ip = mtod(m, struct ip *); - sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); + sctp_delayed_cksum(m, (uint32_t)(ip1->ip_hl << 2)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP; } #endif if (accel) return (EJUSTRETURN); + error = mb_unmapped_to_ext(m, &m1); + if (error != 0) { + if (error == EINVAL) { + if (bootverbose) + if_printf(ifp, "Tx TLS+IPSEC packet\n"); + } + return (error); + } + m = m1; + ip = mtod(m, struct ip *); dst = &sav->sah->saidx.dst; /* Do the appropriate encapsulation, if necessary */ @@ -317,19 +325,18 @@ bad: } int -ipsec4_process_packet(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, - struct inpcb *inp, u_long mtu) +ipsec4_process_packet(struct ifnet *ifp, struct mbuf *m, struct ip *ip1, + struct secpolicy *sp, struct inpcb *inp, u_long mtu) { - return (ipsec4_perform_request(ifp, m, sp, inp, 0, mtu)); + return (ipsec4_perform_request(ifp, m, ip1, sp, inp, 0, mtu)); } int -ipsec4_check_pmtu(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, - int forwarding) +ipsec4_check_pmtu(struct ifnet *ifp, struct mbuf *m, struct ip *ip1, + struct secpolicy *sp, int forwarding) { struct secasvar *sav; - struct ip *ip; size_t hlen, pmtu; uint32_t idx; int error; @@ -341,13 +348,12 @@ ipsec4_check_pmtu(struct ifnet *ifp, struct mbuf *m, struct secpolicy *sp, goto setdf; /* V_ip4_ipsec_dfbit > 1 - we will copy it from inner header. */ - ip = mtod(m, struct ip *); - if (!(ip->ip_off & htons(IP_DF))) + if ((ip1->ip_off & htons(IP_DF)) == 0) return (0); setdf: idx = sp->tcount - 1; - sav = ipsec4_allocsa(ifp, m, sp, &idx, &error); + sav = ipsec4_allocsa(ifp, m, ip1, sp, &idx, &error); if (sav == NULL) { key_freesp(&sp); /* @@ -398,14 +404,14 @@ setdf: } static int -ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, - int forwarding, u_long mtu) +ipsec4_common_output1(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, + struct ip *ip1, int forwarding, u_long mtu) { struct secpolicy *sp; int error; /* Lookup for the corresponding outbound security policy */ - sp = ipsec4_checkpolicy(m, inp, &error, !forwarding); + sp = ipsec4_checkpolicy(m, inp, ip1, &error, !forwarding); if (sp == NULL) { if (error == -EINVAL) { /* Discarded by policy. */ @@ -425,7 +431,7 @@ ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, */ /* NB: callee frees mbuf and releases reference to SP */ - error = ipsec4_check_pmtu(ifp, m, sp, forwarding); + error = ipsec4_check_pmtu(ifp, m, ip1, sp, forwarding); if (error != 0) { if (error == EJUSTRETURN) return (0); @@ -433,7 +439,7 @@ ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, return (error); } - error = ipsec4_process_packet(ifp, m, sp, inp, mtu); + error = ipsec4_process_packet(ifp, m, ip1, sp, inp, mtu); if (error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We @@ -447,6 +453,28 @@ ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, return (error); } +static int +ipsec4_common_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, + struct ip *ip1, int forwarding, u_long mtu) +{ + struct ip ip_hdr; + struct ip *ip; + + if (((m->m_flags & M_PKTHDR) != 0 && m->m_pkthdr.len < sizeof(*ip)) || + ((m->m_flags & M_PKTHDR) == 0 && m->m_len < sizeof(*ip))) { + m_free(m); + return (EACCES); + } + if (ip1 != NULL) { + ip = ip1; + } else { + ip = &ip_hdr; + m_copydata(m, 0, sizeof(*ip), (char *)ip); + } + + return (ipsec4_common_output1(ifp, m, inp, ip, forwarding, mtu)); +} + /* * IPSEC_OUTPUT() method implementation for IPv4. * 0 - no IPsec handling needed @@ -464,7 +492,7 @@ ipsec4_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, u_long mtu) if (m_tag_find(m, PACKET_TAG_IPSEC_OUT_DONE, NULL) != NULL) return (0); - return (ipsec4_common_output(ifp, m, inp, 0, mtu)); + return (ipsec4_common_output(ifp, m, inp, NULL, 0, mtu)); } /* @@ -475,16 +503,20 @@ ipsec4_output(struct ifnet *ifp, struct mbuf *m, struct inpcb *inp, u_long mtu) int ipsec4_forward(struct mbuf *m) { + struct ip ip_hdr; + + m_copydata(m, 0, sizeof(ip_hdr), (char *)&ip_hdr); /* * Check if this packet has an active inbound SP and needs to be * dropped instead of forwarded. */ - if (ipsec4_in_reject(m, NULL) != 0) { + if (ipsec4_in_reject1(m, &ip_hdr, NULL) != 0) { m_freem(m); return (EACCES); } - return (ipsec4_common_output(NULL /* XXXKIB */, m, NULL, 1, 0)); + return (ipsec4_common_output(NULL /* XXXKIB */, m, NULL, &ip_hdr, + 1, 0)); } #endif @@ -874,6 +906,9 @@ ipsec_process_done(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, struct xform_history *xh; struct secasindex *saidx; struct m_tag *mtag; +#ifdef INET + struct ip *ip; +#endif int error; if (sav->state >= SADB_SASTATE_DEAD) { @@ -884,8 +919,9 @@ ipsec_process_done(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, switch (saidx->dst.sa.sa_family) { #ifdef INET case AF_INET: + ip = mtod(m, struct ip *); /* Fix the header length, for AH processing. */ - mtod(m, struct ip *)->ip_len = htons(m->m_pkthdr.len); + ip->ip_len = htons(m->m_pkthdr.len); break; #endif /* INET */ #ifdef INET6 @@ -943,7 +979,7 @@ ipsec_process_done(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav, case AF_INET: key_freesav(&sav); IPSECSTAT_INC(ips_out_bundlesa); - return (ipsec4_perform_request(NULL, m, sp, NULL, + return (ipsec4_perform_request(NULL, m, ip, sp, NULL, idx, 0)); /* NOTREACHED */ #endif diff --git a/sys/netipsec/ipsec_support.h b/sys/netipsec/ipsec_support.h index 0cbfe6ddfee5..26f5e8a82d87 100644 --- a/sys/netipsec/ipsec_support.h +++ b/sys/netipsec/ipsec_support.h @@ -30,6 +30,7 @@ #ifdef _KERNEL #if defined(IPSEC) || defined(IPSEC_SUPPORT) struct ifnet; +struct ip; struct mbuf; struct inpcb; struct tcphdr; @@ -56,6 +57,7 @@ int udp_ipsec_pcbctl(struct inpcb *, struct sockopt *); #endif #ifdef INET int ipsec4_in_reject(const struct mbuf *, struct inpcb *); +int ipsec4_in_reject1(const struct mbuf *m, struct ip *ip1, struct inpcb *inp); int ipsec4_input(struct mbuf *, int, int); int ipsec4_forward(struct mbuf *); int ipsec4_pcbctl(struct inpcb *, struct sockopt *); diff --git a/sys/netipsec/subr_ipsec.c b/sys/netipsec/subr_ipsec.c index 2f7e0f09882e..bb8b62a841c6 100644 --- a/sys/netipsec/subr_ipsec.c +++ b/sys/netipsec/subr_ipsec.c @@ -61,8 +61,8 @@ #ifdef INET void -ipsec4_setsockaddrs(const struct mbuf *m, union sockaddr_union *src, - union sockaddr_union *dst) +ipsec4_setsockaddrs(const struct mbuf *m, const struct ip *ip1, + union sockaddr_union *src, union sockaddr_union *dst) { static const struct sockaddr_in template = { sizeof (struct sockaddr_in), @@ -73,18 +73,8 @@ ipsec4_setsockaddrs(const struct mbuf *m, union sockaddr_union *src, src->sin = template; dst->sin = template; - if (m->m_len < sizeof (struct ip)) { - m_copydata(m, offsetof(struct ip, ip_src), - sizeof (struct in_addr), - (caddr_t) &src->sin.sin_addr); - m_copydata(m, offsetof(struct ip, ip_dst), - sizeof (struct in_addr), - (caddr_t) &dst->sin.sin_addr); - } else { - const struct ip *ip = mtod(m, const struct ip *); - src->sin.sin_addr = ip->ip_src; - dst->sin.sin_addr = ip->ip_dst; - } + src->sin.sin_addr = ip1->ip_src; + dst->sin.sin_addr = ip1->ip_dst; } #endif #ifdef INET6 diff --git a/sys/netipsec/xform_tcp.c b/sys/netipsec/xform_tcp.c index d52051d415a8..d3d4d6c4d734 100644 --- a/sys/netipsec/xform_tcp.c +++ b/sys/netipsec/xform_tcp.c @@ -240,7 +240,7 @@ setsockaddrs(const struct mbuf *m, union sockaddr_union *src, switch (ip->ip_v) { #ifdef INET case IPVERSION: - ipsec4_setsockaddrs(m, src, dst); + ipsec4_setsockaddrs(m, ip, src, dst); break; #endif #ifdef INET6 From nobody Mon Jan 13 20:07:59 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX3GS1b68z5klkN; Mon, 13 Jan 2025 20:08:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX3GS0Vlfz3bLm; Mon, 13 Jan 2025 20:08:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736798880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ExZAnKtP+n+NfVb9/SxBvQtaOzMaOSSeJGWkR1OMFTM=; b=KfQotQ3qUfHxJVqIJhEOs/J2Y9T46WYjXyInMVhm+Pj7yfWTTXOUQcOoQPzpb3poLZm638 nyYb+l7hWPghYp0uzWwjoNJuY0NPyPBjeMKM9ZwX/wND13aMFggbgbMjRVvDqwCw5+7QR2 fXSwhoevQwOBhiD6HQyxqWLkkc+Lv3Lgt83GOBMeRZnD5iAO2XQAn08fWOgc8UTazWAYRo 8odAdvEL50LXy2nFj9einh1BXaXHqwrehkpzntssDEJ7j3qoUia6lb3/c8ozzxpy/MumbG BcIMxIJszS4cl4h0GvmV7uhRU7xaGvw9W9QWi9fNGdsPvC8MBDGXigl+mkekTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736798880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ExZAnKtP+n+NfVb9/SxBvQtaOzMaOSSeJGWkR1OMFTM=; b=kl7n5jf3mozR/y/YXPDO3pNBhVOrrvYpNMEiFRWtj0Fe35MT4K1hKmLcQPMs6Nya0MOhF4 MjudM/c2OyrbNfhvbdaG+KGoXa3HkAhgchkebNJq1GkaSC9smxzo0YnFDz04opUkC0vMrU biqxV3j3JSYo9zHJm9t8s3/4hgcoKs8DvSvhsf/365muYG6B+7mEqtFnrz6QlTsmlg6GjD ZzzhZfgDorAme0OBC2SKIEopFPx6Jb6L6kELY2kswG/85ZWHlYtGSE5GYr7W1xPYSnVRyX RELcv4u3GQoCMvIORKgPk/eLOQirEfu27w7TMrTzYtGrgoHQyLAObbSTa+jDRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736798880; a=rsa-sha256; cv=none; b=SCc73gK0DmqMBQDXgs/h6JXPa2ir/kPWvXNKU5kY+mrDPIeWmjV8qe7YrW3ZAHfXZIQcHh HPc0nhmX17PfovqdqChW4n9vrCcRGKWZm88u/Gg4JRy4nKtlli3U5IqMSpFWdumSfmJ9JN BFIYgIShAEEp3U1uu3NIlbT4pip9oy1i8pSZ2W+UmshLBE43Gx7jcwBQKbcaJtARARwBtz q8fjPH4l8+T0gx4g7a1I82ERDPeWIgy1rU6paB5InXOsZGHsJLOPonXpBQFFQMPvCJ1V1Q nm8dBTcixAIfCnURhl4fmcrjNNVdx6skISmJrEqM4PztqkhoQOuIMC6b8vv72w== 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 4YX3GR75dGzlnp; Mon, 13 Jan 2025 20:07: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 50DK7xCg016895; Mon, 13 Jan 2025 20:07:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DK7xim016892; Mon, 13 Jan 2025 20:07:59 GMT (envelope-from git) Date: Mon, 13 Jan 2025 20:07:59 GMT Message-Id: <202501132007.50DK7xim016892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 6751f65e6af1 - main - nvmf: Defer the post-sync shutdown handler to SHUTDOWN_PRI_LAST List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6751f65e6af15348abdc6106cf54c8335d45e49b Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6751f65e6af15348abdc6106cf54c8335d45e49b commit 6751f65e6af15348abdc6106cf54c8335d45e49b Author: John Baldwin AuthorDate: 2024-10-31 15:03:41 +0000 Commit: John Baldwin CommitDate: 2025-01-13 20:04:29 +0000 nvmf: Defer the post-sync shutdown handler to SHUTDOWN_PRI_LAST nda(4) has its own shutdown handler that runs at SHUTDOWN_PRI_DEFAULT that calls ndaflush() that could run after the nvmf handler. Instead, give a the flush a chance to run before the graceful shutdown of the controller. While here, be a bit more defensive in the post-sync case and shutdown the consumers (sim and /dev/nvmeXnY devices) before destroying the queue pairs so that if any requests are submitted after the post-sync handler they fail gracefully instead of trying to use a destroyed queue pair. Reported by: Sony Arpita Das Sponsored by: Chelsio Communications --- sys/dev/nvmf/host/nvmf.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c index 09d5cecdfad6..77d3081243f6 100644 --- a/sys/dev/nvmf/host/nvmf.c +++ b/sys/dev/nvmf/host/nvmf.c @@ -554,7 +554,7 @@ nvmf_attach(device_t dev) sc->shutdown_pre_sync_eh = EVENTHANDLER_REGISTER(shutdown_pre_sync, nvmf_shutdown_pre_sync, sc, SHUTDOWN_PRI_FIRST); sc->shutdown_post_sync_eh = EVENTHANDLER_REGISTER(shutdown_post_sync, - nvmf_shutdown_post_sync, sc, SHUTDOWN_PRI_FIRST); + nvmf_shutdown_post_sync, sc, SHUTDOWN_PRI_LAST); return (0); out: @@ -776,6 +776,18 @@ nvmf_shutdown_post_sync(void *arg, int howto) callout_drain(&sc->ka_rx_timer); nvmf_shutdown_controller(sc); + + /* + * Quiesce consumers so that any commands submitted after this + * fail with an error. Notably, nda(4) calls nda_flush() from + * a post_sync handler that might be ordered after this one. + */ + for (u_int i = 0; i < sc->cdata->nn; i++) { + if (sc->ns[i] != NULL) + nvmf_shutdown_ns(sc->ns[i]); + } + nvmf_shutdown_sim(sc); + for (u_int i = 0; i < sc->num_io_queues; i++) { nvmf_destroy_qp(sc->io[i]); } From nobody Mon Jan 13 21:28:56 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX53r2RmDz5kqsk; Mon, 13 Jan 2025 21:28:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX53r1dVqz3jyT; Mon, 13 Jan 2025 21:28:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736803736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YMZOF1B4o2Vnxf0ZYd25V66L2QlaFlHl6XqfGmXoKr0=; b=PlVS3vM0+C1tuggbwYybt6PIYy7GT883GU9ym2Y2n5OxCzoHYNRlVvJ0xCNYhYeCpD3bli LdDTC/qylcyyGVqXl+IFwBKCasN+suziefc3rJnbCTFdghtNdeNdY1Gm1RjUiuBk9UZATn g3FZ+nPdTUdRcyTbLk1ju0wy5Irl/7ncwMbazD9ozeCPAwgEL0RnadlBYldVetIJazl94J K5fURkHDsYbUt9+3dOFn9S9N+sOps8DnDiL+fvCbjZP34jAToak9a248S1PIuzU/KLcso+ MzDQctDeHrUwUJClM3yVrK536Fmz36dywezgYNIyK+NmXCcj9fvhwXOVl8QReQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736803736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YMZOF1B4o2Vnxf0ZYd25V66L2QlaFlHl6XqfGmXoKr0=; b=ieuGVuxXxxPI/koZKmxAyvbw7iFgDGtMBNxtnGSosgWfHpNERaDp06vd5FXEQl09W/OfiI I61XwA4ZWsGQ2sht8ispK7fVTIymzqQRMCBfJVz4PR2XnUS3g90i0/+FJ4F9zoWEptorPM 1FgUtpniq0W0eNcPV0OXa78D/f9yKtB4OCbrdWj9wG8HBXWWv63tZGLfshbLPt4xZbdmNH wSr0/zQntMcW/AWX+hCL/InGzfRxLDJROl7F9wI3NzHdIx2JEBwUs9/m7iIa4l+fKG4ulL Sie87MlLFgGxHdRkr213/P5bmONxQJLaJde8G/RNO8BIBXXxIDDZHs570g0Fsw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736803736; a=rsa-sha256; cv=none; b=Dms4f+Lo+y+joeEZR6VnPn3Pc44JXLJyCPt7AtJVsu0lvja08Qsz8J9x0SjzeuS0hpZqQF 030DFYyeftuIBRho3PDlyl3G9pdEIli1LUVkmm0FX/0Q9TY59gFjiWstc7Pt/8JXUyipPY r5eloMPYE7PHzHGwJ5hgi/+eyeQc6mfW0prl/Wws21Z26Tvs1k8IgkXTKKUDziM4frHwcA BcC8eFRDuSmvl7dG2xxBa/k+kpksPPH26FX8wiz39Lwr57XdVXuz2P4T6jLoCvVB4wCwz4 F9Y5MaBgByPMBWHeGzomWqN9e803UDeqS75NXdlP/4DTB/eK9ubN7gmHv7yMkA== 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 4YX53r17s0znn4; Mon, 13 Jan 2025 21:28:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50DLSuPj066564; Mon, 13 Jan 2025 21:28:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DLSuAQ066561; Mon, 13 Jan 2025 21:28:56 GMT (envelope-from git) Date: Mon, 13 Jan 2025 21:28:56 GMT Message-Id: <202501132128.50DLSuAQ066561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 63f28490237f - main - ng_ksocket: fix build without INET6 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63f28490237fd8a8646c897e93b82e1ee0962502 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=63f28490237fd8a8646c897e93b82e1ee0962502 commit 63f28490237fd8a8646c897e93b82e1ee0962502 Author: Gleb Smirnoff AuthorDate: 2025-01-13 21:27:32 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 21:27:32 +0000 ng_ksocket: fix build without INET6 Fixes: 9234a50752cd47887849d4665af0f9f4abdefb5d --- sys/netgraph/ng_ksocket.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c index 43a2747224f3..74b2e211c0ed 100644 --- a/sys/netgraph/ng_ksocket.c +++ b/sys/netgraph/ng_ksocket.c @@ -44,6 +44,8 @@ * version of a socket... kindof like the reverse of the socket node type. */ +#include "opt_inet6.h" + #include #include #include @@ -313,7 +315,7 @@ ng_ksocket_sockaddr_parse(const struct ng_parse_type *type, sin->sin_len = sizeof(*sin); break; } - +#ifdef INET6 case PF_INET6: { struct sockaddr_in6 *const sin6 = (struct sockaddr_in6 *)sa; @@ -366,7 +368,7 @@ ng_ksocket_sockaddr_parse(const struct ng_parse_type *type, sin6->sin6_len = sizeof(*sin6); break; } - +#endif /* INET6 */ default: return (EINVAL); } @@ -424,7 +426,7 @@ ng_ksocket_sockaddr_unparse(const struct ng_parse_type *type, *off += sizeof(*sin); return(0); } - +#ifdef INET6 case PF_INET6: { const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sa; @@ -443,7 +445,7 @@ ng_ksocket_sockaddr_unparse(const struct ng_parse_type *type, *off += sizeof(*sin6); return(0); } - +#endif /* INET6 */ default: return (*ng_ksocket_generic_sockaddr_type.supertype->unparse) (&ng_ksocket_generic_sockaddr_type, From nobody Mon Jan 13 21:28:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX53s4Psyz5kqwT; Mon, 13 Jan 2025 21:28:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX53s2WLlz3jpr; Mon, 13 Jan 2025 21:28:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736803737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bm8f++XJ3GCJMC+axkzuRyw8CG9fcIIBig4UjDSnti0=; b=QW05vmg1UIQIV2fn1CezJ4QRH4FB49fTTJbHzUAMFc6A/41O54L64j+H1esAyFt05sgc2d d7ZpYEXpPw6mFjXzcUu55Jvpp4Z2nCAIQyFcmHlvu0DfbYJVhkv7ZZzc8ixqzRWgInohGN DU4HYBtr2Lj1pWTmHQqZYIeh/USp5huJnwyup/onZxZzsgaCENs1Fhnk1DbHjPFBMS/TXV X0Gap22ZinIICTGa/7X3seLqv3zJcLsBIjs1eBcR7+XiQubqwsDPhHog1n9oQY9pVDod3U ycPYV7AQD6l5Vx6NAsTLPUWWlJQHPL/BpZh2zjHDNIYXj4a50mcBiL1q9CWQJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736803737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bm8f++XJ3GCJMC+axkzuRyw8CG9fcIIBig4UjDSnti0=; b=f9aNtXp4LmDe3ZZVQp3SYBTmArvlb/hIWmJj+mJ5yNuyWXJ0p+K2ETG5IY07kUa7QKUSZH C7V3ln3o7ss1Eh5awZya6UFPQGIwJPQG73730oNzAiJH0mA9XRuEzqZ2H6iZHMwMg++tmX jVbY6PFq6oG+d7zYNR9I4cf6X+toHrK55oFLb6t0CiL/wcf8L2lP30EFnHcdB8zbYJPpN7 nXJVho0/o3CIf/+FFEa3awCePT2y99hjKnSfvPxXrADcwEiGn1S33hi1MsIEJlC5PWzDDe R4Ca5YK3UhAltNX9cOS54tT0VkX3ra0lnOgL5hRF25V8MRn+C0cYwmBMSpBaAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736803737; a=rsa-sha256; cv=none; b=fJFQszY69r/5PdEoqTf345SazwLESds6eCkdqZrPADhYGumqrj9fh5NYOOB8NPBoCHORRj lRqBmRkCdK8aUORQUbYoQg9nhqlvRwfptJoaT5mjzBSi1GHZfET9U4B2Y7cmgMjdHl1Pqo hyElhg0tbWBtL94sQQIvstAcg23iHVLQm6ssSYPNVy+gpbIsT5/MGPSQKnu1VJ0jHVXlB8 XVECrSBwXLGRP+HCt+MBqUg3yzpSyOFdNYNzZKjkjDME/oRHlDZD0dUFsOtl8XsbKiZq9G WykiQEGQGZpuqOKih1mWyrV9Lchhc4V/phVeLmlLIsRQouQ43mhKJxpCST53NA== 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 4YX53s26fWzndt; Mon, 13 Jan 2025 21:28:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50DLSvMP066634; Mon, 13 Jan 2025 21:28:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DLSv5Z066631; Mon, 13 Jan 2025 21:28:57 GMT (envelope-from git) Date: Mon, 13 Jan 2025 21:28:57 GMT Message-Id: <202501132128.50DLSv5Z066631@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 6ed3486980c9 - main - netlink: avoid underflow of groups bitset index List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ed3486980c95bfa2cbc0b19739e93e8c0df9f67 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6ed3486980c95bfa2cbc0b19739e93e8c0df9f67 commit 6ed3486980c95bfa2cbc0b19739e93e8c0df9f67 Author: Gleb Smirnoff AuthorDate: 2025-01-13 21:27:32 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 21:27:53 +0000 netlink: avoid underflow of groups bitset index The subtraction is absolutely unnecessary and created an underflow with 926d2eadcb67. I don't see why it was useful before 926d2eadcb67 and even before edf5608bfef3. The bitset addresses bits from zero to NLP_MAX_GROUPS-1. Note that check of user supplied argument for NETLINK_ADD_MEMBERSHIP and NETLINK_DROP_MEMBERSHIP socket options is already correct !(optval >= NLP_MAX_GROUPS). Fixes: 926d2eadcb671dd26431a1082d4c49c3d5ad7f22 --- sys/netlink/netlink_domain.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c index 45d427f43166..00eb2923eddf 100644 --- a/sys/netlink/netlink_domain.c +++ b/sys/netlink/netlink_domain.c @@ -138,8 +138,7 @@ nl_port_lookup(uint32_t port_id) static void nl_add_group_locked(struct nlpcb *nlp, unsigned int group_id) { - MPASS(group_id <= NLP_MAX_GROUPS); - --group_id; + MPASS(group_id < NLP_MAX_GROUPS); /* TODO: add family handler callback */ if (!nlp_unconstrained_vnet(nlp)) @@ -151,8 +150,7 @@ nl_add_group_locked(struct nlpcb *nlp, unsigned int group_id) static void nl_del_group_locked(struct nlpcb *nlp, unsigned int group_id) { - MPASS(group_id <= NLP_MAX_GROUPS); - --group_id; + MPASS(group_id < NLP_MAX_GROUPS); BIT_CLR(NLP_MAX_GROUPS, group_id, &nlp->nl_groups); } @@ -160,8 +158,7 @@ nl_del_group_locked(struct nlpcb *nlp, unsigned int group_id) static bool nl_isset_group_locked(struct nlpcb *nlp, unsigned int group_id) { - MPASS(group_id <= NLP_MAX_GROUPS); - --group_id; + MPASS(group_id < NLP_MAX_GROUPS); return (BIT_ISSET(NLP_MAX_GROUPS, group_id, &nlp->nl_groups)); } From nobody Tue Jan 14 00:11:30 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YX8gQ34fnz5l1Ys; Tue, 14 Jan 2025 00:11: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX8gQ2NgQz40Xw; Tue, 14 Jan 2025 00:11:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736813490; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=08pLxRajbFc8ESxM0jljYbf39UV9CTGnOpVzKwqKBAc=; b=xUKH/rpU2LQV5FKdb39L4OvBltlHHzDyLcdnKIR5yn8JiSkIHNTt8SMHTaD3FfXkIFpayA 4C1UoZ338AQzYNlgIY+2dZND3+GnvUR0OWTTUO2sJh0MUJ/BM4bnACBrQax6vsuO6gUGcA BOB3LposwUryEzg6q8Ri4Zxjd9dXbMF7v9ATNbw8+385Y1VNXwvtzA9bpshc2lSt4iOu4C lXHrtODP43MoeBw+0zxxksh2yDu8m5dpKzJiR5hZrBpY6lCLvZ/7TCX9C0W0gS/Sf30wZf 9QR22dvnP+oLiHWib/7xQr2tjrWNNqN5NAiax8+yWXM48LtwDBmdAFYkUD261g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736813490; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=08pLxRajbFc8ESxM0jljYbf39UV9CTGnOpVzKwqKBAc=; b=C8yJZqA+8cIoZxgqERfrSYlLsmo5LQFQfZAywYPBPcnqICBLSQrIrGVJZQZvqVZI5y2ItI 09PUy+lr0WVSyPI+zno+LnhLwLL0IcIPGnUmzN0kKMu2BMPamEPE1mE4iRPZuNfWocuevr o/jF7THqOCw1Bpp77D0O+wzl0SMm/ZkSyXan6/qJXSqBLDyWXdQSmsc6DsaFGJRhFAf9+C qndSD+hQja3TkS+oiUyUIoMWWbFuNH2TFkKePZPXI05r0TRiXazaljsXK7+PBXxZhSq2m6 Inv0d7X+UyaOXTyJ/fcCzdtSFeCukfrnmpg9w7hUV2AyTnnPM1vfZV/Rdo5hcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736813490; a=rsa-sha256; cv=none; b=FYls8kuZKC9Ah8KcPiJdXHeDZSHRvjwUbyc/mNUragEfiF3GsohhAsGn/blSqxWqh5/Tb1 GR+ZtViCF4AXVKzjv0YkPXssJqQFit9MJD5OUIhm3mFYzAOw/lEzd2d2UlguGOsmJTi3yD 2dwgLXXC3zbypRO749kitMC1HNsUIOQ4ZT4WpQoa3Y3m7TPB7ARMYmV8nUX8hHDR8hdoQ6 IyfOi5ePDWFs96fVEM8sU3030JjV+56hIvTz+hCzmPIpr/nlm03Nj0kFsO0bFtIb96mogl xjnzyC+knbnQI/4ffMP9u4TR1pYAC7Apfn8V2LwYqXnQ0cNmCiHGOdEgqfzw5g== 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 4YX8gQ1srwzsvP; Tue, 14 Jan 2025 00:11:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50E0BU5M078560; Tue, 14 Jan 2025 00:11:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50E0BUoH078557; Tue, 14 Jan 2025 00:11:30 GMT (envelope-from git) Date: Tue, 14 Jan 2025 00:11:30 GMT Message-Id: <202501140011.50E0BUoH078557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: f167ba73574a - main - rtwn: fix RTWN_RIDX_VHT_MCS() macro List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f167ba73574a3e1757dd95265aa0211cb16c365e Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=f167ba73574a3e1757dd95265aa0211cb16c365e commit f167ba73574a3e1757dd95265aa0211cb16c365e Author: Adrian Chadd AuthorDate: 2025-01-13 03:14:21 +0000 Commit: Adrian Chadd CommitDate: 2025-01-14 00:11:18 +0000 rtwn: fix RTWN_RIDX_VHT_MCS() macro Add parenthesis as appropriate. Oops! --- sys/dev/rtwn/if_rtwn_ridx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/rtwn/if_rtwn_ridx.h b/sys/dev/rtwn/if_rtwn_ridx.h index 0a1ea35303f1..616ba8d6d724 100644 --- a/sys/dev/rtwn/if_rtwn_ridx.h +++ b/sys/dev/rtwn/if_rtwn_ridx.h @@ -53,7 +53,7 @@ * goes from 44 -> 83. */ #define RTWN_RIDX_VHT_MCS_SHIFT 44 -#define RTWN_RIDX_VHT_MCS(s, i) (RTWN_RIDX_VHT_MCS_SHIFT + ((10*s) + i)) +#define RTWN_RIDX_VHT_MCS(s, i) (RTWN_RIDX_VHT_MCS_SHIFT + ((10*(s)) + (i))) /* * The total amount of rate indexes, CCK, OFDM, HT MCS0..31, From nobody Tue Jan 14 04:34:54 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXGWM0c0Pz5j6Ym; Tue, 14 Jan 2025 04:34:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXGWM00j3z3cxg; Tue, 14 Jan 2025 04:34:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736829295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CiugQtBSalOSSVOaLthjsY7WzgZc6sDY0BMMhs6+RUw=; b=ByiJ3bGC9QcWLWEoQMb+rOdD0SxzFftoAc4KcbrD6qjvg2/c/2Fy1fgP5+RHq/emtTQUhF MsG0/qEGim5j7IFvltx4ftbHB4tX8yavvi/G9pt8/r/hjJJ9cEChqTnjBQi/JOKSul0cUI Jk1iZ0RcybRvrl3VOUgbo6+DBE7TWJXBuZP5WQHKAfSnRCEIpLFsQtQPnzk6I/TnS1s8gs Eyi79dNy0920c6iKvW+PMAXt2YAokKlsqGvKLE7v2uBZsGIu7O96idSXY5FsDrlv9934su EJCEUHn4PTbZmmMJ82Cd9qNHILzm+ohfp3vuPZ+S0WCWPUhwsy+/wjc2QeCSAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736829295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CiugQtBSalOSSVOaLthjsY7WzgZc6sDY0BMMhs6+RUw=; b=ESjgA5ojd6Xlg1VHuhhaQgINSKjd/gRBRp3lEoxEaICY6rBYiuOBt36lGODHN9BQBDl/yA kIoq80lNaHhp0cYOqIqqGKCoeGM0J6zsBy+m2JUdyRjCki6FLSIHoFOhF7NZ5+geSYvwrp BjIogSatfPFzvpKgiY05b75zHjYefk/H+RvMK9APAV7TdpfKwDMt7GWi2SrDhrk/iB4O92 yxlBbV5qmGU2dAMGd/qDzKvoOLW3z/b7qQ2rMCI5LLsmInIjAO1FL0YppPG30hH9jqT6AU bQYbfeOIm9iHNU9Ryaxvj0cC6qRGMSIRBsCWrYVNVozyvvf3MmD2OOLAWAQeLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736829295; a=rsa-sha256; cv=none; b=qxWf96dBLLcE6Ga2ppkNOBj12Y4SWUOG/sXLg9d0xfRZhzlbfiCM8+kByukN1aR0iZvlD8 8pyVFKN2L4pqDjAmPImf2WvaoYEldmFeXscdf9QALMFFOYE1Uuv2wnWGZLhRa49hLzeLR2 ULlXX0TKcFjLSS3WLjlpmflDBYyRi6/2JMHQyCo/Ok6l9pIT48kCynyMMH3SNBdwMZ971a KDWKsAIxJrIIRJIh8dEiKG444KsVQ2mqPRw4xv13CA+qtyNFRIpI/exooOJA7WxkA2YP51 udDbqYvs2cIG6S0RV4QlHQO1H3nzxsNrjVbb3ImcT+XLtnRTbG9dD7SXMSE97w== 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 4YXGWL6dMJz113F; Tue, 14 Jan 2025 04:34:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50E4Ysts072507; Tue, 14 Jan 2025 04:34:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50E4Ys6L072504; Tue, 14 Jan 2025 04:34:54 GMT (envelope-from git) Date: Tue, 14 Jan 2025 04:34:54 GMT Message-Id: <202501140434.50E4Ys6L072504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: f45f66fadacc - main - rtwn: explicitly configure RTS based on basic rates List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f45f66fadacc2efff3c2ff64e3528b8dbaad3673 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=f45f66fadacc2efff3c2ff64e3528b8dbaad3673 commit f45f66fadacc2efff3c2ff64e3528b8dbaad3673 Author: Adrian Chadd AuthorDate: 2024-12-19 02:11:28 +0000 Commit: Adrian Chadd CommitDate: 2025-01-14 04:33:44 +0000 rtwn: explicitly configure RTS based on basic rates The NIC/firmware initialises the initial RTS/CTS rate to something high, like OFDM48. That's not going to be very reliable. It's not a problem right now as we program in the RTS/CTS value to use in the TX descriptor setup path based on the control rate for the given frame TX rate, and like the INIDATA/driver rate stuff in the TX descriptor, the TX descriptor RTS/CTS rate overrides the INIRTS rate. However when it's time to flip on firmware based rate control, the initial rate needs to not be OFDM48. Yes, the firmware and hardware does have some rate retry schedule for RTS/CTS frames, but there's no point in wasting short retries trying to do OFDM48 based RTS/CTS setup. Add some warning logging if there are no basic or RTS/CTS rates available, and leave things at default. If this happens in production for someone then it would be good to know and what the rate mask was. Locally tested: * RTL8192CU, STA mode (with/without firmware rate control enabled locally) Differential Revision: https://reviews.freebsd.org/D48140 --- sys/dev/rtwn/if_rtwn.c | 8 +++++--- sys/dev/rtwn/if_rtwn_rx.c | 35 +++++++++++++++++++++++++++++++++++ sys/dev/rtwn/if_rtwn_rx.h | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c index f9950c5acf4d..2003fa7d20be 100644 --- a/sys/dev/rtwn/if_rtwn.c +++ b/sys/dev/rtwn/if_rtwn.c @@ -1308,12 +1308,14 @@ rtwn_calc_basicrates(struct rtwn_softc *sc) ieee80211_free_node(ni); } - - if (basicrates == 0) + if (basicrates == 0) { + device_printf(sc->sc_dev, + "WARNING: no configured basic rates!\n"); return; + } - /* XXX also set initial RTS rate? */ rtwn_set_basicrates(sc, basicrates); + rtwn_set_rts_rate(sc, basicrates); } static int diff --git a/sys/dev/rtwn/if_rtwn_rx.c b/sys/dev/rtwn/if_rtwn_rx.c index e5ddc7a3cb97..9b7c93fee9b6 100644 --- a/sys/dev/rtwn/if_rtwn_rx.c +++ b/sys/dev/rtwn/if_rtwn_rx.c @@ -134,6 +134,41 @@ rtwn_set_basicrates(struct rtwn_softc *sc, uint32_t rates) rtwn_setbits_4(sc, R92C_RRSR, R92C_RRSR_RATE_BITMAP_M, rates); } +/* + * Configure the initial RTS rate to use. + */ +void +rtwn_set_rts_rate(struct rtwn_softc *sc, uint32_t rates) +{ + uint8_t ridx; + + /* + * We shouldn't set the initial RTS/CTS generation rate + * as the highest available rate - that may end up + * with trying to configure something like MCS1 RTS/CTS. + * + * Instead, choose a suitable low OFDM/CCK rate based + * on the basic rate bitmask. Assume the caller + * has filtered out CCK modes in 5GHz. + */ + rates &= (1 << RTWN_RIDX_CCK1) | (1 << RTWN_RIDX_CCK55) | + (1 << RTWN_RIDX_CCK11) | (1 << RTWN_RIDX_OFDM6) | + (1 << RTWN_RIDX_OFDM9) | (1 << RTWN_RIDX_OFDM12) | + (1 << RTWN_RIDX_OFDM18) | (1 << RTWN_RIDX_OFDM24); + if (rates == 0) { + device_printf(sc->sc_dev, + "WARNING: no configured basic RTS rate!\n"); + return; + } + ridx = fls(rates) - 1; + + RTWN_DPRINTF(sc, RTWN_DEBUG_RA, + "%s: mask=0x%08x, ridx=%d\n", + __func__, rates, ridx); + + rtwn_write_1(sc, R92C_INIRTS_RATE_SEL, ridx); +} + static void rtwn_update_avgrssi(struct rtwn_softc *sc, struct rtwn_node *un, int8_t rssi, int is_cck) diff --git a/sys/dev/rtwn/if_rtwn_rx.h b/sys/dev/rtwn/if_rtwn_rx.h index 3108f1d4cde4..751173d0f80f 100644 --- a/sys/dev/rtwn/if_rtwn_rx.h +++ b/sys/dev/rtwn/if_rtwn_rx.h @@ -23,6 +23,7 @@ void rtwn_get_rates(struct rtwn_softc *, const struct ieee80211_rateset *, const struct ieee80211_htrateset *, uint32_t *, uint32_t *, int *, int); void rtwn_set_basicrates(struct rtwn_softc *, uint32_t); +void rtwn_set_rts_rate(struct rtwn_softc *, uint32_t); struct ieee80211_node * rtwn_rx_common(struct rtwn_softc *, struct mbuf *, void *); void rtwn_adhoc_recv_mgmt(struct ieee80211_node *, struct mbuf *, int, From nobody Tue Jan 14 04:34:55 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXGWN29P4z5j6vt; Tue, 14 Jan 2025 04:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXGWN0pcLz3ct8; Tue, 14 Jan 2025 04:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736829296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ou3YgW3WP9hLafYOdfCfZM8Z0NuBZSqLBDeg6pFw/U4=; b=Icvqt9W4YR2rcGBS8t3/806+k4HYxMJQNqeLqCgpgkRpKQ6WGV82dXOzl9QiIn/7Ewrmkw hmB5+NWghiyio5aOIWUGuD3beMipF+c+gkyZTfqAQIx1AhxIE78wJLZ3ZHfY/fGqbkJw+z VrvsuX3ye9PnvZKsmOpBCJMWvLHZiPS2TsVK18Hx4kwNglyjim1Pedq9kVbIWJsUjYnMWu jNMyK5+bebwCrP3rpwNLsj2t/lQJmNqf+I6XSCEZ3/Mjr+agAwQE0NWw7Q1ctp6sMVFrtE RbvYPsijEgUlrLIKJ1/9fzgCXGfg4gqG3p8hkFAxyNj3VYSiNe2BIPaGxFGYEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736829296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ou3YgW3WP9hLafYOdfCfZM8Z0NuBZSqLBDeg6pFw/U4=; b=DNzO2e69jdOkiMBoaYcY/8OBlXSMiIdoEHbfhxdAYKzwEyA6opYPPYmla6OMgK438quuGI mK40oHTxR1ejH03O2cjk00ZgpGM1mL2K9JnO3rwCU/05uinm46IVBmQ/zlCC7jvbWtPz4a 2/CAbr5frDdf+DD8j45ZeY25mb0WU2hUtIl4b02rGZCzpDnlDNVz/swgDnqH6cHM1fZd67 zZMBwHO51mjw7gcBD325eltnkqbUW1+8iOZaIqV643DGlgNcjkk2rnjHC3La2laX33sgqp 5Mv80aXYQwIhGZ0yT06m1Nn49CfE2CtDC0qTR+NJu9E64Tn/0UbMU3fITSfwNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736829296; a=rsa-sha256; cv=none; b=Qcs/8J88e5O2KP/U4GZMy0RTDIGefejVup7wLR2xPOjrpTDh2mtqt1Ya9CSMH0+ak2HXe5 AXzuLTz7Hh0onxnTw5kiCsrHAdtXJpTLSP6O18+Ed9BCo3WzKPhXg/lIWMKf+klJcOc+UJ BV+NJ3uPH1nbvlUGmwuCHAN3BkID1gsThmo4rA61M1Rfblp09Z6BE5zMaFdhGNF+d1LMg/ YuNsi3IwkVVUEC8l1qwboGYsqG8+/QFqPKRVZ+kcW4JDKtYDi21H1knlgIoCjRwGYftTMM lwH930OEurv/o3nfz7rN8R5GH6RvEt7LWN7jb+IkmiBwRl9T9Vwl1R55S6O3vg== 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 4YXGWN0D7lz11d5; Tue, 14 Jan 2025 04:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50E4YtXo072558; Tue, 14 Jan 2025 04:34:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50E4Ytvl072555; Tue, 14 Jan 2025 04:34:55 GMT (envelope-from git) Date: Tue, 14 Jan 2025 04:34:55 GMT Message-Id: <202501140434.50E4Ytvl072555@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: ea347b7fda20 - main - rtwn: refactor out datarate and short preamble setup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea347b7fda20e1437c1b2c363e12a4f29d8ca8f0 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=ea347b7fda20e1437c1b2c363e12a4f29d8ca8f0 commit ea347b7fda20e1437c1b2c363e12a4f29d8ca8f0 Author: Adrian Chadd AuthorDate: 2024-12-19 02:43:47 +0000 Commit: Adrian Chadd CommitDate: 2025-01-14 04:33:56 +0000 rtwn: refactor out datarate and short preamble setup Refactor out the datarate setup and short preamble setup. These will eventually be slightly different based on whether firmware rate control is being performed or not. Locally tested: * RTL8192CU, STA mode Differential Revision: https://reviews.freebsd.org/D48141 --- sys/dev/rtwn/rtl8192c/r92c_tx.c | 47 +++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c index d5cbc3ad9db9..9d975e98d95b 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_tx.c +++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c @@ -257,6 +257,34 @@ r92c_check_enable_ccx_report(struct rtwn_softc *sc, int macid) return true; } +static void +r92c_fill_tx_desc_datarate(struct rtwn_softc *sc, struct r92c_tx_desc *txd, + uint8_t ridx, bool force_rate) +{ + + /* Force this rate if needed. */ + if (sc->sc_ratectl == RTWN_RATECTL_FW && !force_rate) { + txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 0)); + } else { + txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, ridx)); + txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE); + } + + /* Data rate fallback limit (max). */ + txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE_FB_LMT, 0x1f)); +} + +static void +r92c_fill_tx_desc_shpreamble(struct rtwn_softc *sc, struct r92c_tx_desc *txd, + uint8_t ridx, bool force_rate) +{ + const struct ieee80211com *ic = &sc->sc_ic; + + if (RTWN_RATE_IS_CCK(ridx) && ridx != RTWN_RIDX_CCK1 && + (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) + txd->txdw4 |= htole32(R92C_TXDW4_DATA_SHPRE); +} + void r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m, void *buf, uint8_t ridx, bool force_rate, int maxretry) @@ -327,9 +355,7 @@ r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, #endif } - if (RTWN_RATE_IS_CCK(ridx) && ridx != RTWN_RIDX_CCK1 && - (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) - txd->txdw4 |= htole32(R92C_TXDW4_DATA_SHPRE); + r92c_fill_tx_desc_shpreamble(sc, txd, ridx, force_rate); prot = IEEE80211_PROT_NONE; if (RTWN_RATE_IS_HT(ridx)) { @@ -359,16 +385,13 @@ r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, txd->txdw1 |= htole32(SM(R92C_TXDW1_QSEL, qsel)); rtwn_r92c_tx_setup_macid(sc, txd, macid); - txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, ridx)); - /* Data rate fallback limit (max). */ - txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE_FB_LMT, 0x1f)); + + /* Fill in data rate, data retry */ + r92c_fill_tx_desc_datarate(sc, txd, ridx, force_rate); + txd->txdw4 |= htole32(SM(R92C_TXDW4_PORT_ID, uvp->id)); r92c_tx_raid(sc, txd, ni, ismcast); - /* Force this rate if needed. */ - if (sc->sc_ratectl != RTWN_RATECTL_FW) - txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE); - if (!hasqos) { /* Use HW sequence numbering for non-QoS frames. */ rtwn_r92c_tx_setup_hwseq(sc, txd); @@ -423,10 +446,8 @@ r92c_fill_tx_desc_raw(struct rtwn_softc *sc, struct ieee80211_node *ni, txd->txdw1 |= htole32(SM(R92C_TXDW1_QSEL, R92C_TXDW1_QSEL_MGNT)); /* Set TX rate index. */ - txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, ridx)); - txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE_FB_LMT, 0x1f)); + r92c_fill_tx_desc_datarate(sc, txd, ridx, true); /* force rate */ txd->txdw4 |= htole32(SM(R92C_TXDW4_PORT_ID, uvp->id)); - txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE); r92c_tx_raid(sc, txd, ni, ismcast); if (!IEEE80211_QOS_HAS_SEQ(wh)) { From nobody Tue Jan 14 04:34:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXGWP6kxLz5j6BK; Tue, 14 Jan 2025 04:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXGWP3D7jz3cVn; Tue, 14 Jan 2025 04:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736829297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6X7LW/pb8a35j13rnHeHgmoGb49RNU3GULrE3NJhLaI=; b=PVS88Fz4aV0b4Tn8LMDpUmNCbTCYjT83XmFgf+pnZPgBeQBdEAD0riT8bxxcvZo03QCz6v RcL4/ydFVt8GnJdjfUQv6VJjLZFVOam0luwnnxdcF/iIE3Y0lM79Ll3vsdAnNfEVHA2HhN YzlnQMVonKJc+0mugjs2I/obz+EeAtKDnEpFXuaOP10gRwJAU1CFNMutCc3rGdVDY415fK DktI4Kyr2e4qEvFGM1LsyzPTp0q/DWOGdu88hmX6SNAyPICBIDE3OgMtiMUTxuipsxD1DG Yrnk24eoyAV77bnK+R8GgufsyHpJNhYc4tPHsiGn1E+3s6BqPpSPVtnyWts5oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736829297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6X7LW/pb8a35j13rnHeHgmoGb49RNU3GULrE3NJhLaI=; b=oWjo//QbeZZamVTgubRumoeghLhyy8mFzEwEB5uysYiFM3h6aGSt3rSIvgIvHrd1FrCdDV YTURFQYWCgH14FoF1Qf7iaoRVGC1+cyqR5p+o+IJrObiSsZ4MywGwOQAv73b54GHvOKacj WttuJ6w5nc2SLT2BX18/MG5eQ8zQ8FRgUlHZCnzv3fte0RlZnZMAyyHWDnlWt4XknlavL1 PD+QaJ4RlWtyfzq8QxV2FoPjGTkSNegegY6Ymfck5pF/VOup0OfHGt1qBd1ZBy/1GfAaIC QgUxD0aQalaX9psPsB76nOeAKEuVl+M+1a9ZHq7tL1fdNsLt78/OkkKZFLgNuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736829297; a=rsa-sha256; cv=none; b=Z4orjFnroVdWHLe2k+NxUtDOgLyLyonEjQYgI+qIo4UCnvgxuxgnHBiak7BO2hzAyccFf2 ffTMUVzcyWwbqb/jXcB/dHSNJ1cJk0+dT3BU3UDVM6S3dozPyKYSlK5BFXGVHSCb1bCjKj L2bPav5FXkNqXdNppSX6NvskrFkMUV4XO3ggVfd4ddt5jGid0ztBhX+WtUVAjZeOfABOY8 XWU3KF2S+V5uuceK4tU/Av5uXqydrZiweDnNx3ybI6G1v815wJJ9nDqz3xFlDJ8OJ8FU9t gqVGve9k0Kkh4GqOpyXpD0FsxEnoiM0VRac506hHmIIheIIAl9FmmKo+7Thbbg== 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 4YXGWP1XxHz11g1; Tue, 14 Jan 2025 04:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50E4YvmN072625; Tue, 14 Jan 2025 04:34:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50E4Yvmd072622; Tue, 14 Jan 2025 04:34:57 GMT (envelope-from git) Date: Tue, 14 Jan 2025 04:34:57 GMT Message-Id: <202501140434.50E4Yvmd072622@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: ce7fca19287c - main - rtwn: refactor out the r92c path protection decision / configuration List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ce7fca19287cb218794da6fcbe320946485cd67a Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=ce7fca19287cb218794da6fcbe320946485cd67a commit ce7fca19287cb218794da6fcbe320946485cd67a Author: Adrian Chadd AuthorDate: 2024-12-19 03:35:58 +0000 Commit: Adrian Chadd CommitDate: 2025-01-14 04:34:14 +0000 rtwn: refactor out the r92c path protection decision / configuration * refactor out the r92c path protection (RTS/CTS) decision * handle firmware rate control being enabled - if DRVRATE isn't set then the RTSRATE field is ignored and instead RRSR/INIRTS registers are used (and the firmware/hardware will do RTS rate adaptation / retry.) * when making protection decisions with firmware rate control, default to the channel mode rather than rate index. This works on RTL8192CU both with firmware rate control and driver rate control. Locally tested: * RTL8192CU, STA - firmware and net80211 rate control Differential Revision: https://reviews.freebsd.org/D48142 --- sys/dev/rtwn/rtl8192c/r92c_tx.c | 100 +++++++++++++++++++++++++++++++--------- 1 file changed, 78 insertions(+), 22 deletions(-) diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c index 9d975e98d95b..6b013de0c536 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_tx.c +++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c @@ -77,10 +77,14 @@ r92c_tx_set_ht40(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni) static void r92c_tx_protection(struct rtwn_softc *sc, struct r92c_tx_desc *txd, - enum ieee80211_protmode mode, uint8_t ridx) + enum ieee80211_protmode mode, uint8_t ridx, bool force_rate) { struct ieee80211com *ic = &sc->sc_ic; uint8_t rate; + bool use_fw_ratectl; + + use_fw_ratectl = + (sc->sc_ratectl == RTWN_RATECTL_FW && !force_rate); switch (mode) { case IEEE80211_PROT_CTSONLY: @@ -95,17 +99,27 @@ r92c_tx_protection(struct rtwn_softc *sc, struct r92c_tx_desc *txd, if (mode == IEEE80211_PROT_CTSONLY || mode == IEEE80211_PROT_RTSCTS) { - if (RTWN_RATE_IS_HT(ridx)) + if (use_fw_ratectl) { + /* + * If we're not forcing the driver rate then this + * field actually doesn't matter; what matters is + * the RRSR and INIRTS configuration. + */ + ridx = RTWN_RIDX_OFDM24; + } else if (RTWN_RATE_IS_HT(ridx)) { rate = rtwn_ctl_mcsrate(ic->ic_rt, ridx); - else + ridx = rate2ridx(IEEE80211_RV(rate)); + } else { rate = ieee80211_ctl_rate(ic->ic_rt, ridx2rate[ridx]); - ridx = rate2ridx(IEEE80211_RV(rate)); + ridx = rate2ridx(IEEE80211_RV(rate)); + } txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, ridx)); /* RTS rate fallback limit (max). */ txd->txdw5 |= htole32(SM(R92C_TXDW5_RTSRATE_FB_LMT, 0xf)); - if (RTWN_RATE_IS_CCK(ridx) && ridx != RTWN_RIDX_CCK1 && + if (!use_fw_ratectl && RTWN_RATE_IS_CCK(ridx) && + ridx != RTWN_RIDX_CCK1 && (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) txd->txdw4 |= htole32(R92C_TXDW4_RTS_SHORT); } @@ -285,6 +299,49 @@ r92c_fill_tx_desc_shpreamble(struct rtwn_softc *sc, struct r92c_tx_desc *txd, txd->txdw4 |= htole32(R92C_TXDW4_DATA_SHPRE); } +static enum ieee80211_protmode +r92c_tx_get_protmode(struct rtwn_softc *sc, const struct ieee80211vap *vap, + const struct ieee80211_node *ni, const struct mbuf *m, + uint8_t ridx, bool force_rate) +{ + const struct ieee80211com *ic = &sc->sc_ic; + enum ieee80211_protmode prot; + + prot = IEEE80211_PROT_NONE; + + /* + * If doing firmware rate control, base it the configured channel. + * This ensures that for HT operation the RTS/CTS or CTS-to-self + * configuration is obeyed. + */ + if (sc->sc_ratectl == RTWN_RATECTL_FW && !force_rate) { + struct ieee80211_channel *chan; + enum ieee80211_phymode mode; + + chan = (ni->ni_chan != IEEE80211_CHAN_ANYC) ? + ni->ni_chan : ic->ic_curchan; + mode = ieee80211_chan2mode(chan); + if (mode == IEEE80211_MODE_11NG) + prot = ic->ic_htprotmode; + else if (ic->ic_flags & IEEE80211_F_USEPROT) + prot = ic->ic_protmode; + } else { + if (RTWN_RATE_IS_HT(ridx)) + prot = ic->ic_htprotmode; + else if (ic->ic_flags & IEEE80211_F_USEPROT) + prot = ic->ic_protmode; + } + + /* XXX fix last comparison for A-MSDU (in net80211) */ + /* XXX A-MPDU? */ + if (m->m_pkthdr.len + IEEE80211_CRC_LEN > + vap->iv_rtsthreshold && + vap->iv_rtsthreshold != IEEE80211_RTS_MAX) + prot = IEEE80211_PROT_RTSCTS; + + return (prot); +} + void r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m, void *buf, uint8_t ridx, bool force_rate, int maxretry) @@ -292,7 +349,6 @@ r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, #ifndef RTWN_WITHOUT_UCODE struct r92c_softc *rs = sc->sc_priv; #endif - struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = ni->ni_vap; struct rtwn_vap *uvp = RTWN_VAP(vap); struct ieee80211_frame *wh; @@ -357,24 +413,22 @@ r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, r92c_fill_tx_desc_shpreamble(sc, txd, ridx, force_rate); - prot = IEEE80211_PROT_NONE; - if (RTWN_RATE_IS_HT(ridx)) { + prot = r92c_tx_get_protmode(sc, vap, ni, m, ridx, + force_rate); + + /* + * Note: Firmware rate control will enable short-GI + * based on the configured rate mask, however HT40 + * may not be enabled. + */ + if (sc->sc_ratectl != RTWN_RATECTL_FW && + RTWN_RATE_IS_HT(ridx)) { r92c_tx_set_ht40(sc, txd, ni); r92c_tx_set_sgi(sc, txd, ni); - prot = ic->ic_htprotmode; - } else if (ic->ic_flags & IEEE80211_F_USEPROT) - prot = ic->ic_protmode; - - /* XXX fix last comparison for A-MSDU (in net80211) */ - /* XXX A-MPDU? */ - if (m->m_pkthdr.len + IEEE80211_CRC_LEN > - vap->iv_rtsthreshold && - vap->iv_rtsthreshold != IEEE80211_RTS_MAX) - prot = IEEE80211_PROT_RTSCTS; + } /* NB: checks for ht40 / short bits (set above). */ - if (prot != IEEE80211_PROT_NONE) - r92c_tx_protection(sc, txd, prot, ridx); + r92c_tx_protection(sc, txd, prot, ridx, force_rate); } else /* IEEE80211_FC0_TYPE_MGT */ qsel = R92C_TXDW1_QSEL_MGNT; } else { @@ -438,9 +492,11 @@ r92c_fill_tx_desc_raw(struct rtwn_softc *sc, struct ieee80211_node *ni, params->ibp_try0)); } if (params->ibp_flags & IEEE80211_BPF_RTS) - r92c_tx_protection(sc, txd, IEEE80211_PROT_RTSCTS, ridx); + r92c_tx_protection(sc, txd, IEEE80211_PROT_RTSCTS, ridx, + true); if (params->ibp_flags & IEEE80211_BPF_CTS) - r92c_tx_protection(sc, txd, IEEE80211_PROT_CTSONLY, ridx); + r92c_tx_protection(sc, txd, IEEE80211_PROT_CTSONLY, ridx, + true); rtwn_r92c_tx_setup_macid(sc, txd, RTWN_MACID_BC); txd->txdw1 |= htole32(SM(R92C_TXDW1_QSEL, R92C_TXDW1_QSEL_MGNT)); From nobody Tue Jan 14 04:34:58 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXGWQ6wbZz5j6w0; Tue, 14 Jan 2025 04:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXGWQ3RRvz3cyD; Tue, 14 Jan 2025 04:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736829298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BrnGvJrga2w/cTHfOs3LHVquXYGa5iEM/+Gfif2kncc=; b=c17p5nLmQcCHbHp8GwtbnrSXK4irBW3EcEA8CBcR7XAyCZltblprfHQAvWJ0n20IiOd6BW jjCI2DUNPosJ1M9kEqde7njZFbQmrl2MtlL/hGALZdMPLXtXqfQYv1Uft/3DaI4Ur/HZKh 1kJy9LKhssXoYQ8paHSS3Ysxu2O6MYv/tbzAqIUazUOZrPzm0FTLkMsGzq4eg4GzcZPCWd lKkbk4LF2+oSA2m4mUgaIo5vGZ8FbQFh9l1ogC+LzgbqLXOSrqn2dZ3vBXut0GFYXYF3km t2zgZ870ss47UYpAZHY3scwm4kLzyMaBqk5g2tLgY7DRRHvLrS0j2MQUCXWHjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736829298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BrnGvJrga2w/cTHfOs3LHVquXYGa5iEM/+Gfif2kncc=; b=vE7sV3F1Vb38jdg2LOd8xgduH2XBNIdKfTskMnrLg9H0mgrHtHl8agTI4BN6MPps6cVdYG BB8JpEVL0OsF56D2CMOs0tX/Ox7KtFpmIdF1pBKEXVOPJoahChGlk4b2uGGMlSe3AwpwrX FjKBDi9WxXRvBzcmQnx/HpmXji+jsg1e9xWFNHFmwY0P1KnfIdNeIWBsfktwfcJUrp5+77 NTEt5WK+wqVn0YrAt1AX/dauPnYGlltXw1rOyJCkhUg4YmahEUQbLujlDdl8A4vuawu8q4 f7iDid+/UCUOL3VV+4CWF4ROMycaeMEqarjkZq7MJiGklvSj2T2ArHtJ4U8Rrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736829298; a=rsa-sha256; cv=none; b=p+Cz1T3k4kJvFpj2uIJjA9pSXVDn75veGYV3swDQWAoJX/B2LUFi51wRFXAw9PzyDfKvpB Z7a3eEMWzP2joHrxpjVHlE2068M9LQGbFysZ0RfE1gjBjrAfmP7mnSerLMMYVWrxmryNSZ tx2embTRZmk7EyWxmUj2TtqA0I4Tw7inYQqGkoW6sG+E34Z6IXkFer14M1LLW/jI28bwWx WabVgix99bdRqWAHyo86TBOCesYdPqLztLgkxNXY1EL3G5EfZ8jiv3C4fvt9WA1Y55GiBi Yml7fkr7Iw7lBtR4l4fsmHTTa37w8uCGmVrm8lI1VolgBvyxNAf7yTUo+j6Pmg== 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 4YXGWQ2NrLz11g2; Tue, 14 Jan 2025 04:34:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50E4Yw0W072697; Tue, 14 Jan 2025 04:34:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50E4Ywf8072694; Tue, 14 Jan 2025 04:34:58 GMT (envelope-from git) Date: Tue, 14 Jan 2025 04:34:58 GMT Message-Id: <202501140434.50E4Ywf8072694@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 8896f36587f4 - main - rtwn: allow firmware rate control to be enabled for rtl8192cu List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8896f36587f46864fe5281c39de1f7f8aa5a0e33 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=8896f36587f46864fe5281c39de1f7f8aa5a0e33 commit 8896f36587f46864fe5281c39de1f7f8aa5a0e33 Author: Adrian Chadd AuthorDate: 2024-12-19 03:39:07 +0000 Commit: Adrian Chadd CommitDate: 2025-01-14 04:34:35 +0000 rtwn: allow firmware rate control to be enabled for rtl8192cu Although there's no RTS/CTS rate control available yet, the support is enough to enable firmware rate control for experimenting. This won't be enabled by default - users will need to set a tunable before loading the driver (eg kenv dev.rtwn.0.ratectl=2) but it is enough for experimentation, feedback and continued work. Locally tested: * RTL8192CU, STA mode Differential Revision: https://reviews.freebsd.org/D48143 Reviewed by: bz, emaste --- sys/dev/rtwn/rtl8192c/usb/r92cu_init.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c b/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c index 10d812dd7a80..91b1b78edb01 100644 --- a/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c +++ b/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c @@ -373,11 +373,7 @@ r92cu_post_init(struct rtwn_softc *sc) if (sc->sc_flags & RTWN_FW_LOADED) { struct r92c_softc *rs = sc->sc_priv; - if (sc->sc_ratectl_sysctl == RTWN_RATECTL_FW) { - /* XXX firmware RA does not work yet */ - sc->sc_ratectl = RTWN_RATECTL_NET80211; - } else - sc->sc_ratectl = sc->sc_ratectl_sysctl; + sc->sc_ratectl = sc->sc_ratectl_sysctl; /* Start C2H event handling. */ callout_reset(&rs->rs_c2h_report, rs->rs_c2h_timeout, From nobody Tue Jan 14 10:37:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZ21lqBz5kVl9; Tue, 14 Jan 2025 10: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZ20lVWz3C3j; Tue, 14 Jan 2025 10: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=1736851066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bZGbrWKc+G7el/hbxeRD8caJn+Aw7OFXxxPY7STXh/o=; b=PiShlUTdSkLcO8mI/H09Wl3xL3HthKe7mkNAZAiRVMQDX87DJXURpDl66euqAonldK3Wli 0kvL5SORu9PsRJzz+t4iH94kqhXxmtthk5LAacjKn9dd2QBjFAcho87Xfuy+WDSUCDj6jr xqsr8b6ErSQq3WavG2ctpfzTgWMD5SIVnY5+4NGfLX1FzE3EcpOAk83hU3PG+YGykSNTFv 3mjNDNTpixTqOQsEBqcTDh7EAEngIBaU82dWXp50XHYRB1caiZIyLk5y5/VgyJYtvkwMhG eCmrJaS1X6C7ye7QUwxJQhFode5hvxnQo2/Y1CPLDToqKSZ00JhCZvK8G9GzGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bZGbrWKc+G7el/hbxeRD8caJn+Aw7OFXxxPY7STXh/o=; b=uxEqQiDduZ9CuFp2c8Cx+rgJNxSIHKH2ruUprEQjiv4/YtZOvtg8iwhy242R/cRiLSwX2f faih2RdvwIdW0j6HSlq/lh7zJWmmG8mlIV0lSijz5uu7gV6QZfqyUJXE1jTcGF9y9tgFDj NkaWxswVgGTBJ9dyfmFk300JL/fLu43aGy7lfR2b40Z8Ftz4z6LJDVP7Ntkg1SyY6OyGe2 mJz/VqAR8ujSCMwlxirD5G13jmyxO2pHVShbboo6MzywBWc6cca839ApYrvjBwLHXV7Dwo Ce+LZnPvApH3lZ901v3HXcGMjWwaYD5NjUZLaw05Pxxv83qFj8icG52gRfVULw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851066; a=rsa-sha256; cv=none; b=uafiNQ2k/qPdUmxzZIKbBpkfHQn+YXH418uRAiZMD63pgWjzQ78HEPQ5uFrY/xmxhGJ3SY SbI29OgXaG1ne3jY8DJfh4fJQGkD0AmKXlnGkmeD3XzFHCgkgpfyjM+eRW/iZfvB2ztWJN lJq8aJ0XFDmzVQ+aQdFjsofPVuvcUrEdIRpZQGnpntY4wPozd8h72Ang56dpOn06E7XM1M bpntckjCDDwUzFWOo0WnK6i7sBerysnKpgtC+fM/oHT6edXiNqfhhxLTqFmKmPtR9PTNIt cn6WKB0fpNDpKYk5QridhPaXaDzxGCWvKszYmmk2sFKaQ1IIMKOn8glfSdCJ/Q== 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 4YXQZ2030dz1CHj; Tue, 14 Jan 2025 10: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 50EAbjBL047736; Tue, 14 Jan 2025 10: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 50EAbj9o047733; Tue, 14 Jan 2025 10:37:45 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:45 GMT Message-Id: <202501141037.50EAbj9o047733@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 441d489493e8 - main - pf: convert DIOCRCLRTABLES to netlink List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 441d489493e8a1e2658306f1a4c709a0b18cc78b Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=441d489493e8a1e2658306f1a4c709a0b18cc78b commit 441d489493e8a1e2658306f1a4c709a0b18cc78b Author: Kristof Provost AuthorDate: 2024-12-03 15:53:08 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:17 +0000 pf: convert DIOCRCLRTABLES to netlink Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/libpfctl/libpfctl.c | 44 ++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 3 +++ sbin/pfctl/pfctl.c | 4 ++-- sbin/pfctl/pfctl.h | 5 +++-- sbin/pfctl/pfctl_radix.c | 16 -------------- sbin/pfctl/pfctl_table.c | 4 ++-- sys/netpfil/pf/pf_nl.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_nl.h | 10 +++++++++ 8 files changed, 119 insertions(+), 22 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 2e4cdb91bad9..b374ef05e4d7 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -3072,3 +3072,47 @@ pfctl_get_srcnodes(struct pfctl_handle *h, pfctl_get_srcnode_fn fn, void *arg) return (e.error); } + +static struct snl_attr_parser ap_ndel[] = { + { .type = PF_T_NBR_DELETED, .off = 0, .cb = snl_attr_get_uint32 }, +}; +static struct snl_field_parser fp_ndel[] = {}; +SNL_DECLARE_PARSER(ndel_parser, struct genlmsghdr, fp_ndel, ap_ndel); + +int +pfctl_clear_tables(struct pfctl_handle *h, struct pfr_table *filter, + int *ndel, int flags) +{ + struct snl_writer nw; + struct snl_errmsg_data e = {}; + struct nlmsghdr *hdr; + uint32_t seq_id; + int family_id; + + family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME); + if (family_id == 0) + return (ENOTSUP); + + snl_init_writer(&h->ss, &nw); + hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_CLEAR_TABLES); + + snl_add_msg_attr_string(&nw, PF_T_ANCHOR, filter->pfrt_anchor); + snl_add_msg_attr_string(&nw, PF_T_NAME, filter->pfrt_name); + snl_add_msg_attr_u32(&nw, PF_T_TABLE_FLAGS, filter->pfrt_flags); + snl_add_msg_attr_u32(&nw, PF_T_FLAGS, flags); + + if ((hdr = snl_finalize_msg(&nw)) == NULL) + return (ENXIO); + + seq_id = hdr->nlmsg_seq; + + if (!snl_send_message(&h->ss, hdr)) + return (ENXIO); + + while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) { + if (!snl_parse_nlmsg(&h->ss, hdr, &ndel_parser, ndel)) + continue; + } + + return (e.error); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 79756286563b..14ea06fd151a 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -539,4 +539,7 @@ int pfctl_get_ruleset(struct pfctl_handle *h, const char *path, uint32_t nr, str typedef int (*pfctl_get_srcnode_fn)(struct pfctl_src_node*, void *); int pfctl_get_srcnodes(struct pfctl_handle *h, pfctl_get_srcnode_fn fn, void *arg); +int pfctl_clear_tables(struct pfctl_handle *h, struct pfr_table *filter, + int *ndel, int flags); + #endif diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 09d6774b324f..190d1a382c03 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -3219,7 +3219,7 @@ main(int argc, char *argv[]) pfctl_flush_eth_rules(dev, opts, anchorname); pfctl_flush_rules(dev, opts, anchorname); pfctl_flush_nat(dev, opts, anchorname); - pfctl_clear_tables(anchorname, opts); + pfctl_do_clear_tables(anchorname, opts); if (!*anchorname) { pfctl_clear_altq(dev, opts); pfctl_clear_iface_states(dev, ifaceopt, opts); @@ -3233,7 +3233,7 @@ main(int argc, char *argv[]) pfctl_clear_fingerprints(dev, opts); break; case 'T': - pfctl_clear_tables(anchorname, opts); + pfctl_do_clear_tables(anchorname, opts); break; } } diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index b4aba3beb4a6..788232d89006 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -36,6 +36,8 @@ #include +extern struct pfctl_handle *pfh; + struct pfctl; enum pfctl_show { PFCTL_SHOW_RULES, PFCTL_SHOW_LABELS, PFCTL_SHOW_NOTHING }; @@ -54,7 +56,6 @@ struct pfr_buffer { (var) = pfr_buf_next((buf), (var))) int pfr_get_fd(void); -int pfr_clr_tables(struct pfr_table *, int *, int); int pfr_add_tables(struct pfr_table *, int, int *, int); int pfr_del_tables(struct pfr_table *, int, int *, int); int pfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int); @@ -82,7 +83,7 @@ int pfi_get_ifaces(const char *, struct pfi_kif *, int *); int pfi_clr_istats(const char *, int *, int); void pfctl_print_title(char *); -int pfctl_clear_tables(const char *, int); +int pfctl_do_clear_tables(const char *, int); int pfctl_show_tables(const char *, int); int pfctl_command_tables(int, char *[], char *, const char *, char *, const char *, int); diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c index 9bea219a7d81..22552bcf1737 100644 --- a/sbin/pfctl/pfctl_radix.c +++ b/sbin/pfctl/pfctl_radix.c @@ -73,22 +73,6 @@ pfr_report_error(struct pfr_table *tbl, struct pfioc_table *io, err, tbl->pfrt_name); } -int -pfr_clr_tables(struct pfr_table *filter, int *ndel, int flags) -{ - struct pfioc_table io; - - bzero(&io, sizeof io); - io.pfrio_flags = flags; - if (filter != NULL) - io.pfrio_table = *filter; - if (ioctl(dev, DIOCRCLRTABLES, &io)) - return (-1); - if (ndel != NULL) - *ndel = io.pfrio_ndel; - return (0); -} - int pfr_add_tables(struct pfr_table *tbl, int size, int *nadd, int flags) { diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index aac031ce26b2..5e701be3c654 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -104,7 +104,7 @@ static const char *istats_text[2][2][2] = { } while(0) int -pfctl_clear_tables(const char *anchor, int opts) +pfctl_do_clear_tables(const char *anchor, int opts) { return pfctl_table(0, NULL, NULL, "-F", NULL, anchor, opts); } @@ -157,7 +157,7 @@ pfctl_table(int argc, char *argv[], char *tname, const char *command, if (!strcmp(command, "-F")) { if (argc || file != NULL) usage(); - RVTEST(pfr_clr_tables(&table, &ndel, flags)); + RVTEST(pfctl_clear_tables(pfh, &table, &ndel, flags)); xprintf(opts, "%d tables deleted", ndel); } else if (!strcmp(command, "-s")) { b.pfrb_type = (opts & PF_OPT_VERBOSE2) ? diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index e586ad082e4b..3e7a6965d387 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -1793,6 +1793,53 @@ pf_handle_get_srcnodes(struct nlmsghdr *hdr, struct nl_pstate *npt) return (0); } +#define _OUT(_field) offsetof(struct pfioc_table, _field) +static const struct nlattr_parser nla_p_table[] = { + { .type = PF_T_ANCHOR, .off = _OUT(pfrio_table.pfrt_anchor), .arg = (void *)MAXPATHLEN, .cb = nlattr_get_chara }, + { .type = PF_T_NAME, .off = _OUT(pfrio_table.pfrt_name), .arg = (void *)PF_TABLE_NAME_SIZE, .cb = nlattr_get_chara }, + { .type = PF_T_TABLE_FLAGS, .off = _OUT(pfrio_table.pfrt_flags), .cb = nlattr_get_uint32 }, + { .type = PF_T_FLAGS, .off = _OUT(pfrio_flags), .cb = nlattr_get_uint32 }, +}; +static const struct nlfield_parser nlf_p_table[] = {}; +NL_DECLARE_PARSER(table_parser, struct genlmsghdr, nlf_p_table, nla_p_table); +#undef _OUT +static int +pf_handle_clear_tables(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct pfioc_table attrs = { 0 }; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr_new; + int ndel = 0; + int error; + + error = nl_parse_nlmsg(hdr, &table_parser, npt, &attrs); + if (error != 0) + return (error); + + PF_RULES_WLOCK(); + error = pfr_clr_tables(&attrs.pfrio_table, &ndel, attrs.pfrio_flags | PFR_FLAG_USERIOCTL); + PF_RULES_WUNLOCK(); + if (error != 0) + return (error); + + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) + return (ENOMEM); + + ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr); + ghdr_new->cmd = PFNL_CMD_CLEAR_TABLES; + ghdr_new->version = 0; + ghdr_new->reserved = 0; + + nlattr_add_u32(nw, PF_T_NBR_DELETED, ndel); + + if (!nlmsg_end(nw)) { + nlmsg_abort(nw); + return (ENOMEM); + } + + return (0); +} + static const struct nlhdr_parser *all_parsers[] = { &state_parser, &addrule_parser, @@ -1806,6 +1853,7 @@ static const struct nlhdr_parser *all_parsers[] = { &pool_addr_parser, &add_addr_parser, &ruleset_parser, + &table_parser, }; static int family_id; @@ -1986,6 +2034,13 @@ static const struct genl_cmd pf_cmds[] = { .cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL, .cmd_priv = PRIV_NETINET_PF, }, + { + .cmd_num = PFNL_CMD_CLEAR_TABLES, + .cmd_name = "CLEAR_TABLES", + .cmd_cb = pf_handle_clear_tables, + .cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, }; void diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h index 0f534bd623c4..8c0149891773 100644 --- a/sys/netpfil/pf/pf_nl.h +++ b/sys/netpfil/pf/pf_nl.h @@ -61,6 +61,7 @@ enum { PFNL_CMD_GET_RULESETS = 23, PFNL_CMD_GET_RULESET = 24, PFNL_CMD_GET_SRCNODES = 25, + PFNL_CMD_CLEAR_TABLES = 26, __PFNL_CMD_MAX, }; #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1) @@ -422,6 +423,15 @@ enum pf_srcnodes_types_t { PF_SN_NAF = 15, /* u8 */ }; +enum pf_tables_t { + PF_T_UNSPEC, + PF_T_ANCHOR = 1, /* string */ + PF_T_NAME = 2, /* string */ + PF_T_TABLE_FLAGS = 3, /* u32 */ + PF_T_FLAGS = 4, /* u32 */ + PF_T_NBR_DELETED = 5, /* u32 */ +}; + #ifdef _KERNEL void pf_nl_register(void); From nobody Tue Jan 14 10:37:47 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZ33M4wz5kVqK; Tue, 14 Jan 2025 10: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZ30xq3z3Bq3; Tue, 14 Jan 2025 10: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=1736851067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bcI+0kl9w5zO98toiuVyXCJA9Pin2oDuACuwm02VTHk=; b=WU+NidOrTJRPiuh2jZMO4aRcP3mwhJdi9BeHCtGXAHv6pgkRzLFC4nt60QHLW/huTAHHO+ IiNpdgLJFUZZYd8JSL03AzCgMH7SJLIx3FGNXqe5jTbiKDdfpfA4cwNTk7QVe7sZF10R5p mE/bcS0l1VnfdZEXCWSfWZOP6vZ1I3iAM0PXv56Nlsve7GuL7IIEjM04pX5TSIF/CFYQii mz2JCiH5DCosnM3Vj9GasHNeMicZv5Q+MB8XJgBHA7WLCqSxKpalSO6ojZ+lCLFfNC0bic qMvGG4WohDJKKUwoItVEpwTNy9S3JRtqgbmBVvzXXKQtcc4m5SN9DxqTRLwZsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bcI+0kl9w5zO98toiuVyXCJA9Pin2oDuACuwm02VTHk=; b=FXjmh3iJ94xarRHCZXfR7KOtsm3CKIMCTPKN0LpoP5qP+eMrGa82dC9SS8n84z+2JSB8Ds iYS5IarI/xqGVHOlip1NfUcEl9KMtMxQdV+nCxyt4xfIQN9MjZjYSWjq9K7ODn2VYxLy5u mIYRsEGzivFh+ITPFb+vH3u2QCzMJQWyAfOsRAATMtAqD0Q3fQtVYi6Czlti5NW8HBczV9 305HQ5cMSQLYVp9Y0/nRUo3rshF7aWqQC9nuEWrDAm3E/D9csPrbCiiI4MScSs1b3AqYRy XN8lDRCg2Y/borBVueQV5zNkmeH12SQFgCZJIb6+6J9JD1pMiBawZoXa1TOQLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851067; a=rsa-sha256; cv=none; b=u7B95bI/l2GOVLU4tGD66fHva7w1q+NFKIMn0Ej1AlKQJ/QdTxkg2Sdc9YDz0wPWRbx92A ML3Rbnci3srAi+NEGiXCkNGFf68rgL3zOq1AwvVIKswlv1BQd9m0IVS7qD/RaCCvgWg0xH LQ4Wc7dJgO0FZuLRDKCpHK0EL2htTbqHyFvx93AkJYC2O3hHV3koFlS5Eqkv12n7l+1XIL /eQXcAs4PXaMuzUY3inSxTFQ/VtTnDqvvB4/tRomovAP4cnOZoxOGO6Hp4Fp05nVU8o3xF iBdnjb1Lx8Cpty/RUzpvWTzTdJQNbE/m05/OahAC7g8khi5PNwl0Or2UerpxtA== 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 4YXQZ30Y24z1C6T; Tue, 14 Jan 2025 10: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 50EAblcR047778; Tue, 14 Jan 2025 10: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 50EAblgj047775; Tue, 14 Jan 2025 10:37:47 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:47 GMT Message-Id: <202501141037.50EAblgj047775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 4aafc73d1255 - main - pfctl: pfctl_set_hostid always returns 0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4aafc73d1255a92463d2ee73cea381462775e64a Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4aafc73d1255a92463d2ee73cea381462775e64a commit 4aafc73d1255a92463d2ee73cea381462775e64a Author: Kristof Provost AuthorDate: 2025-01-07 10:55:05 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:17 +0000 pfctl: pfctl_set_hostid always returns 0 Don't pretend otherwise and make it a void function instead. ok dlg Obtained from: OpenBSD, mcbride , 9ac6101ff7 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 5 +---- sbin/pfctl/pfctl.c | 6 ++---- sbin/pfctl/pfctl_parser.h | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index fc9cf86081f6..63bee3ab6a1c 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -702,10 +702,7 @@ option : SET REASSEMBLE yesno optnodf { yyerror("hostid must be non-zero"); YYERROR; } - if (pfctl_set_hostid(pf, $3) != 0) { - yyerror("error setting hostid %08x", $3); - YYERROR; - } + pfctl_set_hostid(pf, $3); } | SET BLOCKPOLICY DROP { if (pf->opts & PF_OPT_VERBOSE) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 190d1a382c03..4b2a69f456a2 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -2571,11 +2571,11 @@ pfctl_load_logif(struct pfctl *pf, char *ifname) return (pfctl_set_statusif(pfh, ifname ? ifname : "")); } -int +void pfctl_set_hostid(struct pfctl *pf, u_int32_t hostid) { if ((loadopt & PFCTL_FLAG_OPTION) == 0) - return (0); + return; HTONL(hostid); @@ -2584,8 +2584,6 @@ pfctl_set_hostid(struct pfctl *pf, u_int32_t hostid) if (pf->opts & PF_OPT_VERBOSE) printf("set hostid 0x%08x\n", ntohl(hostid)); - - return (0); } int diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 551f2ff7537c..2b0766dfd99f 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -290,7 +290,7 @@ int pfctl_set_reassembly(struct pfctl *, int, int); int pfctl_set_optimization(struct pfctl *, const char *); int pfctl_apply_limit(struct pfctl *, const char *, unsigned int); int pfctl_set_logif(struct pfctl *, char *); -int pfctl_set_hostid(struct pfctl *, u_int32_t); +void pfctl_set_hostid(struct pfctl *, u_int32_t); int pfctl_do_set_debug(struct pfctl *, char *); int pfctl_set_interface_flags(struct pfctl *, char *, int, int); int pfctl_cfg_syncookies(struct pfctl *, uint8_t, struct pfctl_watermarks *); From nobody Tue Jan 14 10:37:48 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZ46X7Kz5kVN0; Tue, 14 Jan 2025 10:37:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZ42g65z3BsK; Tue, 14 Jan 2025 10: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=1736851068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=moJRPrH08WgyPN0UrMFaZcjrkj+duJWbVx2rhPxh64A=; b=LqYIGPHxYBLd0RdGrJiiPel1gEohGamcXdV1Yw5oCq25O6MRSJSq95cpGJaiexpTQR40lp fxZUGxichsdAErLDSjyv1vD4tz4X7TbDnPU3qy1kw0VfekXiV9Y2yZCpYMp288oVPpbPz9 t8qGuHuokxRHn7rg9CvjqSIKaF6GuXSCk2Q6QGwRzatkwOAvuUyR19FM8I3gbxzTGfHRYI RV48ZENVktGbRncgFYnbWoOznWoTuQazyWpweZ9Jzqinp6ebX1HiULSGTnsqApLLs1hFt/ FHaE1ltb8aXn6nqHyrmHtvyICpvYKLkJZ8b/eA9Qm3XkukZgC7KF2QyeFnfxBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=moJRPrH08WgyPN0UrMFaZcjrkj+duJWbVx2rhPxh64A=; b=Z9I9YCXn/NODKdE07saRinCrEAyUyoR0DiiXQ4vqsyr4Ylqj+mmUiBZWfZhL+K9j7SVFg7 ip6gPuMvH5wnM9OhivmSsFjcf0Ec6o2n+CXpZe7ASPHIt+Mlf7Xz5lLmgmAiFMXtnPCcUc 8n8j574SE9YcFADTOjRTWY3tkVVjI1uB5z1DiKJUngDb+8PrllJOCSuewoook8jzGedy6U OTOme4wXqJdNCZ/KMYxzMb4cjos6zYDE3Cd3B0yhuMIZKBkFF3ETlF47NSjdkWxZvUSj2w Dvlov14PCFvYRno1yWcnjOUU+fg9Wb1TBzPcr7KNawe0Cdv0TWNyjepAQj2A/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851068; a=rsa-sha256; cv=none; b=JhbA/B+q7x80N75aN8rK4zLYFOqYthVV308Nd9XFaAlfjnnuVEovbhtTSANgsn99EzkZfv SgXOkdD7TFvS/N/y+6wtTfJeTf9KuYnw1KZVA/v4NpqY4nOhCsP7F3i0TtJSSGzKwtsXVo V72Mv/aTD7lrv4dD8BBq6oYrbN9D89vEJqPILxAnHyrK0mQWsencUDDDFwuY19LC23T1uD FmiiWjnoRGRlgguFXEJq/cjqgnNuGqasMSFUYUNKV+0Tuqic7dOmZeKEYwyY2TTRhnBqBU qcF4GVLmC8eKxkdKBeb/gip74hcfWA1QUCdDibrZfHkbPpBCfqJhTFIuPZatXw== 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 4YXQZ41xgtz1Brg; Tue, 14 Jan 2025 10: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 50EAbmlR047834; Tue, 14 Jan 2025 10: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 50EAbm4k047831; Tue, 14 Jan 2025 10:37:48 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:48 GMT Message-Id: <202501141037.50EAbm4k047831@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: f88019e8a35c - main - pf: fixup af-to regression with match rules List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f88019e8a35c05b61b5722e4b98cd7b5cca167f7 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f88019e8a35c05b61b5722e4b98cd7b5cca167f7 commit f88019e8a35c05b61b5722e4b98cd7b5cca167f7 Author: Kristof Provost AuthorDate: 2025-01-07 11:12:12 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:17 +0000 pf: fixup af-to regression with match rules pfctl should not infer the af-to behavior from the af/naf difference. instead, we should be clear that this is an af-to rule. essentially this change converts FOM_AFTO marker into a rule flag PFRULE_AFTO so that we don't rely on ambiguous checks (like r->af != r->naf) when setting things up. positive review and comments from claudio, ok henning, sperreault Obtained from: OpenBSD, mikeb , fc302162c0 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 36 +++++++++++++++++++++--------------- sbin/pfctl/pfctl_parser.c | 2 +- sys/netpfil/pf/pf.c | 4 ++-- sys/netpfil/pf/pf.h | 1 + 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 63bee3ab6a1c..3c34b0237895 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -382,7 +382,7 @@ void expand_eth_rule(struct pfctl_eth_rule *, struct node_host *, struct node_host *, const char *, const char *); void expand_rule(struct pfctl_rule *, struct node_if *, - struct node_host *, + struct redirspec *, struct redirspec *, struct node_host *, struct node_host *, struct node_proto *, struct node_os *, struct node_host *, struct node_port *, struct node_host *, struct node_port *, struct node_uid *, struct node_gid *, @@ -1079,9 +1079,8 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto decide_address_family($8.src.host, &r.af); decide_address_family($8.dst.host, &r.af); - r.naf = r.af; - expand_rule(&r, $5, NULL, NULL, $7, $8.src_os, + expand_rule(&r, $5, NULL, NULL, NULL, NULL, $7, $8.src_os, $8.src.host, $8.src.port, $8.dst.host, $8.dst.port, $9.uid, $9.gid, $9.rcv, $9.icmpspec, pf->astack[pf->asd + 1] ? pf->alast->name : $2); @@ -1104,7 +1103,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto decide_address_family($6.src.host, &r.af); decide_address_family($6.dst.host, &r.af); - expand_rule(&r, $3, NULL, NULL, $5, $6.src_os, + expand_rule(&r, $3, NULL, NULL, NULL, NULL, $5, $6.src_os, $6.src.host, $6.src.port, $6.dst.host, $6.dst.port, 0, 0, 0, 0, $2); free($2); @@ -1146,7 +1145,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto r.dst.port_op = $6.dst.port->op; } - expand_rule(&r, $3, NULL, NULL, $5, $6.src_os, + expand_rule(&r, $3, NULL, NULL, NULL, NULL, $5, $6.src_os, $6.src.host, $6.src.port, $6.dst.host, $6.dst.port, 0, 0, 0, 0, $2); free($2); @@ -1469,7 +1468,7 @@ scrubrule : scrubaction dir logquick interface af proto fromto scrub_opts r.match_tag_not = $8.match_tag_not; r.rtableid = $8.rtableid; - expand_rule(&r, $4, NULL, NULL, $6, $7.src_os, + expand_rule(&r, $4, NULL, NULL, NULL, NULL, $6, $7.src_os, $7.src.host, $7.src.port, $7.dst.host, $7.dst.port, NULL, NULL, NULL, NULL, ""); } @@ -1634,7 +1633,7 @@ antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { } if (h != NULL) - expand_rule(&r, j, NULL, NULL, NULL, NULL, h, + expand_rule(&r, j, NULL, NULL, NULL, NULL, NULL, NULL, h, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ""); @@ -1656,7 +1655,7 @@ antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { else h = ifa_lookup(i->ifname, 0); if (h != NULL) - expand_rule(&r, NULL, NULL, NULL, + expand_rule(&r, NULL, NULL, NULL, NULL, NULL, NULL, NULL, h, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ""); } else @@ -2434,6 +2433,7 @@ pfrule : action dir logquick interface route af proto fromto "translation"); YYERROR; } + r.rule_flag |= PFRULE_AFTO; } r.af = $6; @@ -2721,7 +2721,6 @@ pfrule : action dir logquick interface route af proto fromto decide_address_family($8.src.host, &r.af); decide_address_family($8.dst.host, &r.af); - r.naf = r.af; if ($5.rt) { if (!r.direction) { @@ -2837,7 +2836,7 @@ pfrule : action dir logquick interface route af proto fromto YYERROR; } - expand_rule(&r, $4, $5.host, $9.nat.rdr ? $9.nat.rdr->host : NULL, + expand_rule(&r, $4, &$9.nat, &$9.rdr, $5.host, $9.nat.rdr ? $9.nat.rdr->host : NULL, $7, $8.src_os, $8.src.host, $8.src.port, $8.dst.host, $8.dst.port, $9.uid, $9.gid, $9.rcv, $9.icmpspec, ""); } @@ -4985,8 +4984,8 @@ natrule : nataction interface af proto fromto tag tagged rtable o = o->next; } - expand_rule(&r, $2, $9 == NULL ? NULL : $9->host, NULL, $4, - $5.src_os, $5.src.host, $5.src.port, $5.dst.host, + expand_rule(&r, $2, NULL, NULL, $9 == NULL ? NULL : $9->host, + NULL, $4, $5.src_os, $5.src.host, $5.src.port, $5.dst.host, $5.dst.port, 0, 0, 0, 0, ""); free($9); } @@ -5501,7 +5500,7 @@ filter_consistent(struct pfctl_rule *r, int anchor_call) "must not be used on match rules"); problems++; } - if (r->naf != r->af) { + if (r->rule_flag & PFRULE_AFTO) { yyerror("af-to is not supported on match rules"); problems++; } @@ -6139,7 +6138,8 @@ expand_eth_rule(struct pfctl_eth_rule *r, void expand_rule(struct pfctl_rule *r, - struct node_if *interfaces, struct node_host *rdr_hosts, + struct node_if *interfaces, struct redirspec *nat, + struct redirspec *rdr, struct node_host *rdr_hosts, struct node_host *nat_hosts, struct node_proto *protos, struct node_os *src_oses, struct node_host *src_hosts, struct node_port *src_ports, @@ -6179,7 +6179,13 @@ expand_rule(struct pfctl_rule *r, LOOP_THROUGH(struct node_uid, uid, uids, LOOP_THROUGH(struct node_gid, gid, gids, - r->af = af; + r->naf = r->af = af; + + if (r->rule_flag & PFRULE_AFTO) { + assert(nat != NULL); + r->naf = nat->af; + } + /* for link-local IPv6 address, interface must match up */ if ((r->af && src_host->af && r->af != src_host->af) || (r->af && dst_host->af && r->af != dst_host->af) || diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 741915d41b0d..af10bdcf7e4b 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1238,7 +1238,7 @@ print_rule(struct pfctl_rule *r, const char *anchor_call, int verbose, int numer #endif } if (!anchor_call[0] && ! TAILQ_EMPTY(&r->nat.list) && - r->naf != r->af) { + r->rule_flag & PFRULE_AFTO) { printf(" af-to %s from ", r->naf == AF_INET ? "inet" : "inet6"); print_pool(&r->nat, r->nat.proxy_port[0], r->nat.proxy_port[1], r->naf ? r->naf : r->af, PF_NAT); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 335b192d454d..dd337c0aef93 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -5802,7 +5802,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, pf_counter_u64_add_protected(&r->bytes[pd->dir == PF_OUT], pd->tot_len); pf_counter_u64_critical_exit(); pf_rule_to_actions(r, &pd->act); - if (r->naf) + if (r->rule_flag & PFRULE_AFTO) pd->naf = r->naf; if (pd->af != pd->naf) { if (pf_get_transaddr_af(r, pd) == -1) { @@ -5842,7 +5842,7 @@ nextrule: /* apply actions for last matching pass/block rule */ pf_rule_to_actions(r, &pd->act); - if (r->naf) + if (r->rule_flag & PFRULE_AFTO) pd->naf = r->naf; if (pd->af != pd->naf) { if (pf_get_transaddr_af(r, pd) == -1) { diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 0d4d0a6a6f32..10431d9b77d9 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -617,6 +617,7 @@ struct pf_rule { #define PFRULE_IFBOUND 0x00010000 /* if-bound */ #define PFRULE_STATESLOPPY 0x00020000 /* sloppy state tracking */ #define PFRULE_PFLOW 0x00040000 +#define PFRULE_AFTO 0x00200000 /* af-to rule */ #ifdef _KERNEL #define PFRULE_REFS 0x0080 /* rule has references */ From nobody Tue Jan 14 10:37:50 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZ71j98z5kVtc; Tue, 14 Jan 2025 10:37:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZ64Sjyz3Bw1; Tue, 14 Jan 2025 10:37:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tm5CbgHTqZK4WaA6OiD4p/M1UH8djHIvkTZz9OlLgM0=; b=sQpHQwjD4fOU0gL+Y/FwLrSHPwAvFDutVBfNW4QFZw9nb5x1WdQ/7tPF+kqVm3cEVFDllp way68YP0/rXVWlq6wZKD+A7K9l1GMFFBeXLl0rT/7ydtP9oe66AQbB6faTAjnNfpyms3Nd 53/CndJNvRRTuBt46GsuNWQEIY50BFz3QYIMhh+vzVHXhUxkhY/dzNTXZtBco+AC2HLVbv P03KDv4Svia87Ap+2AHnD4m9NFFpwrXeWl5ba3HBhPD6iThv9IfnWp7+7IOOLRHqS3UfCa OFfnYx0TP6LfWzrRYrxBmg3klu0MBHaicggB4h1eKKMTvPuOmXwTqcUXCr5a+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tm5CbgHTqZK4WaA6OiD4p/M1UH8djHIvkTZz9OlLgM0=; b=vbT7G6/xq5D/6YMaQVLFM3aXSFMl7DUMz4wdgJMTmrDu22//ZIWNH6d6vdqWuxDB74PVfJ pvDpMqjO+VqK8zTAEmIn1C56wHNJfmpJnwqb8rAgoYI8VH4sW7GudeS4aMaZPCRG5nybP1 ZCzqtdep8+aGg7WMVlRdi5b7bzfzRYhQpQ3mQdv5AKSrLQofptrXoOV1XQbd9hS9LPRA90 Si52DtsGm6BouCvSQPNzRKGZ6RglyQH56GC7fst5nZt801v8LtYM0PpU2STsaVglFxLbFy z1xLcAGiY5L3ogrWeU5n9RMZMzU89wK2Y7suhUX9OMTL9i7Pw0hI92MfuxfAKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851070; a=rsa-sha256; cv=none; b=iqe1NAlIcJdu/OaDY3z1oumCdgHH+D9wkveT/Z58LEZ+9pNwr2M6wy5yh5wFskn9tWie2L 0Sj73jHxKclfFqMtgKpOFe09kgG9MpEKU6857YcMqBkQxkvFjGoLJ0D+cNpERLKIV+8U+u XpsdcZyKZkSzhm3oJ/dEZDsrjtDwHQlj317+xpeJoe0kiQxPVu7P0GQp6kkb2UtKuT8dXI idBd/D+EQQZX3eu2nl8UnMByfvubALmwJ71AP96a+bqsre/fZa3d/IESMtiKxkjgKVh1Ow IKtdciONVmR8Kto4SHv3CMI2GAThFMiWcBpJZ9lOVGw5b4GDUjeP0VxSG3kvnw== 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 4YXQZ63wNFz1C3T; Tue, 14 Jan 2025 10:37:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbox1047946; Tue, 14 Jan 2025 10:37:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAboQl047943; Tue, 14 Jan 2025 10:37:50 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:50 GMT Message-Id: <202501141037.50EAboQl047943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 37101926c920 - main - pf improve the icmp direction check List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 37101926c920e9fd9b7d89b1ed480103305be4c4 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=37101926c920e9fd9b7d89b1ed480103305be4c4 commit 37101926c920e9fd9b7d89b1ed480103305be4c4 Author: Kristof Provost AuthorDate: 2025-01-07 14:17:51 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:18 +0000 pf improve the icmp direction check Deal correctly with af-to states (there only one state and it's direction is always PF_IN). ok mcbride, claudio on previous version, ok henning, "looks good" deraadt We deviate from the OpenBSD change in that we don't include the "don't exclude icmp echo replies from the test." part of the commit. This is a user-visible behaviour change, and is likely to break existing configurations. For example, it breaks the netpfil/common/dummynet:pf_queue tests. Obtained from: OpenBSD, mikeb , b96cc44e9e Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index dd337c0aef93..bee5690e02c4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -7679,9 +7679,14 @@ pf_icmp_state_lookup(struct pf_state_key_cmp *key, struct pf_pdesc *pd, return (-1); /* Is this ICMP message flowing in right direction? */ + if ((*state)->key[PF_SK_WIRE]->af != (*state)->key[PF_SK_STACK]->af) + direction = (pd->af == (*state)->key[PF_SK_WIRE]->af) ? + PF_IN : PF_OUT; + else + direction = (*state)->direction; if ((*state)->rule->type && - (((!inner && (*state)->direction == direction) || - (inner && (*state)->direction != direction)) ? + (((!inner && direction == pd->dir) || + (inner && direction != pd->dir)) ? PF_IN : PF_OUT) != icmp_dir) { if (V_pf_status.debug >= PF_DEBUG_MISC) { printf("pf: icmp type %d in wrong direction (%d): ", From nobody Tue Jan 14 10:37:49 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZ55MY9z5kVlN; Tue, 14 Jan 2025 10:37:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZ53LPmz3By0; Tue, 14 Jan 2025 10:37:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0GEUCQER6kSy7HnzTp/83ZpYvemiYg38QbOvTeQYNZM=; b=vGtG3LAurLsC29o1n5YG1pLtY1XCZGks2Tbnywtm9lhNdzJXbcDEN+CwxsOTFhh1MZUe3y lUGU90bvhdoc8c9S8p1MejYvxcNiyCTC31ICS0jhKoYUatffGqHxw9IFjw9tpPj3CvQzBI qRFR932umuKGC0VfY5Fwxfa+EvrTYkGTju/i52aofHM0pnKWrDoVSJVEJOPigBJ65pkyB+ QhxJyPdVeStsNnJ12Pez7Ni6cpOCDOrYoStzuz8iZtXUUbzisbH4TwSRsHb58EM3vnZm1T JZRseowJ2DTo9Fda8oVEawisrHPcGEei9yV8//i96Qdtr4Jb4ThCkc9jF6zTCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0GEUCQER6kSy7HnzTp/83ZpYvemiYg38QbOvTeQYNZM=; b=SLAQmFyw7u+PoALgJRX9E9gVN1tRz+iAtNNRmXYCTDoSkcSVFSCfKf1+VEhz0GiGnftY46 iIk2OSOqc8rrzcyXXFbxlp4eidbGmr4KR7DP5Yro7onPnhZLvi/t0NZ0lLt2rhudGjKFjG HklkccTs9LWXvo+KL+gbMBDjGELtxE3zPN1h80K1d5IdYMPgwpKzCst1qCinoCQ0yOvckF gSkzWxZbBYfuHicjRh+zZ4kI7pkMfuqNPhax2B+w97nG36dTm+o+R6vi7UEGdcctE1gbFo OtEFOfV+qGQzLXrUXg0K1IBfIj15eEvrrpkIi37lkT13ERBMjWdcMOR7d8PmWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851069; a=rsa-sha256; cv=none; b=Vx+pCLwqk/CPloIgxjsizVer5zllMYbdJadptAdKHFTp2AvMIYFObGpM14fEDh9tZn0SX6 3pousJ/jbdOFkqepazwRVdJFjDz8TpfUQqpIztUSZU4kBKU299bffq/zv+WDuSHcaSZ+p0 jiHwT1BxliJ66AAJcOKv+6cpIFRLCm+3BUO0isQe0zyDCeyB75jYifKQWvH7ZZY6lVQ50o Kp9Vk5oqJ3OcaUv7hTvXPRXJnoh7nRpRAUlwJxHnswMBBOmlzKbf97vD1rMv8Jim8IY0td uRlDdWtVZNcx9L2k9kG+XOVgsZPdj5lrku+VnByFYiaaMBad2rIK65b8MgAhHg== 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 4YXQZ52t8Cz1CHk; Tue, 14 Jan 2025 10:37:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbnUx047893; Tue, 14 Jan 2025 10:37:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbnI4047890; Tue, 14 Jan 2025 10:37:49 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:49 GMT Message-Id: <202501141037.50EAbnI4047890@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0d68985b0170 - main - pfctl: unbreak rule optimizer List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d68985b0170f704ee45dfb6c209cc852870d2c2 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0d68985b0170f704ee45dfb6c209cc852870d2c2 commit 0d68985b0170f704ee45dfb6c209cc852870d2c2 Author: Kristof Provost AuthorDate: 2025-01-07 14:15:15 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:18 +0000 pfctl: unbreak rule optimizer ok henning, looks Obtained from: OpenBSD, mikeb , 4a16887b1b Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/parse.y | 2 +- sbin/pfctl/pfctl_optimize.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 3c34b0237895..ff2e2d2c93b7 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -6179,7 +6179,7 @@ expand_rule(struct pfctl_rule *r, LOOP_THROUGH(struct node_uid, uid, uids, LOOP_THROUGH(struct node_gid, gid, gids, - r->naf = r->af = af; + r->af = af; if (r->rule_flag & PFRULE_AFTO) { assert(nat != NULL); diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index 9858f38b8671..a688fe484128 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -172,6 +172,7 @@ static struct pf_rule_field { PF_RULE_FIELD(dst.port_op, NOMERGE), PF_RULE_FIELD(src.neg, NOMERGE), PF_RULE_FIELD(dst.neg, NOMERGE), + PF_RULE_FIELD(af, NOMERGE), /* These fields can be merged */ PF_RULE_FIELD(src.addr, COMBINED), From nobody Tue Jan 14 10:37:51 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZ82RpPz5kVqd; Tue, 14 Jan 2025 10:37:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZ74zBnz4B8P; Tue, 14 Jan 2025 10:37:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h5K2ueOyYp9saZ/wP0XM71RVNHOnWet3s86aDVIm3ZE=; b=DG7KUI5UnmQHYxuAS6odokBSIA3M7pM2MIutCR4J44Z6D7UEWDl2yridLyfQIVv9Egvs2r r/b4+eBBHS/Frr2g3J5R73kZyJQWltnPYf4RXSKMUKKBqa8B2KZ3b5/RTPcXfl9EWtwvF/ hx8DIsaTn0106K7JHvFPkLVqfG3Qf9jyRNJ8WoyOa/OSNASaWoZ0aJFYJl41vtQisTZcmn s2lO7BH3oiyBJAWwoaRhqL6ex26ZXBK4yCHPr1ai5Bh/m/4ouIJUSfTjWLHezsTVcDRpe+ X0ZyKLc2d5ft1tISQYo0MqEhJrxrJs1GGJhqbIy+5YKTePDkewXaIHspd7tCog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h5K2ueOyYp9saZ/wP0XM71RVNHOnWet3s86aDVIm3ZE=; b=C7xYTHkQhTiGUL0Fo68UA4UlMBNXYYh3kDPfxexj/1wKNqf88wh8mGInnwBIDF2joPNN9c jFinMKHycRX3wAW4y0QdLZ7W8amze1hNFBU2L4OXrUDD68GqJyYF3gc1yShplWb1w6msh5 +eA401X8diBy60HKzxCZ9huYLNqQjZopEFWkdnqQkG2A0t4080eF7w9mAVOeK667rXj+UJ kPz+SL96ekVrFK3dUQB4A958q3LOcdc7QjBWp0Le/ZRZKf9nRtoeMzxxB0FKCC+bu6b8Lu V+DhLAI9XetSliflquxPn80/Kv4hWWHXzBesHFmgASKXX9i1HqY0f8u1gIeWMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851071; a=rsa-sha256; cv=none; b=NEWKijkWgvfFn4+Zo2NYZPEF3PgvonHsW27CepHu2o1MrgGnaA/iOSgETl1b8fgFfX9Nz0 r0oyqZxDwN37a5xy3Qr48XaWVafp7gQbJey4DDUuve4mhDZm5JPb9xsTpSg2BBNqCBt118 oQzrTRpKEACzyRZoE2x75jBllHuOmG0uIySC5rb24pwO6i2Yeyqd/ZNbLeXo1vJvAcxpBm bjvSqjkTWdwEQBDAwscTh8ZNZXi/Kq63ULEbzw0O2mcNELPNORwFCyXFw+7cC9EL9SzlcX NoYD5sUQqUq7nTKp+PmEKWcJGLr/irIeekpPDE8lJOKoFaxb5eWHobjplU3Stg== 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 4YXQZ74ZMlz1CNs; Tue, 14 Jan 2025 10:37:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbpmB048004; Tue, 14 Jan 2025 10:37:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbpQT048001; Tue, 14 Jan 2025 10:37:51 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:51 GMT Message-Id: <202501141037.50EAbpQT048001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: f2a1e40bb19b - main - pf: simplify state key setup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2a1e40bb19b780467beb4ff98dca3f8b30a953d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f2a1e40bb19b780467beb4ff98dca3f8b30a953d commit f2a1e40bb19b780467beb4ff98dca3f8b30a953d Author: Kristof Provost AuthorDate: 2025-01-07 14:21:48 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:18 +0000 pf: simplify state key setup Just use pd->sidx and pd->didx to reverse the state key arguments in pf_test_state_*(). This needs less code and is more consistent. OK mikeb, markus, henning. Obtained from: OpenBSD, mpf , 2c0d332046 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 57 ++++++++++++++--------------------------------------- 1 file changed, 15 insertions(+), 42 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index bee5690e02c4..3d1ba8e8deb4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6900,17 +6900,10 @@ pf_test_state_tcp(struct pf_kstate **state, struct pf_pdesc *pd, bzero(&key, sizeof(key)); key.af = pd->af; key.proto = IPPROTO_TCP; - if (pd->dir == PF_IN) { /* wire side, straight */ - PF_ACPY(&key.addr[0], pd->src, key.af); - PF_ACPY(&key.addr[1], pd->dst, key.af); - key.port[0] = th->th_sport; - key.port[1] = th->th_dport; - } else { /* stack side, reverse */ - PF_ACPY(&key.addr[1], pd->src, key.af); - PF_ACPY(&key.addr[0], pd->dst, key.af); - key.port[1] = th->th_sport; - key.port[0] = th->th_dport; - } + PF_ACPY(&key.addr[pd->sidx], pd->src, key.af); + PF_ACPY(&key.addr[pd->didx], pd->dst, key.af); + key.port[pd->sidx] = th->th_sport; + key.port[pd->didx] = th->th_dport; STATE_LOOKUP(&key, *state, pd); @@ -7010,17 +7003,10 @@ pf_test_state_udp(struct pf_kstate **state, struct pf_pdesc *pd) bzero(&key, sizeof(key)); key.af = pd->af; key.proto = IPPROTO_UDP; - if (pd->dir == PF_IN) { /* wire side, straight */ - PF_ACPY(&key.addr[0], pd->src, key.af); - PF_ACPY(&key.addr[1], pd->dst, key.af); - key.port[0] = uh->uh_sport; - key.port[1] = uh->uh_dport; - } else { /* stack side, reverse */ - PF_ACPY(&key.addr[1], pd->src, key.af); - PF_ACPY(&key.addr[0], pd->dst, key.af); - key.port[1] = uh->uh_sport; - key.port[0] = uh->uh_dport; - } + PF_ACPY(&key.addr[pd->sidx], pd->src, key.af); + PF_ACPY(&key.addr[pd->didx], pd->dst, key.af); + key.port[pd->sidx] = uh->uh_sport; + key.port[pd->didx] = uh->uh_dport; STATE_LOOKUP(&key, *state, pd); @@ -7127,17 +7113,10 @@ pf_test_state_sctp(struct pf_kstate **state, struct pf_pdesc *pd, bzero(&key, sizeof(key)); key.af = pd->af; key.proto = IPPROTO_SCTP; - if (pd->dir == PF_IN) { /* wire side, straight */ - PF_ACPY(&key.addr[0], pd->src, key.af); - PF_ACPY(&key.addr[1], pd->dst, key.af); - key.port[0] = sh->src_port; - key.port[1] = sh->dest_port; - } else { /* stack side, reverse */ - PF_ACPY(&key.addr[1], pd->src, key.af); - PF_ACPY(&key.addr[0], pd->dst, key.af); - key.port[1] = sh->src_port; - key.port[0] = sh->dest_port; - } + PF_ACPY(&key.addr[pd->sidx], pd->src, key.af); + PF_ACPY(&key.addr[pd->didx], pd->dst, key.af); + key.port[pd->sidx] = sh->src_port; + key.port[pd->didx] = sh->dest_port; STATE_LOOKUP(&key, *state, pd); @@ -8670,15 +8649,9 @@ pf_test_state_other(struct pf_kstate **state, struct pf_pdesc *pd) bzero(&key, sizeof(key)); key.af = pd->af; key.proto = pd->proto; - if (pd->dir == PF_IN) { - PF_ACPY(&key.addr[0], pd->src, key.af); - PF_ACPY(&key.addr[1], pd->dst, key.af); - key.port[0] = key.port[1] = 0; - } else { - PF_ACPY(&key.addr[1], pd->src, key.af); - PF_ACPY(&key.addr[0], pd->dst, key.af); - key.port[1] = key.port[0] = 0; - } + PF_ACPY(&key.addr[pd->sidx], pd->src, key.af); + PF_ACPY(&key.addr[pd->didx], pd->dst, key.af); + key.port[0] = key.port[1] = 0; STATE_LOOKUP(&key, *state, pd); From nobody Tue Jan 14 10:37:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZ973Vjz5kVql; Tue, 14 Jan 2025 10:37:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZ86gYSz3C4J; Tue, 14 Jan 2025 10:37:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aQ/2O87bHSHQD/PbaquKUQHX3ThLkW7/d4zOkHdKSgY=; b=eiascFNMAMGyKpJxDgSHz6TEOUNB+hjsXRNrbq9BMFkbEDXCff+YmpwzS1zlJeepsMozqG VLV1j0hR2A52Um5mNK12J+aUYMv6drZdrx0deyeCSbmCEU4xVu6LyVxZATo1z7de8f4NxI C0qJxpROheFZavfmVt2KA7hCguGHTjb5HcPEC8qzK0LC6nVeNi0hCMtmArwZF4CntICE6L Q/frbPSpOlqKj986f8ZhwCxo09EisBYBjsKnpxh1QsThVEIvagOOyOYlLBdX0vGfcX6cOb mbVuTzw5rPkfW5DhZxYkHS1KMDZ1jnkachPC/Ckxm9AvqKKDPrniAdbq6DAQGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aQ/2O87bHSHQD/PbaquKUQHX3ThLkW7/d4zOkHdKSgY=; b=sF8gF/70ymJqzUcItqF4C7im4jF9+RBkk8K/xto9iYIEWCwrXYqrXIs5DIf8nczNdQBn+5 YVnHgKmNDoBliXKwaGyU0xcM+vKw2O/c6ekM2CJ0ES1FLTHEqTclxLhnOHUFaTp17cY0CH GQGbZDk58Lxv2bKVVgH6/HsF/7Z9aPJsNrC9F1D1DALJj/eWU3+BKqZx/IIs6Izz3Sxyes ZVqlYb+TB5INpsLNyV5P9B/eGlELa5bIqe3ZShWp24W/iqp1p+Mp/60bnsvK3aFFZWFJ/f Lq+vPRZ2nv3iU9COWJnexeM8JlkFevvMdPMvrfUAGTMkf731YuuGPOKlmGswzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851073; a=rsa-sha256; cv=none; b=MPBbfUYQ33iyUgLWzB9OyUjFYcDAUG7uKSDLXcBk69K9KWRkvnnhHYi8XWsvawkvAdEbKC MYSMI/Nzm2dcfsZlsJFrTAYul3gFl3yVY49tB/nT+7j1pjb9rpPXktWm9ihKqPmNAqsn7v 5GEpwZfKeVCjGGqk4PxEARvw0oCaMAPw5U6aXMBVuTfxPBTLgs4inuZgbw/cvD8V3S6Cin ZL5rETMNOw91LIF9ngaXbB4T7Ox/3ezda8Mj9Y3echGF0/iQivF+1/uLGkZHQHsNQaJ4QQ rPTm9D/zwa3OkVlxysGZ3hFbdN0/z5vYp8qYBU5PNrtzZyMKWSD9CbGsrUpZXQ== 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 4YXQZ85qTqz1CLS; Tue, 14 Jan 2025 10:37:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbqio048040; Tue, 14 Jan 2025 10:37:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbqc3048037; Tue, 14 Jan 2025 10:37:52 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:52 GMT Message-Id: <202501141037.50EAbqc3048037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 481374d5f7b0 - main - pf: remove pf_remove_fragment() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 481374d5f7b056cd6fbf344238beb70fdae1eabe Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=481374d5f7b056cd6fbf344238beb70fdae1eabe commit 481374d5f7b056cd6fbf344238beb70fdae1eabe Author: Kristof Provost AuthorDate: 2025-01-07 14:46:05 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:18 +0000 pf: remove pf_remove_fragment() Instead of having two functions pf_free_fragment() and pf_remove_fragment() doing more or less the same, merge them into one. Just remove fragment entries from the queue in pf_join_fragment() before they are freed. Then pf_remove_fragment() is not needed anymore. ok henning@ Obtained from: OpenBSD, bluhm , dc8c96a470 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_norm.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 4adace4c92cf..5b34e825203b 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -130,7 +130,6 @@ static RB_GENERATE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare); static void pf_flush_fragments(void); static void pf_free_fragment(struct pf_fragment *); -static void pf_remove_fragment(struct pf_fragment *); static struct pf_frent *pf_create_fragment(u_short *); static int pf_frent_holes(struct pf_frent *frent); @@ -273,7 +272,10 @@ pf_flush_fragments(void) } } -/* Frees the fragments and all associated entries */ +/* + * Remove a fragment from the fragment queue, free its fragment entries, + * and free the fragment itself. + */ static void pf_free_fragment(struct pf_fragment *frag) { @@ -281,16 +283,18 @@ pf_free_fragment(struct pf_fragment *frag) PF_FRAG_ASSERT(); - /* Free all fragments */ - for (frent = TAILQ_FIRST(&frag->fr_queue); frent; - frent = TAILQ_FIRST(&frag->fr_queue)) { + RB_REMOVE(pf_frag_tree, &V_pf_frag_tree, frag); + TAILQ_REMOVE(&V_pf_fragqueue, frag, frag_next); + + /* Free all fragment entries */ + while ((frent = TAILQ_FIRST(&frag->fr_queue)) != NULL) { TAILQ_REMOVE(&frag->fr_queue, frent, fr_next); m_freem(frent->fe_m); uma_zfree(V_pf_frent_z, frent); } - pf_remove_fragment(frag); + uma_zfree(V_pf_frag_z, frag); } static struct pf_fragment * @@ -708,16 +712,16 @@ static struct mbuf * pf_join_fragment(struct pf_fragment *frag) { struct mbuf *m, *m2; - struct pf_frent *frent, *next; + struct pf_frent *frent; frent = TAILQ_FIRST(&frag->fr_queue); - next = TAILQ_NEXT(frent, fr_next); + TAILQ_REMOVE(&frag->fr_queue, frent, fr_next); m = frent->fe_m; m_adj(m, (frent->fe_hdrlen + frent->fe_len) - m->m_pkthdr.len); uma_zfree(V_pf_frent_z, frent); - for (frent = next; frent != NULL; frent = next) { - next = TAILQ_NEXT(frent, fr_next); + while ((frent = TAILQ_FIRST(&frag->fr_queue)) != NULL) { + TAILQ_REMOVE(&frag->fr_queue, frent, fr_next); m2 = frent->fe_m; /* Strip off ip header. */ @@ -730,7 +734,7 @@ pf_join_fragment(struct pf_fragment *frag) } /* Remove from fragment queue. */ - pf_remove_fragment(frag); + pf_free_fragment(frag); return (m); } From nobody Tue Jan 14 10:37:53 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZB5ZdNz5kVqr; Tue, 14 Jan 2025 10:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZB02DCz3ByZ; Tue, 14 Jan 2025 10:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cqAtbaEuRCaOFIKZ8BEb+1sKmWWe8bQbhOqoy9ZFkW0=; b=vvIEH9a9xhnhmtC0avHwjk3iTFiNgemJs2r1Sf4zSxLkYjEa7/d9K8QQvy8YrTOSpd0/rI AKHO/Jn74sWRIzCdb8IoLBKuzevPp1b95gB/AhLtysOmd54Xyh7YIEcHygLOTIplYjNv2b 0e1csn41Z7yLFw+ML8yvJmdvGjym3xv1gMqPpOPrAwZ5NLqerRjsVWFFkMNcbudB7ScJdn EwAL3ZsNBxZgEJPSREszL7tAnfRF7ZF/L26SOve8NTbQ3CaVul00yL7OXLFhCUQMWhyPyA gLCEYvCou2wZyJONcszqxtLcgg2qpvqoYCIm1G57ViDcUUCgzS0QFTk2OaJERQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cqAtbaEuRCaOFIKZ8BEb+1sKmWWe8bQbhOqoy9ZFkW0=; b=WJdEb62CF9J/fX5PxTBnKXU+3TxMr7z/ReG10GQsxK8GLpbkZAJ8xgavxUyeOa1ghlYRgB /iDheskLzBl11mXAfNAVOP7i0Bpkfgp4OI+4vSoADffshxN9n1JAvTmRYs1Ank8T8uaSBf mYZyZIneRXApRaUZ+9O9Ab6zDWOQG0FpraMoUVijnvty8gAwdQ0mIA0jG2Mu82eVk7RnS/ QNYK5N+80mbRI6V3CqAX2hxBm2Wp7c9HrSI316Y7nuCfLk8IN2CqpyB5/6UrCO0nnN20Yn 1s1GVW2eQb9wKLCT7xToatYztapXdbWKWxPwy5tCho10LBTtE6Pt1mqxLgZ7dQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851074; a=rsa-sha256; cv=none; b=Dt6fn1tGIBjAOKHAC1ydjn/jDlRHZVlnhQM4oAaiP1/QuAYlsN2zZ7Oh2HyJjBZkX/Rl0F CBfSTTTWLxvAGjirtCt/WxJVL/Kw2F/g8380C6ocDoGCJ3CIxWxvho2UuQKowIK+46UVVe +6SrSmP0deMyL/4Z3l4fdXlQ6Gdwl1USVDpTtVB4upf5sR7aksRMSvFNRNvX9+xLK3BDGy CTm4M6xcJpJ0HRnKWIS1i+Tz8rxbpkwIy6s1dwCOBy35YcxCC50Xl3sox0NUpFLjcwVrfO CRO19eWQoD/E09LAYauRYM8zlvBeNrC8YP+Vc2jo3ZpnT3SeJ6ZfRMKuxUJy6g== 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 4YXQZ96cwrz1Brh; Tue, 14 Jan 2025 10:37:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbrEx048094; Tue, 14 Jan 2025 10:37:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbram048092; Tue, 14 Jan 2025 10:37:53 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:53 GMT Message-Id: <202501141037.50EAbram048092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: b6a5e2213938 - main - pf.conf.5: make "self" a bit more visible List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b6a5e221393826d7dc89060c6b52c78ed1f0d313 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b6a5e221393826d7dc89060c6b52c78ed1f0d313 commit b6a5e221393826d7dc89060c6b52c78ed1f0d313 Author: Kristof Provost AuthorDate: 2025-01-07 14:48:43 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:19 +0000 pf.conf.5: make "self" a bit more visible from Sebastian Benoit , ok/input jmc, reminder/input deraadt and too much of a trail to mention all of it, thx everybody involved Obtained from: OpenBSD, henning , 682c71ec7c Sponsored by: Rubicon Communications, LLC ("Netgate") --- share/man/man5/pf.conf.5 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 138fb5e7f82b..6229a49eccc1 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -27,7 +27,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 6, 2024 +.Dd January 7, 2025 .Dt PF.CONF 5 .Os .Sh NAME @@ -1809,6 +1809,8 @@ Any address which is not currently routable. Any source address that fails a unicast reverse path forwarding (URPF) check, i.e. packets coming in on an interface other than that which holds the route back to the packet's source address. +.It Ar self +Expands to all addresses assigned to all interfaces. .It Aq Ar table Any address that matches the given table. .El @@ -1821,7 +1823,9 @@ For instance: means all addresses from 10.1.1.10 to 10.1.1.12, hence addresses 10.1.1.10, 10.1.1.11, and 10.1.1.12. .Pp -Interface names and interface group names can have modifiers appended: +Interface names and interface group names, and +.Ar self +can have modifiers appended: .Pp .Bl -tag -width xxxxxxxxxxxx -compact .It Ar :network From nobody Tue Jan 14 10:37:54 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZC3Wd5z5kVfr; Tue, 14 Jan 2025 10:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZC0gb3z3C6K; Tue, 14 Jan 2025 10:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GjqkS0d5k9ld0eZS/a2Hbitae24LxgV1aeiIyzwRQnE=; b=EUM8ON/03wKWPYxXbB9ZdomOt7ObOHe5W+cUicypoDVo/nWXdCrTYmdflC8cd6UEoZgyd2 2xALHJrZNm1NUIGnoZcQYz/83I8JqrHr8DV5gY+UTRLNWjiyvcEpR22oVbu4V2pApd8jdu UbfDv99tXvPXypl5NwupMuOECattMHlPgw6Stegh4mKyHaWikXSvQr6uUG0hymZHF9HJct Nmg3wuGJi6FstStUjjigdqJgqB4JbwfBZIYS9CnVWYZHLm3rjw5aAik6XRWDle5QJHPho6 JTcbwHBIR9+b7w6iQIJR+p6pOjYFsEd60P5o2F6DMXd2UpatVJ5Up05pRF3IFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GjqkS0d5k9ld0eZS/a2Hbitae24LxgV1aeiIyzwRQnE=; b=r25sWsA0or5UnfoeP8ovxsaNERwDLUoKJjfQdoNOjYojmst7AWn1B4VSBg+o3/n2HQnva0 4PNtHf1t9eiQCFhP9VcuY3fIYsOGkvk1uz50Vczwzs6R3knHBR6x4rFRD5RJixRRjSPMZJ 62QUAsW5xPdZt3AKQrKgXwlJcL4XIyVed2T4yalkKZ41RE54e/obErHezItiB7gQJikfcD a4LV8cofBW6tsrirlvpiMffr15sPT/8HrxkZ9xpGocO900Q9ELFQHmFz7/PyAqygjhFPC8 UgoACiwqwQ7HKHBXx1FUe+qOXactMvgHREQYecZwyE2KBwkbBalOZ+x/nU+sSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851075; a=rsa-sha256; cv=none; b=fMVSyl6VNJuj3wzmgmUtbdaG/uPyy8Y3DyEbgXSSWgnJdLANDKRUViv7VPxZPabkpRaZD5 Xslz3W+XKKgLn8OBkCedpwSSG5sXhPCZLGJHnJRzS0YCmwkgPRVlrz+pVYG5MeR3VDF5Pu epXwr/fiTrlvSZSPpTUwKthYQAu3CT2xRwUjUIsTembS3I6rCF8rGEUUl4kGE8F1TNmVJd y2+ei5pEE4TOgV92FF5mG6YgEAeGxuuvZW2zd1Si1eGlzzKlHelvFlKvj7J7qg7ggpLz69 feNjxZfzsmp0EzHELGzGa9VrK2nLuBOPhIRewA9y8scZ6C+z+nk5Qr3XaDy/Eg== 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 4YXQZC0GRMz1CLT; Tue, 14 Jan 2025 10:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbsQU048154; Tue, 14 Jan 2025 10:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbs1r048151; Tue, 14 Jan 2025 10:37:54 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:54 GMT Message-Id: <202501141037.50EAbs1r048151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 6a3266f72e43 - main - pf: drop IPv6 packets built from overlapping fragments in pf reassembly List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a3266f72e437aecf3edcfb8aa919466b270d548 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6a3266f72e437aecf3edcfb8aa919466b270d548 commit 6a3266f72e437aecf3edcfb8aa919466b270d548 Author: Kristof Provost AuthorDate: 2025-01-08 13:34:22 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:19 +0000 pf: drop IPv6 packets built from overlapping fragments in pf reassembly The reassembly state will be dropped after timeout, all related fragments are dropped until that. This is conforming to RFC 5722. - Sort pf_fragment fields while there. - If the fr_queue is empty, we had overlapping fragments, don't add new ones. - If we detect overlapping IPv6 fragments, flush the fr_queue and drop all fragments immediately. - Rearrange debug output, to make clear what happens. - An IPv4 fragment that is totaly overlapped does not inclease the bad fragment counter. - Put an KASSERT into pf_isfull_fragment() to make sure that the fr_queue is never emtpy there. discussed with Fernando Gont; ok henning@ Obtained from: OpenBSD, bluhm , 8b45f36762 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_norm.c | 46 +++++++++++++++++++++++++++++++++++-------- tests/sys/netpfil/pf/frag6.py | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 8 deletions(-) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 5b34e825203b..45e56edc34fe 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -98,9 +98,9 @@ struct pf_fragment { RB_ENTRY(pf_fragment) fr_entry; TAILQ_ENTRY(pf_fragment) frag_next; uint32_t fr_timeout; + TAILQ_HEAD(pf_fragq, pf_frent) fr_queue; uint16_t fr_maxlen; /* maximum length of single fragment */ u_int16_t fr_holes; /* number of holes in the queue */ - TAILQ_HEAD(pf_fragq, pf_frent) fr_queue; }; VNET_DEFINE_STATIC(struct mtx, pf_frag_mtx); @@ -593,9 +593,9 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, memset(frag->fr_firstoff, 0, sizeof(frag->fr_firstoff)); memset(frag->fr_entries, 0, sizeof(frag->fr_entries)); frag->fr_timeout = time_uptime; + TAILQ_INIT(&frag->fr_queue); frag->fr_maxlen = frent->fe_len; frag->fr_holes = 1; - TAILQ_INIT(&frag->fr_queue); RB_INSERT(pf_frag_tree, &V_pf_frag_tree, frag); TAILQ_INSERT_HEAD(&V_pf_fragqueue, frag, frag_next); @@ -606,7 +606,15 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, return (frag); } - KASSERT(!TAILQ_EMPTY(&frag->fr_queue), ("!TAILQ_EMPTY()->fr_queue")); + if (TAILQ_EMPTY(&frag->fr_queue)) { + /* + * Overlapping IPv6 fragments have been detected. Do not + * reassemble packet but also drop future fragments. + * This will be done for this ident/src/dst combination + * until fragment queue timeout. + */ + goto drop_fragment; + } /* Remember maximum fragment len for refragmentation. */ if (frent->fe_len > frag->fr_maxlen) @@ -642,10 +650,15 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, if (prev != NULL && prev->fe_off + prev->fe_len > frent->fe_off) { uint16_t precut; + if (frag->fr_af == AF_INET6) + goto flush_fragentries; + precut = prev->fe_off + prev->fe_len - frent->fe_off; - if (precut >= frent->fe_len) - goto bad_fragment; - DPFPRINTF(("overlap -%d\n", precut)); + if (precut >= frent->fe_len) { + DPFPRINTF(("new frag overlapped\n")); + goto drop_fragment; + } + DPFPRINTF(("frag head overlap %d\n", precut)); m_adj(frent->fe_m, precut); frent->fe_off += precut; frent->fe_len -= precut; @@ -664,7 +677,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, after->fe_len -= aftercut; new_index = pf_frent_index(after); if (old_index != new_index) { - DPFPRINTF(("frag index %d, new %d", + DPFPRINTF(("frag index %d, new %d\n", old_index, new_index)); /* Fragment switched queue as fe_off changed */ after->fe_off -= aftercut; @@ -676,7 +689,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, /* Insert into correct queue */ if (pf_frent_insert(frag, after, prev)) { DPFPRINTF( - ("fragment requeue limit exceeded")); + ("fragment requeue limit exceeded\n")); m_freem(after->fe_m); uma_zfree(V_pf_frent_z, after); /* There is not way to recover */ @@ -687,6 +700,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, } /* This fragment is completely overlapped, lose it. */ + DPFPRINTF(("old frag overlapped\n")); next = TAILQ_NEXT(after, fr_next); pf_frent_remove(frag, after); m_freem(after->fe_m); @@ -701,6 +715,22 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, return (frag); +flush_fragentries: + /* + * RFC5722: When reassembling an IPv6 datagram, if one or + * more its constituent fragments is determined to be an + * overlapping fragment, the entire datagram (and any constituent + * fragments, including those not yet received) MUST be + * silently discarded. + */ + DPFPRINTF(("flush overlapping fragments\n")); + while ((prev = TAILQ_FIRST(&frag->fr_queue)) != NULL) { + TAILQ_REMOVE(&frag->fr_queue, prev, fr_next); + + m_freem(prev->fe_m); + uma_zfree(V_pf_frent_z, prev); + } + bad_fragment: REASON_SET(reason, PFRES_FRAG); drop_fragment: diff --git a/tests/sys/netpfil/pf/frag6.py b/tests/sys/netpfil/pf/frag6.py index 28b1829d418c..f54381fba8cb 100644 --- a/tests/sys/netpfil/pf/frag6.py +++ b/tests/sys/netpfil/pf/frag6.py @@ -58,3 +58,47 @@ class TestFrag6(VnetTestTemplate): timeout=3) for p in packets: assert not p.getlayer(sp.ICMPv6EchoReply) + +class TestFrag6_Overlap(VnetTestTemplate): + REQUIRED_MODULES = ["pf"] + TOPOLOGY = { + "vnet1": {"ifaces": ["if1"]}, + "vnet2": {"ifaces": ["if1"]}, + "if1": {"prefixes6": [("2001:db8::1/64", "2001:db8::2/64")]}, + } + + def vnet2_handler(self, vnet): + ToolsHelper.print_output("/sbin/pfctl -e") + ToolsHelper.print_output("/sbin/pfctl -x loud") + ToolsHelper.pf_rules([ + "scrub fragment reassemble", + "pass", + ]) + + @pytest.mark.require_user("root") + def test_overlap(self): + "Ensure we discard packets with overlapping fragments" + + # Import in the correct vnet, so at to not confuse Scapy + import scapy.all as sp + + packet = sp.IPv6(src="2001:db8::1", dst="2001:db8::2") \ + / sp.ICMPv6EchoRequest(data=sp.raw(bytes.fromhex('f00f') * 90)) + frags = sp.fragment6(packet, 128) + assert len(frags) == 3 + + f = frags[0].getlayer(sp.IPv6ExtHdrFragment) + # Fragment with overlap + overlap = sp.IPv6(src="2001:db8::1", dst="2001:db8::2") \ + / sp.IPv6ExtHdrFragment(offset = 4, m = 1, id = f.id, nh = f.nh) \ + / sp.raw(bytes.fromhex('f00f') * 4) + frags = [ frags[0], frags[1], overlap, frags[2] ] + + # Delay the send so the sniffer is running when we transmit. + s = DelayedSend(frags) + + packets = sp.sniff(iface=self.vnet.iface_alias_map["if1"].name, + timeout=3) + for p in packets: + p.show() + assert not p.getlayer(sp.ICMPv6EchoReply) From nobody Tue Jan 14 10:37:56 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZD400Kz5kVnV; Tue, 14 Jan 2025 10:37:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZD1sfpz3Bx2; Tue, 14 Jan 2025 10:37:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KAYi/LY3R8BwPUX8ECpAdeFWmpzzFTRnrVSiUE6Ty4M=; b=WC2TdDBdP17JQvNSaJ+2msMZAcrbmvb3abE2ovZ31huL0qtfilQm6znI6848P+iNps0wSW gRl+mkIa1NFBaTHXrtfT+a9yUsQ6bxfmMgCJ5PaFmvrZpQrMzK/iLUNrfQyEbwkLBVMOp/ UkQ1pmbCjuTz7OA4QabL9aEsqrl2DaHPbVE4bbvXvjBbw+YMK8xzIpGk5guwkHovHUbSqy 0BNewmqJHes/mMHrnwMcCaGjEBk83YlUpaat0qYsqAb+iHFwG+Mn8jZcxN8VvNhBi1Jnp9 4FJKC0ejOwHlMQR5T2MkM8t94WqbrvwnCWjy0YqvuKhhnk2JJw5VJ9e8LlI9+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KAYi/LY3R8BwPUX8ECpAdeFWmpzzFTRnrVSiUE6Ty4M=; b=M9fQtgRoOJBdp4tBCRpK4zYEcfKh8MhkIkvkmJfA71sV3yLgNI2dk9K9LCmRm10BsIr6D4 5bVtN8MrX4ZQ8prSoT+FAR76ioMH5siXG73k1kDbnfIKzE425hVqE0GVyZ+HQuA0SLEzxk yNWy+z+C7gPfvv0NKE3PPskQwwPzuGR9YGfCLWP2CveKWjDcibk/PCLxvpPPaj7PhpFZp3 ZDbia4AB/cs/ECCCqsBJtXGajxomkQvaAETBZfg/JIfgZj1VhEmNgvUou3Mn1eWzGmfgEb lSbfFc9++R5mAywEZBlvw68TfPNX4M8pJRxXrf/ZS8/cqiovfK4AYCqn05urAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851076; a=rsa-sha256; cv=none; b=o15H4Wcgk9JrnVlJqOc/+C1gMa/q+0osw8bXtGLsJbP+4ZpEX5Pxw7qX3FpYfszzHqqBs+ v+YosavMyPsZ+/hq2btokwcUT6ljTPS4wHo0pMj5mrVkWhBQyTLqk3aw/H9m8cQ2kHfkDV HIKlX02atVMYUcPJPqdsPeZApLjuNeU0fBm8Ua1K9Cg/Q5RNSsYy697atcMTG2eII4ca1c bUt4Fu1i5iGSZAQ9DKHy3R/qBP27we7PV/tD+Ira831rBdeXdgcdNfMuLWRdl7bt8EIwU0 qw2tmwge091tLgoGZWlOCkdJVdB9zNT8U8X/hjHibtGmBv+W9f2+uyKVwQ3uhQ== 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 4YXQZD1Dxqz1BqT; Tue, 14 Jan 2025 10:37:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbug7048199; Tue, 14 Jan 2025 10:37:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbuZj048196; Tue, 14 Jan 2025 10:37:56 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:56 GMT Message-Id: <202501141037.50EAbuZj048196@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a8136ab47c97 - main - pfctl: convert an snprintf to strlcpy List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8136ab47c97d470b39246b53a64ebbe76f5413f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a8136ab47c97d470b39246b53a64ebbe76f5413f commit a8136ab47c97d470b39246b53a64ebbe76f5413f Author: Kristof Provost AuthorDate: 2025-01-09 09:23:23 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:19 +0000 pfctl: convert an snprintf to strlcpy ok mikeb henning Obtained from: OpenBSD, dhill , a592d7cf61 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 4b2a69f456a2..ca374ca3295d 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1234,7 +1234,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, if (anchorname[0] == '/') { if ((npath = calloc(1, MAXPATHLEN)) == NULL) errx(1, "pfctl_rules: calloc"); - snprintf(npath, MAXPATHLEN, "%s", anchorname); + strlcpy(npath, anchorname, MAXPATHLEN); } else { if (path[0]) snprintf(&path[len], MAXPATHLEN - len, "/%s", anchorname); From nobody Tue Jan 14 10:37:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZF75Zwz5kVnc; Tue, 14 Jan 2025 10:37:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZF2G07z3C6k; Tue, 14 Jan 2025 10:37:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WaHNjP1EO0ykkgcPKgKxqjLtYYx9brvputcoYcWvYKk=; b=cQUSelE+4ocDIPN5a45RMp+49Tb+bNMwyuGKxMdspL3cQ9Sdw1FpyufvL0TPpJYzcDCt0A GRkGesxagIKPpCjL6f8cuQS7e3MlnzQtqamn8kcK0ypDgfWCdybzxGDqNs5Tf+GYvVfvQX oiRuTPaHXQ7e/tkO7jBTt4OjBv2RYVYFK0qoPWxThslmJuMl2Hoh8D/lUUgh0JmI4NOAAc Gv1fisghGYvvhnl/ZwCYfQquZmafqe72D1KabBBfwuRUEpPw5613nBTxVOZ2bKhpJU7VpM Bs96KNQwD3HX169TuZHe54mhmGF9EGgkwNjGsXT6ZKxJSCEWuklQk4q2/A5UCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WaHNjP1EO0ykkgcPKgKxqjLtYYx9brvputcoYcWvYKk=; b=j9CNCBMtYgXgT27AHM/eo6ZD282Bdp0t+reoZs3f3qQSAs/Sd6NLeeYrmREl0jlWQ7ATqU 2EHH8+qQkWBkysFIdQdfJYhnJPRrvGIL0oYpnFlIb/hOklSf98GsLWKf5F1o9TWtQdH0Q/ JMwrPnKtUMG9YLSJ3imfk9yvA/lRJbGXi1LJK3l921gJd90vDocD8C/K+yp+Buv1Btjz69 PhW2JuWzczJJaQzxg7241pxDCuRsFIBWR1Ex9P9sFPhpmcmaizL0HrWyP9RT86uO8r1sOd Hi1VSKO9yg+oKHKwko2WWg1gR1xqO46ygvbQCIeBvNeZQuKvo49lFDF7YRe+Yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851077; a=rsa-sha256; cv=none; b=pQixcDVN++xDs2YkCYqZj0nPYo2dap/kxi5BHNq0XIdzt3i+zb4LXLAxIons41MM56h5at 1Pnv+kfvR4eTHQeMTc9aLPM0QxfD5dygCVlHamQ8X6qByyg7+a61Wmzl87sX4+AEaK31BI k0sKkOhf7oA60IFm/3aRml3T0aNF0jbUAUHn69RF6avEUnKUpvsX+9MmTA62oaoHyUDNal kffjV1WVjWZLv3k3BSVbVUajAQ5Zi10BFeFXkIg2yWGE0stqxxJGna8V2ND1Dg84BxV0ij 01aLYTCRsAkNoxc2u0j3/FKTAmNkGPQ3GnhQT08waCK+cdDMItTAcWzMzlfO6g== 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 4YXQZF1rM1z1CHl; Tue, 14 Jan 2025 10:37:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbvIt048246; Tue, 14 Jan 2025 10:37:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbv0Z048243; Tue, 14 Jan 2025 10:37:57 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:57 GMT Message-Id: <202501141037.50EAbv0Z048243@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0300b49ac821 - main - pf.conf.5: fix description for tcp.opening timeout List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0300b49ac821f6b7e273fb936fa50aefbddb5129 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0300b49ac821f6b7e273fb936fa50aefbddb5129 commit 0300b49ac821f6b7e273fb936fa50aefbddb5129 Author: Kristof Provost AuthorDate: 2025-01-09 09:39:01 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:19 +0000 pf.conf.5: fix description for tcp.opening timeout Issue reported by Felix Rust; ok jmc@ Obtained from: OpenBSD, bluhm , 9278cfc6cf Sponsored by: Rubicon Communications, LLC ("Netgate") --- share/man/man5/pf.conf.5 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 6229a49eccc1..7e2c96c07473 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -27,7 +27,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 7, 2025 +.Dd January 9, 2025 .Dt PF.CONF 5 .Os .Sh NAME @@ -265,7 +265,8 @@ firewall at the risk of dropping valid idle connections. .It Ar tcp.first The state after the first packet. .It Ar tcp.opening -The state before the destination host ever sends a packet. +The state after the second packet but before both endpoints have +acknowledged the connection. .It Ar tcp.established The fully established state. .It Ar tcp.closing From nobody Tue Jan 14 10:38:00 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZK49V2z5kVwS; Tue, 14 Jan 2025 10:38: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZJ5fKkz3BrX; Tue, 14 Jan 2025 10:38:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8A1T5i2+oJayEIsJKK3NCP4x35vJnDsFZ+KFGmpL+Bg=; b=xdd/Npz+ZHCYdXkllVeOxqGhZZXolgihwmWKAkQB0f14+yT0FaCplWDm4DSp5a88GQ5Z22 BGWuL0y9FwKFpTRHvpI3PCjYrPos/A3cIT8oNigffjMsjhM2ALWCFev8tqNcU5uFi9YBiB zVadXtqSOhv8KUsdjFj+W2ZaZaaPtQi7LmT8/U2ehED7xoYUqWKSlPf3XmSfsIu1z3VvKR ztncHULFc4+jLrzgO7RxIgjbb390ktReGdyKpU4Ontiq6sfT6CzuzqbS+p2rJlac8kDz/p i9c1hSEahAr0l6AwJtJs6/aR7pt5AGghTA+IY9Y+BQBMmK6dI3yTfo92tzELEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8A1T5i2+oJayEIsJKK3NCP4x35vJnDsFZ+KFGmpL+Bg=; b=XlMFL8UR+MtIetJS36TmNqqxkogJ5F7i1fOnkkdTUO+wdU9KqjwuOcbPebjno48AhYJ7iB H6gMyp1fPYPuUrS/FEg5wfCZV5JgzjTcLOvJ60g3a6FPIUnv3urRQUp2Cnl1kGySVYpOSO I/8Ym50adn8b9FNc3DTbTDCvs9se+mclX6Gu5h3NeYGsaexOK1SWGIYPGq4VMzrsM5lS7P 0Z6oWzXBkjt4RXUWO/ffzpFGQ3tx6iPAHPCYD4htAzGAwsICKDT1y/h6dbETuRESNb6p93 KlAs8Lr9pOLdy9CWSPqCrMBvHk3MH7o8EwxJmF3OygzZkKg85uaX5jtDhjxyug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851080; a=rsa-sha256; cv=none; b=B7MjuyvRL2E889rI/adzy8c4lkm2x1iqhpahfjlfhYYplakTLN1bdeNRoGEWi43U8eu5SW jBR1TvT1rYxR9whcLdHmYs6hvh+ovb2f5siqhCNMXS6oz916mLl65H9y1dBSP63xv2X+AX TFFIzfpBjwpwBt0ULpujSARK5FkTbLPx2VSteUcsaXhPtzGmUvx2HW5MGpjRIqyBwGuXFt YGMXK13hEWyz2usAGwwdDN4OYesFEKUmpYcrABuH2r+vdpuY21qaAt50lA93yV4QpuwzBD vVpJy4szIHl3GZ/QovjgACE4lL3PhMJwYZ0MkrazWQZKA/MXQejeVcSxy0DRgA== 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 4YXQZJ4xx0z1BC3; Tue, 14 Jan 2025 10:38: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 50EAc0Vw048418; Tue, 14 Jan 2025 10:38:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAc047048415; Tue, 14 Jan 2025 10:38:00 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:38:00 GMT Message-Id: <202501141038.50EAc047048415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d90854a60a91 - main - pf: reset index if it's outside the table List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d90854a60a919fc574d1786486f85394f53ce2dd Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d90854a60a919fc574d1786486f85394f53ce2dd commit d90854a60a919fc574d1786486f85394f53ce2dd Author: Kristof Provost AuthorDate: 2025-01-09 13:31:22 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:20 +0000 pf: reset index if it's outside the table when table content changes we need to reset index to the initial value and do not use the counter; reported by Sebastian Benoit and Daniel Krambrock, tested by Sebastian Benoit, ok henning zinke Obtained from: OpenBSD, mikeb , dba347c9d1 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_table.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index 35c9bd4ab655..03efa0b738da 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -2269,10 +2269,10 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter, return (-1); idx = *pidx; - if (idx >= 0) - use_counter = 1; - if (idx < 0) + if (idx < 0 || idx >= kt->pfrkt_cnt) idx = 0; + else if (counter != NULL) + use_counter = 1; startidx = idx; _next_block: From nobody Tue Jan 14 10:37:59 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZJ2zKGz5kVNF; Tue, 14 Jan 2025 10:38:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZH4G2zz3BxZ; Tue, 14 Jan 2025 10:37:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l2zeX2ajslPsJk2/IHwO9J/r8ELFeEtSY+ZDAPsW+EM=; b=bIr+YUQcDrP2+fxs1sHy7/LWCUvP1IhUrGW9+0a/5CRvrvN+ON8b5RDWEixHMXzdV35kTa 9rSejGrYaj/jj07pZOZTA48VbnqEb0Qk56nqZKsqwlrozh9PdN0wdb5Xfh0lDxrCC61QFJ HPPBy2mfpF02G2kZhx2JB2Jsh1BKfwjHDK/VaekQ16D3BeLSgCQRMBoiCCfFQWHzK1Htc2 bzf2vdmKC+6jVutzQ8E/HiU2jAfANPlcUsB/XZpNh0JiN7wIv2Mzk3N/OhC/wtCLnhOU80 NLL+tFmmqz1w51sVRU0QIkPMza8ZFkI0def2MVzy9COHyHqYuCsGHMjGop4Mpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l2zeX2ajslPsJk2/IHwO9J/r8ELFeEtSY+ZDAPsW+EM=; b=g2bL8nHrXwW+LFZwd3Jpu/prNe8vjeLdC7dAo7LG7LHyW01NAHt+CpBxf6bYrfSAMSnhw4 +ooYjTNxFMGvZS0bg+cLSodqhfDFhRcVQ0maDlJ6WxH7J3llO/aigIwlF3yV+MZ4Jd0gdH 38jLiRLfuwP1wRSCFo6tH/r3shQnFR8cOOGZbvvfWpxLFl9HPrGrf8hTmpCRrSfiiD+Nla Tr08SKBaqoNg92M2/ZNtuzW8FoUCQS4+VcLAtGx7WC7fbCDlpOchYdT4YHs0k2tlGyN1wB sfrLXrGaDweL9YWTlNBpCk5lcZhI9G4QAFkH4Ll/NaZKHtRVzjRGj63PtJZ5gw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851079; a=rsa-sha256; cv=none; b=cnXzP95XIcWwGUFrOPBhiv+HvgFtttD7JKAoH3ajfMUlDZcWmOrFYwBPAAsKI41eB5FDfP Z0TJVJL8DvPD/k5tW2QkmYXETK8/cZlr3XIhJUjb5crXpl+IgiFyE9Qntmd+3mciPuAuOO bKqjQ7aBtzOqyi0w65eHS2O092/T9+Ncj1ajh6sOO1eme3wptXxI+c3Vap82joNPNAuCRh tXqBpkdzNpqpC12VgoZ3WZpKZsKFr5tYewsxPPanhMTF5d5j52BQ3nXmZvuBeJILw8yoji gj/Vnyv1Xrq7964C6L2R/pI2gwutWiapbmm6B26yJhXLkaIZJ3zah+PxvETBKQ== 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 4YXQZH3sSXz1C6W; Tue, 14 Jan 2025 10:37: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 50EAbxjZ048360; Tue, 14 Jan 2025 10:37:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbxUL048357; Tue, 14 Jan 2025 10:37:59 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:59 GMT Message-Id: <202501141037.50EAbxUL048357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 3b79f6d2d394 - main - pf: do not keep state when dropping overlapping IPv6 fragments List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b79f6d2d39405bcac395dc036ceb6f8fd09ce99 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3b79f6d2d39405bcac395dc036ceb6f8fd09ce99 commit 3b79f6d2d39405bcac395dc036ceb6f8fd09ce99 Author: Kristof Provost AuthorDate: 2025-01-09 13:11:11 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:20 +0000 pf: do not keep state when dropping overlapping IPv6 fragments ok sperreault@ Obtained from: OpenBSD, bluhm , cd45765685 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_norm.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 45e56edc34fe..9f1eaf7c4d76 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -606,15 +606,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, return (frag); } - if (TAILQ_EMPTY(&frag->fr_queue)) { - /* - * Overlapping IPv6 fragments have been detected. Do not - * reassemble packet but also drop future fragments. - * This will be done for this ident/src/dst combination - * until fragment queue timeout. - */ - goto drop_fragment; - } + KASSERT(!TAILQ_EMPTY(&frag->fr_queue), ("!TAILQ_EMPTY()->fr_queue")); /* Remember maximum fragment len for refragmentation. */ if (frent->fe_len > frag->fr_maxlen) @@ -651,7 +643,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, uint16_t precut; if (frag->fr_af == AF_INET6) - goto flush_fragentries; + goto free_fragment; precut = prev->fe_off + prev->fe_len - frent->fe_off; if (precut >= frent->fe_len) { @@ -715,21 +707,15 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, return (frag); -flush_fragentries: +free_fragment: /* - * RFC5722: When reassembling an IPv6 datagram, if one or - * more its constituent fragments is determined to be an - * overlapping fragment, the entire datagram (and any constituent - * fragments, including those not yet received) MUST be - * silently discarded. + * RFC 5722, Errata 3089: When reassembling an IPv6 datagram, if one + * or more its constituent fragments is determined to be an overlapping + * fragment, the entire datagram (and any constituent fragments) MUST + * be silently discarded. */ DPFPRINTF(("flush overlapping fragments\n")); - while ((prev = TAILQ_FIRST(&frag->fr_queue)) != NULL) { - TAILQ_REMOVE(&frag->fr_queue, prev, fr_next); - - m_freem(prev->fe_m); - uma_zfree(V_pf_frent_z, prev); - } + pf_free_fragment(frag); bad_fragment: REASON_SET(reason, PFRES_FRAG); From nobody Tue Jan 14 10:38:01 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZL44ccz5kVck; Tue, 14 Jan 2025 10:38: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZK6hSnz3Brc; Tue, 14 Jan 2025 10:38:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1dzz0sw2k5+YrCMEkrz6QPKgKVoup/g0ySasA71BpNI=; b=s3tHRszGUyzbashVbxwjzIHKQEK8MEEdTxKyKT6xx9gfShxJjAExkDWRV5RQ6Vrlb85AyM bOpn2BuhaTzQFKi9BkgMk+ev02F35iNXhkOkr6egcrikyw8ixcW6Hga5QCPaUjWUlfCcao KZjMBPqF4Z9t2pP++QumdTVrshbv7ownlz+HB8ImzLtNqh8Fu+naOCexjBkaKOEUvXIQXR YeuIUAHn4ypxBNY1DSqOpXKabZciaMz3lXp7D9w7q4LdXoNXVWe29/t1YmQdor9f1wgG8k ap0MY2CPBoEZmxKLLr9VSJSjXl2jOA6nrHAauE44oTsTMg+yeXUzSihdpbjS1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1dzz0sw2k5+YrCMEkrz6QPKgKVoup/g0ySasA71BpNI=; b=leeiYsJkKr1K+F2Tt7OWPceNn+7t5b2wiZQjcUv+auV6HHpE9jy5s7rUijnEGl32pNBxRy YwFITuh/Sq4m9id6/YfHbCr3gdyoNut6FXBsiYVDI5n6aYPrvUhhHsl8THlyGFghbU+q0+ otUE3h2UILbQ4bh8a8vYO7PfzDINWru9UnStXpnIhXDFc84FMuZOqnLSJOA1M/i7uPzKhE yS26XFegAZ8i5NokVLtMzWXi5ZJZ2O+1UpExmfqL5NNru+DlVjoAExv831HND1Gy9MjVDD gEyX9y14SDJ5zyOdfmMIJ01RZd1SISG1Hd5NgxM86fQEEzswd68TrGRIuXNjYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851082; a=rsa-sha256; cv=none; b=hBnY4H3guGZY7gAEkxlA1AU8KBOBJzcbpViZDBxDOhJQM14EFbi+YhCI3xmDggn2UytqeG iPzjZCaYiw5ZTUviTxzKWY8FElphKaNbWtZE5NUShMSqBv6ic3llqpwh0YB/jxUykqNnB3 RabYYnDG3uTbocr6M09KtB87tzm7llp6ZaBLZyQxZmBqgcAhu3Y4kisyZRZU9NUHQqBwHM uHih4bemR+WtOznx0zyZBSJyux/1eoxqroncn0B9rAyEGSkwe5NUHzDSLKZg/qKX9is8Xj ELZ1lbodoGk4t9egBM/4C75kbJi95lzmnbgZ9l0U9Ds3RaAqlyLG+qUO4Jkkvw== 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 4YXQZK65y2z1C6X; Tue, 14 Jan 2025 10:38:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAc1cA048462; Tue, 14 Jan 2025 10:38:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAc1ui048459; Tue, 14 Jan 2025 10:38:01 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:38:01 GMT Message-Id: <202501141038.50EAc1ui048459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5466aca1536e - main - pf: minor fixes for pf_walk_header6() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5466aca1536e45b2d327ff9ae232700ea01f30e8 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5466aca1536e45b2d327ff9ae232700ea01f30e8 commit 5466aca1536e45b2d327ff9ae232700ea01f30e8 Author: Kristof Provost AuthorDate: 2025-01-09 13:39:20 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:20 +0000 pf: minor fixes for pf_walk_header6() - Fragment offset is in network byte order. - Check for legal short fragments before calling pf_pull_hdr() to avoid bogus reason accounting. - When checking wether the protocol header is within the fragment, count the IPv6 payload length relative to the end of the IPv6 header. ok henning@ Obtained from: OpenBSD, bluhm , 3230e62590 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 11b6be239ca7..053b0b2ccb31 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -9720,9 +9720,11 @@ pf_walk_header6(struct pf_pdesc *pd, struct ip6_hdr *h, u_short *reason) struct ip6_frag frag; struct ip6_ext ext; struct ip6_rthdr rthdr; + uint32_t end; int rthdr_cnt = 0; pd->off += sizeof(struct ip6_hdr); + end = pd->off + ntohs(h->ip6_plen); pd->fragoff = pd->extoff = pd->jumbolen = 0; pd->proto = h->ip6_nxt; for (;;) { @@ -9746,7 +9748,7 @@ pf_walk_header6(struct pf_pdesc *pd, struct ip6_hdr *h, u_short *reason) } pd->fragoff = pd->off; /* stop walking over non initial fragments */ - if ((frag.ip6f_offlg & IP6F_OFF_MASK) != 0) + if (htons((frag.ip6f_offlg & IP6F_OFF_MASK)) != 0) return (PF_PASS); pd->off += sizeof(frag); pd->proto = frag.ip6f_nxt; @@ -9757,14 +9759,14 @@ pf_walk_header6(struct pf_pdesc *pd, struct ip6_hdr *h, u_short *reason) REASON_SET(reason, PFRES_IPOPTIONS); return (PF_DROP); } + /* fragments may be short */ + if (pd->fragoff != 0 && end < pd->off + sizeof(rthdr)) { + pd->off = pd->fragoff; + pd->proto = IPPROTO_FRAGMENT; + return (PF_PASS); + } if (!pf_pull_hdr(pd->m, pd->off, &rthdr, sizeof(rthdr), NULL, reason, AF_INET6)) { - /* fragments may be short */ - if (pd->fragoff != 0) { - pd->off = pd->fragoff; - pd->proto = IPPROTO_FRAGMENT; - return (PF_PASS); - } DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short rthdr")); return (PF_DROP); } @@ -9779,15 +9781,15 @@ pf_walk_header6(struct pf_pdesc *pd, struct ip6_hdr *h, u_short *reason) case IPPROTO_DSTOPTS: if (!pf_pull_hdr(pd->m, pd->off, &ext, sizeof(ext), NULL, reason, AF_INET6)) { - /* fragments may be short */ - if (pd->fragoff != 0) { - pd->off = pd->fragoff; - pd->proto = IPPROTO_FRAGMENT; - return (PF_PASS); - } DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short exthdr")); return (PF_DROP); } + /* fragments may be short */ + if (pd->fragoff != 0 && end < pd->off + sizeof(ext)) { + pd->off = pd->fragoff; + pd->proto = IPPROTO_FRAGMENT; + return (PF_PASS); + } /* reassembly needs the ext header before the frag */ if (pd->fragoff == 0) pd->extoff = pd->off; @@ -9815,7 +9817,7 @@ pf_walk_header6(struct pf_pdesc *pd, struct ip6_hdr *h, u_short *reason) case IPPROTO_SCTP: case IPPROTO_ICMPV6: /* fragments may be short, ignore inner header then */ - if (pd->fragoff != 0 && ntohs(h->ip6_plen) < pd->off + + if (pd->fragoff != 0 && end < pd->off + (pd->proto == IPPROTO_TCP ? sizeof(struct tcphdr) : pd->proto == IPPROTO_UDP ? sizeof(struct udphdr) : pd->proto == IPPROTO_SCTP ? sizeof(struct sctphdr) : From nobody Tue Jan 14 10:37:58 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXQZG6MGTz5kVwQ; Tue, 14 Jan 2025 10:37:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXQZG3W3sz3BxT; Tue, 14 Jan 2025 10:37:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Bn2vp0JSlxc7a2s0LeB+YIckHkJo5q6KffkzwZ60r4=; b=YeiO6aXOGsCdZaumlsbxqcwzxFaQddrcnL6c0l/QJGF3O1tmN+U50UVEw3muq2SH3cE5X+ 4mp2+IvOuPmkl8Xo/xBg0/h2OpEO2ryYkkJ20xzKhUsoRMoMtUnU6rUePXcRZ9eUsnUrFB Y/X6IFUkCdmcj8pC4i76ysNfYW0wYFGDxwZv7GnJoYMQ4f87Be2qoNLVerkF8lg9+dSl9N +Ns9ieHeh7Cls64dvQJn7M5uuSYjv1+vjnTojWIOlHkNnTO/+2jrJkvk1opcjPjJ1FcUdT 54HT7OTBnNariJHV0rlXNkv8VMJ87bgcRqnJ6BV4K1Vg2t+97nB8PeDE3QDe3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736851078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8Bn2vp0JSlxc7a2s0LeB+YIckHkJo5q6KffkzwZ60r4=; b=ZcqNvaV/VfY+wRxn9r8p8EyAEXXPQelbibGU7o7zAp28aYlwgD+Uu78RteIb9rHV97G2Pj k9UOPOuM59b+AflZER5ZXnz+n+kWKcs9fImDAJhXqk/gjUyZQIhFMgs9JxaApfgN1n9xwB lYXcLP7mRgtryMwhpB0mRIWnh10XvbDwAp89EZ1ZV2GmcMyHsMIkdt9gdaFz+Nk/y3zYK5 Y4Ux/0bRN0X0YMxWq2R8GcuR5UYOxDJrZpk6mWILpqHqzJRKC4wsTxqA0hmIAsbS7nOXHc 7FEXtcR31KYgxR6pf88TKMC1jl+YyLDaycYQ0r+m5tyDuJndPWnBca82n+zFfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736851078; a=rsa-sha256; cv=none; b=ipXmLXFBKnwaP6WSsD4mLtqEBCXht1M041QjPEGdZ7oG7aWVi2cK+7V68mcR3xNYIbXrHg v7nwBkmpz9Jbh1cTefDQ77b48e9mo7KhVs/S1AOMHVYZOZiuNzOS6mlJb6pZJXg2Z+oaDI Lr9t6BK4f3KBd1gVhIXqXsqYTS4FTLe5kcUJM+jcUrpt8N9+XjFDD0jhsWRRSnSpGDKtYf PW7H5YZ7QRcIIX/NmPEugRKkKThI01pF7FbioK2QFlTzZ7quR3jqqI1jcX5EvOHOE7jR3C RpJIwET2tm0etsrhzMXW9elwqw+5hqu3RsAlC9INabZkEWaBvLGhrOUvZW3kjg== 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 4YXQZG36s1z1C6V; Tue, 14 Jan 2025 10:37:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EAbwst048297; Tue, 14 Jan 2025 10:37:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EAbwBp048294; Tue, 14 Jan 2025 10:37:58 GMT (envelope-from git) Date: Tue, 14 Jan 2025 10:37:58 GMT Message-Id: <202501141037.50EAbwBp048294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 1941d370bf89 - main - pf: pass struct pf_pdesc to pf_walk_option6() and pf_walk_header6() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1941d370bf89ea9a1c3aab5ce33e04d6ba0f635d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1941d370bf89ea9a1c3aab5ce33e04d6ba0f635d commit 1941d370bf89ea9a1c3aab5ce33e04d6ba0f635d Author: Kristof Provost AuthorDate: 2025-01-09 11:02:39 +0000 Commit: Kristof Provost CommitDate: 2025-01-14 08:54:19 +0000 pf: pass struct pf_pdesc to pf_walk_option6() and pf_walk_header6() This makes their argument list shorter. Also fix a bug where pf_walk_option6() used the outer header in the pd2 case. ok henning@ mikeb@ Obtained from: OpenBSD, bluhm , dfff4707a1 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 6 +-- sys/netpfil/pf/pf.c | 143 +++++++++++++++++++++++++--------------------------- 2 files changed, 72 insertions(+), 77 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 3432f8dc99e1..3f109d31ccde 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1626,6 +1626,9 @@ struct pf_pdesc { u_int32_t off; /* protocol header offset */ u_int32_t hdrlen; /* protocol header length */ u_int32_t p_len; /* total length of protocol payload */ + u_int32_t extoff; /* extentsion header offset */ + u_int32_t fragoff; /* fragment header offset */ + u_int32_t jumbolen; /* length from v6 jumbo header */ u_int32_t badopts; /* v4 options or v6 routing headers */ u_int16_t *ip_sum; @@ -1634,7 +1637,6 @@ struct pf_pdesc { #define PFDESC_TCP_NORM 0x0001 /* TCP shall be statefully scrubbed */ u_int16_t virtual_proto; #define PF_VPROTO_FRAGMENT 256 - int extoff; sa_family_t af; sa_family_t naf; u_int8_t proto; @@ -2391,8 +2393,6 @@ int pf_normalize_ip(struct mbuf **, u_short *, struct pf_pdesc *); #endif /* INET */ #ifdef INET6 -int pf_walk_header6(struct mbuf *, struct ip6_hdr *, int *, int *, int *, - uint8_t *, uint32_t *, u_short *); int pf_normalize_ip6(struct mbuf **, int, u_short *, struct pf_pdesc *); void pf_poolmask(struct pf_addr *, struct pf_addr*, struct pf_addr *, struct pf_addr *, sa_family_t); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3d1ba8e8deb4..11b6be239ca7 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -367,7 +367,9 @@ static u_int16_t pf_calc_mss(struct pf_addr *, sa_family_t, int, u_int16_t); static int pf_check_proto_cksum(struct mbuf *, int, int, u_int8_t, sa_family_t); -static int pf_walk_option6(struct mbuf *, int, int, uint32_t *, +static int pf_walk_option6(struct pf_pdesc *, struct ip6_hdr *, + int, int, u_short *); +static int pf_walk_header6(struct pf_pdesc *, struct ip6_hdr *, u_short *); static void pf_print_state_parts(struct pf_kstate *, struct pf_state_key *, struct pf_state_key *); @@ -7850,8 +7852,6 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, #endif /* INET */ #ifdef INET6 struct ip6_hdr h2_6; - int fragoff2, extoff2; - u_int32_t jumbolen; #endif /* INET6 */ int ipoff2 = 0; @@ -7904,9 +7904,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, return (PF_DROP); } pd2.off = ipoff2; - if (pf_walk_header6(pd->m, &h2_6, &pd2.off, &extoff2, - &fragoff2, &pd2.proto, &jumbolen, - reason) != PF_PASS) + if (pf_walk_header6(&pd2, &h2_6, reason) != PF_PASS) return (PF_DROP); pd2.src = (struct pf_addr *)&h2_6.ip6_src; @@ -9655,16 +9653,15 @@ pf_dummynet_route(struct pf_pdesc *pd, struct pf_kstate *s, #ifdef INET6 static int -pf_walk_option6(struct mbuf *m, int off, int end, uint32_t *jumbolen, +pf_walk_option6(struct pf_pdesc *pd, struct ip6_hdr *h, int off, int end, u_short *reason) { struct ip6_opt opt; struct ip6_opt_jumbo jumbo; - struct ip6_hdr *h = mtod(m, struct ip6_hdr *); while (off < end) { - if (!pf_pull_hdr(m, off, &opt.ip6o_type, sizeof(opt.ip6o_type), - NULL, reason, AF_INET6)) { + if (!pf_pull_hdr(pd->m, off, &opt.ip6o_type, + sizeof(opt.ip6o_type), NULL, reason, AF_INET6)) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short opt type")); return (PF_DROP); } @@ -9672,8 +9669,8 @@ pf_walk_option6(struct mbuf *m, int off, int end, uint32_t *jumbolen, off++; continue; } - if (!pf_pull_hdr(m, off, &opt, sizeof(opt), NULL, reason, - AF_INET6)) { + if (!pf_pull_hdr(pd->m, off, &opt, sizeof(opt), NULL, + reason, AF_INET6)) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short opt")); return (PF_DROP); } @@ -9684,7 +9681,7 @@ pf_walk_option6(struct mbuf *m, int off, int end, uint32_t *jumbolen, } switch (opt.ip6o_type) { case IP6OPT_JUMBO: - if (*jumbolen != 0) { + if (pd->jumbolen != 0) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 multiple jumbo")); REASON_SET(reason, PFRES_IPOPTIONS); return (PF_DROP); @@ -9694,15 +9691,15 @@ pf_walk_option6(struct mbuf *m, int off, int end, uint32_t *jumbolen, REASON_SET(reason, PFRES_IPOPTIONS); return (PF_DROP); } - if (!pf_pull_hdr(m, off, &jumbo, sizeof(jumbo), NULL, + if (!pf_pull_hdr(pd->m, off, &jumbo, sizeof(jumbo), NULL, reason, AF_INET6)) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short jumbo")); return (PF_DROP); } - memcpy(jumbolen, jumbo.ip6oj_jumbo_len, - sizeof(*jumbolen)); - *jumbolen = ntohl(*jumbolen); - if (*jumbolen < IPV6_MAXPACKET) { + memcpy(&pd->jumbolen, jumbo.ip6oj_jumbo_len, + sizeof(pd->jumbolen)); + pd->jumbolen = ntohl(pd->jumbolen); + if (pd->jumbolen < IPV6_MAXPACKET) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short jumbolen")); REASON_SET(reason, PFRES_IPOPTIONS); return (PF_DROP); @@ -9718,43 +9715,41 @@ pf_walk_option6(struct mbuf *m, int off, int end, uint32_t *jumbolen, } int -pf_walk_header6(struct mbuf *m, struct ip6_hdr *h, int *off, int *extoff, - int *fragoff, uint8_t *nxt, uint32_t *jumbolen, u_short *reason) +pf_walk_header6(struct pf_pdesc *pd, struct ip6_hdr *h, u_short *reason) { struct ip6_frag frag; struct ip6_ext ext; struct ip6_rthdr rthdr; int rthdr_cnt = 0; - *off += sizeof(struct ip6_hdr); - *extoff = *fragoff = 0; - *nxt = h->ip6_nxt; - *jumbolen = 0; + pd->off += sizeof(struct ip6_hdr); + pd->fragoff = pd->extoff = pd->jumbolen = 0; + pd->proto = h->ip6_nxt; for (;;) { - switch (*nxt) { + switch (pd->proto) { case IPPROTO_FRAGMENT: - if (*fragoff != 0) { + if (pd->fragoff != 0) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 multiple fragment")); REASON_SET(reason, PFRES_FRAG); return (PF_DROP); } /* jumbo payload packets cannot be fragmented */ - if (*jumbolen != 0) { + if (pd->jumbolen != 0) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 fragmented jumbo")); REASON_SET(reason, PFRES_FRAG); return (PF_DROP); } - if (!pf_pull_hdr(m, *off, &frag, sizeof(frag), NULL, - reason, AF_INET6)) { + if (!pf_pull_hdr(pd->m, pd->off, &frag, sizeof(frag), + NULL, reason, AF_INET6)) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short fragment")); return (PF_DROP); } - *fragoff = *off; + pd->fragoff = pd->off; /* stop walking over non initial fragments */ if ((frag.ip6f_offlg & IP6F_OFF_MASK) != 0) return (PF_PASS); - *off += sizeof(frag); - *nxt = frag.ip6f_nxt; + pd->off += sizeof(frag); + pd->proto = frag.ip6f_nxt; break; case IPPROTO_ROUTING: if (rthdr_cnt++) { @@ -9762,12 +9757,12 @@ pf_walk_header6(struct mbuf *m, struct ip6_hdr *h, int *off, int *extoff, REASON_SET(reason, PFRES_IPOPTIONS); return (PF_DROP); } - if (!pf_pull_hdr(m, *off, &rthdr, sizeof(rthdr), NULL, - reason, AF_INET6)) { + if (!pf_pull_hdr(pd->m, pd->off, &rthdr, sizeof(rthdr), + NULL, reason, AF_INET6)) { /* fragments may be short */ - if (*fragoff != 0) { - *off = *fragoff; - *nxt = IPPROTO_FRAGMENT; + if (pd->fragoff != 0) { + pd->off = pd->fragoff; + pd->proto = IPPROTO_FRAGMENT; return (PF_PASS); } DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short rthdr")); @@ -9782,50 +9777,51 @@ pf_walk_header6(struct mbuf *m, struct ip6_hdr *h, int *off, int *extoff, case IPPROTO_AH: case IPPROTO_HOPOPTS: case IPPROTO_DSTOPTS: - if (!pf_pull_hdr(m, *off, &ext, sizeof(ext), NULL, - reason, AF_INET6)) { + if (!pf_pull_hdr(pd->m, pd->off, &ext, sizeof(ext), + NULL, reason, AF_INET6)) { /* fragments may be short */ - if (*fragoff != 0) { - *off = *fragoff; - *nxt = IPPROTO_FRAGMENT; + if (pd->fragoff != 0) { + pd->off = pd->fragoff; + pd->proto = IPPROTO_FRAGMENT; return (PF_PASS); } DPFPRINTF(PF_DEBUG_MISC, ("IPv6 short exthdr")); return (PF_DROP); } /* reassembly needs the ext header before the frag */ - if (*fragoff == 0) - *extoff = *off; - if (*nxt == IPPROTO_HOPOPTS && *fragoff == 0) { - if (pf_walk_option6(m, *off + sizeof(ext), - *off + (ext.ip6e_len + 1) * 8, jumbolen, - reason) != PF_PASS) + if (pd->fragoff == 0) + pd->extoff = pd->off; + if (pd->proto == IPPROTO_HOPOPTS && pd->fragoff == 0) { + if (pf_walk_option6(pd, h, + pd->off + sizeof(ext), + pd->off + (ext.ip6e_len + 1) * 8, reason) + != PF_PASS) return (PF_DROP); - if (ntohs(h->ip6_plen) == 0 && *jumbolen != 0) { + if (ntohs(h->ip6_plen) == 0 && pd->jumbolen != 0) { DPFPRINTF(PF_DEBUG_MISC, ("IPv6 missing jumbo")); REASON_SET(reason, PFRES_IPOPTIONS); return (PF_DROP); } } - if (*nxt == IPPROTO_AH) - *off += (ext.ip6e_len + 2) * 4; + if (pd->proto == IPPROTO_AH) + pd->off += (ext.ip6e_len + 2) * 4; else - *off += (ext.ip6e_len + 1) * 8; - *nxt = ext.ip6e_nxt; + pd->off += (ext.ip6e_len + 1) * 8; + pd->proto = ext.ip6e_nxt; break; case IPPROTO_TCP: case IPPROTO_UDP: case IPPROTO_SCTP: case IPPROTO_ICMPV6: /* fragments may be short, ignore inner header then */ - if (*fragoff != 0 && ntohs(h->ip6_plen) < *off + - (*nxt == IPPROTO_TCP ? sizeof(struct tcphdr) : - *nxt == IPPROTO_UDP ? sizeof(struct udphdr) : - *nxt == IPPROTO_SCTP ? sizeof(struct sctphdr) : + if (pd->fragoff != 0 && ntohs(h->ip6_plen) < pd->off + + (pd->proto == IPPROTO_TCP ? sizeof(struct tcphdr) : + pd->proto == IPPROTO_UDP ? sizeof(struct udphdr) : + pd->proto == IPPROTO_SCTP ? sizeof(struct sctphdr) : sizeof(struct icmp6_hdr))) { - *off = *fragoff; - *nxt = IPPROTO_FRAGMENT; + pd->off = pd->fragoff; + pd->proto = IPPROTO_FRAGMENT; } /* FALLTHROUGH */ default: @@ -9913,9 +9909,6 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, #ifdef INET6 case AF_INET6: { struct ip6_hdr *h; - int fragoff; - uint32_t jumbolen; - uint8_t nxt; if (__predict_false((*m0)->m_len < sizeof(struct ip6_hdr)) && (pd->m = *m0 = m_pullup(*m0, sizeof(struct ip6_hdr))) == NULL) { @@ -9929,8 +9922,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, h = mtod(pd->m, struct ip6_hdr *); pd->off = 0; - if (pf_walk_header6(pd->m, h, &pd->off, &pd->extoff, &fragoff, &nxt, - &jumbolen, reason) != PF_PASS) { + if (pf_walk_header6(pd, h, reason) != PF_PASS) { *action = PF_DROP; return (-1); } @@ -9945,7 +9937,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, pd->virtual_proto = pd->proto = h->ip6_nxt; pd->act.rtableid = -1; - if (fragoff != 0) + if (pd->fragoff != 0) pd->virtual_proto = PF_VPROTO_FRAGMENT; /* @@ -9958,7 +9950,7 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, } /* We do IP header normalization and packet reassembly here */ - if (pf_normalize_ip6(m0, fragoff, reason, pd) != + if (pf_normalize_ip6(m0, pd->fragoff, reason, pd) != PF_PASS) { *action = PF_DROP; return (-1); @@ -9975,20 +9967,23 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, pd->src = (struct pf_addr *)&h->ip6_src; pd->dst = (struct pf_addr *)&h->ip6_dst; - /* - * Reassembly may have changed the next protocol from fragment - * to something else, so update. - */ - pd->virtual_proto = pd->proto = h->ip6_nxt; pd->off = 0; - if (pf_walk_header6(pd->m, h, &pd->off, &pd->extoff, &fragoff, &nxt, - &jumbolen, reason) != PF_PASS) { + if (pf_walk_header6(pd, h, reason) != PF_PASS) { *action = PF_DROP; return (-1); } - if (fragoff != 0) + if (m_tag_find(pd->m, PACKET_TAG_PF_REASSEMBLED, NULL) != NULL) { + /* + * Reassembly may have changed the next protocol from + * fragment to something else, so update. + */ + pd->virtual_proto = pd->proto; + MPASS(pd->fragoff == 0); + } + + if (pd->fragoff != 0) pd->virtual_proto = PF_VPROTO_FRAGMENT; break; From nobody Tue Jan 14 11:21:43 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXRXl3ltNz5kY7S; Tue, 14 Jan 2025 11:21:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXRXl3T7jz3Nt5; Tue, 14 Jan 2025 11:21:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736853703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mq0+5DoWtd63g19ULlwI1MtSXdd2oe6DfYE5N6Go7yo=; b=XQ73massfRf0Zr9VuLaw0nV0hXKY6/KdyikR0qsg56F4P/3Z/c76uLDCZG92IWvvy8gF9o r5w29wU6Crs/elHYcFjpwQQT7zkL+O4TOulfmVEHcY9cSfpG/xbI7qH8b+E2U4SYaLQ48A Ml9EZpXbA3QP8u2jJ1qOUEcP/g+OcmeUsDLgAPTNLOAjk5yVKI3u9DG0Y8gSE8iluicvYP AGSaHEjOat3l2ENh0ECVFD2GfBJsPikwBWvSdygv2Ekb3XyromUsTCDac4qUQ7nhfbgExY UveZn7ipCoix9rUYIx4RFcTB18z7+G4mYa8lQ9HZhPrhk5uds3gwaSsgWfY60g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736853703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mq0+5DoWtd63g19ULlwI1MtSXdd2oe6DfYE5N6Go7yo=; b=P6oIsrStvFwB1EiFNVTEockCuVAaQ740FiBZPSco/BBPk71BSBLT5lgp6fNbYKO3J/bahM E7W7sxDGk7OvYqa8dbXp/9f2WSh+DA3w0GKfnkMYdQYqwfTrDsN4jUVA8WQy8iaeQB7b1S SUvkw1nTD/1nEsE6d5alC6d6NNBujuK3qOh4AnhuMihMDMt0F+fv8LYGcRQSFIaVz7yx1J Q49jOtRB9rDu90KSYveAxWTwL8CHTWKr5tNMdohdc8+tRoCUpMu+SlxqwA/2X+07IYslqo 73aKQkAoCRyM40bVt69m/t3Q8vZlH84p2duhDDAgU5/vy+zVBZHJb2KPXl12Ag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736853703; a=rsa-sha256; cv=none; b=CKabBUR3L7wHai3NDk/CVQ7r+Z2zHkzUV4ZNavfuFC19wukwsE8cLPlo4OVGrhsoj9HnCV 3iDP+UH1y1TOvcFaui0BEaxFcJg4tYnlwKdqfJB/iEQDiEDOK00e3FtybTDBsRwe3uY0Ir zfFhPI9S81Azf31pTO6aeyQqmbu/GaIpYJpA6pri2dmJ9wBLGdgOLuYqmKvCk6vxqu58pw 94kwwl3ojdxMt9TG+cVh6UMNJFpUooyAKTrziemUdCWRO5Vdm4+FyjPJ9HaWeo5IahmGVr ferLX54nbC/yVROnN4AbGbLvKBHCrmR6xJg4vwBxYOOJOo8pzBn0QqBQx7VNFA== 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 4YXRXl2rjjz1Dcc; Tue, 14 Jan 2025 11:21:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EBLhUm035091; Tue, 14 Jan 2025 11:21:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EBLh9t035087; Tue, 14 Jan 2025 11:21:43 GMT (envelope-from git) Date: Tue, 14 Jan 2025 11:21:43 GMT Message-Id: <202501141121.50EBLh9t035087@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: dc4581589a32 - main - pkg: clean support for repositories List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc4581589a3256667fafd46a30c67abdfd86618f Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=dc4581589a3256667fafd46a30c67abdfd86618f commit dc4581589a3256667fafd46a30c67abdfd86618f Author: Baptiste Daroussin AuthorDate: 2025-01-14 11:12:00 +0000 Commit: Baptiste Daroussin CommitDate: 2025-01-14 11:21:40 +0000 pkg: clean support for repositories Rework the way the bootstrap fetches pkg, by implementing a full support for the repositories, the boostrap will now loop over all available repo and try to fetch the full package from there. It will at the first valid package found. Fallback to packagesite (which has been deprecated for a while) if needed, by transforming it into a repo, if no repo is found. MFC After: 3 weeks --- usr.sbin/pkg/config.c | 158 ++++++++++++++++++++++++++++++++++++++------------ usr.sbin/pkg/config.h | 24 ++++++++ usr.sbin/pkg/pkg.c | 149 +++++++++++++++++++++++------------------------ 3 files changed, 216 insertions(+), 115 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index d8e15d44da3d..23bccb7eb96e 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -59,6 +59,8 @@ struct config_entry { bool main_only; /* Only set in pkg.conf. */ }; +static struct repositories repositories = STAILQ_HEAD_INITIALIZER(repositories); + static struct config_entry c[] = { [PACKAGESITE] = { PKG_CONFIG_STRING, @@ -211,7 +213,7 @@ boolstr_to_bool(const char *str) } static void -config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) +config_parse(const ucl_object_t *obj) { FILE *buffp; char *buf = NULL; @@ -238,29 +240,9 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) memset(buf, 0, bufsz); rewind(buffp); - if (conftype == CONFFILE_PKG) { for (j = 0; j < strlen(key); ++j) fputc(toupper(key[j]), buffp); fflush(buffp); - } else if (conftype == CONFFILE_REPO) { - if (strcasecmp(key, "url") == 0) - fputs("PACKAGESITE", buffp); - else if (strcasecmp(key, "mirror_type") == 0) - fputs("MIRROR_TYPE", buffp); - else if (strcasecmp(key, "signature_type") == 0) - fputs("SIGNATURE_TYPE", buffp); - else if (strcasecmp(key, "fingerprints") == 0) - fputs("FINGERPRINTS", buffp); - else if (strcasecmp(key, "pubkey") == 0) - fputs("PUBKEY", buffp); - else if (strcasecmp(key, "enabled") == 0) { - if ((cur->type != UCL_BOOLEAN) || - !ucl_object_toboolean(cur)) - goto cleanup; - } else - continue; - fflush(buffp); - } for (i = 0; i < CONFIG_SIZE; i++) { if (strcmp(buf, c[i].key) == 0) @@ -324,7 +306,7 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) if (c[i].envset) continue; /* Prevent overriding ABI, ASSUME_ALWAYS_YES, etc. */ - if (conftype != CONFFILE_PKG && c[i].main_only == true) + if (c[i].main_only == true) continue; switch (c[i].type) { case PKG_CONFIG_LIST: @@ -336,12 +318,91 @@ config_parse(const ucl_object_t *obj, pkg_conf_file_t conftype) } } -cleanup: free(temp_config); fclose(buffp); free(buf); } + +static void +parse_mirror_type(struct repository *r, const char *mt) +{ + if (strcasecmp(mt, "srv") == 0) + r->mirror_type = MIRROR_SRV; + r->mirror_type = MIRROR_NONE; +} + +static bool +parse_signature_type(struct repository *repo, const char *st) +{ + if (strcasecmp(st, "FINGERPRINTS") == 0) + repo->signature_type = SIGNATURE_FINGERPRINT; + else if (strcasecmp(st, "PUBKEY") == 0) + repo->signature_type = SIGNATURE_PUBKEY; + else if (strcasecmp(st, "NONE") == 0) + repo->signature_type = SIGNATURE_NONE; + else { + warnx("Signature type %s is not supported for bootstraping," + " ignoring repository %s", st, repo->name); + free(repo->url); + free(repo->name); + free(repo->fingerprints); + free(repo->pubkey); + free(repo); + return false; + } + return (true); +} + +static void +parse_repo(const ucl_object_t *o) +{ + const ucl_object_t *cur; + const char *key; + ucl_object_iter_t it = NULL; + + struct repository *repo = calloc(1, sizeof(struct repository)); + if (repo == NULL) + err(EXIT_FAILURE, "calloc"); + + repo->name = strdup(ucl_object_key(o)); + if (repo->name == NULL) + err(EXIT_FAILURE, "strdup"); + while ((cur = ucl_iterate_object(o, &it, true))) { + key = ucl_object_key(cur); + if (key == NULL) + continue; + if (strcasecmp(key, "url") == 0) { + repo->url = strdup(ucl_object_tostring(cur)); + if (repo->url == NULL) + err(EXIT_FAILURE, "strdup"); + } else if (strcasecmp(key, "mirror_type") == 0) { + parse_mirror_type(repo, ucl_object_tostring(cur)); + } else if (strcasecmp(key, "signature_type") == 0) { + if (!parse_signature_type(repo, ucl_object_tostring(cur))) + return; + } else if (strcasecmp(key, "fingerprints") == 0) { + repo->fingerprints = strdup(ucl_object_tostring(cur)); + if (repo->fingerprints == NULL) + err(EXIT_FAILURE, "strdup"); + } else if (strcasecmp(key, "pubkey") == 0) { + repo->pubkey = strdup(ucl_object_tostring(cur)); + if (repo->pubkey == NULL) + err(EXIT_FAILURE, "strdup"); + } else if (strcasecmp(key, "enabled") == 0) { + if ((cur->type != UCL_BOOLEAN) || + !ucl_object_toboolean(cur)) { + free(repo->url); + free(repo->name); + free(repo); + return; + } + } + } + STAILQ_INSERT_TAIL(&repositories, repo, next); + return; +} + /*- * Parse new repo style configs in style: * Name: @@ -367,8 +428,7 @@ parse_repo_file(ucl_object_t *obj, const char *requested_repo) if (requested_repo != NULL && strcmp(requested_repo, key) != 0) continue; - - config_parse(cur, CONFFILE_REPO); + parse_repo(cur); } } @@ -379,8 +439,12 @@ read_conf_file(const char *confpath, const char *requested_repo, { struct ucl_parser *p; ucl_object_t *obj = NULL; + const char *abi = pkg_get_myabi(); + if (abi == NULL) + errx(EXIT_FAILURE, "Fail do determine ABI"); p = ucl_parser_new(0); + ucl_parser_register_variable(p, "ABI", abi); if (!ucl_parser_add_file(p, confpath)) { if (errno != ENOENT) @@ -397,7 +461,7 @@ read_conf_file(const char *confpath, const char *requested_repo, "configuration file %s", confpath); else { if (conftype == CONFFILE_PKG) - config_parse(obj, conftype); + config_parse(obj); else if (conftype == CONFFILE_REPO) parse_repo_file(obj, requested_repo); } @@ -408,7 +472,7 @@ read_conf_file(const char *confpath, const char *requested_repo, return (0); } -static int +static void load_repositories(const char *repodir, const char *requested_repo) { struct dirent *ent; @@ -416,12 +480,9 @@ load_repositories(const char *repodir, const char *requested_repo) char *p; size_t n; char path[MAXPATHLEN]; - int ret; - - ret = 0; if ((d = opendir(repodir)) == NULL) - return (1); + return; while ((ent = readdir(d))) { /* Trim out 'repos'. */ @@ -437,7 +498,6 @@ load_repositories(const char *repodir, const char *requested_repo) continue; if (read_conf_file(path, requested_repo, CONFFILE_REPO)) { - ret = 1; goto cleanup; } } @@ -445,8 +505,6 @@ load_repositories(const char *repodir, const char *requested_repo) cleanup: closedir(d); - - return (ret); } int @@ -508,8 +566,7 @@ config_init(const char *requested_repo) } STAILQ_FOREACH(cv, c[REPOS_DIR].list, next) - if (load_repositories(cv->value, requested_repo)) - goto finalize; + load_repositories(cv->value, requested_repo); finalize: if (c[ABI].val == NULL && c[ABI].value == NULL) { @@ -520,8 +577,6 @@ finalize: c[ABI].val = abi; } - subst_packagesite(c[ABI].value != NULL ? c[ABI].value : c[ABI].val); - return (0); } @@ -560,6 +615,33 @@ config_bool(pkg_config_key k, bool *val) return (0); } +struct repositories * +config_get_repositories(void) +{ + if (STAILQ_EMPTY(&repositories)) { + /* Fall back to PACKAGESITE - deprecated - */ + struct repository *r = calloc(1, sizeof(r)); + if (r == NULL) + err(EXIT_FAILURE, "calloc"); + r->name = strdup("fallback"); + if (r->name == NULL) + err(EXIT_FAILURE, "strdup"); + subst_packagesite(c[ABI].value != NULL ? c[ABI].value : c[ABI].val); + r->url = c[PACKAGESITE].value; + if (c[SIGNATURE_TYPE].value != NULL) + if (!parse_signature_type(r, c[SIGNATURE_TYPE].value)) + exit(EXIT_FAILURE); + if (c[MIRROR_TYPE].value != NULL) + parse_mirror_type(r, c[MIRROR_TYPE].value); + if (c[PUBKEY].value != NULL) + r->pubkey = c[PUBKEY].value; + if (c[FINGERPRINTS].value != NULL) + r->fingerprints = c[FINGERPRINTS].value; + STAILQ_INSERT_TAIL(&repositories, r, next); + } + return (&repositories); +} + void config_finish(void) { int i; diff --git a/usr.sbin/pkg/config.h b/usr.sbin/pkg/config.h index 21d115e41db2..26f3ff79541b 100644 --- a/usr.sbin/pkg/config.h +++ b/usr.sbin/pkg/config.h @@ -30,6 +30,7 @@ #define _PKG_CONFIG_H #include +#include #define URL_SCHEME_PREFIX "pkg+" @@ -58,9 +59,32 @@ typedef enum { CONFFILE_REPO, } pkg_conf_file_t; +typedef enum { + SIGNATURE_NONE = 0, + SIGNATURE_FINGERPRINT, + SIGNATURE_PUBKEY, +} signature_t; + +typedef enum { + MIRROR_NONE = 0, + MIRROR_SRV, +} mirror_t; + +struct repository { + char *name; + char *url; + mirror_t mirror_type; + signature_t signature_type; + char *fingerprints; + char *pubkey; + STAILQ_ENTRY(repository) next; +}; +STAILQ_HEAD(repositories, repository); + int config_init(const char *); void config_finish(void); int config_string(pkg_config_key, const char **); int config_bool(pkg_config_key, bool *); +struct repositories *config_get_repositories(void); #endif diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 54884dbe0b23..0b46d2831e9e 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -255,7 +255,7 @@ install_pkg_static(const char *path, const char *pkgpath, bool force) } static int -fetch_to_fd(const char *url, char *path, const char *fetchOpts) +fetch_to_fd(struct repository *repo, const char *url, char *path, const char *fetchOpts) { struct url *u; struct dns_srvinfo *mirrors, *current; @@ -267,18 +267,11 @@ fetch_to_fd(const char *url, char *path, const char *fetchOpts) ssize_t r; char buf[10240]; char zone[MAXHOSTNAMELEN + 13]; - static const char *mirror_type = NULL; max_retry = 3; current = mirrors = NULL; remote = NULL; - if (mirror_type == NULL && config_string(MIRROR_TYPE, &mirror_type) - != 0) { - warnx("No MIRROR_TYPE defined"); - return (-1); - } - if ((fd = mkstemp(path)) == -1) { warn("mkstemp()"); return (-1); @@ -294,7 +287,7 @@ fetch_to_fd(const char *url, char *path, const char *fetchOpts) while (remote == NULL) { if (retry == max_retry) { if (strcmp(u->scheme, "file") != 0 && - strcasecmp(mirror_type, "srv") == 0) { + repo->mirror_type == MIRROR_SRV) { snprintf(zone, sizeof(zone), "_%s._tcp.%s", u->scheme, u->host); mirrors = dns_getsrvinfo(zone); @@ -653,23 +646,31 @@ parse_cert(int fd) { } static bool -verify_pubsignature(int fd_pkg, int fd_sig) +verify_pubsignature(int fd_pkg, int fd_sig, struct repository *r) { struct pubkey *pk; - const char *pubkey; char *data; struct pkgsign_ctx *sctx; size_t datasz; bool ret; + const char *pubkey; pk = NULL; - pubkey = NULL; sctx = NULL; data = NULL; ret = false; - if (config_string(PUBKEY, &pubkey) != 0) { - warnx("No CONFIG_PUBKEY defined"); - goto cleanup; + + if (r != NULL) { + if (r->pubkey == NULL) { + warnx("No CONFIG_PUBKEY defined for %s", r->name); + goto cleanup; + } + pubkey = r->pubkey; + } else { + if (config_string(PUBKEY, &pubkey) != 0) { + warnx("No CONFIG_PUBKEY defined for %s", r->name); + goto cleanup; + } } if ((pk = read_pubkey(fd_sig)) == NULL) { @@ -703,8 +704,8 @@ verify_pubsignature(int fd_pkg, int fd_sig) } /* Verify the signature. */ - printf("Verifying signature with public key %s... ", pubkey); - if (pkgsign_verify_data(sctx, data, datasz, pubkey, NULL, 0, pk->sig, + printf("Verifying signature with public key %s.a.. ", r->pubkey); + if (pkgsign_verify_data(sctx, data, datasz, r->pubkey, NULL, 0, pk->sig, pk->siglen) == false) { fprintf(stderr, "Signature is not valid\n"); goto cleanup; @@ -723,7 +724,7 @@ cleanup: } static bool -verify_signature(int fd_pkg, int fd_sig) +verify_signature(int fd_pkg, int fd_sig, struct repository *r) { struct fingerprint_list *trusted, *revoked; struct fingerprint *fingerprint; @@ -742,9 +743,17 @@ verify_signature(int fd_pkg, int fd_sig) ret = false; /* Read and parse fingerprints. */ - if (config_string(FINGERPRINTS, &fingerprints) != 0) { - warnx("No CONFIG_FINGERPRINTS defined"); - goto cleanup; + if (r != NULL) { + if (r->fingerprints == NULL) { + warnx("No FINGERPRINTS defined for %s", r->name); + goto cleanup; + } + fingerprints = r->fingerprints; + } else { + if (config_string(FINGERPRINTS, &fingerprints) != 0) { + warnx("No FINGERPRINTS defined"); + goto cleanup; + } } snprintf(path, MAXPATHLEN, "%s/trusted", fingerprints); @@ -833,7 +842,7 @@ cleanup: } static int -bootstrap_pkg(bool force, const char *fetchOpts) +bootstrap_pkg(bool force, const char *fetchOpts, struct repository *repo) { int fd_pkg, fd_sig; int ret; @@ -841,28 +850,18 @@ bootstrap_pkg(bool force, const char *fetchOpts) char tmppkg[MAXPATHLEN]; char tmpsig[MAXPATHLEN]; const char *packagesite; - const char *signature_type; char pkgstatic[MAXPATHLEN]; const char *bootstrap_name; fd_sig = -1; ret = -1; - if (config_string(PACKAGESITE, &packagesite) != 0) { - warnx("No PACKAGESITE defined"); - return (-1); - } - - if (config_string(SIGNATURE_TYPE, &signature_type) != 0) { - warnx("Error looking up SIGNATURE_TYPE"); - return (-1); - } - - printf("Bootstrapping pkg from %s, please wait...\n", packagesite); + printf("Bootstrapping pkg from %s, please wait...\n", repo->url); /* Support pkg+http:// for PACKAGESITE which is the new format in 1.2 to avoid confusion on why http://pkg.FreeBSD.org has no A record. */ + packagesite = repo->url; if (strncmp(URL_SCHEME_PREFIX, packagesite, strlen(URL_SCHEME_PREFIX)) == 0) packagesite += strlen(URL_SCHEME_PREFIX); @@ -873,53 +872,44 @@ bootstrap_pkg(bool force, const char *fetchOpts) snprintf(tmppkg, MAXPATHLEN, "%s/%s.XXXXXX", getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, bootstrap_name); - if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) != -1) + if ((fd_pkg = fetch_to_fd(repo, url, tmppkg, fetchOpts)) != -1) break; bootstrap_name = NULL; } if (bootstrap_name == NULL) goto fetchfail; - if (signature_type != NULL && - strcasecmp(signature_type, "NONE") != 0) { - if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { - - snprintf(tmpsig, MAXPATHLEN, "%s/%s.sig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, - bootstrap_name); - snprintf(url, MAXPATHLEN, "%s/Latest/%s.sig", - packagesite, bootstrap_name); - - if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { - fprintf(stderr, "Signature for pkg not " - "available.\n"); - goto fetchfail; - } + if (repo->signature_type == SIGNATURE_FINGERPRINT) { + snprintf(tmpsig, MAXPATHLEN, "%s/%s.sig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.sig", + packagesite, bootstrap_name); - if (verify_signature(fd_pkg, fd_sig) == false) - goto cleanup; - } else if (strcasecmp(signature_type, "PUBKEY") == 0) { + if ((fd_sig = fetch_to_fd(repo, url, tmpsig, fetchOpts)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto fetchfail; + } - snprintf(tmpsig, MAXPATHLEN, - "%s/%s.pubkeysig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, - bootstrap_name); - snprintf(url, MAXPATHLEN, "%s/Latest/%s.pubkeysig", - packagesite, bootstrap_name); + if (verify_signature(fd_pkg, fd_sig, repo) == false) + goto cleanup; + } else if (repo->signature_type == SIGNATURE_PUBKEY) { + snprintf(tmpsig, MAXPATHLEN, + "%s/%s.pubkeysig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.pubkeysig", + repo->url, bootstrap_name); - if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { - fprintf(stderr, "Signature for pkg not " - "available.\n"); - goto fetchfail; - } + if ((fd_sig = fetch_to_fd(repo, url, tmpsig, fetchOpts)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto fetchfail; + } - if (verify_pubsignature(fd_pkg, fd_sig) == false) - goto cleanup; - } else { - warnx("Signature type %s is not supported for " - "bootstrapping.", signature_type); + if (verify_pubsignature(fd_pkg, fd_sig, repo) == false) goto cleanup; - } } if ((ret = extract_pkg_static(fd_pkg, pkgstatic, MAXPATHLEN)) == 0) @@ -929,18 +919,15 @@ bootstrap_pkg(bool force, const char *fetchOpts) fetchfail: for (int j = 0; bootstrap_names[j] != NULL; j++) { - warnx("Attempted to fetch %s/Latest/%s", packagesite, + warnx("Attempted to fetch %s/Latest/%s", repo->url, bootstrap_names[j]); } warnx("Error: %s", fetchLastErrString); if (fetchLastErrCode == FETCH_RESOLV) { fprintf(stderr, "Address resolution failed for %s.\n", packagesite); - fprintf(stderr, "Consider changing PACKAGESITE.\n"); } else { fprintf(stderr, "A pre-built version of pkg could not be found for " "your system.\n"); - fprintf(stderr, "Consider changing PACKAGESITE or installing it from " - "ports: 'ports-mgmt/pkg'.\n"); } cleanup: @@ -1024,7 +1011,7 @@ bootstrap_pkg_local(const char *pkgpath, bool force) goto cleanup; } - if (verify_signature(fd_pkg, fd_sig) == false) + if (verify_signature(fd_pkg, fd_sig, NULL) == false) goto cleanup; } else if (strcasecmp(signature_type, "PUBKEY") == 0) { @@ -1037,7 +1024,7 @@ bootstrap_pkg_local(const char *pkgpath, bool force) goto cleanup; } - if (verify_pubsignature(fd_pkg, fd_sig) == false) + if (verify_pubsignature(fd_pkg, fd_sig, NULL) == false) goto cleanup; } else { @@ -1105,6 +1092,7 @@ main(int argc, char *argv[]) signed char ch; const char *fetchOpts; char *command; + struct repositories *repositories; activation_test = false; add_pkg = false; @@ -1232,6 +1220,8 @@ main(int argc, char *argv[]) fetchDebug = 1; if ((bootstrap_only && force) || access(pkgpath, X_OK) == -1) { + struct repository *repo; + int ret = 0; /* * To allow 'pkg -N' to be used as a reliable test for whether * a system is configured to use pkg, don't bootstrap pkg @@ -1272,7 +1262,12 @@ main(int argc, char *argv[]) if (pkg_query_yes_no() == 0) exit(EXIT_FAILURE); } - if (bootstrap_pkg(force, fetchOpts) != 0) + repositories = config_get_repositories(); + STAILQ_FOREACH(repo, repositories, next) { + if ((ret = bootstrap_pkg(force, fetchOpts, repo)) == 0) + break; + } + if (ret != 0) exit(EXIT_FAILURE); config_finish(); From nobody Tue Jan 14 12:59:44 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXTjr3K2Fz5kfXn; Tue, 14 Jan 2025 12:59:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXTjr1v9jz3VsC; Tue, 14 Jan 2025 12:59:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736859584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BnhBXkiONp4Ugar0hp+KDAwfMQLoJKg+zjpOuaDNYTY=; b=ANljhh/9Iu4aA8uRReh19/bKAbXLUwQgabXyk708MMee3wYoThoQR5qJ/jXcsqi44P8pdj CK/JLDWK6KhxYTbKi+IJ8AlEl97cwS9EPfsPw7jxTkwKZhknRysq8YSnDCTw+2DzsRcfzk JfRgfW1IILTmf1T8ErAY9e8SXG7oYYTJ+MuZsct+45B3vxairnUMYZKf6eK0wMdnvbDSus 9Fh5NQcNgYRbyO6HHgXW747tI8X5HBlJ0nI6nGdGIWgySMxGI0qbkd1PpvV52NmkcT7How xcWYIgjzqoIeuc4b5AdqOTrj1FF1bEEg7/WEMkIJgySGO9x7vj65CfXS5LtvDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736859584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BnhBXkiONp4Ugar0hp+KDAwfMQLoJKg+zjpOuaDNYTY=; b=QMcPxmp7p5NPLZ8Ff/Hvhn8ymCrmod+XSUVzlxcTi4imRp1Z4r0gsE7bnvI85DruExNn1H KlZeCeXupt93r2/yiBhQjlDmX1zMcxEDMRWIULkB1DM9YdJoh/3xonSDHbpJAZDoKLKzUS lxVZK5Y9tO4hDaF8x+FY3VJTTdDOivLRjaGHG5lXGFRHTKZEsJLAplxyXt7lMPnJLXBzDl KU2xo55VEbgd5HttPZSfZmyLQt2p86ezvnxElZAGyqb0q4CstG6FSSHEu9Q1ICwZM4ac7C y8oT9LVrcunQdi1K1lfjITcKHK/kNTbeD+8qK7C/KBLxYUZMh00A2NhqU9P6IA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736859584; a=rsa-sha256; cv=none; b=nz0yML6Eih7EeqRaW+hoeAlCsOqw6kCoDcvOfy1T7f6EGf2p0CliyUbGL5espkHN+QXBaR tqops4H5eI/F/VoCQuSuxlXgNImombtKhrNtG+LWKYswdiAcQH6wG2WTZFSBHo/bdkQrUS fC8BKeZej4+0fpr74CyvNDqdBQTXFavJ4yVLyrh+ssoDPHews4kntLH8DONjfaJ+h8NEZ5 NZn3XdXklCA6Ad0z0EKEf7TS0W0z1vC5CDhvYdK2Exp9XkDIJK98kbEew8MbJ3CDJtlcuO r1BR57FBW1VgthFEfQmbpRnaaH5r8H3LDLVRAr+jURjDiO3mu5OHJGbWeSNA6g== 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 4YXTjr1Jrrz1Gdj; Tue, 14 Jan 2025 12:59:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50ECxiK3010596; Tue, 14 Jan 2025 12:59:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50ECxiS0010593; Tue, 14 Jan 2025 12:59:44 GMT (envelope-from git) Date: Tue, 14 Jan 2025 12:59:44 GMT Message-Id: <202501141259.50ECxiS0010593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Benedict Reuschling Subject: git: 49f4e3d297d2 - main - pkg: Fix two typos in visible error messages List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bcr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 49f4e3d297d26ce6b8e2a2b790bc6357edd064c4 Auto-Submitted: auto-generated The branch main has been updated by bcr: URL: https://cgit.FreeBSD.org/src/commit/?id=49f4e3d297d26ce6b8e2a2b790bc6357edd064c4 commit 49f4e3d297d26ce6b8e2a2b790bc6357edd064c4 Author: Benedict Reuschling AuthorDate: 2025-01-14 12:58:53 +0000 Commit: Benedict Reuschling CommitDate: 2025-01-14 12:58:53 +0000 pkg: Fix two typos in visible error messages No functional changes. --- usr.sbin/pkg/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 23bccb7eb96e..fe1599f42c2c 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -342,7 +342,7 @@ parse_signature_type(struct repository *repo, const char *st) else if (strcasecmp(st, "NONE") == 0) repo->signature_type = SIGNATURE_NONE; else { - warnx("Signature type %s is not supported for bootstraping," + warnx("Signature type %s is not supported for bootstrapping," " ignoring repository %s", st, repo->name); free(repo->url); free(repo->name); @@ -441,7 +441,7 @@ read_conf_file(const char *confpath, const char *requested_repo, ucl_object_t *obj = NULL; const char *abi = pkg_get_myabi(); if (abi == NULL) - errx(EXIT_FAILURE, "Fail do determine ABI"); + errx(EXIT_FAILURE, "Failed to determine ABI"); p = ucl_parser_new(0); ucl_parser_register_variable(p, "ABI", abi); From nobody Tue Jan 14 13:42:29 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXVgC6rfLz5kj51; Tue, 14 Jan 2025 13:42:31 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXVgC6Q42z3bJn; Tue, 14 Jan 2025 13:42:31 +0000 (UTC) (envelope-from bapt@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736862151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BaFE6/unjX0hJR7nVDswOJTs70dEtUZ8K1uLS+wzo34=; b=FJkMzkI9sLKjWxkm9OVxX/Mj8SM3Ev1nLIvRnCqPL4FDgO2p+3vnbg+hABvHuY9WQ1A0Jt HzWb/X1uxFB1tvRXvPH/MonEQXfCoorE8W0Y2Vu8/aDrRDNxcGlxtZqCzTstofwqOhzYdr kboMGzLR/oTJ4b28VJlF+XvdAjQfDmtKE39rCeYO+8EN4Ju9P3KzLEhi4wvwTgRp8r7oZ3 QYYBF2Eg2gZnCOT1AK/gweg/rlHapLaJUHNTE6Rz+CFPBewCjclxsk53LnHpiwt6JmsVod paAzyXgbILyoViOhdOmuxLhgYOJalGmd9dT9jD+dIhJFr3JWh/Cgpu6osCa5pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736862151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BaFE6/unjX0hJR7nVDswOJTs70dEtUZ8K1uLS+wzo34=; b=D7UQSiPr6iTZr/EvstrrHGQJ3aKRwXFtiJDL73kLqrvnndbDTQQVf0A6TK6TxbITHcnrLH Nsuu6R2kjCSPwWgcKfwI7VA+21joUoOy6EXdfa1vgc5R+SQlKxd0CY+khn+v5TQcUWnxbX 6Wn0lc9aX12MGJ4mHxpy4OteYYMYLnTOauJi7/WGgp8H/1pRFqTTMzjL/VrincQm85GTQB wv6+ArPQDJft/8aZIYq2OJpucyO6sLOoLpa4DNVl727nhjoKAiCI9ki6vdcCnLiXw+sksT YFW5KvPyRPDXHDDqkzBJ8HFIFZCHsvCV/w22KcgyjaTRMLRyDvUkbpoBJQTfPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736862151; a=rsa-sha256; cv=none; b=YgowlyfNEyXj902DIipBrvDuknjdR7h2EhiKeOi2NGF/N0mxvjSPdh6zi3oYVFFujy9eWK QzgnpvU7CHUA5fPrhBNWJubrGqKP1FDFZuKpF3ckw+oxn/zypInq0v7D8Q63Oj3yiO972r JkzvMQZ+/w7otzD/tyDPKJLJnx427vl5MI7YsBw8Bg9zoJJC1mW11Ii/SBl0bz4SNIVtRy 1GvtYRP5QH/eA69pM5+RomAZWxvZeN1uM3RnZnFL118od5WWbugf7C5lni1l/nBqDvuXrL JBYjeGN7IPqjN+6Yk6r3/m5wSf86ssw6iOvTQe4ozCuPF8pFomG0ulu06fN7+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from aniel.nours.eu (nours.eu [176.31.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YXVgC5LvPzkZB; Tue, 14 Jan 2025 13:42:31 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id 6ABB615104D; Tue, 14 Jan 2025 14:42:29 +0100 (CET) Date: Tue, 14 Jan 2025 14:42:29 +0100 From: Baptiste Daroussin To: Benedict Reuschling Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 49f4e3d297d2 - main - pkg: Fix two typos in visible error messages Message-ID: <3dh6qvpb6vfasylr2k6uxykxwsc63x6e3pcx6exwucgfuhol2n@scrct6pcmayu> References: <202501141259.50ECxiS0010593@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202501141259.50ECxiS0010593@gitrepo.freebsd.org> On Tue 14 Jan 12:59, Benedict Reuschling wrote: > The branch main has been updated by bcr: > > URL: https://cgit.FreeBSD.org/src/commit/?id=49f4e3d297d26ce6b8e2a2b790bc6357edd064c4 > > commit 49f4e3d297d26ce6b8e2a2b790bc6357edd064c4 > Author: Benedict Reuschling > AuthorDate: 2025-01-14 12:58:53 +0000 > Commit: Benedict Reuschling > CommitDate: 2025-01-14 12:58:53 +0000 > > pkg: Fix two typos in visible error messages > > No functional changes. Thanks, Bapt From nobody Tue Jan 14 13:43:00 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXVgn0rM0z5kjJl; Tue, 14 Jan 2025 13:43: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXVgn01nKz3bnq; Tue, 14 Jan 2025 13:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736862181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZG5RydRD/QvY0rOWlfoUc/Z4rYUhYx9z/AkGyQqifsQ=; b=BOxx5fEsJ2lS+3CK/aWv6kewahGNb2/879wNwDGFUCDPDgtqRF9cvRLQWHJSxUbbDnGNfh m0pIv6hZSJp87CO9epO8htYuCkNYfr/+Duc6eSSTQnoWjlNNwBmfRtCUTvBUN/9NiNe6sN nCGtDrG/SQ6/ZsPjylFMLEJmGfy1PTTiDQwRhCIrnyJdCcp9r3R+Qvt/O3TSlV6GamZPB3 J+BS2imvP42mAvOWExKikSqgTSB61nbMa+StFNcLTBRFdo3o+F6jdBhJLO3laJTJlMf/4n 8Wv5gyHaeP9x6IbYKTae17TkFMgFap0Wwb0HqGxoRtDz7mH0NoR3PPoEKlzZqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736862181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZG5RydRD/QvY0rOWlfoUc/Z4rYUhYx9z/AkGyQqifsQ=; b=y41n2eda2lZGBsuAOgwxIEvgwDnKPw7xrJmvhg6lDbUdF8foiPAcyFW0FVIikmmAT1GNSk dCk7MEUba5uCt4rPLW36aFsaHDwnxdAhlDNC6z2kSkG/m89Yoh2dX9T0axU+LHHIveidlP VWG6R+IUht2KVTnDReXMRCQlLQci8jLZIrc/P1iX6zGaP/dRto/roPBLJ5NfdXlSslXJFX 4hJNh2N1rCXf2llWm+/KAkcqyU6HL9cHCkBfjKzfoC3CXKIeDT5KmfZDXqknRxjMyYaAnx id4BNdl8tNPT18YHxbLNum9opzbTK15rJDA3cRnCnbyhXd27baoOTcMAah5EhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736862181; a=rsa-sha256; cv=none; b=XihfFBoK+sgtkCD//aP8KIx2I3B2CQu9ydacAKQGUsRbgbSGaUw+emKamcyiDdc18HvsQw hg5ltps+bfdpzsM7708neVdmPsyzPgoj9HoYpqDm14WXhtnWePNRXWuJfrRcHpkxSiXYrI UB2WwMINzLXilov/hCTSi+OqP/FND1VJhCeaAX119k2oyyr4+Jl8JDt93CMV09mdZmci7n UdNpSSHK5Ts3Zns7InW5AfwloLDDYtOlrWfbMmH2nhkxeVyS49GroIOuURSskkgLnM1Dho gnY0t+cc1drGc+83eHnkrfcd7DdRRYyf3dee/SOWtI63GTzCNPwVzEdAsrC4PA== 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 4YXVgm65DNz1J95; Tue, 14 Jan 2025 13:43: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 50EDh0u1002137; Tue, 14 Jan 2025 13:43:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EDh0G9002134; Tue, 14 Jan 2025 13:43:00 GMT (envelope-from git) Date: Tue, 14 Jan 2025 13:43:00 GMT Message-Id: <202501141343.50EDh0G9002134@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 0cd9513a5ba5 - main - pkg: retire backwards compatibility bootstrap support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0cd9513a5ba5bcc5918d783f31279f91edbba2ee Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0cd9513a5ba5bcc5918d783f31279f91edbba2ee commit 0cd9513a5ba5bcc5918d783f31279f91edbba2ee Author: Ed Maste AuthorDate: 2024-10-07 17:10:58 +0000 Commit: Ed Maste CommitDate: 2025-01-14 13:42:36 +0000 pkg: retire backwards compatibility bootstrap support pkg.pkg has been available for years and is the default in all supported releases. Retire fallback support for pkg.txz. Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46990 --- usr.sbin/pkg/pkg.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 0b46d2831e9e..21ee1cd4bd30 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -91,11 +91,7 @@ struct fingerprint { STAILQ_ENTRY(fingerprint) next; }; -static const char *bootstrap_names [] = { - "pkg.pkg", - "pkg.txz", - NULL -}; +static const char *bootstrap_name = "pkg.pkg"; STAILQ_HEAD(fingerprint_list, fingerprint); @@ -851,7 +847,6 @@ bootstrap_pkg(bool force, const char *fetchOpts, struct repository *repo) char tmpsig[MAXPATHLEN]; const char *packagesite; char pkgstatic[MAXPATHLEN]; - const char *bootstrap_name; fd_sig = -1; ret = -1; @@ -865,18 +860,12 @@ bootstrap_pkg(bool force, const char *fetchOpts, struct repository *repo) if (strncmp(URL_SCHEME_PREFIX, packagesite, strlen(URL_SCHEME_PREFIX)) == 0) packagesite += strlen(URL_SCHEME_PREFIX); - for (int j = 0; bootstrap_names[j] != NULL; j++) { - bootstrap_name = bootstrap_names[j]; - snprintf(url, MAXPATHLEN, "%s/Latest/%s", packagesite, bootstrap_name); - snprintf(tmppkg, MAXPATHLEN, "%s/%s.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, - bootstrap_name); - if ((fd_pkg = fetch_to_fd(repo, url, tmppkg, fetchOpts)) != -1) - break; - bootstrap_name = NULL; - } - if (bootstrap_name == NULL) + snprintf(url, MAXPATHLEN, "%s/Latest/%s", packagesite, bootstrap_name); + snprintf(tmppkg, MAXPATHLEN, "%s/%s.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + if ((fd_pkg = fetch_to_fd(repo, url, tmppkg, fetchOpts)) == -1) goto fetchfail; if (repo->signature_type == SIGNATURE_FINGERPRINT) { @@ -918,11 +907,7 @@ bootstrap_pkg(bool force, const char *fetchOpts, struct repository *repo) goto cleanup; fetchfail: - for (int j = 0; bootstrap_names[j] != NULL; j++) { - warnx("Attempted to fetch %s/Latest/%s", repo->url, - bootstrap_names[j]); - } - warnx("Error: %s", fetchLastErrString); + warnx("Error fetching %s: %s", url, fetchLastErrString); if (fetchLastErrCode == FETCH_RESOLV) { fprintf(stderr, "Address resolution failed for %s.\n", packagesite); } else { From nobody Tue Jan 14 15:26:16 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXXyx4MgSz5kp43; Tue, 14 Jan 2025 15:26: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXXyx1cNMz3p3c; Tue, 14 Jan 2025 15:26:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ka2mYo5nFtQvAeUC1Mq9C3Ie5KJ7jac5XBu1Y894Fn0=; b=gQNAIL/20f5hiQ/jNTClId4j2EM+uvMNCqD/uGx+8XKm3jf3dHvk2GWg+koPqfu2hXuiI6 JQBfqbq/lF5ipUo+gwgiEO7WCsfVLIU1yjAgZHmzFudLKZAy+8dAkhestZ171JqaZdpyJw XW/JzbJIZDXSkGDy47ImteFKbC7g5Ht1deFuHO6HCDZU2opx49/tb3LUXLi9pMfn2+rJ2H F678OcCuQOpyencgiAaNDddrmAS2OnYFgD26g9CnwXtFlarcmQs9uKu/0H2DTLyKoKe32t RJWCJDheuSzx2jNkgbZQhJlPGFO2eAGvYVzBJcy3/G5lfMata0CGr7ZD82dX/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ka2mYo5nFtQvAeUC1Mq9C3Ie5KJ7jac5XBu1Y894Fn0=; b=LLcyGNWABR/INMu861gyspwByS3BEfY2PKGjkL6cX2HZrDcW41tbPqWS+zpFEJoD0IAQIn Yn3TADQ6StKMldwQPU+8J6yYyPrMzNkHqR7+uv2uNrHaLqowxNL1zt5x4ZvQhgInUEJ/qA GZllSZADYOUfczsLI0C86V5E7PjTki81DTuxE7EywzlnGd8LYt7jewO7CKcvBpMDUW1d26 d4D53wNyBo3in7BeTHz1JkwGNidzYc3D4y7Aw7FkGLOHIQXEX2RtRAW6BGVC6SXEbkW+CM a7w5GIcKWOkPeEA9H4BfRRJN2z2AN/CG/fJHud1XlBYH/HY46MtPba65YZ58hQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736868377; a=rsa-sha256; cv=none; b=i8jDktrzKxUIRsE+t84n6WhGodqEs6d0hp0kuE0OSHl21fOYWq/AuDYX2renE1HkKti5h6 areir+vl+8sY/UlfUL1LuQvccoYFrg77aJAbiwyFanPn9ChTpGr5gDdOKQ0dGueVelOM9C ZNIHZkfM16wyhm7Cl3n3SUlvAd+/NmmV4iXepETcrhSHtcpfQ0j4HwAvzmVedrxjzs9lBX Dxpr8Zf2RkOyHrNTW1hqfhQZTfDscAsQ0y6gxLenofcQ6lXAuqRKoLMjkExiEy+ZMTokMS cyJ6Op4RRE1G3JboH4+usShlQtDQ5F02hzMnYiZW3xyIwylfy3YnME+G8wIIyw== 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 4YXXyx0TNgz1L8b; Tue, 14 Jan 2025 15:26: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 50EFQGx0090713; Tue, 14 Jan 2025 15:26:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EFQGbs090710; Tue, 14 Jan 2025 15:26:16 GMT (envelope-from git) Date: Tue, 14 Jan 2025 15:26:16 GMT Message-Id: <202501141526.50EFQGbs090710@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f78fe930854c - main - audit: Fix short-circuiting in syscallenter() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f78fe930854cac6eed55859b45e0a7b5d87189d6 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f78fe930854cac6eed55859b45e0a7b5d87189d6 commit f78fe930854cac6eed55859b45e0a7b5d87189d6 Author: Mark Johnston AuthorDate: 2025-01-14 14:19:24 +0000 Commit: Mark Johnston CommitDate: 2025-01-14 14:19:28 +0000 audit: Fix short-circuiting in syscallenter() syscallenter() has a slow path to handle syscall auditing and dtrace syscall tracing. It uses AUDIT_SYSCALL_ENTER() to check whether to take the slow path, but this macro also has side effects: it writes the audit log entry. When systrace (dtrace syscall tracing) is enabled, this would get short-circuited, and we end up not writing audit log entries. Introduce a pure macro to check whether auditing is enabled, use it in syscallenter() instead of AUDIT_SYSCALL_ENTER(). Reviewed by: kib Reported by: Joe Duin Fixes: 2f7292437d0c ("Merge audit and systrace checks") MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48448 --- sys/kern/subr_syscall.c | 8 +++++--- sys/security/audit/audit.h | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 22bc35774e70..16fa47c5605a 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -141,9 +141,8 @@ syscallenter(struct thread *td) sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0; - if (__predict_false(SYSTRACE_ENABLED() || - AUDIT_SYSCALL_ENTER(sa->code, td) || - !sy_thr_static)) { + if (__predict_false(AUDIT_SYSCALL_ENABLED() || + SYSTRACE_ENABLED() || !sy_thr_static)) { if (!sy_thr_static) { error = syscall_thread_enter(td, &se); sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0; @@ -158,6 +157,9 @@ syscallenter(struct thread *td) if (__predict_false(se->sy_entry != 0)) (*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0); #endif + + AUDIT_SYSCALL_ENTER(sa->code, td); + error = (se->sy_call)(td, sa->args); /* Save the latest error return value. */ if (__predict_false((td->td_pflags & TDP_NERRNO) != 0)) diff --git a/sys/security/audit/audit.h b/sys/security/audit/audit.h index b87dd52e0773..28e84dce79f3 100644 --- a/sys/security/audit/audit.h +++ b/sys/security/audit/audit.h @@ -389,9 +389,11 @@ void audit_thread_free(struct thread *td); audit_arg_vnode2((vp)); \ } while (0) +#define AUDIT_SYSCALL_ENABLED() audit_syscalls_enabled + #define AUDIT_SYSCALL_ENTER(code, td) ({ \ bool _audit_entered = false; \ - if (__predict_false(audit_syscalls_enabled)) { \ + if (audit_syscalls_enabled) { \ audit_syscall_enter(code, td); \ _audit_entered = true; \ } \ @@ -468,6 +470,7 @@ void audit_thread_free(struct thread *td); #define AUDITING_TD(td) 0 +#define AUDIT_SYSCALL_ENABLED() 0 #define AUDIT_SYSCALL_ENTER(code, td) 0 #define AUDIT_SYSCALL_EXIT(error, td) From nobody Tue Jan 14 15:26:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXXyy3FNWz5kpPH; Tue, 14 Jan 2025 15:26: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXXyy175mz3p5J; Tue, 14 Jan 2025 15:26:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kQIYaQpLnGpUltcMEc9UUhr3iqCG/MTbJ836MyisuGc=; b=XGxjjmQIxc+8yfe7tFfQ+yArv1BFrG+rg2nVgLIniT7BuWWorqLAGI8YXHePo5OYgQBPIq ts9xG5KbWKb9T16slb8Iv4kuPNW8vsIESm4QjjM50K06FWCrLSvjloQok8mVetrnXtqpji CjdHadNQXEcIMTrSxiAwcqOaLzQ74FJeqxiuFGDrnA6Psh62JR0ay5QK/FlS4ZVMk7i7LA vDCzGhjSskQgOO2u4eEW4h+jUpvTvVLHg9DnYBrAOXHvJN0MTBxtU4Xklgts5sDlBQ2J93 h16s9NDpoUYtHQpEGCcHm4gqVrQq7RP2IqaK8tcq1aj8aERhpQtLfsB6Ns8b7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kQIYaQpLnGpUltcMEc9UUhr3iqCG/MTbJ836MyisuGc=; b=gygr21g2dH+a9fvYfU4JV90ASJNTfZRlyWov8ZmHAp+/RLYQ4HJZ9VqPmteOpUHGTJZvlv w64F50yzB4pyOwRIQJfKc/JO6CzQ8N6eem27iPgUI3SpC0eXwfuTOY+Ae+PgMm75rtTEgf Ihz5DsI/ePuPkAsS8qK3H7ZhB9gka474ivdVJ4HxbpDY7PAyT0nxsL1vDmGxpv1wURF0wl 9Dmrhz2tDH/HYg3p7f6L1k9QdXTKVDMg6sLJZ6r23FxxqF8PfHmGB2cX9gyWzpTZ4UJPOf oo1h/7RUhJPxO/UChYWEm4qNeget6KzNxd7G3al23CrIlDJ/gOct4ozb3/+6hA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736868378; a=rsa-sha256; cv=none; b=TJzj57K5Uq6XMm8SL4TdEabsfSGxPtSW0JXbCOr7MtIl7YGh2diskX36Bur0WxEHtR+8ji c7WhU4YNp4pSO752YZLwjSh6byOAeYkQ4VUx3VGexITku24uj/Nttutyq2y4D5cq16gjCg hCRWXzjMfQUxsYp5n0/bV6f9AzrZSrNuA3M6z7hTih9/idE8/CASTrqas78sps/2GUpg/v JFOp8xSyJ5Tdt91ElzjsnBJabsoVAQZ9mjTACKfWegPKgkpGaOLtcw66AziUYYwGeyb+Lq I+wvnEltmJag3x4S3v9E6kbj7/1djHcwlh1PAowoyCVHRT1n32QQBam50CEcoA== 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 4YXXyy0f7cz1LFR; Tue, 14 Jan 2025 15:26: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 50EFQIWv090777; Tue, 14 Jan 2025 15:26:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EFQIH6090774; Tue, 14 Jan 2025 15:26:18 GMT (envelope-from git) Date: Tue, 14 Jan 2025 15:26:18 GMT Message-Id: <202501141526.50EFQIH6090774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ae4f708f0b38 - main - syslogd: Ensure that forwarded messages are sent from port 514 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae4f708f0b383277505daa191e21db399b558839 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ae4f708f0b383277505daa191e21db399b558839 commit ae4f708f0b383277505daa191e21db399b558839 Author: Mark Johnston AuthorDate: 2025-01-14 14:19:56 +0000 Commit: Mark Johnston CommitDate: 2025-01-14 14:19:56 +0000 syslogd: Ensure that forwarded messages are sent from port 514 Prior to commit 4ecbee2760f7, syslogd used its listening socket(s) to forward messages to remote hosts, when so configured. As a consequence, they are sent from the address+port to which those sockets are bound, typically 0.0.0.0:514. When in capability mode, sendto() is not permitted, so we instead pre-create sockets and connect them to the forwarding addresses, letting the kernel pick an ephemeral source port. However, this doesn't match syslogd's previous behaviour, breaking some setups. So, restore the old behaviour by binding forwarding sockets to the addresses on which syslogd is listening. Since we cannot use the same sockets for receiving messages and also for forwarding them, use SO_REUSEPORT to enable duplicate bindings to port 514, relying on the existing behaviour that the first socket bound to that port is the one that actually receives messages. Add some regression tests to cover this and related functionality of syslogd's -a option. Reviewed by: jfree Reported by: Michael Butler Fixes: 4ecbee2760f7 ("syslogd: Open forwarding socket descriptors") Differential Revision: https://reviews.freebsd.org/D48222 --- usr.sbin/syslogd/syslogd.c | 179 +++++++++++++++++++++++---- usr.sbin/syslogd/syslogd.h | 6 + usr.sbin/syslogd/syslogd_cap_config.c | 2 + usr.sbin/syslogd/tests/syslogd_test.sh | 216 +++++++++++++++++++++++++++++++++ 4 files changed, 378 insertions(+), 25 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index e1d3dffe013a..726cedc17b1d 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -373,6 +373,7 @@ close_filed(struct filed *f) switch (f->f_type) { case F_FORW: if (f->f_addr_fds != NULL) { + free(f->f_addrs); for (size_t i = 0; i < f->f_num_addr_fds; ++i) close(f->f_addr_fds[i]); free(f->f_addr_fds); @@ -2987,11 +2988,152 @@ parse_selector(const char *p, struct filed *f) return (q); } +static int +maybe_dup_forw_socket(const nvlist_t *nvl, const struct sockaddr *rsa, + const struct sockaddr *lsa) +{ + const nvlist_t * const *line; + size_t linecount; + + if (!nvlist_exists_nvlist_array(nvl, "filed_list")) + return (-1); + line = nvlist_get_nvlist_array(nvl, "filed_list", &linecount); + for (size_t i = 0; i < linecount; i++) { + const struct forw_addr *forw; + const int *fdp; + size_t fdc; + + if (nvlist_get_number(line[i], "f_type") != F_FORW) + continue; + fdp = nvlist_get_descriptor_array(line[i], "f_addr_fds", &fdc); + forw = nvlist_get_binary(line[i], "f_addrs", NULL); + for (size_t j = 0; j < fdc; j++) { + int fd; + + if (memcmp(&forw[j].raddr, rsa, rsa->sa_len) != 0 || + memcmp(&forw[j].laddr, lsa, lsa->sa_len) != 0) + continue; + + fd = dup(fdp[j]); + if (fd < 0) + err(1, "dup"); + return (fd); + } + } + + return (-1); +} + +/* + * Create a UDP socket that will forward messages from "lai" to "ai". + * Capsicum doesn't permit connect() or sendto(), so we can't reuse the (bound) + * sockets used to listen for messages. + */ +static int +make_forw_socket(const nvlist_t *nvl, struct addrinfo *ai, struct addrinfo *lai) +{ + int s; + + s = socket(ai->ai_family, ai->ai_socktype, 0); + if (s < 0) + err(1, "socket"); + if (lai != NULL) { + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &(int){1}, + sizeof(int)) < 0) + err(1, "setsockopt"); + if (bind(s, lai->ai_addr, lai->ai_addrlen) < 0) + err(1, "bind"); + } + if (connect(s, ai->ai_addr, ai->ai_addrlen) < 0) { + if (errno == EADDRINUSE && lai != NULL) { + int s1; + + s1 = maybe_dup_forw_socket(nvl, ai->ai_addr, + lai->ai_addr); + if (s1 < 0) + errc(1, EADDRINUSE, "connect"); + (void)close(s); + s = s1; + } else { + err(1, "connect"); + } + } + /* Make it a write-only socket. */ + if (shutdown(s, SHUT_RD) < 0) + err(1, "shutdown"); + + return (s); +} + +static void +make_forw_socket_array(const nvlist_t *nvl, struct filed *f, + struct addrinfo *res) +{ + struct addrinfo *ai; + size_t i; + + f->f_num_addr_fds = 0; + + /* How many sockets do we need? */ + for (ai = res; ai != NULL; ai = ai->ai_next) { + struct socklist *boundsock; + int count; + + count = 0; + STAILQ_FOREACH(boundsock, &shead, next) { + if (boundsock->sl_ai.ai_family == ai->ai_family) + count++; + } + if (count == 0) + count = 1; + f->f_num_addr_fds += count; + } + + f->f_addr_fds = calloc(f->f_num_addr_fds, sizeof(*f->f_addr_fds)); + f->f_addrs = calloc(f->f_num_addr_fds, sizeof(*f->f_addrs)); + if (f->f_addr_fds == NULL || f->f_addrs == NULL) + err(1, "malloc failed"); + + /* + * Create our forwarding sockets: for each bound socket + * belonging to the destination address, create one socket + * connected to the destination and bound to the address of the + * listening socket. + */ + i = 0; + for (ai = res; ai != NULL; ai = ai->ai_next) { + struct socklist *boundsock; + int count; + + count = 0; + STAILQ_FOREACH(boundsock, &shead, next) { + if (boundsock->sl_ai.ai_family == + ai->ai_family) { + memcpy(&f->f_addrs[i].raddr, ai->ai_addr, + ai->ai_addrlen); + memcpy(&f->f_addrs[i].laddr, + boundsock->sl_ai.ai_addr, + boundsock->sl_ai.ai_addrlen); + f->f_addr_fds[i++] = make_forw_socket(nvl, ai, + &boundsock->sl_ai); + count++; + } + } + if (count == 0) { + memcpy(&f->f_addrs[i].raddr, ai->ai_addr, + ai->ai_addrlen); + f->f_addr_fds[i++] = make_forw_socket(nvl, ai, NULL); + } + } + assert(i == f->f_num_addr_fds); +} + static void -parse_action(const char *p, struct filed *f) +parse_action(const nvlist_t *nvl, const char *p, struct filed *f) { - struct addrinfo *ai, hints, *res; - int error, i; + struct addrinfo hints, *res; + size_t i; + int error; const char *q; bool syncfile; @@ -3045,27 +3187,7 @@ parse_action(const char *p, struct filed *f) dprintf("%s\n", gai_strerror(error)); break; } - - for (ai = res; ai != NULL; ai = ai->ai_next) - ++f->f_num_addr_fds; - - f->f_addr_fds = calloc(f->f_num_addr_fds, - sizeof(*f->f_addr_fds)); - if (f->f_addr_fds == NULL) - err(1, "malloc failed"); - - for (ai = res, i = 0; ai != NULL; ai = ai->ai_next, ++i) { - int *sockp = &f->f_addr_fds[i]; - - *sockp = socket(ai->ai_family, ai->ai_socktype, 0); - if (*sockp < 0) - err(1, "socket"); - if (connect(*sockp, ai->ai_addr, ai->ai_addrlen) < 0) - err(1, "connect"); - /* Make it a write-only socket. */ - if (shutdown(*sockp, SHUT_RD) < 0) - err(1, "shutdown"); - } + make_forw_socket_array(nvl, f, res); freeaddrinfo(res); f->f_type = F_FORW; break; @@ -3161,7 +3283,7 @@ cfline(nvlist_t *nvl, const char *line, const char *prog, const char *host, /* skip to action part */ while (*p == '\t' || *p == ' ') p++; - parse_action(p, &f); + parse_action(nvl, p, &f); /* An nvlist is heap allocated heap here. */ nvl_filed = filed_to_nvlist(&f); @@ -3772,6 +3894,13 @@ socksetup(struct addrinfo *ai, const char *name, mode_t mode) return (NULL); } + if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &(int){1}, + sizeof(int)) < 0) { + logerror("setsockopt(SO_REUSEPORT)"); + close(s); + return (NULL); + } + /* * For AF_LOCAL sockets, the process umask is applied to the * mode set above, so temporarily clear it to ensure that the diff --git a/usr.sbin/syslogd/syslogd.h b/usr.sbin/syslogd/syslogd.h index 744465a9cc00..5644dcaf2671 100644 --- a/usr.sbin/syslogd/syslogd.h +++ b/usr.sbin/syslogd/syslogd.h @@ -127,6 +127,11 @@ enum f_type { F_PIPE, /* pipe to program */ }; +struct forw_addr { + struct sockaddr_storage laddr; + struct sockaddr_storage raddr; +}; + /* * This structure represents the files that will have log * copies printed. @@ -158,6 +163,7 @@ struct filed { char f_hname[MAXHOSTNAMELEN]; int *f_addr_fds; size_t f_num_addr_fds; + struct forw_addr *f_addrs; }; /* F_FORW */ struct { char f_pname[MAXPATHLEN]; diff --git a/usr.sbin/syslogd/syslogd_cap_config.c b/usr.sbin/syslogd/syslogd_cap_config.c index a952dbe325a0..0cf6fb67491d 100644 --- a/usr.sbin/syslogd/syslogd_cap_config.c +++ b/usr.sbin/syslogd/syslogd_cap_config.c @@ -140,6 +140,8 @@ filed_to_nvlist(const struct filed *filed) nvlist_add_string(nvl_filed, "f_hname", filed->f_hname); nvlist_add_descriptor_array(nvl_filed, "f_addr_fds", filed->f_addr_fds, filed->f_num_addr_fds); + nvlist_add_binary(nvl_filed, "f_addrs", filed->f_addrs, + filed->f_num_addr_fds * sizeof(*filed->f_addrs)); } else if (filed->f_type == F_PIPE) { nvlist_add_string(nvl_filed, "f_pname", filed->f_pname); if (filed->f_procdesc >= 0) { diff --git a/usr.sbin/syslogd/tests/syslogd_test.sh b/usr.sbin/syslogd/tests/syslogd_test.sh index 51c3a5fca1c6..fd3d0c49c080 100644 --- a/usr.sbin/syslogd/tests/syslogd_test.sh +++ b/usr.sbin/syslogd/tests/syslogd_test.sh @@ -2,6 +2,7 @@ # SPDX-License-Identifier: BSD-2-Clause # # Copyright (c) 2021, 2023 The FreeBSD Foundation +# Copyright (c) 2024 Mark Johnston # # This software was developed by Mark Johnston under sponsorship from # the FreeBSD Foundation. @@ -337,6 +338,217 @@ jail_noinet_cleanup() jail -r syslogd_noinet } +# Create a pair of jails, connected by an epair. The idea is to run syslogd in +# one jail (syslogd_allowed_peer), listening on 169.254.0.1, and logger(1) can +# send messages from the other jail (syslogd_client) using source addrs +# 169.254.0.2 or 169.254.0.3. +allowed_peer_test_setup() +{ + local epair + + atf_check jail -c name=syslogd_allowed_peer vnet persist + atf_check jail -c name=syslogd_client vnet persist + + atf_check -o save:epair ifconfig epair create + epair=$(cat epair) + epair=${epair%%a} + + atf_check ifconfig ${epair}a vnet syslogd_allowed_peer + atf_check ifconfig ${epair}b vnet syslogd_client + atf_check jexec syslogd_allowed_peer ifconfig ${epair}a inet 169.254.0.1/16 + atf_check jexec syslogd_allowed_peer ifconfig lo0 inet 127.0.0.1/8 + atf_check jexec syslogd_client ifconfig ${epair}b inet 169.254.0.2/16 + atf_check jexec syslogd_client ifconfig ${epair}b alias 169.254.0.3/16 + atf_check jexec syslogd_client ifconfig lo0 inet 127.0.0.1/8 +} + +allowed_peer_test_cleanup() +{ + jail -r syslogd_allowed_peer + jail -r syslogd_client + ifconfig $(cat epair) destroy +} + +atf_test_case allowed_peer "cleanup" +allowed_peer_head() +{ + atf_set descr "syslogd -a works" + atf_set require.user root +} +allowed_peer_body() +{ + local logfile + + allowed_peer_test_setup + + logfile="${PWD}/jail.log" + printf "user.debug\t${logfile}\n" > "${SYSLOGD_CONFIG}" + syslogd_start -j syslogd_allowed_peer -b 169.254.0.1:514 -a '169.254.0.2/32' + + # Make sure that a message from 169.254.0.2:514 is logged. + atf_check jexec syslogd_client \ + logger -p user.debug -t test1 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world" + atf_check -o match:"test1: hello, world" cat "${logfile}" + # ... but not a message from port 515. + atf_check -o ignore jexec syslogd_client \ + logger -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world" + atf_check -o not-match:"test2: hello, world" cat "${logfile}" + atf_check -o ignore jexec syslogd_client \ + logger -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.3:515 "hello, world" + atf_check -o not-match:"test2: hello, world" cat "${logfile}" + + syslogd_stop + + # Now make sure that we can filter by port. + syslogd_start -j syslogd_allowed_peer -b 169.254.0.1:514 -a '169.254.0.2/32:515' + + atf_check jexec syslogd_client \ + logger -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world" + atf_check -o not-match:"test3: hello, world" cat "${logfile}" + atf_check jexec syslogd_client \ + logger -p user.debug -t test4 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world" + atf_check -o match:"test4: hello, world" cat "${logfile}" + + syslogd_stop +} +allowed_peer_cleanup() +{ + allowed_peer_test_cleanup +} + +atf_test_case allowed_peer_forwarding "cleanup" +allowed_peer_forwarding_head() +{ + atf_set descr "syslogd forwards messages from its listening port" + atf_set require.user root +} +allowed_peer_forwarding_body() +{ + local logfile + + allowed_peer_test_setup + + printf "user.debug\t@169.254.0.1\n" > client_config + printf "mark.debug\t@169.254.0.1:515\n" >> client_config + syslogd_start -j syslogd_client -b 169.254.0.2:514 -f ${PWD}/client_config + + logfile="${PWD}/jail.log" + printf "+169.254.0.2\nuser.debug\t${logfile}\n" > "${SYSLOGD_CONFIG}" + syslogd_start -j syslogd_allowed_peer -P ${SYSLOGD_PIDFILE}.2 \ + -b 169.254.0.1:514 -a 169.254.0.2/32 + + # A message forwarded to 169.254.0.1:514 should be logged, but one + # forwarded to 169.254.0.1:515 should not. + atf_check jexec syslogd_client \ + logger -h 169.254.0.2 -p user.debug -t test1 "hello, world" + atf_check jexec syslogd_client \ + logger -h 169.254.0.2 -p mark.debug -t test2 "hello, world" + + atf_check -o match:"test1: hello, world" cat "${logfile}" + atf_check -o not-match:"test2: hello, world" cat "${logfile}" +} +allowed_peer_forwarding_cleanup() +{ + allowed_peer_test_cleanup +} + +atf_test_case allowed_peer_wildcard "cleanup" +allowed_peer_wildcard_head() +{ + atf_set descr "syslogd -a works with port wildcards" + atf_set require.user root +} +allowed_peer_wildcard_body() +{ + local logfile + + allowed_peer_test_setup + + logfile="${PWD}/jail.log" + printf "user.debug\t${logfile}\n" > "${SYSLOGD_CONFIG}" + syslogd_start -j syslogd_allowed_peer -b 169.254.0.1:514 -a '169.254.0.2/32:*' + + # Make sure that a message from 169.254.0.2:514 is logged. + atf_check jexec syslogd_client \ + logger -p user.debug -t test1 -h 169.254.0.1 -S 169.254.0.2:514 "hello, world" + atf_check -o match:"test1: hello, world" cat "${logfile}" + # ... as is a message from 169.254.0.2:515, allowed by the wildcard. + atf_check jexec syslogd_client \ + logger -p user.debug -t test2 -h 169.254.0.1 -S 169.254.0.2:515 "hello, world" + atf_check -o match:"test2: hello, world" cat "${logfile}" + # ... but not a message from 169.254.0.3. + atf_check -o ignore jexec syslogd_client \ + logger -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.3:514 "hello, world" + atf_check -o not-match:"test3: hello, world" cat "${logfile}" + atf_check -o ignore jexec syslogd_client \ + logger -p user.debug -t test3 -h 169.254.0.1 -S 169.254.0.3:515 "hello, world" + atf_check -o not-match:"test3: hello, world" cat "${logfile}" + + syslogd_stop +} +allowed_peer_wildcard_cleanup() +{ + allowed_peer_test_cleanup +} + +atf_test_case "forward" "cleanup" +forward_head() +{ + atf_set descr "syslogd forwards messages to a remote host" + atf_set require.user root +} +forward_body() +{ + local epair logfile + + atf_check -o save:epair ifconfig epair create + epair=$(cat epair) + epair=${epair%%a} + + atf_check jail -c name=syslogd_server vnet persist + atf_check ifconfig ${epair}a vnet syslogd_server + atf_check jexec syslogd_server ifconfig ${epair}a inet 169.254.0.1/16 + atf_check jexec syslogd_server ifconfig ${epair}a alias 169.254.0.2/16 + atf_check jexec syslogd_server ifconfig lo0 inet 127.0.0.1/8 + + atf_check jail -c name=syslogd_client vnet persist + atf_check ifconfig ${epair}b vnet syslogd_client + atf_check jexec syslogd_client ifconfig ${epair}b inet 169.254.0.3/16 + atf_check jexec syslogd_client ifconfig lo0 inet 127.0.0.1/8 + + cat <<__EOF__ > ./client_config +user.debug @169.254.0.1 +mail.debug @169.254.0.2 +ftp.debug @169.254.0.1 +__EOF__ + + logfile="${PWD}/jail.log" + cat <<__EOF__ > ./server_config +user.debug ${logfile} +mail.debug ${logfile} +ftp.debug ${logfile} +__EOF__ + + syslogd_start -j syslogd_server -f ${PWD}/server_config -b 169.254.0.1 -b 169.254.0.2 + syslogd_start -j syslogd_client -f ${PWD}/client_config -P ${SYSLOGD_PIDFILE}.2 + + atf_check jexec syslogd_client \ + logger -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p user.debug -t test1 "hello, world" + atf_check jexec syslogd_client \ + logger -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p mail.debug -t test2 "you've got mail" + atf_check jexec syslogd_client \ + logger -h 169.254.0.3 -P $SYSLOGD_UDP_PORT -p ftp.debug -t test3 "transfer complete" + + atf_check -o match:"test1: hello, world" cat "${logfile}" + atf_check -o match:"test2: you've got mail" cat "${logfile}" + atf_check -o match:"test3: transfer complete" cat "${logfile}" +} +forward_cleanup() +{ + jail -r syslogd_server + jail -r syslogd_client +} + atf_init_test_cases() { atf_add_test_case "unix" @@ -349,4 +561,8 @@ atf_init_test_cases() atf_add_test_case "host_action" atf_add_test_case "pipe_action" atf_add_test_case "jail_noinet" + atf_add_test_case "allowed_peer" + atf_add_test_case "allowed_peer_forwarding" + atf_add_test_case "allowed_peer_wildcard" + atf_add_test_case "forward" } From nobody Tue Jan 14 15:26:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXXyz5KfHz5kp2W; Tue, 14 Jan 2025 15:26: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXXyz1sXNz3p3g; Tue, 14 Jan 2025 15:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ah4XxiJDF4QO+4fAjaOibkWajUMuAqLvmfSQdjGYNyo=; b=e+Bf9oRy2TD9/0Dm1IhZ1QucUttXhSqmOWsZY9KqXmr5PdT1J6S+J8HTs9gtSGJCRcHm9o vxQ7orJPcR77jBUHFWQlr2uxJpTmV2VXcpe296Cay9Kmq8ljCF5sYu5qgr8n2bnj2598AQ ZfMSCndAZSJvTtcu1EvGGqK3pczY4l5An6ozZ9H+Noj81q/E0PPoOAN51upK9MXU4t18sN cHD1OLZc3uf6Ou64mOEcqlR/fTs8QJGlY6uk9B3Sh9bLfPng7FxBQ9NPaxliV+Ifugy2ni usPWvjCEWclbHbckMJ0OqkcJB712TfGn348SRhHLzEilN6R9KG64ydzdpC+gTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ah4XxiJDF4QO+4fAjaOibkWajUMuAqLvmfSQdjGYNyo=; b=hgS6VzqQ3HuGAOl6vH3T4bDrZqu8MjbO7vxKr2OT37A7lc9ypcFNy3ZTjjRaeZ3INp6gmp Vo9gXeXwwGBk/+g1EfafwPTyCdpitjagtd7NvS0hv4ARrJPiHSNAi3veGKeJ3kBeSv7SUP +YKAD0MUpq1i6cF7+0q4g0JFyCtGPX6/2YjbeWx0hk0L/cnQSsLoW1QN1+DMausIViqI2E 7kof9Hoaq/NP7EPqxlkzoNskYa9mhJxrkRgHzMwJLq+79o+VzrPisDnDw8qCZG6Cyik0y8 eUQ5rjKr7IWvc8GT+7jy6Ng5kOxlCY/Ou9Cu+1wymHSrMIKeQqQXJqbmWAV9vQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736868379; a=rsa-sha256; cv=none; b=PyCt4QOFmDktFV85y8VYwIKIPb7S+dnX4Uxu9LWBxrztMANtYpWMoFH1KlexlovpGf/em2 edIzOdraScLyBCmutbbUIaIshY8A4C4HBAlFpEudug7ucGEifASajkfJhd/JPUVSSPK3NH qfS5FcCHes9GMruwdzZ2NMkenxtwHP8XwfXRQf871l7Kptxw3w4jhytOcNlQYb+YqM24n8 hTM/3OI3HBZPckUFnlVGnzIzqZiRaXoi4CiCDdU/6833QXBQzDMdyXYhnQmHG0wBng9pN6 MtpEvbwcgRQ53sUc/tq2hfvcMV6QtZ8RCxUSYMI5v9m6B5nIHwqynhziEu5B+g== 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 4YXXyz1KyRz1LY8; Tue, 14 Jan 2025 15:26: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 50EFQJdj090831; Tue, 14 Jan 2025 15:26:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EFQJNc090828; Tue, 14 Jan 2025 15:26:19 GMT (envelope-from git) Date: Tue, 14 Jan 2025 15:26:19 GMT Message-Id: <202501141526.50EFQJNc090828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e6c9c463384d - main - ls: Release resources before returning from traverse() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6c9c463384d11a44af3e5f2cc947fb69f3a1968 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e6c9c463384d11a44af3e5f2cc947fb69f3a1968 commit e6c9c463384d11a44af3e5f2cc947fb69f3a1968 Author: Mark Johnston AuthorDate: 2025-01-14 14:20:26 +0000 Commit: Mark Johnston CommitDate: 2025-01-14 14:20:26 +0000 ls: Release resources before returning from traverse() PR: 278476 MFC after: 2 weeks Reported by: valgrind --- bin/ls/ls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/ls/ls.c b/bin/ls/ls.c index a285838e2ee1..048cfc9293e6 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -643,8 +643,10 @@ traverse(int argc, char *argv[], int options) chp = fts_children(ftsp, 0); if (chp != NULL) display(NULL, chp, options); - if (f_listdir) + if (f_listdir) { + fts_close(ftsp); return; + } /* * If not recursing down this tree and don't need stat info, just get @@ -693,6 +695,7 @@ traverse(int argc, char *argv[], int options) } if (errno) err(1, "fts_read"); + fts_close(ftsp); } /* From nobody Tue Jan 14 15:35:25 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXY9T2tYZz5kpwg; Tue, 14 Jan 2025 15:35:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXY9T1zw2z3r3L; Tue, 14 Jan 2025 15:35:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I3vhHqkm8hkZyBO2c4paAKHqadYuyiwfYYI8ZcFmKzI=; b=QAbV7kkjtHgiTGKRMS5RDtU0zfWpZk2fJ9bSbmuN4rQi6t3N+gomqz0yYvfTrBDy1/ZHI2 AzJaTzPa3cG1LvHKb1qCjY3g43K7/OjexvH5pBohTJyrdfNTQ+zy1Pngnd8hwuQNVg15e7 FwI03qWXUwElPXzDN1Sep/ggdl8HtvpoVHIcYUxS40YMqWpkqYIoThW5BjxErD8cuOpNrA TemsSbaxc8NqE0nQSUgqVdp3xWbLUn2QO9RB5hTahsW/CkSZcrHHN/nJi/kO5QahUI4Kwn JOmC4CfdjAgqw0DcRC7UnbrXrTLxkby7tcwSQKhpAojgntQ/sRSkDk/xWV/siA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736868925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I3vhHqkm8hkZyBO2c4paAKHqadYuyiwfYYI8ZcFmKzI=; b=D3t/PdzcBBpJAM91yYdZwVx/DkSgj1J8uDrHcmHRjEzPOUAkTrVc1CpuWsQ6L8uIwh2iZO SUVsUCd0UUDW4bU3+o4+fsFicN+pozyYjDkA2UPy7HjbLrWbyQ75jxIVtZP+K57xozqfxR ltYpXGkd3EbEihjLKwgejMAAJ2Q+7BySimQOUjG6OfYc7fG8CYlCWDbccwQ5JEJbwzcVwI ecjTOlNpknCYNH0Pj8CapzGRM5Uw3S6FjlJ1J8b+AP7nIMsmySHH0PsVPMrIGQuK4zQibD iiRUIQ/zu97BgRzWYLTlcfJuzltunFM8eaoSA1yOf5/y3eOuCuxjLsZd8Q+B+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736868925; a=rsa-sha256; cv=none; b=Mgavtbs2r9iyRGeQswRZ7IMq5PTMeLi4YNge9FQ7nD1Mp3eShKIWIHZUWTwKmZ29duIx46 zXkBczbicT9CSS9k65ex1laRxGvzMZe2qR5JAoGravbNJovZCAg/yhbaGFOlrQXL1ZFGTi vAZhISSCV6RJCxFwsIWWWkWLN+MNGOX+8TsN3QzPletRpploUQTLHPkefLWGUiYCjU9Khq fs4j55uwItci9sCaHf8mgHlobowoCqCor6K9jcditNdW0spDtgjKRvf4dqa49PmO1a7yQv EpKP+cWAEJfDYs1zuVTFI3faK1oC3GVxnFiPlRZhcugLyVPMLe0YSgFPy4Hrkg== 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 4YXY9T1Y6Lz1LvW; Tue, 14 Jan 2025 15:35:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EFZPIb010271; Tue, 14 Jan 2025 15:35:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EFZPdT010268; Tue, 14 Jan 2025 15:35:25 GMT (envelope-from git) Date: Tue, 14 Jan 2025 15:35:25 GMT Message-Id: <202501141535.50EFZPdT010268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c2cd12b7ae28 - main - cxgbe tom: Make t4_push_frames static to t4_cpl_io.c List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2cd12b7ae28a34e551d1b96906620249a860bc0 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c2cd12b7ae28a34e551d1b96906620249a860bc0 commit c2cd12b7ae28a34e551d1b96906620249a860bc0 Author: John Baldwin AuthorDate: 2025-01-14 15:34:45 +0000 Commit: John Baldwin CommitDate: 2025-01-14 15:34:45 +0000 cxgbe tom: Make t4_push_frames static to t4_cpl_io.c This function is not used outside of this file. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D47760 --- sys/dev/cxgbe/tom/t4_cpl_io.c | 2 +- sys/dev/cxgbe/tom/t4_tom.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 8cafac61fa8b..8547f21586e1 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -633,7 +633,7 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbuf *stop, int nsegs, int n) * stalls). When drop is set this function MUST drop the bytes and wake up any * writers. */ -void +static void t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop) { struct mbuf *sndptr, *m, *sb_sndptr; diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 1f97dd81a0bc..6295a3484b9f 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -525,7 +525,6 @@ int t4_send_fin(struct toedev *, struct tcpcb *); int t4_send_rst(struct toedev *, struct tcpcb *); void t4_set_tcb_field(struct adapter *, struct sge_wrq *, struct toepcb *, uint16_t, uint64_t, uint64_t, int, int); -void t4_push_frames(struct adapter *, struct toepcb *, int); void t4_push_pdus(struct adapter *, struct toepcb *, int); /* t4_ddp.c */ From nobody Tue Jan 14 15:39:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXYGj5rfKz5kq8g; Tue, 14 Jan 2025 15:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXYGj4TXlz3rPb; Tue, 14 Jan 2025 15:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736869197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AM9LHiLVXyPbexvv8NLVNyHtRiXpV1UYezvpWY2HXyc=; b=bEQyTGVlKkcN/rbITEeMpljWjngnNb3Q0ESwrowZ1QHgPnnoNMmMAdc+WDJ0fjSpyLq1QC 6MF59lmuVo0FlJ7SHuaR3RJCD+PVc1j66T3/PLbFT+iBNStIpi+5YEGtxBWOyCCFzCx5qd tW/jx5ZAwz+1iRjAVZr/Tf2C7gSCgyXkg5c+9vD5SegBexvmeEWEYEPaVIyMf1g/fP4bqG VuybTWL6COMElfbp/rkFmXR+YlVCKiV7eT9z6oV7u5MiX6zvnFi/bAqbafLkYyxCUgkL8F 3IQ8o6RlMo+5/xuR+4iCJa2F7V6IzkG68Si38iw2nepPrm5IXBlncbbpmFGbMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736869197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AM9LHiLVXyPbexvv8NLVNyHtRiXpV1UYezvpWY2HXyc=; b=KLMJOikddRV7XpyS3BqutF/YoNRSYfgPIw09rjUie2MBEKQPNXyJLVPvLikxPsd3cZJkQQ doDNSOhBhbh9uhQ1y8FprCRdmRYcHCVejUdvLq9OykYCXb2BC+ZMs3mBDZSX7M6eVhatYo izx0SUDzwmlTLoKlmiXS06gQnafJ5+TlNErdFvoxiMnK26lTH5ra6f0AzvOg11s78BRdzj X1DecsWsh6SJ5IS8tBsCWrzHW7kX16vU5lGetmYsl3poYYmpiZJW9nlNZl+Wi5LMpbRsR+ tCF4CHqMimQzav/HCih0dfq7TyLRLBwE9EtPY2qnPVawvroYjmx+YqUGpgJnLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736869197; a=rsa-sha256; cv=none; b=vgGab54yAYwydyDJmUqC5fqNzyeQCnSg1ThMdVXx89H5N0S8Gq7toVJn1gn8IXV9nfguhp GqBcnXkBHETOIe9TKkEw9yCTAUIpBwd61+00rYFeEWaFgYF73md7DspnwYf5hOkMFiVpSt nC/obwlJ+Vq/Jk2fGKpHxFBRv3qBLdD0z2QgcJ3A3hhoAESy8c3raKT8ltR/iJEOIGDAbG HRJfHBe8WYFuE1obvFEVNIFBI6aKVryhhd2fjAjr89vlBsfaUTBiuGM9IVI47Hfc4J5OOm bngDBm5ArG/0xAqn493eBPmn/gpFlcEtKTaFs848hK9AByjxxFV6yvEdXxNJMA== 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 4YXYGj428vz1L9D; Tue, 14 Jan 2025 15:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EFdvfB011704; Tue, 14 Jan 2025 15:39:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EFdvZn011702; Tue, 14 Jan 2025 15:39:57 GMT (envelope-from git) Date: Tue, 14 Jan 2025 15:39:57 GMT Message-Id: <202501141539.50EFdvZn011702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: de11299323e0 - main - pmcannotate: Add a '-m' mode option to control per-line annotations. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de11299323e0a647ae2164f74ca966862e7c4dd8 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=de11299323e0a647ae2164f74ca966862e7c4dd8 commit de11299323e0a647ae2164f74ca966862e7c4dd8 Author: John Baldwin AuthorDate: 2025-01-14 15:39:53 +0000 Commit: John Baldwin CommitDate: 2025-01-14 15:39:53 +0000 pmcannotate: Add a '-m' mode option to control per-line annotations. - "block" (the default mode) displays per-block percentages in front of each annotated line. - "global" displays a global percentage in front of each line. - "raw" displays the raw count of sample hits in front of each line. Reviewed by: Pau Amma , mav Sponsored by: University of Cambridge, Google, Inc. Differential Revision: https://reviews.freebsd.org/D35401 --- usr.sbin/pmcannotate/pmcannotate.8 | 15 ++++++++++- usr.sbin/pmcannotate/pmcannotate.c | 54 ++++++++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/usr.sbin/pmcannotate/pmcannotate.8 b/usr.sbin/pmcannotate/pmcannotate.8 index 9a89c40db1e7..e2fae0a7a7e0 100644 --- a/usr.sbin/pmcannotate/pmcannotate.8 +++ b/usr.sbin/pmcannotate/pmcannotate.8 @@ -25,7 +25,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.Dd November 20, 2008 +.Dd January 14, 2025 .Dt PMCANNOTATE 8 .Os .Sh NAME @@ -37,6 +37,7 @@ .Op Fl h .Op Fl k Ar pathname .Op Fl l Ar level +.Op Fl m Ar mode .Ar pmcout.out binaryobj .Sh DESCRIPTION The @@ -84,6 +85,18 @@ This directory specifies where should look for the kernel and its modules. The default is .Pa /boot/kernel . +.It Fl m Ar mode +Format to use when annotating source or assembly lines. +One of: +.Bl -tag -width indent +.It Cm block +Display percentage of matching samples relative to samples +falling in the current block. +.It Cm global +Display percentage of matching samples relative to all samples. +.It Cm raw +Display the raw count of matching samples. +.El .El .Sh LIMITATIONS As long as diff --git a/usr.sbin/pmcannotate/pmcannotate.c b/usr.sbin/pmcannotate/pmcannotate.c index 01af75090793..5958ff615e4b 100644 --- a/usr.sbin/pmcannotate/pmcannotate.c +++ b/usr.sbin/pmcannotate/pmcannotate.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -58,7 +59,7 @@ exit(EXIT_FAILURE); \ } while (0) -#define PERCSAMP(x) ((x) * 100 / totalsamples) +#define PERCSAMP(x) ((float)(x) * 100 / totalsamples) struct entry { TAILQ_ENTRY(entry) en_iter; @@ -108,7 +109,9 @@ static TAILQ_HEAD(, aggent) fqueue = TAILQ_HEAD_INITIALIZER(fqueue); * Use a float value in order to automatically promote operations * to return a float value rather than use casts. */ -static float totalsamples; +static u_int totalsamples; + +static enum { RAW, BLOCK_PERCENT, GLOBAL_PERCENT } print_mode; /* * Identifies a string cointaining objdump's assembly printout. @@ -500,6 +503,30 @@ general_insertent(struct entry *entry) TAILQ_INSERT_TAIL(&mainlst, entry, en_iter); } +/* + * Return a string either holding a percentage or the raw count value. + */ +static const char * +print_count(u_int nsamples, u_int totsamples) +{ + static char buf[16]; + + switch (print_mode) { + case RAW: + snprintf(buf, sizeof(buf), "%u", nsamples); + break; + case BLOCK_PERCENT: + snprintf(buf, sizeof(buf), "%.2f%%", (float)nsamples * 100 / + totsamples); + break; + case GLOBAL_PERCENT: + snprintf(buf, sizeof(buf), "%.2f%%", (float)nsamples * 100 / + totalsamples); + break; + } + return (buf); +} + /* * Printout the body of an "objdump -d" assembly function. * It does simply stops when a new function is encountered, @@ -528,8 +555,8 @@ general_printasm(FILE *fp, struct aggent *agg) if (obj == NULL) printf("\t| %s", buffer); else - printf("%.2f%%\t| %s", - (float)obj->en_nsamples * 100 / agg->ag_nsamples, + printf("%7s | %s", + print_count(obj->en_nsamples, agg->ag_nsamples), buffer); } } @@ -622,8 +649,8 @@ printblock(FILE *fp, struct aggent *agg) printf("\t| %s", buffer); else { done = 1; - printf("%.2f%%\t| %s", - (float)tnsamples * 100 / agg->ag_nsamples, buffer); + printf("%7s | %s", + print_count(tnsamples, agg->ag_nsamples), buffer); } } @@ -656,7 +683,7 @@ usage(const char *progname) { fprintf(stderr, - "usage: %s [-a] [-h] [-k kfile] [-l lb] pmcraw.out binary\n", + "usage: %s [-a] [-h] [-k kfile] [-l lb] [-m mode] pmcraw.out binary\n", progname); exit(EXIT_SUCCESS); } @@ -681,7 +708,8 @@ main(int argc, char *argv[]) kfile = NULL; asmsrc = 0; limit = 0.5; - while ((cget = getopt(argc, argv, "ahl:k:")) != -1) + print_mode = BLOCK_PERCENT; + while ((cget = getopt(argc, argv, "ahl:m:k:")) != -1) switch(cget) { case 'a': asmsrc = 1; @@ -692,6 +720,16 @@ main(int argc, char *argv[]) case 'l': limit = (float)atof(optarg); break; + case 'm': + if (strcasecmp(optarg, "raw") == 0) + print_mode = RAW; + else if (strcasecmp(optarg, "global") == 0) + print_mode = GLOBAL_PERCENT; + else if (strcasecmp(optarg, "block") == 0) + print_mode = BLOCK_PERCENT; + else + errx(1, "Invalid mode %s", optarg); + break; case 'h': case '?': default: From nobody Tue Jan 14 15:49:23 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXYTc1F7Bz5kqD1; Tue, 14 Jan 2025 15:49:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXYTb5sfDz3sRS; Tue, 14 Jan 2025 15:49:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736869763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FsBwwvdmbShOp3xkq5eEclm/ccvZ4hvrx5O9UiNgm3Y=; b=PXSNiDoO4f1CcAGOcvvYfrgHCWjqN5ZBFiO9reS9/JjyRsfvT0FGtW/eC9P7c1jlM0UKUg 081YGgad9cN3DHZgrlqfAvrO49b7u7dnLjO41RqObsoK9j1z1IOg+CYNpAuKKvAz7vABRX GlhMsgkXGXdxxzJBylLDrIuFIhiuctn/LlyxrbNbbsJYTWsRs3nhEpP9xnY/cbNadxkbcL 3lJYkLm8mOk34rXVwyVgDQYhjz/pUoczMWJEOwbwrLcrTYEr3DG24Y7NmyF9dD+jVgKg86 N4dBbfQCTTvC1DD+IhQzLCnnwuUNvaH8l2RlqcoawBkjusPP+LEU1UORlFI+oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736869763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FsBwwvdmbShOp3xkq5eEclm/ccvZ4hvrx5O9UiNgm3Y=; b=oED2HH47QJ+NxAZPyP3nFsRc82mspHuoizyhN4np9pN4pBfYPaDmWapROKqWP3eqFYM7ng njKfvUQBG+GyAouPQ7uEIrxkwWDv60vElrdW+MT9RAPd3WdVzrIPS4pBWPu6rp8qOzVq25 AJsIx983O/q5YRJnBe2WoQuWb6REHVwfunxlcGbCLPFugGBBrjov1cb5PdSK9WyX9XIM+q ytvcsUEjTDUGPqBfMjRH0dueq3BR7IQHjTTd/mkAEyYEoDtxDMK55dD8V5pXdCtNEs4DqK zvmyUej/w5MGh1kv/Rp+tDQisGjk+ycR5s1zMJkLPgd37Yq/OmvlCrhnarAF4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736869763; a=rsa-sha256; cv=none; b=A46OeX7oeq10cQZK+2H+iafoBLSMjPx3e2YUo3aBLu1R8dZajv3zqX4M6huN2PqNW4/uDt xluXS6rYkr+dGxGsLbPaJjYo9DKSpsnV6mQG3XT71/GU2B4+kcahN9MHAoIkckoumtziNH yotVu3wS1wqupsJ7pGtIcaq9jGCuKnk/1yIlMcleQJFN/vwNXE6Z9Ec5UfrP4UH+GJGgVK PMHysTldJKCkfW8DKgrnHm9AwYoBE5AJz9mQEpuGisqqaEZdpOXyjpqU4dETX5xPutD65B 8wHElktCEuVM+sA/YsIo8CpF3uyWRH9exgiwMyMkxozWSyc0TJLOF3U8KimKmw== 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 4YXYTb5Jcvz1M9G; Tue, 14 Jan 2025 15:49: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 50EFnNOY030058; Tue, 14 Jan 2025 15:49:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EFnNxf030055; Tue, 14 Jan 2025 15:49:23 GMT (envelope-from git) Date: Tue, 14 Jan 2025 15:49:23 GMT Message-Id: <202501141549.50EFnNxf030055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 660331da7a75 - main - Centralize and simpify implemention of some VM macros List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 660331da7a75e897ae9710c9933962d82f0a194c Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=660331da7a75e897ae9710c9933962d82f0a194c commit 660331da7a75e897ae9710c9933962d82f0a194c Author: Brooks Davis AuthorDate: 2025-01-14 15:48:07 +0000 Commit: John Baldwin CommitDate: 2025-01-14 15:48:07 +0000 Centralize and simpify implemention of some VM macros These macros have substantially identical implementations on each platform. Use roundup2/rounddown2 for round_page/trunc_page. This version standardizes on not using explicit casts and instead preserving the original type. A couple of tweaks were required to make this work. Reviewed by: brooks, kib, markj Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D48450 --- sys/amd64/amd64/pmap.c | 2 +- sys/amd64/include/param.h | 7 ------- sys/arm/arm/minidump_machdep.c | 3 ++- sys/arm/include/param.h | 7 ------- sys/arm64/include/param.h | 8 -------- sys/i386/include/param.h | 7 ------- sys/powerpc/include/param.h | 7 ------- sys/riscv/include/param.h | 8 -------- sys/sys/param.h | 11 +++++++++++ usr.bin/systat/sysput.c | 3 +-- 10 files changed, 15 insertions(+), 48 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 265d48e26c0b..5d31ad0dd495 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2499,7 +2499,7 @@ pmap_init(void) ret = vm_page_blacklist_add(0x40000000 + ptoa(i), false); if (!ret && bootverbose) - printf("page at %#lx already used\n", + printf("page at %#x already used\n", 0x40000000 + ptoa(i)); } } diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h index 8ad1c0e93c6a..371128c6fe20 100644 --- a/sys/amd64/include/param.h +++ b/sys/amd64/include/param.h @@ -142,20 +142,13 @@ /* * Mach derived conversion macros */ -#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) -#define trunc_page(x) ((unsigned long)(x) & ~(PAGE_MASK)) #define trunc_2mpage(x) ((unsigned long)(x) & ~PDRMASK) #define round_2mpage(x) ((((unsigned long)(x)) + PDRMASK) & ~PDRMASK) #define trunc_1gpage(x) ((unsigned long)(x) & ~PDPMASK) -#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) -#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) - #define amd64_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) #define amd64_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) -#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) - #define INKERNEL(va) (((va) >= DMAP_MIN_ADDRESS && (va) < DMAP_MAX_ADDRESS) \ || ((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS)) diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c index 802b3184ed06..2e7fe6ebc51d 100644 --- a/sys/arm/arm/minidump_machdep.c +++ b/sys/arm/arm/minidump_machdep.c @@ -221,7 +221,8 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) if (error != 0) goto fail; - printf("Physical memory: %u MB\n", ptoa((uintmax_t)physmem) / 1048576); + printf("Physical memory: %ju MB\n", + ptoa((uintmax_t)physmem) / 1048576); printf("Dumping %llu MB:", (long long)dumpsize >> 20); /* Dump my header */ diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index 3e1503e17709..03131ebcb436 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -123,17 +123,10 @@ /* * Mach derived conversion macros */ -#define trunc_page(x) ((x) & ~PAGE_MASK) -#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) #define trunc_1mpage(x) ((unsigned)(x) & ~PDRMASK) #define round_1mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) -#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) -#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) - #define arm32_btop(x) ((unsigned)(x) >> PAGE_SHIFT) #define arm32_ptob(x) ((unsigned)(x) << PAGE_SHIFT) -#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) - #endif /* !_ARM_INCLUDE_PARAM_H_ */ diff --git a/sys/arm64/include/param.h b/sys/arm64/include/param.h index 6eb58a69dba1..c3f6990db79b 100644 --- a/sys/arm64/include/param.h +++ b/sys/arm64/include/param.h @@ -119,17 +119,9 @@ /* * Mach derived conversion macros */ -#define round_page(x) (((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK) -#define trunc_page(x) ((unsigned long)(x) & ~PAGE_MASK) - -#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) -#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) - #define arm64_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) #define arm64_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) -#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) - #endif /* !_MACHINE_PARAM_H_ */ #endif /* !__arm__ */ diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 2b9982324d19..79b6eee9db69 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -144,19 +144,12 @@ /* * Mach derived conversion macros */ -#define trunc_page(x) ((x) & ~PAGE_MASK) -#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) #define trunc_4mpage(x) ((x) & ~PDRMASK) #define round_4mpage(x) ((((x)) + PDRMASK) & ~PDRMASK) -#define atop(x) ((x) >> PAGE_SHIFT) -#define ptoa(x) ((x) << PAGE_SHIFT) - #define i386_btop(x) ((x) >> PAGE_SHIFT) #define i386_ptob(x) ((x) << PAGE_SHIFT) -#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) - #define INKERNEL(va) (TRUE) #endif /* !_I386_INCLUDE_PARAM_H_ */ diff --git a/sys/powerpc/include/param.h b/sys/powerpc/include/param.h index 56a7308a21b3..b40ada24ad11 100644 --- a/sys/powerpc/include/param.h +++ b/sys/powerpc/include/param.h @@ -141,20 +141,13 @@ /* * Mach derived conversion macros */ -#define trunc_page(x) ((x) & ~(PAGE_MASK)) -#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) #define trunc_2mpage(x) ((unsigned long)(x) & ~L3_PAGE_MASK) #define round_2mpage(x) ((((unsigned long)(x)) + L3_PAGE_MASK) & ~L3_PAGE_MASK) #define trunc_1gpage(x) ((unsigned long)(x) & ~L2_PAGE_MASK) -#define atop(x) ((x) >> PAGE_SHIFT) -#define ptoa(x) ((x) << PAGE_SHIFT) - #define powerpc_btop(x) ((x) >> PAGE_SHIFT) #define powerpc_ptob(x) ((x) << PAGE_SHIFT) -#define pgtok(x) ((x) * (PAGE_SIZE / 1024UL)) - #define btoc(x) ((vm_offset_t)(((x)+PAGE_MASK)>>PAGE_SHIFT)) #endif /* !_POWERPC_INCLUDE_PARAM_H_ */ diff --git a/sys/riscv/include/param.h b/sys/riscv/include/param.h index d06bd0663bac..ca9c91f3f981 100644 --- a/sys/riscv/include/param.h +++ b/sys/riscv/include/param.h @@ -93,15 +93,7 @@ /* * Mach derived conversion macros */ -#define round_page(x) (((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK) -#define trunc_page(x) ((unsigned long)(x) & ~PAGE_MASK) - -#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) -#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) - #define riscv_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) #define riscv_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) -#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) - #endif /* !_MACHINE_PARAM_H_ */ diff --git a/sys/sys/param.h b/sys/sys/param.h index d2aad1ff98a1..6d611f251add 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -200,6 +200,17 @@ #define MJUM9BYTES (9 * 1024) /* jumbo cluster 9k */ #define MJUM16BYTES (16 * 1024) /* jumbo cluster 16k */ +/* + * Mach derived conversion macros + */ +#define round_page(x) roundup2(x, PAGE_SIZE) +#define trunc_page(x) rounddown2(x, PAGE_SIZE) + +#define atop(x) ((x) >> PAGE_SHIFT) +#define ptoa(x) ((x) << PAGE_SHIFT) + +#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) + /* * Some macros for units conversion */ diff --git a/usr.bin/systat/sysput.c b/usr.bin/systat/sysput.c index 4053037236f4..6ae0075bb54d 100644 --- a/usr.bin/systat/sysput.c +++ b/usr.bin/systat/sysput.c @@ -25,13 +25,12 @@ * SUCH DAMAGE. */ -#include +#include #include #include #include #include -#include #include #include "systat.h" From nobody Tue Jan 14 17:39:00 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXbw45Lvfz5kCTK; Tue, 14 Jan 2025 17:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXbw44Z5sz42tJ; Tue, 14 Jan 2025 17:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736876340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dxPkoKZexFXwyxk6sTkXPmBVN8myqofZ3KrC4Ywaiew=; b=dYE9hkV4q9VTcNLeqcgotw2SuhZjfYaNG7kDBm5bMKTYa6AIxO4I1Fw+kVlfp/7d0voUD4 8RRdy3c/+aoRLx/5VqQ/QGbejQxRzMYz+ZfMdPdBWTQjh720xhgwKeinbvR9AoE3WGy8el YZT9JmVM6wOsMxG9Rwon+sEvu0M8KtHaEgStTqlGubAzP1HyjjlG/LhUjbeRaSo/GF5f6u xybBTj6YqYNRGIluoDe72+OC1pNQ5mQbZh4sdS+XNoBSDRXYmizIgPy76NWhA97vsE8bmi ZuOTBVnTu85+IqM0WKgXMGtbZQynsBcnfCODY+rT7neJiTHjNZn1f4c39TYnfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736876340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dxPkoKZexFXwyxk6sTkXPmBVN8myqofZ3KrC4Ywaiew=; b=mN0W+2MzN9/OZT9YVtnZZDCLZ58+ae0nctHsi6qyFgDJiqfz4tsawHNRBVHC12L9yLVPY3 Q8mqR7efl2L7HfiS1KCfyNb3oDOKYYReECP7gqgbqzPe1Ck1Rbd6uWQkaBEKQFGjsNDFHQ N20PPW9BFmBgoOCpJ/jxtNtIbS4i4Y8dLcC+ILmnjWGSnUpzTdiDVhaF8EnH0bAJ88Zula x0850d0w0yXZJ9ArjnX5dgaZh3667M/DB1TVS86do7GlbZxqRTnIToJ5iXtVe1I94yR6Wl 2jnAcwMMjvl38G3wbM1JYjJwVNi02HpBgppOp4hYsERkuLafjq+YWe5TU+Jntw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736876340; a=rsa-sha256; cv=none; b=OFZ3ryA/onUv21vmdEe3lHeHJkY1DLeLXJr/xkt11izg982XuxHkj5nSJriesZnRqolIu2 +Jdrm2S7sg26jFN47Zk0xCv1mLpPPY0azRc9lh2A+DdI4pHEpIltzt0y2tQW2/BrwKxaz7 6WPBmFrMEpihZM/4EQnZKBjTgF4OJ3WWoX0Czg9Z1zurpZmG9ACoSbTfFsbAGodk1jVa8/ x8hxlXdqgRDNm6Aws7X1gY3xmG8pxwcx6/kCLZsguerA/E+TuB9SqCbCM2FA8F1TIa6C7P xC1epbeRgFeK1eh1iQ6azI+YKNjPSe5SfHbdK5x9SsV6SyPjr9R+65CLcWzgTw== 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 4YXbw43rpVz1PTs; Tue, 14 Jan 2025 17:39: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 50EHd0P7036160; Tue, 14 Jan 2025 17:39:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EHd0a7036157; Tue, 14 Jan 2025 17:39:00 GMT (envelope-from git) Date: Tue, 14 Jan 2025 17:39:00 GMT Message-Id: <202501141739.50EHd0a7036157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 618d1621c2d4 - main - nvmecontrol: Fix error message for invalid Fabrics I/O queue size List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 618d1621c2d42ba8b0e17c8ba0859c80e1b54367 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=618d1621c2d42ba8b0e17c8ba0859c80e1b54367 commit 618d1621c2d42ba8b0e17c8ba0859c80e1b54367 Author: John Baldwin AuthorDate: 2025-01-14 17:36:55 +0000 Commit: John Baldwin CommitDate: 2025-01-14 17:38:47 +0000 nvmecontrol: Fix error message for invalid Fabrics I/O queue size Sponsored by: Chelsio Communications --- sbin/nvmecontrol/fabrics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/fabrics.c b/sbin/nvmecontrol/fabrics.c index de069e3df62a..27ecc8fb6cdc 100644 --- a/sbin/nvmecontrol/fabrics.c +++ b/sbin/nvmecontrol/fabrics.c @@ -457,7 +457,7 @@ connect_nvm_queues(const struct nvmf_association_params *aparams, else if (queue_size > (u_int)mqes + 1) { shutdown_controller(*admin); nvmf_free_association(na); - warn("I/O queue size exceeds controller maximum (%u)", + warnx("I/O queue size exceeds controller maximum (%u)", mqes + 1); return (EX_USAGE); } From nobody Tue Jan 14 17:54:06 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXcFW1LlCz5kD7S; Tue, 14 Jan 2025 17:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXcFW0VHhz445W; Tue, 14 Jan 2025 17:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vp0X9WE27XzrSgAJLwXmxpH78yr7BDCDCr6QmfbsxrA=; b=NUkfs7kv0d4q7gfwSfxq/B8l5AgzgatKt3zsHgdlE6uVo0g8+fu7WBSLS/cx9mSfKRoMJ+ ueis1b3nlt+XM8/I24Q4wzxC5Q5bGZ6HPxD8itHjBGe1ylNjxHz3jcEGg1SkYRclRZdk18 0qX5hqj1Q3oFtfteAup5OmFK0Of54B/4Ch4gMnBENZBn+BhUMYCCVrwi2lteFySE8qm8qR vuBBVb53+tAs0s8/8vFxUYfQUZSiiwIbBQbH30bdbqpb3NEgrc3Au/grQce5fouvHMNCCa y2K7kNM5qT+iicM63ls2JyjUm+J7l1pymtF7ljvVYvHt5pKB7FquDmWIwmtwIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vp0X9WE27XzrSgAJLwXmxpH78yr7BDCDCr6QmfbsxrA=; b=ybB5NbIq0p0aRSt2FOVtq5bJRM9CgjWPVSRRYxHBCxta5VbAIQxQJfHzTBZhr8ZtJIpRmt T6sXcekKzCh+BultCf6G3kHkk2DH1CpwtlUKAZ31VMtwmL/+bZyiBtVL2lL3/VByYZwiiT DuilNuCfQAGk72UXERfvuiMWPfmjH3Pu7veZuZsgUtIN6DCl4h/GgsKLYgxTiUZ2DvSFBd s3caRBACmWbZK7Cx0ZGkP5hEMbTlz2qRSCGEshShj5LdIV/DbYdgIl7MkLZC8Axog5yYXz ccBxZb1+5EoDItluNvnJviiC1Ks9XbU3Ps0MVC47gjF1jtp+vjORgRLJOahmQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736877247; a=rsa-sha256; cv=none; b=ytyCRNvjhO3lOD4RoNw8pjEDsWkuJIwkQm0Mnuma4QOqgKeR+E1pTeKaokJ8DkKHcebQ0z WLo6ehqiQhUf2+0eDqyl4chzKI+OFQ06d0iFQyzzMD6/zbr4Slyr9a+J3ajwXLC89/B5mA qAAzPd3SHUmyONfa0k9p8fWcjEVeIniuLSQ3v6NZmt9iIVrchNlnn7pJwmknCpPp/V+/Oq tQWGvjRaAeHSDROs7ia4luYT1OR+MN4Wdux3TYg48KlVC0zf9uNwIU0ITcN9bdGSOtCegu fylQGPfpP2UohjdxftmE1LZUgwpRjVAEkEDLysIz7qiq3MLO1tA1BnHInKnXkg== 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 4YXcFV70h3z1QST; Tue, 14 Jan 2025 17: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 50EHs63t071992; Tue, 14 Jan 2025 17: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 50EHs6kJ071989; Tue, 14 Jan 2025 17:54:06 GMT (envelope-from git) Date: Tue, 14 Jan 2025 17:54:06 GMT Message-Id: <202501141754.50EHs6kJ071989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: bec5a3c046ba - main - nextboot: Smarter warning about deleting nextboot List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bec5a3c046ba2bd970679a31f7227f260bef4935 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bec5a3c046ba2bd970679a31f7227f260bef4935 commit bec5a3c046ba2bd970679a31f7227f260bef4935 Author: Warner Losh AuthorDate: 2025-01-14 17:32:01 +0000 Commit: Warner Losh CommitDate: 2025-01-14 17:52:54 +0000 nextboot: Smarter warning about deleting nextboot Read only filesystems always error when trying to remove something with EROFS. However, that's true even if the file isn't there. The code assumed it would always get a ENOENT if the file wasn't there, but produced a gross message on read only systems. This message was harmless, but annoying. Instead, stat the file first and return if it's already not there. Some readings of POSIX require that the ENOENT error take precidence over the EROFS error. Linux made this change years ago, and we should too. POSIX.1-2024 isn't explicit, but does say for unlink() does say "[EROFS] The directory entry to be unlinked is part of a read-only file system" and "[ENOENT] A component of path does not name an existing file" implying that EROFS should only be returned for an existing file. FreeBSD doesn't implement this, so this workaround is necessary. Ideally, we'd fix this in the kernel in the future. Sponsored by: Netflix Discussed with: jrtc23 Differential Revision: https://reviews.freebsd.org/D48425 --- sbin/reboot/reboot.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index c6b0e0980c88..9825d4f96319 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -308,7 +308,22 @@ main(int argc, char *argv[]) errx(1, "-r and -k cannot be used together, there is no next kernel"); if (Dflag) { - if (unlink(PATH_NEXTBOOT) != 0 && errno != ENOENT) + struct stat sb; + + /* + * Break the rule about stat then doing + * something. When we're booting, there's no + * race. When we're a read-only root, though, the + * read-only error takes priority over the file not + * there error in unlink. So stat it first and exit + * with success if it isn't there. Otherwise, let + * unlink sort error reporting. POSIX-1.2024 suggests + * ENOENT should be preferred to EROFS for unlink, + * but FreeBSD historically has preferred EROFS. + */ + if (stat(PATH_NEXTBOOT, &sb) != 0 && errno == ENOENT) + exit(0); + if (unlink(PATH_NEXTBOOT) != 0) warn("unlink " PATH_NEXTBOOT); exit(0); } From nobody Tue Jan 14 17:55:13 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXcGn5tb1z5kD0p; Tue, 14 Jan 2025 17:55: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXcGn5Kwfz44cx; Tue, 14 Jan 2025 17:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jdrIVILWEfg4MH7TaFDr4FeWt0Sp3fcxG9elz7SUGVU=; b=UtFxOyJs5kyvmlpzApZvcR7e5PiuYcHPGWxzRIKADOtr24xXmZP+VlS41RFSzFBErgl7nT JfvLmSJ+zLnLkxh2A2Z5+3X/EYfIrR8lVP6+HJubzy/wVC/jg2g/Jgi2d0yl9a//KBIc0y 3kNCqXEmVQOdKEFdss59+gBvrdn/66Mg7l8IF4TuFcdWeRlqmE6JFHVzUNG0/stO0bCf/U NqmN7qHPpJCiUO3NfKdw7bYxA9RjPeqbugrWv0v5y/x8qZ+A/p5DG918pj1PH8TtHWuxNm mt1hjbmfGaFGAi6ukfly/wz8Me9uwzyEOfhgOD1ZIPxy4troplb2KfHJztAq3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jdrIVILWEfg4MH7TaFDr4FeWt0Sp3fcxG9elz7SUGVU=; b=fUYOLB2h5JmhuDjLh1V9BUmt2hZlj8+CRV/voqHyBpi/4NZuU/OvTly2B0PHGYcPbe/c2U e6tNGQWYI9YusNipLE1ZTD6tHb/ZRBOCKzW3nO+58ygiD9K0fls25lyEr0Mg1obAnU2FOm mg7B/aZlljgIzAKLP8yh0HW4GXi0mUvfjJSHIWhhOa1hD1qrRT2Wy43wiTEacRtrnPkSfF HhytdF5BO3evrwxeATqChoSyYumqMpwS6DXSOqjjrLsDqGOnSFQ7BCrpDvPXOPiTzsVkUf O88vEYLM+AZ9QMEOGspZkMRAMpKXYPxmS4wWIWybmEoxkWSivoEi23CAHGTtdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736877313; a=rsa-sha256; cv=none; b=qUsJ4HfhxkAFLAK0icjNPsrnaCmXRvPX1sfY6l7X238njnnWacuqQPCM8009KBzwOCIOfb H+3B+fNCTlo8DzP5bAPQjwsy8ITPiXPxuEzxDpypb4D0i1hHqaaBOyxN0I+BJsdTlH/TCV +ykFIuaGIBUQVgKgrCq8LG4FlEtx9T+MLaKeowdQ5DSdAo9qw8OELOa67YKfNh/w3IW3i5 +4A5ua18tGp06Qaa9NKtH42v37rJ8DBI2Gx6HuHPEJZvvyGT2zZ7qaNG/zAzxQxSnhF+In 0DAnNOOtJaecdT7w2Mh1+HFkNSrIX+qTZN/qo9OxF+ld1yX04CfxvuY25H7NzA== 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 4YXcGn4kQbz1QSV; Tue, 14 Jan 2025 17:55: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 50EHtDV7072545; Tue, 14 Jan 2025 17:55:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EHtD0T072542; Tue, 14 Jan 2025 17:55:13 GMT (envelope-from git) Date: Tue, 14 Jan 2025 17:55:13 GMT Message-Id: <202501141755.50EHtD0T072542@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4804cb433dbe - main - libthr: use atomic_add_int() instead of atomic_fetchadd_int() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4804cb433dbec2555695dc2bf391f286f2172621 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4804cb433dbec2555695dc2bf391f286f2172621 commit 4804cb433dbec2555695dc2bf391f286f2172621 Author: Konstantin Belousov AuthorDate: 2025-01-13 19:18:40 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-14 17:55:07 +0000 libthr: use atomic_add_int() instead of atomic_fetchadd_int() the return value is ignored. Reviewed by: markj, olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48454 --- lib/libthr/thread/thr_list.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libthr/thread/thr_list.c b/lib/libthr/thread/thr_list.c index 7da851dff681..bca2bfc75fef 100644 --- a/lib/libthr/thread/thr_list.c +++ b/lib/libthr/thread/thr_list.c @@ -149,16 +149,16 @@ _thr_alloc(struct pthread *curthread) if (thread == NULL) { if (total_threads > MAX_THREADS) return (NULL); - atomic_fetchadd_int(&total_threads, 1); + atomic_add_int(&total_threads, 1); thread = calloc(1, sizeof(struct pthread)); if (thread == NULL) { - atomic_fetchadd_int(&total_threads, -1); + atomic_add_int(&total_threads, -1); return (NULL); } if ((thread->sleepqueue = _sleepq_alloc()) == NULL || (thread->wake_addr = _thr_alloc_wake_addr()) == NULL) { thr_destroy(curthread, thread); - atomic_fetchadd_int(&total_threads, -1); + atomic_add_int(&total_threads, -1); return (NULL); } } else { @@ -176,7 +176,7 @@ _thr_alloc(struct pthread *curthread) thread->tcb = tcb; } else { thr_destroy(curthread, thread); - atomic_fetchadd_int(&total_threads, -1); + atomic_add_int(&total_threads, -1); thread = NULL; } return (thread); @@ -202,7 +202,7 @@ _thr_free(struct pthread *curthread, struct pthread *thread) thread->tcb = NULL; if ((curthread == NULL) || (free_thread_count >= MAX_CACHED_THREADS)) { thr_destroy(curthread, thread); - atomic_fetchadd_int(&total_threads, -1); + atomic_add_int(&total_threads, -1); } else { /* * Add the thread to the free thread list, this also avoids From nobody Tue Jan 14 17:55:14 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXcGp6dskz5kDPF; Tue, 14 Jan 2025 17:55: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXcGp65TSz44qd; Tue, 14 Jan 2025 17:55:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oTwfkDo+alpuPtnE8W+dInciCLliYAobHONfjehRvEE=; b=Oa9p3uRbsGg6RxY8tMTkJuhnQvxtHx0T5BF08974Dppf7PBuoKHJgPI2kvcJ5RHGvvSQbZ aF+IfvrFcG9Vc1iRibaaw1cSZoTi6JDdNwYNfX2KoumD1OD164GgJ8hWNolnnkLbBsa4lm aKiwgXoRfxLBsPZ8gvRG9JPiIQJeyigfPF/IghvMcT2U7QzDKQdF8oAs7uqjA2MRSQZMLG aTo1AhiXHoNT/KSHezsIXW9hMXJTc5t2A17+aoR005L3lHlU7kmXHFvk5Oo0IbmfF2+WCE AHcrT37KTTmw/KXFCqFe27irVFlRbTqf7wZuR2rlS18A4l5xRDu5eUUvvwMFnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oTwfkDo+alpuPtnE8W+dInciCLliYAobHONfjehRvEE=; b=Vsch4Tzh1+iC4Gf+tQbpXs9Bg5oOH+4UvAWIJfOgh+DdhKpjvADkMKL/ZQB2/tsFL2F9y5 hbBCVvcC+Cmz0TsPj8O13cSxGeptgpYlKVMN894HBCONl8E19vh8tBM4oYTHASGI/KruB2 XImtZTsX6kG+sA3zD5ExybkgG/3gYFDq0ld6Wbo2/en+EUH+ww2tOc+ftObIjoTc0ERccr nnwGTDr2fc1dVxwqRIGm+dE7K3g5DdaSljee2qFoJs00oGY48yJu9LIfjB8ra6cY91DzB7 o9vkWCO0PXI970bGiNlzmpbm1wEOOUoWp0pAEBIvHRTdSdVMq4op0ShJqKpB+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736877314; a=rsa-sha256; cv=none; b=rFnkybZfLrxdMri9nyDoI3uHKAfamoTo7R/ecDFJmK8xz6kqpn/v/uxlxW06FrYbC8HT6x vPDie6f96CpEEz8S0V2nrjs9jb9U4SE+CALcijDm/+fOmnDTlOUhZmIFem8u43a4FUlJ4U AaHvqY2Kr2NLatEYAoUpeGjw2BxANowes87E1RjtQGYMxgveeBWt6uHueggpBMVQjWleiE qT9n7SI7igbwkr/dP98nNGu1Vf6c5odzyqinvoGGCWDxi4juLXVpQ6nkWB0Zd5ZwdY23+b gOShd1P3H0//gffw2GGoOlysaNtQmdwHFd9qPY1X5a28+j5FNrASSDFXKi1O+Q== 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 4YXcGp5h1vz1Phx; Tue, 14 Jan 2025 17:55: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 50EHtEq6072587; Tue, 14 Jan 2025 17:55:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EHtE5s072584; Tue, 14 Jan 2025 17:55:14 GMT (envelope-from git) Date: Tue, 14 Jan 2025 17:55:14 GMT Message-Id: <202501141755.50EHtE5s072584@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9718f18471f7 - main - pthread_mutex_trylock(): init libthr if needed List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9718f18471f700b271eb898c764e02b7fcd3766f Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9718f18471f700b271eb898c764e02b7fcd3766f commit 9718f18471f700b271eb898c764e02b7fcd3766f Author: Konstantin Belousov AuthorDate: 2025-01-12 11:28:52 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-14 17:55:07 +0000 pthread_mutex_trylock(): init libthr if needed Reported by: yuri Reviewed by: markj, olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48454 --- lib/libthr/thread/thr_mutex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index ca8971cc720a..32bdc4afe65f 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -619,6 +619,7 @@ __Tthr_mutex_trylock(pthread_mutex_t *mutex) uint32_t id; int ret, robust; + _thr_check_init(); ret = check_and_init_mutex(mutex, &m); if (ret != 0) return (ret); From nobody Tue Jan 14 17:55:15 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXcGr69nDz5kDBt; Tue, 14 Jan 2025 17:55: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXcGq70Y2z44LG; Tue, 14 Jan 2025 17:55:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vjg7gx+3vIXAeYyJ4Ya0VqN62BQvUCz/XiEPkJ/Ngic=; b=hECWCzieg5M/1LcqvdikWeEH5tdoVMlC9F70hWKCjhuTbgQGnnBNxlP6Zy8huHf5oygmZm AVFR8T4Xn3/77SCvA/HrrAHThELzqli1UW2kwL3LsM26wb7OX1t+tXFZdh+zmVkPKlpd8m 0+NBTGW2cLKk0VDjkIyE8J4VaNZFUtHZSVBd6p9mzbtxro/6pGfYo7CHP8yPXKgeqJGU+G uz58bmg0Cd0GgSNgCAszD7mQbzCqDrhkaidJoCHClXwDCHg09glqUjVRVTnG3ktnXu48n5 GX2BVltasqp5VzmS8suBclXcatbjjz9RMOb+bfLJ1na58lSy2Mjn6rMxNR2vfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vjg7gx+3vIXAeYyJ4Ya0VqN62BQvUCz/XiEPkJ/Ngic=; b=V4G+xbTktaYVw4Ts6znsEGybFdU1Sxj/d8iohSzQ5F3UoPx1JyNQokQ5LLMmdWKeYQB1f7 xQ9BO67WPWV1DQRN0ZuAdu0lp9MJASYymPnaKn4453icUQZusi40ARtOARmh86HucWVD6r rL5qDMpd0bJrJrR63TlUhup5nOhoJdPKGQR40yvzfWrbTVbNw4seBSuiCR3Di7zgSBb3pd tR0GCxecJpMfl0LRdvYWm362leljdFQX4WQieJcTBCZYRvlaKIDI79LR11jv80rVqHEv1P tA6L+XKGM0QKoQXwd0s+GuLGo76IX7XVU3EoFZKX40t9K3Xbc8lPOGHcxtTKBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736877316; a=rsa-sha256; cv=none; b=w6R8FyrvmFIXvQ+zN5QtYC96XoBg+wpJaO2CW0h68LAvHWrctY2yOIfcT2/Vr3AlNtUN9Z oHo/0M2DOjk+cyuMUqIkgsMyPY461Q+PllLUq+IdkALB2xhjQyu32L8JJ3MvHyioBMhSBe MJXSbX/FrKvMe2oWhg1Lx79w1s5zbhpZsNKFeZiDLi3cFju8jWEtE4PMuP83JXc+u5C2iv Yj1M5v555NQxM+AanqoqhwiIMGwMR62P7o4wIQdnV2FpEjKtm1DH19ML/7SjB7PeoYIb0n 73jOyLcOsgdJbgds+YrOtryg6jODHsEOjRqpx5Sg9VSbPM2Toq+vzhQDOX2O7w== 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 4YXcGq6TKRz1PW2; Tue, 14 Jan 2025 17:55: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 50EHtFEf072650; Tue, 14 Jan 2025 17:55:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EHtFwt072647; Tue, 14 Jan 2025 17:55:15 GMT (envelope-from git) Date: Tue, 14 Jan 2025 17:55:15 GMT Message-Id: <202501141755.50EHtFwt072647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9a2ae72421cd - main - libthr: switch thread and sleepq memory allocator to crt from libc malloc List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a2ae72421cd75c741984f63b8c9ee89346a188d Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9a2ae72421cd75c741984f63b8c9ee89346a188d commit 9a2ae72421cd75c741984f63b8c9ee89346a188d Author: Konstantin Belousov AuthorDate: 2025-01-14 09:06:58 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-14 17:55:08 +0000 libthr: switch thread and sleepq memory allocator to crt from libc malloc There are more complex interactions between malloc and libthr initialization that can happen if libthr functions are called from ELF object' constructors, before libthr is initialized. Break the dependencies loop by using the private allocator with controlled init. Reported by: yuri Reviewed by: markj, olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48454 --- lib/libthr/thread/thr_list.c | 4 ++-- lib/libthr/thread/thr_sleepq.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libthr/thread/thr_list.c b/lib/libthr/thread/thr_list.c index bca2bfc75fef..bbc1d2899cb9 100644 --- a/lib/libthr/thread/thr_list.c +++ b/lib/libthr/thread/thr_list.c @@ -150,7 +150,7 @@ _thr_alloc(struct pthread *curthread) if (total_threads > MAX_THREADS) return (NULL); atomic_add_int(&total_threads, 1); - thread = calloc(1, sizeof(struct pthread)); + thread = __thr_calloc(1, sizeof(struct pthread)); if (thread == NULL) { atomic_add_int(&total_threads, -1); return (NULL); @@ -222,7 +222,7 @@ thr_destroy(struct pthread *curthread __unused, struct pthread *thread) _sleepq_free(thread->sleepqueue); if (thread->wake_addr != NULL) _thr_release_wake_addr(thread->wake_addr); - free(thread); + __thr_free(thread); } /* diff --git a/lib/libthr/thread/thr_sleepq.c b/lib/libthr/thread/thr_sleepq.c index d7de9ab4e25a..9c680acd0ac0 100644 --- a/lib/libthr/thread/thr_sleepq.c +++ b/lib/libthr/thread/thr_sleepq.c @@ -62,7 +62,7 @@ _sleepq_alloc(void) { struct sleepqueue *sq; - sq = calloc(1, sizeof(struct sleepqueue)); + sq = __thr_calloc(1, sizeof(struct sleepqueue)); TAILQ_INIT(&sq->sq_blocked); SLIST_INIT(&sq->sq_freeq); return (sq); @@ -71,7 +71,7 @@ _sleepq_alloc(void) void _sleepq_free(struct sleepqueue *sq) { - free(sq); + __thr_free(sq); } void From nobody Tue Jan 14 20:42:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXh0K4DYCz5kPPn; Tue, 14 Jan 2025 20:42:57 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXh0K0cxMz4K6f; Tue, 14 Jan 2025 20:42:57 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-467a3c85e11so39898081cf.2; Tue, 14 Jan 2025 12:42:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736887375; x=1737492175; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=Dedt2iOdRid8QeXO3wtoStVGyLUekpZE+D2rqVAFzvQ=; b=Vmqi/AtgJZYoZam/NwsG/McaC8JiYHeaUAuxxVU3sNzlNJpeHX8lwUFIUWDTIL9Lrn PeTY59fcpAhk6TvdnPwvdW93HAi9qDwqd4HtASCL4/hkbBEtrmhf8QSLpS6d/sGx/N5T 3aOCUMEhmpl8pArbMKhcNOLJanIF8rlsmjWr96qONHWBophn2s6WFubGCvhN//3zeSK1 T5jQVJzILr8NkoBsXXl2zoct+scnBFa/+ADlE0AdZS+8QJA5/5odJJY313N3V8+4JcAP CTS5zE/PsfCrnP4ngAOY2VYta3HyyPH6qktSUPDJtfKCBrzzkARA1lYy5thd9dRTdJfj la2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736887375; x=1737492175; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dedt2iOdRid8QeXO3wtoStVGyLUekpZE+D2rqVAFzvQ=; b=q6WdO6GZVSbld3aeU/TXp8hh5s5f9n7rdekHIE9nHBIdxuFVmmudfHY2lOr64hEhd1 vhNwQPWmvnAP4USUT4EFNIuNj1OBYMfH+lFoFgaBJVpG7vY7+qCE7L7EaVhjlkoMxxJp lQZbmZMXtKYh9Wbe6xQz7cHKP3p9GG3ntuhfHtoI/+W4lhnccXOX+EiGfLG3Xr4DqWJU 0D6ZiKpcA5MUP7A8q8SJe5qIOqfpXNGZZIAUtk7esLYhqSf//jpC2pT1BENfjgNHqKIP uG1nruMM6SpVkOzVntITkReugXMXmFJZSHSl8n0XespYN4M3V7XpMiM6ZlLfgtRzaNtJ GzxA== X-Forwarded-Encrypted: i=1; AJvYcCWty6ayp3//mwBoFODOJ2kh1aSiGab0q4bgMSn3Vkm1iVZq9sxcOzgnVdG+ercFb7vXW7bon57++VDEqXVWfRLxoXwY8Eg=@freebsd.org, AJvYcCXodiV+kwe+unO9d8iZi2k4/YJKUtOgkseSucK8T5kPqwNISi2Ze5KNyvThNa/uDLYfVcQ+vFnEqMk0CZiLGQrc5w5X@freebsd.org X-Gm-Message-State: AOJu0YwOVzk372G6AHkL6AIyrALEoeMPvCyUmlJu8AiLkzm7bmGF+C7T CzVeZsjE17/OGOAQ+Dj/OBbSOwmA35EUf4dpPl/F+23FpMdJOmlqtXHPoA== X-Gm-Gg: ASbGncvgoejJYgN65RQHpJVmTOd4yk5AzxT/cB2XVps8FIoPV2YujKatmbnj7YEfHBk tTUuGfdTt7yYn0WYdmUd/09t04OCsIZNW2mcq46JWyijYZsEf+hmz1Gps+4nH16/CwW7mXnEeZV l1bHz4IWVu2lD2TMK7f33Q+0p9ewKMrpF5KyTwigrcWE1MrKFmk5A6Tiu8OslIjs44KVTTfuzXm oMyMWuhE+6y0bbLcp5KKzSx/i3uMwDYi41m2nHrfQzhfwJocjmKERiKaCwnud5G/FC78dk= X-Google-Smtp-Source: AGHT+IEwpkokaGMxzMKZU4zTgiwEmzBdKBtA0IGRgRvb96T3VFekfM+tMGILn4Cn7p/U0NeqG7V6Pg== X-Received: by 2002:a05:622a:1314:b0:467:5da6:808f with SMTP id d75a77b69052e-46c7108f485mr385721951cf.22.1736887375338; Tue, 14 Jan 2025 12:42:55 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dfade72b04sm56325036d6.83.2025.01.14.12.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 12:42:54 -0800 (PST) Date: Tue, 14 Jan 2025 15:42:52 -0500 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9a2ae72421cd - main - libthr: switch thread and sleepq memory allocator to crt from libc malloc Message-ID: References: <202501141755.50EHtFwt072647@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202501141755.50EHtFwt072647@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4YXh0K0cxMz4K6f X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] On Tue, Jan 14, 2025 at 05:55:15PM +0000, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9a2ae72421cd75c741984f63b8c9ee89346a188d > > commit 9a2ae72421cd75c741984f63b8c9ee89346a188d > Author: Konstantin Belousov > AuthorDate: 2025-01-14 09:06:58 +0000 > Commit: Konstantin Belousov > CommitDate: 2025-01-14 17:55:08 +0000 > > libthr: switch thread and sleepq memory allocator to crt from libc malloc > > There are more complex interactions between malloc and libthr > initialization that can happen if libthr functions are called from ELF > object' constructors, before libthr is initialized. Break the > dependencies loop by using the private allocator with controlled init. > > Reported by: yuri > Reviewed by: markj, olce > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D48454 I see some startup deadlock when running the googletest regression tests (/usr/tests/lib/googletest/gmock_main) after this commit. gdb (which itself also hangs due to this bug) shows: (gdb) bt #0 _umtx_op_err () at /home/markj/sb/main/src/lib/libsys/amd64/_umtx_op_err.S:38 #1 0x000015e1ba96fd2c in __thr_umutex_lock (mtx=0x15e1ba974468, id=100113) at /usr/src/lib/libthr/thread/thr_umtx.c:69 #2 0x000015e1ba966a41 in __thr_calloc (num=1, size=17) at /usr/src/lib/libthr/thread/thr_malloc.c:92 #3 0x000015e1ba969213 in mutex_init (mutex=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) 0x15e1bd5c0240, mutex_attr=, calloc_cb=) at /usr/src/lib/libthr/thread/thr_mutex.c:291 #4 init_static (thread=0x1dc347e4b008, mutex=mutex@entry=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) 0x15e1bd5c0240) at /usr/src/lib/libthr/thread/thr_mutex.c:307 #5 0x000015e1ba967192 in check_and_init_mutex (mutex=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) 0x15e1bd5c0240, m=) at /usr/src/lib/libthr/thread/thr_mutex.c:606 #6 __Tthr_mutex_lock (mutex=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) 0x15e1bd5c0240) at /usr/src/lib/libthr/thread/thr_mutex.c:751 #7 0x000015e1bd54e714 in std::__1::__libcpp_mutex_lock[abi:se190105](pthread_mutex**) (__m=0x15e1ba974468) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/include/__thread/support/pthread.h:95 #8 std::__1::__call_once (flag=@0x15e1bd5c0cf0: 0, arg=0x11, func=0x0) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/call_once.cpp:44 #9 0x000015e1bd58a6a3 in std::__1::call_once[abi:se190105](std::__1::once_flag&, std::__1::locale::id::__get()::$_0&&) ( __flag=..., __func=...) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/include/__mutex/once_flag.h:131 #10 std::__1::locale::id::__get (this=0x15e1bd5c0cf0 ::id>) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:596 #11 std::__1::locale::__imp::install > (this=0x15e1bd5c0e30 , f=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:153 #12 std::__1::locale::__imp::__imp (this=this@entry=0x15e1bd5c0e30 , refs=refs@entry=1) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:161 #13 0x000015e1bd58c143 in std::__1::__no_destroy::__emplace[abi:se190105](unsigned int&&) ( this=0x15e1bd5c0e30 , __args=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/include/__utility/no_destroy.h:42 #14 std::__1::locale::classic()::$_0::operator()() const (this=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:502 #15 std::__1::locale::classic () at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:500 #16 0x000015e1bd58ea0b in std::__1::locale::__global () at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:509 #17 std::__1::locale::locale (this=0x15e1bd5c0798) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/locale.cpp:523 #18 0x000015e1bd55fcf0 in std::__1::basic_streambuf >::basic_streambuf (this=warning: (Internal error: pc 0x15e1bd5c0790 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0790 in address map, but not in symtab.) 0x15e1bd5c0790) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/include/streambuf:300 #19 0x000015e1bd56d9b8 in std::__1::__stdinbuf::__stdinbuf (this=warning: (Internal error: pc 0x15e1bd5c0790 in read in CU, but not in symtab.) warning: (Error: pc 0x15e1bd5c0790 in address map, but not in symtab.) 0x15e1bd5c0790, __fp=0x15e1c095a560, __st=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/std_stream.h:72 #20 std::__1::DoIOSInit::DoIOSInit (this=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/iostream.cpp:131 #21 0x000015e1bd56e06d in std::__1::ios_base::Init::Init (this=) at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/iostream.cpp:166 #22 0x000015e1bd56eef5 in __cxx_global_var_init () at /home/markj/sb/main/src/contrib/llvm-project/libcxx/src/iostream_init.h:2 #23 0x000015e1bd56eef5 in global constructors keyed to 000100 () from /lib/libc++.so.1 #24 0x0000357474de453d in objlist_call_init (list=list@entry=0x15e1b85f0a70, lockstate=lockstate@entry=0x15e1b85f0860) at /home/markj/sb/main/src/libexec/rtld-elf/rtld.c:3110 #25 0x0000357474de3219 in _rtld (sp=, exit_proc=0x15e1b85f0ae0, objp=0x15e1b85f0ae8) at /home/markj/sb/main/src/libexec/rtld-elf/rtld.c:974 #26 0x0000357474de0019 in rtld_start () at /home/markj/sb/main/src/libexec/rtld-elf/amd64/rtld_start.S:40 From nobody Tue Jan 14 21:24:23 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXhwC0823z5kRQx; Tue, 14 Jan 2025 21:24:27 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXhwB6JpWz3CPt; Tue, 14 Jan 2025 21:24:26 +0000 (UTC) (envelope-from glebius@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736889866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JMyS2RPydxs8FUQzvVZqFJTg33ialBEy1KJn/JTyWNc=; b=nn16bKongy1+Axr2m0SqqSLae1Ygcm62zOjeGHS1b3EAKIM2rDgLgPP1FKZf2eCbjXD6HO 9mBQEewk4taYj9sNe0QB05uNDMQ7H27NmAOoiquCusqRznuT52tKL4M2kPh7mh6pWRY365 rD4EYWsV5Ilkzo+M2ZC+rA+sq0ReokWuZZK1hdUSf6jo0vcuDKqLV41tHS/dQkT/bw2Qji GKsd8qGWInx12PFo7HNgvsNDyvYgYu40Yh0L4VOLSbCAkPE94H2HqfYy2I6l5fmSaD1weY c9pCtlcZ4D0XY1oZ+l3w4Bp9Jf8P5BsqW6RJbf4sOCY3ZusievlMFsVzUZgMQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736889866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JMyS2RPydxs8FUQzvVZqFJTg33ialBEy1KJn/JTyWNc=; b=PgmGZBpiH0VV0DFhtaZRGD109CFhERARWRe6RNezPOEf4fMW0ATeg5Hbis2zIeASx/aU1r 4qdYvR2pD/oiyynTiKqGvNUpKnvx1K+BMGJfepIXrO0mf/K0jnYrqQCZuo+yKXlWs6AG7r xNetv+6r32jznvV0ndEEyYYe4wOqISzsEWTkoIduPZogsyi1KvG7TA0DooA5u59LRPrZMc 8WQ+6OkWcPrw8aHNegv3nU8j0PNSmFIfxsgbp4gCoJqvszUnKu88DPQcgv+9va8475Aydh vgwKVHYDosy5wxNHu6NsRKwvxhFCyC2VPXwI1xiAbeXQ6wJ3sKQtxNVom9UMwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736889866; a=rsa-sha256; cv=none; b=N0flQT8bAXK9FV9l4Cs5uRU4Qc7d7tawYYhH/rYMrUf3O4t7dxBT9+EYmhwUkVID86IDLv /B3FFTtfrniABFk77mvx88J1bQDszMIxSzVx7HywzBbm7B5asi8W1M4HNyEim2b9W5dbPB oO/w5a2/lsWmdvi/BVh8HNT44orZ+UuG1S57hgHQzcnJq/3l3jEyQg57WB/87Lv3tnYDHY m3289AWp322nX/ji4CUYIvMcf8t9uOt2MO1Evhrxr7VaNdop846WQuOIb8p+Dvt0MjP5Ls Mu9XQoh4bOgJw073ilEsK+NVtKZnWBko6JbDWCbaENG5+x3jomdDyba67ASM4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: glebius) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YXhwB0plzzvJt; Tue, 14 Jan 2025 21:24:25 +0000 (UTC) (envelope-from glebius@freebsd.org) Date: Tue, 14 Jan 2025 13:24:23 -0800 From: Gleb Smirnoff To: Kristof Provost Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 441d489493e8 - main - pf: convert DIOCRCLRTABLES to netlink Message-ID: References: <202501141037.50EAbj9o047733@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202501141037.50EAbj9o047733@gitrepo.freebsd.org> On Tue, Jan 14, 2025 at 10:37:45AM +0000, Kristof Provost wrote: K> The branch main has been updated by kp: K> K> URL: https://cgit.FreeBSD.org/src/commit/?id=441d489493e8a1e2658306f1a4c709a0b18cc78b K> K> commit 441d489493e8a1e2658306f1a4c709a0b18cc78b K> Author: Kristof Provost K> AuthorDate: 2024-12-03 15:53:08 +0000 K> Commit: Kristof Provost K> CommitDate: 2025-01-14 08:54:17 +0000 K> K> pf: convert DIOCRCLRTABLES to netlink K> K> Sponsored by: Rubicon Communications, LLC ("Netgate") K> --- K> lib/libpfctl/libpfctl.c | 44 ++++++++++++++++++++++++++++++++++++++ K> lib/libpfctl/libpfctl.h | 3 +++ K> sbin/pfctl/pfctl.c | 4 ++-- K> sbin/pfctl/pfctl.h | 5 +++-- K> sbin/pfctl/pfctl_radix.c | 16 -------------- K> sbin/pfctl/pfctl_table.c | 4 ++-- K> sys/netpfil/pf/pf_nl.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ K> sys/netpfil/pf/pf_nl.h | 10 +++++++++ K> 8 files changed, 119 insertions(+), 22 deletions(-) K> K> diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c K> index 2e4cdb91bad9..b374ef05e4d7 100644 K> --- a/lib/libpfctl/libpfctl.c K> +++ b/lib/libpfctl/libpfctl.c K> @@ -3072,3 +3072,47 @@ pfctl_get_srcnodes(struct pfctl_handle *h, pfctl_get_srcnode_fn fn, void *arg) K> K> return (e.error); K> } K> + K> +static struct snl_attr_parser ap_ndel[] = { K> + { .type = PF_T_NBR_DELETED, .off = 0, .cb = snl_attr_get_uint32 }, K> +}; K> +static struct snl_field_parser fp_ndel[] = {}; K> +SNL_DECLARE_PARSER(ndel_parser, struct genlmsghdr, fp_ndel, ap_ndel); Looks like userland can also appreciate an empty vector that belongs to the library. Just like in e9255dafa1ef0c635385aee78ead3a0050b19cca. -- Gleb Smirnoff From nobody Tue Jan 14 22:12:06 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXjzC0h6Lz5kVbj; Tue, 14 Jan 2025 22:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXjzC02Ctz3H3c; Tue, 14 Jan 2025 22:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736892727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IDNesE/SXtE7wt1LjIPGK7XuEd25NBEgDkOWRSf3v/o=; b=bHnbAQr8YYrB1hxGIWXtu8G3G1O6H7kuE/aGJh0Vc+fm3yEcpzDpcekSUUu7NB/xW8oaSm 05GtNUGrNCVn0h/oct27ep1s6bm0OLVMhAF2IREDBHPgzsfUiNBYGb6XG+gTn+fYRV/ImH PY9PY5RMpYW0RqEc3QKXtLRUIKFi/XA5S+d3vnEdoMR2yGjw/D+a5M/t9CI6qO2TT0Eop/ Me3nSBDbWd7CYYeMjYS4DBbF5d5OW57B2S8CQ+DU/A3hedEoSzHRP/UMsUdamcZu4H8UCR gnNT6oJndI9Nw1MGhP7vAvuRv4D7hv7P4tWMb8+SOTwbp6ETpqoshZxkfsVydQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736892727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IDNesE/SXtE7wt1LjIPGK7XuEd25NBEgDkOWRSf3v/o=; b=WWZxpsQEP7Ni5//736w+UFrirlKxAFZ56MLzJVt992vOD69dnjCvhXX1jyGbcP8pKylcmA UE5RwQqPPeBu6SvUF9/YCoR1LA0wj2yHr3Od2sxp8qRO7WZgQLXIz7QZJ69cW8XSg7cAi3 apWjtlrkOE7xNZ5Aju+MAAVuePhNTI83D9584PvlKrO4LCPAExnDQ6mQje19ma29WL0jQ7 7EETzI/x3A/cgZxs+vwkcGi3evbNhRYkicNMdOMsFogCJ3dYTlrtqSXi5KPb7iChKtWJmM /i3N8Fiv45b3Yl+uD02OB7gjl5/U1blD8wb0iMLQQwRWKvYuokZ6LSNGLwWmFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736892727; a=rsa-sha256; cv=none; b=X5pk5PJp9qCSXh1wOK9dcIpP8PicFn8hKXfrm0DlsxqO6C0p/kgq71rw6QLhGGYwAi4OSi lMTLNYW5HrxMvVA1fJgCQSs+wgH8RXvi6/rsZhMn80T1JaNRsaYTCxa0izTo3AwzL9CExu d5+0jDgQSfi1aFRCsdvUuM1hcytH1584dlsrO7v85Gbso/BqsyWpIm74Yx2XByu9uKUkbT SIn/Sxgt6XZxsBIENToghIGgLIRx2ay/Rb9ECEhRRnLpwM5gRX9bdSBKWw3ceuI9vLXIjz e5im4Wqtg8p1bYF8XcvDjNmSjS3ahrkyu3Gl5ySXDOZsnZnRUaMIHAKYn7ynXQ== 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 4YXjzB6W88z4Lq; Tue, 14 Jan 2025 22:12: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 50EMC6QN057760; Tue, 14 Jan 2025 22:12:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EMC6n3057757; Tue, 14 Jan 2025 22:12:06 GMT (envelope-from git) Date: Tue, 14 Jan 2025 22:12:06 GMT Message-Id: <202501142212.50EMC6n3057757@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 1cd455f39d88 - main - fs: Add new VFCF_xxx flags for va_filerev List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1cd455f39d886f27c33f7726f79fc4cc566da7b3 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1cd455f39d886f27c33f7726f79fc4cc566da7b3 commit 1cd455f39d886f27c33f7726f79fc4cc566da7b3 Author: Rick Macklem AuthorDate: 2025-01-14 22:11:06 +0000 Commit: Rick Macklem CommitDate: 2025-01-14 22:11:06 +0000 fs: Add new VFCF_xxx flags for va_filerev Richard Kojedzinszky reported a problem via email, where the Linux NFSv4.2 client did not detect a change in a directory on a FreeBSD NFSv4.2 server. Adding support for the NFSv4.2 change_attr_type attribute seems to have fixed the problem. This requires that the server file system indicate if it increments va_filerev by one, since that file attribute is used for the NFSv4.2 change attribute. Fuse requires an indication that va_filerev is based on ctime. This patch adds VFCF_FILEREVINC and VFCF_FILEREVCT to indicate this. A future patch to the NFS server will use these flags. Reviewed by: asomers, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D48436 --- sys/sys/mount.h | 2 ++ sys/ufs/ffs/ffs_vfsops.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index ac84c99ac74b..6715c55d7a6d 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -685,6 +685,8 @@ struct ovfsconf { #define VFCF_SBDRY 0x01000000 /* Stop at Boundary: defer stop requests to kernel->user (AST) transition */ #define VFCF_FILEMOUNT 0x02000000 /* allow mounting files */ +#define VFCF_FILEREVINC 0x04000000 /* va_filerev is incr. by one */ +#define VFCF_FILEREVCT 0x08000000 /* va_filerev is set to ctime */ typedef uint32_t fsctlop_t; diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 2bfee6a6145d..9e94d368d7c9 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -117,7 +117,7 @@ static struct vfsops ufs_vfsops = { .vfs_susp_clean = process_deferred_inactive, }; -VFS_SET(ufs_vfsops, ufs, 0); +VFS_SET(ufs_vfsops, ufs, VFCF_FILEREVINC); MODULE_VERSION(ufs, 1); static b_strategy_t ffs_geom_strategy; From nobody Tue Jan 14 22:19:08 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXk7c2tlFz5kVv2; Tue, 14 Jan 2025 22:19:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXk7b4HfQz3HbF; Tue, 14 Jan 2025 22:19:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 50EMJ8lJ019196; Wed, 15 Jan 2025 00:19:11 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 50EMJ8lJ019196 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 50EMJ8QW019195; Wed, 15 Jan 2025 00:19:08 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 15 Jan 2025 00:19:08 +0200 From: Konstantin Belousov To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9a2ae72421cd - main - libthr: switch thread and sleepq memory allocator to crt from libc malloc Message-ID: References: <202501141755.50EHtFwt072647@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4YXk7b4HfQz3HbF X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Tue, Jan 14, 2025 at 03:42:52PM -0500, Mark Johnston wrote: > On Tue, Jan 14, 2025 at 05:55:15PM +0000, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=9a2ae72421cd75c741984f63b8c9ee89346a188d > > > > commit 9a2ae72421cd75c741984f63b8c9ee89346a188d > > Author: Konstantin Belousov > > AuthorDate: 2025-01-14 09:06:58 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2025-01-14 17:55:08 +0000 > > > > libthr: switch thread and sleepq memory allocator to crt from libc malloc > > > > There are more complex interactions between malloc and libthr > > initialization that can happen if libthr functions are called from ELF > > object' constructors, before libthr is initialized. Break the > > dependencies loop by using the private allocator with controlled init. > > > > Reported by: yuri > > Reviewed by: markj, olce > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D48454 > > I see some startup deadlock when running the googletest regression tests > (/usr/tests/lib/googletest/gmock_main) after this commit. gdb (which > itself also hangs due to this bug) shows: > > (gdb) bt > #0 _umtx_op_err () at /home/markj/sb/main/src/lib/libsys/amd64/_umtx_op_err.S:38 > #1 0x000015e1ba96fd2c in __thr_umutex_lock (mtx=0x15e1ba974468, id=100113) at /usr/src/lib/libthr/thread/thr_umtx.c:69 > #2 0x000015e1ba966a41 in __thr_calloc (num=1, size=17) at /usr/src/lib/libthr/thread/thr_malloc.c:92 > #3 0x000015e1ba969213 in mutex_init (mutex=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) > warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) The following fixed the issue for me. I am somewhat surprised that the problem did not manifested itself before. commit 783d95d0d6e6e508705cf16cfd9e4a5e2f8db8e4 Author: Konstantin Belousov Date: Wed Jan 15 00:11:48 2025 +0200 libpthread_init(): ensure curthread == NULL until set explicitly Otherwise libthr::_get_curthread() returns a garbage kept there from allocate_initial_tls(), until libthr initialization proceeds enough to set initial pcb->pcb_thread. The garbage pcb_thread was dereferenced as struct pthread and some memory read as TID. Since it was not consistent between reads, thr_malloc_umtx unlock returned EPERM instead of clearing the lock word. Reported by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 708c425d69c1..e5e438897dee 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -334,6 +334,7 @@ _libpthread_init(struct pthread *curthread) /* Set the initial thread. */ if (curthread == NULL) { first = 1; + _tcb_get()->tcb_thread = NULL; /* Create and initialize the initial thread. */ curthread = _thr_alloc(NULL); if (curthread == NULL) From nobody Tue Jan 14 22:28:27 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXkL85LKzz5kWVQ; Tue, 14 Jan 2025 22:28:32 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXkL82P4Bz3L5W; Tue, 14 Jan 2025 22:28:32 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-6d8fd060e27so48823886d6.1; Tue, 14 Jan 2025 14:28:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736893711; x=1737498511; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=f4LxTL2KfiCyptCccNppROFKAhwK4vqnHgK9mBIC5vs=; b=ALpnpRf3LQGZPuQfK5HX6qJig16dKFU+AIQ3DAq05KQqHu4wU5sPlsFPRmObQuF9IO Z+zxnnqtWOaRwHNJ5C2wpDdijx3tC09MwSdakkvsNXvXP0d50G3I7T4bN/esvE/htfRg nJB1aVybAzSE4k57FvwNYC3RmcYfkt4CfYOWwXhrweSBakNmmSDpXiZV8m6Ed224srMd 9Mpp+DLBL8Su+ZshDfju6Iih1fvM7wR/Ol/T6JRI4vkL3ZAiIcq+VBvsnKhHw7Ybsgt0 pJrqjiXGRsBnyy22SSMb8Qd8Ofp7/Uf473uXOLbgLu2z04apF5p3U5ZU428EXo6PJW6B vuGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736893711; x=1737498511; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f4LxTL2KfiCyptCccNppROFKAhwK4vqnHgK9mBIC5vs=; b=sbMjEGBtZ5v7PdmiG3oxbQTxvioeCGdeGFdqn7b1kniTeLzWkRAiEbBfFUeOdvOhLu FsV7i1TgRcZJqEjjW0LO5g4pZIS+F+2M6JnZYtG9LLWIsgRsE3CEGZrFvwcWHmxOZm7P JQ14SGpD7Zs3g8/PYobiz80TKSlotVweOfLWf3IJKBIwtFbckBA/bVfVykhZRrIXagVs cdnm+QXsCLmla7i252x2THUfv801BzZe3+Kks683Z3Re/ElB/CtkCIij+IJaa+XWdDhC L5sb6Q9kFqYw6id700s+c292pKd1qlx7LhuNQ4dLM4qVMZbSo4gBfYJyS39NM1Vyvsqk YOKw== X-Forwarded-Encrypted: i=1; AJvYcCUCLzCtflwc3aMahXXCSGyfEcoRmW3mfqaV7I35TG/kHTHIpryl5Y/aLqKxKiuB9GpR0RYvaisHc4Hq9VWI5Wpi1jpN@freebsd.org, AJvYcCVcREw9UAreDYO/qJj4r+Nl0BBUUpX0ab3NKANvbQH61eTspj1mWmeBCxIPsYaHrwKavPlTE41YXQrPyGN+8auEm260w9A=@freebsd.org X-Gm-Message-State: AOJu0YyHm88IB03AoIYNtEM2dTC4KNBsTs1BPnWmsnxNKyargs7jdo3+ IJwYk/C2a3ycccHS8yNvwtwX7pbGeJ5mEfxZI8LwwTDHjh0lUagi X-Gm-Gg: ASbGncs7eHFr6pCudRGCTkNz7qG58D8+OSqB/Sb622zpq69JS53l0GDMbc79mIxstJC 1vhWuR9jaValOCwpdHV56dpePFgwDqKJRIAM4VHBg7V5FrPWnoSSiKZ9n/l5jx97UlNB6jiLaRn YJeAJKH/0jvNgzNd4mkNabSvg7IGMYgjhitu9WLtkjolGTulPEEWyHuPdyiUXcPNM8V4JB2aTs+ elCCktaf3KBq4aOHIxBWDF6q/kmcDsf9vITqOjeYevmQTAGH/6jXcLg0R8aKpS19fH8VfM= X-Google-Smtp-Source: AGHT+IEE4Wr7NSNoUczKtHxBvy255GMe1y7YIEE2ulwPPz8RWwzFVQGP5Qu5eEeKn81qJq0eyeUnDw== X-Received: by 2002:a05:6214:501a:b0:6df:9740:68a3 with SMTP id 6a1803df08f44-6df9b2b3231mr487072996d6.38.1736893711055; Tue, 14 Jan 2025 14:28:31 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7bce3516004sm651336585a.101.2025.01.14.14.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 14:28:29 -0800 (PST) Date: Tue, 14 Jan 2025 17:28:27 -0500 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9a2ae72421cd - main - libthr: switch thread and sleepq memory allocator to crt from libc malloc Message-ID: References: <202501141755.50EHtFwt072647@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4YXkL82P4Bz3L5W X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] On Wed, Jan 15, 2025 at 12:19:08AM +0200, Konstantin Belousov wrote: > On Tue, Jan 14, 2025 at 03:42:52PM -0500, Mark Johnston wrote: > > On Tue, Jan 14, 2025 at 05:55:15PM +0000, Konstantin Belousov wrote: > > > The branch main has been updated by kib: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=9a2ae72421cd75c741984f63b8c9ee89346a188d > > > > > > commit 9a2ae72421cd75c741984f63b8c9ee89346a188d > > > Author: Konstantin Belousov > > > AuthorDate: 2025-01-14 09:06:58 +0000 > > > Commit: Konstantin Belousov > > > CommitDate: 2025-01-14 17:55:08 +0000 > > > > > > libthr: switch thread and sleepq memory allocator to crt from libc malloc > > > > > > There are more complex interactions between malloc and libthr > > > initialization that can happen if libthr functions are called from ELF > > > object' constructors, before libthr is initialized. Break the > > > dependencies loop by using the private allocator with controlled init. > > > > > > Reported by: yuri > > > Reviewed by: markj, olce > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 1 week > > > Differential revision: https://reviews.freebsd.org/D48454 > > > > I see some startup deadlock when running the googletest regression tests > > (/usr/tests/lib/googletest/gmock_main) after this commit. gdb (which > > itself also hangs due to this bug) shows: > > > > (gdb) bt > > #0 _umtx_op_err () at /home/markj/sb/main/src/lib/libsys/amd64/_umtx_op_err.S:38 > > #1 0x000015e1ba96fd2c in __thr_umutex_lock (mtx=0x15e1ba974468, id=100113) at /usr/src/lib/libthr/thread/thr_umtx.c:69 > > #2 0x000015e1ba966a41 in __thr_calloc (num=1, size=17) at /usr/src/lib/libthr/thread/thr_malloc.c:92 > > #3 0x000015e1ba969213 in mutex_init (mutex=warning: (Internal error: pc 0x15e1bd5c0240 in read in CU, but not in symtab.) > > warning: (Error: pc 0x15e1bd5c0240 in address map, but not in symtab.) > > The following fixed the issue for me. I am somewhat surprised that the > problem did not manifested itself before. It seems to fix the hang for me as well, thanks. > commit 783d95d0d6e6e508705cf16cfd9e4a5e2f8db8e4 > Author: Konstantin Belousov > Date: Wed Jan 15 00:11:48 2025 +0200 > > libpthread_init(): ensure curthread == NULL until set explicitly > > Otherwise libthr::_get_curthread() returns a garbage kept there from > allocate_initial_tls(), until libthr initialization proceeds enough to > set initial pcb->pcb_thread. The garbage pcb_thread was dereferenced > as struct pthread and some memory read as TID. Since it was not > consistent between reads, thr_malloc_umtx unlock returned EPERM instead > of clearing the lock word. > > Reported by: markj > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c > index 708c425d69c1..e5e438897dee 100644 > --- a/lib/libthr/thread/thr_init.c > +++ b/lib/libthr/thread/thr_init.c > @@ -334,6 +334,7 @@ _libpthread_init(struct pthread *curthread) > /* Set the initial thread. */ > if (curthread == NULL) { > first = 1; > + _tcb_get()->tcb_thread = NULL; > /* Create and initialize the initial thread. */ > curthread = _thr_alloc(NULL); > if (curthread == NULL) From nobody Tue Jan 14 23:14:05 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXlLj5lL3z5kZDf; Tue, 14 Jan 2025 23:14: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXlLj4RgMz3QS8; Tue, 14 Jan 2025 23:14:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736896445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sr4BobZtwHQCSM90Jtyzhmub6i+jBNsHdcQKMtWkcqQ=; b=wGm9spjuyEbTnYf0/ULG0Q7EXDzmF77VMHCtJmO4JqyVhxWMTT3DNdxn0Qr9WEi73DkAu9 0d8Npfc427erPYZ6tsoxlwsFgYqvXGc/U8KGEQyALp0/7YVUzB6XBOXsMNkZ9acBrmVh92 DjzAnTJcjrtdDesNHaR78fdXuYx1DZGDMmwYFs8YMUE89YOP+MaGNkDvlRwBkVGftJ5PQY 6BEoC4CXcny2NbWlBQ2jE+QQaYner6eXSXLBSt8eT8vvr0nw1PTMHaOjwSIZm8cFmhvxKN klebXQEGPYOx6eaR+rXuaipGLGiWS9TEB/OfdC1MVwe+w9zrWX2ZCBZUfyVITA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736896445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sr4BobZtwHQCSM90Jtyzhmub6i+jBNsHdcQKMtWkcqQ=; b=UFM/anovoAEZjs48pHhkTcivYsgaJyAIQvOIzR2m5uemgCwKIMcjBnYHbTvYB7YcskTpRj 58bwxn99aEsMRoxW8MwI3fk6W6pES8RbgPfGOaa+b1OJ0pFhxn6bHsAIn9tr85omprjjXb m4y63JVgY6Y39rx/YP9vgcC48vrzZ1e6hn9kUOo1XBmYB9aWp8LzLKZUyi93LmQ+db8hpR brPBV9bAYv++oVOgngZGMDJlD1k/NXblY9pcmLx4m71TvXGeR6gF+QMwO88c7uHF4qJC8D wYSD8MzPQ95lLjBKnEO6yuGe8TaUOj7rcjjR9jQ5hbvOIwxI1iDxd6msd78MlQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736896445; a=rsa-sha256; cv=none; b=FKNWb9t0wVvyMPJU9cl8+OJgh+UwVuFHzclkiKRcKGAx/UHq5lP6DZ69tCfsQD016W0EF/ ZcuoPlOChbuZzcvSXCvta5ygj6FP+Ad7bozdxb6WCgb7oKX4atFyPy2lg99dKkaH2HsiiB 5K3gFcooy9Sdy5v2zAaSW+v+0W7K+HNlh7QXe27Nx7p96xmCOK9pqxzf7z8PpSZ9W2GPAd 73ehi8nT5HbbcYPxHuXOwnP5/f/M4Rbk8jsu1XYEKGXz4+ue8F1eZpK+OgxYO1wXrTGNA+ NyfOThhnjNQ8cXKrqCrh4uHNWNT7p1+F8rTEeFQfAkJlaUgbgMQnQ6ruo2Y7tw== 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 4YXlLj3wvNz5nd; Tue, 14 Jan 2025 23:14: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 50ENE5TX072653; Tue, 14 Jan 2025 23:14:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50ENE57F072650; Tue, 14 Jan 2025 23:14:05 GMT (envelope-from git) Date: Tue, 14 Jan 2025 23:14:05 GMT Message-Id: <202501142314.50ENE57F072650@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 676be27133fa - main - libpthread_init(): ensure curthread == NULL until set explicitly List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 676be27133fa3296f3d9083732d8837a3eaa5ea4 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=676be27133fa3296f3d9083732d8837a3eaa5ea4 commit 676be27133fa3296f3d9083732d8837a3eaa5ea4 Author: Konstantin Belousov AuthorDate: 2025-01-14 22:11:48 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-14 23:14:00 +0000 libpthread_init(): ensure curthread == NULL until set explicitly Otherwise libthr::_get_curthread() returns a garbage kept there from allocate_initial_tls(), until libthr initialization proceeds enough to set initial pcb->pcb_thread. The garbage pcb_thread was dereferenced as struct pthread and some memory read as TID. Since the read might not be consistent between reads, thr_malloc_umtx unlock sometimes returned EPERM instead of clearing the lock word. Reported by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libthr/thread/thr_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 708c425d69c1..8855491b91cb 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -334,6 +334,8 @@ _libpthread_init(struct pthread *curthread) /* Set the initial thread. */ if (curthread == NULL) { first = 1; + /* Force _get_curthread() return NULL until set. */ + _tcb_get()->tcb_thread = NULL; /* Create and initialize the initial thread. */ curthread = _thr_alloc(NULL); if (curthread == NULL) From nobody Tue Jan 14 23:36:10 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXlrC11Rpz5kbK8; Tue, 14 Jan 2025 23:36: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXlrC06z7z3S4r; Tue, 14 Jan 2025 23:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736897771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1PHLfCKsCU+39rEEy0Y8vVZyUC+d04oaekZ9k5emcHM=; b=vFhTzdEtMSgmHVsd6rEPpyqPs9ljBPnwznaO+E1gwp5p3+wj+4+eMHvOy7nzR0MHGC5G6r GhdNTCu8iCIeOc0BULgOLHCensN+psths4YSjAHK66Iu2vKzLe9a1ztnxBE/e2RgIGu3Fb Uvqjuh1UKVoz8iBXXxRDFCUgrEByP6pmBNeU76kiR19Rl7Y4jqL2dSwvgzzJH5eaKjVCXh wlskxYkW3obx//e/kMHdiwwl63O44480G/OoVvt8bmvFtO7Z9G+8gtU0TuXqOduXFnmcLH jZ51JJG7aSZomGhwR88TTnfA2LaC+BlGaMVY3JMUiF4QI3NlQPxlulFfP/9Plw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736897771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1PHLfCKsCU+39rEEy0Y8vVZyUC+d04oaekZ9k5emcHM=; b=XObbz+4xuZTTsxqlueXOpj+6kV3W4Qikzxt3AgBMiGZLGY1CjBpIlLFhx86S6liqBMKVUr GUzaG822aAZqmYb1gXffa8rolebtjEgDosXSC0V3I7VbkJEe06bfP5mTiJ4fxniS7Lc59l qFMcHkoFqbqmqSuoYy6MHL4i0mE1SRd7rw8HcxpT/pNkv4SZ9r6YPYP3ukAuFCQbhX0Ll+ L1UxUNb9SKmOkrsUBs7GjI1PrfuPHVHkD5P+gd2RQxbxy3VEgg7FoDyIJSFILPeHTTm4cm V1M7AX4m29FrXPaEqBoyL8nNlkHsXyk63BdF5/EhQ4Vj5TbvUSgLeS6xrAi2Iw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736897771; a=rsa-sha256; cv=none; b=wVlSwZ6rXjKRdc3Tj8P8HPFr/iQ+iO75S/SbG9QavMKAbfsZKmG7USzT4IowuMUhn6uROF GwC90mt0IDUhVUMQfvwMx9usebRvQlIVAroQvYRPNbl2HpTS0pi1F6Tb5dVZOreIZwrofY 60GlzQ7V8yNvatgBJPc/4AWYOLqMVgw0fv1On3TnP21fElTjX44gwO3i94FDdoIc/XlVS0 CfRzHq7dSv9dOAzX+v9rPlLEqsv0D0xxtJCYcWmBn+DIeXXUHivzWEjJqD9C5obXFRh+LU g5ynRyVNamLGzJ9tNJusOlRz51XN7Esbml9A0Z8+k6wllceXQq0LmHnWBJ58VQ== 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 4YXlrB6fHqz6Lm; Tue, 14 Jan 2025 23:36:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50ENaA2x011141; Tue, 14 Jan 2025 23:36:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50ENaAp2011138; Tue, 14 Jan 2025 23:36:10 GMT (envelope-from git) Date: Tue, 14 Jan 2025 23:36:10 GMT Message-Id: <202501142336.50ENaAp2011138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 02703de8bcae - main - pthread_create(): style List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02703de8bcae3b45e6d96e8467d5fa512d62cc3d Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=02703de8bcae3b45e6d96e8467d5fa512d62cc3d commit 02703de8bcae3b45e6d96e8467d5fa512d62cc3d Author: Konstantin Belousov AuthorDate: 2025-01-14 23:32:06 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-14 23:35:38 +0000 pthread_create(): style Use NULL instead of 0 for null pointer. Use != 0 for non-bool, as in the rest of the function. Remove unneeded (). Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libthr/thread/thr_create.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c index 4de9bd84ca5b..2ae7cf0cd7b2 100644 --- a/lib/libthr/thread/thr_create.c +++ b/lib/libthr/thread/thr_create.c @@ -146,7 +146,7 @@ _pthread_create(pthread_t * __restrict thread, _thr_stack_fix_protection(new_thread); /* Return thread pointer eariler so that new thread can use it. */ - (*thread) = new_thread; + *thread = new_thread; if (SHOULD_REPORT_EVENT(curthread, TD_CREATE) || cpusetp != NULL) { THR_THREAD_LOCK(curthread, new_thread); locked = 1; @@ -226,8 +226,8 @@ _pthread_create(pthread_t * __restrict thread, THR_THREAD_UNLOCK(curthread, new_thread); } out: - if (ret) - (*thread) = 0; + if (ret != 0) + *thread = NULL; return (ret); } From nobody Wed Jan 15 02:26:32 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXqcm5gQPz5klp7; Wed, 15 Jan 2025 02:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXqcm4jf6z3dlZ; Wed, 15 Jan 2025 02:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736907992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1YWYzpAF1QoJeRWRWfI85GQ/8uBg/fHxVZkK3JNxI5M=; b=eUgqLvNpO2va64oxXVBGEs+hYZvM+yO+D+WRP7NoAjQLSePca9e9WmieHD25rkBromYby0 erabZQPpJv/3kE9315tFxXJTPJtkVU5wqH351Q4afKRBNN//F4HZjiowq8cIvvS7gY3TXm gNmODJC1+FtBLJ4IXO2fOawLL6SADv5GjaGHtkrja6e7VBXFQzvGrhOV/A6KE3JEslz6+W 1Tz2QWVlkBqkGlekSk4kqpCZa9CGyOwYHrOW2O6+SGQgSx6vtbR4HbZa/NzdSAaZl8yCyb OgZARy2rKfnTzThNW+LuAjaukF7VC6t6pPEKrvPAfNg5K0JsvXS8rqgoUAK5rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736907992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1YWYzpAF1QoJeRWRWfI85GQ/8uBg/fHxVZkK3JNxI5M=; b=kud0czpS0h+Hn9dccEtuQdASG6RjHb9l1apQIgHRmhSGfZgzP2VWb8Ux9iaznPleAQYLyI ofIxK4vOo84jmlbJgkhdaow4v3H/Ds367QI/gAq7EiYjDw+BgSM610KexORzzj3t8+KkWa lDkUR9Wial0XxrD7pl0bWhOcyJ6Qo3qkpA2uVPik6t9tQ6rFRW/f0ZXEXvXJYbdTQwjqwG pbNNLOCkvoPKXvv06BniFo27vUb8HLQCtkpTZx4B59+iKzL+RkocBuKIFKanqolf67fmCu a12lsUJt1E9YsM3FFHggL5Yq+x+OjrL8/y9VQbW7BFJ7w/kSM0Y1RKvD6VNTqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736907992; a=rsa-sha256; cv=none; b=P2sQD6tG2eqjyw0nq0R2qi0SQ9Ju997o1UyuHS+4HA+79EDVRF0tDNfKN0QhGaTh3fTcBT gBquigQIRKSDLtnT+Z1WXmgGjLsBZ86b+LS4N96lQ067DmscLhpYtxtQ8ZKCckY0i3IWEM ETVvw7wtdUH634lJt7/YFtALHyEKT6mGecbMY79iaEUT2UZ+vwYVhZRsV1qMh0X71d2rCl iAqJX1Huo7FT4zaUc2aI5pqtqzVnaAu5ASFMf6e2u2eGOCjr9/kfRw2E2W4cOOfUtQi7ol kARc41JX2uqxLQzGoELCqVb/WGMnBqpDtet3xo+fYyZZXsc7j90He5PYoZGWpw== 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 4YXqcm42lczBxj; Wed, 15 Jan 2025 02:26:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50F2QWYf028336; Wed, 15 Jan 2025 02:26:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50F2QWvU028333; Wed, 15 Jan 2025 02:26:32 GMT (envelope-from git) Date: Wed, 15 Jan 2025 02:26:32 GMT Message-Id: <202501150226.50F2QWvU028333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: dea3eef94caf - main - uart: Ingore pl011 historic mistakes List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dea3eef94cafb3bb1e5f04bc96b5636ffca92ee7 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dea3eef94cafb3bb1e5f04bc96b5636ffca92ee7 commit dea3eef94cafb3bb1e5f04bc96b5636ffca92ee7 Author: Warner Losh AuthorDate: 2025-01-15 02:17:46 +0000 Commit: Warner Losh CommitDate: 2025-01-15 02:24:35 +0000 uart: Ingore pl011 historic mistakes Some veresions of EDK-II and QEMU reported the wrong values for the register shift and the region I/O size. Detect those and set it to the correct values. In general, anything other than a shift of 2 and a regio width of 4 (bytes, or 32 bits) is a mistake. However, allow for overrides in the future by only overriding the buggy values. Otherwise, we will fail to boot. PR: 282936 Sponsored by: Netflix Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D47946 --- sys/dev/uart/uart_dev_pl011.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_dev_pl011.c b/sys/dev/uart/uart_dev_pl011.c index 4f946f7c5f36..e7a2ff7a85f1 100644 --- a/sys/dev/uart/uart_dev_pl011.c +++ b/sys/dev/uart/uart_dev_pl011.c @@ -172,6 +172,27 @@ static int uart_pl011_probe(struct uart_bas *bas) { + /* + * Versions of QEMU before 41f7b58b634e (8.3) reported bogus values for + * this tabel. The PL011 IP is always 32-bits wide and should be shifted + * 2 to match the 4-byte size of the data. QEMU reported these values + * incorrectly before that. + * https://github.com/qemu/qemu/commit/41f7b58b634ec3b60ae874375d2bbb61d790971e + * + * In additon, other hardware vendors also reported this value + * incorrectly. It's not tied to what the ACPI device node is, but was a + * misunderstanding coupled with a Linux driver that didn't need the + * right values. Quirks used to be used to ignore the bad values, now we + * detect the historic mistake and override (to allow for a future where + * we may need to override these values). + * + * PL011 Docs: https://developer.arm.com/documentation/ddi0183/latest/ + */ + if (bas->regshft == 0 || bas->regiowidth == 1) { + bas->regshft = 2; + bas->regiowidth = 4; + } + return (0); } @@ -356,7 +377,8 @@ static struct uart_class uart_pl011_class = { .uc_ops = &uart_pl011_ops, .uc_range = 0x48, .uc_rclk = 0, - .uc_rshift = 2 + .uc_rshift = 2, + .uc_riowidth = 4, }; UART_CLASS(uart_pl011_class); From nobody Wed Jan 15 02:26:33 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXqcn68Y7z5klg2; Wed, 15 Jan 2025 02:26:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXqcn53Btz3dHr; Wed, 15 Jan 2025 02:26:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736907993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rCTsKMw1vKIdRNWTdM+Umr/LhvlamMog3cu5YGmrpu8=; b=G39tO1LpYosKZHNfJ3t+WdKbapNc/LC4DyYJe0xCZAM+JYWBzvmgrwwMUbBeG37IZHJ9Rp 4rnJZjcapgW/ukGKjBIyZVDM7lNeQCKEVbmaztZu9E97sXLuQ7Ign4tqphSzTF5QCUUQ+/ v6h30BaCIdpkuiLUWAb8Kc76NV56lzwBQAZp4FfVeGhHSZlkzh1kmr6Gx1aFoI3/X1x+je SI7JxRBvhZEemCh/UIKgn8bLsEDZVs+zwNfUWC2VaP8PeFttGY2Mq5g/AMf6IUbK1tVqr+ vGWiwYjcLYnT/HcO9X5w4Pb7FXXYLWoCNVEoTxhxKVbnVzDNIyt1oqcr5gijWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736907993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rCTsKMw1vKIdRNWTdM+Umr/LhvlamMog3cu5YGmrpu8=; b=p96uH7Y4+moHcQSGZuOlE7aFaMB1Y/Gp+v56AFpmKffoDFuk2gwsvssuVUeE+Z4VbUl+ng h5r6HZRVBU4ok40OqyinkZ6we9mR1DU+N4UXD4rZ9SZSU52e/zwqCHT3j5spoozsB/XJzi +ixAxz3U3h+POVfyms+cLs8cxdtTqSCEyj40spnbycY4WMpZ2ZX+GNDwdhbWmPqvPE6Rly NYdq/9IZT/XJw6Vs25JDREmVYsD3kDjS+wSpvRgZHOSChqLdYdBw+9SiPt9ritw1Eo0iOa ALzhF0RQDjgvvj29EcVB3oYo0iH6IlFV1oMno/fUBdyOH4IMCq2CXD6zcFlJAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736907993; a=rsa-sha256; cv=none; b=oSseQLWUk25vR211ue4tLEB1LWaWUR6IIqXBMC9rpJSu6ELbsZ4D9vXX33H0+Sv8JNCxeJ lprh/TtwFaSAkb2C9WawdJV9rZSYiA7TI423FoGS2+qPeQ8I9Yby4O2tLdtDKZcgyugtf/ Jj03gHwDZh7ZqO+ZAUrgXLUGgAzCKQyYB6kqYiK1O5c0t3+5AylNAd++uFV6DfJKQl3vFZ kWrFDhGDNkmh7mMX4xG15jA0MNzaBAN3Mtze/QcpWgeP1TVNtP34W+/CLRHdwuqEICJ5D0 cJ/61Jv6i69XUawvY/aDaFNUScaC/QD+aX4H4dUpRd73IdWi3zMYX7QDurvy/A== 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 4YXqcn4ZVqzBvM; Wed, 15 Jan 2025 02:26:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50F2QXZ2028382; Wed, 15 Jan 2025 02:26:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50F2QX9R028379; Wed, 15 Jan 2025 02:26:33 GMT (envelope-from git) Date: Wed, 15 Jan 2025 02:26:33 GMT Message-Id: <202501150226.50F2QX9R028379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 5db3699be68f - main - Kill ignore regshft flag List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5db3699be68f3a49d96d58c78af6f12e2dc1b38b Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5db3699be68f3a49d96d58c78af6f12e2dc1b38b commit 5db3699be68f3a49d96d58c78af6f12e2dc1b38b Author: Warner Losh AuthorDate: 2025-01-15 02:21:26 +0000 Commit: Warner Losh CommitDate: 2025-01-15 02:24:36 +0000 Kill ignore regshft flag This flag was introduced to ignore bad firmware values. These were present in older versions of EDK-II that many devices (both Ampere and Amazon) used. QEMU also used this value, but fixed it. But since it's tied to the firmware bug not the device name ID it doesn't make sense to have it flagged there. Sponsored by: Netflix Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D47947 --- sys/dev/uart/uart_bus.h | 1 - sys/dev/uart/uart_cpu_acpi.c | 12 ------------ sys/dev/uart/uart_dev_pl011.c | 6 +++--- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/sys/dev/uart/uart_bus.h b/sys/dev/uart/uart_bus.h index ccf8ad06a8ec..a605e3d20be7 100644 --- a/sys/dev/uart/uart_bus.h +++ b/sys/dev/uart/uart_bus.h @@ -56,7 +56,6 @@ /* UART quirk flags */ #define UART_F_BUSY_DETECT 0x1 -#define UART_F_IGNORE_SPCR_REGSHFT 0x2 /* * UART class & instance (=softc) diff --git a/sys/dev/uart/uart_cpu_acpi.c b/sys/dev/uart/uart_cpu_acpi.c index ce00a09fee33..7382c47a8db6 100644 --- a/sys/dev/uart/uart_cpu_acpi.c +++ b/sys/dev/uart/uart_cpu_acpi.c @@ -221,12 +221,6 @@ uart_cpu_acpi_spcr(int devtype, struct uart_devinfo *di) di->pci_info.device = spcr->PciDeviceId; } - /* Apply device tweaks. */ - if ((cd->cd_quirks & UART_F_IGNORE_SPCR_REGSHFT) == - UART_F_IGNORE_SPCR_REGSHFT) { - di->bas.regshft = cd->cd_regshft; - } - /* Create a bus space handle. */ error = bus_space_map(di->bas.bst, spcr->SerialPort.Address, uart_getrange(class), 0, &di->bas.bsh); @@ -296,12 +290,6 @@ next: /* XXX: Find the correct value */ di->baudrate = 115200; - /* Apply device tweaks. */ - if ((cd->cd_quirks & UART_F_IGNORE_SPCR_REGSHFT) == - UART_F_IGNORE_SPCR_REGSHFT) { - di->bas.regshft = cd->cd_regshft; - } - /* Create a bus space handle. */ error = bus_space_map(di->bas.bst, base_address->Address, uart_getrange(class), 0, &di->bas.bsh); diff --git a/sys/dev/uart/uart_dev_pl011.c b/sys/dev/uart/uart_dev_pl011.c index e7a2ff7a85f1..a0d5a5b1c7e2 100644 --- a/sys/dev/uart/uart_dev_pl011.c +++ b/sys/dev/uart/uart_dev_pl011.c @@ -392,9 +392,9 @@ UART_FDT_CLASS_AND_DEVICE(fdt_compat_data); #ifdef DEV_ACPI static struct acpi_uart_compat_data acpi_compat_data[] = { - {"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_PL011, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"}, - {"ARMHB000", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_GENERIC, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"}, - {"ARMHB000", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_32BIT, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"}, + {"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_PL011, 2, 0, 0, 0, "uart pl011"}, + {"ARMHB000", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_GENERIC, 2, 0, 0, 0, "uart pl011"}, + {"ARMHB000", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_32BIT, 2, 0, 0, 0, "uart pl011"}, {NULL, NULL, 0, 0, 0, 0, 0, NULL}, }; UART_ACPI_CLASS_AND_DEVICE(acpi_compat_data); From nobody Wed Jan 15 02:54:39 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXrFC5V5yz5knSG; Wed, 15 Jan 2025 02:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXrFC3JsTz3jgc; Wed, 15 Jan 2025 02:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736909679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRTcE+K3VamXbfoDApelp0zztcORh9/EXsk7/Gi5eQE=; b=M3B4FtTcpK5md65ZFejEO4qGp2w+IYTjNe/ldbjVqSimRtM03gllv2BrBmoHw6xGgdRTya 3nZedorY0iLW3WHEIJ8qUZLSIPrvs1dnvNpsELtgy+k8qteAZ8TqHDmZLRncCBdLUt+PE3 iUeq2818vmUhnuxH86MkI/gkuMRDp8A4AfHNNGJqzhJyCy8uuyqbxd7q8Pb2wymC+y1mr5 SKFSotix/3n1+7cZ6dTwaUbtxpBWkJAlPOOuP0TLcgDhwn/DUSvLHpaSco8mlvt2XdKQl3 FCrS9+4Vm3jIh9KwrlxH9+4ezpR+TfP8EmwN1mytrEUsQzqL5q2m889fKqigDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736909679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRTcE+K3VamXbfoDApelp0zztcORh9/EXsk7/Gi5eQE=; b=bUiKnVSnhseZz1g9VfFX4Ql2aIHsQuO0wffxpm+liCRZgHElcj8nTQXaErRZlzpsHpnKjd jOcHsT41X8/ez1vpv7N3Pz96/LFCmQ9M9zMuHjOwkRRiqRf/DUmaj9+pFtNnVLzcReGlRM IWSA3+22WmztehI0y2ZRZJJcs5RoP8bC13yMn+gYEEIlAVgby3X6AkmQBLM+Fc5LNwTLEs Z2n7IV32nnoehIEL2ySY3L9YylELoZ1z+c70S14Kpd/obItF7OQd3xRMl8YnogJzZ+AycO f/gX2I3wyLTsVRgyw+DOJyzEAgeuBzPPDVyD1Rh62173TKgQiIb9qNWGw+KkAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736909679; a=rsa-sha256; cv=none; b=ZrtpidVVRZDnzu3a2FOVCcOiP5mit60klH9H43IvE0eZHjFMAERnY5f/1MsxmnEq5uQfad t7x2b9sHw1NFBykZ1rLIUI2yMvcLNZ3edvq3makCdRhTpAMwMZgKpvfSfKO4UehCT8wc9c xHcHBGJ0PW8josnMgzrmAxW8N2YIABxFvWhFB/+y/7etibya7o6rBOyUsVYCd81FnszrWO Ohnb/GCG8k07R9wsbe8jbKJXr3c+VrUCwiANwVdIxy3QG3Ru7EVJCJCRL9Z8pDZ9glV8KZ lJRr+9yapq3HQU1eSkM2l5XjkEE/le+ZVsuBxzzFvlI5Iigq4U4qML2i4uKhNw== 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 4YXrFC2n96zCVh; Wed, 15 Jan 2025 02:54:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50F2sdYw084188; Wed, 15 Jan 2025 02:54:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50F2sdsn084185; Wed, 15 Jan 2025 02:54:39 GMT (envelope-from git) Date: Wed, 15 Jan 2025 02:54:39 GMT Message-Id: <202501150254.50F2sdsn084185@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 316aa4de2c4f - main - mfc-candidates: Retire shell wrapper List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 316aa4de2c4f8e3ecba987ce038af0c484821be3 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=316aa4de2c4f8e3ecba987ce038af0c484821be3 commit 316aa4de2c4f8e3ecba987ce038af0c484821be3 Author: Ed Maste AuthorDate: 2025-01-15 02:53:50 +0000 Commit: Ed Maste CommitDate: 2025-01-15 02:54:12 +0000 mfc-candidates: Retire shell wrapper In commit 48f3fcabea80 I replaced the shell implementation of mfc-candidates with one in Lua, but left the .sh as a wrapper in case users had an alias or script that called it. Enough time has now passed that we can remove the wrapper. Sponsored by: The FreeBSD Foundation --- tools/tools/git/mfc-candidates.sh | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/tools/tools/git/mfc-candidates.sh b/tools/tools/git/mfc-candidates.sh deleted file mode 100644 index 53fad909c91f..000000000000 --- a/tools/tools/git/mfc-candidates.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -#- -# SPDX-License-Identifier: BSD-2-Clause -# -# Copyright 2022 The FreeBSD Foundation -# -# This software was developed by Ed Maste -# under sponsorship from the FreeBSD Foundation. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted providing that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -# Backwards compatibility wrapper -/usr/libexec/flua $(dirname $0)/mfc-candidates.lua "$@" From nobody Wed Jan 15 04:34:05 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXtRy0zJrz5ktM0; Wed, 15 Jan 2025 04: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXtRy0PVlz3qZt; Wed, 15 Jan 2025 04:34:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736915646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oe3FJrslK1SIs2LMevWM609QT6pTlsIB3gO4Uh/yXFE=; b=dpUx0vHd+Gh4K03qVXVt2gEke5qm6mBcLcHnIug5lFulyUx8amgtSzVIzuk2RVk5f7GrhM QQfPlS9prSDd3/ucFCfApFmsiLyDzaE86nTmCN1FZ/2GwL1rZ65yojcZbr2AL1dTgQSd8/ XI+GRj0mys0NEw7lufC0oWX60aInxjwZVHelXCumlsmXpMS+hgDM1VDSdEKqj0ow3ihICp oDXzrKJPf+Xt4cqm8TXrkDlLgNHoERYPuus5nJ/iv647lJbr7DD5/5m3k+5IFjd79XnLrP 2WpWhg7wM16sNP6sYgOLNDHksN2p9z4z2coU4Yh3cf9fm3HFivmWDTvq3KnVEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736915646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oe3FJrslK1SIs2LMevWM609QT6pTlsIB3gO4Uh/yXFE=; b=LTGRP/c6+DEFwNFfLaJL9zJIjpP0SS3h7jZZ3yJ0kaM4QmMHHu3HIdPWsXhgOfbQbsGpQZ yF21D6FeGOeWftO/E8PbLai5ynoYJK2bzkQMjp9l/3n81XNIWuEfdrLsShO62k3X2z4LM/ gxVtx3zeKtUzJPRYgkqDlPwRSdxcNCzCfQTAUmgTLCPpX7s6IGPnb66LPMAKiBAf3X7CTy 77JAnAo8tW34F5BzZ0Qw/MX01u4nQ3l514vGKptQDbiodfP/jm9Ul1rojRm+J1icKRSLuZ j27+Tr3iGggug2/H4FllY0UiByPh/Znff8qgUHbZbFL0Ry3oBWjoJEoiAfo7qQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736915646; a=rsa-sha256; cv=none; b=FvKhedz2hC0rJBDdmbmusc+x10YDINHWwEMSf4GWR3kiuNy3UmSbeW9UFfJLP9+8axnorA Sfekf/dhCz//zWP7e/12NpB2gRue5c/te3yh7fd0C3gmmt8bPLeaGTHYLmsmwbo4x7EhyL 2UP6BUtUBOjt5vry0CDLz9uCqZYxrTewn3YWaFvufXQ1jGeK4XTXCt47b2khQp7hG5HFF1 Zr5Jvr+/2skiuLCFw+DNwf0AtwOU0phXM+kcFcOYf9lb0ETUBkYpkVD7/zWkSvIsH4udPc LCeQXhRXYrEJgObYBtFCqbScEvmBC8b/aCRoG+s163PsaHa1PGGS1ZKqGM3zVw== 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 4YXtRx75W5zVbK; Wed, 15 Jan 2025 04: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 50F4Y5o9073148; Wed, 15 Jan 2025 04: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 50F4Y5VY073145; Wed, 15 Jan 2025 04:34:05 GMT (envelope-from git) Date: Wed, 15 Jan 2025 04:34:05 GMT Message-Id: <202501150434.50F4Y5VY073145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 7befd68335a0 - main - pvscsi: Explicitly mask out CTS_SAS_VALID_SPEED bit List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 7befd68335a0b34405b6293f30cc47cabc46ab06 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=7befd68335a0b34405b6293f30cc47cabc46ab06 commit 7befd68335a0b34405b6293f30cc47cabc46ab06 Author: Zhenlei Huang AuthorDate: 2025-01-15 04:32:31 +0000 Commit: Zhenlei Huang CommitDate: 2025-01-15 04:32:31 +0000 pvscsi: Explicitly mask out CTS_SAS_VALID_SPEED bit This driver prefers connection speed over sas port speed. On stable/13 branch the stack-allocated CCB is not cleared thus the cam layer may report weird speed on boot. ``` da0: Fixed Direct Access SPC-4 SCSI device da0: 4294967.295MB/s transfers ``` -current and stable/14 have the change [1] which clears stack-allocated CCB thus are not affected, but I want -current and stable/14 to have this fix in to reduce drift between branches. 1. ec5325dbca62 cam: make sure to clear even more CCBs allocated on the stack Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D48438 --- sys/dev/vmware/pvscsi/pvscsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/vmware/pvscsi/pvscsi.c b/sys/dev/vmware/pvscsi/pvscsi.c index 111330e4f17f..08bdb8c3f108 100644 --- a/sys/dev/vmware/pvscsi/pvscsi.c +++ b/sys/dev/vmware/pvscsi/pvscsi.c @@ -1444,6 +1444,10 @@ finish_ccb: cts->proto_specific.scsi.flags = CTS_SCSI_FLAGS_TAG_ENB; cts->proto_specific.scsi.valid = CTS_SCSI_VALID_TQ; + /* Prefer connection speed over sas port speed */ + cts->xport_specific.sas.valid &= ~CTS_SAS_VALID_SPEED; + cts->xport_specific.sas.bitrate = 0; + ccb_h->status = CAM_REQ_CMP; xpt_done(ccb); } break; From nobody Wed Jan 15 08:21:29 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXzVK4Wnkz5l66t; Wed, 15 Jan 2025 08:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXzVK3nsZz47Np; Wed, 15 Jan 2025 08:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736929289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=023GpNoTSlmHXDDXOQWvrXqvoOZE3RT9blHo6SlFqkM=; b=rcY7hsbr/lB6uTWVtY7nHR02MClPW/LEmxViB/tzgr3mX6ya5LbPak+CJstbjaN904sbX4 56Z0dhauHFdlpouFs0EzBuxLHo12k4bj8iruxZ3gUGEErv62DuRx5yLM2V1eHhGAGpWbsN KZENJWFbDcXqcvOUrFDr4igRL2EBnaX+if08BxJRf03QytcXeOnHX7K1xYLZCOhelRhnK+ T+BVG/bFzU0NXN142Er4PKZJOts+SY8cXLPy48QV3ehemmp0gtc5HOzGVpuKnMm+MXpTUX wx8559TUd23YOrYuw3tvHv/w9zz0gYBI8KIpowew4EA6YNG5fchyuKlKoxBAjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736929289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=023GpNoTSlmHXDDXOQWvrXqvoOZE3RT9blHo6SlFqkM=; b=I3HNigSkKISippl9q73NG1ZRvvjCQs6IrZ8zxadqa9vfsr1ZnaZxrTz7zgtpRiDEv8NTKW bFK8tnaz7NcSKShAzE8vazhRfMVdA7Y0ucJUmG9ddxe1XM5m7kxngfkURFZMqb8uz3cu0Q 89LeMbl2vTXeUqNTljfJU4AXRxMtnsy0RJpJy2seTKlLlVoAseKFNlZMmiKPZtE3PDdeqm f7Kf9MBYv6zFoYO6fWsV9YLEFsM9i8kH0ZxJDJs4Z9qeTsNhLUAQjmGscAmqz2X8j2dbyX ri/U4WhvjEzh2Fi+zy/1LkFsp7ZWa08dShtt/0bNdopJj/GrfV5/tiBghw1G9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736929289; a=rsa-sha256; cv=none; b=EldJkCKzBUOpJQ9wo4JhV8ivD59QUSthwuk/y+Z2GgiMqhPvy4qXW9qg8fur1WXaOf8fsk ytslEUKcqdgUWt+ciLDmIO63WbewxmwenbOHWMb31ijHkg4eam+LGkUWrH715sbCW1mUKN 8u8NM3MkanaENbT4HkRQ+hR5Ax422lSFa+4Tdhn1oK+UMUEOd8Ny7ejaeBcX1g9CLIXcht Dvocz+vgRpIrOj9virlq6lVkNuaEu4xfs1ZIM4Rl+CqvwM4kj4ec/XsM/h14iGJTnh7VZq l1Ime7JCfUSyWFOVr7y9Ol2NbL4diJRvHYOCpg29NXJ6brLgqldD6x8VTAbISw== 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 4YXzVK3Nm6zdsG; Wed, 15 Jan 2025 08:21:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50F8LT8L096332; Wed, 15 Jan 2025 08:21:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50F8LTBR096329; Wed, 15 Jan 2025 08:21:29 GMT (envelope-from git) Date: Wed, 15 Jan 2025 08:21:29 GMT Message-Id: <202501150821.50F8LTBR096329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: eccf736c3ce6 - main - pkg: make sure the repositories have at least an url List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eccf736c3ce6e9566fa9923080b4c24ee7f9ae2a Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=eccf736c3ce6e9566fa9923080b4c24ee7f9ae2a commit eccf736c3ce6e9566fa9923080b4c24ee7f9ae2a Author: Baptiste Daroussin AuthorDate: 2025-01-15 08:06:55 +0000 Commit: Baptiste Daroussin CommitDate: 2025-01-15 08:21:19 +0000 pkg: make sure the repositories have at least an url While here, factorize code to free the repository structure --- usr.sbin/pkg/config.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index fe1599f42c2c..3aaa7a7815e8 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -1,9 +1,8 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2014 Baptiste Daroussin + * Copyright (c) 2014-2025 Baptiste Daroussin * Copyright (c) 2013 Bryan Drewery - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -332,6 +331,16 @@ parse_mirror_type(struct repository *r, const char *mt) r->mirror_type = MIRROR_NONE; } +static void +repo_free(struct repository *r) +{ + free(r->name); + free(r->url); + free(r->fingerprints); + free(r->pubkey); + free(r); +} + static bool parse_signature_type(struct repository *repo, const char *st) { @@ -344,11 +353,7 @@ parse_signature_type(struct repository *repo, const char *st) else { warnx("Signature type %s is not supported for bootstrapping," " ignoring repository %s", st, repo->name); - free(repo->url); - free(repo->name); - free(repo->fingerprints); - free(repo->pubkey); - free(repo); + repo_free(repo); return false; } return (true); @@ -392,13 +397,16 @@ parse_repo(const ucl_object_t *o) } else if (strcasecmp(key, "enabled") == 0) { if ((cur->type != UCL_BOOLEAN) || !ucl_object_toboolean(cur)) { - free(repo->url); - free(repo->name); - free(repo); + repo_free(repo); return; } } } + /* At least we need an url */ + if (repo->url == NULL) { + repo_free(repo); + return; + } STAILQ_INSERT_TAIL(&repositories, repo, next); return; } From nobody Wed Jan 15 08:21:30 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXzVL6VJZz5l6N1; Wed, 15 Jan 2025 08:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXzVL4kN9z47TV; Wed, 15 Jan 2025 08:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736929290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JoaWyjS+zvJRtZoK2f8Fmam2ZIYZsBJi2zeoXXDir/s=; b=DLSczWqFgW6L9+QarbvJznUa5J1LIASkeFt8T4HUDMZVMoExkieVrlN51aq+vPnaBpNXxz r2B5XEMIgjoaZPkHX4wuH3esy7YJs4u+3dVKXmA9zXw0QBkAMjvjaQ5WM8S6axpDvBEh7q OmWEQF53+uaeSwyYpm8pL+A6ahGsToJxY5h47AAbtijFXFnpXL96KpRQT4HKtIg5fI0e5u v443JnTBkbDn2gEdJ6Mz+27ehqsDOSnIyIx3C3RgsviCYMgtdvaUBK8px+k0OLu3DoVshN TflGZWtkHzCI9i8wbY/boGHavEEpeZqxVXwFepkVecXzEolOLjTS4tvTnHwmDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736929290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JoaWyjS+zvJRtZoK2f8Fmam2ZIYZsBJi2zeoXXDir/s=; b=UO1bUXe2Kw7aN4tuXYYfPr5lyrAsuh3toj65r2S8FTzk7TNO7QmYooFA+H6Ut3WdhY/WC5 iCoUVb+U1TyZ8cW9jO45GAvz8kiEzt1xz2E343sqWUZryGBbnI66BpjZme+Y8ElTvAFHhQ 10w8BWUkOUYt6UYORiwxVJ/c4HCgrF/YWgUgcIgsE1+R/aMh003f1wTt7yui0HoaUqfw7c 1MdiclUIFWw9XxWXLB90buXKMlVOHBlu6oZPPVwy0O/gmrHti2VtZy4p0+eY5rYWTnz8b3 l807LE/afsZCQDVsuAG88gmXwvUTTTYQ/aMgkH/gsPRhjFovbKtPRxGFv2jBmQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736929290; a=rsa-sha256; cv=none; b=hf4E9QJ7lmZnPpa5SLHJyA/eGox1iSJQso6RYS9emimY+4pX6vPhff27+jj5/L3OFjlw7D dWWZjnTb/bIfW7IjfQWSmFewgSosxsnXk3RlcYk8Fw8IkE2E4s8MBMAydAzD5VQv1N94rv imfitG6KDBVdIkhbp8b4d5vvDPs8WjuUxriwHxzUglqFJJqd2wYlZ3q9+BawXW2gW4STcm x2vgInHuB963Gj9K7+B4Ci5iZEqQ6sCU+POcdhqHotWclYsqPzPwmiAcUeuBRehgDfqSX6 GwFETAyGD199cd6SArKN4KYIBJB2q5sJ5aG3vS0+mvVWU9LLSx4Eem6mBFXXgQ== 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 4YXzVL4BJHzdk8; Wed, 15 Jan 2025 08:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50F8LU9B096692; Wed, 15 Jan 2025 08:21:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50F8LU4B096678; Wed, 15 Jan 2025 08:21:30 GMT (envelope-from git) Date: Wed, 15 Jan 2025 08:21:30 GMT Message-Id: <202501150821.50F8LU4B096678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 5c341fe5123d - main - pkg(7): support configuration overwrite like pkg(8) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c341fe5123d4aa6961066542de63dd4431d004d Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=5c341fe5123d4aa6961066542de63dd4431d004d commit 5c341fe5123d4aa6961066542de63dd4431d004d Author: Baptiste Daroussin AuthorDate: 2025-01-15 08:18:46 +0000 Commit: Baptiste Daroussin CommitDate: 2025-01-15 08:21:19 +0000 pkg(7): support configuration overwrite like pkg(8) with pkg(8) it is possible to overwrite a configuration like adding FreeBSD { enabled: false } in /usr/local/etc/pkg/repo/overwrite.conf which allows to change any value which can have been reviously configured in anything in /etc/pkg/*.conf now the bootstrap supports the same MFC After: 3 weeks --- usr.sbin/pkg/config.c | 55 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 3aaa7a7815e8..2ad6c8a93756 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -353,51 +353,79 @@ parse_signature_type(struct repository *repo, const char *st) else { warnx("Signature type %s is not supported for bootstrapping," " ignoring repository %s", st, repo->name); - repo_free(repo); - return false; + return (false); } return (true); } +static struct repository * +find_repository(const char *name) +{ + struct repository *repo; + STAILQ_FOREACH(repo, &repositories, next) { + if (strcmp(repo->name, name) == 0) + return (repo); + } + return (NULL); +} + static void parse_repo(const ucl_object_t *o) { const ucl_object_t *cur; - const char *key; + const char *key, *reponame; ucl_object_iter_t it = NULL; + bool newrepo = false; + struct repository *repo; + + reponame = ucl_object_key(o); + repo = find_repository(reponame); + if (repo == NULL) { + repo = calloc(1, sizeof(struct repository)); + if (repo == NULL) + err(EXIT_FAILURE, "calloc"); - struct repository *repo = calloc(1, sizeof(struct repository)); - if (repo == NULL) - err(EXIT_FAILURE, "calloc"); - - repo->name = strdup(ucl_object_key(o)); - if (repo->name == NULL) - err(EXIT_FAILURE, "strdup"); + repo->name = strdup(reponame); + if (repo->name == NULL) + err(EXIT_FAILURE, "strdup"); + newrepo = true; + } while ((cur = ucl_iterate_object(o, &it, true))) { key = ucl_object_key(cur); if (key == NULL) continue; if (strcasecmp(key, "url") == 0) { + free(repo->url); repo->url = strdup(ucl_object_tostring(cur)); if (repo->url == NULL) err(EXIT_FAILURE, "strdup"); } else if (strcasecmp(key, "mirror_type") == 0) { parse_mirror_type(repo, ucl_object_tostring(cur)); } else if (strcasecmp(key, "signature_type") == 0) { - if (!parse_signature_type(repo, ucl_object_tostring(cur))) + if (!parse_signature_type(repo, ucl_object_tostring(cur))) { + if (newrepo) + repo_free(repo); + else + STAILQ_REMOVE(&repositories, repo, repository, next); return; + } } else if (strcasecmp(key, "fingerprints") == 0) { + free(repo->fingerprints); repo->fingerprints = strdup(ucl_object_tostring(cur)); if (repo->fingerprints == NULL) err(EXIT_FAILURE, "strdup"); } else if (strcasecmp(key, "pubkey") == 0) { + free(repo->pubkey); repo->pubkey = strdup(ucl_object_tostring(cur)); if (repo->pubkey == NULL) err(EXIT_FAILURE, "strdup"); } else if (strcasecmp(key, "enabled") == 0) { if ((cur->type != UCL_BOOLEAN) || !ucl_object_toboolean(cur)) { - repo_free(repo); + if (newrepo) + repo_free(repo); + else + STAILQ_REMOVE(&repositories, repo, repository, next); return; } } @@ -407,7 +435,8 @@ parse_repo(const ucl_object_t *o) repo_free(repo); return; } - STAILQ_INSERT_TAIL(&repositories, repo, next); + if (newrepo) + STAILQ_INSERT_TAIL(&repositories, repo, next); return; } From nobody Wed Jan 15 15:03:44 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YY8QS2jT0z5kFD3; Wed, 15 Jan 2025 15:03:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YY8QS1bBjz3h2G; Wed, 15 Jan 2025 15:03:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736953424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vd2Kd0s0y1BZXp9NCtsIn31so4tbZyB8be91w9EFv7g=; b=GMiKNqAqdxFCTSq97r/vhQGWqfXLFZKeZv8u2AZLbfnUVfU2wUyHAsjT+Hj3eTftaYDHI7 2Da/s+zChRnkV8LobzlHK6SI7ZI2rcjW5ROhTN8JxxwAm5CEnWK1i0Zukq2vYFqiMpb8n8 MIq6ewR1UZnyRNwTLHujFNIDGeikB/hgF043RyWrG+XhZxdRbDY0oSjvblEWYt4laNXsgV HFl4Y+4A2TT/gtqHWXo88YIZRQaT/uZHEHaEtb4N0NpG/b+gqB78kg7HKqJzL/gljIWQ0C DrjgCk0Dyc0z8u6cOD7meUhiX2GNxFvV2YIiW7jUtJjEyWrmKmagS82zRQORrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736953424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vd2Kd0s0y1BZXp9NCtsIn31so4tbZyB8be91w9EFv7g=; b=a6dpSeaZ8XTFYr9LZM2bYXcU1yzQo8oHUNG6PbSnS07YU6SORHDTKt/LRjnpr5unmW/t00 669hQCeOpqzEFo8M1sQG1WAHo1phelVWmnxoaHq+QXGmjSLO+2kpSmiaDaezDTe+R84+sS fCWRHIuP75lIj9DLFljGV/vRs76TZssbM/OOtdnKrNkKLC3M9YEJZFTIuzv569mWrSxHIk 1gb+tTzM5iyqVvPa04k7KQMZWtUUEGM+WFnxnD4z3UypU6gwYFvDS0UQyAEFHRunRuZhts dAv94HbkjgejK05Z+ADvuyUAELzG2sfLDtigo9Sx6igeIYMHhBph72l3/zWvag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736953424; a=rsa-sha256; cv=none; b=MKFtojNYQMgV9hVP9w2+4wWQ8ea9SXCkNeoe2OkXdoTGpnBo5b9BFrwfTpvq/Ik7S/U+VQ z+AveLKnH+9hOV509JnjuwwQjwi7AlYKbh9KIxTwaXHm+SjU35FISFBH1bIUu2UHbohgvJ fqnT+eAL5tq3uyMKMAZJSjkqaUsgBPUQ5/XZhmWQnhN0BMdoqOXPaP+5PrVgph14siEth4 46+wN5vord2e8s68dyOwxopCQ5YRfZ1A/efgUZld3bIAfyZyN4vT6zdliWVHldpXUn29dx A3klMpOhH1aqH9uj48lO7S5SQnJcMUB4otLD5bmR47+IYmcW6Oo+LhDcWshDVw== 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 4YY8QS1BDRzrSc; Wed, 15 Jan 2025 15:03:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FF3iFa052631; Wed, 15 Jan 2025 15:03:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FF3iP9052628; Wed, 15 Jan 2025 15:03:44 GMT (envelope-from git) Date: Wed, 15 Jan 2025 15:03:44 GMT Message-Id: <202501151503.50FF3iP9052628@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 101e825e551a - main - arm64: Refine comment about size of struct pmap_large_md_page List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 101e825e551afc69a7cebb78fa6b676d38d93d2d Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=101e825e551afc69a7cebb78fa6b676d38d93d2d commit 101e825e551afc69a7cebb78fa6b676d38d93d2d Author: John Baldwin AuthorDate: 2025-01-15 15:03:12 +0000 Commit: John Baldwin CommitDate: 2025-01-15 15:03:12 +0000 arm64: Refine comment about size of struct pmap_large_md_page pmap_init_pv_table does not assume a specific size of 64. It does assume a size that evenly divides the size of a page since it inserts pages from different domains into the kva backing the global pv_table array. Reviewed by: imp, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D48455 --- sys/arm64/arm64/pmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index fd6798668626..23eedff2e7cd 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1547,11 +1547,11 @@ pmap_init_pv_table(void) int domain, i, j, pages; /* - * We strongly depend on the size being a power of two, so the assert - * is overzealous. However, should the struct be resized to a - * different power of two, the code below needs to be revisited. + * We depend on the size being evenly divisible into a page so + * that the pv_table array can be indexed directly while + * safely spanning multiple pages from different domains. */ - CTASSERT((sizeof(*pvd) == 64)); + CTASSERT(PAGE_SIZE % sizeof(*pvd) == 0); /* * Calculate the size of the array. From nobody Wed Jan 15 17:11:56 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYCGN39Fvz5kP0F; Wed, 15 Jan 2025 17:11:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYCGN2DvDz42sb; Wed, 15 Jan 2025 17:11:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736961116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JZuvhdcZrwekYkA8Dfp8b1rmZHIQ3fWVcPnKEMVbmE0=; b=LgW35tE5yhldAsuJV3FxgxbMN9ueRjAkSBXXoW6FWPmlQK9tyl+iZWIXyXRhHV8j1NxDoO RlX9ID2S8vFUYOTZeKqy660GZsZZ0E2DhgXmQyOnPQbg5OcDKpXvva/RcQ/mxawQtULOh0 pR9u+5PFKv95vHsWQJwrOO8lbY3ZfDiYknZi4J1Pp2+MI9jDrfp01Nn3soshnAlO9fA9bb rcWryQnKQrqD9XTTl6Hw0ubihP+ZOPA72icb8IyBvJgud9+JvRFLgH/6icwAlRm3myDju3 kKmeuDu6NUJrc/I5Ey49/9zO9rHJPNdkz4f9GEYF2VwdmBDYvo8HeJTV+5n/9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736961116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JZuvhdcZrwekYkA8Dfp8b1rmZHIQ3fWVcPnKEMVbmE0=; b=uDNYN5Vae+n5D4vB4+w7pphr6MwnCCbDOzYxyXbCJoSzptxO/i3reybDP3dG6ZZmMmNAnL d5fM14OafHVpIG9c/vBuTVq1TmbksrNUHenC5QWqi84vbqTgyoDv25ZVrN16WNNUP/08kG 7j/QXJBCXfanWunTp+OZ3tbEeV6qFSMhw18nMJIInm3M2IbYB/plUbDaArgAZU0BRo8Vm9 KQSSVpJFhcNFZ/2usk9dgKd/TCxEZKC8xwv3kGTVe4diTpRiG1n1LcsXWrklHXq64e15dU eQlqdIXzK6/LF3aAemXq/Ki3ttyUegR86leJIV9hNuy7FSp9TttB0IiNI+bSwQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736961116; a=rsa-sha256; cv=none; b=p3x+K3+5rBA39YwqX8xm70xijByIldwzCaH76GtVMLsPHcwCSAWAMIVCNue8oxQVGn6VCc QAGSTOMrp5P2gJovFLC1H0zRYgZr7lLF297gZo5TTcxZ0ZjVlE9MORCIYtXjB5nPfAmq3q JC0r5oYuDb0nPPpUV/ghWD37nFLt+XCdJVPKjzo5Si4qJgooE6Rqr/xKYLDlTHEFzouZW3 3x6nqIukcbZuccDWTnFECDOpdrYH+sAQV5NUy/i5ceHdqefgGSwpeGE8ZoxIUc1nHWBw9M jWHNRmJsSLwX1SgKNaG2ulGp6GpQ6ZZBRS7LwL4rVOCuN7tn2x/3T5rYskjb5w== 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 4YYCGN1lKzzvyv; Wed, 15 Jan 2025 17:11:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FHBu6J094958; Wed, 15 Jan 2025 17:11:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FHBugo094955; Wed, 15 Jan 2025 17:11:56 GMT (envelope-from git) Date: Wed, 15 Jan 2025 17:11:56 GMT Message-Id: <202501151711.50FHBugo094955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1132466b56bc - main - git-arc: Properly quote .nm arg List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1132466b56bc87dbdcc32bdf84b93d2fabe67776 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1132466b56bc87dbdcc32bdf84b93d2fabe67776 commit 1132466b56bc87dbdcc32bdf84b93d2fabe67776 Author: Warner Losh AuthorDate: 2025-01-15 17:02:53 +0000 Commit: Warner Losh CommitDate: 2025-01-15 17:09:43 +0000 git-arc: Properly quote .nm arg .Nm git arc has 2 args, despite the mdoc reference saying there's only one arg when in the preamble and NAME sections, but not noting that restriction later. Quote the arg and bump the date. This doesn't affect man git-arc, but does affect the rendering of the man page on at least one website. Date bumped since it is a semantic change and not just a typo or other trivial correction. Reviewed by: jhb Sponsored by: Netflix --- tools/tools/git/git-arc.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1 index f2f7ee38e140..1f1bc2fca130 100644 --- a/tools/tools/git/git-arc.1 +++ b/tools/tools/git/git-arc.1 @@ -24,11 +24,11 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 5, 2023 +.Dd Janurary 15, 2025 .Dt GIT-ARC 1 .Os .Sh NAME -.Nm git arc +.Nm "git arc" .Nd a wrapper to improve integration between git and arcanist .Sh SYNOPSIS .Nm From nobody Wed Jan 15 17:23:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYCWW4pzMz5kPNv; Wed, 15 Jan 2025 17:23: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYCWW3RZlz44r5; Wed, 15 Jan 2025 17:23:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736961799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=986lJUKl3jocmWG3NB9uY1OUanIOIVLykbnO9RjIiLA=; b=qQLdyhYl7Yjo/FdhAiany/ubCjH7DpHYsHzLWMPsXCs3TuyUcvllT7tlKLucfoDaUabElY xEzHALqgZ2+jMlmMMgpzvThUuJlaLLgVxmRbOpaCa1bMtIYl9UBe2FJMH19wD8Cxaw3wzU sAYe0FUHVDOSsgS87kVpbpw8jDobhpWH3zMCsFj5nYi4X7Z+2UpRBpcbjBb36LGZGPHXfs 3Hh5h18JTEfzlhgfUcoXiIbIO/Z0NnObAcL+pP927zQX7wTlS37nXUfAnKt7mZSxBEZOI7 j/U7TwlRxmMxLKB7IzBuQL93dtQ31YJ4Tngn60LhWcpaM6fvdxFkTZR9pj+/wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736961799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=986lJUKl3jocmWG3NB9uY1OUanIOIVLykbnO9RjIiLA=; b=A1RCYPdD8nD2j9xgJvXJspixZS5a+GWg0QNELkvZFmiET5ebRZEicbIyA6cZnSWXt1vBDt sWDuhrZpZh+jQNP5g0kgpHk/FXKybUPPKXYtH8V0crChDjPL+HalDGJwFVwys9VIslxB18 M0vjNMzSPgnAEOHvvS66e7vSVTdIPCBa672H0TnZdLsepbJJp4BOgBOTcZLj5uN1FT3lNT CO0ZQRefkzdvxEno7TwQj51UU9b0npgqDOHlwlHCn8DzjlxzfJ3PyrEv61nmrQohYigMjp p/vVuhkaJEhxTqassL7TgaLv6063KI3M/2rYtq0Wap1KAP3Uk/UX5sSMZrKA6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736961799; a=rsa-sha256; cv=none; b=UokdSimyYvNB2Z1aVyg58wVMEGkWlsmeq4k0choVYI/v/+8mFFciolm3zCnIZnH47Wu7na uiHKnP9xRoyJf0lidAqPhzwggTmjxu1Exzo7vLaOsel7RwmpOlQN9lcOCmz0W9WjKKwKHi XSQn6Z+ozQjlFyuaWfbx/A6gQcyYwnYU0JSC5p6mT3oCD7kqLP1HMKowXp0sl8XQ6BPcge BtGXjejm18G60mWOwARNAeJpNMxOWKhky7HfpL6YonaKKigUqOCDMzty75KK9rFknsKHwe hluAPXH3daUS99LESbYryfRI+Sp3f2LPvRWwR9iBPVptjMG10h/1XkTJ9JvAPw== 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 4YYCWW2zPGzwLF; Wed, 15 Jan 2025 17:23: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 50FHNJFV014745; Wed, 15 Jan 2025 17:23:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FHNJB1014742; Wed, 15 Jan 2025 17:23:19 GMT (envelope-from git) Date: Wed, 15 Jan 2025 17:23:19 GMT Message-Id: <202501151723.50FHNJB1014742@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: cf9070746742 - main - Introduce the UMA_ZONE_NOTRIM uma zone type List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf907074674206b1825f79c6864c4c4a32089ecc Auto-Submitted: auto-generated The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=cf907074674206b1825f79c6864c4c4a32089ecc commit cf907074674206b1825f79c6864c4c4a32089ecc Author: Andrew Gallatin AuthorDate: 2025-01-15 17:11:51 +0000 Commit: Andrew Gallatin CommitDate: 2025-01-15 17:23:00 +0000 Introduce the UMA_ZONE_NOTRIM uma zone type The ktls buffer zone allocates 16k contiguous buffers, and often needs to call vm_page_reclaim_contig_domain_ext() to free up contiguous memory, which can be expensive. Web servers which have a daily pattern of peaks and troughs end up having UMA trim the ktls_buffer_zone when they are in their trough, and end up re-building it on the way to their peak. Rather than calling vm_page_reclaim_contig_domain_ext() multiple times on a daily basis, lets mark the ktls_buffer_zone with a new UMA flag, UMA_ZONE_NOTRIM. This disables UMA_RECLAIM_TRIM on the zone, but allows UMA_RECLAIM_DRAIN* operations, so that if we become extremely short of memory (vm_page_count_severe()), the uma reclaim worker can still free up memory. Note that UMA_ZONE_UNMANAGED already exists, but can never be drained or trimmed, so it may hold on to memory during times of severe memory pressure. Using UMA_ZONE_NOTRIM rather than UMA_ZONE_UNMANAGED is an attempt to keep this zone more reactive in the face of severe memory pressure. Sponsored by: Netflix Reviewed by: jhb, kib, markj (via slack) Differential Revision: https://reviews.freebsd.org/D48451 --- sys/kern/uipc_ktls.c | 2 +- sys/vm/uma.h | 1 + sys/vm/uma_core.c | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 881825bf1d9f..6815667594a4 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -495,7 +495,7 @@ ktls_init(void) ktls_buffer_zone = uma_zcache_create("ktls_buffers", roundup2(ktls_maxlen, PAGE_SIZE), NULL, NULL, NULL, NULL, ktls_buffer_import, ktls_buffer_release, NULL, - UMA_ZONE_FIRSTTOUCH); + UMA_ZONE_FIRSTTOUCH | UMA_ZONE_NOTRIM); } /* diff --git a/sys/vm/uma.h b/sys/vm/uma.h index 38865df7ae02..4f2b143a2fae 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -252,6 +252,7 @@ uma_zone_t uma_zcache_create(const char *name, int size, uma_ctor ctor, #define UMA_ZONE_SECONDARY 0x0200 /* Zone is a Secondary Zone */ #define UMA_ZONE_NOBUCKET 0x0400 /* Do not use buckets. */ #define UMA_ZONE_MAXBUCKET 0x0800 /* Use largest buckets. */ +#define UMA_ZONE_NOTRIM 0x1000 /* Don't trim this zone */ #define UMA_ZONE_CACHESPREAD 0x2000 /* * Spread memory start locations across * all possible cache lines. May diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index e93c561d759a..4de850afcb66 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1222,7 +1222,7 @@ zone_timeout(uma_zone_t zone, void *unused) trim: /* Trim caches not used for a long time. */ - if ((zone->uz_flags & UMA_ZONE_UNMANAGED) == 0) { + if ((zone->uz_flags & (UMA_ZONE_UNMANAGED | UMA_ZONE_NOTRIM)) == 0) { for (int i = 0; i < vm_ndomains; i++) { if (bucket_cache_reclaim_domain(zone, false, false, i) && (zone->uz_flags & UMA_ZFLAG_CACHE) == 0) @@ -5306,8 +5306,13 @@ uma_reclaim_domain_cb(uma_zone_t zone, void *arg) struct uma_reclaim_args *args; args = arg; - if ((zone->uz_flags & UMA_ZONE_UNMANAGED) == 0) - uma_zone_reclaim_domain(zone, args->req, args->domain); + if ((zone->uz_flags & UMA_ZONE_UNMANAGED) != 0) + return; + if ((args->req == UMA_RECLAIM_TRIM) && + (zone->uz_flags & UMA_ZONE_NOTRIM) !=0) + return; + + uma_zone_reclaim_domain(zone, args->req, args->domain); } /* See uma.h */ From nobody Wed Jan 15 18:10:20 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYDYm5fFfz5kSDq; Wed, 15 Jan 2025 18:10: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYDYm4ccpz3D0C; Wed, 15 Jan 2025 18:10:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736964620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jg+GuHQzjJeoP5DLfMx2QEVpqVzWVvxI71Jt9fkUvSY=; b=aSVrlYoyxWx1IUdlvOGDkillaTLYjEGFrf8mbixYKJLsk3uUipWGUT1AIKLGCJWH4NtSUc yZ/kAXaf+Y+sreHpyZee1lFUx+CaHW/X9R1cOVPhYEze1awLWNKfEEPS+nDoECWvmbvOem Vk8C9bfEcVqwolazAGlikHC6rKoXUAzAv8Uir8bSntA0aRq2LB7CI+nZ7fKfJ2T4P5aMu3 SgwAo8491s4NO7Gv0Q9UCSWtcC7+Sq62CCK6cDXVH4LBGqnh6yybPrAYLzwFC02ZFJNzwE Gv8Egj2tx7IUfOsj8G8ekt6t/8zNxhVpSxwPN4BOHEPDeIX0Ncejt17zcRjB4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736964620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jg+GuHQzjJeoP5DLfMx2QEVpqVzWVvxI71Jt9fkUvSY=; b=sdNMnS1i5srquD/2UTI74vxcLX8Rar5uRLPVuNe8aGBOPPyxoFEohLUs9WCcB+iOrpEpZA pkfOZhrQJoleX1KIXbzXAWnZANSQCQ+r4ZwPsPusmyy4TQJMWNN02q2LMPwV90ofbLEz3J RA/P8fOYLW6qKWs/F/aLifM8bJmPhajBLL8hz2p1Z0KLys+VWw5ku+qDH9ODP56HBAUcQf V3U+8iis4lfnjul4o8L1ecoUVfDJGsKRnX22EwvlGmYIrk4y7EEtAChW6W3lBBfIbADFYj bHJ9B318muMEhh9/4K0iC8lCPl2x12Xb5leJR7x0FpZsfNYxzREx5CZDrrpaog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736964620; a=rsa-sha256; cv=none; b=JxxOdlcm0acYPlaphNQWL58pBJlCAbg4b9p8ilxFNim9zwOfWbAT83xD/IGBWAtZlXjhuk 1g8BJPoNStHNUBuNComJReu5A3EWCvMy7DYaUgp+ou5Je4JTEQhtcY7J0ATlCgbAxk6oYt tUhEXePH1o2TlFA0IP6bNDut/7Xn5+o0iGDibOZztCpM8Q4WbvZlCpA8+R146tHxA54E3X rGFX3F+M34KLG6wGPpw3Yq7vF+fAzp83e3GuPFMjnaIng1NN4yh/+iKd5/p/U96tBqH/Gh qJVlae9wnBynKUe7l/5OB+88Ky3jC6gZBzVTkIOSUDh31tUGuXXAO5VVqEce8g== 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 4YYDYm3xMXzxXX; Wed, 15 Jan 2025 18:10:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FIAKCu000954; Wed, 15 Jan 2025 18:10:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FIAKsL000951; Wed, 15 Jan 2025 18:10:20 GMT (envelope-from git) Date: Wed, 15 Jan 2025 18:10:20 GMT Message-Id: <202501151810.50FIAKsL000951@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 9e36aaf0c24c - main - munmap.2: Unaligned addresses do not return error List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e36aaf0c24cf158e83c69c1d2312c000c3c36f3 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9e36aaf0c24cf158e83c69c1d2312c000c3c36f3 commit 9e36aaf0c24cf158e83c69c1d2312c000c3c36f3 Author: Ed Maste AuthorDate: 2025-01-15 16:52:58 +0000 Commit: Ed Maste CommitDate: 2025-01-15 18:09:37 +0000 munmap.2: Unaligned addresses do not return error We previously claimed that non-page-aligned addresses would return EINVAL, but the address is in fact rounded down to the page boundary. Reported by: Harald Eilertsen Reviewed by: brooks Sponsored by: The FreeBSD Foundation Fixes: dabee6fecc67 ("kern_descrip.c: add fdshare()/fdcopy()") Differential Revision: https://reviews.freebsd.org/D48465 --- lib/libsys/munmap.2 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/libsys/munmap.2 b/lib/libsys/munmap.2 index dce76d355c1f..560ed0056260 100644 --- a/lib/libsys/munmap.2 +++ b/lib/libsys/munmap.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 22, 2017 +.Dd January 15, 2025 .Dt MUNMAP 2 .Os .Sh NAME @@ -54,8 +54,6 @@ will fail if: .Bl -tag -width Er .It Bq Er EINVAL The -.Fa addr -argument was not page aligned, the .Fa len argument was zero or negative, or some part of the region being unmapped is outside the From nobody Wed Jan 15 18:26:49 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYDwp1hGPz5kT5x; Wed, 15 Jan 2025 18:26: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYDwn5vJWz3HnM; Wed, 15 Jan 2025 18:26:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736965609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7fa5U5IVGfg1SL+riqh4bCI1c6xYVljB7YZI0MfMknk=; b=XHm/sT9uHfhalhEykMHOz2fyAIZLtHdbjzhDxcXcNFhsEm410kBlmHT00tOpJ6sKfUP9zM f8WKbucFL8uOMjuwESJw1c3C2xsLbbF3BoeEjkOJ+wdYI3Upy7If7YHoNnfZHPgEO9iVZC VvjJShpJYVJUTUb7BK6RT/lLa2J7dizd9jMpq4qNur1Fw4IUecJUA+2CNKZFJbnfUz7G3A 3sse/9HDkFCA37epaWpkWfhBkoPsd+RSyETaMMQCTaXeAWnsm+Bb15SbgxsEpv9MDiXQHm tU1gYAKOkeRK1nsBpZKUtpOApY0PorSG3qB2v4rmFTRwUB0Z0klA/EbNDCwxVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736965609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7fa5U5IVGfg1SL+riqh4bCI1c6xYVljB7YZI0MfMknk=; b=RZrK+B6AZGJ7eKGvXPs5ZIqAqrZHgRUPmFxnGfd+zosuEMT2VOgyvuBomC6HkcClB/42JC 3kNYj+Ga1TCJZ6XOFGAQVhFpzx2XI80YQpBllHoc9Ib1rEKSvrn0ud7GScy2ZD1Ukc3oU5 2X122PlqoScyASNsh1t7nXOn688Wh/rX7Fy28XZsDP3uQTAZpnDKKwxrYvuGM2s47GAiLa 3t9XUtRl1NWM64NfqZAowdI2YxySAx8YpL+Rg716VGTOl3n5MEc41Xc7StanTq512YklaB rrpMy0Wv3o8RrKSBHlpME1pe+lec7xk+/6QFl9iPfC65R6m54Q9UwTj5m7kbAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736965609; a=rsa-sha256; cv=none; b=X5x1heBO+dQZoH4epiwyfBHLmynakUoo7gJgbV88+d9Wlxo+yWHkBYpvXxBHIhFJjWNXzV TuuQDITBYFnyIVeZ32kGkwaW2bSIfmfMCNKnXyR97zeWo1ASSgSI/RFf1utjrErL3tJUeY 7JZCJ+FmJ2LNhvNvp9jEMO0lGaWqvoo00/IkAmm1WLpErfB4yCoActpt5RkKwz7odVqRfP YzJ23ohKgPo+EbLHYSVUz2FqMgqhZI3rtF0PrJXkhRVVuRiS1tD1cB7nq2l6jb/zULgKe4 1EvYwvteivpkrMlvlVFrddddqX38waiekyZEKbDz1ddFsfcHkLJetcF99JaEKQ== 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 4YYDwn5B09zxX5; Wed, 15 Jan 2025 18:26:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FIQnQM028125; Wed, 15 Jan 2025 18:26:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FIQnGu028122; Wed, 15 Jan 2025 18:26:49 GMT (envelope-from git) Date: Wed, 15 Jan 2025 18:26:49 GMT Message-Id: <202501151826.50FIQnGu028122@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e0b7a9b6bee1 - main - RELNOTES: Document recent file handle layout changes List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0b7a9b6bee16f4855b392c0941e76b7fef777a0 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e0b7a9b6bee16f4855b392c0941e76b7fef777a0 commit e0b7a9b6bee16f4855b392c0941e76b7fef777a0 Author: Mark Johnston AuthorDate: 2025-01-15 18:20:50 +0000 Commit: Mark Johnston CommitDate: 2025-01-15 18:21:08 +0000 RELNOTES: Document recent file handle layout changes Reviewed by: olce, rmacklem, imp, emaste Differential Revision: https://reviews.freebsd.org/D48093 --- RELNOTES | 5 +++++ UPDATING | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/RELNOTES b/RELNOTES index 5cdb0bde4ac4..515966f8ea08 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +8ae6247aa966, cf0ede720391d, 205659c43d87bd, 1ccbdf561f417, 4db1b113b151: + The layout of NFS file handles for the tarfs, tmpfs, cd9660, and ext2fs + file systems has changed. An NFS server that exports any of these file + systems will need its clients to unmount and remount the exports. + 07cd69e272da: Add a new -a command line option to mountd(8). If this command line option is specified, when diff --git a/UPDATING b/UPDATING index 412eb446f4fd..3eccd089d808 100644 --- a/UPDATING +++ b/UPDATING @@ -33,6 +33,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: this SoC familly will be selected. Also a new rk8xx device was added, this select the base driver for Rockchip PMIC. +20241223: + The layout of NFS file handles for the tarfs, tmpfs, cd9660, and ext2fs + file systems has changed. An NFS server that exports any of these file + systems will need its clients to unmount and remount the exports. + 20241216: The iwm(4) firmwares are no longer compiled as kernel modules but instead shipped as raw files. For pkgbase users if you use iwm(4) you will need From nobody Wed Jan 15 19:28:34 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYGJ22sjtz5kXVM; Wed, 15 Jan 2025 19:28:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYGJ220S9z3QVr; Wed, 15 Jan 2025 19:28:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736969314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mAvvdiXoCNO/E5S5ykmHncL8e0LcFFAWaXIB+R27CtY=; b=Era9wJ4YvP1tnKv76MIhrEx0y3RPu/CS1/uUVsxqBWMCZUYvzyLXc6gZRrJezanbs1UdKI 8J12b7hI3fzx3ZdYyunlGIRXhQ2TQ+TT5fCzAvgFBC1v+2MiFtaOPb6CWGP6N60GVs8N6t UQKS9m4a8YoHKkRBq5MqJVAl03fBb6yBk+lAjiK2DaJH86NRrQMNIqaeUNVCOTh3p+0X1A 2+TeciWrBBbYMPL0/ZXflbp7dhkHsCGCiR8zl/Waij1QAP/290Fopp4TW+1b0F1/8lTpZH m4vsZ5O/0TVw5LhOI9vxEyQPUYXSggQ7cxM8uAPcA0sLQjLUmr2+/CrCIGrDHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736969314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mAvvdiXoCNO/E5S5ykmHncL8e0LcFFAWaXIB+R27CtY=; b=RlQ9p2FEqqeH3b67oZIuLu9vrtfNOk4dWoqhGFR65W4GB3Xm9/85yWqODfS6LRdsIcUDVi fx5AUOiy2snE7o4uMLgJxvim8EPg64uPMwD8ugcz4y0S44G67LJ7/iHM5BIwkiyEocDh5V /wD7ftQoYZw+bE6H0yopg1UnSnmYSc/sfaFae4+YD6NB1O45N1n9w+Np/cahK3N1gUei84 bXIr3iJj8QPm5kPjrz6zs5yBLZCVNif5UQFMhZ7FEQfGrLAeBEq64wuLxv5WKwODHIoluD gNOqdp1lp26H5Q6TWDJNv7MK1WmyFBxokO5LYRXn74FNY+1pMVbfuiM5AKRVdg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736969314; a=rsa-sha256; cv=none; b=XHufmSO9M4VZuEWrC4pePaCRG2+Yv+Fs/PkIJ3tUuOIGEWe+Fd7rawDwRPAVsU1lKcLJck +MRjtwMBQji1OFGY75jvkh5ptaGWDdl75VbFqh21L2qhJ54D8iw0amH6fFS6inSJW1N3BS p9tux17rmARw7HN0rXvy/19CL/GJWI7oG1vHsGvmpaLplWLdMKKHUYzVTcb+8HxQj8R5B2 GwmG4fHyGR1Ye+jYtgcdohUH+PNWNo9mCFCb4S/rLhnc5XBQ04MEuIamXBC4KLTLP6JVUV 8FHQEfwPukoZWGSW6F+d2rQ1t9c4CvRTZ3bNy1WIZzrAB17A9Zdo2KHsrcgljw== 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 4YYGJ21bTMz106B; Wed, 15 Jan 2025 19:28:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FJSYjb041524; Wed, 15 Jan 2025 19:28:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FJSYjk041521; Wed, 15 Jan 2025 19:28:34 GMT (envelope-from git) Date: Wed, 15 Jan 2025 19:28:34 GMT Message-Id: <202501151928.50FJSYjk041521@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: c0661bbbd0d9 - main - depend-cleanup: Fix match expression for AArch64 asm files List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0661bbbd0d917f602d42fe4bb9ee3edc5970c8a Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c0661bbbd0d917f602d42fe4bb9ee3edc5970c8a commit c0661bbbd0d917f602d42fe4bb9ee3edc5970c8a Author: Ed Maste AuthorDate: 2025-01-14 21:36:08 +0000 Commit: Ed Maste CommitDate: 2025-01-15 19:28:03 +0000 depend-cleanup: Fix match expression for AArch64 asm files Some routines (strcmp, strncmp, strlen) switched from an asm implementation from arm-optimized-routines to a new asm implementation. The default clean_dep rule matches both the old and new dependency string, resulting in those routines always being rebuilt. Instead use "arm-optimized-routines" (i.e., contrib subdir for the previous implementation) as the matching regex. Also delete the old generated src files. Reviewed by: fuz Sponsored by: The FreeBSD Foundation Fixes: d57842ed2dad ("depend-cleanup.sh: clean up after AArch64 libc SIMD merge") Differential Revision: https://reviews.freebsd.org/D48459 --- tools/build/depend-cleanup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 6f97747183a8..30c303d4f90f 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -242,7 +242,8 @@ fi if [ $MACHINE_ARCH = aarch64 ]; then # 20250110 5e7d93a60440 add strcmp SIMD implementation - clean_dep lib/libc strcmp S + clean_dep lib/libc strcmp S arm-optimized-routines + run rm -f "$OBJTOP"/lib/libc/strcmp.S # 20250110 b91003acffe7 add strspn optimized implementation clean_dep lib/libc strspn c @@ -260,7 +261,8 @@ if [ $MACHINE_ARCH = aarch64 ]; then clean_dep lib/libc strlcpy c # 20250110 25c485e14769 add strncmp SIMD implementation - clean_dep lib/libc strncmp S + clean_dep lib/libc strncmp S arm-optimized-routines + run rm -f "$OBJTOP"/lib/libc/strncmp.S # 20250110 bad17991c06d add memccpy SIMD implementation clean_dep lib/libc memccpy c @@ -272,7 +274,8 @@ if [ $MACHINE_ARCH = aarch64 ]; then clean_dep lib/libc strlcat c # 20250110 3863fec1ce2d add strlen SIMD implementation - clean_dep lib/libc strlen S + clean_dep lib/libc strlen S arm-optimized-routines + run rm -f "$OBJTOP"/lib/libc/strlen.S # 20250110 79e01e7e643c add bcopy & bzero wrapper clean_dep lib/libc bcopy c From nobody Wed Jan 15 20:31:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYHhR0411z5kcY3; Wed, 15 Jan 2025 20:31: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYHhQ6JLKz3ZBp; Wed, 15 Jan 2025 20:31:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736973078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wwG9Qvd7d81aV6bz7sM9Qk3+/SdxbS0yE6to5DEl37c=; b=k0rO38wF+995y9J7uNAlxEutAfWeNjIFuOVVKNVl+J+nwyra3FUUBzqiJOudiLQD+ArIDp NqOgEX1W8Mj4iRxHb3KLYWVcJDOl+VsslC159V6dhk43hCBSmKdrpTQz9pjy9gOkFozm/I 5uXZPOF/zzNOr+B1ULQV2PP5IhxWG6HPLYGY2TonERD/NVPmlh1OUCbgzJFNCj0wO67J2D CQXYyWK5sOnPu6hxherkqhkvnKBVMUJs8wWbIM/GsGui7KrmPstHlHRySrjlmutoLE8ndk 7PR8M7ttPgbQ0YjgO4Vf6wd36wqBotPlaFd7iDVTWsZT23pWIhEH5OUaZVGb4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736973078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wwG9Qvd7d81aV6bz7sM9Qk3+/SdxbS0yE6to5DEl37c=; b=O5UpRMqNzStwfxeoIof6YFx5CttdKSaRhmT3OH/1Zyoq+7xAPk7JREWGETVqHDL6IeFqMQ bk3THv5T3EA7yJiuSIA0kf3NrtQuUymQRki6MeZL5djUqghon4yzLr70t/in+a+IZojpWP zfddeyh8gITRo/jKXvuq/RitD5MuKUcSGXkwz+zEz0g9WEg85WFAoaowvpXftS7mcsdANV VTkIWj5/tKE9fesUn28EW0UpE/HcF8qdLxdEoVvcHpjNWao73HrEYfgW/Vn2tQESu7h28B 9/0hYnDei6fUvViDoDjPDwHS+KWdipfou4ga4yeT0J5gkpXac3IEYCNiLBtV7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736973078; a=rsa-sha256; cv=none; b=BZVWuifU9BH3rKdlbQQJBKDBGT2+pSURgD9Q6EOKveBs5TdgIu/pRd2532mNvObbBffCKM dMgJe+25nDIT8sv/zVJpMeRLeHtC+nYt5U4zo51GNEfdAyOy+cT1BrXruAtQ8e+Z+n8pSt 0OHtyU4e8IyLa1BScQ3WDD88HfTvW9MSeGv/VG8I7UTu7J0zqyrvCSjZdvjCKWHWRLM43q 16TA2RnZmdIEm+DGJQksmb7g2B+znl+oLYUbTUbLbxN/oNRa8rwX6FPiz6bati/odROsSf WOhaV+IbLms8kzHCvnLWEgSo0KE3jjk8ZHMvJ5KaO2zwnswmmBDJwco2ka/jhw== 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 4YYHhQ5qdsz11vG; Wed, 15 Jan 2025 20:31: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 50FKVIIA065994; Wed, 15 Jan 2025 20:31:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FKVIHK065991; Wed, 15 Jan 2025 20:31:18 GMT (envelope-from git) Date: Wed, 15 Jan 2025 20:31:18 GMT Message-Id: <202501152031.50FKVIHK065991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 9f31c4746041 - main - fusefs: add a test for the max_read= mount option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f31c47460412ab6ccae36a70ca019b47423ccec Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9f31c47460412ab6ccae36a70ca019b47423ccec commit 9f31c47460412ab6ccae36a70ca019b47423ccec Author: Alan Somers AuthorDate: 2025-01-10 21:36:02 +0000 Commit: Alan Somers CommitDate: 2025-01-15 20:29:15 +0000 fusefs: add a test for the max_read= mount option When set, this limits the amount of data that the kernel will request of the server in any single read operation. The option has always been available in our fusefs implementation, but never covered by the test suite. MFC after: 2 weeks Sponsored by: ConnectWise --- tests/sys/fs/fusefs/mockfs.cc | 10 +++++++- tests/sys/fs/fusefs/mockfs.hh | 8 ++++++- tests/sys/fs/fusefs/read.cc | 53 +++++++++++++++++++++++++++++++++++++++++++ tests/sys/fs/fusefs/utils.cc | 2 +- tests/sys/fs/fusefs/utils.hh | 2 ++ 5 files changed, 72 insertions(+), 3 deletions(-) diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index 502f22a1e980..1fd2d5e358b1 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -416,7 +416,8 @@ void MockFS::debug_response(const mockfs_buf_out &out) { } } -MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, +MockFS::MockFS(int max_read, int max_readahead, bool allow_other, + bool default_permissions, bool push_symlinks_in, bool ro, enum poll_method pm, uint32_t flags, uint32_t kernel_minor_version, uint32_t max_write, bool async, bool noclusterr, unsigned time_gran, bool nointr, bool noatime, @@ -424,6 +425,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, : m_daemon_id(NULL), m_kernel_minor_version(kernel_minor_version), m_kq(pm == KQ ? kqueue() : -1), + m_maxread(max_read), m_maxreadahead(max_readahead), m_pid(getpid()), m_uniques(new std::unordered_set), @@ -470,6 +472,12 @@ MockFS::MockFS(int max_readahead, bool allow_other, bool default_permissions, build_iovec(&iov, &iovlen, "from", __DECONST(void *, "/dev/fuse"), -1); sprintf(fdstr, "%d", m_fuse_fd); build_iovec(&iov, &iovlen, "fd", fdstr, -1); + if (m_maxread > 0) { + char val[10]; + + snprintf(val, sizeof(val), "%d", m_maxread); + build_iovec(&iov, &iovlen, "max_read=", &val, -1); + } if (allow_other) { build_iovec(&iov, &iovlen, "allow_other", __DECONST(void*, &trueval), sizeof(bool)); diff --git a/tests/sys/fs/fusefs/mockfs.hh b/tests/sys/fs/fusefs/mockfs.hh index 38efcd049a61..1de77767d0c9 100644 --- a/tests/sys/fs/fusefs/mockfs.hh +++ b/tests/sys/fs/fusefs/mockfs.hh @@ -294,6 +294,12 @@ class MockFS { int m_kq; + /* + * If nonzero, the maximum size in bytes of a read that the kernel will + * send to the server. + */ + int m_maxread; + /* The max_readahead file system option */ uint32_t m_maxreadahead; @@ -355,7 +361,7 @@ class MockFS { bool m_quit; /* Create a new mockfs and mount it to a tempdir */ - MockFS(int max_readahead, bool allow_other, + MockFS(int max_read, int max_readahead, bool allow_other, bool default_permissions, bool push_symlinks_in, bool ro, enum poll_method pm, uint32_t flags, uint32_t kernel_minor_version, uint32_t max_write, bool async, diff --git a/tests/sys/fs/fusefs/read.cc b/tests/sys/fs/fusefs/read.cc index 9693428914e6..e9c79ba2ffda 100644 --- a/tests/sys/fs/fusefs/read.cc +++ b/tests/sys/fs/fusefs/read.cc @@ -111,6 +111,13 @@ class ReadAhead: public Read, } }; +class ReadMaxRead: public Read { + virtual void SetUp() { + m_maxread = 16384; + Read::SetUp(); + } +}; + class ReadNoatime: public Read { virtual void SetUp() { m_noatime = true; @@ -840,6 +847,52 @@ TEST_F(Read, mmap) leak(fd); } + +/* When max_read is set, large reads will be split up as necessary */ +TEST_F(ReadMaxRead, split) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + int fd; + ssize_t bufsize = 65536; + ssize_t fragsize = bufsize / 4; + char *rbuf, *frag0, *frag1, *frag2, *frag3; + + rbuf = new char[bufsize](); + frag0 = new char[fragsize](); + frag1 = new char[fragsize](); + frag2 = new char[fragsize](); + frag3 = new char[fragsize](); + memset(frag0, '0', fragsize); + memset(frag1, '1', fragsize); + memset(frag2, '2', fragsize); + memset(frag3, '3', fragsize); + + expect_lookup(RELPATH, ino, bufsize); + expect_open(ino, 0, 1); + expect_read(ino, 0, fragsize, fragsize, frag0); + expect_read(ino, fragsize, fragsize, fragsize, frag1); + expect_read(ino, 2 * fragsize, fragsize, fragsize, frag2); + expect_read(ino, 3 * fragsize, fragsize, fragsize, frag3); + + fd = open(FULLPATH, O_RDONLY); + ASSERT_LE(0, fd) << strerror(errno); + + ASSERT_EQ(bufsize, read(fd, rbuf, bufsize)) << strerror(errno); + ASSERT_EQ(0, memcmp(rbuf, frag0, fragsize)); + ASSERT_EQ(0, memcmp(rbuf + fragsize, frag1, fragsize)); + ASSERT_EQ(0, memcmp(rbuf + 2 * fragsize, frag2, fragsize)); + ASSERT_EQ(0, memcmp(rbuf + 3 * fragsize, frag3, fragsize)); + + delete[] frag3; + delete[] frag2; + delete[] frag1; + delete[] frag0; + delete[] rbuf; + leak(fd); +} + /* * The kernel should not update the cached atime attribute during a read, if * MNT_NOATIME is used. diff --git a/tests/sys/fs/fusefs/utils.cc b/tests/sys/fs/fusefs/utils.cc index 831ded0c0815..d059221b2e55 100644 --- a/tests/sys/fs/fusefs/utils.cc +++ b/tests/sys/fs/fusefs/utils.cc @@ -154,7 +154,7 @@ void FuseTest::SetUp() { m_maxwrite = MIN(libfuse_max_write, (uint32_t)m_maxphys / 2); try { - m_mock = new MockFS(m_maxreadahead, m_allow_other, + m_mock = new MockFS(m_maxread, m_maxreadahead, m_allow_other, m_default_permissions, m_push_symlinks_in, m_ro, m_pm, m_init_flags, m_kernel_minor_version, m_maxwrite, m_async, m_noclusterr, m_time_gran, diff --git a/tests/sys/fs/fusefs/utils.hh b/tests/sys/fs/fusefs/utils.hh index 506e8a985212..9dd8dad6b5cc 100644 --- a/tests/sys/fs/fusefs/utils.hh +++ b/tests/sys/fs/fusefs/utils.hh @@ -55,6 +55,7 @@ bool is_unsafe_aio_enabled(void); extern const uint32_t libfuse_max_write; class FuseTest : public ::testing::Test { protected: + uint32_t m_maxread; uint32_t m_maxreadahead; uint32_t m_maxwrite; uint32_t m_init_flags; @@ -80,6 +81,7 @@ class FuseTest : public ::testing::Test { unsigned long m_maxphys; FuseTest(): + m_maxread(0), m_maxreadahead(0), m_maxwrite(0), m_init_flags(0), From nobody Wed Jan 15 20:38:44 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYHs100jsz5kd45; Wed, 15 Jan 2025 20:38:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYHs04Pptz3c7v; Wed, 15 Jan 2025 20:38:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736973524; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2th973HEIw6ewfVzlmHCHpoPtYFVJkCD+XkkrwEiJ3c=; b=JWZe7n5BiqnYhsOzLyA/MMT9WvoG3xuybDzceW1YV+I2lEYPDzyRaky9/LzvaHXl088Nxr u5JcmljQCi8eOMJnVJqeHBeEJL/uqHewmE6Q/QXhReAfGO7BZ0yGRfqI/B4r7cHgONm8VF mPUZ/Fh9GGY0a0jKT9op7NPa9D2Qhea6m9l0awy8ZoJBoX3STDvnL7ltQAuUeAw1TJdWsJ qYKIcYfnlgoN48gzL+WHyHm9y7B+xCqN4lI0uyb3J+f3xU66AkmN3ip4uBqJf6Nov5R/TJ LNJNGRGTVwLzcb1hEECb/G6VtRsnLBd7BDiXCHEmMcZQJ7xV+9BIARf8RAQQKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736973524; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2th973HEIw6ewfVzlmHCHpoPtYFVJkCD+XkkrwEiJ3c=; b=mVmhkJUJnEu++UZnhDvlm6Nq3bKrsbXqXdC5HuFhOeGFF3Gss+Yf+mqJChtYwCoPs4k8l9 kzAtAbp/qqEA4aRr1kvG5Ji0XSGbEgHng+C6oC0iOrQQpxE1FJuwc3ULCNkb51Qrvue/KO /m2gHjf0a7L2VhbZL0AjRMXTkca30HZpZxdxV+udEn8CPid54ngcOsFHAbJSZLlbkpkppy DAdmT5Q2gWrc2JWcTDRl883cYfggI94cgGq5QRO8dND1S5cVcRfA9/Gf0GPrlw3Bgi7ILF 0Wn9O7BTr/cHUo50d7MFcDMCs7K6FSCmd5tmVdRxffwycaX0qCSQEJkihHhAHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736973524; a=rsa-sha256; cv=none; b=YwAT5LZtn5kE5gP1tUw6dxm0qpiHZupkYKRvMTUIzYsqdfOgDCt2yIg10fIGK+A8ticc/x Ul+0hUFI+OE7iAOBvzBG+Q1UpQ69oKwKA4VoO9N0BnkkOa3cS81egVNtE8FyfgHipLsQU4 o/BqXJ5t3BDEcyXjarT9YcyxCJjeBeAAPQr3WoA8gMJK1AAKjypzks2/ru6J8gFGPbkXu7 oYZ6Grd9N3Ju7hyz6LfqIey5Mq4D8LV3ITZZQnZOCEXM9ogLWGrQZ+C65ewDvtOezF8jOm aKw0EWI9VKy3Q0PIs/PgUIotRvUxvufllsJhsI7btkpRfP7y6W/qLAdNpQqNSw== 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 4YYHs03k0Sz11N8; Wed, 15 Jan 2025 20:38:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FKcisT073080; Wed, 15 Jan 2025 20:38:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FKcidm073077; Wed, 15 Jan 2025 20:38:44 GMT (envelope-from git) Date: Wed, 15 Jan 2025 20:38:44 GMT Message-Id: <202501152038.50FKcidm073077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 564c732b5c02 - main - fusefs: slightly better debugging in the tests List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 564c732b5c0221373d067c9a21da09b310e676ae Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=564c732b5c0221373d067c9a21da09b310e676ae commit 564c732b5c0221373d067c9a21da09b310e676ae Author: Alan Somers AuthorDate: 2025-01-10 18:20:06 +0000 Commit: Alan Somers CommitDate: 2025-01-15 20:37:37 +0000 fusefs: slightly better debugging in the tests If the kernel rejects a response written by the server, print it. That would most likely be due to an error in the test logic. MFC after: 2 weeks Sponsored by: ConnectWise --- tests/sys/fs/fusefs/mockfs.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index 1fd2d5e358b1..532dd27d77b9 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -1034,6 +1034,10 @@ void MockFS::write_response(const mockfs_buf_out &out) { ASSERT_EQ(-1, r); ASSERT_EQ(out.expected_errno, errno) << strerror(errno); } else { + if (r <= 0 && errno == EINVAL) { + printf("Failed to write response. unique=%lu:\n", + out.header.unique); + } ASSERT_TRUE(r > 0 || errno == EAGAIN) << strerror(errno); } } From nobody Wed Jan 15 21:10:40 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYJYs1j0Gz5kflD; Wed, 15 Jan 2025 21:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYJYs11sDz3gV4; Wed, 15 Jan 2025 21:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736975441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QP1hzsRs/KmCaEYm54FPdAfSY1ZEQEF/76dUiWhkMJw=; b=Qozh9e4t7RIY2gtcKiix0jgdwskEjBfL4JCk8mphV4i942O9stuem6Ky0qk2QunIBeMRBZ 4Mkq1zNskMv+LsCM/uBymA6K8DdAIa/fBSdErFOJlJ9ygR/VlIn2yHSrCXQRrIt4OoiJz+ oR3KYN/HnNKbQKmH4kr2okzMNPpth2+U79B0qjutrC1lTKK5QNr0S5P/Ke3Iy4afRUhRt3 yick+FC28XaQLDc2KlC/iRx+qRaDSulYLNpS608pUz241hT2hoCn76qaCMAQqi52qQUOIO YWzAuGaXr/y99cgm5F2Nvu/kBcGas1sIi21LOgpFIZX2VChbUBNs4XvfBDfOYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736975441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QP1hzsRs/KmCaEYm54FPdAfSY1ZEQEF/76dUiWhkMJw=; b=t3tAOU/iBoWj1xjWyN4FRqKoul1KapxtdEHJ7MN2/qSLaSMsuUpHCq7/Ikp7Xnsgyqrbde 0bHTGYN0wFjHQlHcCM0UhY4bsQ8yzJfaYsaT2RG/qPKo3HfMiTTL3aYdWNprlaXhALHA43 mA5wvywGY4K7TFdPoq96rJN/6xH/TagkHpxkgRenMS9iJH/AXqn0IvUbUxMOOS5Ot06/Xu ZI2F3tq5bWYvlR7Ke4HnJSuI/nYtYmUopPHPWHO/JD1zkrJZCbUj7CF8bq1VOAy5hTjUH5 jUbjZryiQlg++NHirw02uAGP7iEYBtqbMdr8f+ZqP4RwTVOud2eQHNIJrd1Edw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736975441; a=rsa-sha256; cv=none; b=I4g+Q13D2u2bzY7mIxR+BwPTTbyL5PByAKLXkZggf/Plv/5CFKKWQThscTrISTlB6wP4nJ FtX7pPPklrjAFBVzPr8JrqX+yJv9uZbe3DGAOcFONlO6N/QXFX8sczIMf1SiVwQxd7dHxW HfN94mgcFWLCc/fNoHpC7/e29ge8SBDedswr9bMJb+kheBwQbfjmoR/2xAOg+rgCy+bFxt c4LDlpJO2GYex+rRhtaXSJrDVDPc8XanZ2wCaWARcD9Xvmj7kKCBiMTMzYge3XwiYCrNHT Vp4N0WRuyyx8mCIh8QvwZ0AKQ1Lp1ki/vtoCAD6VOJOb0pfBspJj68DQznMZAw== 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 4YYJYs0Vhjz12fK; Wed, 15 Jan 2025 21:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FLAe3g042093; Wed, 15 Jan 2025 21:10:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FLAeFF042090; Wed, 15 Jan 2025 21:10:40 GMT (envelope-from git) Date: Wed, 15 Jan 2025 21:10:40 GMT Message-Id: <202501152110.50FLAeFF042090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: c18a6c15f415 - main - Use ffs_sbget() to replace open-coded superblock reload. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c18a6c15f4152029b6d1d0f64aa1ff36faceb9b2 Auto-Submitted: auto-generated The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=c18a6c15f4152029b6d1d0f64aa1ff36faceb9b2 commit c18a6c15f4152029b6d1d0f64aa1ff36faceb9b2 Author: Kirk McKusick AuthorDate: 2025-01-15 21:08:42 +0000 Commit: Kirk McKusick CommitDate: 2025-01-15 21:08:42 +0000 Use ffs_sbget() to replace open-coded superblock reload. No functional change intended. Tested-by: Peter Holm MFC-after: 1 week --- sys/ufs/ffs/ffs_vfsops.c | 87 ++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 65 deletions(-) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 9e94d368d7c9..a739e0220ec9 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -578,8 +578,12 @@ ffs_mount(struct mount *mp) vfs_write_resume(mp, 0); } if ((mp->mnt_flag & MNT_RELOAD) && - (error = ffs_reload(mp, 0)) != 0) + (error = ffs_reload(mp, 0)) != 0) { return (error); + } else { + /* ffs_reload replaces the superblock structure */ + fs = ump->um_fs; + } if (fs->fs_ronly && !vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { /* @@ -740,26 +744,20 @@ ffs_cmount(struct mntarg *ma, void *data, uint64_t flags) * Things to do to update the mount: * 1) invalidate all cached meta-data. * 2) re-read superblock from disk. - * 3) re-read summary information from disk. - * 4) invalidate all inactive vnodes. - * 5) clear MNTK_SUSPEND2 and MNTK_SUSPENDED flags, allowing secondary - * writers, if requested. - * 6) invalidate all cached file data. - * 7) re-read inode data for all active vnodes. + * 3) If requested, clear MNTK_SUSPEND2 and MNTK_SUSPENDED flags + * to allow secondary writers. + * 4) invalidate all cached file data. + * 5) re-read inode data for all active vnodes. */ int ffs_reload(struct mount *mp, int flags) { struct vnode *vp, *mvp, *devvp; struct inode *ip; - void *space; struct buf *bp; struct fs *fs, *newfs; struct ufsmount *ump; - ufs2_daddr_t sblockloc; - int i, blks, error; - uint64_t size; - int32_t *lp; + int error; ump = VFSTOUFS(mp); @@ -782,31 +780,22 @@ ffs_reload(struct mount *mp, int flags) /* * Step 2: re-read superblock from disk. */ - fs = VFSTOUFS(mp)->um_fs; - if ((error = bread(devvp, btodb(fs->fs_sblockloc), fs->fs_sbsize, - NOCRED, &bp)) != 0) + if ((error = ffs_sbget(devvp, &newfs, UFS_STDSB, 0, M_UFSMNT, + ffs_use_bread)) != 0) return (error); - newfs = (struct fs *)bp->b_data; - if ((newfs->fs_magic != FS_UFS1_MAGIC && - newfs->fs_magic != FS_UFS2_MAGIC) || - newfs->fs_bsize > MAXBSIZE || - newfs->fs_bsize < sizeof(struct fs)) { - brelse(bp); - return (EINTEGRITY); - } /* - * Preserve the summary information, read-only status, and - * superblock location by copying these fields into our new - * superblock before using it to update the existing superblock. + * Replace our superblock with the new superblock. Preserve + * our read-only status. */ - newfs->fs_si = fs->fs_si; + fs = VFSTOUFS(mp)->um_fs; newfs->fs_ronly = fs->fs_ronly; - sblockloc = fs->fs_sblockloc; - bcopy(newfs, fs, (uint64_t)fs->fs_sbsize); - brelse(bp); + free(fs->fs_csp, M_UFSMNT); + free(fs->fs_si, M_UFSMNT); + free(fs, M_UFSMNT); + fs = VFSTOUFS(mp)->um_fs = newfs; ump->um_bsize = fs->fs_bsize; ump->um_maxsymlinklen = fs->fs_maxsymlinklen; - ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc); + ffs_oldfscompat_read(fs, VFSTOUFS(mp), fs->fs_sblockloc); UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { printf("WARNING: %s: reload pending error: blocks %jd " @@ -816,42 +805,10 @@ ffs_reload(struct mount *mp, int flags) fs->fs_pendinginodes = 0; } UFS_UNLOCK(ump); - - /* - * Step 3: re-read summary information from disk. - */ - size = fs->fs_cssize; - blks = howmany(size, fs->fs_fsize); - if (fs->fs_contigsumsize > 0) - size += fs->fs_ncg * sizeof(int32_t); - size += fs->fs_ncg * sizeof(uint8_t); - free(fs->fs_csp, M_UFSMNT); - space = malloc(size, M_UFSMNT, M_WAITOK); - fs->fs_csp = space; - for (i = 0; i < blks; i += fs->fs_frag) { - size = fs->fs_bsize; - if (i + fs->fs_frag > blks) - size = (blks - i) * fs->fs_fsize; - error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), size, - NOCRED, &bp); - if (error) - return (error); - bcopy(bp->b_data, space, (uint64_t)size); - space = (char *)space + size; - brelse(bp); - } /* - * We no longer know anything about clusters per cylinder group. + * Step 3: If requested, clear MNTK_SUSPEND2 and MNTK_SUSPENDED flags + * to allow secondary writers. */ - if (fs->fs_contigsumsize > 0) { - fs->fs_maxcluster = lp = space; - for (i = 0; i < fs->fs_ncg; i++) - *lp++ = fs->fs_contigsumsize; - space = lp; - } - size = fs->fs_ncg * sizeof(uint8_t); - fs->fs_contigdirs = (uint8_t *)space; - bzero(fs->fs_contigdirs, size); if ((flags & FFSR_UNSUSPEND) != 0) { MNT_ILOCK(mp); mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | MNTK_SUSPEND2); From nobody Wed Jan 15 21:49:36 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYKQm2STLz5kjRM; Wed, 15 Jan 2025 21:49:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYKQm1pVrz3kMK; Wed, 15 Jan 2025 21:49:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736977776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XhmJ1Hn12SL2hqO5s/axnmNU5Dd1snIZG+fsv6jeu8M=; b=CNQjsEDzTPzYVJ1iaTz2wI6cJsWPFgkWT2bVMRbNIphDqUYn9dX24veP+8QZmvJfdEjPKK 4NIaGJeJhUesTVphdQ8BHqkw/WkcKnCFCnzo12ZR4V1fBPVKIRIZv8EUSNg62Rxrf0Ytbo xBTZ39JVAF4bU8aHsCY9wbTj3I1jTmB7tiZ66wuU5dm76f+ps1Izb/cATK+rVL9q6Uni9n MbPyffH5iLogHTzkVUsB/IyTtPHVtCrENzZzf52P0uWp1f2pYuVOut2vaOrnxRb4Vrz5Yq iloe2UfngGzs8fAQo/tp/RViaG0sCgjXZDPNp561uO0dWLK3jzEnQzbdEDaOMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736977776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XhmJ1Hn12SL2hqO5s/axnmNU5Dd1snIZG+fsv6jeu8M=; b=ABk7kxQnyNQr2+jJoumJ3xJMfIeb+0+pEembaLFEhtQD2Pfv/7iMJJ5DR2Woj0HjlcKkPO JLJOmVPPySwKrcgwJruPoV7VMA0DNsZlP2AtCCQaFJVUDPYW0jK8Qc7e8Q+Ad9aF5s9zSP qGFe0xwPcZd1+D4kpE5a3XNPZN40mD2tZgl6HJnBqzvrKi6OqXMc7FgNGkLO3lERUmHpuP NK+LfvTI+tr5e0RGDRtsdZcZav4oqYQQS/1kFChNAFQC7bkCSAwbl2+B8yDM7pkmumZHft 7xSlGtjv7HhqK5c8hC0Q3v6AKCfYisPQ+Iri18g9loWBN/rxmaD379n54G/pwg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736977776; a=rsa-sha256; cv=none; b=m3ZNqWfWIWvm2lLVThAYGZGlYkpJc5k4KNI8TXaH3erNhMbT8KR4lXRaP8ejClmEkEMlO4 gN4Bj/9Ji0ibobl2furk1G1IzgxrEaMRrKOX41eoQP2EGxYMOMM1scSvNuU8pjzxGKPAai MiWNudokGS/JmKubyPh8MmjfQEDFE5UajJVtAjfl6AW28jVv8L6ieXsJhoCkRkPtJ8gfw/ Qn2ENTmywZObBmNZGm2gyN1Cj19mLVIolFCQKowMeTHTe53tnMReI5H0tnk98szI4lSCw5 1fXqf2pscDAjaEWoPVhLv8I4w2wvc36clb6BoxVtRjnz+BlbrmruyM4LE9EI4Q== 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 4YYKQm1BbZz13vk; Wed, 15 Jan 2025 21:49:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FLnaMi004570; Wed, 15 Jan 2025 21:49:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FLna4b004567; Wed, 15 Jan 2025 21:49:36 GMT (envelope-from git) Date: Wed, 15 Jan 2025 21:49:36 GMT Message-Id: <202501152149.50FLna4b004567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: fab411c4fd52 - main - munmap.2: Remove EINVAL for negative len List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fab411c4fd5224e3dd44e0eb288d60b27480e2d1 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=fab411c4fd5224e3dd44e0eb288d60b27480e2d1 commit fab411c4fd5224e3dd44e0eb288d60b27480e2d1 Author: Ed Maste AuthorDate: 2025-01-15 21:44:31 +0000 Commit: Ed Maste CommitDate: 2025-01-15 21:49:21 +0000 munmap.2: Remove EINVAL for negative len len is unsigned (it is size_t), so cannot be negative. Sponsored by: The FreeBSD Foundation --- lib/libsys/munmap.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libsys/munmap.2 b/lib/libsys/munmap.2 index 560ed0056260..d6b53f1bcf19 100644 --- a/lib/libsys/munmap.2 +++ b/lib/libsys/munmap.2 @@ -55,7 +55,7 @@ will fail if: .It Bq Er EINVAL The .Fa len -argument was zero or negative, or +argument was zero, or some part of the region being unmapped is outside the valid address range for a process. .El From nobody Wed Jan 15 22:06:42 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYKpW0vtqz5kkDR; Wed, 15 Jan 2025 22:06:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYKpW08jKz3lsH; Wed, 15 Jan 2025 22:06:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736978803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uKru6bni5aRRSzhcR8WEk9SHF7pQJ7X5sOd96TAsbyg=; b=xM55OsweFBa2iCR94dJuoSZKOXmNxeBJFwuVUsF3dLuZ2ypN55R+zAvaXgwdQe4j0eBUtI sduQrA5bUJ4MXM9MPdOmUfhh7ERJw/4HwZEiyyue83Eg/dudApHvStvKZf5LytNjKMBjQh uON/JFRK/liHzRBOZCQWGUbPS90XwgtpEnQTc/95yK8mErMcZx5nsXxaf6cxMd+7U/ooeo XMmjivUM4P1gBRHcT5egJNp6n7RHKNST+foEwd+cAthZUnVdALEk55dzU2GoR/Os/xVEKB ikWciG2/YLLomxcpkgFD2nA3b79ErzNpIEiyGljHooiYLxJBVt0gCtoBpNkr8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736978803; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uKru6bni5aRRSzhcR8WEk9SHF7pQJ7X5sOd96TAsbyg=; b=XwpgpiWdqK4alK83duJ4x3inWBUpid4GukSkgWT2GNsfWRZHmFLCqF9/49ZqmXBDE7O7tf dyLQOFOsV41IiWtH5x5qtgPgYDY9eW2Zjrm/KzXIpnie5xnzKUZ44kbMF9CMS1k4dKRYzv tal15rt7PzXoxB02AJxKz0Wih7sgoR2T1BeW2kpZH/H8VEK8LLC6xMs3LUHW4JkKfi3S4O O+cyjUFgA0Q1xnGSqdz9+o2ZU4UvSswqfph7ADigxS37rho7iKt8duOJmUcozY6YI/h3Wq fyXMqbIdFqM9Oa0eX9efRVwJc2CukxiiZOyGy4jMpJcaOu/sQVheoXdJPO23mw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736978803; a=rsa-sha256; cv=none; b=RIrBKrpwCoT7Del0UvOVnadqL3AtFc/X7X9h4v3nR/ZmoVYrp0IurCVFkqNLZJcY4xm41I BIIK2VrWGZc/cxL9XZACDQP0ZE/qzOxxDQc3wAxl2/gnycGs/QdIhsyZUNPAnoVsZFlSQy yfww09Edfz3Ii0NS8YT4qOCvT58hNTk32ISdwxe3hUqlKAkPXDlBRWhmkxQ1BSueWTIefh LVbvvGjMOEI9uwX6wHhK1sZrT1XYzfPFBXGHmYcnZk6h41hhxMx2yIb86NF9DCaekYDU8C IXcgMzwDEnYhV80DeGIcWI+su9Hi1Gi5K/DriRzxnzeecwxvT9IYC+XG///Wvg== 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 4YYKpV6FP0z140w; Wed, 15 Jan 2025 22:06:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50FM6gB3041768; Wed, 15 Jan 2025 22:06:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FM6gJ6041765; Wed, 15 Jan 2025 22:06:42 GMT (envelope-from git) Date: Wed, 15 Jan 2025 22:06:42 GMT Message-Id: <202501152206.50FM6gJ6041765@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 2d2481c35f5a - main - pf: add extra SCTP multihoming probe points List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d2481c35f5a53322e982e47a2bb8f9085f525b7 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2d2481c35f5a53322e982e47a2bb8f9085f525b7 commit 2d2481c35f5a53322e982e47a2bb8f9085f525b7 Author: Kristof Provost AuthorDate: 2025-01-08 21:23:17 +0000 Commit: Kristof Provost CommitDate: 2025-01-15 22:02:42 +0000 pf: add extra SCTP multihoming probe points Add probe points in the SCTP multihome parsing code. This is intended to help debug a multihome issue, and is expected to be generally useful, so will be included for everyone. MFC after: 2 weeks Sponsored by: Orange Business Services --- sys/netpfil/pf/pf.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 053b0b2ccb31..a49216a9dc20 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -140,6 +140,13 @@ SDT_PROBE_DEFINE2(pf, sctp, multihome, add, "uint32_t", "struct pf_sctp_source *"); SDT_PROBE_DEFINE3(pf, sctp, multihome, remove, "uint32_t", "struct pf_kstate *", "struct pf_sctp_source *"); +SDT_PROBE_DEFINE4(pf, sctp, multihome_scan, entry, "int", + "int", "struct pf_pdesc *", "int"); +SDT_PROBE_DEFINE2(pf, sctp, multihome_scan, param, "uint16_t", "uint16_t"); +SDT_PROBE_DEFINE2(pf, sctp, multihome_scan, ipv4, "struct in_addr *", + "int"); +SDT_PROBE_DEFINE2(pf, sctp, multihome_scan, ipv6, "struct in_addr6 *", + "int"); SDT_PROBE_DEFINE3(pf, eth, test_rule, entry, "int", "struct ifnet *", "struct mbuf *"); @@ -7493,6 +7500,8 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op) int off = 0; struct pf_sctp_multihome_job *job; + SDT_PROBE4(pf, sctp, multihome_scan, entry, start, len, pd, op); + while (off < len) { struct sctp_paramhdr h; @@ -7504,6 +7513,9 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op) if (ntohs(h.param_length) < 4) return (PF_DROP); + SDT_PROBE2(pf, sctp, multihome_scan, param, ntohs(h.param_type), + ntohs(h.param_length)); + switch (ntohs(h.param_type)) { case SCTP_IPV4_ADDRESS: { struct in_addr t; @@ -7533,6 +7545,8 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op) if (! job) return (PF_DROP); + SDT_PROBE2(pf, sctp, multihome_scan, ipv4, &t, op); + memcpy(&job->pd, pd, sizeof(*pd)); // New source address! @@ -7566,6 +7580,8 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op) if (! job) return (PF_DROP); + SDT_PROBE2(pf, sctp, multihome_scan, ipv6, &t, op); + memcpy(&job->pd, pd, sizeof(*pd)); memcpy(&job->src, &t, sizeof(t)); job->pd.src = &job->src; @@ -7616,6 +7632,7 @@ pf_multihome_scan(int start, int len, struct pf_pdesc *pd, int op) return (PF_PASS); } + int pf_multihome_scan_init(int start, int len, struct pf_pdesc *pd) { From nobody Wed Jan 15 23:33:12 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYMkJ2bbpz5kpnP; Wed, 15 Jan 2025 23:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYMkJ1qCmz3sQ9; Wed, 15 Jan 2025 23:33:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736983992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wvxCugZoTVHpHG/3fso0e4oHC3LjcV4pBz2pYhsOu24=; b=W3nOX0pgN350FAXr/6DW2R6UzL5gMK5RMkV3fXrAJ3CjDzsziyfgzfapDuyPuLuB7Qsi3V 4JHDc3S91y2CVOLj8oYEeGgiiSgj4AAe5P1AL6kgroM7inRqgXcbo0LGJMzD0ZUTs/y/Wg baufE1rM6euwE2Jc5qgljK3IkAf3UcGA4ggFJygLlm9RY4dRzwNdfbDB0HlXp/9AusTQy+ t5MV4inVqr33z/qPf5WcNaFo7sf6DwTtdJrU0+tzX5BAoQ+96ATVeVjrE0IDkgofoCkLpa KEhlkNsYCt3SRp9xJpvnzEuiZPytWCd4ROfSD940Vvk+HWSeKaiVBbdoFCp/pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736983992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wvxCugZoTVHpHG/3fso0e4oHC3LjcV4pBz2pYhsOu24=; b=GHkE0TZjidkXJuG0DWWCChKa395AnCqSquXwKyL57AqLmWzEjlrLNF03vqaZVq99K8v9C1 4Jt+K4XRaQjGu+uXugE26HdR8pQd8vKBYkKQrFxUlW2byrVvVn8x6jp4z4LJPbK29qZhbj /QNCf7bOXtlB8etxTF1/tCDyz3bclgpKmXAAb66eeaiBB7Bt3kfZOwdBpvzNchrSUxJ5Wk 0RzEbAyzNlMI6x7ASmdz6OigjxFfu8Nu1CNEXayncSl1TIO9okH8Jc6UiPnGmaLlJmP4EJ H57RsJyiwCvAO7FjFonXoIr2T+h125eAVWMQIg97BDFfqsqkCYAODxIwSqgY8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736983992; a=rsa-sha256; cv=none; b=J8cfssR9UxWrZa5ci7xRwMsf7iCddJbD8stsUpWzRsjSaDErAsWiXxmw2QZtUgJhaIbFGr 8uAGbhzjQk/s74GhUfKX7w5QwuuJJc+UWtkTtQRmCucUSUl/KKXNgceDrUEJ+oQlzXfNnB pVLzuIRiWU/3adXrLIFgT25ngv7r9U4rPCE6iA26jUpkb/aKVexYDoHYhCwX1BpWfe8Bfm rJ2xJ8MrUFYqqvJ7jdVV1ZS4lCLd6a055n6O9C/G9yvR5fykF7qCMZP3DBocu4MBOWOyZe R8Wjo0J2wKlw0tKtYwMWTH2cOpd8acNGs7/5ReYjkUCZ2IRIq0h4/22Fj/UA5A== 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 4YYMkJ1QQsz16PM; Wed, 15 Jan 2025 23:33: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 50FNXC76008636; Wed, 15 Jan 2025 23:33:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FNXC6H008633; Wed, 15 Jan 2025 23:33:12 GMT (envelope-from git) Date: Wed, 15 Jan 2025 23:33:12 GMT Message-Id: <202501152333.50FNXC6H008633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 52f7eb31ae84 - main - fusefs: fix the 32-bit build after 564c732b5c0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 52f7eb31ae84b0a02cd79c857c3201cb7b65c00f Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=52f7eb31ae84b0a02cd79c857c3201cb7b65c00f commit 52f7eb31ae84b0a02cd79c857c3201cb7b65c00f Author: Alan Somers AuthorDate: 2025-01-15 23:31:56 +0000 Commit: Alan Somers CommitDate: 2025-01-15 23:31:56 +0000 fusefs: fix the 32-bit build after 564c732b5c0 It's a printf format specifier again. MFC with: 564c732b5c0221373d067c9a21da09b310e676ae Sponsored by: ConnectWise --- tests/sys/fs/fusefs/mockfs.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index 532dd27d77b9..35ae6c207229 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -1035,8 +1035,8 @@ void MockFS::write_response(const mockfs_buf_out &out) { ASSERT_EQ(out.expected_errno, errno) << strerror(errno); } else { if (r <= 0 && errno == EINVAL) { - printf("Failed to write response. unique=%lu:\n", - out.header.unique); + printf("Failed to write response. unique=%" PRIu64 + ":\n", out.header.unique); } ASSERT_TRUE(r > 0 || errno == EAGAIN) << strerror(errno); } From nobody Wed Jan 15 23:36:17 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYMnt09krz5kpm9; Wed, 15 Jan 2025 23:36: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYMns6lCGz3sps; Wed, 15 Jan 2025 23:36:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736984178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rR58JaFIDRGPKgSKByJYZusWLymn1YQeIcawew+yu8k=; b=deVWpv+4U5UXa184CU+8R+wl87lC+ahI6YgAbzIbiRIloBOCkeDdvyjjvOXMVX/VMdgxeN pZwfZBRSXMI3X1sYLVUJBtuxjoUDf5LaBWO0JEkeMsCp58aYSkujx7fiSRQ7Q98KrwpHa1 Bek8KTTFPka2fJ2PYRh5vMQK1fVZtWgWr0vszkZjaOGME4MXdIhKFmnREFftU8OSqtYkvW jNN2ikR+3gnWZbcMCI69T/ODse020K5E0rKutI8HTlFmU9WwUCRNSEwIMY5hfuw02+odq/ dQpFxUSsoTLGH3P0GBMFqXiROgp6FvVRtdiKux6K7+ZsjMhygccJnxqW5MBdxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736984177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rR58JaFIDRGPKgSKByJYZusWLymn1YQeIcawew+yu8k=; b=YIQ6vknnFYfG5k+Eg6AXrK01Boz8kp3nHIC3ahnGhd/EU3zDwkbA1J6rNxSDy8gPfdqVQH UorSPpm7KioXrhTWb0owpF1J0UQjNzLyYOIjfFpk/0LGzHlAtWQ787ajUqG+n1bgO8QKxP xiZsMz29wsvyQprcpZ+8tZa3EXhBz23ZM/dV8RGxahtOPqzrioAjK6pgp4DYY6iXT/R6lz in22wkL+AMnrm5Yy8iDvSwfGdyAwdNmk9Rl93eFdcoKTS0AYUaypXrCZ3mSDB/sBidffJT fRzdIIBlS80F8bP5LVDO+Ei20Wyl6BBHZy9ShhpxkKYZAG2hN6OsfVbodWO4ag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736984177; a=rsa-sha256; cv=none; b=lFfyYB6nnZNvRUL2eM3Lg/wmAZDRmxNG/gOt7kVtgVnwqFriD2MoOFYqr0sUMeGpCRiBrw 0XgS+ZmGPEMU3Xujg3HP/I4FAW0I5LMd+7ZQsoL162FHJwobmUoVH6oZsbzcSxjhZ8ac7y E9MNNLME3bVY63o1lRGP04nBkQNuFa/cnSU4JoXmGe+XLkkgZzSMRK7Mx/LXSzx46kPUYz WzkpM+BzbwGgAWw9a27SLHmIYvjNEM7yAM9efn3dK08r4PZRC9agPBZ8nIzVJI7w+R3dlS 4CqlJeWrQCkpxUlAEz4aig5qpPt5vMxheDiFdHgTRyLVuhfx2K6tdgnKaFj7Og== 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 4YYMns6LqJz16m6; Wed, 15 Jan 2025 23:36: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 50FNaHRJ009658; Wed, 15 Jan 2025 23:36:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50FNaHH2009655; Wed, 15 Jan 2025 23:36:17 GMT (envelope-from git) Date: Wed, 15 Jan 2025 23:36:17 GMT Message-Id: <202501152336.50FNaHH2009655@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 054c5ddf587a - main - net80211: add IEEE80211_IS_LOCKED() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 054c5ddf587a7a0c430cf64dbf100b718eafdcc5 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=054c5ddf587a7a0c430cf64dbf100b718eafdcc5 commit 054c5ddf587a7a0c430cf64dbf100b718eafdcc5 Author: Bjoern A. Zeeb AuthorDate: 2025-01-15 22:50:01 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-01-15 23:36:00 +0000 net80211: add IEEE80211_IS_LOCKED() When trying to sort out a teardown locking problem (downcall in the driver can sleep) I found that the fan-out tree was getting too big to fix net80211 locking per-se for this while working on entirely different problems. Add IEEE80211_IS_LOCKED() so the driver can check and un-/re-lock as necessary (as we do in other cases already) to avoid panics on debug kernels left and right. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D48475 --- sys/net80211/ieee80211_freebsd.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h index b58c55cc7652..ed913f7b3661 100644 --- a/sys/net80211/ieee80211_freebsd.h +++ b/sys/net80211/ieee80211_freebsd.h @@ -73,6 +73,8 @@ typedef struct { mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED) #define IEEE80211_UNLOCK_ASSERT(_ic) \ mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED) +#define IEEE80211_IS_LOCKED(_ic) \ + mtx_owned(IEEE80211_LOCK_OBJ(_ic)) /* * Transmit lock. From nobody Wed Jan 15 23:42:39 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYMxH5VtCz5kqfd; Wed, 15 Jan 2025 23:42:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYMxH2j0hz3tMq; Wed, 15 Jan 2025 23:42:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736984563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eoLtTdjnufATvhJYJxoRAfrDbOZjCTinDzISFDiqxSM=; b=dohVRh+3w8NU31flCfLpjMEbQe5moJ1fcMHXgW2YjmKMS2fSRh/6zHaNJvog41/uUG9MUX 2DDRRozB5zDwQuJ36bdUq/ja+yTdF38+1c51aB5VOafbZvQsKJHkqNqjh0wFWUsj8xevr6 L6BV7kRTiLAuuBAcn0VJ+skBa0nAtrp1D9D/b7C9AJK9BpinA/BYtbLatLEjMAEKBt0oO5 hB+5SZfX2zusqE+7/03+eEBF0Cq5bbMJ8w9eG5b98ncfBfu1zMjUHalK7xNqPsUYUEaNds Qq8PbWXTzX3S8z6z2mDQ0CvdKcLZLTERLPPvacTmQ/Uf7XTvJiaFF4hcLis4pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736984563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eoLtTdjnufATvhJYJxoRAfrDbOZjCTinDzISFDiqxSM=; b=fRVoloPptmlI7nW+UOdZrSkLdHolanrtMS6SS2tub9b7+ezYwwj2MG4PBfT9Ze75q7qCck tuYOtch8xzC5ih0XFxOgrxiM8APZd7GQZbrPR3W2SwN/euCVHRaYeXAuSwgq60ppyi/zOi VRKGkho9fy4hA+Y6Fn3NRdansdbenyyLiN48sldAs0MOa4Y6K+DWnpBfHRhNYlJinMYD82 ZBde3hiIVl4ZHbiZl3eJ+Bij4+Z7ObJ6Fe1Gae4ovPckZfd0d8MWVahdeOyYJdAmhvU5He U9KASB/V7+LWH3jemu+2zx12kbP2FGgP13oArFdP75HfeDLmN5zQr6NIhJj3Cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736984563; a=rsa-sha256; cv=none; b=yHaPukb9fs9DJeQarV77ZH8HZb4Rn0f57s3PsWnccUCGb/Duj0t1xKvd+JuFC9bgWzcP5l zIYX+jK+ULaLnMhr3n+J5VlWIYPvQbewWkoW3xb/lza4xUuyyjJ2Li1KGye48si0R4Cex5 jfiTjAKpbDE3p/mkMb5sqKc/kqALlYIRAqUSa0LFHC+SsId8fyCpnWh6RTBhkFDzWw6f54 KQWce7w18f4UhzyaR+LIzyUNvCEIdy4bpurZ9D3UGDZOxSN3XcdxfPzIhbxT3k1NuU+BJo szL1rPalq8uj0b3VQU2QjuQmdutNwMyb1xvTjiNyf3cvW84z2fnwwHDTpJSxCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E6" (verified OK)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YYMxH1MGBzDmM; Wed, 15 Jan 2025 23:42:43 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id ED34FA64806; Wed, 15 Jan 2025 23:42:34 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 5BA0B2D029DD; Wed, 15 Jan 2025 23:42:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id tNhGCLRD-IhK; Wed, 15 Jan 2025 23:42:40 +0000 (UTC) Received: from strong-aiccu0.sbone.de (strong-aiccu0.sbone.de [IPv6:fde9:577b:c1a9:f491::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 155682D029D8; Wed, 15 Jan 2025 23:42:39 +0000 (UTC) Date: Wed, 15 Jan 2025 23:42:39 +0000 (UTC) From: "Bjoern A. Zeeb" To: Adrian Chadd cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 912a05670ed9 - main - net80211: add helper functions for VHT transmit In-Reply-To: <202501090059.5090xBuW075394@gitrepo.freebsd.org> Message-ID: <4n262snp-q102-67q2-7q11-7qp1qp7rnn25@SerrOFQ.bet> References: <202501090059.5090xBuW075394@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed On Thu, 9 Jan 2025, Adrian Chadd wrote: > The branch main has been updated by adrian: > > URL: https://cgit.FreeBSD.org/src/commit/?id=912a05670ed9545a1d1b010eedafb819e14eb1b8 > > commit 912a05670ed9545a1d1b010eedafb819e14eb1b8 > Author: Adrian Chadd > AuthorDate: 2024-12-16 02:29:33 +0000 > Commit: Adrian Chadd > CommitDate: 2025-01-09 00:51:51 +0000 > > net80211: add helper functions for VHT transmit > > * Add static helper functions for VHT TX for 20MHz, 40MHz and 80MHz. > * Add a public function to check if the given VHT width is available > for transmit. > > Differential Revision: https://reviews.freebsd.org/D48101 > --- > sys/net80211/ieee80211_vht.c | 137 +++++++++++++++++++++++++++++++++++++++++++ > sys/net80211/ieee80211_vht.h | 4 ++ > 2 files changed, 141 insertions(+) > > diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c > index a05beb91216f..82879f90c67b 100644 > --- a/sys/net80211/ieee80211_vht.c > +++ b/sys/net80211/ieee80211_vht.c > @@ -873,3 +873,140 @@ ieee80211_vht_get_vhtinfo_ie(struct ieee80211_node *ni, > +bool > +ieee80211_vht_check_tx_bw(const struct ieee80211_node *ni, > + enum ieee80211_sta_rx_bw bw) > +{ > + > + switch (bw) { > + case IEEE80211_STA_RX_BW_20: > + return (ieee80211_vht_check_tx_vht(ni)); > + case IEEE80211_STA_RX_BW_40: > + return (ieee80211_vht_check_tx_vht40(ni)); > + case IEEE80211_STA_RX_BW_80: > + return (ieee80211_vht_check_tx_vht80(ni)); > + case IEEE80211_STA_RX_BW_160: > + return (ieee80211_vht_check_tx_vht160(ni)); > + case IEEE80211_STA_RX_BW_320: > + return (false); > + default: > + return (false); > + } You should be able to remove the default case and that'll mean we'll get compiler errors if we add another BW fields in the future and don't handle it ("check this place and implement it" warnings for free). /bz -- Bjoern A. Zeeb r15:7 From nobody Wed Jan 15 23:59:58 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYNKS5ZQtz5krCn; Thu, 16 Jan 2025 00:00:12 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E6" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYNKR14Fjz3vRj; Thu, 16 Jan 2025 00:00:10 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=zabbadoz.net header.s=20240622 header.b=lxBM9gdv; spf=pass (mx1.freebsd.org: domain of bzeeb-lists@lists.zabbadoz.net designates 2003:a:140a:2200:6:594:fffe:19 as permitted sender) smtp.mailfrom=bzeeb-lists@lists.zabbadoz.net; dmarc=pass (policy=none) header.from=zabbadoz.net Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 5F97CA64805; Wed, 15 Jan 2025 23:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zabbadoz.net; s=20240622; t=1736985595; bh=W1cKtsnIo5ExKhTnaNvy7rzhzx+menk84GGMk967h0E=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=lxBM9gdvWMctWf52QWbAOlnsim+jxIplqBtIkb3jjPLtg30RS9zu83funKWDdd3sl XdlqsD76gNDsJgywHUCc92nOQl2cVCpGXf0Zl196KSrVPnCsl1iHAikzsT7rZYWvrq BqxaGQAMP1OscUNTubPkBrfJFvJa8IjGw8FBPetnh9VdjCZY9camPH9c4Vs7Ra/w0L ogUTPxk8lHD72gJ8o/W0vBBJHCw5Q8bCb8xCG2FUm+9Zr4JVQVnjCtoFBoX0183ZAS d0d1Pi3D5X7xhAELzTtbVeOV3wfb+GYv0ce5rUFL8hpGnLak3uWNPxIMfkYnK5sGDO 5emvoSDt6KZ4USXWot7TuKNJ04KEiHUOcfyUb6ae849QmT34OdO1O/vhyG6H3LJOjk 3Oz2NE0siQkwDhHK8a1BTAOJxtkO20VEDTLFdiPfBnvG73T2rV+uiTqBvNXgICxAN1 bawcg4gpGRgAJnws2mpS8dxnfPiWKiI5EBAYE+Ke2lBiRWb7RvP8g4vjMnLQVs/Ce/ gwNNWZUAZNHk6ojxYiMEy8mlxw2GJGkqJKK0pH2O0/AlSMpOO+F/DXazatTXNnq3Ax 3xA86rTdx59osAGZiY/iE3POkFzn0faLlFGPpQPKHSPEzhy1VUx2oAow5dvH3o3I0O hd066OZqGBmP19tTWzje9Uiw= Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id BB4BD2D029DD; Thu, 16 Jan 2025 00:00:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id EJxPww25q2Iy; Thu, 16 Jan 2025 00:00:00 +0000 (UTC) Received: from strong-aiccu0.sbone.de (strong-aiccu0.sbone.de [IPv6:fde9:577b:c1a9:f491::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 399A52D029D8; Thu, 16 Jan 2025 00:00:00 +0000 (UTC) Date: Wed, 15 Jan 2025 23:59:58 +0000 (UTC) From: "Bjoern A. Zeeb" To: Konstantin Belousov cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: b0e020764aae - main - ipsec + ktls: cannot coexists In-Reply-To: <202501131930.50DJUCFg047113@gitrepo.freebsd.org> Message-ID: <71p14p04-5o5o-1385-1551-7733rr1qo57o@yvfgf.mnoonqbm.arg> References: <202501131930.50DJUCFg047113@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[zabbadoz.net,none]; R_DKIM_ALLOW(-0.20)[zabbadoz.net:s=20240622]; R_SPF_ALLOW(-0.20)[+ip6:2003:a:140a:2200:6:594:fffe:19]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; ASN(0.00)[asn:3320, ipnet:2003::/19, country:DE]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MLMMJ_DEST(0.00)[dev-commits-src-all@FreeBSD.org,dev-commits-src-main@FreeBSD.org]; DKIM_TRACE(0.00)[zabbadoz.net:+] X-Spamd-Bar: --- X-Rspamd-Queue-Id: 4YYNKR14Fjz3vRj On Mon, 13 Jan 2025, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b0e020764aae970545357b0f146dcba7b4b55864 > > commit b0e020764aae970545357b0f146dcba7b4b55864 > Author: Konstantin Belousov > AuthorDate: 2024-12-28 08:30:49 +0000 > Commit: Konstantin Belousov > CommitDate: 2025-01-13 19:29:31 +0000 > > ipsec + ktls: cannot coexists Ignore my ignorance but that description sounds bad. Do you mean on a per-packet base or in general on a machine, i.e., (1) an individual packet cannot be processed by ktls and ipsec (2) a host can either run ktls or ipsec but not both? Either sounds like (half) a bug to me that should be fixed by the way but I am so out of the ipsec stack that I don't know current implications. What is the reason a packet could not first be KTLS handled and then put into IPsec (for some part of its journey)? /bz > but instead of tripping the assert in debug kernel, and silently falling > into UB for prod, skip IPSEC processing for KTLS framed packets when > mb_unmapped_to_ext() failed. > > Reviewed by: markj > Sponsored by: NVidia networking > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D48265 > --- > sys/netinet/ip_output.c | 33 +++++++++++++++++++++++++-------- > sys/netinet6/ip6_output.c | 34 ++++++++++++++++++++++++++-------- > 2 files changed, 51 insertions(+), 16 deletions(-) -- Bjoern A. Zeeb r15:7 From nobody Thu Jan 16 00:10:53 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYNZ31YZfz5krpJ; Thu, 16 Jan 2025 00:11:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYNZ22ZGrz3wCB; Thu, 16 Jan 2025 00:11:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 50G0ArvM049456; Thu, 16 Jan 2025 02:10:56 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 50G0ArvM049456 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 50G0Arci049454; Thu, 16 Jan 2025 02:10:53 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 16 Jan 2025 02:10:53 +0200 From: Konstantin Belousov To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b0e020764aae - main - ipsec + ktls: cannot coexists Message-ID: References: <202501131930.50DJUCFg047113@gitrepo.freebsd.org> <71p14p04-5o5o-1385-1551-7733rr1qo57o@yvfgf.mnoonqbm.arg> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71p14p04-5o5o-1385-1551-7733rr1qo57o@yvfgf.mnoonqbm.arg> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4YYNZ22ZGrz3wCB X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Wed, Jan 15, 2025 at 11:59:58PM +0000, Bjoern A. Zeeb wrote: > On Mon, 13 Jan 2025, Konstantin Belousov wrote: > > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=b0e020764aae970545357b0f146dcba7b4b55864 > > > > commit b0e020764aae970545357b0f146dcba7b4b55864 > > Author: Konstantin Belousov > > AuthorDate: 2024-12-28 08:30:49 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2025-01-13 19:29:31 +0000 > > > > ipsec + ktls: cannot coexists > > Ignore my ignorance but that description sounds bad. > > Do you mean on a per-packet base or in general on a machine, i.e., > (1) an individual packet cannot be processed by ktls and ipsec > (2) a host can either run ktls or ipsec but not both? After this change, we are at the #1. Before, we were at #2. This change maps mbuf chains that are to be processed by sw IPSEC. So the change makes KTLS and IPSEC compatible. Mark said that there are plans to make sw IPSEC to fully handle unmapped packets. > > Either sounds like (half) a bug to me that should be fixed by the way > but I am so out of the ipsec stack that I don't know current implications. > > What is the reason a packet could not first be KTLS handled and then put > into IPsec (for some part of its journey)? Talking about software implementations, KTLS mbufs are unmapped, and IPSEC was not prepared to handle that, so we remap them. For inline offload on network cards (talking about mlx5), current offload engines can do only one crypto op on packet as it is processed. In other words, either KTLS, or IPSEC inline can be done, not both. From nobody Thu Jan 16 00:33:02 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYP3R3pT3z5ksmN; Thu, 16 Jan 2025 00:33:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx-01.divo.sbone.de (mx-01.divo.sbone.de [IPv6:2003:a:140a:2200:6:594:fffe:19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (prime256v1) client-digest SHA256) (Client CN "mx-01.divo.sbone.de", Issuer "E6" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYP3R2nlzz3xvs; Thu, 16 Jan 2025 00:33:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Authentication-Results: mx1.freebsd.org; none Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mx-01.divo.sbone.de (Postfix) with ESMTPS id 30584A64805; Thu, 16 Jan 2025 00:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zabbadoz.net; s=20240622; t=1736987579; bh=GilStMJw9r+JXdaZzdDnDQzRdK/J4cnJC/k3Jd6tyeQ=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=jC0NpDAuQzTAV0xRdcWQ2hqYMVHSG8NeoUbzmTPzpagVlnscPpOyx3aNu0oE3g9uj H8YoVd2TQc9x8jdBQZWikD22iy3NwMpX7GNVQ0NiPf7qGRx+rXJSJdsGoIsOPNs6rF 54BaQ/SfUI4fiI1tb7NYxPYs3DqGUhedXNU5Pr3k/eF3bSNGj0XtBdTuWgZrOUnFpA 9emA++t3MX1fDrucYgCvOSYz8fpPu/rzDXRXcH8fF9HN/rwm2+wKhQ34nrUHgGKU9Q Mrv/lp4ntwzftvuQNpcJ2fXAl8GyzrKWH2aAEB9ptrrwP3QSLPIOc0WqjjTEU088cG I45ftprQK/eU/o71a6LKsjRsKRGQq7dvXLRYW63xFzLe+NAxdgNGJ58n7DTOd3Z7yD gYCbcqjZPMKpG7GpDakoxynPxTRWjB/re53OZHoougEJUbGTuXz+RWIfmq4nKZHfaY 2TZQC8Kc4WUHZSvNXeC84yAcD/S5SPEu1MSx5ebk9KpaAdurVAl8GZKuCpR3aFIV+l ibSA1Dg+t5DW+Q2COHsg1uzPVZj2LEV17VjArEtLgIGCRoPDRqsBAXrqFmnAPpvlyO GQOSFuzNdOtYjHi2lg/9Gtift92g/8W+mKGcod0IN1Q8/EBiaEl/lrAZN+T0TGqjGC 8573EdC6jfK4HS5SvyCJXNMk= Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 81E1D2D029DD; Thu, 16 Jan 2025 00:33:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id VP6XVe2mJNC6; Thu, 16 Jan 2025 00:33:04 +0000 (UTC) Received: from strong-aiccu0.sbone.de (strong-aiccu0.sbone.de [IPv6:fde9:577b:c1a9:f491::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 1229D2D029D8; Thu, 16 Jan 2025 00:33:03 +0000 (UTC) Date: Thu, 16 Jan 2025 00:33:02 +0000 (UTC) From: "Bjoern A. Zeeb" To: Konstantin Belousov cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b0e020764aae - main - ipsec + ktls: cannot coexists In-Reply-To: Message-ID: <3462o4sq-1833-o2r1-5q7p-58502pp2r8s5@yvfgf.mnoonqbm.arg> References: <202501131930.50DJUCFg047113@gitrepo.freebsd.org> <71p14p04-5o5o-1385-1551-7733rr1qo57o@yvfgf.mnoonqbm.arg> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4YYP3R2nlzz3xvs X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:3320, ipnet:2003::/19, country:DE] On Thu, 16 Jan 2025, Konstantin Belousov wrote: > On Wed, Jan 15, 2025 at 11:59:58PM +0000, Bjoern A. Zeeb wrote: >> On Mon, 13 Jan 2025, Konstantin Belousov wrote: >> >>> The branch main has been updated by kib: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=b0e020764aae970545357b0f146dcba7b4b55864 >>> >>> commit b0e020764aae970545357b0f146dcba7b4b55864 >>> Author: Konstantin Belousov >>> AuthorDate: 2024-12-28 08:30:49 +0000 >>> Commit: Konstantin Belousov >>> CommitDate: 2025-01-13 19:29:31 +0000 >>> >>> ipsec + ktls: cannot coexists >> >> Ignore my ignorance but that description sounds bad. >> >> Do you mean on a per-packet base or in general on a machine, i.e., >> (1) an individual packet cannot be processed by ktls and ipsec >> (2) a host can either run ktls or ipsec but not both? > > After this change, we are at the #1. > Before, we were at #2. > > This change maps mbuf chains that are to be processed by sw IPSEC. So > the change makes KTLS and IPSEC compatible. > > Mark said that there are plans to make sw IPSEC to fully handle unmapped > packets. > >> >> Either sounds like (half) a bug to me that should be fixed by the way >> but I am so out of the ipsec stack that I don't know current implications. >> >> What is the reason a packet could not first be KTLS handled and then put >> into IPsec (for some part of its journey)? > > Talking about software implementations, KTLS mbufs are unmapped, and IPSEC > was not prepared to handle that, so we remap them. > > For inline offload on network cards (talking about mlx5), current offload > engines can do only one crypto op on packet as it is processed. In other > words, either KTLS, or IPSEC inline can be done, not both. I see. Thanks a lot for the work and explanations. Goinng from #2 -> #1 seems very good indeed. Lots of joy, /bz -- Bjoern A. Zeeb r15:7 From nobody Thu Jan 16 01:23:01 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYQ922KTnz5kxDR; Thu, 16 Jan 2025 01:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYQ9217Gsz44Cy; Thu, 16 Jan 2025 01:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736990582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZGrVwwSIjyxz0ew/ouVRo10iOOYLrKZXPVD5dxVKOZ4=; b=b6p+dkFO0HXDzUd5vsTURi/swnnNwAfOZS7tUVJqglKapl5AeedHCkR40KPBnSaJEVSNjt tJb8n0OybUTfzla4vjyZORNLltyg17gdC8HKTw/MKbQgPbb7I89DZ7IGZnqRpXgdkMcwQY bqB96YZRPWJycdAkbV2KCxXm89lT32yxXj4b+xOM8R17FUtq1KwT2lF16JWyy+OiZLnZKq /gY8vwIVdw4h+ZF3ZArsFWahuPv6aPCW2UIP3tsMDFZ+J1YMvZpWytPjpoxCF/wbOkBSZd gMz74Dk0B4HsDA5Psd8VAI/Cj67agxwiDa6DF2ls32r75g1QEVg3L+InHLNCqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736990582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZGrVwwSIjyxz0ew/ouVRo10iOOYLrKZXPVD5dxVKOZ4=; b=c6Bod8kJYrURLOgUM7nfEG4QOxyPMn8fJhx5iC0FswnyoX+bgeOCl1tOAFlzyBKrwGXS4N rnJR9NQWrq+D+41vyp/Fv35e3Vp9T+F3QccEk1QZu23JpccbDqriLp4nP4RS53FRCFK/+Y I6dMlMtMfLHYMY1wDma9kA5OIBhVHewD5uubMQLq3GWmJ998ZZ9gKBI41jATX2bSQg0Yt7 NJTuKr8HYyFzRmME1QboUdEbQZyiNYkfx1E7PrPTVm26M1FIZv4Y46J/Jdq5DgejPxymUo fJaEn1MtKeOvSU9ZBKDOWPxB4Qfo0PRm8DWCbnqtcfCgYZJgalW+aR2dDuQB2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736990582; a=rsa-sha256; cv=none; b=hOgYnPO+IHOHoMgJnetUcQH66WjsGkJjSb/jqZjLaQ/kJEYeZYKJM1cYKIpdSMm9LQQSKD rCJPcvxWYEd9Sp1eWsn8aNiDNI+DXWCIEdRMWf0O8/oil+r5CDrLUnUkPIu8H3GKtX93xM XCmCjEphwM1ctAaM2IvCHsxZvFh3yrtcvxbMZEIICX2EyO3FVsbGTZvmLwwBwC0ifBKyrN Z8pt8307JMeugKt4FwsC5UCfGEj7/fIPszPCP3lD47in8l77r8KB42bppiH2M83jMfH5cd 6/McJRZqef4kBbtpuYOn8uQpHbkusx5+fBQtdSuJi8P/5wb+5Lop/Ireauxw0A== 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 4YYQ9204YZz19X8; Thu, 16 Jan 2025 01:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50G1N1Or012159; Thu, 16 Jan 2025 01:23:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50G1N11A012156; Thu, 16 Jan 2025 01:23:01 GMT (envelope-from git) Date: Thu, 16 Jan 2025 01:23:01 GMT Message-Id: <202501160123.50G1N11A012156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: 521c1fe0e200 - main - libc/aarch64: fix strlen() when flush-to-zero is set List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 521c1fe0e2002dfd7d8db86eb7144b7865229912 Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=521c1fe0e2002dfd7d8db86eb7144b7865229912 commit 521c1fe0e2002dfd7d8db86eb7144b7865229912 Author: Robert Clausecker AuthorDate: 2025-01-13 13:41:41 +0000 Commit: Robert Clausecker CommitDate: 2025-01-16 01:20:30 +0000 libc/aarch64: fix strlen() when flush-to-zero is set Our SIMD-enhanced strlen() implementation for AArch64 uses a floating-point comparison to compare a bit mask to zero. This works fine under normal circumstances, but fails if the FZ (flush-to-zero) flag is set in FPCR (the floating-point control register) as then the CPU no longer distinguishes denormals from zero. This was not caught during testing; this flag is rarely set and programs that do so rarely perform string manipulation. Avoid this problem by using an integer comparison instead. The performance impact seems to be small (about 0.5 %) on the Windows 2023 Dev Kit, but seems to be more significant (up to around 19%) on the RPi 5. Reviewed by: getz Fixes: 3863fec1ce2dc6033f094a085118605ea89db9e2 Differential Revision: https://reviews.freebsd.org/D48442 --- lib/libc/aarch64/string/strlen.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libc/aarch64/string/strlen.S b/lib/libc/aarch64/string/strlen.S index 7bfac7f4b1e1..6fefc252eca1 100644 --- a/lib/libc/aarch64/string/strlen.S +++ b/lib/libc/aarch64/string/strlen.S @@ -33,9 +33,8 @@ ENTRY(__strlen) ldr q0, [x10, #16]! cmeq v0.16b, v0.16b, #0 shrn v0.8b, v0.8h, #4 // reduce to fit mask in GPR - fcmp d0, #0.0 - b.eq .Lloop fmov x1, d0 + cbz x1, .Lloop .Ldone: sub x0, x10, x0 rbit x1, x1 // reverse bits as NEON has no ctz From nobody Thu Jan 16 07:30:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYZJq3shWz5lJty; Thu, 16 Jan 2025 07:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYZJq2jnDz3bH8; Thu, 16 Jan 2025 07:30:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737012619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=94vCJ1BQKu4v0FzkWb9XNaf1vOSjM6KVFWokynYbBeQ=; b=Z6LNYtGwIf+fv1jNVDlFhm2MeSGCAU6u2pCShGq5rtuwlRCCoBQilTTTzdDkKlzRo8UX0Z gFjlEt9ZWF9Kn4ssVGOOZ2ZKv60P+RO5LKLf9NsqENmu3lTNuZdV+Aq44Rd7nZMYLP5zA8 yKGWfGR3SuguRbRaNi1t23KPGoHG+dOPQZKVx/Tm0x1IwhndFIk4yQ05KztJVFJ8XdhIU5 ig8DbxM/nJe05k85+ClGBJOyNVNs8kNmkcvh3Z+yTx7Ep0SYeYVo9sQvZ2QbQAcBeecnGJ V5HYDOKR34L7NTFljvee/ghM+Ap4dGsMg9E2ywF/YQRbpoomWT5nU2wlwmUJmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737012619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=94vCJ1BQKu4v0FzkWb9XNaf1vOSjM6KVFWokynYbBeQ=; b=jFw+6H9HECH2sa8b5cLjq0a7r3ybgsmRmmX1GmTO9WMq92bF5du7WUU1yF4kbg7pt9Zq6s 9HPd/f+yLmyjcPUSjF3OO7GXbZ/7mfGix4mLDJJSc3auy2rTkopDBOswOvXtWcwGJ6y1R8 2heRWehI0Ri8c1es12GtW6RDZMWU023Kcg0zKiUtuv0OUL1gLozlBQQ19hVDkC/kiZudYc 0j2EVz7/rg3ZQzmNgzSyJhG6D68Qe/TTWot4NwIv3aUhsReVgGzVvE9aVjJB1kNSrskJm2 5WMvzOGkPWqh3p5aSVIqQchYlTrBx3f9vhFhrEPGBral6MkvFsEUf6m+lIPOMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737012619; a=rsa-sha256; cv=none; b=y3ViNAqoSiLIxCyyFphaftpXVpS6LTjTD04NRgkxUQ6COY2SaYHJelXO/gy/iAKxw5XQZr 5ImcvEQVPbSFPeKaTp5XhfDzkF7WO2ud3YzVxSoOLKvqvyO+j4J1CTZl3QmZMZwj4kR8q5 P9GR1YSoZzBmxrSwRIlCQ9pDwYNynZNUK+3E5FBDPQnbwVAhw9K79U1hEfiaQkF0SWc76d JcUjSyELTRG4f3H5BDJxShDFewPOTNR/S5LmwJeKKg9YkGfpfvFlSQO98svSNGXtCwyqtW +pyCweDJUaHPDOyvhZmBQ1rbC9Tm+jblMVio3oBJ8Eca4urFB0rlryXopDoEfw== 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 4YYZJq22Psz7FQ; Thu, 16 Jan 2025 07:30: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 50G7UJMj098584; Thu, 16 Jan 2025 07:30:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50G7UJcq098581; Thu, 16 Jan 2025 07:30:19 GMT (envelope-from git) Date: Thu, 16 Jan 2025 07:30:19 GMT Message-Id: <202501160730.50G7UJcq098581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: c1f6b799a764 - main - powerd: use snl_get_genl_mcast_group() API List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c1f6b799a7647a738f2e0dfa688c54ada83abc59 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c1f6b799a7647a738f2e0dfa688c54ada83abc59 commit c1f6b799a7647a738f2e0dfa688c54ada83abc59 Author: Gleb Smirnoff AuthorDate: 2025-01-16 03:33:16 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-16 07:20:57 +0000 powerd: use snl_get_genl_mcast_group() API --- usr.sbin/powerd/powerd.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/usr.sbin/powerd/powerd.c b/usr.sbin/powerd/powerd.c index 7be24e0c01ad..7eab9a630411 100644 --- a/usr.sbin/powerd/powerd.c +++ b/usr.sbin/powerd/powerd.c @@ -464,31 +464,23 @@ acline_read(int rfds) bool netlink_init(void) { - struct _getfamily_attrs attrs; + uint32_t group; if (modfind("nlsysevent") < 0) kldload("nlsysevent"); if (modfind("nlsysevent") < 0) return (false); - if (!snl_init(&ss, NETLINK_GENERIC)) + if (!snl_init(&ss, NETLINK_GENERIC) || (group = + snl_get_genl_mcast_group(&ss, "nlsysevent", "ACPI", NULL)) == 0) { + warnx("Cannot find \"nlsysevent\" family \"ACPI\" group"); return (false); + } - if (!snl_get_genl_family_info(&ss, "nlsysevent", &attrs)) + if (setsockopt(ss.fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &group, + sizeof(group)) == -1) { + warnx("Cannot subscribe to \"ACPI\""); return (false); - - for (unsigned int i = 0; i < attrs.mcast_groups.num_groups; i++) { - if (strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name, - "ACPI") == 0) { - if (setsockopt(ss.fd, SOL_NETLINK, - NETLINK_ADD_MEMBERSHIP, - &attrs.mcast_groups.groups[i]->mcast_grp_id, - sizeof(attrs.mcast_groups.groups[i]->mcast_grp_id)) - == -1) { - warnx("Cannot subscribe to \"ACPI\""); - return (false); - } - } } return (true); } From nobody Thu Jan 16 07:30:20 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYZJr47Fdz5lJv0; Thu, 16 Jan 2025 07:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYZJr3VN5z3bmx; Thu, 16 Jan 2025 07:30:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737012620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qlK1G+6F1FNsv3RzKWSmKvSYKzyU6UFwmuSu+Wgoexc=; b=tCfYKDc1JRW436dWNVZ8KPlw2GnIN4jiZ31p9tzYNHuGG6HYO1/MNOFs9THQWDFxxJH9LT GIAFe5B7t3gEs3FhucaXh4SDXAAkIZPd9pfFK14fEFfRtB4Y2ZqwGshMS+GyxIAMgoDsvk baGQ4en2eOq8iCV+iHLgNdakdfl4xqe0ndc10h/rSbzHIVjnqzxDfaCXWkZcdCvU5wocuQ dckL17gLWvpAkGjWf0bolzok+5hx6dA7Fi/rxNk3hjUNzCb+NkXHz3dBsTGrJ+bkJhe15s UPdBYKkdgTkFiFvAKc9rcnZS7y1seghrI3kVaMu37TAy+zk3CKXAYX+7Crauyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737012620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qlK1G+6F1FNsv3RzKWSmKvSYKzyU6UFwmuSu+Wgoexc=; b=J2w9je+ZaOHR2p0+M1RDqUpzX/oMWNLam/x+rGyG/+18/lHqQXhjKIXN+yiHIEIIajOhLb AUFJPbK2d+ECZ1CNnlPCdsnDHWeDm2kpIQIuPkH9xAb6UBGZRjsuA4VhW9LSKybZI9ZSG5 vtGm9aJ1lqEzJxFZtBKrPe/rtYE+v6h5+3W8GDVH/BjOlhBRi6eqHMJDCG1ShkjygohiMW PPAGIH6WPwEwnpJh3R/wJaNS80PTGkJN+YFD99FuzDP0NMU2XfWQBIjDIt0eDan3Osmns6 fzHbHlPVJQSOtqhEDgVu+p6HGVtQbMBxa1qDMlj2RzkpO40sNWIaK4Y3nI6o+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737012620; a=rsa-sha256; cv=none; b=WKLdBR7MIyR9lcsWRrS2zLwdlZIFPKyMeNpij6amsGC0sJ6yC7Yqy+hria4xrujqFhhtsU /XxhcafnFBzbPhhXd8mfS8ekJhoZojThcUxKhNLFjZYBVIPuMVZvYVZA2qw9Zp7TkRAcSe oiViSnyKqspZjz4zzmDP+mXsRsTTdeJW6SuitwNxtKfYwn8veABJ3v7VZtWabMkgNLAPeI vNaBu6q+15KCWHaKcyO5JBsEubk9khwqvsxr1/4JKrzrp5VU9mM1nNQOB/Pad9eayyruTP VapjKp/GFCgJRcJogPYHg7WHgYV/1k1G5QrZEIvMYzbSLPmlDc0qpJZKKLqiRQ== 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 4YYZJr30fNz70Q; Thu, 16 Jan 2025 07:30:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50G7UKcG098632; Thu, 16 Jan 2025 07:30:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50G7UKLI098629; Thu, 16 Jan 2025 07:30:20 GMT (envelope-from git) Date: Thu, 16 Jan 2025 07:30:20 GMT Message-Id: <202501160730.50G7UKLI098629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: c3df2fa9a755 - main - netlink: snl_create_msg_request() may fail due to ENOMEM List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3df2fa9a7554e00f34f1cbcf8be6c8ccf9ccd8a Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c3df2fa9a7554e00f34f1cbcf8be6c8ccf9ccd8a commit c3df2fa9a7554e00f34f1cbcf8be6c8ccf9ccd8a Author: Gleb Smirnoff AuthorDate: 2025-01-16 02:50:29 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-16 07:21:58 +0000 netlink: snl_create_msg_request() may fail due to ENOMEM --- sys/netlink/netlink_snl.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 2861ea93bafb..d10852ac7a36 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -1261,9 +1261,13 @@ snl_end_attr_nested(const struct snl_writer *nw, int off) static inline struct nlmsghdr * snl_create_msg_request(struct snl_writer *nw, int nlmsg_type) { + struct nlmsghdr *hdr; + assert(nw->hdr == NULL); - struct nlmsghdr *hdr = snl_reserve_msg_object(nw, struct nlmsghdr); + if (__predict_false((hdr = + snl_reserve_msg_object(nw, struct nlmsghdr)) == NULL)) + return (NULL); hdr->nlmsg_type = nlmsg_type; hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; nw->hdr = hdr; From nobody Thu Jan 16 07:30:21 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYZJt6Cn5z5lKKF; Thu, 16 Jan 2025 07:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYZJs746wz3bWZ; Thu, 16 Jan 2025 07:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737012622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QdAIIN0sQMdMSIKeHV5PZO2I+tynOlgjFVk5QMHJIKU=; b=dIGMIa6AadAKXmd7SNN5O6GcRVp3q8jXUhtUSo0rnaMhdBIu97l2oIBhcoF6ay2GH9AGhQ hG3t69j5sriGoiHFeUFfwsQ2B8lXjx1RuKXs/u4kTAOXZuWddpDN0vurxFhbMZVzANCtj/ DRpcfjSbgnUwf0EKAtxlGSj9ZsKDhPhOl8osHDSoosXr0HDOwSWxVfSkonqk6LjiXlIDEr juXxtr18VUbcX3B7JuK0dAfG2UPmIXkNnqTfoLOqwPlgX5co0RPaNV4Vob95WyknbcNyVu JdcXlnIF74PAF1NDlnLAcIRJTDiz4oqA1QtN7g/5NVy0UMZL7v/ELcPUzJAL6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737012622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QdAIIN0sQMdMSIKeHV5PZO2I+tynOlgjFVk5QMHJIKU=; b=gylkdBhQF/vLWT4T97znJGcBOhUjFEETegbHCtnhJ5+uJcWX8HAjWxyMnz8EkrlWcL62ZG 2U3lsy4ENDjwFVls6hdgmO4MKGimtSZ+VcNs2r/kj7pRpxT0sHYQtYud+MtxP6z7BluYnf 1n7XC3bbQmKCGa5JaWmEfuvTja32HiSRtOK8GEmC1SoFYVKdQr/HpOXKdC6utiNpA2ZTCd P2iSzEiR/g4iYIUnkVanjt7FifF2inBUCKFNHdjB7qvriEH7u9rGKqw5CiZjqVX1+Mmb3Z vZdI3GD0vB8rTkcfhUg0a7kwQRxTNkYaDSlrM16e7GzfhcTeHHinzDM4FPLyYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737012622; a=rsa-sha256; cv=none; b=rAzJ+iwD878oQAhisjYCmIDyYdd75Rk2V8B8SHe24yHqA7ZZ6ccYKLVY4+VHWV3lpBvGz8 M7YZls7a+IZgcrwgWrZL9oJs5tDGwf2rpKnZJ+ItnMzEM6YMQVzVoiJpfGd4V7s5RuTagK aHAemqs+FhpdR5daO2Q5iIkR/JhfoH/MhriCecAvRxQ62LB0yCiE2T6zj+meGNWNHyo2NC VDnWrXp19cW0VlaLXtdiNEpdmOFZZsXG/J1+TdyJJ5upbFpIJFyudo24ZD6gWHeFiZVEWU tKCOhfhxoD1RvWmbUV7ev4W1Ni7X0EpVoOQfQ8GlRGT4i43+Xm6Giji72PDBIg== 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 4YYZJs3Tz9z6nn; Thu, 16 Jan 2025 07:30:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50G7ULiR098677; Thu, 16 Jan 2025 07:30:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50G7UL6D098674; Thu, 16 Jan 2025 07:30:21 GMT (envelope-from git) Date: Thu, 16 Jan 2025 07:30:21 GMT Message-Id: <202501160730.50G7UL6D098674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 90b1df4f4df9 - main - netlink: small cleanup of generic snl(3) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90b1df4f4df937bca4b18563e6e15288de7484ac Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=90b1df4f4df937bca4b18563e6e15288de7484ac commit 90b1df4f4df937bca4b18563e6e15288de7484ac Author: Gleb Smirnoff AuthorDate: 2025-01-16 01:01:53 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-16 07:22:19 +0000 netlink: small cleanup of generic snl(3) - Add const qualifiers for the family/group name pointers. - Break & tab long lines. No functional changes. --- sys/netlink/netlink_snl_generic.h | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/sys/netlink/netlink_snl_generic.h b/sys/netlink/netlink_snl_generic.h index e2dc4d1bfffe..bdbefb914259 100644 --- a/sys/netlink/netlink_snl_generic.h +++ b/sys/netlink/netlink_snl_generic.h @@ -62,7 +62,7 @@ static struct snl_field_parser snl_fp_genl[] = {}; struct snl_genl_ctrl_mcast_group { uint32_t mcast_grp_id; - char *mcast_grp_name; + const char *mcast_grp_name; }; struct snl_genl_ctrl_mcast_groups { @@ -72,25 +72,40 @@ struct snl_genl_ctrl_mcast_groups { #define _OUT(_field) offsetof(struct snl_genl_ctrl_mcast_group, _field) static struct snl_attr_parser _nla_p_getmc[] = { - { .type = CTRL_ATTR_MCAST_GRP_NAME, .off = _OUT(mcast_grp_name), .cb = snl_attr_get_string }, - { .type = CTRL_ATTR_MCAST_GRP_ID, .off = _OUT(mcast_grp_id), .cb = snl_attr_get_uint32 }, + { + .type = CTRL_ATTR_MCAST_GRP_NAME, + .off = _OUT(mcast_grp_name), + .cb = snl_attr_get_string, + }, + { + .type = CTRL_ATTR_MCAST_GRP_ID, + .off = _OUT(mcast_grp_id), + .cb = snl_attr_get_uint32, + }, }; #undef _OUT SNL_DECLARE_ATTR_PARSER_EXT(_genl_ctrl_mc_parser, - sizeof(struct snl_genl_ctrl_mcast_group), - _nla_p_getmc, NULL); + sizeof(struct snl_genl_ctrl_mcast_group), _nla_p_getmc, NULL); struct _getfamily_attrs { uint16_t family_id; - char *family_name; + const char *family_name; struct snl_genl_ctrl_mcast_groups mcast_groups; }; #define _IN(_field) offsetof(struct genlmsghdr, _field) #define _OUT(_field) offsetof(struct _getfamily_attrs, _field) static struct snl_attr_parser _nla_p_getfam[] = { - { .type = CTRL_ATTR_FAMILY_ID , .off = _OUT(family_id), .cb = snl_attr_get_uint16 }, - { .type = CTRL_ATTR_FAMILY_NAME, .off = _OUT(family_name), .cb = snl_attr_get_string }, + { + .type = CTRL_ATTR_FAMILY_ID, + .off = _OUT(family_id), + .cb = snl_attr_get_uint16, + }, + { + .type = CTRL_ATTR_FAMILY_NAME, + .off = _OUT(family_name), + .cb = snl_attr_get_string, + }, { .type = CTRL_ATTR_MCAST_GROUPS, .off = _OUT(mcast_groups), From nobody Thu Jan 16 09:10:42 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYcXf4T0Lz5lQ5p; Thu, 16 Jan 2025 09:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYcXf3ymLz3lkZ; Thu, 16 Jan 2025 09:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737018642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=52qcB619kl6vPmn+EjZX/79qX8q52TwjeSzWV4SkEHY=; b=WAtUtdezcijW6koVYtaYhsoZsKBCCgRBY9wSOLrpFjvbsHVbzP2n7Jm6iP7fs7a3kURXLE NV+/qAcgajrTRfcaBSI7511k4nDo+EcMjdj20DMDtE6OaOV8xBdcOzVl3xxCbZNjZbUnNM U/EO3T0r+dWW85Q53jzT6c16FDY7PebencPS4zjOw1jGRbIO+YWdYHa0G/Tt00psyeFVMy yGsAVj5dV/dJqtjNyzw8lr2rSLfR/hl/11EF1kIMURgLv+tw+JbZauOPFO45Y49LbrI7eq pbH/rEKOMzyNm4K4+4foI1BfYXIAw8LkzQeFlTur12wCCzmYWYMGnQpKNDgFPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737018642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=52qcB619kl6vPmn+EjZX/79qX8q52TwjeSzWV4SkEHY=; b=Y9/N5U8hOQ5rLZojSrnCzUFeLMIUjnREk9wYnE4MxshacmzpNzwB+u+zMXsfiHb8lK0yp5 6LsXim2oon1nFQYC5RmYIVXxzTSzAlM7MsUhE5tRPH7AXTgnISdpNvoWg26e16CfJ02s51 X3jEm5Bp8MaAWEVxBQZHuQdhGon8MC3GMlTGB2C/+sErUJTERGb/X8NCsGIAnqm82IAGng 1p5/UPLMHY3nWrLUSDchGYJHzvEFfHrVpjS6vaa8Fan3DNBnyHF0WN2/Q/aPtEo+C3V94u 6NcgKTyq1MpiEyWrLkYoFCZyXElCH514Sn8tIphJvLXcyqvmDfznEowisYgsvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737018642; a=rsa-sha256; cv=none; b=ZvgIUMa6ZJy8MeQ7M+N5r8KCkGeNjQB7v7n7PYRnlHSdAEAgxqygK9tE7OXlbXqCTem22g PqhIgrUDrS2GBIxI7VAy7J4JB5jccTO7nxt6TOKWOTN1Z/m0MOiN/Ve0N92OQ1sR2j1fKr XAYASr1TKZcYSQBSqq+oC/O1U90EwmZEyaleEepdPyzrmuTehC4f8tCRilTPlYMk7Ar1kx 7//kZ09FnditnyHbhzTc0iZQdZSa1azN+RWe+uuzzkgu6XU88bXFlN0b1aTGqAMDRkjBl9 5EekG3NmNrP/+LQMQ9z6+HXSrZZFssL6+V1EuTkNwGy9VCiLajsR3aongOTOxw== 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 4YYcXf3YrSz9KZ; Thu, 16 Jan 2025 09:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50G9AgiB086944; Thu, 16 Jan 2025 09:10:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50G9Ag93086941; Thu, 16 Jan 2025 09:10:42 GMT (envelope-from git) Date: Thu, 16 Jan 2025 09:10:42 GMT Message-Id: <202501160910.50G9Ag93086941@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7c882c69a4f0 - main - libpfctl: use snl_f_p_empty instead of declaring own empty array List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c882c69a4f077efc2602da303c192363fe478d0 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7c882c69a4f077efc2602da303c192363fe478d0 commit 7c882c69a4f077efc2602da303c192363fe478d0 Author: Kristof Provost AuthorDate: 2025-01-15 11:03:37 +0000 Commit: Kristof Provost CommitDate: 2025-01-16 09:05:09 +0000 libpfctl: use snl_f_p_empty instead of declaring own empty array Just as we did in the kernel in e9255dafa1ef0c635385aee78ead3a0050b19cca Suggested by: glebius Reviewed by: glebius, melifaro Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D48460 --- lib/libpfctl/libpfctl.c | 48 +++++++++++++++-------------------------------- sys/netlink/netlink_snl.h | 1 + 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index b374ef05e4d7..f0708c8f0439 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -392,8 +392,7 @@ static const struct snl_attr_parser ap_getstatus[] = { { .type = PF_GS_BCOUNTERS, .off = _OUT(bcounters), .arg_u32 = 2 * 2, .cb = snl_attr_get_uint64_array }, { .type = PF_GS_PCOUNTERS, .off = _OUT(pcounters), .arg_u32 = 2 * 2 * 2, .cb = snl_attr_get_uint64_array }, }; -static struct snl_field_parser fp_getstatus[] = {}; -SNL_DECLARE_PARSER(getstatus_parser, struct genlmsghdr, fp_getstatus, ap_getstatus); +SNL_DECLARE_PARSER(getstatus_parser, struct genlmsghdr, snl_f_p_empty, ap_getstatus); #undef _OUT struct pfctl_status * @@ -1356,11 +1355,9 @@ static struct snl_attr_parser ap_getrules[] = { { .type = PF_GR_NR, .off = _OUT(nr), .cb = snl_attr_get_uint32 }, { .type = PF_GR_TICKET, .off = _OUT(ticket), .cb = snl_attr_get_uint32 }, }; -static struct snl_field_parser fp_getrules[] = { -}; #undef _IN #undef _OUT -SNL_DECLARE_PARSER(getrules_parser, struct genlmsghdr, fp_getrules, ap_getrules); +SNL_DECLARE_PARSER(getrules_parser, struct genlmsghdr, snl_f_p_empty, ap_getrules); int pfctl_get_rules_info_h(struct pfctl_handle *h, struct pfctl_rules_info *rules, uint32_t ruleset, @@ -1665,9 +1662,8 @@ static struct snl_attr_parser ap_getrule[] = { { .type = PF_RT_RPOOL_NAT, .off = _OUT(r.nat), .arg = &pool_parser, .cb = snl_attr_get_nested }, { .type = PF_RT_NAF, .off = _OUT(r.naf), .cb = snl_attr_get_uint8 }, }; -static struct snl_field_parser fp_getrule[] = {}; #undef _OUT -SNL_DECLARE_PARSER(getrule_parser, struct genlmsghdr, fp_getrule, ap_getrule); +SNL_DECLARE_PARSER(getrule_parser, struct genlmsghdr, snl_f_p_empty, ap_getrule); int pfctl_get_clear_rule_h(struct pfctl_handle *h, uint32_t nr, uint32_t ticket, @@ -1778,11 +1774,9 @@ struct pfctl_creator { static struct snl_attr_parser ap_creators[] = { { .type = PF_ST_CREATORID, .off = _OUT(id), .cb = snl_attr_get_uint32 }, }; -static struct snl_field_parser fp_creators[] = { -}; #undef _IN #undef _OUT -SNL_DECLARE_PARSER(creator_parser, struct genlmsghdr, fp_creators, ap_creators); +SNL_DECLARE_PARSER(creator_parser, struct genlmsghdr, snl_f_p_empty, ap_creators); static int pfctl_get_creators_nl(struct snl_state *ss, uint32_t *creators, size_t *len) @@ -1913,11 +1907,9 @@ static struct snl_attr_parser ap_state[] = { { .type = PF_ST_RT, .off = _OUT(rt), .cb = snl_attr_get_uint8 }, { .type = PF_ST_RT_IFNAME, .off = _OUT(rt_ifname), .cb = snl_attr_store_ifname }, }; -static struct snl_field_parser fp_state[] = { -}; #undef _IN #undef _OUT -SNL_DECLARE_PARSER(state_parser, struct genlmsghdr, fp_state, ap_state); +SNL_DECLARE_PARSER(state_parser, struct genlmsghdr, snl_f_p_empty, ap_state); static const struct snl_hdr_parser *all_parsers[] = { &state_parser, &skey_parser, &speer_parser, @@ -2042,9 +2034,8 @@ struct pfctl_nl_clear_states { static struct snl_attr_parser ap_clear_states[] = { { .type = PF_CS_KILLED, .off = _OUT(killed), .cb = snl_attr_get_uint32 }, }; -static struct snl_field_parser fp_clear_states[] = {}; #undef _OUT -SNL_DECLARE_PARSER(clear_states_parser, struct genlmsghdr, fp_clear_states, ap_clear_states); +SNL_DECLARE_PARSER(clear_states_parser, struct genlmsghdr, snl_f_p_empty, ap_clear_states); static int _pfctl_clear_states_h(struct pfctl_handle *h, const struct pfctl_kill *kill, @@ -2478,10 +2469,9 @@ static struct snl_attr_parser ap_natlook[] = { { .type = PF_NL_SRC_PORT, .off = _OUT(sport), .cb = snl_attr_get_uint16 }, { .type = PF_NL_DST_PORT, .off = _OUT(dport), .cb = snl_attr_get_uint16 }, }; -static struct snl_field_parser fp_natlook[] = {}; #undef _IN #undef _OUT -SNL_DECLARE_PARSER(natlook_parser, struct genlmsghdr, fp_natlook, ap_natlook); +SNL_DECLARE_PARSER(natlook_parser, struct genlmsghdr, snl_f_p_empty, ap_natlook); int pfctl_natlook(struct pfctl_handle *h, const struct pfctl_natlook_key *k, @@ -2597,9 +2587,8 @@ struct pfctl_nl_timeout { static struct snl_attr_parser ap_get_timeout[] = { { .type = PF_TO_SECONDS, .off = _OUT(seconds), .cb = snl_attr_get_uint32 }, }; -static struct snl_field_parser fp_get_timeout[] = {}; #undef _OUT -SNL_DECLARE_PARSER(get_timeout_parser, struct genlmsghdr, fp_get_timeout, ap_get_timeout); +SNL_DECLARE_PARSER(get_timeout_parser, struct genlmsghdr, snl_f_p_empty, ap_get_timeout); int pfctl_get_timeout(struct pfctl_handle *h, uint32_t timeout, uint32_t *seconds) @@ -2680,9 +2669,8 @@ struct pfctl_nl_limit { static struct snl_attr_parser ap_get_limit[] = { { .type = PF_LI_LIMIT, .off = _OUT(limit), .cb = snl_attr_get_uint32 }, }; -static struct snl_field_parser fp_get_limit[] = {}; #undef _OUT -SNL_DECLARE_PARSER(get_limit_parser, struct genlmsghdr, fp_get_limit, ap_get_limit); +SNL_DECLARE_PARSER(get_limit_parser, struct genlmsghdr, snl_f_p_empty, ap_get_limit); int pfctl_get_limit(struct pfctl_handle *h, const int index, uint *limit) @@ -2730,9 +2718,8 @@ struct pfctl_nl_begin_addrs { static struct snl_attr_parser ap_begin_addrs[] = { { .type = PF_BA_TICKET, .off = _OUT(ticket), .cb = snl_attr_get_uint32 }, }; -static struct snl_field_parser fp_begin_addrs[] = {}; #undef _OUT -SNL_DECLARE_PARSER(begin_addrs_parser, struct genlmsghdr, fp_begin_addrs, ap_begin_addrs); +SNL_DECLARE_PARSER(begin_addrs_parser, struct genlmsghdr, snl_f_p_empty, ap_begin_addrs); int pfctl_begin_addrs(struct pfctl_handle *h, uint32_t *ticket) @@ -2815,8 +2802,7 @@ pfctl_add_addr(struct pfctl_handle *h, const struct pfioc_pooladdr *pa, int whic static const struct snl_attr_parser ap_get_addrs[] = { { .type = PF_AA_NR, .off = 0, .cb = snl_attr_get_uint32 }, }; -static struct snl_field_parser fp_get_addrs[] = {}; -SNL_DECLARE_PARSER(get_addrs_parser, struct genlmsghdr, fp_get_addrs, ap_get_addrs); +SNL_DECLARE_PARSER(get_addrs_parser, struct genlmsghdr, snl_f_p_empty, ap_get_addrs); int pfctl_get_addrs(struct pfctl_handle *h, uint32_t ticket, uint32_t r_num, @@ -2877,8 +2863,7 @@ static const struct snl_attr_parser ap_get_addr[] = { { .type = PF_AA_ANCHOR, .off = _OUT(anchor), .arg_u32 = MAXPATHLEN, .cb = snl_attr_copy_string }, { .type = PF_AA_ADDR, .off = _OUT(addr), .arg = &pool_addr_parser, .cb = snl_attr_get_nested }, }; -static struct snl_field_parser fp_get_addr[] = {}; -SNL_DECLARE_PARSER(get_addr_parser, struct genlmsghdr, fp_get_addr, ap_get_addr); +SNL_DECLARE_PARSER(get_addr_parser, struct genlmsghdr, snl_f_p_empty, ap_get_addr); #undef _OUT int @@ -2927,8 +2912,7 @@ static const struct snl_attr_parser ap_ruleset[] = { { .type = PF_RS_NR, .off = _OUT(nr), .cb = snl_attr_get_uint32 }, { .type = PF_RS_NAME, .off = _OUT(name), .arg = (void *)PF_ANCHOR_NAME_SIZE, .cb = snl_attr_copy_string }, }; -static struct snl_field_parser fp_ruleset[] = {}; -SNL_DECLARE_PARSER(ruleset_parser, struct genlmsghdr, fp_ruleset, ap_ruleset); +SNL_DECLARE_PARSER(ruleset_parser, struct genlmsghdr, snl_f_p_empty, ap_ruleset); #undef _OUT int @@ -3031,9 +3015,8 @@ static struct snl_attr_parser ap_srcnode[] = { { .type = PF_SN_CONNECTION_RATE, .off = _OUT(conn_rate), .arg = &pfctl_threshold_parser, .cb = snl_attr_get_nested }, { .type = PF_SN_NAF, .off = _OUT(naf), .cb = snl_attr_get_uint8 }, }; -static struct snl_field_parser fp_srcnode[] = {}; #undef _OUT -SNL_DECLARE_PARSER(srcnode_parser, struct genlmsghdr, fp_srcnode, ap_srcnode); +SNL_DECLARE_PARSER(srcnode_parser, struct genlmsghdr, snl_f_p_empty, ap_srcnode); int pfctl_get_srcnodes(struct pfctl_handle *h, pfctl_get_srcnode_fn fn, void *arg) @@ -3076,8 +3059,7 @@ pfctl_get_srcnodes(struct pfctl_handle *h, pfctl_get_srcnode_fn fn, void *arg) static struct snl_attr_parser ap_ndel[] = { { .type = PF_T_NBR_DELETED, .off = 0, .cb = snl_attr_get_uint32 }, }; -static struct snl_field_parser fp_ndel[] = {}; -SNL_DECLARE_PARSER(ndel_parser, struct genlmsghdr, fp_ndel, ap_ndel); +SNL_DECLARE_PARSER(ndel_parser, struct genlmsghdr, snl_f_p_empty, ap_ndel); int pfctl_clear_tables(struct pfctl_handle *h, struct pfr_table *filter, diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index d10852ac7a36..0f3b3b44622d 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -132,6 +132,7 @@ struct snl_field_parser { uint16_t off_out; snl_parse_field_f *cb; }; +static const struct snl_field_parser snl_f_p_empty[] = {}; typedef bool snl_parse_attr_f(struct snl_state *ss, struct nlattr *attr, const void *arg, void *target); From nobody Thu Jan 16 13:51:53 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYkn52CYSz5kTNh; Thu, 16 Jan 2025 13:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYkn51jB3z47SH; Thu, 16 Jan 2025 13:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737035513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u1h7Ggj+T4ptfx2GtOtA9VxHPQZkJAZhqFIpn4ZcSxQ=; b=I6bd4VfDrTnTBRjE+31LEqWqxdbT4Gt0obmUu7s7wkaP5bxdEjY5VpnJll251KuDzRkxzq idE7cpsF2K08XWdZY5gBYedzgw/YHNGYp3u6Ka3cxyt68IK2wZ496aJnG33XQjD/pKxGG6 IUeGsZTp/sezBAY5RFuJ0M9XwQTWxT0n/JFN24lW3zU6Zft/KnMWpE6u14IdCWNcb/rxHD 7rWjH4+WFPFsZz0zPG5TX6YFJ8w2gBJb1VGkHv4E/AI/vr3+8hFqYhKzMW5DxXWj5COACE lj8yJmCtYW3lmUdkjUjo+pA/MgjV3qS6T+HJ9RMNBOBHfSREj6QtKUnpEM9YOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737035513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u1h7Ggj+T4ptfx2GtOtA9VxHPQZkJAZhqFIpn4ZcSxQ=; b=B/9BTWwxKqa3fduqoBIn1tZcOmq36ie+D0e50PloAlFL2BfM1GbAIFyA+p4Jh3eltZ7y+2 Y08qlm7pYnh+BvBICIKF1ZF46NLNKnDrq8ZdFE+E12FSkzsBhl1qa0Mf2qIAFsDbUfUPSr a+XlpNOV4O69NLJvrmFoIX/slQQ0x7t10jal4DlpJR5oXtt9JQjPsadInUXGTpz1vIIw2o QDsrI9elM5vKsh0/nDn8daeWm/gQQ0JKp1a3tB7nJWG/Eu+30CqV62jd7L17W5SPREHoTB 21l+LFhpioISfb5zAKQjzK9WPcU/BXz1GQeSQS6UlA3OanFApmQ7/ULSf5HKnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737035513; a=rsa-sha256; cv=none; b=L8H31dV7c0qP1Tz2Se8Uoz7ybweW1rzvbGTXjyMIkYXFBRbcIR7FOyGElzNWZS2dZhSg0X 6hU1KoKYNEc3waxcH9P5wq7XQ6m9w7+jlNrsquKo1On5VexQ+7SlyrajjCa1wnULLASWic ZQ8yNbcxp2scw0SLuFjVs8gD5oApQbBwUb23nMfvCBE8LK8aWQhuBHOvmHsIV69XhKqcTy wuF+V/YkDaw2ZutFvkjxkXu2xPTMu8ZdCthEZ51IP3t1U6/3j2muG2dAPoBRLJPthAXQ8u Mr/FDj3tdCcgn+NtQG0p0E5EmHr3UiFWqkFbqCeH8ljUpV7MoLZml4ju+cClGg== 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 4YYkn51J6gzbwJ; Thu, 16 Jan 2025 13:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GDprfE016813; Thu, 16 Jan 2025 13:51:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GDprls016810; Thu, 16 Jan 2025 13:51:53 GMT (envelope-from git) Date: Thu, 16 Jan 2025 13:51:53 GMT Message-Id: <202501161351.50GDprls016810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: e3b4a51580fc - main - pkg(7): expand VERSION_MAJOR, VERSION_MINOR, RELEASE and OSNAME List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3b4a51580fcd4a1ddf0d61feb5f325ff1de5420 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=e3b4a51580fcd4a1ddf0d61feb5f325ff1de5420 commit e3b4a51580fcd4a1ddf0d61feb5f325ff1de5420 Author: Baptiste Daroussin AuthorDate: 2025-01-16 13:50:42 +0000 Commit: Baptiste Daroussin CommitDate: 2025-01-16 13:50:42 +0000 pkg(7): expand VERSION_MAJOR, VERSION_MINOR, RELEASE and OSNAME Catchup with pkg(8) by expanding more variable when parsing repositories The only missing variable now is ARCH, this will have to wait for pkg 2.0 to be the lowest supported version. --- usr.sbin/pkg/config.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 2ad6c8a93756..26d7dd66b2a4 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -477,11 +477,26 @@ read_conf_file(const char *confpath, const char *requested_repo, struct ucl_parser *p; ucl_object_t *obj = NULL; const char *abi = pkg_get_myabi(); + char *major, *minor; + struct utsname uts; + + if (uname(&uts)) + err(EXIT_FAILURE, "uname"); if (abi == NULL) errx(EXIT_FAILURE, "Failed to determine ABI"); p = ucl_parser_new(0); + asprintf(&major, "%d", __FreeBSD_version/100000); + if (major == NULL) + err(EXIT_FAILURE, "asprintf"); + asprintf(&minor, "%d", (__FreeBSD_version / 1000) % 100); + if (minor == NULL) + err(EXIT_FAILURE, "asprintf"); ucl_parser_register_variable(p, "ABI", abi); + ucl_parser_register_variable(p, "OSNAME", uts.sysname); + ucl_parser_register_variable(p, "RELEASE", major); + ucl_parser_register_variable(p, "VERSION_MAJOR", major); + ucl_parser_register_variable(p, "VERSION_MINOR", minor); if (!ucl_parser_add_file(p, confpath)) { if (errno != ENOENT) @@ -505,6 +520,8 @@ read_conf_file(const char *confpath, const char *requested_repo, ucl_object_unref(obj); ucl_parser_free(p); + free(major); + free(minor); return (0); } From nobody Thu Jan 16 14:10:50 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYlBy4FBTz5kV07; Thu, 16 Jan 2025 14:10: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYlBy31P2z49n8; Thu, 16 Jan 2025 14:10:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737036650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BMC64/J7LELMKuHc1OjsgamgBemLWe0Cd7/D3W5vlSI=; b=UIZY1Mdgedu+ZSTADnaVXvDfSf356z6iYdgrO5hORrYBRHrUxGO9VS5X0Sqq/lLBM3juLV ejHCdVh/DCozMswwifDDBmucuq0/cE7UuS55ZgIfLd5tsDLDo702TldGH5XYlW1rxkklCs gDaXCA0cv4i+oSKGy9IRFQduILKEbc9F/FO6wFWKuPnJklw1kjM5Lhxm5YRd/87lZsNQaN iMt+lNWd3E8PiQ5b9Rui+myl0dn8jnu5NC26UZ2IifYWHJSe/5eB7aUwXQJikRKnuctqG0 wEqX3bCFNw4PzUWSZ25mZszy/EPlLrqSVjIwC0Se2l5HoEBbkzcTsmZIG8Ji5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737036650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BMC64/J7LELMKuHc1OjsgamgBemLWe0Cd7/D3W5vlSI=; b=xOU6nZfqmDueIwHu3/Ed2C7wsa3P4V3LgIpdWrY+Di+xOgPzW0BF5svfKudqkQJmx7S2Sk SE6JOwU2fxrHVmU7JjcXUvy/LaZzfc9qGog24iNRcaR7BFQSz7pnbBJL+KEJYKeaQY273r ZZnbEjSCfdD5dtt4wwblF9Mr3Uh8SeAK+jg6vbIO6xOr9ekZtHBnjCeVoIce8+OgzxD4kt m3nPpnmgnq42IWjL2IXFgyalRwUB8r3ftL0tsUBb5HQOsAqJUACk9KOsO82OidifYMd1+M znXkTk0cfAnyIyBySN1wbuQ7rEXIHTqY8VniGRbpq1NjndMCgq9ymLM+XFFJhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737036650; a=rsa-sha256; cv=none; b=NDXbRlr25zp8cmnFhItJObOXth86GaE9iXMBy0X3sN30ymjxuPqYYAeIHtK5d6D/Se5yMq 89pGWSc2fKgjnlLPlNCDtw0rH+huHMJv7xc4eZgJ8Osf27CTglTjC1TB4udiMvhLZGs+J8 FGpP0FVOrgiqvVwbfWSvIbeD4s3e0RksZ2seysVCLljBZKduy6vsOcXQQWEV6sxJWGYQ42 JfWmZH53CoUHp7DEns+jQVcBFAEQCKJZlxzVxB2/L6cym16hD6a22LUgCVpVTo66+ZqAhF sCCy4vHViG9882MruIE7dXBqmLBjrVP7YgnAwr8Fes+YEUqU/PC5eYRI4M2akg== 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 4YYlBy2TFNzc0H; Thu, 16 Jan 2025 14:10:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GEAoG3050923; Thu, 16 Jan 2025 14:10:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GEAoXq050920; Thu, 16 Jan 2025 14:10:50 GMT (envelope-from git) Date: Thu, 16 Jan 2025 14:10:50 GMT Message-Id: <202501161410.50GEAoXq050920@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 9dc96d8bc3f2 - main - libusb: hotplug, use events instead of a timer when possible List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9dc96d8bc3f282fefb186670edbf07c7cc32f9c5 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=9dc96d8bc3f282fefb186670edbf07c7cc32f9c5 commit 9dc96d8bc3f282fefb186670edbf07c7cc32f9c5 Author: Baptiste Daroussin AuthorDate: 2025-01-04 10:23:12 +0000 Commit: Baptiste Daroussin CommitDate: 2025-01-16 14:10:11 +0000 libusb: hotplug, use events instead of a timer when possible Try to fetch events from nlsysevent or devd to determine when to scan the usb bus for devices addition or removal. if none are available fallback on the regular timer based (4s) scanner if devd socket or netlink socket is closed or error fallback on the timer based method. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D48300 --- lib/libusb/libusb10.c | 8 ++ lib/libusb/libusb10.h | 16 ++++ lib/libusb/libusb10_hotplug.c | 173 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 196 insertions(+), 1 deletion(-) diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c index 6d9c11910ea0..afa25eabf459 100644 --- a/lib/libusb/libusb10.c +++ b/lib/libusb/libusb10.c @@ -155,6 +155,7 @@ libusb_init_context(libusb_context **context, return (LIBUSB_ERROR_INVALID_PARAM); memset(ctx, 0, sizeof(*ctx)); + ctx->devd_pipe = -1; debug = getenv("LIBUSB_DEBUG"); if (debug != NULL) { @@ -280,6 +281,13 @@ libusb_exit(libusb_context *ctx) HOTPLUG_LOCK(ctx); td = ctx->hotplug_handler; ctx->hotplug_handler = NO_THREAD; + if (ctx->usb_event_mode == usb_event_devd) { + close(ctx->devd_pipe); + ctx->devd_pipe = -1; + } else if (ctx->usb_event_mode == usb_event_netlink) { + close(ctx->ss.fd); + ctx->ss.fd = -1; + } HOTPLUG_UNLOCK(ctx); pthread_join(td, &ptr); diff --git a/lib/libusb/libusb10.h b/lib/libusb/libusb10.h index 544364386061..3402e0377c92 100644 --- a/lib/libusb/libusb10.h +++ b/lib/libusb/libusb10.h @@ -30,6 +30,12 @@ #ifndef LIBUSB_GLOBAL_INCLUDE_FILE #include +#include +#include +#include +#include +#include + #endif #define GET_CONTEXT(ctx) (((ctx) == NULL) ? usbi_default_context : (ctx)) @@ -90,12 +96,22 @@ struct libusb_hotplug_callback_handle_struct { TAILQ_HEAD(libusb_device_head, libusb_device); +typedef enum { + usb_event_none, + usb_event_scan, + usb_event_devd, + usb_event_netlink +} usb_event_mode_t; + struct libusb_context { int debug; int debug_fixed; int ctrl_pipe[2]; int tr_done_ref; int tr_done_gen; + usb_event_mode_t usb_event_mode; + int devd_pipe; + struct snl_state ss; pthread_mutex_t ctx_lock; pthread_mutex_t hotplug_lock; diff --git a/lib/libusb/libusb10_hotplug.c b/lib/libusb/libusb10_hotplug.c index 98903686f76b..fd016e972dfb 100644 --- a/lib/libusb/libusb10_hotplug.c +++ b/lib/libusb/libusb10_hotplug.c @@ -23,6 +23,7 @@ * SUCH DAMAGE. */ +#include #ifdef LIBUSB_GLOBAL_INCLUDE_FILE #include LIBUSB_GLOBAL_INCLUDE_FILE #else @@ -39,6 +40,10 @@ #include #include #include +#include +#include +#include +#include #endif #define libusb_device_handle libusb20_device @@ -49,6 +54,118 @@ #include "libusb.h" #include "libusb10.h" +#define DEVDPIPE "/var/run/devd.seqpacket.pipe" +#define DEVCTL_MAXBUF 1024 + +typedef enum { + broken_event, + invalid_event, + valid_event, +} event_t; + +static bool +netlink_init(libusb_context *ctx) +{ + struct _getfamily_attrs attrs; + + if (modfind("nlsysevent") < 0) + kldload("nlsysevent"); + if (modfind("nlsysevent") < 0) + return (false); + if (!snl_init(&ctx->ss, NETLINK_GENERIC)) + return (false); + + if (!snl_get_genl_family_info(&ctx->ss, "nlsysevent", &attrs)) + return (false); + + for (unsigned int i = 0; i < attrs.mcast_groups.num_groups; i++) { + if (strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name, + "USB") == 0) { + if (setsockopt(ctx->ss.fd, SOL_NETLINK, + NETLINK_ADD_MEMBERSHIP, + &attrs.mcast_groups.groups[i]->mcast_grp_id, + sizeof(attrs.mcast_groups.groups[i]->mcast_grp_id)) + == -1) { + return (false); + } + } + } + ctx->usb_event_mode = usb_event_netlink; + return (true); +} + +static bool +devd_init(libusb_context *ctx) +{ + struct sockaddr_un devd_addr; + + bzero(&devd_addr, sizeof(devd_addr)); + if ((ctx->devd_pipe = socket(PF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK, 0)) < 0) + return (false); + + devd_addr.sun_family = PF_LOCAL; + strlcpy(devd_addr.sun_path, DEVDPIPE, sizeof(devd_addr.sun_path)); + if (connect(ctx->devd_pipe, (struct sockaddr *)&devd_addr, + sizeof(devd_addr)) == -1) { + close(ctx->devd_pipe); + ctx->devd_pipe = -1; + return (false); + } + + ctx->usb_event_mode = usb_event_devd; + return (true); +} + +struct nlevent { + const char *name; + const char *subsystem; + const char *type; + const char *data; +}; + +#define _OUT(_field) offsetof(struct nlevent, _field) +static struct snl_attr_parser ap_nlevent_get[] = { + { .type = NLSE_ATTR_SYSTEM, .off = _OUT(name), .cb = snl_attr_get_string }, + { .type = NLSE_ATTR_SUBSYSTEM, .off = _OUT(subsystem), .cb = snl_attr_get_string }, + { .type = NLSE_ATTR_TYPE, .off = _OUT(type), .cb = snl_attr_get_string }, + { .type = NLSE_ATTR_DATA, .off = _OUT(data), .cb = snl_attr_get_string }, +}; +#undef _OUT + +SNL_DECLARE_GENL_PARSER(nlevent_get_parser, ap_nlevent_get); + +static event_t +verify_event_validity(libusb_context *ctx) +{ + if (ctx->usb_event_mode == usb_event_netlink) { + struct nlmsghdr *hdr; + struct nlevent ne; + + hdr = snl_read_message(&ctx->ss); + if (hdr != NULL && hdr->nlmsg_type != NLMSG_ERROR) { + memset(&ne, 0, sizeof(ne)); + if (!snl_parse_nlmsg(&ctx->ss, hdr, &nlevent_get_parser, &ne)) + return (broken_event); + if (strcmp(ne.subsystem, "DEVICE") == 0) + return (valid_event); + return (invalid_event); + } + return (invalid_event); + } else if (ctx->usb_event_mode == usb_event_devd) { + char buf[DEVCTL_MAXBUF]; + ssize_t len; + + len = read(ctx->devd_pipe, buf, sizeof(buf)); + if (len == 0 || (len < 0 && errno != EWOULDBLOCK)) + return (broken_event); + if (len > 0 && strstr(buf, "system=USB") != NULL && + strstr(buf, "subsystem=DEVICE") != NULL) + return (valid_event); + return (invalid_event); + } + return (broken_event); +} + static int libusb_hotplug_equal(libusb_device *_adev, libusb_device *_bdev) { @@ -105,6 +222,7 @@ libusb_hotplug_enumerate(libusb_context *ctx, struct libusb_device_head *phead) static void * libusb_hotplug_scan(void *arg) { + struct pollfd pfd; struct libusb_device_head hotplug_devs; libusb_hotplug_callback_handle acbh; libusb_hotplug_callback_handle bcbh; @@ -112,9 +230,51 @@ libusb_hotplug_scan(void *arg) libusb_device *temp; libusb_device *adev; libusb_device *bdev; + int timeout = INFTIM; + int nfds; + memset(&pfd, 0, sizeof(pfd)); + if (ctx->usb_event_mode == usb_event_devd) { + pfd.fd = ctx->devd_pipe; + pfd.events = POLLIN | POLLERR; + nfds = 1; + } else if (ctx->usb_event_mode == usb_event_netlink) { + pfd.fd = ctx->ss.fd; + pfd.events = POLLIN | POLLERR; + nfds = 1; + } else { + nfds = 0; + timeout = 4000; + } for (;;) { - usleep(4000000); + pfd.revents = 0; + if (poll(&pfd, nfds, timeout) > 0) { + switch (verify_event_validity(ctx)) { + case invalid_event: + continue; + case valid_event: + break; + case broken_event: + /* There are 2 cases for broken events: + * - devd and netlink sockets are not available + * anymore (devd restarted, nlsysevent unloaded) + * - libusb_exit has been called as it sets NO_THREAD + * this will result in exiting this loop and this thread + * immediately + */ + nfds = 0; + if (ctx->usb_event_mode == usb_event_devd) { + if (ctx->devd_pipe != -1) + close(ctx->devd_pipe); + } else if (ctx->usb_event_mode == usb_event_netlink) { + if (ctx->ss.fd != -1) + close(ctx->ss.fd); + } + ctx->usb_event_mode = usb_event_scan; + timeout = 4000; + break; + } + } HOTPLUG_LOCK(ctx); if (ctx->hotplug_handler == NO_THREAD) { @@ -122,6 +282,10 @@ libusb_hotplug_scan(void *arg) TAILQ_REMOVE(&ctx->hotplug_devs, adev, hotplug_entry); libusb_unref_device(adev); } + if (ctx->usb_event_mode == usb_event_devd) + close(ctx->devd_pipe); + else if (ctx->usb_event_mode == usb_event_netlink) + close(ctx->ss.fd); HOTPLUG_UNLOCK(ctx); break; } @@ -192,6 +356,13 @@ int libusb_hotplug_register_callback(libusb_context *ctx, ctx = GET_CONTEXT(ctx); + if (ctx->usb_event_mode == usb_event_none) { + HOTPLUG_LOCK(ctx); + if (!netlink_init(ctx) && !devd_init(ctx)) + ctx->usb_event_mode = usb_event_scan; + HOTPLUG_UNLOCK(ctx); + } + if (ctx == NULL || cb_fn == NULL || events == 0 || vendor_id < -1 || vendor_id > 0xffff || product_id < -1 || product_id > 0xffff || From nobody Thu Jan 16 14:25:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYlXK0F1Bz5kW4F; Thu, 16 Jan 2025 14:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYlXJ6Lhxz4Dcn; Thu, 16 Jan 2025 14:25:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737037552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b6drp7CAcq04pCzP9YWw36T9pyLv9PRRHt9gQD+ViXQ=; b=xJrOcAuivteimdLLljEdCW/pgVftsWPEm0m426uO9IjBuY9HRFMJ12NIIAo4ezBH8sYqpO H8x1cvcSOOPSRGUMKW43VV0+Dm/Z/+9ObyL+GXb5cEtP51GFdzZll4qdd08dMbp11npknk dETHE3yyKRs54bAogC+/s1zakR2uQTLI9qUcBMCdwWs+QmkbK6EEqS4MSWE+Qq5loJWTZ6 PPBLivv0AgVULP17udbp8NxSkCMDYlpxf1BSZnd1dP9Z/jDS9S+E3JVgxlB4eN3pe50GNO nsXDtTd88RIG/4aJ3ed4D5Y4iUxpz4AKlo/4lAeNX99MfiJT15J2vg1k61XMyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737037552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b6drp7CAcq04pCzP9YWw36T9pyLv9PRRHt9gQD+ViXQ=; b=QgA2d1U831d45ugdQe/yyWFPtxZIimoBMhlzo160zS2MsJiKL2oVb/15C1e5WL4WbdBSPZ 8bXPWZs1wb8MQTmpCaPR4ew7xgMJPPbigfk8ilIKo8eSzSlFMc/bWaA8GyZ4M1u9OvvApd o7N0dTZuert42yTv/BmA9hGys687sYJeycQPrAh0GL+P2PXZBQPXiNLRaLLqn+rv3GM4QM 5l+1SGzOdxfUQkGErYsu8TkwdBRsfnsrUXhguDhzlGbIGPDbZoZsxVbJMj267XAvlbqT1h W9OQEo1d7qEVvmUvTsN5QVWLwnxmnHkBSErezBYvcr2YVNuK0XUWbWYo7Rp+qQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737037552; a=rsa-sha256; cv=none; b=VX3HBFxY82BNXN0UEzW2IhbMMBY3CT5vYOXmaokO4dKr2lOI4gYplNTEezBi4jaBp+F0vW VhQdjwZt4uguFWGukgYowm/ZzfcEoqsAwvTLg+JG5NPn/RNoOa8xASgcm8ZmSMha33+vzw sj5ywpGxk6a9BS+qfuQU1h5un7pyv1HutsdyVyJtD35/hJEoR7WrDzy2hFD15OLH6Scgot FBWb1A6MfDzRDV+e4Bt4cMacAeRJ26J5iyee1lwsITaOy34NVvh30ear62j6rIHTWiu/JC ir6rqWn4LsAjRX0pBrq/XB5IrfMC0Gj8NGL3Zg2sLhOxhkqIROlo6tQ7CuXHAg== 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 4YYlXJ5f5zzcpF; Thu, 16 Jan 2025 14:25:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GEPqN2075702; Thu, 16 Jan 2025 14:25:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GEPq7N075699; Thu, 16 Jan 2025 14:25:52 GMT (envelope-from git) Date: Thu, 16 Jan 2025 14:25:52 GMT Message-Id: <202501161425.50GEPq7N075699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 621569254cd0 - main - hwpstate_amd: add amd pstate for zen4 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 621569254cd0b0639488aa5d7b8143cef7c90a18 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=621569254cd0b0639488aa5d7b8143cef7c90a18 commit 621569254cd0b0639488aa5d7b8143cef7c90a18 Author: SHENGYI HONG AuthorDate: 2025-01-15 11:18:34 +0000 Commit: Mark Johnston CommitDate: 2025-01-16 14:25:45 +0000 hwpstate_amd: add amd pstate for zen4 Co-authored-by: Daniel Schaefer Reviewed by: markj MFC after: 2 weeks Sponsored by: Framework Computer Inc Differential Revision: https://reviews.freebsd.org/D48461 --- sys/x86/cpufreq/hwpstate_amd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c index 59a3a64e6495..5a2ff7611228 100644 --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -461,6 +461,7 @@ hwpstate_get_info_from_msr(device_t dev) break; case 0x17: case 0x18: + case 0x19: did = AMD_17H_CUR_DID(msr); if (did == 0) { HWPSTATE_DEBUG(dev, "unexpected did: 0\n"); From nobody Thu Jan 16 14:25:53 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYlXL0jb5z5kVfY; Thu, 16 Jan 2025 14:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYlXK6my2z4DCS; Thu, 16 Jan 2025 14:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737037554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qRyHWvfX3RMwKaCzo4OOuARrSj5SoCOhomCh4nfjdso=; b=i9W37ofRI5ra1TreQTFwWHh3XLld9GEMSjPh0C8C/qaeVRp+TVo3vbF0OtVG5/YSXaZKOQ ozlvZrZTyaVzvlC0dNk5pswk/hSWqgGYFhVwMQRISW8Twv6eWddIzjwd0+FwOPhBn+R8X+ 3gVf5MKCsnu0OwdW0/znMY4ALLi6A2cnP14qPloA/iLDonLoPnjRwUEtt5aniEMvtqUntM umC93DIpHKhwy6qYMS2JVxYfMwgqpF2EsfsmLsTPqDb+rQqsR83XrI/QRSygqaBJd0h1Zy vIjqqntuicyccRnVLLr8AkA5oEMaUDztugjXWOGMFiLUOnQal5NZj0GGEK+zAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737037554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qRyHWvfX3RMwKaCzo4OOuARrSj5SoCOhomCh4nfjdso=; b=KBCXJNVFX3HVvF10xqmUlo3eIsxkojLjnita+RqN1xJulTWTKwgC4lGTzi2lTzcYUo9wVW vGmjF7LgT/lUrLQAqvWxnezYU2Nid57pIT79QDLd/WdPET0LoFolbQshgPTNIzHQFGpNUh UGXN/hI6d5WrBAn78DmHkGJnmQJqD9tk5B+5iE2S0MP0/dwVbn0AE9aS6hfqoPCgcdFlXz JYyoA3/RFPGOy4SwA/Pfs7M1CYqZqlTKHyJ//n/pUoEytuwGX4fjbpLMWr+SR5AIcr6KUq ZejZZsNPXOBQuj4HaCBJL+CqsKVmVQg1TLD/bH4YiZXD/9cLc+YBnh/k/Fw3bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737037554; a=rsa-sha256; cv=none; b=S85fNnSwZkkMq70IvpzsQg7vxUaiMdQEpeHiKLXfhUqIjfnoGJQLHMGtZR9BSkLS+ELLn8 pxd1t7Vmqm3OF9s+7tjzGxzUhvkVJQhwkjeKDc0dV9FldnqbVO4Ce/hcFIsoV6CAGEmNs3 HP58NDE5hO6babmxt8uhJvN0PEc4JDKcsRxaIUydRMLCa0gGMedhDOtXjIrJwG5JzaL8ZV XNH/y/BqNabYr/eR++1a/c8JyO1hH9Aa36FinF5NBoJPALj7HS3btx92i5oVd/hTGLY6Bt qXPxvkrvqKe9Gq+AOfv8NE4ux7C8GJciwd5ZkJLjGrfRw0VBoS4s2Me/yHDu7Q== 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 4YYlXK6K54zclm; Thu, 16 Jan 2025 14:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GEPrQd075757; Thu, 16 Jan 2025 14:25:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GEPr6M075754; Thu, 16 Jan 2025 14:25:53 GMT (envelope-from git) Date: Thu, 16 Jan 2025 14:25:53 GMT Message-Id: <202501161425.50GEPr6M075754@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 0e6e1f14f0a7 - main - hwpstate_amd: add amd pstate for zen5 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e6e1f14f0a7cfabec38106e41cb2f7a39363e55 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0e6e1f14f0a7cfabec38106e41cb2f7a39363e55 commit 0e6e1f14f0a7cfabec38106e41cb2f7a39363e55 Author: SHENGYI HONG AuthorDate: 2024-12-09 03:18:18 +0000 Commit: Mark Johnston CommitDate: 2025-01-16 14:25:45 +0000 hwpstate_amd: add amd pstate for zen5 Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47985 --- sys/x86/cpufreq/hwpstate_amd.c | 62 +++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/sys/x86/cpufreq/hwpstate_amd.c b/sys/x86/cpufreq/hwpstate_amd.c index 5a2ff7611228..a9305e571ece 100644 --- a/sys/x86/cpufreq/hwpstate_amd.c +++ b/sys/x86/cpufreq/hwpstate_amd.c @@ -43,6 +43,8 @@ * 31116 Rev 3.20 February 04, 2009 * BIOS and Kernel Developer's Guide(BKDG) for AMD Family 11h Processors * 41256 Rev 3.00 - July 07, 2008 + * Processor Programming Reference (PPR) for AMD Family 1Ah Model 02h, + * Revision C1 Processors Volume 1 of 7 - Sep 29, 2024 */ #include @@ -88,6 +90,8 @@ #define AMD_17H_CUR_DID(msr) (((msr) >> 8) & 0x3F) #define AMD_17H_CUR_FID(msr) ((msr) & 0xFF) +#define AMD_1AH_CUR_FID(msr) ((msr) & 0xFFF) + #define HWPSTATE_DEBUG(dev, msg...) \ do { \ if (hwpstate_verbose) \ @@ -163,6 +167,23 @@ static driver_t hwpstate_driver = { DRIVER_MODULE(hwpstate, cpu, hwpstate_driver, 0, 0); +static int +hwpstate_amd_iscale(int val, int div) +{ + switch (div) { + case 3: /* divide by 1000 */ + val /= 10; + case 2: /* divide by 100 */ + val /= 10; + case 1: /* divide by 10 */ + val /= 10; + case 0: /* divide by 1 */ + ; + } + + return (val); +} + /* * Go to Px-state on all cpus, considering the limit register (if so * configured). @@ -462,13 +483,30 @@ hwpstate_get_info_from_msr(device_t dev) case 0x17: case 0x18: case 0x19: - did = AMD_17H_CUR_DID(msr); - if (did == 0) { - HWPSTATE_DEBUG(dev, "unexpected did: 0\n"); - did = 1; + case 0x1A: + /* calculate freq */ + if (family == 0x1A) { + fid = AMD_1AH_CUR_FID(msr); + /* 1Ah CPU don't use a divisor */ + hwpstate_set[i].freq = fid; + if (fid > 0x0f) + hwpstate_set[i].freq *= 5; + else { + HWPSTATE_DEBUG(dev, + "unexpected fid: %d\n", fid); + return (ENXIO); + } + } else { + did = AMD_17H_CUR_DID(msr); + if (did == 0) { + HWPSTATE_DEBUG(dev, + "unexpected did: 0\n"); + did = 1; + } + fid = AMD_17H_CUR_FID(msr); + hwpstate_set[i].freq = (200 * fid) / did; } - fid = AMD_17H_CUR_FID(msr); - hwpstate_set[i].freq = (200 * fid) / did; + /* Vid step is 6.25mV, so scale by 100. */ hwpstate_set[i].volts = (155000 - (625 * AMD_17H_CUR_VID(msr))) / 100; @@ -479,16 +517,8 @@ hwpstate_get_info_from_msr(device_t dev) * section 2.5.2.1.6. */ hwpstate_set[i].power = AMD_17H_CUR_IDD(msr) * 1000; - switch (AMD_17H_CUR_IDIV(msr)) { - case 3: /* divide by 1000 */ - hwpstate_set[i].power /= 10; - case 2: /* divide by 100 */ - hwpstate_set[i].power /= 10; - case 1: /* divide by 10 */ - hwpstate_set[i].power /= 10; - case 0: /* divide by 1 */ - ; - } + hwpstate_set[i].power = hwpstate_amd_iscale( + hwpstate_set[i].power, AMD_17H_CUR_IDIV(msr)); hwpstate_set[i].power *= hwpstate_set[i].volts; /* Milli amps * milli volts to milli watts. */ hwpstate_set[i].power /= 1000; From nobody Thu Jan 16 15:48:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYnN95Kk5z5kbQr; Thu, 16 Jan 2025 15:48:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYnN94lBnz4PDf; Thu, 16 Jan 2025 15:48:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737042537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ud5LyQqnjS40vOQF8lyj5AErd7VP03wJz3Vl9cHW0d0=; b=Xegg/bId8mQQ6U/4UTP+dV1VmHDLj/ep9pR95gSvOtrxHzx1PoZojzhPwwd55GH9f3pdym 2Q8qPM2YcIJaFW1/vPaMx6CqPuLFXj9sxblLzMOgYbYWSthkfAlOlU/bfq14mmXPXKW8hX SuMETedGcSwHbHghkBINsxWkGHLJZMxEIX39Bcp4/03Ze0/dsa9VOQBW9CkW9eDSp5D8ct ja9CWsC2kBwqy+9NClwNjuK756+Ku3I1aclEZFDpUOKw5POqOOh44yhOujE+3zlX4ofG2u p4v9JwoeFqU14GaynMuEKOdirx0yN0XHaKdjk96pSSeU4TwGqTK3drlYRYSJGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737042537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ud5LyQqnjS40vOQF8lyj5AErd7VP03wJz3Vl9cHW0d0=; b=rCKHHFGSbnmpQf5z6Cjxp4NRNt8ZMTTpli3BjrhGWCGLG1zi+HH6yzsAsL1GVZHBLHy3e0 WM+LKpgznoj2galqzqCzKaeOxn1T8STpYOaC1NvC8fPmtxAfTw49MNv3Sh+JG8VgRJdrlP kU65dRbXxjW15mcFDebz7yiAEwwS7tGs1v5tOmv4bptnjpQsNACYzdqt8PIRUZWEFGOtu8 IlsCQ2l7ZMSwKKaqB84DNFSe7OYXlMmEZJBaU2yZAo+NrqttnY/otpCsVbQ8gXvUkcLsdv ZCqhvxUZQKb3SfcFMkcOtk4S2ZPtSXJXrRJRDF8iRYkHX4ikS5bBXt4nRVytrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737042537; a=rsa-sha256; cv=none; b=rabvUoPkxoZii7TzhE/3CbdXly7G1DwIEDpwqIZZyStgbgrYcrBfSRScyz0SkSSu003HJZ tt652TTCw6TYEXQvkFECGQNUaxOcue1Mb85xs/XoDRNfxGCXwhAn5oFKzQ0h9ndV/Ngqqv cZUeltsyaHNXQsBzqEQoOSId+xrzOk/uzJWvf5Af5GrttZIuWVjW78XTJbPFKis/CfmhUb VCLVgf18xJ22F5/Zy9icsE/JfBqa1ykb84QXrIQGiICzKiOXRKLUtWVoKR+YS6ugMhoNQx IUA0/xPGtjR1o8NzmjD1ocFY3VyH5MGC5T+wlSHnzraG/7ZttxrTgidY+OoYIQ== 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 4YYnN93yKLzfKM; Thu, 16 Jan 2025 15:48:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GFmvVG026618; Thu, 16 Jan 2025 15:48:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GFmvdc026615; Thu, 16 Jan 2025 15:48:57 GMT (envelope-from git) Date: Thu, 16 Jan 2025 15:48:57 GMT Message-Id: <202501161548.50GFmvdc026615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 491db92a1751 - main - bintrans(1): fix typo List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 491db92a1751ae3546cee4e73f43d7146cc9dc9d Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=491db92a1751ae3546cee4e73f43d7146cc9dc9d commit 491db92a1751ae3546cee4e73f43d7146cc9dc9d Author: Baptiste Daroussin AuthorDate: 2025-01-16 15:48:10 +0000 Commit: Baptiste Daroussin CommitDate: 2025-01-16 15:48:10 +0000 bintrans(1): fix typo Reported by: Helge Oldach --- usr.bin/bintrans/bintrans.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/bintrans/bintrans.1 b/usr.bin/bintrans/bintrans.1 index 02571067c8f0..73baac115de4 100644 --- a/usr.bin/bintrans/bintrans.1 +++ b/usr.bin/bintrans/bintrans.1 @@ -236,7 +236,7 @@ Decode. Output to .Ar output_file instead of standard output. -.It fl r +.It Fl r Encode/Decode in RFC2047 specific variant. .El .Sh EXAMPLES From nobody Thu Jan 16 15:52:00 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYnRh44w2z5kbHd; Thu, 16 Jan 2025 15:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYnRh3Q1Rz4QGv; Thu, 16 Jan 2025 15:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737042720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8HCyyYqeHCOlYxrAldXttT9UzyQFzTiSF72OD7O2pwI=; b=q/Nbe9hlpUK+WfEKIRslXZ4UrlAyGaeABzdJOoY75pkRTrZBiRvFbfZky5nN7KYULpUwnW mcDOLWynquXsEwq7xSxjkQWhSU7nipnwtdbqHpCYpB+kj6osC40/iH+QnmeCJrt5Z7Ri5W Vcqm/tbCzExUDsLtcR9lG1LFDU7d6iQbv7BYDQ1K9kP1M5C4YB3H8X4W0MO3YfWjib6Bo9 cIL57uavN3th/tj7jp00PUAZZTvbKN8OBl5NaVB+0jw2wx5HXu63DZ3ySGXbFUUjteHTBf Gxty+pzhorMu16kJr+Dpxg0CiqUsTjeN/6VtKlW05yB1IHdKL0vPZsX5DOnTLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737042720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8HCyyYqeHCOlYxrAldXttT9UzyQFzTiSF72OD7O2pwI=; b=NuJUOFlsYBPApfXOi9TU4JTcopNiuTZrmOUl2T/OLu/1fHHWjfNSAMFdRgCtcPYiFwakz7 lwEhq4Uo3ZY4+O01hYnWyFOnxr8DhiL9/5WENpHeK2qhl+3V5JI35fXRfpJID7G6b+40qd TqhjJBO0o4En1x1a5l8A/R0ICEx87KrWpkuWuKrbsksRBdvWDFHCc+yOVdyOulOVzi/DO3 ZE/+fP1+q3cVq1GKYLAxwLCMOXQLgHTU1+It4jshZ9RYo+N+TXVpFoy8s9djhWayzGMems J2sRV0qQfivlcQapjJh0098tKq+6UkQ2ntoWzbzhwYcvbad9I8v7uoMekSg+rw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737042720; a=rsa-sha256; cv=none; b=kdEfUPquzVr5zhaF65g7uYSkIMAHQ7ihAdJbLeOn8nTkt5Xg17boeyHyvgx5cKnuZ4MgIj C++zSfEPJPFSzqJvjjEPIv/B6QmY+x3RRbPhH5Jzx8Rc78VHs75GpTPnh9sC31ftMijrbg idlAUtFwCHq3IMT66NuF5DOg3tH+ozTFfEu01kD/povNWchvUBpR67BuY+Yqp8h2n9YYcv qQkVQjdijnGpjbXNccz6kRzqxYFyn5MyOmtlrkzh5aJ2rXsHP253VckmIQksoBdOD0VRur B8xBS+h7I7fbwVNHKAdE7z7dMdjCNhzn0UKXr1YAzoTKKoD3biPh+Ghj7xgMiw== 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 4YYnRh2zjGzg29; Thu, 16 Jan 2025 15:52: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 50GFq0wM040548; Thu, 16 Jan 2025 15:52:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GFq0Bp040545; Thu, 16 Jan 2025 15:52:00 GMT (envelope-from git) Date: Thu, 16 Jan 2025 15:52:00 GMT Message-Id: <202501161552.50GFq0Bp040545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4276dfa8c4b9 - main - BUS_HINTED_CHILD.9: New manpage to document this bus method List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4276dfa8c4b9e75ab29f2c53a7af36c2f77ab563 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4276dfa8c4b9e75ab29f2c53a7af36c2f77ab563 commit 4276dfa8c4b9e75ab29f2c53a7af36c2f77ab563 Author: John Baldwin AuthorDate: 2025-01-16 15:51:44 +0000 Commit: John Baldwin CommitDate: 2025-01-16 15:51:44 +0000 BUS_HINTED_CHILD.9: New manpage to document this bus method Reviewed by: ziaee, imp Differential Revision: https://reviews.freebsd.org/D48366 --- share/man/man9/BUS_HINTED_CHILD.9 | 36 ++++++++++++++++++++++++++++++++++++ share/man/man9/Makefile | 1 + 2 files changed, 37 insertions(+) diff --git a/share/man/man9/BUS_HINTED_CHILD.9 b/share/man/man9/BUS_HINTED_CHILD.9 new file mode 100644 index 000000000000..699bb06e8dd8 --- /dev/null +++ b/share/man/man9/BUS_HINTED_CHILD.9 @@ -0,0 +1,36 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2025 John Baldwin +.Dd January 6, 2025 +.Dt BUS_HINTED_CHILD 9 +.Os +.Sh NAME +.Nm BUS_HINTED_CHILD +.Nd notify a bus device about a potential child device identified by hints +.Sh SYNOPSIS +.In sys/param.h +.In sys/bus.h +.Ft void +.Fn BUS_HINTED_CHILD "device_t dev" "const char *dname" "int dunit" +.Sh DESCRIPTION +The +.Fn BUS_HINTED_CHILD +method is invoked by the +.Xr bus_enumerate_hinted_children 9 +function for each set of named hints whose +.Dq at +hint matches the bus device +.Fa dev . +Typically, this method should determine if the set of hints for the given +device name and unit sufficiently describe a new device. +If so, a new device should be added via +.Xr BUS_ADD_CHILD 9 . +.Sh SEE ALSO +.Xr BUS_ADD_CHILD 9 , +.Xr device 9 +.Sh HISTORY +The +.Fn BUS_HINTED_CHILD +method first appeared in +.Fx 6.2 . diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index c09d3aa554a1..6e8edc3f698d 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -47,6 +47,7 @@ MAN= accept_filter.9 \ BUS_GET_CPUS.9 \ BUS_GET_PROPERTY.9 \ bus_get_resource.9 \ + BUS_HINTED_CHILD.9 \ bus_map_resource.9 \ BUS_NEW_PASS.9 \ BUS_PRINT_CHILD.9 \ From nobody Thu Jan 16 15:55:28 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYnWj3BJ2z5kbtp; Thu, 16 Jan 2025 15:55:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYnWj1wx5z4Qh6; Thu, 16 Jan 2025 15:55:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737042929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V86Jj6ZB4lWuqBefF+wSPzNEEQwDCf9YJgFMVsVGoOg=; b=EAVtEJxDAiKf9Qu6ptgq0DN4OM57WUM07SQGuUTQD62C0Q2ZPH8zqsKNtg15Xg5fU+zThk n8Prr/ftbWBHxhTVEFQZJ1kbGvmA15707zfnYJ3aB+xcoWVUks/QFcJ5/NGWVfN0MXQ6qK 2hB5cixtin2ugvLBHuKNrCVYspiIAOhY22Irp/5anagiei0HGOJaaXaHev1uvW7CA42/+X M0QwbnWfFo64myjvUOHUj9UwpXuZ599qYu3c8iyDsV8gvQR06Prrp2u04RflzIm2yjn8Vt 7mVrJ923eK2dCAfSnrs/dDf26rjtWGdVSx2v0L4VNfenh9lWGiBxyG3PdP/o7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737042929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V86Jj6ZB4lWuqBefF+wSPzNEEQwDCf9YJgFMVsVGoOg=; b=Oih80KaP5EfDKIIanpaGfSOYYZ4WxcsioKk2x2YsylZTRUld/9FqD1vd2cAvrMLEM56fsC /PgimytHO1QwrOSd1IQhCZhHcy7d7u1oNWlyDDobntiJxG5vxzH0qUROWHLTIJsU2RE2/2 IwwNArHTGcoZXYQZ00boUmU7uENu/Y1g4wPKZ032hYJCrJo3lbh2MJC9l7lnJ+2/YFvGZC FFgCySeR0aGeNDlx7S3UtPVQ2fmbNviR/jBgY/YlW7yqzHYLoiWzzg7MaGosoBmW4Py57A EibStZ9KiKSW187sBZIUf1F56tlLg6f6zUpMCSBI5eIp+f4zZMGfyf91OMfARA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737042929; a=rsa-sha256; cv=none; b=ZrvFqegrkkfIsHM3afjHirUiWq/QKbBowhf2OOjf1OSD4da7AlLQoMarty+VycJulq8FnM wsmi2ORtMH/sDwGq9WnFxnUKjTj6YW9Y1FL9Nib3EuV+GzA+eAU/7Mtc/qJ0p06ID92urR Fp582ZDs0p6czOOVxLAnmbwu5NLOJ4qHN/dagjV5G0x9yRWPVj8BdiZiUSNILjWlDupsFI A2b5qHu3OWpegDT1gdrmrfkn1Yp8B5NC5Kt0lXsjrtQX/tyuFrGPgwefUaxkxMkI0/Q0YT 91WhfVlkvpm9da3SwkGcdudSf4x25aePpTWRNh5CchZEe6xPWe//z0tSxQCNpA== 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 4YYnWj0yTMzg0G; Thu, 16 Jan 2025 15:55: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 50GFtSqp045057; Thu, 16 Jan 2025 15:55:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GFtSNm045046; Thu, 16 Jan 2025 15:55:28 GMT (envelope-from git) Date: Thu, 16 Jan 2025 15:55:28 GMT Message-Id: <202501161555.50GFtSNm045046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 2759653c8523 - main - bus_generic_print_child.9: Add bus_print_child_{header,footer} List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2759653c8523f279cf0715d5cf641d2e029b6614 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2759653c8523f279cf0715d5cf641d2e029b6614 commit 2759653c8523f279cf0715d5cf641d2e029b6614 Author: John Baldwin AuthorDate: 2025-01-16 15:55:02 +0000 Commit: John Baldwin CommitDate: 2025-01-16 15:55:02 +0000 bus_generic_print_child.9: Add bus_print_child_{header,footer} These functions are already described in the body, just add them in the NAME and SYNOPSIS sections along with MLINKS. Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D48370 --- share/man/man9/Makefile | 2 ++ share/man/man9/bus_generic_print_child.9 | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 6e8edc3f698d..42564aa2ac72 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -692,6 +692,8 @@ MLINKS+=bus_dma.9 busdma.9 \ bus_dma.9 bus_dmamem_free.9 \ bus_dma.9 bus_dma_tag_create.9 \ bus_dma.9 bus_dma_tag_destroy.9 +MLINKS+=bus_generic_print_child.9 bus_print_child_footer.9 \ + bus_generic_print_child.9 bus_print_child_header.9 MLINKS+=bus_generic_read_ivar.9 bus_generic_write_ivar.9 MLINKS+=BUS_GET_CPUS.9 bus_get_cpus.9 MLINKS+=bus_map_resource.9 bus_unmap_resource.9 \ diff --git a/share/man/man9/bus_generic_print_child.9 b/share/man/man9/bus_generic_print_child.9 index 8c3bd4b0fc71..1adca331b016 100644 --- a/share/man/man9/bus_generic_print_child.9 +++ b/share/man/man9/bus_generic_print_child.9 @@ -26,11 +26,13 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 15, 2017 +.Dd January 16, 2025 .Dt BUS_GENERIC_PRINT_CHILD 9 .Os .Sh NAME -.Nm bus_generic_print_child +.Nm bus_generic_print_child , +.Nm bus_print_child_footer , +.Nm bus_print_child_header .Nd generic implementation of .Dv DEVICE_PRINT_CHILD for buses @@ -39,6 +41,10 @@ for buses .In sys/bus.h .Ft int .Fn bus_generic_print_child "device_t dev" "device_t child" +.Ft int +.Fn bus_print_child_footer "device_t dev" "device_t child" +.Ft int +.Fn bus_print_child_header "device_t dev" "device_t child" .Sh DESCRIPTION This implementation prints out the default device announcement message. Given device 'foo0' on bus 'bar0' where foo0 has the name "FooCard 1234" the From nobody Thu Jan 16 15:55:30 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYnWk2YRnz5kbWQ; Thu, 16 Jan 2025 15:55: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYnWk1Tm2z3BvW; Thu, 16 Jan 2025 15:55:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737042930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=64nXjzEpGdI5NA4ywOKsf4uYyh59RFPh+/t/U8gX6n0=; b=OK2+yfIy7EmAqJSirKqlB4TIqg4c11RVub6ixYl9vmBK+IbZ9FMBHn3WJkv6nYNCtbjBrL wDZLm3W4enpqNQFbsj4aSppMm3SxaNLKBc6nbMQ9jt8INhcmUC4y8pXTHmyuQ1FAhNn1nu ToTmTv2KrjMOfOcnT5t/JyTRX7WA8E9d77ANSsLD84wQ1ZHOmFlpABy+ck+nSIc0KO7FmL edyJ1hIcQHkeeu3WAa05sEg0VN3bYIe8U3zNQrNO3HVE2eLOs+CNZCyE68C/lc3k12LrLs lylmISNZhQGg+QT/aHuP+HxJ9VEN/SNLh1W+4cymEqiriQSPpwlEg6fnBPOdLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737042930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=64nXjzEpGdI5NA4ywOKsf4uYyh59RFPh+/t/U8gX6n0=; b=eH9NXRxmL2qlCzZ4jBwXqoSuFoIQHUFqVR02O0AGjkT2t/EXlfPLyro52x+rwlRrIhIn5v jFAG4Y4b5mLw2gOZdkJ7+PHRtFn+qqCUeSJ6LKBm4n8Whi8Z8TLvj4qF2Gb96tfsyWOq/y VmZt8EgSSU6STpPJ1Hw+TnqYMQ7FJRJ0PJ2osFbKyLyBGGNy+iMgJqV0OtFt+N1fEJDr9y 9xLoI9Xs0fNKeIvvZpHjWOniXSk6KTjBq0ShSv9ukW/uHrmyiwMZ5qj78tYFhFMCzEJ4PU aLP2bXGXB+2FDETc60ryfDiCxTLBvuJ5bSAssWBcITdJcUgpE9MUnmrait5jDw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737042930; a=rsa-sha256; cv=none; b=eZIk3WWFHvFG8ZNmqpOE4Lke2R0XuqXmCEZ1El6fFmhu9VJT8JGSmO1IBPnG50KWaODhE8 0YMz//AJZC+O3rar4iOfHM3NCukXZyHw9mHI93Eug2kvQGyvdWrkQRt3Hfp15gt9hrbj/I 9x3Nx0iiY/sJtRu+216yOxYXCKemXE5lP2sgW/t10uXhBksIWRUL63tPk2ZqxsuygA+Q3H EVxYNcCxkWRL8k0lwONEePPZ2Fty5byQns8jBvC/A4HGTpcud0FpDfOpIYLSnWopxD8Vr5 mhIv3r4hyhKlAsW8BYdNyiSpKv7yRf93++XgfBfk+L8n+H1YYLfOLrTdl4qhpA== 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 4YYnWk0x6kzg2L; Thu, 16 Jan 2025 15:55:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GFtUPG045155; Thu, 16 Jan 2025 15:55:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GFtUS7045152; Thu, 16 Jan 2025 15:55:30 GMT (envelope-from git) Date: Thu, 16 Jan 2025 15:55:30 GMT Message-Id: <202501161555.50GFtUS7045152@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e2012b81cb87 - main - BUS_CONFIG_INTR.9: Describe bus_config_intr() wrapper function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e2012b81cb87793be589cffa0a89d9b230df7c93 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e2012b81cb87793be589cffa0a89d9b230df7c93 commit e2012b81cb87793be589cffa0a89d9b230df7c93 Author: John Baldwin AuthorDate: 2025-01-16 15:55:20 +0000 Commit: John Baldwin CommitDate: 2025-01-16 15:55:20 +0000 BUS_CONFIG_INTR.9: Describe bus_config_intr() wrapper function Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D48372 --- share/man/man9/BUS_CONFIG_INTR.9 | 16 +++++++++++++--- share/man/man9/Makefile | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/share/man/man9/BUS_CONFIG_INTR.9 b/share/man/man9/BUS_CONFIG_INTR.9 index cf6ecbb4b823..aaeb6c3ec089 100644 --- a/share/man/man9/BUS_CONFIG_INTR.9 +++ b/share/man/man9/BUS_CONFIG_INTR.9 @@ -23,12 +23,13 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 15, 2017 +.Dd January 16, 2025 .Dt BUS_CONFIG_INTR 9 .Os .\" .Sh NAME -.Nm BUS_CONFIG_INTR +.Nm BUS_CONFIG_INTR , +.Nm bus_config_intr .Nd "configure interrupt polarity and trigger mode" .\" .Sh SYNOPSIS @@ -36,9 +37,13 @@ .In sys/bus.h .Ft int .Fo BUS_CONFIG_INTR +.Fa "device_t bus" "device_t dev" "int irq" "enum intr_trigger trig" +.Fa "enum intr_polarity pol" +.Fc +.Ft int +.Fo bus_config_intr .Fa "device_t dev" "int irq" "enum intr_trigger trig" "enum intr_polarity pol" .Fc -.\" .Sh DESCRIPTION The .Fn BUS_CONFIG_INTR @@ -53,6 +58,11 @@ that it is called prior to .Xr BUS_SETUP_INTR 9 . .Pp The +.Fn bus_config_intr +function is a simple wrapper around +.Fn BUS_CONFIG_INTR . +.Pp +The .Fa trig argument can be one of: .Bl -tag -width ".Dv INTR_TRIGGER_CONFORM" diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 42564aa2ac72..a284eaca5ecb 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -674,6 +674,7 @@ MLINKS+=buf_ring.9 buf_ring_alloc.9 \ MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9 MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9 MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9 +MLINKS+=BUS_CONFIG_INTR.9 bus_config_intr.9 MLINKS+=BUS_DESCRIBE_INTR.9 bus_describe_intr.9 MLINKS+=bus_dma.9 busdma.9 \ bus_dma.9 bus_dmamap_create.9 \ From nobody Thu Jan 16 16:03:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYnjN3W1qz5kcCy; Thu, 16 Jan 2025 16:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYnjN2kqjz3Dsb; Thu, 16 Jan 2025 16:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737043432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eW40lEsuNVOGALY6QmEu11h91+tbOlMVuLE1v+C3/i8=; b=xeli8kYOT8tog7oW3BLq0c1/JiePo0+iyjiU+pOJckxoaqagz6je/UoJEUgMRL3Fuy/b48 8xAPLcxI3VQedPvmZcAku2OsN4ZFTT2WVZURAhp6Xv0IaFweHhHn7LKKy1n/TC8m9aP0Dk HnwUb1KjMtpvVb8UaMCtMlirAYrTX4U2XyGjvMORMXAQsKd5GJcwTisg4AaYY7fPVhE4BJ bVajChIuZYWS7qpXlMZbkvSYSMSbXxbPkEXexxMlY7vCgwkfhHz7gBptmYQujcj4q4XUuO 9qndlS86s5ixYp629+yYkV/6MTPdCVsPzE+NF1eckd9PJlMpnPo6iFCXCwY3ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737043432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eW40lEsuNVOGALY6QmEu11h91+tbOlMVuLE1v+C3/i8=; b=QfXY/a56KjWu+8+srhg98tzPS1qlQHqfmklrSt9zRV0tNvAMJEZUDELBjYnK9uo+xxxTm0 /isTjl4ix0CFxN9AL/LOaxlcp2QbGNvssNFZBVT/8GxbTGh3dcMFe87uDz7t0HLQmPrh/q Y0C44E2EWzzSI6QQXv5wv4OuwGZan2iWj7LbqDEPV//BOk8sOf2jrI85PKB9YSTdlaDgCm h5NCNNxDn4uJCbt2HrqaPDlnItZQ7rhfRDnyfxIKCrdvx8wlGUc7k0DJbb08ZEH7ERckNb sBzKDpOvw/oxq8pNCdcJboZSw8Tut6fJ7JnFeCXr/Ug5/6paBgDlwS6kVTP4pw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737043432; a=rsa-sha256; cv=none; b=d4oLR7153Y9XdzS8ib648djr/69XpmhNBYi1F+wYw3py3Z6a/RIMzl27Ua+dgICbHtFeMN 1+pxyB4ojJTZXeP5gtVhQsQMlnjfcuKuYY/Au6EAatKuGt/HIan6UDRP+Olw8njq1mrNOU 3kouHNdzbxECpRGIEYY+JDq6H2JihlT9BrKkyY/qAR7U86cjj1MRvHEZxKAfELPwZWVawd iE29C19KRGEEb66Vol5RR79Hy69zjEK73I03FhFPfrZd8keD0w1uUjAEQ5b3TnZnyBxdS4 t4WfQVNSrHHXBMAJ5AYFVKlXXeaiOEZXcjrYXaA9U6rTBFbLzxgb3/ThkZqpzg== 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 4YYnjN2Kh6zg12; Thu, 16 Jan 2025 16:03:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GG3q8t064540; Thu, 16 Jan 2025 16:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GG3qM9064537; Thu, 16 Jan 2025 16:03:52 GMT (envelope-from git) Date: Thu, 16 Jan 2025 16:03:52 GMT Message-Id: <202501161603.50GG3qM9064537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 82fa7f83b53b - main - ls -lh: humanize the total List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82fa7f83b53b3c5b7f3a5c5560edc7caeeaa1029 Auto-Submitted: auto-generated The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=82fa7f83b53b3c5b7f3a5c5560edc7caeeaa1029 commit 82fa7f83b53b3c5b7f3a5c5560edc7caeeaa1029 Author: Piotr Paweł Stefaniak AuthorDate: 2025-01-06 17:59:03 +0000 Commit: Piotr Paweł Stefaniak CommitDate: 2025-01-16 16:00:17 +0000 ls -lh: humanize the total Before this change, the total printed on the first line was always in blocks. Now the long format with -h will print the "humanized number" instead. `ls -sh` never provided sizes in anything other than blocks, total or individual, and this commit doesn't change that. The total number of blocks is a sum of fts_statp->st_blocks, so it's multiplied by 512 and not by blocksize. $ ls -lh /usr/bin | head -n 2 total 442 MB -r-xr-xr-x 1 root wheel 70B Dec 20 21:06 CC Differential Revision: https://reviews.freebsd.org/D48329 --- bin/ls/ls.1 | 4 ++++ bin/ls/print.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index d86250b82db2..6aaa5025a6e1 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -539,6 +539,10 @@ which are listed as the directory's contents and .Pa .. and other files which start with a dot, depending on other options). +If the +.Fl h +option is given, +the total size is displayed as the number of bytes. .Pp The default block size is 512 bytes. The block size may be set with option diff --git a/bin/ls/print.c b/bin/ls/print.c index f651dea5de90..a504ec63dc26 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -210,7 +210,14 @@ printlong(const DISPLAY *dp) if ((dp->list == NULL || dp->list->fts_level != FTS_ROOTLEVEL) && (f_longform || f_size)) { - (void)printf("total %lu\n", howmany(dp->btotal, blocksize)); + if (!f_humanval) + (void)printf("total %lu\n", howmany(dp->btotal, blocksize)); + else { + (void)humanize_number(buf, 7 /* "1024 KB" */, + dp->btotal * 512, "B", HN_AUTOSCALE, HN_DECIMAL); + + (void)printf("total %s\n", buf); + } } for (p = dp->list; p; p = p->fts_link) { From nobody Thu Jan 16 16:03:53 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYnjP4hJXz5kc39; Thu, 16 Jan 2025 16:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYnjP3Z3Zz3DmH; Thu, 16 Jan 2025 16:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737043433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hamiwax/yokCbOzhy6Womnn4fEP5n6vpCxaPkEKffuU=; b=B32Ej8WP5cZFEBbfYY2gcF4tdvVspBOPs+Uo6NOCXt/wgda57M9FYvioyZcK31Zg1Q/L3O peDunEMS0xn2rURA8aPmgbWHEeAa4r70At9IymgIeEoJMHyRQE3MYQhLLlU8cOKKJUvqOy fS1rxrNaLHLocZR371t6iZ9Fya9hP+9zWddtRawk/UEOcT+jxiAFeyat+px9/Hl85nDoLv BEwToXsdUrH+qRpW7Mdqr7kDH297LYYri4jsOOYM+IsyGQ90ZQ+ZJqAJjasEh1bhxf3Bhz SaZ4vjPyc8vpYMMjw3hi/omZFf8lWW0uLvOL2r77QzrRalUSehp97S68EKJq0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737043433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hamiwax/yokCbOzhy6Womnn4fEP5n6vpCxaPkEKffuU=; b=Ns6/N1+RatT5W650ZtlYxpzKnguk5OhL52N0DbvunvortyjflL2LVawco//ocYKAonWUyN mvY2OkKRMADeCbe/1a2v/LbPoSzZ6bCEDQiwPL0UOYn8Gl1RF2OMl+VnHZ67AagUIUp6Qg JFtayDVoAt5QnC4orzkF5c6fCLqr6aHPyz/91aejPA9PlbxK7M1+IahgqlzAKrEO4E3g5q nRCbEuX7vfLPdmvTH3H/CW0LGWC6bfjd0cJT1nulXBGRoHG/qT9KcC7+IDaEP4XrajltXb waUF8jpOYcJ7eR0RsMNclIV2F+GO7NoyvX6zemqqzl8nTLnhmdkb/neq9ljUag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737043433; a=rsa-sha256; cv=none; b=CTWFYbYCSQnb7ixa6HtEDdGpmaPh/EXWyuFOWyUPd/Rm9XZVJ8dYiAUQdetEgnp1OVfhWz uUBdzCumL2xQ5+1hFba8uvcRMuNLs6+ogdPmX6kSt1e9vDh90efrCmwt5ZixMe/vryU/Cf JrdrZR/vCeNvvueVcFhNAokf7lmGukRZQXBj7mWn2lMprOFhEyEylSnX6y8FECjUht26m0 QdvVE9WunFqb2PQ+fC+5uE2cW1towwYBDJUb2g9roqFxgE2+WBzGAICheQ5Gs6sP6twfz2 C6JJawmEhu/G4AtRa5D54vLBXbuzAD2L+glHmgAlddf5zM5koYqiQezYXeUG7Q== 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 4YYnjP3794zg5h; Thu, 16 Jan 2025 16:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GG3rYS064610; Thu, 16 Jan 2025 16:03:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GG3rVW064607; Thu, 16 Jan 2025 16:03:53 GMT (envelope-from git) Date: Thu, 16 Jan 2025 16:03:53 GMT Message-Id: <202501161603.50GG3rVW064607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 8b92977857f8 - main - ls: implement --group-directories-first for compatibility with GNU ls List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8b92977857f8acaa539c21800b024edea9eee8b4 Auto-Submitted: auto-generated The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=8b92977857f8acaa539c21800b024edea9eee8b4 commit 8b92977857f8acaa539c21800b024edea9eee8b4 Author: Piotr Paweł Stefaniak AuthorDate: 2025-01-06 21:26:14 +0000 Commit: Piotr Paweł Stefaniak CommitDate: 2025-01-16 16:00:17 +0000 ls: implement --group-directories-first for compatibility with GNU ls Also implement --group-directories which takes a parameter. "first" is equivalent to --group-directories-first, "last" gives reversed sorting. Changes in sorting between elements of the same type (files, directories) are not intended. Differential Revision: https://reviews.freebsd.org/D48347 --- bin/ls/ls.1 | 19 ++++++++++++++++++- bin/ls/ls.c | 35 +++++++++++++++++++++++++++++++---- bin/ls/util.c | 4 ++-- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index 6aaa5025a6e1..b634f2f23ae6 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -39,6 +39,8 @@ .Nm .Op Fl ABCFGHILPRSTUWZabcdfghiklmnopqrstuvwxy1\&, .Op Fl -color Ns = Ns Ar when +.Op Fl -group-directories Ns = Ns Ar order +.Op Fl -group-directories-first .Op Fl D Ar format .Op Ar .Sh DESCRIPTION @@ -303,6 +305,16 @@ options. Display the long .Pq Fl l format output without the file owner's name or number. +.It Fl -group-directories Ns = Ns Ar order +Within results for each operand, +group directories together and print them either +.Cm first +or +.Cm last. +.It Fl -group-directories-first +Equivalent to +.Fl -group-directories Ns = Ns Ar first . +Implemented for compatibility with GNU coreutils. .It Fl h When used with the .Fl l @@ -914,8 +926,13 @@ and .St -p1003.1-2008 . The options .Fl B , D , G , I , T , U , W , Z , b , h , v , w , y -and +, .Fl , +.Fl -color +and +.Fl -group-directories Ns = +(including +.Fl -group-directories-first ) are non-standard extensions. .Pp The ACL support is compatible with diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 048cfc9293e6..ca0fb9877b7e 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -87,12 +87,24 @@ static void display(const FTSENT *, FTSENT *, int); static int mastercmp(const FTSENT * const *, const FTSENT * const *); static void traverse(int, char **, int); -#define COLOR_OPT (CHAR_MAX + 1) +enum { + GRP_NONE = 0, + GRP_DIR_FIRST = -1, + GRP_DIR_LAST = 1 +}; + +enum { + BIN_OPT = CHAR_MAX, + COLOR_OPT, + GROUP_OPT +}; static const struct option long_opts[] = { - {"color", optional_argument, NULL, COLOR_OPT}, - {NULL, no_argument, NULL, 0} + {"color", optional_argument, NULL, COLOR_OPT}, + {"group-directories", optional_argument, NULL, GROUP_OPT}, + {"group-directories-first", no_argument, NULL, GROUP_OPT}, + {NULL, no_argument, NULL, 0} }; static void (*printfcn)(const DISPLAY *); @@ -105,6 +117,7 @@ int termwidth = 80; /* default terminal width */ int f_accesstime; /* use time of last access */ int f_birthtime; /* use time of birth */ int f_flags; /* show flags associated with a file */ +static int f_groupdir = GRP_NONE;/* group directories first/last */ int f_humanval; /* show human-readable file sizes */ int f_inode; /* print inode */ static int f_kblocks; /* print size in kilobytes */ @@ -449,6 +462,15 @@ main(int argc, char *argv[]) case 'y': f_samesort = 1; break; + case GROUP_OPT: + if (optarg == NULL || strcmp(optarg, "first") == 0) + f_groupdir = GRP_DIR_FIRST; + else if (strcmp(optarg, "last") == 0) + f_groupdir = GRP_DIR_LAST; + else + errx(2, "unsupported --group-directories value '%s' (must be first or last)", + optarg); + break; case COLOR_OPT: #ifdef COLORLS if (optarg == NULL || do_color_always(optarg)) @@ -1004,7 +1026,7 @@ label_out: static int mastercmp(const FTSENT * const *a, const FTSENT * const *b) { - int a_info, b_info; + int a_info, b_info, dir; a_info = (*a)->fts_info; if (a_info == FTS_ERR) @@ -1023,5 +1045,10 @@ mastercmp(const FTSENT * const *a, const FTSENT * const *b) if (b_info == FTS_D) return (-1); } + + if (f_groupdir != GRP_NONE) + if ((dir = (a_info == FTS_D) - (b_info == FTS_D)) != 0) + return (f_groupdir * dir); + return (sortfcn(*a, *b)); } diff --git a/bin/ls/util.c b/bin/ls/util.c index 40610faa5fae..d83cae0e98d1 100644 --- a/bin/ls/util.c +++ b/bin/ls/util.c @@ -219,9 +219,9 @@ usage(void) { (void)fprintf(stderr, #ifdef COLORLS - "usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuvwxy1,] [--color=when] [-D format]" + "usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuvwxy1,] [--color=when] [-D format] [--group-directories=]" #else - "usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuvwxy1,] [-D format]" + "usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuvwxy1,] [-D format] [--group-directories=]" #endif " [file ...]\n"); exit(1); From nobody Thu Jan 16 16:09:22 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYnqk6LQZz5kckS; Thu, 16 Jan 2025 16:09:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYnqk5cyBz3FYm; Thu, 16 Jan 2025 16:09:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737043762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iO2dRVQ+CM3iYmSi/OFuXXLlMSHNEzR5JQW8FaqHA5I=; b=SHlDShTHh4PePPQaaRm6/3qO3LxSbto9AcN46apVS52JDaxz9RoHejwR8ae0M0mCwIRoZw Cl2RKR/xeWZi/YnxMIHZN+mzaAMwTqbSG2dqxK4GJhiX5CAPyxEasyA4eQaQVG4nzgwvR+ 4OyHAKQ5toHT/gd9BTVYHkCIMIi+V/LJxNQj5vr3po6/sCLpJrSy1H668URJSw7q+rfsE0 wFkD5+1MJSlfJIOXldpaKnUmljNO0Z389cybM8RUKfRB2fAiSZgxOCjOynJVWBrciBoCeL Pqzm/l1+SswSDts7e+CcRW3ZmkXX15ZzVtxsJDr1Nyni7AWeyA8GiF76724w7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737043762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iO2dRVQ+CM3iYmSi/OFuXXLlMSHNEzR5JQW8FaqHA5I=; b=Wf8q19UuL/iv55H1wmgTCrqkGiRR/owGU7XEJiQMiMvNCHSwM8OxvqbYsWIGEzLK/R96wJ BdQ41B4JQwEaUyiZDMYXzHi7GHNv6rvoghL418khYHExIuISEIL5w/8EpT9FUXdChkvADc kafLrK2touIG7Ais5M9SqGg3OrG93uJrzcNu3u4klrI/JMSBoHVAvOZIE5El/kB57+/uCD zwjLTUNckw6MXz8kPxMoUKc7HlpEL6jXnzStEVlXZAxRAywigosnYMZLLePoQd6o+s8VZl 6gbjN9Tl6g7OmTfmvTpZY7Jya+koIMSFuITXI+3c8Hroy6l7bMuMRd1uaypCRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737043762; a=rsa-sha256; cv=none; b=fKwg8eMQOrsLf6Ps94s62BbPVyId3lLKE7GsCHbTLaAmTcd0UMZcG0BoYzP3oU2PjZCXTD I15ueXXxZFZlSFppLPAeGWyh6iBKG3iEqNk91/IWFWIN1C5N4jZE/hllK5lGF7My1nLrMa 80KiysOWABXHD/vHF4wkE6mf33Ens9LOmyUND8m1fGmuf6uU8csgNfDd4Cqj92XFYPnICi QE5JixJNR+THfNmSAAx6fvnWFKkgaAiB7xs/2vk17Y3sVjna/H+XwFaIX/UGal9z5t2SJA lJN8mLbyC4O6LVDhHQrbZIGRv1/6FUrv0ER6fFNpIg6jEhP3sChGzPIch6qXLg== 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 4YYnqk5ClKzf53; Thu, 16 Jan 2025 16:09:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GG9MMW066387; Thu, 16 Jan 2025 16:09:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GG9Mkb066384; Thu, 16 Jan 2025 16:09:22 GMT (envelope-from git) Date: Thu, 16 Jan 2025 16:09:22 GMT Message-Id: <202501161609.50GG9Mkb066384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 4ed2448a4f2b - main - ls.1: bump date after 82fa7f83b53b and 8b92977857f8 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ed2448a4f2b32d0c4055c282e4cc2b691d621ed Auto-Submitted: auto-generated The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=4ed2448a4f2b32d0c4055c282e4cc2b691d621ed commit 4ed2448a4f2b32d0c4055c282e4cc2b691d621ed Author: Piotr Paweł Stefaniak AuthorDate: 2025-01-16 16:05:43 +0000 Commit: Piotr Paweł Stefaniak CommitDate: 2025-01-16 16:05:43 +0000 ls.1: bump date after 82fa7f83b53b and 8b92977857f8 --- bin/ls/ls.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index b634f2f23ae6..9621959821be 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 22, 2024 +.Dd January 16, 2025 .Dt LS 1 .Os .Sh NAME From nobody Thu Jan 16 16:54:54 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYprG6Z0Nz5kfvM; Thu, 16 Jan 2025 16:54:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYprG5rKdz3Ktb; Thu, 16 Jan 2025 16:54:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737046494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qCoXtvho4vgiYLduib5Zb3aL2rzK/Ah4L4EQY4IjlmU=; b=IVTEYjfquz6ZHGm40QPF2YskkJ7wBYjDQS83fipWeoDKZOUFHS5XDTFfnUYF0bbMADSoH/ jtWnNmCOexNjH1G16D0KhFDSt9TrIXD0T5HzQcegrPJk5YW2LdGEH8UqLrm2PhS6SE7xAd 553T1sWUlVhzAaQGXX4t1wtQIX59x6yopuE69J7DJ6h+PoAL+4dtaIvG93WUiogUzDob0q zRa3Z4Icdye0fvwk2N0lpy0OA/YHCTwTNSYYAh6UZwdZs+wY1Te5WD5wRaqgK2hICa0uqb 94csEPgTzt88SSMjdIr67EDwVOhiglZth3FF4ovDmcNE7RgWW8f/hUeDtqa72Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737046494; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qCoXtvho4vgiYLduib5Zb3aL2rzK/Ah4L4EQY4IjlmU=; b=npx9PBAQAbE46Ik7ALAR1raWkKx2SKiGIFwIE0XG7U4MfSwAZ8MuOI4g4+Q1FXQ5fr1vT/ shnadyuJ5XSMXwv/pGG+QP6ZtQbknIPeSCY9nB1r9g8TJMO2CbvFGNVT6MJsjp113Ciu0V v7ztpvfo1y21X+DhfaZfU01PeRyWCkdFeoUxT+3sD9mxFgQWQAYkoexopHUYw0W/DPBwCL +8Wf/EsDoA2Qd1QQwUjUEQPcDrtT5JLcy96s9UqjFxzkKPx2u/uRdi8wjM2njl9igcRZDa AsPGFI7r4HvJtMGmOyFg6+4jsV0YYIV2FeH98MCgogkwzqxEhJ0SuaiPqKNurQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737046494; a=rsa-sha256; cv=none; b=kq+SJiH8VtgdcssvqpirBIGu8k5QOljCmm3K9LZpXjU/2xgb5c0NjuDVzO5FaROHh9SSG4 hxw0dIgSt/2DLsQK7HmVpkOoEJhGdA7XvLK2GMHcgTGwPjrF4P+yTCZHkk55VLtxN14GRH Mf59Xv4O4VASrXjJvo6km5bRkGR7l5+aEiEqP2rxqNIn+5RqGpUhj8lNYnGsGcAid6ZMDr Xns8cvxSX9MnDqmWtLzWEEWXWOCSPWquI8PjwBq8FIgG2stcVH3EqO1+YUZweC/BNxUjft h2tHyz+2lURU7ba4qf79u+gawapVevYcxpyLzYoUfStC2RFYNSKCMYb2nEZ69w== 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 4YYprG5L7szhGk; Thu, 16 Jan 2025 16:54:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GGsslc057842; Thu, 16 Jan 2025 16:54:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GGssak057839; Thu, 16 Jan 2025 16:54:54 GMT (envelope-from git) Date: Thu, 16 Jan 2025 16:54:54 GMT Message-Id: <202501161654.50GGssak057839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c1557708f1fa - main - pkg: Fix Coverity warnings List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c1557708f1fae1bb9c8e23e3bbb2aa2b055e1211 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c1557708f1fae1bb9c8e23e3bbb2aa2b055e1211 commit c1557708f1fae1bb9c8e23e3bbb2aa2b055e1211 Author: Mark Johnston AuthorDate: 2025-01-16 15:09:58 +0000 Commit: Mark Johnston CommitDate: 2025-01-16 16:45:15 +0000 pkg: Fix Coverity warnings - Fix allocation size in config_get_repositories(). - Fix a memory leak in read_conf_file(). - Avoid a null pointer dereference in an error path in verify_pubsignature(). Fixes: e3b4a51580fc ("pkg(7): expand VERSION_MAJOR, VERSION_MINOR, RELEASE and OSNAME") Fixes: dc4581589a32 ("pkg: clean support for repositories") --- usr.sbin/pkg/config.c | 17 ++++++++++------- usr.sbin/pkg/pkg.c | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 26d7dd66b2a4..6649e75b7f6b 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -476,9 +476,9 @@ read_conf_file(const char *confpath, const char *requested_repo, { struct ucl_parser *p; ucl_object_t *obj = NULL; - const char *abi = pkg_get_myabi(); - char *major, *minor; + char *abi = pkg_get_myabi(), *major, *minor; struct utsname uts; + int ret; if (uname(&uts)) err(EXIT_FAILURE, "uname"); @@ -502,9 +502,9 @@ read_conf_file(const char *confpath, const char *requested_repo, if (errno != ENOENT) errx(EXIT_FAILURE, "Unable to parse configuration " "file %s: %s", confpath, ucl_parser_get_error(p)); - ucl_parser_free(p); /* no configuration present */ - return (1); + ret = 1; + goto out; } obj = ucl_parser_get_object(p); @@ -517,13 +517,16 @@ read_conf_file(const char *confpath, const char *requested_repo, else if (conftype == CONFFILE_REPO) parse_repo_file(obj, requested_repo); } - ucl_object_unref(obj); + + ret = 0; +out: ucl_parser_free(p); + free(abi); free(major); free(minor); - return (0); + return (ret); } static void @@ -674,7 +677,7 @@ config_get_repositories(void) { if (STAILQ_EMPTY(&repositories)) { /* Fall back to PACKAGESITE - deprecated - */ - struct repository *r = calloc(1, sizeof(r)); + struct repository *r = calloc(1, sizeof(*r)); if (r == NULL) err(EXIT_FAILURE, "calloc"); r->name = strdup("fallback"); diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 21ee1cd4bd30..92fdbf0ebff8 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -664,7 +664,7 @@ verify_pubsignature(int fd_pkg, int fd_sig, struct repository *r) pubkey = r->pubkey; } else { if (config_string(PUBKEY, &pubkey) != 0) { - warnx("No CONFIG_PUBKEY defined for %s", r->name); + warnx("No CONFIG_PUBKEY defined"); goto cleanup; } } From nobody Thu Jan 16 16:54:55 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYprJ0wnBz5kfn3; Thu, 16 Jan 2025 16:54:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYprH74t9z3Ktc; Thu, 16 Jan 2025 16:54:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737046496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3DIwWxyXOkwweE15Y3YAGjT3cddB8giz5OOkEd5I2Vg=; b=A/K5C4VeP3C4o+zvm0FXGdYryUHhRx5VFT5dnY8C3q6ZHhtFbvJWsyYYKFbg91fL2Q9MxF +V2VHHGaoQhJLI3pkvxVQI0ljtEftFZGXBs+GDE7G6Yzrsu0Uxl5O0z7r7SPmmaOUoQ8fB 56SbWpCNh5nU9ISqbBhLvpIWvLxsrnYJ0BXodhm5TTbv6QCtkVskUpfPzowYFO7kb0sNn8 Q+bBLf8+Aj/bMOPCLk/vKhpiCZL1lmLbz+j1DatdSmq/S4ecW17eVPh4asVdCKkeHxu4bA QrkeACr87iOWr9rXJmhQiJSW1BNz1Q1cKbEBrHDY4pFYrQn8nQn0SSyvA/4iLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737046496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3DIwWxyXOkwweE15Y3YAGjT3cddB8giz5OOkEd5I2Vg=; b=jtqgsXn0GG2EK8LKDYKOTwRVZMESyVcFthXYvLvWepg1S2RGl4Z65NGpNci0cJ2Vfa/Tmz 2G4C8k9vBWH55nGzaHxsugDzMNl7P8o62I7PnYrh1IYHuMe8mwklsGSTTd4HOhT4rfzl5U JMxafI31KInYi6FXkk1TuJLUSl+sYk8l1SgUqapC1WAzzublvO4Q2NhA0boSPYzryKuWhX ywjM8rADJLZzbLne4yCKb97Q0pOY6p5XezOulVUXBN4nfKw0etyhdTEzZXM9AQmXcTOiWI +xQnIjr2nWjPlq658F86MZ5HTP+dxuSEap6sgMygsKftD/DvjF9DCZcPLkAn+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737046496; a=rsa-sha256; cv=none; b=PpUEPMP0XixozJMgnWuvAC+KAHmNM7pJkdAiYN+ei1wdxjaajmJHlgBCGJLW7nF2z3vYz+ Jn/Jm0UoV2Twt315gf9xdFv+G5aH+CAjjWnDpnwk/xVGtBiyXCNFgsXUrXSa6k26tkEf1m DgIiiJXLQOLAhgsmFeQN3brNOE++F3rQktLBwPHQYwQjv5ftGwm5+KyhNazTbdf3fAwFbA rg3lmioztXOIahwLb6WH9m4hpRLRp7877sQvWK7vTIhc8uYrcviF+2Eqx3dIO+iIX9/me8 Yh4izAwCUGnGtcniPYeBWXJqdp3yxFxjh+Q9GeihMpJQAANk7c52R7gXmgUdfg== 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 4YYprH6MSkzhGl; Thu, 16 Jan 2025 16:54:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GGstBb057888; Thu, 16 Jan 2025 16:54:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GGstxb057884; Thu, 16 Jan 2025 16:54:55 GMT (envelope-from git) Date: Thu, 16 Jan 2025 16:54:55 GMT Message-Id: <202501161654.50GGstxb057884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 886396f1b1a7 - main - pf: Force logging if pf_create_state() fails List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 886396f1b1a727c642071965612e2c2c9dd11d6c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=886396f1b1a727c642071965612e2c2c9dd11d6c commit 886396f1b1a727c642071965612e2c2c9dd11d6c Author: Mark Johnston AuthorDate: 2025-01-16 15:44:40 +0000 Commit: Mark Johnston CommitDate: 2025-01-16 16:45:16 +0000 pf: Force logging if pf_create_state() fails Currently packets are logged before pf_create_state() is called, so we might log a packet as passed that is subsequently dropped due to state creation failure. In particular, the drop is not logged, which is wrong. Improve the situation a bit: force logging if state creation fails. This isn't totally right as we'll end up logging the packet twice in this case, but it's better than not logging the drop at all. Add a regression test. Discussed with: kp, ks Co-authored-by: Franco Fichtner MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: OPNsense Differential Revision: https://reviews.freebsd.org/D47953 --- sys/netpfil/pf/pf.c | 1 + tests/sys/netpfil/pf/pflog.sh | 64 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a49216a9dc20..cfab6a828d5f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -5911,6 +5911,7 @@ nextrule: &match_rules, udp_mapping); if (action != PF_PASS) { pf_udp_mapping_release(udp_mapping); + pd->act.log |= PF_LOG_FORCE; if (action == PF_DROP && (r->rule_flag & PFRULE_RETURN)) pf_return(r, nr, pd, sk, th, diff --git a/tests/sys/netpfil/pf/pflog.sh b/tests/sys/netpfil/pf/pflog.sh index f5a1241cb5a8..968d165f3dcb 100644 --- a/tests/sys/netpfil/pf/pflog.sh +++ b/tests/sys/netpfil/pf/pflog.sh @@ -2,6 +2,7 @@ # SPDX-License-Identifier: BSD-2-Clause # # Copyright (c) 2023 Rubicon Communications, LLC (Netgate) +# Copyright (c) 2024 Deciso B.V. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -132,8 +133,71 @@ matches_cleanup() pft_cleanup } +atf_test_case "state_max" "cleanup" +state_max_head() +{ + atf_set descr 'Ensure that drops due to state limits are logged' + atf_set require.user root +} + +state_max_body() +{ + pflog_init + + epair=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair}a + jexec alcatraz ifconfig ${epair}a 192.0.2.1/24 up + + ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + jexec alcatraz pfctl -e + jexec alcatraz ifconfig pflog0 up + pft_set_rules alcatraz "pass log inet keep state (max 1)" + + jexec alcatraz tcpdump -n -e -ttt --immediate-mode -l -U -i pflog0 >> ${PWD}/pflog.txt & + sleep 1 # Wait for tcpdump to start + + atf_check -s exit:0 -o ignore \ + ping -c 1 192.0.2.1 + + atf_check -s exit:2 -o ignore \ + ping -c 1 192.0.2.1 + + echo "Rules" + jexec alcatraz pfctl -sr -vv + echo "States" + jexec alcatraz pfctl -ss -vv + echo "Log" + cat ${PWD}/pflog.txt + + # First ping passes. + atf_check -o match:".*rule 0/0\(match\): pass in on ${epair}a: 192.0.2.2 > 192.0.2.1: ICMP echo request.*" \ + cat pflog.txt + + # Second ping is blocked due to the state limit. + atf_check -o match:".*rule 0/0\(match\): block in on ${epair}a: 192.0.2.2 > 192.0.2.1: ICMP echo request.*" \ + cat pflog.txt + + # At most three lines should be written: one for the first ping, and + # two for the second: one for the initial pass through the ruleset, and + # then a drop because of the state limit. Ideally only the drop would + # be logged; if this is fixed, the count will be 2 instead of 3. + atf_check -o match:3 grep -c . pflog.txt +} + +state_max_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "malformed" atf_add_test_case "matches" + atf_add_test_case "state_max" } From nobody Thu Jan 16 16:54:56 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYprL212kz5kfl8; Thu, 16 Jan 2025 16:54:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYprK5Yz2z3Kp0; Thu, 16 Jan 2025 16:54:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737046497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+Y19IQN5JCvA9oiAKd3XtaGun5i32xpLuGFcc/fwWyE=; b=NnBMsYpyQcJVAkspdq+9IhawR7KuO/fB0Ao7kNqim0O7r0wl3Q8UkeMHqGIXO5EUnsWX99 vJ4VrKBrmvihc95OBdQUtTsHcQPh0r1dDUjyqTiEEznpbrnhBa2rr4Rg8NWW3cwgaeRHNp jpgpGXn1ayxfbHnKQwKmGqLBhiQUZoMFI9DN46czNreZbBkSJ/kjZmapGykOACKb3QXzMh t3pDtQ5esuBZROEFDjFTNnoPJ5T17kNlYxJYVtsphY9TxDquNCYVNQilJykyTUufgpzM+X Pck23goIuH83pqQacARwNlc1V3EuZiCQof0Ezm3WR7jxLEQfYlFrLOH53Lo66w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737046497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+Y19IQN5JCvA9oiAKd3XtaGun5i32xpLuGFcc/fwWyE=; b=Vmun4dzPrqr5x6AyerbVorC5n/EkmgYM8HbIq15h3hdKTJyB4d8aKDoMso00blT+Bp8+Ar NHj0Q1NFKaYtBSCjP7eyZSdMoLeYNNaQ/6kdW/0iVofaFH9Quv+IvFVUaM3cN2dD95CfLj zq+AYN1dg2Q5AYq0aarEq2ERNNjJaD+nY1QrppL88ZgajUCEgtNh5Rert+0c3A9MjUdob5 BgaBK3pRsah9N2k891yzsuKTzHv/3FepCKziuwzw7NnOukIWB9ikSWaxmA5RvNGoEAt0xm TX+cAc7Ekmv5TuQHByH/OuOH92u3LOuq3Z6Z37pyOOzPnlNnrRo7ug2DMU0xTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737046497; a=rsa-sha256; cv=none; b=H/s0U3F5SOLf5/stKJZqmlQyshA4y/sIGkuK/SZrQfcVrdQPbntJVfSVWVt538iVcOi7Oo u+8ND6KukCp8WRPe8kvwyhWhIOT7KOMhhEyizeIuGbSanIX7/DWYaK/k+fWwRV0q9wz94l +fB8y222NLsmkFBrUnCkZl72Wb2PVMmNBoUptxS68h5t/7y6KCLjUJVg9kacYKRjuBYSYG PpM3h9QBtyFhv0P0Po71whD6I5jf+HmvhCBXL+xOAoRsJHHJ+pp2oDmYzQffc6m6ch9d0Q K8gJClq0XpeX8Jqm+G6YlzDqGcdHZp2XLjtSPyuNT4qH9WlQAN1jfJDe9fPqgg== 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 4YYprK0ZH7zhbj; Thu, 16 Jan 2025 16:54:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GGsuml057975; Thu, 16 Jan 2025 16:54:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GGsusJ057970; Thu, 16 Jan 2025 16:54:56 GMT (envelope-from git) Date: Thu, 16 Jan 2025 16:54:56 GMT Message-Id: <202501161654.50GGsusJ057970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 40faf87894ff - main - ip: Defer checks for an unspecified dstaddr until after pfil hooks List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40faf87894ff67ffdf8126fce9bb438ddf61a26f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=40faf87894ff67ffdf8126fce9bb438ddf61a26f commit 40faf87894ff67ffdf8126fce9bb438ddf61a26f Author: Mark Johnston AuthorDate: 2025-01-16 15:46:37 +0000 Commit: Mark Johnston CommitDate: 2025-01-16 16:45:16 +0000 ip: Defer checks for an unspecified dstaddr until after pfil hooks To comply with Common Criteria certification requirements, it may be necessary to ensure that packets to 0.0.0.0/::0 are dropped and logged by the system firewall. Currently, such packets are dropped by ip_input() and ip6_input() before reaching pfil hooks; let's defer the checks slightly to give firewalls a chance to drop the packets themselves, as this gives better observability. Add some regression tests for this with pf+pflog. Note that prior to commit 713264f6b8b, v4 packets to the unspecified address were not dropped by the IP stack at all. Note that ip_forward() and ip6_forward() ensure that such packets are not forwarded; they are passed back unmodified. Add a regression test which ensures that such packets are visible to pflog. Reviewed by: glebius MFC after: 3 weeks Sponsored by: Klara, Inc. Sponsored by: OPNsense Differential Revision: https://reviews.freebsd.org/D48163 --- sys/netinet/ip_input.c | 16 +++++++--- sys/netinet6/ip6_fastfwd.c | 1 + sys/netinet6/ip6_input.c | 17 +++++++++-- tests/sys/netpfil/pf/pflog.sh | 71 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 8 deletions(-) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index e00f3b77c74c..3c340b376433 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -521,11 +521,6 @@ ip_input(struct mbuf *m) goto bad; } } - /* The unspecified address can appear only as a src address - RFC1122 */ - if (__predict_false(ntohl(ip->ip_dst.s_addr) == INADDR_ANY)) { - IPSTAT_INC(ips_badaddr); - goto bad; - } if (m->m_pkthdr.csum_flags & CSUM_IP_CHECKED) { sum = !(m->m_pkthdr.csum_flags & CSUM_IP_VALID); @@ -641,6 +636,17 @@ tooshort: } } passin: + /* + * The unspecified address can appear only as a src address - RFC1122. + * + * The check is deferred to here to give firewalls a chance to block + * (and log) such packets. ip_tryforward() will not process such + * packets. + */ + if (__predict_false(ntohl(ip->ip_dst.s_addr) == INADDR_ANY)) { + IPSTAT_INC(ips_badaddr); + goto bad; + } /* * Process options and, if not destined for us, diff --git a/sys/netinet6/ip6_fastfwd.c b/sys/netinet6/ip6_fastfwd.c index 08531cee05bf..0ed313bd49a5 100644 --- a/sys/netinet6/ip6_fastfwd.c +++ b/sys/netinet6/ip6_fastfwd.c @@ -107,6 +107,7 @@ ip6_tryforward(struct mbuf *m) IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst) || IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src) || + IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) || in6_localip(&ip6->ip6_dst)) return (m); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index ec819a12628d..68e4be66537b 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -621,10 +621,10 @@ ip6_input(struct mbuf *m) IP_PROBE(receive, NULL, NULL, ip6, rcvif, NULL, ip6); /* - * Check against address spoofing/corruption. + * Check against address spoofing/corruption. The unspecified address + * is checked further below. */ - if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src) || - IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst)) { + if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src)) { /* * XXX: "badscope" is not very suitable for a multicast source. */ @@ -749,6 +749,17 @@ ip6_input(struct mbuf *m) } passin: + /* + * The check is deferred to here to give firewalls a chance to block + * (and log) such packets. ip6_tryforward() will not process such + * packets. + */ + if (__predict_false(IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst))) { + IP6STAT_INC(ip6s_badscope); + in6_ifstat_inc(rcvif, ifs6_in_addrerr); + goto bad; + } + /* * Disambiguate address scope zones (if there is ambiguity). * We first make sure that the original source or destination address diff --git a/tests/sys/netpfil/pf/pflog.sh b/tests/sys/netpfil/pf/pflog.sh index 968d165f3dcb..8288d1d263e8 100644 --- a/tests/sys/netpfil/pf/pflog.sh +++ b/tests/sys/netpfil/pf/pflog.sh @@ -195,9 +195,80 @@ state_max_cleanup() pft_cleanup } +atf_test_case "unspecified_v4" "cleanup" +unspecified_v4_head() +{ + atf_set descr 'Ensure that packets to the unspecified address are visible to pfil hooks' + atf_set require.user root +} + +unspecified_v4_body() +{ + pflog_init + + vnet_mkjail alcatraz + jexec alcatraz ifconfig lo0 inet 127.0.0.1 + jexec alcatraz route add default 127.0.0.1 + + jexec alcatraz pfctl -e + jexec alcatraz ifconfig pflog0 up + pft_set_rules alcatraz "block log on lo0 to 0.0.0.0" + + jexec alcatraz tcpdump -n -e -ttt --immediate-mode -l -U -i pflog0 >> pflog.txt & + sleep 1 # Wait for tcpdump to start + + atf_check -s not-exit:0 -o ignore -e ignore \ + jexec alcatraz ping -S 127.0.0.1 -c 1 0.0.0.0 + + atf_check -o match:".*: block out on lo0: 127.0.0.1 > 0.0.0.0: ICMP echo request,.*" \ + cat pflog.txt +} + +unspecified_v4_cleanup() +{ + pft_cleanup +} + +atf_test_case "unspecified_v6" "cleanup" +unspecified_v6_head() +{ + atf_set descr 'Ensure that packets to the unspecified address are visible to pfil hooks' + atf_set require.user root +} + +unspecified_v6_body() +{ + pflog_init + + vnet_mkjail alcatraz + jexec alcatraz ifconfig lo0 up + jexec alcatraz route -6 add ::0 ::1 + + jexec alcatraz pfctl -e + jexec alcatraz ifconfig pflog0 up + pft_set_rules alcatraz "block log on lo0 to ::0" + + jexec alcatraz tcpdump -n -e -ttt --immediate-mode -l -U -i pflog0 >> pflog.txt & + sleep 1 # Wait for tcpdump to start + + atf_check -s not-exit:0 -o ignore -e ignore \ + jexec alcatraz ping -6 -S ::1 -c 1 ::0 + + cat pflog.txt + atf_check -o match:".*: block out on lo0: ::1 > ::: ICMP6, echo request,.*" \ + cat pflog.txt +} + +unspecified_v6_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "malformed" atf_add_test_case "matches" atf_add_test_case "state_max" + atf_add_test_case "unspecified_v4" + atf_add_test_case "unspecified_v6" } From nobody Thu Jan 16 17:33:11 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYqhR6dSHz5kj2r; Thu, 16 Jan 2025 17:33:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYqhR5m3pz3NlV; Thu, 16 Jan 2025 17:33:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737048791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GeoFUnum3GqjyFnCkI1IrDq9LegW05589futcJsIwJg=; b=JNFo55TOuTpkjSyLGJKyTnJOkB/SvsEACkC749FS5+XipZVOH+3boVG+aN+VdxDm8MgEwE lwKGcSFLuO7o8lQSB61gb6E1esaPdrA6t+r63tQI6QlcMNgmK+pqAvhYcFiXVa39ArEKCy pMq14ryefcqb7arAewE5GltzA37vvXQMBdGwxNqXdWdf8GneYuWM+sdGZW5FQMxykSular 0nD7XXCsHE/GARoF95Bn/VoK941MGVUtVgL4UkIMa8nArxgc6vBI4RiCh4DPeMgdkINx1b XHWm1lnm8q0feDCWaq0H0Bt5hJ+4wKlNqc4UiHer9mM5uKicCcDtDoSFMq40Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737048791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GeoFUnum3GqjyFnCkI1IrDq9LegW05589futcJsIwJg=; b=v7ejl8upPB+66PjCE6FmBBaC0h+KdcgbH240yJImI0t1AS+0aU1mWFJKL56m33dQIwzheC V/I3msenX62Nn1/U1MNB0nrx61FOjaTWb4ZyoL+h/iY4slhch55YPPFZ8EdrOSqxXof/lz CvFUA4XK2E+fzBRPqZQ7tRnFOQPFRcA3lTXFcX0HdAQLwkWfYXp3vimxjERHBSxVdVOwJ1 bwIeDSrGWiJw/lHKTtw1CQT4R36qrTYNVW/7pVAJDv3ijmFFvlm/vPFMhCGZKZHM2areHr 71+bPoo7S+OyTHCsf1jTfn9XVF9dW6UzNfnXbitk6EbXOBL7bGdUdcdHL9WrTw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737048791; a=rsa-sha256; cv=none; b=u3AcoHA+LNKKVK0tTQh7BXCgmD3KyLlPZBFT1wy22AVzQQp0dRFHTznMWYW3XzB9Bp1MeR tCK3yJNyLdv0dC8uTflHnUY6dpgkMNkECdtrcxKxHS0RsL2fiNdd8LKKuyyXwBt20W3EBT FdmE1PH+6bLTbFbEqqtww/ps5TnD1Tq05WFuM9OdQcm97p6vSwyvAc9kbAbUEYwPhwUBZ3 4dLkJBd21iAQA9Zkrw5pjUU2nBK7HBXBTmF2cGg4m1recqYfNN0/DpPucVpMS8+Rs4KVVZ OiGC8jmNUbI9k7PxgK4cAOFHm9OTfrOczXaZCg+8+IHEFIqM9xfyJKT3I87kMA== 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 4YYqhR5FfTzhtG; Thu, 16 Jan 2025 17:33: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 50GHXBUG033546; Thu, 16 Jan 2025 17:33:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GHXBV9033543; Thu, 16 Jan 2025 17:33:11 GMT (envelope-from git) Date: Thu, 16 Jan 2025 17:33:11 GMT Message-Id: <202501161733.50GHXBV9033543@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 6f2775548278 - main - armada38x: implement gateclk clkdev methods List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6f2775548278c76e7c33b15aaaaa759270a8dcd5 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6f2775548278c76e7c33b15aaaaa759270a8dcd5 commit 6f2775548278c76e7c33b15aaaaa759270a8dcd5 Author: Mitchell Horne AuthorDate: 2024-04-15 20:18:25 +0000 Commit: Mitchell Horne CommitDate: 2025-01-16 17:27:00 +0000 armada38x: implement gateclk clkdev methods Implement basic clkdev methods required by the generic clk_gate device. This should make it functional, and prevent panics when invoking the clock's CLKNODE_GET_GATE method (e.g. with `sysctl -a`). Additionally, we need to fill in other key fields of the clk_gate_def structure before registering each clk. PR: 278188 Reported by: solo_code@protonmail.com Tested by: solo_code@protonmail.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48419 --- sys/arm/mv/clk/armada38x_gateclk.c | 99 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 5 deletions(-) diff --git a/sys/arm/mv/clk/armada38x_gateclk.c b/sys/arm/mv/clk/armada38x_gateclk.c index 24355d9c9dac..0cc91b447199 100644 --- a/sys/arm/mv/clk/armada38x_gateclk.c +++ b/sys/arm/mv/clk/armada38x_gateclk.c @@ -43,11 +43,22 @@ #include "clkdev_if.h" +#define ARMADA38X_GATECLK_MAXREG 0 + +static struct resource_spec armada38x_gateclk_specs[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +#define RD4(_sc, addr) bus_read_4(_sc->res, addr) +#define WR4(_sc, addr, val) bus_write_4(_sc->res, addr, val) + struct armada38x_gateclk_softc { - struct clkdom *clkdom; - struct mtx mtx; - const char* parent; + struct resource *res; + struct clkdom *clkdom; + struct mtx mtx; + const char* parent; }; static struct clk_gate_def gateclk_nodes[] = @@ -219,10 +230,75 @@ static struct clk_gate_def gateclk_nodes[] = static int armada38x_gateclk_probe(device_t dev); static int armada38x_gateclk_attach(device_t dev); +static int +armada38x_gateclk_write_4(device_t dev, bus_addr_t addr, uint32_t val) +{ + struct armada38x_gateclk_softc *sc = device_get_softc(dev); + + if (addr > ARMADA38X_GATECLK_MAXREG) + return (EINVAL); + + WR4(sc, addr, val); + return (0); +} + +static int +armada38x_gateclk_read_4(device_t dev, bus_addr_t addr, uint32_t *val) +{ + struct armada38x_gateclk_softc *sc = device_get_softc(dev); + + if (addr > ARMADA38X_GATECLK_MAXREG) + return (EINVAL); + + *val = RD4(sc, addr); + return (0); +} + +static int +armada38x_gateclk_modify_4(device_t dev, bus_addr_t addr, uint32_t clr, + uint32_t set) +{ + struct armada38x_gateclk_softc *sc = device_get_softc(dev); + uint32_t reg; + + if (addr > ARMADA38X_GATECLK_MAXREG) + return (EINVAL); + + reg = RD4(sc, addr); + reg &= ~clr; + reg |= set; + WR4(sc, addr, reg); + + return (0); +} + +static void +armada38x_gateclk_device_lock(device_t dev) +{ + struct armada38x_gateclk_softc *sc = device_get_softc(dev); + + mtx_lock(&sc->mtx); +} + +static void +armada38x_gateclk_device_unlock(device_t dev) +{ + struct armada38x_gateclk_softc *sc = device_get_softc(dev); + + mtx_unlock(&sc->mtx); +} + static device_method_t armada38x_gateclk_methods[] = { DEVMETHOD(device_probe, armada38x_gateclk_probe), DEVMETHOD(device_attach, armada38x_gateclk_attach), + /* clkdev interface */ + DEVMETHOD(clkdev_write_4, armada38x_gateclk_write_4), + DEVMETHOD(clkdev_read_4, armada38x_gateclk_read_4), + DEVMETHOD(clkdev_modify_4, armada38x_gateclk_modify_4), + DEVMETHOD(clkdev_device_lock, armada38x_gateclk_device_lock), + DEVMETHOD(clkdev_device_unlock, armada38x_gateclk_device_unlock), + DEVMETHOD_END }; @@ -254,6 +330,7 @@ static int armada38x_gateclk_attach(device_t dev) { struct armada38x_gateclk_softc *sc; + struct clk_gate_def *defp; phandle_t node; int i, error; clk_t clock; @@ -261,6 +338,11 @@ armada38x_gateclk_attach(device_t dev) sc = device_get_softc(dev); node = ofw_bus_get_node(dev); + if (bus_alloc_resources(dev, armada38x_gateclk_specs, &sc->res) != 0) { + device_printf(dev, "Cannot allocate resources.\n"); + return (ENXIO); + } + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); sc->clkdom = clkdom_create(dev); @@ -276,8 +358,15 @@ armada38x_gateclk_attach(device_t dev) sc->parent = clk_get_name(clock); for (i = 0; i < nitems(gateclk_nodes); ++i) { - gateclk_nodes[i].clkdef.parent_names = &sc->parent; - error = clknode_gate_register(sc->clkdom, &gateclk_nodes[i]); + /* Fill clk_gate fields. */ + defp = &gateclk_nodes[i]; + defp->clkdef.parent_names = &sc->parent; + defp->offset = 0; + defp->mask = 0x1; + defp->on_value = 1; + defp->off_value = 0; + + error = clknode_gate_register(sc->clkdom, defp); if (error != 0) { device_printf(dev, "Cannot create gate nodes\n"); return (error); From nobody Thu Jan 16 17:53:12 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYr7X3TTLz5kjw6; Thu, 16 Jan 2025 17:53: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYr7X2lS9z3QKs; Thu, 16 Jan 2025 17:53:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737049992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N6wrK5to06BYBV2wG4RDNiPgaAFNeQ/hn8k/7fO5FDM=; b=PPV2/iEuqcwmGgvG4oqsthUSYWyqDY1wB3TzaK6JwQMCqB/g+j9xdFeobbJ2LT+o4itKRI dlBZQXIM+e5lFDQ0Ijgbi73cGA+WzMKkZrEsqCbRgHLAijXxP2Ny6KlLIt4zkqlA4FtxEK wa/QhTelwWveFbXYs6SlCDOnkibJRcFtfcIBfBeywrjJiVb5uKEwD9rqDHS+NJsinVno9x ABiUIFTDkxGzwKG2Yf2d4tWRrf12pOQhhNH5EjjcOqvHS4FJjxqkxB9ou0nd7FMvv/jcD7 kaC8ZDuY4u9zN2j+RBBwv5iRQ617FaiKhMpQIbbZB3dTewgYpuMzlQNhyXAkyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737049992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N6wrK5to06BYBV2wG4RDNiPgaAFNeQ/hn8k/7fO5FDM=; b=RrIi9fFRO+i9CeZrvJkZYf+GIzYikTnEry0KKbCpm38ml3aa/ZrCEHUnLumgR8Ha1xtSuR yEr1PkbrQfjhija5KM9dE2cau4SPl7s05I1OFLRrIpv748IXKbMMh9zcjamMnlJU5VpEtV 4CurvEiCrg3CskYxlbyFKI+VTxf7KkQ1m/3DlaMCprav83gqPFihi5yFe3AvDC4/H0cowO IFv6ekyc02frvDqu15527vsSCtmi2dP58GnoLfKwRd7786NJppDaEv1tiDjxn5iveyCgtn 1AC+OKt+Eg/50XmKPZsQKdr+yqRStLuiErWDjEZANDFH/LGOo+nvubeM1SyjRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737049992; a=rsa-sha256; cv=none; b=rbZsf9n0Rnyn6PpbjBPl61aIS7SPDlmR8ime3PZusJO52PHgoHrR1qxIlVkl8MKyCNGmMt +D9Q8bbzHYo+2c+v/m3R7ykvbSfUMrTgBGmO5c3E/Joy/NPW7Dy4BigzezEmice2cZDTAX LN/oGzbfWN7P0acSbDO6jh+fHbZ2UwDWBKkDK8IEZ+/2uWcNkdHoKEXlN21mlRfT2/fQPF MBp2uQyhqRXExWiTCep3M/EwUPlSP6AJ+KzJrAoMMPpxajeiuOcM1e5SA9ntNLF0WCsZ2W lxZKsV3td5XYmCeEkexrBPjsC3PkHzUSK8AMQ6Yl6gWzD9cCDDlbEnCmftCUFw== 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 4YYr7X2B2xzk7N; Thu, 16 Jan 2025 17:53: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 50GHrCNi069993; Thu, 16 Jan 2025 17:53:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GHrCWD069990; Thu, 16 Jan 2025 17:53:12 GMT (envelope-from git) Date: Thu, 16 Jan 2025 17:53:12 GMT Message-Id: <202501161753.50GHrCWD069990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 724e383bd4c4 - main - munmap.2: Add STANDARDS and note about portability List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 724e383bd4c40ea7db4bf2f1e9b8d2c741c6b481 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=724e383bd4c40ea7db4bf2f1e9b8d2c741c6b481 commit 724e383bd4c40ea7db4bf2f1e9b8d2c741c6b481 Author: Ed Maste AuthorDate: 2025-01-15 21:43:49 +0000 Commit: Ed Maste CommitDate: 2025-01-16 17:50:47 +0000 munmap.2: Add STANDARDS and note about portability POSIX used to specify that munmap shall fail with EINVAL if the addr argument is not a multiple of the page size, but that was changed to may fail. Note that we conform to contemporary POSIX and include a brief note for portable programs. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48481 --- lib/libsys/munmap.2 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/libsys/munmap.2 b/lib/libsys/munmap.2 index d6b53f1bcf19..5c587d652a42 100644 --- a/lib/libsys/munmap.2 +++ b/lib/libsys/munmap.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 15, 2025 +.Dd January 16, 2025 .Dt MUNMAP 2 .Os .Sh NAME @@ -66,6 +66,15 @@ valid address range for a process. .Xr mprotect 2 , .Xr msync 2 , .Xr getpagesize 3 +.Sh STANDARDS +The +.Fn munmap +system call conforms to +.St -p1003.1-2024 . +Portable programs should ensure that +.Fa addr +is a multiple of the page size as returned by +.Xr sysconf 3 . .Sh HISTORY The .Fn munmap From nobody Thu Jan 16 18:10:39 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYrWh2pxBz5kl81; Thu, 16 Jan 2025 18:10:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYrWg5TkGz3XKd; Thu, 16 Jan 2025 18:10:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737051039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dlmVV0DkmL+iY5QnxwnW2BirTzTTW21CFLonyxoUiO4=; b=pmRhcDGkq5scHECdSrTnkUn9vLbS4k4yq1GxtnI3ylmKZj7u7V3m+pbO284RAC+MbBzmCM hIXygNrFIE+9LWxh7y/IlchOATGj4uWni6dljrtKGri2xvmrRrahL8KSi+c5RdyZNLLUKQ MBA9F4O1ELBKP4QvE6G+yRNDyY+Fvf5THEJCng7ocQxZt00JvJ17iPg1bJ7wt2MoT7S2RJ 3xI1mgkxzcRoKBsYwMEmymiWvgab0m6iJBNB0iqhsoZwPE/3XZq4k+mAK1rF7PxkSlSlL2 XwThNmf6Fu75hsggxRkFZapvJuZ2OgSDrm/ym+W6saSqG/anowMcdrQyEmrPzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737051039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dlmVV0DkmL+iY5QnxwnW2BirTzTTW21CFLonyxoUiO4=; b=llGWuKa8rasHea+OGQYvc0ZHzjai8PUfQydwmbXsFY8a7Aa5w9GSeHJ9oU9x0/RzwJPGbP Xa5jAG09S4ToUuZwxql+ETqFDfjeHSVAYHM1ofM4tbpYwsfSmA4JOM3GUy9ue6p4btOIH9 OyY+Wjxby0Pm7G80KD0t2DdexT/URv+k6wzVFmEzjstGSGTy6vOLe1rBbaZEZ1oqpIB5ac sS6YaY4LFPv9sGFM6fPa+IaATsoPrl6QbUs75GWv5bge+zyvsCewkezn/qyvobEP9YUhWH WBxwDYbt8YNNwS98tKn2MEKLxIaQ+UsBVx3GOZ7jqmz7GTuUmd17DfEIgD2hYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737051039; a=rsa-sha256; cv=none; b=XHk1O7ZmNPPWn4SLWvfheXjFi39XXKPoVV9KSdpA3KNqc1bGe40uxuWVnpCfzVd0ewFmDz qE5j5NYSxF8i8SnTUrDC2vM6ouwUIfdVUS4noAbqiOZdKyCHSmSeSuu9naQ/17zlb4A8yN kUpcXYLNzs9eJqthZ+Hm4FA9EE0V894Xi+dg/c1iu+LaPprcWgR2W22Xore83j843EiyGC 4Xm5OayoyWT26IU1bDcEu8QJXH8PdcSrgluOzqdPe+wCeK3796HQQsTGU2X3mqfkpfPtYX f3m10wYg2JYE3nY7I+TOu5GWNr5Fa+UfLACjQ/9KZjfLtfxQeaJM0kNA74yAuw== 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 4YYrWg4v0KzkKr; Thu, 16 Jan 2025 18:10: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 50GIAdAK002518; Thu, 16 Jan 2025 18:10:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GIAdWV002515; Thu, 16 Jan 2025 18:10:39 GMT (envelope-from git) Date: Thu, 16 Jan 2025 18:10:39 GMT Message-Id: <202501161810.50GIAdWV002515@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 8be18c2d5a63 - main - sys/net: fix several sysinit_cfunc_t signature mismatches List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8be18c2d5a63859c83aaceb66377e3c9820bfe48 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=8be18c2d5a63859c83aaceb66377e3c9820bfe48 commit 8be18c2d5a63859c83aaceb66377e3c9820bfe48 Author: SHENGYI HONG AuthorDate: 2025-01-16 17:49:04 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-16 18:10:09 +0000 sys/net: fix several sysinit_cfunc_t signature mismatches Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D48490 --- sys/net/dummymbuf.c | 4 ++-- sys/net/if_ethersubr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net/dummymbuf.c b/sys/net/dummymbuf.c index d73566759ed3..ff566cfb87c3 100644 --- a/sys/net/dummymbuf.c +++ b/sys/net/dummymbuf.c @@ -437,7 +437,7 @@ dmb_pfil_uninit(void) } static void -vnet_dmb_init(void *unused __unused) +vnet_dmb_init(const void *unused __unused) { sx_init(&V_dmb_rules_lock, "dummymbuf rules"); V_dmb_hits = counter_u64_alloc(M_WAITOK); @@ -447,7 +447,7 @@ VNET_SYSINIT(vnet_dmb_init, SI_SUB_PROTO_PFIL, SI_ORDER_ANY, vnet_dmb_init, NULL); static void -vnet_dmb_uninit(void *unused __unused) +vnet_dmb_uninit(const void *unused __unused) { dmb_pfil_uninit(); counter_u64_free(V_dmb_hits); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 6cd5cefa9609..ddaa94414ca5 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -759,7 +759,7 @@ ether_init(__unused void *arg) SYSINIT(ether, SI_SUB_INIT_IF, SI_ORDER_ANY, ether_init, NULL); static void -vnet_ether_init(__unused void *arg) +vnet_ether_init(const __unused void *arg) { struct pfil_head_args args; @@ -778,7 +778,7 @@ VNET_SYSINIT(vnet_ether_init, SI_SUB_PROTO_IF, SI_ORDER_ANY, #ifdef VIMAGE static void -vnet_ether_pfil_destroy(__unused void *arg) +vnet_ether_pfil_destroy(const __unused void *arg) { pfil_head_unregister(V_link_pfil_head); From nobody Thu Jan 16 18:45:06 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYsHQ7035z5kn2G; Thu, 16 Jan 2025 18:45: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYsHQ5rJCz3fn2; Thu, 16 Jan 2025 18:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737053106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZJzGhhp5CronxMLkF9/Wwez6j9nsNUAteZqCPQvMTyg=; b=SdFFH/cA0np58EKEk9fCUmZtsCwQdMuB3w2O7F8flmww6McvDpd/Te3jKMs3GiTbzcVNIx gOX9dr4tUUarm270TiTKb8QNLAV7qeMkWvFKT8NQJMaxJJDYBVVTPCcYLrmpdOToRdivz3 5YbWC4LkoxvyuTtx7dUm3QtP79Kxxk0dj9FlopbP/b3GoQJA5XgjP6scTTDzZuXuHN6sDA KmlMS7WFKLnFpr+diEedZZs2kHyLsqK6JI6LOkcPDxVJ97m8nFyDFVD5GDu38ZDhwOB7cf hrQclV2pKErqWok2HKohB+8J7G75daqOJo6q1XjIgujUbkwMf3FAW2PidVtrQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737053106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZJzGhhp5CronxMLkF9/Wwez6j9nsNUAteZqCPQvMTyg=; b=BCU4GPIu6luvpn6gsnyX9uVPhwmxDGbsL7BsngZUDwkaAk9He43XwMnp0a11aVjTOp97GS iPcppd+bg+KIQcEu2iOSO+kh6EZPiozYrSftUNeirpVhthBY7sR9paEUYbJ4YOoRRv3pjN CpU6reLA6jzFlfrs2MssSf+XbxTYb99xpgh+iWTwqG0oV3euF0Aiq8AsQmcDbCUVrsTKq9 7ewHv4pyAl0MRVWJuqh0NkI2WEisXti/u7NMkGk1vO89CgnQjrZEkkKjDkB5KfV5UPLmns XDDDe+Qrnpz+IH5CyS41+gl9ZRqlQn1BIeVBDlbpEKqG4upJKhs5/xt6zVj12g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737053106; a=rsa-sha256; cv=none; b=c/iukOuZEh1iY2cRjMvOnl9ylfbAzHoGl//2PliDvqEAcy3IXGDrivxp1BezJKcQ1Rz0Kw YD0up15uUHJ88rm9aOpXIrJixSrnyQWMJO4QnR35eqizjeXyXFIRD2QLPI14YnZirEWUbn e+1Pq4B/5QNj2t8TyHf9zmcn769tqO+teLGkkzBYNQ5QkbX75EDqhFWgPldirHsuO2z0K+ QCO8nwzOW7PXfVknF3jTdNcMeESFQyrB212iWDwvQ9k1aVsC/OUY5lAdpFnU2hzEQlji/X AFwavTVDZsy3z4mq2E8G1rdHYlfk2FUkibHrfb/trA3OWBwk4R3NJ3MT534y2g== 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 4YYsHQ5GW9zlJd; Thu, 16 Jan 2025 18:45: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 50GIj6dR067127; Thu, 16 Jan 2025 18:45:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GIj6TW067124; Thu, 16 Jan 2025 18:45:06 GMT (envelope-from git) Date: Thu, 16 Jan 2025 18:45:06 GMT Message-Id: <202501161845.50GIj6TW067124@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 661ca921e8cd - main - Fix backward compatibility with UFS1 filesystems created before June 2002 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 661ca921e8cd56b17fc6615bc7e596e56e0e7c31 Auto-Submitted: auto-generated The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=661ca921e8cd56b17fc6615bc7e596e56e0e7c31 commit 661ca921e8cd56b17fc6615bc7e596e56e0e7c31 Author: Kirk McKusick AuthorDate: 2025-01-16 18:43:48 +0000 Commit: Kirk McKusick CommitDate: 2025-01-16 18:44:35 +0000 Fix backward compatibility with UFS1 filesystems created before June 2002 The code to handle compatibility with old filesystems exists and does the right things. The loss of compatibility was introduced 2.5 years ago when the superblock integrity checks were added. The problem is that the compatibility code was being run after the new integrity checks rather than before them. The reason that it has taken so long to show up is because it only affected filesystems created before UFS2 got added in June 2002 and that had never been mounted read-write (as their superblocks would be updated by the compatibility code if they could be written). Hence the problem was not apparent until someone tried to mount a pre-2002 virgin UFS1 filesystem image. See the Pahabricator review for more details. Reviewed-by: kib Tested-by: Peter Holm MFC-after: 1 week Differential-Revision: https://reviews.freebsd.org/D48472 --- sbin/growfs/debug.c | 2 - sys/ufs/ffs/ffs_extern.h | 2 +- sys/ufs/ffs/ffs_snapshot.c | 2 +- sys/ufs/ffs/ffs_softdep.c | 4 +- sys/ufs/ffs/ffs_subr.c | 81 +++++++++++++++++++++++++++++++++++++- sys/ufs/ffs/ffs_vfsops.c | 96 +--------------------------------------------- sys/ufs/ffs/fs.h | 5 ++- 7 files changed, 88 insertions(+), 104 deletions(-) diff --git a/sbin/growfs/debug.c b/sbin/growfs/debug.c index bfff2acad2b5..3fe7e26e3e50 100644 --- a/sbin/growfs/debug.c +++ b/sbin/growfs/debug.c @@ -305,8 +305,6 @@ dbg_dump_fs(struct fs *sb, const char *comment) sb->fs_avgfilesize); fprintf(dbg_log, "avgfpdir int32_t 0x%08x\n", sb->fs_avgfpdir); - fprintf(dbg_log, "save_cgsize int32_t 0x%08x\n", - sb->fs_save_cgsize); fprintf(dbg_log, "flags int32_t 0x%08x\n", sb->fs_flags); fprintf(dbg_log, "contigsumsize int32_t 0x%08x\n", diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 112ab1107e8b..119de616003d 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -82,7 +82,7 @@ int ffs_inotovp(struct mount *, ino_t, uint64_t, int, struct vnode **, int); int ffs_isblock(struct fs *, uint8_t *, ufs1_daddr_t); int ffs_isfreeblock(struct fs *, uint8_t *, ufs1_daddr_t); -void ffs_oldfscompat_write(struct fs *, struct ufsmount *); +void ffs_oldfscompat_write(struct fs *); int ffs_own_mount(const struct mount *mp); int ffs_sbsearch(void *, struct fs **, int, struct malloc_type *, int (*)(void *, off_t, void **, int)); diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index f4eed782f7bc..31823458ed8a 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -838,7 +838,7 @@ resumefs: copy_fs->fs_fmod = 0; bpfs = (struct fs *)&nbp->b_data[loc]; bcopy((caddr_t)copy_fs, (caddr_t)bpfs, (uint64_t)fs->fs_sbsize); - ffs_oldfscompat_write(bpfs, ump); + ffs_oldfscompat_write(bpfs); bpfs->fs_ckhash = ffs_calc_sbhash(bpfs); bawrite(nbp); } diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 98ad4269b5f2..751b6e42a347 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -9937,7 +9937,7 @@ clear_unlinked_inodedep( struct inodedep *inodedep) if (pino == 0) { bcopy((caddr_t)fs, bp->b_data, (uint64_t)fs->fs_sbsize); bpfs = (struct fs *)bp->b_data; - ffs_oldfscompat_write(bpfs, ump); + ffs_oldfscompat_write(bpfs); softdep_setup_sbupdate(ump, bpfs, bp); /* * Because we may have made changes to the superblock, @@ -9969,7 +9969,7 @@ clear_unlinked_inodedep( struct inodedep *inodedep) (int)fs->fs_sbsize, 0, 0, 0); bcopy((caddr_t)fs, bp->b_data, (uint64_t)fs->fs_sbsize); bpfs = (struct fs *)bp->b_data; - ffs_oldfscompat_write(bpfs, ump); + ffs_oldfscompat_write(bpfs); softdep_setup_sbupdate(ump, bpfs, bp); /* * Because we may have made changes to the superblock, diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index bcb4d25c8ad9..7c2971d885ea 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -123,6 +123,7 @@ ffs_update_dinode_ckhash(struct fs *fs, struct ufs2_dinode *dip) static off_t sblock_try[] = SBLOCKSEARCH; static int readsuper(void *, struct fs **, off_t, int, int (*)(void *, off_t, void **, int)); +static void ffs_oldfscompat_read(struct fs *, ufs2_daddr_t); static int validate_sblock(struct fs *, int); /* @@ -268,6 +269,7 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int flags, if (fs->fs_magic == FS_UFS1_MAGIC && (flags & UFS_ALTSBLK) == 0 && fs->fs_bsize == SBLOCK_UFS2 && sblockloc == SBLOCK_UFS2) return (ENOENT); + ffs_oldfscompat_read(fs, sblockloc); if ((error = validate_sblock(fs, flags)) > 0) return (error); /* @@ -316,6 +318,83 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int flags, return (0); } +/* + * Sanity checks for loading old filesystem superblocks. + * See ffs_oldfscompat_write below for unwound actions. + * + * XXX - Parts get retired eventually. + * Unfortunately new bits get added. + */ +static void +ffs_oldfscompat_read(struct fs *fs, ufs2_daddr_t sblockloc) +{ + uint64_t maxfilesize; + + /* + * If not yet done, update fs_flags location and value of fs_sblockloc. + */ + if ((fs->fs_old_flags & FS_FLAGS_UPDATED) == 0) { + fs->fs_flags = fs->fs_old_flags; + fs->fs_old_flags |= FS_FLAGS_UPDATED; + fs->fs_sblockloc = sblockloc; + } + /* + * If not yet done, update UFS1 superblock with new wider fields. + */ + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_maxbsize != fs->fs_bsize) { + fs->fs_maxbsize = fs->fs_bsize; + fs->fs_time = fs->fs_old_time; + fs->fs_size = fs->fs_old_size; + fs->fs_dsize = fs->fs_old_dsize; + fs->fs_csaddr = fs->fs_old_csaddr; + fs->fs_cstotal.cs_ndir = fs->fs_old_cstotal.cs_ndir; + fs->fs_cstotal.cs_nbfree = fs->fs_old_cstotal.cs_nbfree; + fs->fs_cstotal.cs_nifree = fs->fs_old_cstotal.cs_nifree; + fs->fs_cstotal.cs_nffree = fs->fs_old_cstotal.cs_nffree; + } + if (fs->fs_magic == FS_UFS1_MAGIC && + fs->fs_old_inodefmt < FS_44INODEFMT) { + fs->fs_maxfilesize = ((uint64_t)1 << 31) - 1; + fs->fs_qbmask = ~fs->fs_bmask; + fs->fs_qfmask = ~fs->fs_fmask; + } + if (fs->fs_magic == FS_UFS1_MAGIC) { + fs->fs_save_maxfilesize = fs->fs_maxfilesize; + maxfilesize = (uint64_t)0x80000000 * fs->fs_bsize - 1; + if (fs->fs_maxfilesize > maxfilesize) + fs->fs_maxfilesize = maxfilesize; + } + /* Compatibility for old filesystems */ + if (fs->fs_avgfilesize <= 0) + fs->fs_avgfilesize = AVFILESIZ; + if (fs->fs_avgfpdir <= 0) + fs->fs_avgfpdir = AFPDIR; +} + +/* + * Unwinding superblock updates for old filesystems. + * See ffs_oldfscompat_read above for details. + * + * XXX - Parts get retired eventually. + * Unfortunately new bits get added. + */ +void +ffs_oldfscompat_write(struct fs *fs) +{ + + /* + * Copy back UFS2 updated fields that UFS1 inspects. + */ + if (fs->fs_magic == FS_UFS1_MAGIC) { + fs->fs_old_time = fs->fs_time; + fs->fs_old_cstotal.cs_ndir = fs->fs_cstotal.cs_ndir; + fs->fs_old_cstotal.cs_nbfree = fs->fs_cstotal.cs_nbfree; + fs->fs_old_cstotal.cs_nifree = fs->fs_cstotal.cs_nifree; + fs->fs_old_cstotal.cs_nffree = fs->fs_cstotal.cs_nffree; + fs->fs_maxfilesize = fs->fs_save_maxfilesize; + } +} + /* * Verify the filesystem values. */ @@ -561,7 +640,7 @@ validate_sblock(struct fs *fs, int flags) sizepb *= NINDIR(fs); maxfilesize += sizepb; } - WCHK(fs->fs_maxfilesize, !=, maxfilesize, %jd); + WCHK(fs->fs_maxfilesize, >, maxfilesize, %jd); /* * These values have a tight interaction with each other that * makes it hard to tightly bound them. So we can only check diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index a739e0220ec9..da079ce1efb6 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -83,8 +83,6 @@ static uma_zone_t uma_inode, uma_ufs1, uma_ufs2; VFS_SMR_DECLARE; static int ffs_mountfs(struct vnode *, struct mount *, struct thread *); -static void ffs_oldfscompat_read(struct fs *, struct ufsmount *, - ufs2_daddr_t); static void ffs_ifree(struct ufsmount *ump, struct inode *ip); static int ffs_sync_lazy(struct mount *mp); static int ffs_use_bread(void *devfd, off_t loc, void **bufp, int size); @@ -795,7 +793,6 @@ ffs_reload(struct mount *mp, int flags) fs = VFSTOUFS(mp)->um_fs = newfs; ump->um_bsize = fs->fs_bsize; ump->um_maxsymlinklen = fs->fs_maxsymlinklen; - ffs_oldfscompat_read(fs, VFSTOUFS(mp), fs->fs_sblockloc); UFS_LOCK(ump); if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { printf("WARNING: %s: reload pending error: blocks %jd " @@ -1010,7 +1007,6 @@ ffs_mountfs(struct vnode *odevvp, struct mount *mp, struct thread *td) ump->um_check_blkno = NULL; mtx_init(UFS_MTX(ump), "FFS", "FFS Lock", MTX_DEF); sx_init(&ump->um_checkpath_lock, "uchpth"); - ffs_oldfscompat_read(fs, ump, fs->fs_sblockloc); fs->fs_ronly = ronly; fs->fs_active = NULL; mp->mnt_data = ump; @@ -1219,96 +1215,6 @@ ffs_use_bread(void *devfd, off_t loc, void **bufp, int size) return (0); } -static int bigcgs = 0; -SYSCTL_INT(_debug, OID_AUTO, bigcgs, CTLFLAG_RW, &bigcgs, 0, ""); - -/* - * Sanity checks for loading old filesystem superblocks. - * See ffs_oldfscompat_write below for unwound actions. - * - * XXX - Parts get retired eventually. - * Unfortunately new bits get added. - */ -static void -ffs_oldfscompat_read(struct fs *fs, - struct ufsmount *ump, - ufs2_daddr_t sblockloc) -{ - off_t maxfilesize; - - /* - * If not yet done, update fs_flags location and value of fs_sblockloc. - */ - if ((fs->fs_old_flags & FS_FLAGS_UPDATED) == 0) { - fs->fs_flags = fs->fs_old_flags; - fs->fs_old_flags |= FS_FLAGS_UPDATED; - fs->fs_sblockloc = sblockloc; - } - /* - * If not yet done, update UFS1 superblock with new wider fields. - */ - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_maxbsize != fs->fs_bsize) { - fs->fs_maxbsize = fs->fs_bsize; - fs->fs_time = fs->fs_old_time; - fs->fs_size = fs->fs_old_size; - fs->fs_dsize = fs->fs_old_dsize; - fs->fs_csaddr = fs->fs_old_csaddr; - fs->fs_cstotal.cs_ndir = fs->fs_old_cstotal.cs_ndir; - fs->fs_cstotal.cs_nbfree = fs->fs_old_cstotal.cs_nbfree; - fs->fs_cstotal.cs_nifree = fs->fs_old_cstotal.cs_nifree; - fs->fs_cstotal.cs_nffree = fs->fs_old_cstotal.cs_nffree; - } - if (fs->fs_magic == FS_UFS1_MAGIC && - fs->fs_old_inodefmt < FS_44INODEFMT) { - fs->fs_maxfilesize = ((uint64_t)1 << 31) - 1; - fs->fs_qbmask = ~fs->fs_bmask; - fs->fs_qfmask = ~fs->fs_fmask; - } - if (fs->fs_magic == FS_UFS1_MAGIC) { - ump->um_savedmaxfilesize = fs->fs_maxfilesize; - maxfilesize = (uint64_t)0x80000000 * fs->fs_bsize - 1; - if (fs->fs_maxfilesize > maxfilesize) - fs->fs_maxfilesize = maxfilesize; - } - /* Compatibility for old filesystems */ - if (fs->fs_avgfilesize <= 0) - fs->fs_avgfilesize = AVFILESIZ; - if (fs->fs_avgfpdir <= 0) - fs->fs_avgfpdir = AFPDIR; - if (bigcgs) { - fs->fs_save_cgsize = fs->fs_cgsize; - fs->fs_cgsize = fs->fs_bsize; - } -} - -/* - * Unwinding superblock updates for old filesystems. - * See ffs_oldfscompat_read above for details. - * - * XXX - Parts get retired eventually. - * Unfortunately new bits get added. - */ -void -ffs_oldfscompat_write(struct fs *fs, struct ufsmount *ump) -{ - - /* - * Copy back UFS2 updated fields that UFS1 inspects. - */ - if (fs->fs_magic == FS_UFS1_MAGIC) { - fs->fs_old_time = fs->fs_time; - fs->fs_old_cstotal.cs_ndir = fs->fs_cstotal.cs_ndir; - fs->fs_old_cstotal.cs_nbfree = fs->fs_cstotal.cs_nbfree; - fs->fs_old_cstotal.cs_nifree = fs->fs_cstotal.cs_nifree; - fs->fs_old_cstotal.cs_nffree = fs->fs_cstotal.cs_nffree; - fs->fs_maxfilesize = ump->um_savedmaxfilesize; - } - if (bigcgs) { - fs->fs_cgsize = fs->fs_save_cgsize; - fs->fs_save_cgsize = 0; - } -} - /* * unmount system call */ @@ -2192,7 +2098,7 @@ ffs_use_bwrite(void *devfd, off_t loc, void *buf, int size) UFS_UNLOCK(ump); fs = (struct fs *)bp->b_data; fs->fs_fmod = 0; - ffs_oldfscompat_write(fs, ump); + ffs_oldfscompat_write(fs); fs->fs_si = NULL; /* Recalculate the superblock hash */ fs->fs_ckhash = ffs_calc_sbhash(fs); diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h index 8a1b5be18bc2..c092688c475b 100644 --- a/sys/ufs/ffs/fs.h +++ b/sys/ufs/ffs/fs.h @@ -411,7 +411,8 @@ struct fs { int64_t fs_unrefs; /* number of unreferenced inodes */ int64_t fs_providersize; /* size of underlying GEOM provider */ int64_t fs_metaspace; /* size of area reserved for metadata */ - int64_t fs_sparecon64[13]; /* old rotation block list head */ + uint64_t fs_save_maxfilesize; /* save old UFS1 maxfilesize */ + int64_t fs_sparecon64[12]; /* old rotation block list head */ int64_t fs_sblockactualloc; /* byte offset of this superblock */ int64_t fs_sblockloc; /* byte offset of standard superblock */ struct csum_total fs_cstotal; /* (u) cylinder summary information */ @@ -424,7 +425,7 @@ struct fs { uint32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ uint32_t fs_avgfilesize; /* expected average file size */ uint32_t fs_avgfpdir; /* expected # of files per directory */ - int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */ + uint32_t fs_available_spare; /* old scratch space */ ufs_time_t fs_mtime; /* Last mount or fsck time. */ int32_t fs_sujfree; /* SUJ free list */ int32_t fs_sparecon32[21]; /* reserved for future constants */ From nobody Thu Jan 16 18:54:28 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYsVD2nJ1z5knHt; Thu, 16 Jan 2025 18:54: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYsVD25z3z3gdv; Thu, 16 Jan 2025 18:54:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737053668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KbER20RrjMZ9Sd/sBjVBx329Jojk3Fpmi1OATEGjncM=; b=ucXovKhTGGBerclkNvkBsTJpgIzs+7OuH0xX1FVuq+YrWy0kYkvNFfZp8IfY3fQrg6NAkK WiQSKTsdvFgSmIUazvhgsfsW3Ttj2HodL/K9zdk8l71XwF44tD7usi4C9j0EqtPPhMcqsY 8ui/AaRty5tsppYMgdD5OrO503N2/5jgNnFQHwSJWpQV1CynzVda0SNoIuh/7cP/RFXBLk xVpgBdc7CqO4NyBXQ1RU/dnjvNlQSa56X/FTrDt3JLFFdiWXg4Z2XtrK8sQk/3aErd7QTS TgmdTKGbjfXPbQFQOv1329EdvPFSaA51lpsqQYw9uTOKITEOS41iGyKKEjC+xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737053668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KbER20RrjMZ9Sd/sBjVBx329Jojk3Fpmi1OATEGjncM=; b=LOoiP4Cprt3U3KeQ3N/5q3HS1gsjcPtxst4bgOykKeVVxVbttKu7/+bdzQS3uRT2HI0yIM HmlKAxXF4p7iiOC/NqcqCuF5FsVEkgYC0iSSnAZNmitNcwmQR3nqqcpSJbgfzKnTm8yAba 2X3PK7lEEM+RQ9mLbsudFnAozGfN4qTcjeQbTRG6e2+q0P/PfdWENN1OWUqwCmNQ8/jb4O oMUavrCwgrYCjHyzO1VSAkFo/44UZysRb5MrlDA07QNUSR+iv+tl/k7aHow3M1xeEGUn4X j4aXuC/iATcWKjH7CT77HFoVZiJI3fRyQ83kGTfiuOLLf1DkPEelPG8UYcUkNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737053668; a=rsa-sha256; cv=none; b=Ve7NhAK54fKywY/2wXGGaqdbd9Wu+wsZ2cxzcS49GC9j2JeJEqfOSQQ64u+P4pVGtccj7H 3f9yKawQQ2XvVYcECTM12omr73TTp2PKRklLhlBfxnaHUeGsu8a5PJh24BLPdVaf5Kf/nw F13aGatcevonQ6K9RAIlTUhq3O2SNAH7HAbG+IygBmKjNVHjkHXCvilj4VmXOuKwBNZqUK O/vOchaX0jdIsnYISddrcaYJy6YM3d7mGjnpbApDIuuB/HNdhnf3qUWJeJExSLMql/GC8z shS9QtAzJn/uSm+NckHm0mbJxVOYDBkwPYEHkNIy6Cl3jv8C8nkss/Lqlen4JA== 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 4YYsVD1YP3zlKN; Thu, 16 Jan 2025 18:54: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 50GIsSY5085878; Thu, 16 Jan 2025 18:54:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GIsSH9085875; Thu, 16 Jan 2025 18:54:28 GMT (envelope-from git) Date: Thu, 16 Jan 2025 18:54:28 GMT Message-Id: <202501161854.50GIsSH9085875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: b4663a8d1117 - main - stat(2): add st_filerev List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b4663a8d111767206bb3ebcfec5b95a6b88bc720 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b4663a8d111767206bb3ebcfec5b95a6b88bc720 commit b4663a8d111767206bb3ebcfec5b95a6b88bc720 Author: Konstantin Belousov AuthorDate: 2025-01-13 21:14:04 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-16 18:54:20 +0000 stat(2): add st_filerev Reviewed by: asomers, markj, olce, rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48452 --- sys/compat/freebsd32/freebsd32.h | 3 ++- sys/compat/freebsd32/freebsd32_misc.c | 1 + sys/fs/tmpfs/tmpfs_vnops.c | 1 + sys/kern/kern_descrip.c | 1 + sys/kern/vfs_default.c | 2 ++ sys/kern/vfs_subr.c | 1 + sys/sys/stat.h | 3 ++- sys/sys/vnode.h | 1 + sys/ufs/ufs/ufs_vnops.c | 2 ++ 9 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index e1bfe282c4b1..3dbf1b5a876d 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -240,7 +240,8 @@ struct stat32 { uint32_t st_blksize; uint32_t st_flags; uint64_t st_gen; - uint64_t st_spare[10]; + uint64_t st_filerev; + uint64_t st_spare[9]; }; struct freebsd11_stat32 { uint32_t st_dev; diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 4cd706e16155..e5b2b0feeafd 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2251,6 +2251,7 @@ copy_stat(struct stat *in, struct stat32 *out) CP(*in, *out, st_blksize); CP(*in, *out, st_flags); CP(*in, *out, st_gen); + CP(*in, *out, st_filerev); TS_CP(*in, *out, st_birthtim); out->st_padding0 = 0; out->st_padding1 = 0; diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 83e43ec7ba13..c99d0732be50 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -476,6 +476,7 @@ tmpfs_stat(struct vop_stat_args *v) sb->st_blksize = PAGE_SIZE; sb->st_flags = node->tn_flags; sb->st_gen = node->tn_gen; + sb->st_filerev = 0; if (vp->v_type == VREG) { #ifdef __ILP32__ vm_object_t obj = node->tn_reg.tn_aobj; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 10e0b4b142f8..f87ad1f45143 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1620,6 +1620,7 @@ kern_fstat(struct thread *td, int fd, struct stat *sbp) AUDIT_ARG_FILE(td->td_proc, fp); + sbp->st_filerev = 0; error = fo_stat(fp, sbp, td->td_ucred); fdrop(fp, td); #ifdef __STAT_TIME_T_EXT diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 4067ab4ba446..5e6516921002 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1511,6 +1511,7 @@ vop_stdstat(struct vop_stat_args *a) vap->va_fsid = VNOVAL; vap->va_gen = 0; vap->va_rdev = NODEV; + vap->va_filerev = 0; error = VOP_GETATTR(vp, vap, a->a_active_cred); if (error) @@ -1587,6 +1588,7 @@ vop_stdstat(struct vop_stat_args *a) sb->st_flags = vap->va_flags; sb->st_blocks = vap->va_bytes / S_BLKSIZE; sb->st_gen = vap->va_gen; + sb->st_filerev = vap->va_filerev; out: return (vop_stat_helper_post(a, error)); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index feb808c0d4c7..ef51fdba8e7c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1200,6 +1200,7 @@ vattr_null(struct vattr *vap) vap->va_flags = VNOVAL; vap->va_gen = VNOVAL; vap->va_vaflags = 0; + vap->va_filerev = VNOVAL; } /* diff --git a/sys/sys/stat.h b/sys/sys/stat.h index dabf121f45fe..15b7ec99bdd9 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -185,7 +185,8 @@ struct stat { blksize_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ __uint64_t st_gen; /* file generation number */ - __uint64_t st_spare[10]; + __uint64_t st_filerev; /* file revision, incr on changes */ + __uint64_t st_spare[9]; }; #ifdef _KERNEL diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 42973adac287..00f8a1eabc4e 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -989,6 +989,7 @@ void vop_rename_fail(struct vop_rename_args *ap); ap->a_sb->st_padding0 = 0; \ ap->a_sb->st_padding1 = 0; \ bzero(_ap->a_sb->st_spare, sizeof(_ap->a_sb->st_spare)); \ + ap->a_sb->st_filerev = 0; \ } \ _error; \ }) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 0bca40199071..9aea01e70951 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -549,6 +549,7 @@ ufs_stat(struct vop_stat_args *ap) sb->st_birthtim.tv_sec = -1; sb->st_birthtim.tv_nsec = 0; sb->st_blocks = dbtob((uint64_t)ip->i_din1->di_blocks) / S_BLKSIZE; + sb->st_filerev = ip->i_din1->di_modrev; } else { sb->st_rdev = ip->i_din2->di_rdev; sb->st_size = ip->i_din2->di_size; @@ -559,6 +560,7 @@ ufs_stat(struct vop_stat_args *ap) sb->st_birthtim.tv_sec = ip->i_din2->di_birthtime; sb->st_birthtim.tv_nsec = ip->i_din2->di_birthnsec; sb->st_blocks = dbtob((uint64_t)ip->i_din2->di_blocks) / S_BLKSIZE; + sb->st_filerev = ip->i_din2->di_modrev; } sb->st_blksize = max(PAGE_SIZE, vp->v_mount->mnt_stat.f_iosize); From nobody Thu Jan 16 20:08:21 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYv7b5n0yz5ks7L; Thu, 16 Jan 2025 20:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYv7b53GMz3tZF; Thu, 16 Jan 2025 20:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737058107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xfI2LPCGQkZ7DbUY4uup4QVPJdZdGL4DFBh46Nvtn00=; b=h2gKbY9ruWyeTJixSnMuvjkqhdAt+6wqHVLoUsHVFfNJC90QGNQAInvdIEGLR59XZ+HngL nAgkU861nq7HdmJjHlgInwR0gPk1BrILSBAdpB7Ij0jchYRH03t5D+3Qt43CLZsxktJZl9 yKBaum7FTzqN3neUwVkgxhKp5tAH12hocxwT1fDNGSQdstVKJ9F6rlwFrcfDq8p9A2kNJ5 rvB4044WAY99EgWZfCiibolZFbsLyyUGOunILhnHLFzXpxFll+acmxWEmtmY0c9i+oqqQs uSiHzYWe7Fx6AMlgXZ8aXycNC8LsGlKBZp58ET88pJcMT3V8aYnc47CDXvOGiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737058107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xfI2LPCGQkZ7DbUY4uup4QVPJdZdGL4DFBh46Nvtn00=; b=qHKwvLaTa16HPAtoRT9hxPQ6dyIwo/PNrZS7NxpMHB0u7dPe0FSoBTpOPOsFenGyEHKQh6 hP2L3jc8320u1yFTOav1g42NOZ8wqo0tqk0iAg4VZ4/UZy5yBJrZAT7BKs3JNs9HX/xD/+ 6USnTGFDRGHXFRTKnAc1yTIsz5Z19X8m65mWc3e1sGd8CuQupLyHBKeF9xsURlKC0S2jts +frzo8cWAbq+hsjew5UxHYb7enoG05r1OaqnrFYMFncodYpFP4Cxdm6pTVvTATylobjO4I dreNJ8NvJxLuLvwzaORZxk0kG5d7yVRLiD/+17XcilGJ+3YjMphXmxpVwpmJ8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737058107; a=rsa-sha256; cv=none; b=Bk5Y8MnlBi5dxxtjcfQI1XTGs5ZDUILMVWw6bNljBJOdGv7+Q8maJQkGYk1sY4bMujl1HV dun9LYrrDSgxAZ4Uo85887YDstblZCXXAZ7pb3wFO6mqJu5wOcIy/gilDyjxZST43xZfFF Qd/qGZwWV20qDTfVr+IH6YmBlOiMlUH6phZuJIk3eXv74ZFF03+tn3btaU/RYcY5/NHKeh pCJwDp87Jk6yPSvezTo2x4Ip/4suQ/M0jhkPk/rMYTlDiBM7jiqg6r4UDj9sJrMA5JbUFc bixalkT59h0VZHYzGmuic4LX1KV1Kk+QXC2QmPWSjCZNt6qXWUbGc8IZ/vHy+w== 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 4YYv7b4ZfjzmvQ; Thu, 16 Jan 2025 20:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50GK8Rmk019126; Thu, 16 Jan 2025 20:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50GK8LI3019075; Thu, 16 Jan 2025 20:08:21 GMT (envelope-from git) Date: Thu, 16 Jan 2025 20:08:21 GMT Message-Id: <202501162008.50GK8LI3019075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 6c05f3a74f30 - main - Merge llvm-project release/19.x llvmorg-19.1.7-0-gcd708029e0b2 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org 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/main X-Git-Reftype: branch X-Git-Commit: 6c05f3a74f30934ee60919cc97e16ec69b542b06 Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=6c05f3a74f30934ee60919cc97e16ec69b542b06 commit 6c05f3a74f30934ee60919cc97e16ec69b542b06 Merge: b4663a8d1117 a51c056eb719 Author: Dimitry Andric AuthorDate: 2025-01-16 20:04:36 +0000 Commit: Dimitry Andric CommitDate: 2025-01-16 20:06:51 +0000 Merge llvm-project release/19.x llvmorg-19.1.7-0-gcd708029e0b2 This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project release/19.x llvmorg-19.1.7-0-gcd708029e0b2, a.k.a. 19.1.7 release. PR: 280562 MFC after: 3 days contrib/llvm-project/clang/lib/Driver/Driver.cpp | 5 + .../clang/lib/Driver/ToolChains/Hexagon.cpp | 2 +- .../clang/lib/Format/UnwrappedLineParser.cpp | 2 +- .../llvm-project/clang/lib/Sema/SemaDeclCXX.cpp | 2 +- .../compiler-rt/lib/lsan/lsan_interceptors.cpp | 2 + contrib/llvm-project/libcxx/include/__config | 2 +- .../llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h | 2 +- .../CodeGen/SelectionDAG/LegalizeVectorTypes.cpp | 8 +- .../llvm-project/llvm/lib/MC/WasmObjectWriter.cpp | 111 +++++++++++++-------- .../lib/Target/Hexagon/HexagonISelLowering.cpp | 4 + .../llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 11 +- .../llvm/lib/Target/RISCV/RISCVInstrInfo.cpp | 7 ++ .../lib/Target/RISCV/RISCVInstrInfoVPseudos.td | 17 ++-- .../llvm/lib/Target/RISCV/RISCVInstrInfoXCV.td | 2 +- .../llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td | 5 +- .../AggressiveInstCombine.cpp | 3 +- .../lib/Transforms/Scalar/SimpleLoopUnswitch.cpp | 5 +- .../lib/Transforms/Vectorize/SLPVectorizer.cpp | 5 +- lib/clang/include/VCSVersion.inc | 6 +- lib/clang/include/clang/Basic/Version.inc | 6 +- lib/clang/include/lld/Common/Version.inc | 2 +- lib/clang/include/lldb/Version/Version.inc | 6 +- lib/clang/include/llvm/Config/config.h | 4 +- lib/clang/include/llvm/Config/llvm-config.h | 4 +- lib/clang/include/llvm/Support/VCSRevision.h | 2 +- 25 files changed, 138 insertions(+), 87 deletions(-) diff --cc lib/clang/include/VCSVersion.inc index 7624a2e4b17a,000000000000..a18ba351aaab mode 100644,000000..100644 --- a/lib/clang/include/VCSVersion.inc +++ b/lib/clang/include/VCSVersion.inc @@@ -1,8 -1,0 +1,8 @@@ - #define LLVM_REVISION "llvmorg-19.1.5-0-gab4b5a2db582" ++#define LLVM_REVISION "llvmorg-19.1.7-0-gcd708029e0b2" +#define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git" + - #define CLANG_REVISION "llvmorg-19.1.5-0-gab4b5a2db582" ++#define CLANG_REVISION "llvmorg-19.1.7-0-gcd708029e0b2" +#define CLANG_REPOSITORY "https://github.com/llvm/llvm-project.git" + - #define LLDB_REVISION "llvmorg-19.1.5-0-gab4b5a2db582" ++#define LLDB_REVISION "llvmorg-19.1.7-0-gcd708029e0b2" +#define LLDB_REPOSITORY "https://github.com/llvm/llvm-project.git" diff --cc lib/clang/include/clang/Basic/Version.inc index 5104f9d7ad7a,000000000000..92e55f9316cf mode 100644,000000..100644 --- a/lib/clang/include/clang/Basic/Version.inc +++ b/lib/clang/include/clang/Basic/Version.inc @@@ -1,8 -1,0 +1,8 @@@ - #define CLANG_VERSION 19.1.5 - #define CLANG_VERSION_STRING "19.1.5" ++#define CLANG_VERSION 19.1.7 ++#define CLANG_VERSION_STRING "19.1.7" +#define CLANG_VERSION_MAJOR 19 +#define CLANG_VERSION_MAJOR_STRING "19" +#define CLANG_VERSION_MINOR 1 - #define CLANG_VERSION_PATCHLEVEL 5 ++#define CLANG_VERSION_PATCHLEVEL 7 + +#define CLANG_VENDOR "FreeBSD " diff --cc lib/clang/include/lld/Common/Version.inc index 31f15b8a74f8,000000000000..0643da4abbf4 mode 100644,000000..100644 --- a/lib/clang/include/lld/Common/Version.inc +++ b/lib/clang/include/lld/Common/Version.inc @@@ -1,4 -1,0 +1,4 @@@ +// Local identifier in __FreeBSD_version style +#define LLD_FREEBSD_VERSION 1500001 + - #define LLD_VERSION_STRING "19.1.5 (FreeBSD llvmorg-19.1.5-0-gab4b5a2db582-" __XSTRING(LLD_FREEBSD_VERSION) ")" ++#define LLD_VERSION_STRING "19.1.7 (FreeBSD llvmorg-19.1.7-0-gcd708029e0b2-" __XSTRING(LLD_FREEBSD_VERSION) ")" diff --cc lib/clang/include/lldb/Version/Version.inc index 5aa1f29215b4,000000000000..02d44970ff54 mode 100644,000000..100644 --- a/lib/clang/include/lldb/Version/Version.inc +++ b/lib/clang/include/lldb/Version/Version.inc @@@ -1,6 -1,0 +1,6 @@@ - #define LLDB_VERSION 19.1.5 - #define LLDB_VERSION_STRING "19.1.5" ++#define LLDB_VERSION 19.1.7 ++#define LLDB_VERSION_STRING "19.1.7" +#define LLDB_VERSION_MAJOR 19 +#define LLDB_VERSION_MINOR 1 - #define LLDB_VERSION_PATCH 5 ++#define LLDB_VERSION_PATCH 7 +/* #undef LLDB_FULL_VERSION_STRING */ diff --cc lib/clang/include/llvm/Config/config.h index f86e4b6b5946,000000000000..1968fb5072c9 mode 100644,000000..100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@@ -1,372 -1,0 +1,372 @@@ +#ifndef CONFIG_H +#define CONFIG_H + +// Include this header only under the llvm source tree. +// This is a private header. + +/* Exported configuration */ +#include "llvm/Config/llvm-config.h" + +/* Bug report URL. */ +#define BUG_REPORT_URL "https://bugs.freebsd.org/submit/" + +/* Define to 1 to enable backtraces, and to 0 otherwise. */ +#define ENABLE_BACKTRACES 1 + +/* Define to 1 to enable crash overrides, and to 0 otherwise. */ +#define ENABLE_CRASH_OVERRIDES 1 + +/* Define to 1 to enable crash memory dumps, and to 0 otherwise. */ +#define LLVM_ENABLE_CRASH_DUMPS 0 + +/* Define to 1 to prefer forward slashes on Windows, and to 0 prefer + backslashes. */ +#define LLVM_WINDOWS_PREFER_FORWARD_SLASH 0 + +/* Define to 1 if you have the `backtrace' function. */ +#define HAVE_BACKTRACE TRUE + +#define BACKTRACE_HEADER + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CRASHREPORTERCLIENT_H */ + +/* can use __crashreporter_info__ */ +#if defined(__APPLE__) +#define HAVE_CRASHREPORTER_INFO 1 +#else +#define HAVE_CRASHREPORTER_INFO 0 +#endif + +/* Define to 1 if you have the declaration of `arc4random', and to 0 if you + don't. */ +#define HAVE_DECL_ARC4RANDOM 1 + +/* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you + don't. */ +#define HAVE_DECL_FE_ALL_EXCEPT 1 + +/* Define to 1 if you have the declaration of `FE_INEXACT', and to 0 if you + don't. */ +#define HAVE_DECL_FE_INEXACT 1 + +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_S 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define if dlopen() is available on this platform. */ +#define HAVE_DLOPEN 1 + +/* Define if dladdr() is available on this platform. */ +#define HAVE_DLADDR 1 + +#if !defined(__arm__) || defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__) +/* Define to 1 if we can register EH frames on this platform. */ +#define HAVE_REGISTER_FRAME 1 + +/* Define to 1 if we can deregister EH frames on this platform. */ +#define HAVE_DEREGISTER_FRAME 1 +#endif // !arm || USING_SJLJ_EXCEPTIONS || ARM_DWARF_EH_ + +/* Define if __unw_add_dynamic_fde() is available on this platform. */ +/* #undef HAVE_UNW_ADD_DYNAMIC_FDE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FENV_H 1 + +/* Define if libffi is available on this platform. */ +/* #undef HAVE_FFI_CALL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FFI_FFI_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FFI_H */ + +/* Define to 1 if you have the `futimens' function. */ +#define HAVE_FUTIMENS 1 + +/* Define to 1 if you have the `futimes' function. */ +#define HAVE_FUTIMES 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `getrlimit' function. */ +#define HAVE_GETRLIMIT 1 + +/* Define to 1 if you have the `getrusage' function. */ +#define HAVE_GETRUSAGE 1 + +/* Define to 1 if you have the `isatty' function. */ +#define HAVE_ISATTY 1 + +/* Define to 1 if you have the `edit' library (-ledit). */ +#define HAVE_LIBEDIT TRUE + +/* Define to 1 if you have the `pfm' library (-lpfm). */ +/* #undef HAVE_LIBPFM */ + +/* Define to 1 if the `perf_branch_entry' struct has field cycles. */ +/* #undef LIBPFM_HAS_FIELD_CYCLES */ + +/* Define to 1 if you have the `psapi' library (-lpsapi). */ +/* #undef HAVE_LIBPSAPI */ + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#define HAVE_LIBPTHREAD 1 + +/* Define to 1 if you have the `pthread_getname_np' function. */ +#define HAVE_PTHREAD_GETNAME_NP 1 + +/* Define to 1 if you have the `pthread_setname_np' function. */ +#define HAVE_PTHREAD_SETNAME_NP 1 + +/* Define to 1 if you have the header file. */ +#if __has_include() +#define HAVE_LINK_H 1 +#else +#define HAVE_LINK_H 0 +#endif + +/* Define to 1 if you have the header file. */ +#if __has_include() +#define HAVE_MACH_MACH_H 1 +#endif + +/* Define to 1 if you have the `mallctl' function. */ +#if defined(__FreeBSD__) +#define HAVE_MALLCTL 1 +#endif + +/* Define to 1 if you have the `mallinfo' function. */ +#if defined(__linux__) +#define HAVE_MALLINFO 1 +#endif + +/* Define to 1 if you have the `mallinfo2' function. */ +/* #undef HAVE_MALLINFO2 */ + +/* Define to 1 if you have the header file. */ +#if __has_include() +#define HAVE_MALLOC_MALLOC_H 1 +#endif + +/* Define to 1 if you have the `malloc_zone_statistics' function. */ +#if defined(__APPLE__) +#define HAVE_MALLOC_ZONE_STATISTICS 1 +#endif + +/* Define to 1 if you have the `posix_spawn' function. */ +#define HAVE_POSIX_SPAWN 1 + +/* Define to 1 if you have the `pread' function. */ +#define HAVE_PREAD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Have pthread_mutex_lock */ +#define HAVE_PTHREAD_MUTEX_LOCK 1 + +/* Have pthread_rwlock_init */ +#define HAVE_PTHREAD_RWLOCK_INIT 1 + +/* Define to 1 if you have the `sbrk' function. */ +#define HAVE_SBRK 1 + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the `sigaltstack' function. */ +#define HAVE_SIGALTSTACK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `sysconf' function. */ +#define HAVE_SYSCONF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if stat struct has st_mtimespec member .*/ +#if !defined(__linux__) +#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#endif + +/* Define to 1 if stat struct has st_mtim member. */ +#if !defined(__APPLE__) +#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VALGRIND_VALGRIND_H */ + +/* Have host's _alloca */ +/* #undef HAVE__ALLOCA */ + +/* Define to 1 if you have the `_chsize_s' function. */ +/* #undef HAVE__CHSIZE_S */ + +/* Define to 1 if you have the `_Unwind_Backtrace' function. */ +#define HAVE__UNWIND_BACKTRACE 1 + +/* Have host's __alloca */ +/* #undef HAVE___ALLOCA */ + +/* Have host's __ashldi3 */ +/* #undef HAVE___ASHLDI3 */ + +/* Have host's __ashrdi3 */ +/* #undef HAVE___ASHRDI3 */ + +/* Have host's __chkstk */ +/* #undef HAVE___CHKSTK */ + +/* Have host's __chkstk_ms */ +/* #undef HAVE___CHKSTK_MS */ + +/* Have host's __cmpdi2 */ +/* #undef HAVE___CMPDI2 */ + +/* Have host's __divdi3 */ +/* #undef HAVE___DIVDI3 */ + +/* Have host's __fixdfdi */ +/* #undef HAVE___FIXDFDI */ + +/* Have host's __fixsfdi */ +/* #undef HAVE___FIXSFDI */ + +/* Have host's __floatdidf */ +/* #undef HAVE___FLOATDIDF */ + +/* Have host's __lshrdi3 */ +/* #undef HAVE___LSHRDI3 */ + +/* Have host's __main */ +/* #undef HAVE___MAIN */ + +/* Have host's __moddi3 */ +/* #undef HAVE___MODDI3 */ + +/* Have host's __udivdi3 */ +/* #undef HAVE___UDIVDI3 */ + +/* Have host's __umoddi3 */ +/* #undef HAVE___UMODDI3 */ + +/* Have host's ___chkstk */ +/* #undef HAVE____CHKSTK */ + +/* Have host's ___chkstk_ms */ +/* #undef HAVE____CHKSTK_MS */ + +/* Linker version detected at compile time. */ +/* #undef HOST_LINK_VERSION */ + +/* Define if overriding target triple is enabled */ +/* #undef LLVM_TARGET_TRIPLE_ENV */ + +/* Whether tools show host and target info when invoked with --version */ +#define LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO 1 + +/* Whether tools show optional build config flags when invoked with --version */ +#define LLVM_VERSION_PRINTER_SHOW_BUILD_CONFIG 1 + +/* Define if libxml2 is supported on this platform. */ +/* #undef LLVM_ENABLE_LIBXML2 */ + +/* Define to the extension used for shared libraries, say, ".so". */ +#if defined(__APPLE__) +#define LTDL_SHLIB_EXT ".dylib" +#else +#define LTDL_SHLIB_EXT ".so" +#endif + +/* Define to the extension used for plugin libraries, say, ".so". */ +#if defined(__APPLE__) +#define LLVM_PLUGIN_EXT ".dylib" +#else +#define LLVM_PLUGIN_EXT ".so" +#endif + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "https://bugs.freebsd.org/submit/" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "LLVM" + +/* Define to the full name and version of this package. */ - #define PACKAGE_STRING "LLVM 19.1.5" ++#define PACKAGE_STRING "LLVM 19.1.7" + +/* Define to the version of this package. */ - #define PACKAGE_VERSION "19.1.5" ++#define PACKAGE_VERSION "19.1.7" + +/* Define to the vendor of this package. */ +/* #undef PACKAGE_VENDOR */ + +/* Define to a function implementing stricmp */ +/* #undef stricmp */ + +/* Define to a function implementing strdup */ +/* #undef strdup */ + +/* Whether GlobalISel rule coverage is being collected */ +#define LLVM_GISEL_COV_ENABLED 0 + +/* Define to the default GlobalISel coverage file prefix */ +/* #undef LLVM_GISEL_COV_PREFIX */ + +/* Whether Timers signpost passes in Xcode Instruments */ +#if defined(__APPLE__) +#define LLVM_SUPPORT_XCODE_SIGNPOSTS 1 +#else +#define LLVM_SUPPORT_XCODE_SIGNPOSTS 0 +#endif + +/* #undef HAVE_PROC_PID_RUSAGE */ + +#define HAVE_BUILTIN_THREAD_POINTER 1 + +#endif diff --cc lib/clang/include/llvm/Config/llvm-config.h index 966249436723,000000000000..4ca2d0083398 mode 100644,000000..100644 --- a/lib/clang/include/llvm/Config/llvm-config.h +++ b/lib/clang/include/llvm/Config/llvm-config.h @@@ -1,232 -1,0 +1,232 @@@ +/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- C -*-===*/ +/* */ +/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */ +/* Exceptions. */ +/* See https://llvm.org/LICENSE.txt for license information. */ +/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ +/* */ +/*===----------------------------------------------------------------------===*/ + +/* This file enumerates variables from the LLVM configuration so that they + can be in exported headers and won't override package specific directives. + This is a C header that can be included in the llvm-c headers. */ + +#ifndef LLVM_CONFIG_H +#define LLVM_CONFIG_H + +/* Define if LLVM_ENABLE_DUMP is enabled */ +/* #undef LLVM_ENABLE_DUMP */ + +/* Target triple LLVM will generate code for by default */ +/* Doesn't use `cmakedefine` because it is allowed to be empty. */ +/* #undef LLVM_DEFAULT_TARGET_TRIPLE */ + +/* Define if threads enabled */ +#define LLVM_ENABLE_THREADS 1 + +/* Has gcc/MSVC atomic intrinsics */ +#define LLVM_HAS_ATOMICS 1 + +/* Host triple LLVM will be executed on */ +/* #undef LLVM_HOST_TRIPLE */ + +/* LLVM architecture name for the native architecture, if available */ +/* #undef LLVM_NATIVE_ARCH */ + +/* LLVM name for the native AsmParser init function, if available */ +/* #undef LLVM_NATIVE_ASMPARSER */ + +/* LLVM name for the native AsmPrinter init function, if available */ +/* #undef LLVM_NATIVE_ASMPRINTER */ + +/* LLVM name for the native Disassembler init function, if available */ +/* #undef LLVM_NATIVE_DISASSEMBLER */ + +/* LLVM name for the native Target init function, if available */ +/* #undef LLVM_NATIVE_TARGET */ + +/* LLVM name for the native TargetInfo init function, if available */ +/* #undef LLVM_NATIVE_TARGETINFO */ + +/* LLVM name for the native target MC init function, if available */ +/* #undef LLVM_NATIVE_TARGETMC */ + +/* LLVM name for the native target MCA init function, if available */ +/* #undef LLVM_NATIVE_TARGETMCA */ + +/* Define if the AArch64 target is built in */ +#ifdef LLVM_TARGET_ENABLE_AARCH64 +#define LLVM_HAS_AARCH64_TARGET 1 +#else +#define LLVM_HAS_AARCH64_TARGET 0 +#endif + +/* Define if the AMDGPU target is built in */ +#define LLVM_HAS_AMDGPU_TARGET 0 + +/* Define if the ARC target is built in */ +#define LLVM_HAS_ARC_TARGET 0 + +/* Define if the ARM target is built in */ +#ifdef LLVM_TARGET_ENABLE_ARM +#define LLVM_HAS_ARM_TARGET 1 +#else +#define LLVM_HAS_ARM_TARGET 0 +#endif + +/* Define if the AVR target is built in */ +#define LLVM_HAS_AVR_TARGET 0 + +/* Define if the BPF target is built in */ +#ifdef LLVM_TARGET_ENABLE_BPF +#define LLVM_HAS_BPF_TARGET 1 +#else +#define LLVM_HAS_BPF_TARGET 0 +#endif + +/* Define if the CSKY target is built in */ +#define LLVM_HAS_CSKY_TARGET 0 + +/* Define if the DirectX target is built in */ +#define LLVM_HAS_DIRECTX_TARGET 0 + +/* Define if the Hexagon target is built in */ +#define LLVM_HAS_HEXAGON_TARGET 0 + +/* Define if the Lanai target is built in */ +#define LLVM_HAS_LANAI_TARGET 0 + +/* Define if the LoongArch target is built in */ +#define LLVM_HAS_LOONGARCH_TARGET 0 + +/* Define if the M68k target is built in */ +#define LLVM_HAS_M68K_TARGET 0 + +/* Define if the Mips target is built in */ +#ifdef LLVM_TARGET_ENABLE_MIPS +#define LLVM_HAS_MIPS_TARGET 1 +#else +#define LLVM_HAS_MIPS_TARGET 0 +#endif + +/* Define if the MSP430 target is built in */ +#define LLVM_HAS_MSP430_TARGET 0 + +/* Define if the NVPTX target is built in */ +#define LLVM_HAS_NVPTX_TARGET 0 + +/* Define if the PowerPC target is built in */ +#ifdef LLVM_TARGET_ENABLE_POWERPC +#define LLVM_HAS_POWERPC_TARGET 1 +#else +#define LLVM_HAS_POWERPC_TARGET 0 +#endif + +/* Define if the RISCV target is built in */ +#ifdef LLVM_TARGET_ENABLE_RISCV +#define LLVM_HAS_RISCV_TARGET 1 +#else +#define LLVM_HAS_RISCV_TARGET 0 +#endif + +/* Define if the Sparc target is built in */ +#define LLVM_HAS_SPARC_TARGET 0 + +/* Define if the SPIRV target is built in */ +#define LLVM_HAS_SPIRV_TARGET 0 + +/* Define if the SystemZ target is built in */ +#define LLVM_HAS_SYSTEMZ_TARGET 0 + +/* Define if the VE target is built in */ +#define LLVM_HAS_VE_TARGET 0 + +/* Define if the WebAssembly target is built in */ +#define LLVM_HAS_WEBASSEMBLY_TARGET 0 + +/* Define if the X86 target is built in */ +#ifdef LLVM_TARGET_ENABLE_X86 +#define LLVM_HAS_X86_TARGET 1 +#else +#define LLVM_HAS_X86_TARGET 0 +#endif + +/* Define if the XCore target is built in */ +#define LLVM_HAS_XCORE_TARGET 0 + +/* Define if the Xtensa target is built in */ +#define LLVM_HAS_XTENSA_TARGET 0 + +/* Define if this is Unixish platform */ +#define LLVM_ON_UNIX 1 + +/* Define if we have the Intel JIT API runtime support library */ +#define LLVM_USE_INTEL_JITEVENTS 0 + +/* Define if we have the oprofile JIT-support library */ +#define LLVM_USE_OPROFILE 0 + +/* Define if we have the perf JIT-support library */ +#define LLVM_USE_PERF 0 + +/* Major version of the LLVM API */ +#define LLVM_VERSION_MAJOR 19 + +/* Minor version of the LLVM API */ +#define LLVM_VERSION_MINOR 1 + +/* Patch version of the LLVM API */ - #define LLVM_VERSION_PATCH 5 ++#define LLVM_VERSION_PATCH 7 + +/* LLVM version string */ - #define LLVM_VERSION_STRING "19.1.5" ++#define LLVM_VERSION_STRING "19.1.7" + +/* Whether LLVM records statistics for use with GetStatistics(), + * PrintStatistics() or PrintStatisticsJSON() + */ +#define LLVM_FORCE_ENABLE_STATS 0 + +/* Define if we have z3 and want to build it */ +/* #undef LLVM_WITH_Z3 */ + +/* Define if we have curl and want to use it */ +/* #undef LLVM_ENABLE_CURL */ + +/* Define if we have cpp-httplib and want to use it */ +/* #undef LLVM_ENABLE_HTTPLIB */ + +/* Define if zlib compression is available */ +#define LLVM_ENABLE_ZLIB 1 + +/* Define if zstd compression is available */ +#define LLVM_ENABLE_ZSTD 1 + +/* Define if LLVM is using tflite */ +/* #undef LLVM_HAVE_TFLITE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSEXITS_H 1 + +/* Define if building libLLVM shared library */ +/* #undef LLVM_BUILD_LLVM_DYLIB */ + +/* Define if building LLVM with BUILD_SHARED_LIBS */ +/* #undef LLVM_BUILD_SHARED_LIBS */ + +/* Define if building LLVM with LLVM_FORCE_USE_OLD_TOOLCHAIN_LIBS */ +/* #undef LLVM_FORCE_USE_OLD_TOOLCHAIN */ + +/* Define if llvm_unreachable should be optimized with undefined behavior + * in non assert builds */ +#define LLVM_UNREACHABLE_OPTIMIZE 1 + +/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */ +#define LLVM_ENABLE_DIA_SDK 0 + +/* Define if plugins enabled */ +/* #undef LLVM_ENABLE_PLUGINS */ + +/* Define if logf128 is available */ +/* #undef LLVM_HAS_LOGF128 */ + +#endif diff --cc lib/clang/include/llvm/Support/VCSRevision.h index db3347a0e5a5,000000000000..76aa3f075586 mode 100644,000000..100644 --- a/lib/clang/include/llvm/Support/VCSRevision.h +++ b/lib/clang/include/llvm/Support/VCSRevision.h @@@ -1,2 -1,0 +1,2 @@@ - #define LLVM_REVISION "llvmorg-19.1.5-0-gab4b5a2db582" ++#define LLVM_REVISION "llvmorg-19.1.7-0-gcd708029e0b2" +#define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git" From nobody Thu Jan 16 21:52:22 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYxRY0ngqz5kyl9; Thu, 16 Jan 2025 21:52:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYxRY00Jjz45HZ; Thu, 16 Jan 2025 21:52:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737064345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+sa7KL/GXqxUUbCVl1l54kvoBmcE5pIpSzJNGfIHsr4=; b=q2R84O5jrgBmk+xZlPubQUvGuqrur4lS+ZeANvcbogrIcSdzgu25zcoP3svkM0RVXTLGnF fCQh6FSdQVyKg9Lx24q4uCTRMel1yGgi1eC7PHoL5bdaQU1zoYllBugq/4gz30SiaALkK9 WvX6ESHq1TJ8Z6jyYK+g7tZ/dzE+Y3wnycbGT46QQ/fUL6Nr1XF/YzrQOlz6QEakpevr5V NVLczfhVLLsJVu4BdzcQIEIh51vtNLQSxWl1RMIjHSFAQk1XMrN7IQ3WR++9eTdLQdPoXe kjVQekB9H9cvjgcAYN0JXyTI9bY4jjagqc+pym6c/tfs6NhYbV1tZsRcn0A0mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737064345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+sa7KL/GXqxUUbCVl1l54kvoBmcE5pIpSzJNGfIHsr4=; b=VkZ+ECCemzmxXWHFpvv5xDj8fb+f3qP56o8nE6DhALWnvg/s0ruF7H8psf+lAMcO2gEg0L GGvqm4/RbCOA9bZ20BADERZSr58r1y0fIgKGm9xuaRTDjulcyvW/nOQK3TjpymQTVfhbfz 0FhA+FMFwgVg+QYTLIO5zEiBvd0G4KptL2ukHlP0YGUl8PkYtlKwokcxcf2F27aXO8SE6E UVpUuDu3mbxssEhwyij2+SMymbm7yNRFlhAGZZw9LyK2OvMp068qugyFgK4zIx8hCJjj95 33yKZmub5gprKgt/8iqCJguiEx9nbM/aWINXldXhFfWLo/4o57lmY7mAQFx32Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737064345; a=rsa-sha256; cv=none; b=Ln9MLrKbadjruJvlfxS6lzyDExEMb/kb0EzEc2k1rL8IirJ7CyY5w0rZMo45No3b7dgwh8 OLywhzBGaI9sleJqvbBWMraU3fTvv1ErWkEEjXiiKzS/q9bh9pqnSyyH/eUWxTWSaoEAL0 dCwLkpQuvLBfxjgOg8cQ6b6m163kJYDor0vYB5a9n6oTjdU6FkwUDysSdW4kVwrpGxC9De Yu3azfZ7aXrs2Ha5txr1NIjznW6RAVcmqX8ZolAx+liNkCOoNYnXGmLXrmG97NhXmlLV60 Dikks3X0XKvaBZNjrj/1j72IX2aLwTo4ivnQmml4DCOZiaGAd43oTf61aifxYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YYxRX27Nrz10W3; Thu, 16 Jan 2025 21:52:24 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <25a28def-fbfd-49df-a2bf-dc4ef6609440@FreeBSD.org> Date: Thu, 16 Jan 2025 15:52:22 -0600 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 9ded074e875c - main - Refactor makesyscalls.lua into a library To: Brooks Davis , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org, Warner Losh References: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> Content-Language: en-US From: Kyle Evans In-Reply-To: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/30/24 16:08, Brooks Davis wrote: > The branch main has been updated by brooks: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9ded074e875c29cb92d5f643801990d7bb23cca4 > > commit 9ded074e875c29cb92d5f643801990d7bb23cca4 > Author: agge3 > AuthorDate: 2024-10-21 21:42:13 +0000 > Commit: Brooks Davis > CommitDate: 2024-10-30 21:04:30 +0000 > > Refactor makesyscalls.lua into a library > > * main.lua replicates the functionality of makesyscalls.lua > * Individual files are generated by their associated module > * Modules can be called as standalone scripts to generate a specific > file > * Data and procedures are performed by objects instead of procedual code > * Bitmasks are replaced by declarative types > * Temporary files are no longer produced, writing is stored in memory > * Comments provide explanation to functions and semantics > > Google Summer of Code 2024 Final Work Product > > Co-authored-by: Warner Losh > Co-authored-by: Kyle Evans > Co-authored-by: Brooks Davis > Sponsored by: Google (GSoC 24) > Pull Request: https://github.com/freebsd/freebsd-src/pull/1362 > Signed-off-by: agge3 > --- > sys/tools/syscalls/README.md | 49 +++ > sys/tools/syscalls/config.lua | 312 +++++++++++++++++ > sys/tools/syscalls/core/freebsd-syscall.lua | 147 ++++++++ > sys/tools/syscalls/core/scarg.lua | 163 +++++++++ > sys/tools/syscalls/core/scret.lua | 45 +++ > sys/tools/syscalls/core/syscall.lua | 497 +++++++++++++++++++++++++++ > sys/tools/syscalls/main.lua | 64 ++++ > sys/tools/syscalls/scripts/init_sysent.lua | 193 +++++++++++ > sys/tools/syscalls/scripts/libsys_h.lua | 111 ++++++ > sys/tools/syscalls/scripts/syscall_h.lua | 97 ++++++ > sys/tools/syscalls/scripts/syscall_mk.lua | 90 +++++ > sys/tools/syscalls/scripts/syscalls.lua | 109 ++++++ > sys/tools/syscalls/scripts/syscalls_map.lua | 74 ++++ > sys/tools/syscalls/scripts/sysproto_h.lua | 242 +++++++++++++ > sys/tools/syscalls/scripts/systrace_args.lua | 268 +++++++++++++++ > sys/tools/syscalls/tools/generator.lua | 113 ++++++ > sys/tools/syscalls/tools/util.lua | 194 +++++++++++ > 17 files changed, 2768 insertions(+) > > [...] > diff --git a/sys/tools/syscalls/core/freebsd-syscall.lua b/sys/tools/syscalls/core/freebsd-syscall.lua > new file mode 100644 > index 000000000000..193b1e43563c > --- /dev/null > +++ b/sys/tools/syscalls/core/freebsd-syscall.lua > @@ -0,0 +1,147 @@ > [...] > +function FreeBSDSyscall:parseSysfile() > + local file = self.sysfile > + local config = self.config > + local commentExpr = "^%s*;.*" > + > + if file == nil then > + return nil, "No file given" > + end > + > + self.syscalls = {} > + > + local fh, msg = io.open(file) > + if fh == nil then > + return nil, msg > + end > + > + local incs = "" > + local defs = "" > + local s > + for line in fh:lines() do > + line = line:gsub(commentExpr, "") -- Strip any comments. > + -- NOTE: Can't use pure pattern matching here because of > + -- the 's' test and this is shorter than a generic pattern > + -- matching pattern. > + if line == nil or line == "" then > + goto skip -- Blank line, skip this line. > + elseif s ~= nil then > + -- If we have a partial system call object s, > + -- then feed it one more line. > + if s:add(line) then > + -- Append to system call list. > + for t in s:iter() do > + if t:validate(t.num - 1) then > + table.insert(self.syscalls, t) > + else > + util.abort(1, > + "Skipped system call " .. > + "at number " .. t.num) > + end > + end > + s = nil > + end > + elseif line:match("^#%s*include") then > + incs = incs .. line .. "\n" > + elseif line:match("%%ABI_HEADERS%%") then > + local h = self.config.abi_headers > + if h ~= nil and h ~= "" then > + incs = incs .. h .. "\n" > + end > + elseif line:match("^#%s*define") then > + defs = defs .. line.. "\n" > + elseif line:match("^#") then > + util.abort(1, "Unsupported cpp op " .. line) This specifically is kind of a huge regression, and I don't really know how to cope with it. We've guaranteed for years that we'll copy preprocessor directives through to all output files. We don't use that upstream in FreeBSD, but we work with downstreams/vendors that make extensive use of it in their syscall definitions. I don't really know what the answer is to this, but we probably shouldn't have dropped it without some discussion first. This is going to be a bit of a headache... > [...] Thanks, Kyle Evans From nobody Thu Jan 16 22:43:07 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YYyZ41dRHz5l1Yp; Thu, 16 Jan 2025 22:43:08 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YYyZ374hdz49Vy; Thu, 16 Jan 2025 22:43:07 +0000 (UTC) (envelope-from brooks@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737067388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aMY/wnleGUiFshyaRA0mSCPajKzd5Uogozbhc4UxxsQ=; b=Dr2rn2PQ/GqRfwipcFBYdHybAok7avPpXNYdJo5OLPzSe1IQdBsuyfQEMew90p+y5MOY+c C1rbG9ZzVNCqkhbMyb1iS+sfmctaTS87Cgie6kc1iZ0ugOr00n8Ie4YQW0BVXNJLed+IAg krHL5JVIHr++Oy/SxeVYTRAUFb9ZjWzwaYJGN5KJKplwlomKnM9YC1R1G/nxYFLVedMIvx 274Utx3+mN9qNj7K7fs60zugyWI6zEpyJqvtV55BZBVW7Eyihv3jyIS7yhgkGQhpjz/294 JIJgpBhynKZn+JPr6h+xjlO1z3n5TH3Kn3tWytik2wwPvSGgZZZ5KygodmEklw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737067388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aMY/wnleGUiFshyaRA0mSCPajKzd5Uogozbhc4UxxsQ=; b=QOdWsqJ8v3TMM1aifHfqqz/h7zZyXcFNg8/79vFHMculpOKsSu2oVVUGZmOEMGWW2nMxv4 /BetxNXpX2jfJMCxQLqbfWbUA9daXS6ShlmbhHFOkXRCctezlz9m3Tr7zdVbuzY6bj/QO5 HtccO9aIuBncH/4wRUBd6koIJgBhuYSOEcL2gDcgJHV1fy3sLktWLY3hB0CQpJt9bjhSNL 2VgrScnYJUbxoG/WemGrm5RbtRE1vDsGQ4JBF/QbHamhD6aHXVcuMrV+TbiI3DBgiwxxN8 WHIB/ssFQy2pZWvFXRujLKtJFZVyxdXi7KecsYo0JvOH4QbXvt+vcXb5b8jDhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737067388; a=rsa-sha256; cv=none; b=PeMqI75sTM28sep89Ve7YRdhF5tqaR9T5jFSt24pDX5OroNDQc0+ugMzO+cn/JKO7ZbM9+ DixmLoZ+iPurEyP39XjnxFOY3jvyW7iNuf2qcsjeJM7ZJMLJRrP+B/CyHKaWvkGoR5OuMj Rt7joHa/dIPDD6sfFOAzj1N6r6fLPKbxBtUH7p/EaksBzZp8wbjwiCn2uLQ1YsFuQHFNq4 W8c4kKP7eTKS9j7pFr2pGEimitYELHep/O+SaL1gsNPHLbd7JuWslx+6X+2YUYl9Q20TCF 2+Ls8AhGvqQ2/v80SXcTg5iu1m3YB/2jAnvz8YD22FkM84Afi2KLdp/KjfKXPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: brooks/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YYyZ363dtzywp; Thu, 16 Jan 2025 22:43:07 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 1466A3C01A0; Thu, 16 Jan 2025 22:43:07 +0000 (UTC) Date: Thu, 16 Jan 2025 22:43:07 +0000 From: Brooks Davis To: Kyle Evans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Warner Losh Subject: Re: git: 9ded074e875c - main - Refactor makesyscalls.lua into a library Message-ID: References: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> <25a28def-fbfd-49df-a2bf-dc4ef6609440@FreeBSD.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25a28def-fbfd-49df-a2bf-dc4ef6609440@FreeBSD.org> On Thu, Jan 16, 2025 at 03:52:22PM -0600, Kyle Evans wrote: > On 10/30/24 16:08, Brooks Davis wrote: > > The branch main has been updated by brooks: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=9ded074e875c29cb92d5f643801990d7bb23cca4 > > > > commit 9ded074e875c29cb92d5f643801990d7bb23cca4 > > Author: agge3 > > AuthorDate: 2024-10-21 21:42:13 +0000 > > Commit: Brooks Davis > > CommitDate: 2024-10-30 21:04:30 +0000 > > > > Refactor makesyscalls.lua into a library > > * main.lua replicates the functionality of makesyscalls.lua > > * Individual files are generated by their associated module > > * Modules can be called as standalone scripts to generate a specific > > file > > * Data and procedures are performed by objects instead of procedual code > > * Bitmasks are replaced by declarative types > > * Temporary files are no longer produced, writing is stored in memory > > * Comments provide explanation to functions and semantics > > Google Summer of Code 2024 Final Work Product > > Co-authored-by: Warner Losh > > Co-authored-by: Kyle Evans > > Co-authored-by: Brooks Davis > > Sponsored by: Google (GSoC 24) > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1362 > > Signed-off-by: agge3 > > --- > > sys/tools/syscalls/README.md | 49 +++ > > sys/tools/syscalls/config.lua | 312 +++++++++++++++++ > > sys/tools/syscalls/core/freebsd-syscall.lua | 147 ++++++++ > > sys/tools/syscalls/core/scarg.lua | 163 +++++++++ > > sys/tools/syscalls/core/scret.lua | 45 +++ > > sys/tools/syscalls/core/syscall.lua | 497 +++++++++++++++++++++++++++ > > sys/tools/syscalls/main.lua | 64 ++++ > > sys/tools/syscalls/scripts/init_sysent.lua | 193 +++++++++++ > > sys/tools/syscalls/scripts/libsys_h.lua | 111 ++++++ > > sys/tools/syscalls/scripts/syscall_h.lua | 97 ++++++ > > sys/tools/syscalls/scripts/syscall_mk.lua | 90 +++++ > > sys/tools/syscalls/scripts/syscalls.lua | 109 ++++++ > > sys/tools/syscalls/scripts/syscalls_map.lua | 74 ++++ > > sys/tools/syscalls/scripts/sysproto_h.lua | 242 +++++++++++++ > > sys/tools/syscalls/scripts/systrace_args.lua | 268 +++++++++++++++ > > sys/tools/syscalls/tools/generator.lua | 113 ++++++ > > sys/tools/syscalls/tools/util.lua | 194 +++++++++++ > > 17 files changed, 2768 insertions(+) > > > > [...] > > diff --git a/sys/tools/syscalls/core/freebsd-syscall.lua b/sys/tools/syscalls/core/freebsd-syscall.lua > > new file mode 100644 > > index 000000000000..193b1e43563c > > --- /dev/null > > +++ b/sys/tools/syscalls/core/freebsd-syscall.lua > > @@ -0,0 +1,147 @@ > > [...] > > +function FreeBSDSyscall:parseSysfile() > > + local file = self.sysfile > > + local config = self.config > > + local commentExpr = "^%s*;.*" > > + > > + if file == nil then > > + return nil, "No file given" > > + end > > + > > + self.syscalls = {} > > + > > + local fh, msg = io.open(file) > > + if fh == nil then > > + return nil, msg > > + end > > + > > + local incs = "" > > + local defs = "" > > + local s > > + for line in fh:lines() do > > + line = line:gsub(commentExpr, "") -- Strip any comments. > > + -- NOTE: Can't use pure pattern matching here because of > > + -- the 's' test and this is shorter than a generic pattern > > + -- matching pattern. > > + if line == nil or line == "" then > > + goto skip -- Blank line, skip this line. > > + elseif s ~= nil then > > + -- If we have a partial system call object s, > > + -- then feed it one more line. > > + if s:add(line) then > > + -- Append to system call list. > > + for t in s:iter() do > > + if t:validate(t.num - 1) then > > + table.insert(self.syscalls, t) > > + else > > + util.abort(1, > > + "Skipped system call " .. > > + "at number " .. t.num) > > + end > > + end > > + s = nil > > + end > > + elseif line:match("^#%s*include") then > > + incs = incs .. line .. "\n" > > + elseif line:match("%%ABI_HEADERS%%") then > > + local h = self.config.abi_headers > > + if h ~= nil and h ~= "" then > > + incs = incs .. h .. "\n" > > + end > > + elseif line:match("^#%s*define") then > > + defs = defs .. line.. "\n" > > + elseif line:match("^#") then > > + util.abort(1, "Unsupported cpp op " .. line) > > This specifically is kind of a huge regression, and I don't really know how to > cope with it. We've guaranteed for years that we'll copy preprocessor > directives through to all output files. We don't use that upstream in > FreeBSD, but we work with downstreams/vendors that make extensive use of it in > their syscall definitions. > > I don't really know what the answer is to this, but we probably shouldn't have > dropped it without some discussion first. This is going to be a bit of a > headache... This response seems rather hyperbolic. This change was up for review for months and the feature is unused in tree so there was no way to know it was important. It would be helpful to work through some examples understand what people need here and if it really has to be a refactor to pass things through or if adding some new tags and config values could do the job. The quickest workaround would probably to revert these commits locally (I took care to isolate them for exactly this reason): 5212b9500116 sysent: GC sys/tools/makesyscalls.lua 204d065dac81 sysent: switch to refactored makesyscalls.lua You might also need to revert this commit or implement it in makesyscalls.lua: bbc0f33b1317 sysent: add a NOLIB modifer to prevent stub generation If we need be, I'd even be ok with temporarily restoring makesyscalls.lua and back porting easy features, but maintaining two is certainly not viable indefinitely. -- Brooks From nobody Fri Jan 17 01:40:07 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ2VL5FNGz5kCkc; Fri, 17 Jan 2025 01:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ2VL4sgKz3XKh; Fri, 17 Jan 2025 01:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737078010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qDQtufBTS5Q+ehIhi2MUrpK13ESJKgRVYQx/pJA9U9A=; b=JQladfkGjZruI15KIUbwuUXwMv7d+4zEIZSMPv/u3n6hPtaXR2UIe8ppHNH5FzjHMh92JA 4xK8tDBPcint/Vz3HqEE1kaOvnvbTRmhyO7DZWrlOIrPYaGxEv1h72+fMKccQH7FgyR/Ak ehHjzH46Jkt/WBNQffHmjSGi+/BlZ83RxjKq9kIOAy5zF/fFh6R4YkNuQT5cWnW+ljTFTF yrnwozLJe0PAdP1bkZ9Lfchf33rAkOzc1l58uVffkTNtb3FjRZdaBGvKx14zzkYLEM5aIw 1SBvrLUCSwUkSybGhPfrUi3Bq08o/9VpibzsilwBmNCPIHVFaYDCwOb7oCu8uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737078010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qDQtufBTS5Q+ehIhi2MUrpK13ESJKgRVYQx/pJA9U9A=; b=vkJ3SndOlJbUP15kG8rQoMSolN+nRDrxvqLbAwUsHI8OAzGCQkQwP4niHD8YPGfjpMMOvt 2ZKRCTIGHVRu/88l31BM4b6g9cU20HKcibIlW7VeC9oIZNDZohGCFTllx5cCF5zINyaMPZ j/yl+WIcRmOQVNYXxQSPoN/5PxWKzb5WTFkrCqBRn1KzVVNl7wauWZatTgQ3sf8soaBc5w OuV0NiHphM/ZQOmGAT7KHKBi88eUNdwgG8Zg/6EAGozI7R4SgnQbU0PELZOBK8pqyoWAU2 3VtqloetxG7gZ0uhD8t761i39+U+00iFbWwLlT7AvcDCJ8e1mbwBfBmvy9o66Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737078010; a=rsa-sha256; cv=none; b=qLTRZ13sq2P9gaMSm53W19GWi7HLCudoskbyHEuhub8RyXM25OzsSJ/m79It+bhxre22UK GqiFiiClCRcSKMGLygAu9vVtDLsBCKv3qVaAO0mNTVyJ1NBk1Fet0Z0sd806r912q+tOwL 1EFOhuQhFBP7L+hj6PLyKbTnJPnkWwMr9pmSv91WCw25fnzTmrScNOrjRmFzbAhOJCtl0Q MfpSO0rDtNopvKjQ3lqTp93BxiybXgZS++xyo4vihYbizDEru8UIFOQOGf6jSfSeFCUZhs rXtywJ1slODP2etDRkwvB0BBi6rw5s3VMILWyyS7io95jPuU5k/MUOLopznmuA== 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 4YZ2VL44w6zx9g; Fri, 17 Jan 2025 01:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H1eAjP039838; Fri, 17 Jan 2025 01:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H1e7sT038695; Fri, 17 Jan 2025 01:40:07 GMT (envelope-from git) Date: Fri, 17 Jan 2025 01:40:07 GMT Message-Id: <202501170140.50H1e7sT038695@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: 46226b0162ba - main - contrib/tzdata: import tzdata 2025a List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46226b0162ba03986b1de2c790804b37dd8e64d6 Auto-Submitted: auto-generated The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=46226b0162ba03986b1de2c790804b37dd8e64d6 commit 46226b0162ba03986b1de2c790804b37dd8e64d6 Merge: 6c05f3a74f30 b4a294ba7e60 Author: Philip Paeps AuthorDate: 2025-01-17 01:33:46 +0000 Commit: Philip Paeps CommitDate: 2025-01-17 01:33:46 +0000 contrib/tzdata: import tzdata 2025a Changes: https://github.com/eggert/tz/blob/2025a/NEWS MFC after: 3 days contrib/tzdata/Makefile | 32 +++++------ contrib/tzdata/NEWS | 84 +++++++++++++++++++++++++++-- contrib/tzdata/antarctica | 2 + contrib/tzdata/asia | 113 ++++++++++++++++++++++++++++----------- contrib/tzdata/australasia | 113 +++++++++++++++++++++------------------ contrib/tzdata/checknow.awk | 2 +- contrib/tzdata/checktab.awk | 39 +++++++++++++- contrib/tzdata/etcetera | 4 ++ contrib/tzdata/europe | 2 +- contrib/tzdata/factory | 10 ++++ contrib/tzdata/leap-seconds.list | 8 +-- contrib/tzdata/leapseconds | 8 +-- contrib/tzdata/northamerica | 9 ++-- contrib/tzdata/southamerica | 27 ++++++++-- contrib/tzdata/theory.html | 40 +++++++++----- contrib/tzdata/version | 2 +- contrib/tzdata/zone.tab | 2 +- contrib/tzdata/zone1970.tab | 6 +-- contrib/tzdata/zonenow.tab | 9 ++-- 19 files changed, 369 insertions(+), 143 deletions(-) diff --cc contrib/tzdata/Makefile index 0087b4596515,000000000000..2130582c2deb mode 100644,000000..100644 --- a/contrib/tzdata/Makefile +++ b/contrib/tzdata/Makefile @@@ -1,1381 -1,0 +1,1383 @@@ +# Make and install tzdb code and data. +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. +# Request POSIX conformance; this must be the first non-comment line. +.POSIX: +# On older platforms you may need to scrounge for POSIX conformance. +# For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007), +# use 'PATH=/usr/xpg4/bin:$PATH make CC=c99'. + +# To affect how this Makefile works, you can run a shell script like this: +# +# #!/bin/sh +# make CC='gcc -std=gnu23' "$@" +# +# This example script is appropriate for a circa 2024 GNU/Linux system +# where a non-default setting enables this package's optional use of C23. +# +# Alternatively, you can simply edit this Makefile to tailor the following +# macro definitions. + +############################################################################### +# Start of macros that one plausibly might want to tailor. + +# Package name for the code distribution. +PACKAGE= tzcode + +# Version number for the distribution, overridden in the 'tarballs' rule below. +VERSION= unknown + +# Email address for bug reports. +BUGEMAIL= tz@iana.org + +# DATAFORM selects the data format. +# Available formats represent essentially the same data, albeit +# possibly with minor discrepancies that users are not likely to notice. +# To get new features and the best data right away, use: +# DATAFORM= vanguard +# To wait a while before using new features, to give downstream users +# time to upgrade zic (the default), use: +# DATAFORM= main +# To wait even longer for new features, use: +# DATAFORM= rearguard +# Rearguard users might also want "ZFLAGS = -b fat"; see below. +DATAFORM= main + +# Change the line below for your timezone (after finding the one you want in +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -l -' to remove it, or 'zic -l rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for LOCALTIME. + +LOCALTIME= Factory + +# The POSIXRULES macro controls interpretation of POSIX-like TZ +# settings like TZ='EET-2EEST' that lack DST transition rules. +# If POSIXRULES is '-', no template is installed; this is the default. +# Any other value for POSIXRULES is obsolete and should not be relied on, as: +# * It does not work correctly in popular implementations such as GNU/Linux. +# * It does not work even in tzcode, except for historical timestamps +# that precede the last explicit transition in the POSIXRULES file. +# Hence it typically does not work for current and future timestamps. +# If, despite the above, you want a template for handling these settings, +# you can change the line below (after finding the timezone you want in the +# one of the $(TDATA) source files, or adding it to a source file). +# Alternatively, if you discover you've got the wrong timezone, you can just +# 'zic -p -' to remove it, or 'zic -p rightzone' to change it. +# Use the command +# make zonenames +# to get a list of the values you can use for POSIXRULES. + +POSIXRULES= - + +# Also see TZDEFRULESTRING below, which takes effect only +# if POSIXRULES is '-' or if the template file cannot be accessed. + + +# Installation locations. +# +# The defaults are suitable for Debian, except that if REDO is +# posix_right or right_posix then files that Debian puts under +# /usr/share/zoneinfo/posix and /usr/share/zoneinfo/right are instead +# put under /usr/share/zoneinfo-posix and /usr/share/zoneinfo-leaps, +# respectively. Problems with the Debian approach are discussed in +# the commentary for the right_posix rule (below). + +# Destination directory, which can be used for staging. +# 'make DESTDIR=/stage install' installs under /stage (e.g., to +# /stage/etc/localtime instead of to /etc/localtime). Files under +# /stage are not intended to work as-is, but can be copied by hand to +# the root directory later. If DESTDIR is empty, 'make install' does +# not stage, but installs directly into production locations. +DESTDIR = + +# Everything is installed into subdirectories of TOPDIR, and used there. +# TOPDIR should be empty (meaning the root directory), +# or a directory name that does not end in "/". +# TOPDIR should be empty or an absolute name unless you're just testing. +TOPDIR = + +# The default local timezone is taken from the file TZDEFAULT. +TZDEFAULT = $(TOPDIR)/etc/localtime + +# The subdirectory containing installed program and data files, and +# likewise for installed files that can be shared among architectures. +# These should be relative file names. +USRDIR = usr +USRSHAREDIR = $(USRDIR)/share + +# "Compiled" timezone information is placed in the "TZDIR" directory +# (and subdirectories). +# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. +TZDIR_BASENAME= zoneinfo +TZDIR = $(TOPDIR)/$(USRSHAREDIR)/$(TZDIR_BASENAME) + +# The "tzselect" and (if you do "make INSTALL") "date" commands go in: +BINDIR = $(TOPDIR)/$(USRDIR)/bin + +# The "zdump" command goes in: +ZDUMPDIR = $(BINDIR) + +# The "zic" command goes in: +ZICDIR = $(TOPDIR)/$(USRDIR)/sbin + +# Manual pages go in subdirectories of. . . +MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man + +# Library functions are put in an archive in LIBDIR. +LIBDIR = $(TOPDIR)/$(USRDIR)/lib + + +# Types to try, as an alternative to time_t. +TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL) +TIME_T_ALTERNATIVES_HEAD = int_least64_t.ck +TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \ + uint_least64_t.ck + +# What kind of TZif data files to generate. (TZif is the binary time - # zone data format that zic generates; see Internet RFC 8536.) ++# zone data format that zic generates; see Internet RFC 9636.) +# If you want only POSIX time, with time values interpreted as +# seconds since the epoch (not counting leap seconds), use +# REDO= posix_only +# below. If you want only "right" time, with values interpreted +# as seconds since the epoch (counting leap seconds), use +# REDO= right_only +# below. If you want both sets of data available, with leap seconds not +# counted normally, use +# REDO= posix_right +# below. If you want both sets of data available, with leap seconds counted +# normally, use +# REDO= right_posix +# below. POSIX mandates that leap seconds not be counted; for compatibility +# with it, use "posix_only" or "posix_right". Use POSIX time on systems with +# leap smearing; this can work better than unsmeared "right" time with +# applications that are not leap second aware, and is closer to unsmeared +# "right" time than unsmeared POSIX time is (e.g., 0.5 vs 1.0 s max error). + +REDO= posix_right + +# Whether to put an "Expires" line in the leapseconds file. +# Use EXPIRES_LINE=1 to put the line in, 0 to omit it. +# The EXPIRES_LINE value matters only if REDO's value contains "right". +# If you change EXPIRES_LINE, remove the leapseconds file before running "make". +# zic's support for the Expires line was introduced in tzdb 2020a, +# and was modified in tzdb 2021b to generate version 4 TZif files. +# EXPIRES_LINE defaults to 0 for now so that the leapseconds file +# can be given to pre-2020a zic implementations and so that TZif files +# built by newer zic implementations can be read by pre-2021b libraries. +EXPIRES_LINE= 0 + +# To install data in text form that has all the information of the TZif data, +# (optionally incorporating leap second information), use +# TZDATA_TEXT= tzdata.zi leapseconds +# To install text data without leap second information (e.g., because +# REDO='posix_only'), use +# TZDATA_TEXT= tzdata.zi +# To avoid installing text data, use +# TZDATA_TEXT= + +TZDATA_TEXT= leapseconds tzdata.zi + +# For backward-compatibility links for old zone names, use +# BACKWARD= backward +# To omit these links, use +# BACKWARD= + +BACKWARD= backward + +# If you want out-of-scope and often-wrong data from the file 'backzone', +# but only for entries listed in the backward-compatibility file zone.tab, use +# PACKRATDATA= backzone +# PACKRATLIST= zone.tab +# If you want all the 'backzone' data, use +# PACKRATDATA= backzone +# PACKRATLIST= +# To omit this data, use +# PACKRATDATA= +# PACKRATLIST= + +PACKRATDATA= +PACKRATLIST= + +# The name of a locale using the UTF-8 encoding, used during self-tests. +# The tests are skipped if the name does not appear to work on this system. + +UTF8_LOCALE= en_US.utf8 + +# Non-default libraries needed to link. +# On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. +LDLIBS= + +# Add the following to an uncommented "CFLAGS=" line as needed +# to override defaults specified in the source code or by the system. +# "-DFOO" is equivalent to "-DFOO=1". +# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime +# formats that generate only the last two digits of year numbers +# -DEPOCH_LOCAL if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. +# -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# on POSIX platforms predating POSIX.1-2024 +# -DHAVE_DECL_ENVIRON if declares 'environ' +# -DHAVE_DECL_TIMEGM=0 if does not declare timegm +# -DHAVE_DIRECT_H if mkdir needs (MS-Windows) +# -DHAVE__GENERIC=0 if _Generic does not work* +# -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), +# -DHAVE_GETRANDOM=0 to avoid using getrandom +# -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), +# where LDLIBS also needs to contain -lintl on some hosts; +# -DHAVE_GETTEXT=0 to avoid using gettext +# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares +# ctime_r and asctime_r incompatibly with POSIX.1-2017 and earlier +# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). +# -DHAVE_INTTYPES_H=0 if does not work*+ +# -DHAVE_LINK=0 if your system lacks a link function +# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function +# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz +# localtime_rz can make zdump significantly faster, but is nonstandard. +# -DHAVE_MALLOC_ERRNO=0 if malloc etc. do not set errno on failure. +# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare +# functions like 'link' or variables like 'tzname' required by POSIX +# -DHAVE_SETENV=0 if your system lacks the setenv function +# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function+ +# -DHAVE_STDCKDINT_H=0 if neither nor substitutes like +# __builtin_add_overflow work* +# -DHAVE_STDINT_H=0 if does not work*+ +# -DHAVE_STRFTIME_L if declares locale_t and strftime_l +# -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_STRTOLL=0 if your system lacks the strtoll function+ +# -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_SYS_STAT_H=0 if does not work* +# -DHAVE_TZSET=0 if your system lacks a tzset function +# -DHAVE_UNISTD_H=0 if does not work* +# -DHAVE_UTMPX_H=0 if does not work* +# -Dlocale_t=XXX if your system uses XXX instead of locale_t ++# -DMKTIME_MIGHT_OVERFLOW if mktime might fail due to time_t overflow +# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+ +# Typically it is better to use a later standard. For example, +# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'. +# Even with -DPORT_TO_C89, the code needs at least one C99 +# feature (integers at least 64 bits wide) and maybe more. +# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers +# with external linkage, e.g., applications cannot define 'localtime'. - # -Dssize_t=long on hosts like MS-Windows that lack ssize_t ++# -Dssize_t=int on hosts like MS-Windows that lack ssize_t +# -DSUPPORT_C89=0 if the tzcode library should not support C89 callers +# Although -DSUPPORT_C89=0 might work around latent bugs in callers, +# it does not conform to POSIX. +# -DSUPPORT_POSIX2008 if the library should support older POSIX callers+ +# However, this might cause problems in POSIX.1-2024-or-later callers. +# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has +# security implications and is not recommended for general use +# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires; +# not needed by the main-program tz code, which is single-threaded. +# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. +# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# This is intended for internal use only; it mangles external names. +# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" +# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; +# the default is system-supplied, typically "/usr/lib/locale" +# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified +# DST transitions for proleptic format TZ strings lacking them, +# in the usual case where POSIXRULES is '-'. If not specified, +# TZDEFRULESTRING defaults to US rules for future DST transitions. +# This mishandles some past timestamps, as US DST rules have changed. +# It also mishandles settings like TZ='EET-2EEST' for eastern Europe, +# as Europe and US DST rules differ. - # -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255) ++# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 254) +# -DUNINIT_TRAP if reading uninitialized storage can cause problems +# other than simply getting garbage data +# -DUSE_LTZ=0 to build zdump with the system time zone library +# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_BLOAT_DEFAULT=\"fat\" to default zic's -b option to "fat", and +# similarly for "slim". Fat TZif files work around incompatibilities +# and bugs in some TZif readers, notably older ones that +# ignore or otherwise mishandle 64-bit data in TZif files; +# however, fat TZif files may trigger bugs in newer TZif readers. +# Slim TZif files are more efficient, and are the default. +# -DZIC_MAX_ABBR_LEN_WO_WARN=3 +# (or some other number) to set the maximum time zone abbreviation length +# that zic will accept without a warning (the default is 6) +# -g to generate symbolic debugging info +# -Idir to include from directory 'dir' +# -O0 to disable optimization; other -O options to enable more optimization +# -Uname to remove any definition of the macro 'name' +# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking +# +# * Options marked "*" can be omitted if your compiler is C23 compatible. +# * Options marked "+" are obsolescent and are planned to be removed +# once the code assumes C99 or later (say in the year 2029) +# and POSIX.1-2024 or later (say in the year 2034). +# +# Select instrumentation via "make GCC_INSTRUMENT='whatever'". +GCC_INSTRUMENT = \ + -fsanitize=undefined -fsanitize-address-use-after-scope \ + -fsanitize-undefined-trap-on-error -fstack-protector +# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow. +GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \ + $(GCC_INSTRUMENT) \ + -Wall -Wextra \ + -Walloc-size-larger-than=100000 -Warray-bounds=2 \ - -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \ ++ -Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wcast-qual \ ++ -Wdate-time \ + -Wdeclaration-after-statement -Wdouble-promotion \ + -Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \ + -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ + -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \ + -Wmissing-declarations -Wmissing-prototypes \ + -Wmissing-variable-declarations -Wnested-externs \ + -Wnull-dereference \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ + -Wshadow -Wshift-overflow=2 -Wstrict-overflow \ + -Wstrict-prototypes -Wstringop-overflow=4 \ + -Wstringop-truncation -Wsuggest-attribute=cold \ + -Wsuggest-attribute=const -Wsuggest-attribute=format \ + -Wsuggest-attribute=malloc \ + -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ + -Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \ + -Wvariadic-macros -Wvla -Wwrite-strings \ - -Wno-format-nonliteral -Wno-sign-compare ++ -Wno-format-nonliteral -Wno-sign-compare -Wno-type-limits +# +# If your system has a "GMT offset" field in its "struct tm"s +# (or if you decide to add such a field in your system's "time.h" file), +# add the name to a define such as +# -DTM_GMTOFF=tm_gmtoff +# to the end of the "CFLAGS=" line. If not defined, the code attempts to +# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. +# Similarly, if your system has a "zone abbreviation" field, define +# -DTM_ZONE=tm_zone +# and define NO_TM_ZONE to suppress any guessing. +# Although POSIX.1-2024 requires these fields and they are widely available +# on GNU/Linux and BSD systems, some older systems lack them. +# +# The next batch of options control support for external variables +# exported by tzcode. In practice these variables are less useful +# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. +# # +# # To omit or support the external variable "tzname", add one of: +# # -DHAVE_TZNAME=0 # do not support "tzname" +# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library +# # -DHAVE_TZNAME=2 # support and define "tzname" +# # to the "CFLAGS=" line. Although "tzname" is required by POSIX.1-1988 +# # and later, its contents are unspecified if you use a geographical TZ +# # and the variable is planned to be removed in a future POSIX edition. +# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. +# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause +# # crashes when combined with some platforms' standard libraries, +# # presumably due to memory allocation issues. +# # +# # To omit or support the external variables "timezone" and "daylight", add +# # -DUSG_COMPAT=0 # do not support +# # -DUSG_COMPAT=1 # support, and variables are defined by system library +# # -DUSG_COMPAT=2 # support and define variables +# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix +# # Systems Group code and are required by POSIX.1-2008 and later (with XSI), +# # although their contents are unspecified if you use a geographical TZ +# # and the variables are planned to be removed in a future edition of POSIX. +# # If not defined, the code attempts to guess USG_COMPAT from other macros. +# # +# # To support the external variable "altzone", add +# # -DALTZONE=0 # do not support +# # -DALTZONE=1 # support "altzone", which is defined by system library +# # -DALTZONE=2 # support and define "altzone" +# # to the end of the "CFLAGS=" line; although "altzone" appeared in +# # System V Release 3.1 it has not been standardized. +# # If not defined, the code attempts to guess ALTZONE from other macros. +# +# If you want functions that were inspired by early versions of X3J11's work, +# add +# -DSTD_INSPIRED +# to the end of the "CFLAGS=" line. This arranges for the following +# functions to be added to the time conversion library. +# "offtime" is like "gmtime" except that it accepts a second (long) argument +# that gives an offset to add to the time_t when converting it. +# I.e., "offtime" is like calling "localtime_rz" with a fixed-offset zone. +# "timelocal" is nearly equivalent to "mktime". +# "timeoff" is like "timegm" except that it accepts a second (long) argument +# that gives an offset to use when converting to a time_t. +# I.e., "timeoff" is like calling "mktime_z" with a fixed-offset zone. +# "posix2time" and "time2posix" are described in an included manual page. +# X3J11's work does not describe any of these functions. +# These functions may well disappear in future releases of the time +# conversion package. +# +# If you don't want functions that were inspired by NetBSD, add +# -DNETBSD_INSPIRED=0 +# to the end of the "CFLAGS=" line. Otherwise, the functions +# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the +# time library, and if STD_INSPIRED is also defined to nonzero the functions +# "posix2time_z" and "time2posix_z" are added as well. +# The functions ending in "_z" (or "_rz") are like their unsuffixed +# (or suffixed-by-"_r") counterparts, except with an extra first +# argument of opaque type timezone_t that specifies the timezone. +# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. +# +# If you want to allocate state structures in localtime, add +# -DALL_STATE +# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. +# +# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put +# out by the National Institute of Standards and Technology +# which claims to test C and POSIX conformance. If you want to pass PCTS, add +# -DPCTS +# to the end of the "CFLAGS=" line. +# +# If you want strict compliance with XPG4 as of 1994-04-09, add +# -DXPG4_1994_04_09 +# to the end of the "CFLAGS=" line. This causes "strftime" to always return +# 53 as a week number (rather than 52 or 53) for January days before +# January's first Monday when a "%V" format is used and January 1 +# falls on a Friday, Saturday, or Sunday. +# +# POSIX says CFLAGS defaults to "-O 1". +# Uncomment the following line and edit its contents as needed. + +#CFLAGS= -O 1 + + +# The name of a POSIX-like library archiver, its flags, C compiler, +# linker flags, and 'make' utility. Ordinarily the defaults suffice. +# The commented-out values are the defaults specified by POSIX.1-2024. +#AR = ar +#ARFLAGS = -rv +#CC = c17 +#LDFLAGS = +#MAKE = make + +# Where to fetch leap-seconds.list from. +leaplist_URI = \ + https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list +# The file is generated by the IERS Earth Orientation Centre, in Paris. +leaplist_TZ = Europe/Paris + +# The zic command and its arguments. + +zic= ./zic +ZIC= $(zic) $(ZFLAGS) + +# To shrink the size of installed TZif files, +# append "-r @N" to omit data before N-seconds-after-the-Epoch. +# To grow the files and work around bugs in older applications, +# possibly at the expense of introducing bugs in newer ones, +# append "-b fat"; see ZIC_BLOAT_DEFAULT above. +# See the zic man page for more about -b and -r. +ZFLAGS= + +# How to use zic to install TZif files. + +ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' + +# The name of a POSIX-compliant 'awk' on your system. +# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work. +# Also, it is better (though not essential) if 'awk' supports UTF-8, +# and unfortunately mawk and busybox awk do not support UTF-8. +# Try AWK=gawk or AWK=nawk if your awk has the abovementioned problems. +AWK= awk + +# The full path name of a POSIX-compliant shell, preferably one that supports +# the Korn shell's 'select' statement as an extension. +# These days, Bash is the most popular. +# It should be OK to set this to /bin/sh, on platforms where /bin/sh +# lacks 'select' or doesn't completely conform to POSIX, but /bin/bash +# is typically nicer if it works. +KSHELL= /bin/bash + +# Name of curl , used for HTML validation +# and to fetch leap-seconds.list from upstream. +# Set CURL=: to disable use of the Internet. +CURL= curl + +# Name of GNU Privacy Guard , used to sign distributions. +GPG= gpg + +# This expensive test requires USE_LTZ. +# To suppress it, define this macro to be empty. +CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives + +# SAFE_CHAR is a regular expression that matches a safe character. +# Some parts of this distribution are limited to safe characters; +# others can use any UTF-8 character. +# For now, the safe characters are a safe subset of ASCII. +# The caller must set the shell variable 'sharp' to the character '#', +# since Makefile macros cannot contain '#'. +# TAB_CHAR is a single tab character, in single quotes. +TAB_CHAR= ' ' +SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' +SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' +SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' +SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) +SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' + +# These non-alphabetic, non-ASCII printable characters are Latin-1, +# and so are likely displayable even in editors like XEmacs 21 +# that have limited display capabilities. +UNUSUAL_OK_LATIN_1 = ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷ +# Non-ASCII non-letters that OK_CHAR allows, as these characters are +# useful in commentary. +UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1) + +# Put this in a bracket expression to match spaces. +s = [:space:] + +# OK_CHAR matches any character allowed in the distributed files. +# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and +# multibyte letters are also allowed so that commentary can contain a +# few safe symbols and people's names and can quote non-English sources. +# Other non-letters are limited to ASCII renderings for the +# convenience of maintainers using XEmacs 21.5.34, which by default +# mishandles Unicode characters U+0100 and greater. +OK_CHAR= '[][:alpha:]$(UNUSUAL_OK_CHARSET)'$(SAFE_CHARSET)'-]' + +# SAFE_LINE matches a line of safe characters. +# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; +# this is so that comments can contain non-ASCII characters. +# OK_LINE matches a line of OK characters. +SAFE_LINE= '^'$(SAFE_CHAR)'*$$' +SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' +OK_LINE= '^'$(OK_CHAR)'*$$' + +# Flags to give 'tar' when making a distribution. +# Try to use flags appropriate for GNU tar. +GNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \ + --numeric-owner --owner=0 --group=0 \ + --mode=go+u,go-w --sort=name +SETUP_TAR= \ + export LC_ALL=C && \ + if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \ + TAR='tar $(GNUTARFLAGS)'; \ + else \ + TAR=tar; \ + fi + +# Flags to give 'gzip' when making a distribution. +GZIPFLAGS= -9n + +# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported. +# This makes it easier to see which Zone has been affected. +SETUP_DIFF_TZS = \ + if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \ + DIFF_TZS='diff -u -F^TZ='; \ + else \ + DIFF_TZS='diff -u'; \ + fi + +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : + +# POSIX prohibits defining or using SHELL. However, csh users on systems +# that use the user shell for Makefile commands may need to define SHELL. +#SHELL= /bin/sh + +# End of macros that one plausibly might want to tailor. +############################################################################### + + +TZCOBJS= zic.o +TZDOBJS= zdump.o localtime.o strftime.o +DATEOBJS= date.o localtime.o strftime.o +LIBSRCS= localtime.c asctime.c difftime.c strftime.c +LIBOBJS= localtime.o asctime.o difftime.o strftime.o +HEADERS= tzfile.h private.h +NONLIBSRCS= zic.c zdump.c +NEWUCBSRCS= date.c +SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ + tzselect.ksh workman.sh +MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ + tzfile.5 tzselect.8 zic.8 zdump.8 +MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ + time2posix.3.txt \ + tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ + date.1.txt +COMMON= calendars CONTRIBUTING LICENSE Makefile \ + NEWS README SECURITY theory.html version +WEB_PAGES= tz-art.html tz-how-to.html tz-link.html +CHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck +DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) +PRIMARY_YDATA= africa antarctica asia australasia \ + europe northamerica southamerica +YDATA= $(PRIMARY_YDATA) etcetera +NDATA= factory +TDATA_TO_CHECK= $(YDATA) $(NDATA) backward +TDATA= $(YDATA) $(NDATA) $(BACKWARD) +ZONETABLES= zone.tab zone1970.tab zonenow.tab +TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) +LEAP_DEPS= leapseconds.awk leap-seconds.list +TZDATA_ZI_DEPS= ziguard.awk zishrink.awk version $(TDATA) \ + $(PACKRATDATA) $(PACKRATLIST) +DSTDATA_ZI_DEPS= ziguard.awk $(TDATA) $(PACKRATDATA) $(PACKRATLIST) +DATA= $(TDATA_TO_CHECK) backzone iso3166.tab leap-seconds.list \ + leapseconds $(ZONETABLES) +AWK_SCRIPTS= checklinks.awk checknow.awk checktab.awk leapseconds.awk \ + ziguard.awk zishrink.awk +MISC= $(AWK_SCRIPTS) +TZS_YEAR= 2050 +TZS_CUTOFF_FLAG= -c $(TZS_YEAR) +TZS= to$(TZS_YEAR).tzs +TZS_NEW= to$(TZS_YEAR)new.tzs - TZS_DEPS= $(YDATA) asctime.c localtime.c \ - private.h tzfile.h zdump.c zic.c ++TZS_DEPS= $(YDATA) localtime.c private.h \ ++ strftime.c tzfile.h zdump.c zic.c +TZDATA_DIST = $(COMMON) $(DATA) $(MISC) +# EIGHT_YARDS is just a yard short of the whole ENCHILADA. +EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi +ENCHILADA = $(EIGHT_YARDS) $(TZS) + +# Consult these files when deciding whether to rebuild the 'version' file. +# This list is not the same as the output of 'git ls-files', since +# .gitignore is not distributed. +VERSION_DEPS= \ + calendars CONTRIBUTING LICENSE Makefile NEWS README SECURITY \ + africa antarctica asctime.c asia australasia \ + backward backzone \ + checklinks.awk checknow.awk checktab.awk \ + date.1 date.c difftime.c \ + etcetera europe factory iso3166.tab \ + leap-seconds.list leapseconds.awk localtime.c \ + newctime.3 newstrftime.3 newtzset.3 northamerica \ + private.h southamerica strftime.c theory.html \ + time2posix.3 tz-art.html tz-how-to.html tz-link.html \ + tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ + workman.sh zdump.8 zdump.c zic.8 zic.c \ + ziguard.awk zishrink.awk \ + zone.tab zone1970.tab zonenow.tab + +all: tzselect zic zdump libtz.a $(TABDATA) \ + vanguard.zi main.zi rearguard.zi + +ALL: all date $(ENCHILADA) + +install: all $(DATA) $(REDO) $(MANS) + mkdir -p '$(DESTDIR)$(BINDIR)' \ + '$(DESTDIR)$(ZDUMPDIR)' '$(DESTDIR)$(ZICDIR)' \ + '$(DESTDIR)$(LIBDIR)' \ + '$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \ + '$(DESTDIR)$(MANDIR)/man8' + $(ZIC_INSTALL) -l $(LOCALTIME) \ + -p $(POSIXRULES) \ + -t '$(DESTDIR)$(TZDEFAULT)' + cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.' + cp tzselect '$(DESTDIR)$(BINDIR)/.' + cp zdump '$(DESTDIR)$(ZDUMPDIR)/.' + cp zic '$(DESTDIR)$(ZICDIR)/.' + cp libtz.a '$(DESTDIR)$(LIBDIR)/.' + $(RANLIB) '$(DESTDIR)$(LIBDIR)/libtz.a' + cp -f newctime.3 newtzset.3 '$(DESTDIR)$(MANDIR)/man3/.' + cp -f tzfile.5 '$(DESTDIR)$(MANDIR)/man5/.' + cp -f tzselect.8 zdump.8 zic.8 '$(DESTDIR)$(MANDIR)/man8/.' + +INSTALL: ALL install date.1 + mkdir -p '$(DESTDIR)$(BINDIR)' '$(DESTDIR)$(MANDIR)/man1' + cp date '$(DESTDIR)$(BINDIR)/.' + cp -f date.1 '$(DESTDIR)$(MANDIR)/man1/.' + +# Calculate version number from git, if available. +# Otherwise, use $(VERSION) unless it is "unknown" and there is already +# a 'version' file, in which case reuse the existing 'version' contents +# and append "-dirty" if the contents do not already end in "-dirty". +version: $(VERSION_DEPS) + { (type git) >/dev/null 2>&1 && \ + V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty) || \ + if test '$(VERSION)' = unknown && read -r V <$@; then \ + V=$${V%-dirty}-dirty; \ + else \ + V='$(VERSION)'; \ + fi; } && \ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ + +# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST. +vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS) + $(AWK) \ + -v DATAFORM=$(@:.zi=) \ + -v PACKRATDATA='$(PACKRATDATA)' \ + -v PACKRATLIST='$(PACKRATLIST)' \ + -f ziguard.awk \ + $(TDATA) $(PACKRATDATA) >$@.out + mv $@.out $@ +# This file has a version comment that attempts to capture any tailoring +# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO. +tzdata.zi: $(DATAFORM).zi version zishrink.awk + read -r version $@.out + mv $@.out $@ + +tzdir.h: + printf '%s\n' >$@.out \ + '#ifndef TZDEFAULT' \ + '# define TZDEFAULT "$(TZDEFAULT)" /* default zone */' \ + '#endif' \ + '#ifndef TZDIR' \ + '# define TZDIR "$(TZDIR)" /* TZif directory */' \ + '#endif' + mv $@.out $@ + +version.h: version + read -r VERSION $@.out + mv $@.out $@ + +zdump: $(TZDOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + +zic: $(TZCOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + +leapseconds: $(LEAP_DEPS) + $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \ + -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ + +# Awk script to extract a Git-style author from leap-seconds.list comments. +EXTRACT_AUTHOR = \ + author_line { sub(/^.[[:space:]]*/, ""); \ + sub(/:[[:space:]]*/, " <"); \ + printf "%s>\n", $$0; \ + success = 1; \ + exit \ + } \ + /Questions or comments to:/ { author_line = 1 } \ + END { exit !success } + +# Fetch leap-seconds.list from upstream. +fetch-leap-seconds.list: + $(CURL) -OR $(leaplist_URI) + +# Fetch leap-seconds.list from upstream and commit it to the local repository. +commit-leap-seconds.list: fetch-leap-seconds.list + author=$$($(AWK) '$(EXTRACT_AUTHOR)' leap-seconds.list) && \ + date=$$(TZ=$(leaplist_TZ) stat -c%y leap-seconds.list) && \ + git commit --author="$$author" --date="$$date" -m'make $@' \ + leap-seconds.list + +# Arguments to pass to submakes. +# They can be overridden by later submake arguments. +INSTALLARGS = \ + BACKWARD='$(BACKWARD)' \ + DESTDIR='$(DESTDIR)' \ + PACKRATDATA='$(PACKRATDATA)' \ + PACKRATLIST='$(PACKRATLIST)' \ + TZDEFAULT='$(TZDEFAULT)' \ + TZDIR='$(TZDIR)' \ + ZIC='$(ZIC)' + +INSTALL_DATA_DEPS = zic leapseconds tzdata.zi + +posix_only: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) tzdata.zi + +right_only: $(INSTALL_DATA_DEPS) + $(ZIC_INSTALL) -L leapseconds tzdata.zi + +# In earlier versions of this makefile, the other two directories were +# subdirectories of $(TZDIR). However, this led to configuration errors. +# For example, with posix_right under the earlier scheme, +# TZ='right/Australia/Adelaide' got you localtime with leap seconds, +# but gmtime without leap seconds, which led to problems with applications +# like sendmail that subtract gmtime from localtime. +# Therefore, the other two directories are now siblings of $(TZDIR). +# You must replace all of $(TZDIR) to switch from not using leap seconds +# to using them, or vice versa. +right_posix: right_only + rm -fr '$(DESTDIR)$(TZDIR)-leaps' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-leaps' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + +posix_right: posix_only + rm -fr '$(DESTDIR)$(TZDIR)-posix' + ln -s '$(TZDIR_BASENAME)' '$(DESTDIR)$(TZDIR)-posix' || \ + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-posix' posix_only + $(MAKE) $(INSTALLARGS) TZDIR='$(TZDIR)-leaps' right_only + +zones: $(REDO) + +# dummy.zd is not a real file; it is mentioned here only so that the +# top-level 'make' does not have a syntax error. +ZDS = dummy.zd +# Rule used only by submakes invoked by the $(TZS_NEW) rule. +# It is separate so that GNU 'make -j' can run instances in parallel. +$(ZDS): zdump + ./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@ + +TZS_NEW_DEPS = tzdata.zi zdump zic +$(TZS_NEW): $(TZS_NEW_DEPS) + rm -fr tzs$(TZS_YEAR).dir + mkdir tzs$(TZS_YEAR).dir + $(zic) -d tzs$(TZS_YEAR).dir tzdata.zi + $(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \ + tzdata.zi | LC_ALL=C sort >$@.out + x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \ + tzdata.zi \ + | LC_ALL=C sort -t . -k 2,2) && \ + set x $$x && \ + shift && \ + ZDS=$$* && \ + $(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \ + ZDS="$$ZDS" $$ZDS && \ + sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out + rm -fr tzs$(TZS_YEAR).dir + mv $@.out $@ + +# If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the +# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. +$(TZS): + touch $@ + +force_tzs: $(TZS_NEW) + cp $(TZS_NEW) $(TZS) + +libtz.a: $(LIBOBJS) + rm -f $@ + $(AR) $(ARFLAGS) $@ $(LIBOBJS) + $(RANLIB) $@ + +date: $(DATEOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + +tzselect: tzselect.ksh version + read -r VERSION $@.out + chmod +x $@.out + mv $@.out $@ + - check: check_mild back.ck ++check: check_mild back.ck now.ck +check_mild: check_web check_zishrink \ + character-set.ck white-space.ck links.ck mainguard.ck \ - name-lengths.ck now.ck slashed-abbrs.ck sorted.ck \ ++ name-lengths.ck slashed-abbrs.ck sorted.ck \ + tables.ck ziguard.ck tzs.ck + +# True if UTF8_LOCALE does not work; +# otherwise, false but with LC_ALL set to $(UTF8_LOCALE). +UTF8_LOCALE_MISSING = \ + { test ! '$(UTF8_LOCALE)' \ + || ! printf 'A\304\200B\n' \ + | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \ + || { export LC_ALL='$(UTF8_LOCALE)'; false; }; } + +character-set.ck: $(ENCHILADA) + $(UTF8_LOCALE_MISSING) || { \ + sharp='#' && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ + $(MISC) $(SOURCES) $(WEB_PAGES) \ + CONTRIBUTING LICENSE README SECURITY \ + version tzdata.zi && \ + ! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \ + Makefile && \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \ + leapseconds zone.tab && \ + ! grep -Env $(OK_LINE) $(ENCHILADA); \ + } + touch $@ + +white-space.ck: $(ENCHILADA) + $(UTF8_LOCALE_MISSING) || { \ + enchilada='$(ENCHILADA)' && \ + patfmt=' \t|[\f\r\v]' && pat=$$(printf "$$patfmt\\n") && \ + ! grep -En "$$pat|[$s]\$$" \ + $${enchilada%leap-seconds.list*} \ + $${enchilada#*leap-seconds.list}; \ + } + touch $@ + +PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+ +FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15} + +name-lengths.ck: $(TDATA_TO_CHECK) backzone + :;! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \ + $(TDATA_TO_CHECK) backzone + touch $@ + +mainguard.ck: main.zi + test '$(PACKRATLIST)' || \ + cat $(TDATA) $(PACKRATDATA) | diff -u - main.zi + touch $@ + +PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+ +STDOFF = [-+]?[0-9:.]+ +RULELESS_SAVE = (-|$(STDOFF)[sd]?) +RULELESS_SLASHED_ABBRS = \ + $(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/ + +slashed-abbrs.ck: $(TDATA_TO_CHECK) + :;! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK) + touch $@ + +CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } + +sorted.ck: backward backzone + $(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \ + backward | LC_ALL=C sort -cu + $(AWK) '/^Zone.*\// {print $$2}' backzone | LC_ALL=C sort -cu + touch $@ + +back.ck: checklinks.awk $(TDATA_TO_CHECK) + $(AWK) \ + -v DATAFORM=$(DATAFORM) \ + -v backcheck=backward \ *** 477 LINES SKIPPED *** From nobody Fri Jan 17 02:25:03 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ3V735R6z5kGSH; Fri, 17 Jan 2025 02:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ3V72VD7z3bSH; Fri, 17 Jan 2025 02:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737080703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vKbHUq7I+BARafDd61OQD4jcY8KVk64v7k8xWI99CGg=; b=E9ABa9E4vflS4WMMwGNilJ1mvyK57OQEKJvvO9SJtu/WcO44ElFcCWbdIk9PwqDOjt1RSX lfIaYjFbN7tSxsDnxspWyR8Nqodk8nCZCjrf8trfNeWzwFe+pE69+/CzHh4XAGvoSUd2hl HDawK3DKZEqhOkL+oaW3ZRJd4GExt8DfFSepbaGG3/YtzWv3IUJFc5Nq285qEnrsJmAfa9 E/BIu6qKm295T/y2Pevm3j28uwdfs+wBEI1e0tc79W2x++AvJR/dLBbzuaP8Ip1fwavGSw +wjOnAhikVX9dGpby12nspli7PVeD0Qsyv7MGVIc4Zy3CBsPVmqfRpR8F5rhjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737080703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vKbHUq7I+BARafDd61OQD4jcY8KVk64v7k8xWI99CGg=; b=QaOepxZJ/dZx03oxg9YmZZb6w4Y8+oMJW9i+mYvUozPdt6/m6VZ85SPIcLspyZdj3gR0q1 hkR+V+neCO6FUsjnY0byokRCjR4DdxzZfvVRw6w0f4FSg6HC5/cJho+Wtqu5USiKi+DHLx xO9Qnq6rMYApAPMe058c9NfUYWiHGMO1oPakY0+GDa3UauCkuCCHRiVjy6bzcUW8dvyood HPL6DEtN8vgtPjE5HPLDeNSv3HWiQVLD0/qR2aHb3CuObvmDw/ULiCZmNDyKpFmMaKl+Kx P1j8nGQ3AlvT8wJOBhYFCDQ/UQ1XweCC/vEPARpt/HYZCLI+WNhYmqmogEFytg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737080703; a=rsa-sha256; cv=none; b=HeCFlW/P4D/jiNPCLvCvNrk1JQabysIclT26kDB1a9EBFLt6jxEKTs9k8dB+oAQRveirS8 R4G63GTpe/OO+Iy9CF+JNaiHjthMnaKXz4P/pWE0yeDk/X0qGW8Vw+3RaY72IXkFds9loE RIU0Djd4cnlHHG8Ctc6Pe+fYQ9Ll62SZLeJgAZf2+DhByOs3EAYhLQvR3jHkf8ut7BXRqE a9ISYZisFWXF6d/GH6PeSK3vwBnX150tcj2WTqqEwnY5cB+IKkLlu92A1S031hnEUk1j7d quGx88nrNyG8I23ynH/9B/kNtvXAYRO2Hv+87RjQ8uxslGCa4wmBGEZBUQVmBg== 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 4YZ3V71ymQzxqF; Fri, 17 Jan 2025 02:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H2P3iB028265; Fri, 17 Jan 2025 02:25:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H2P3HJ028262; Fri, 17 Jan 2025 02:25:03 GMT (envelope-from git) Date: Fri, 17 Jan 2025 02:25:03 GMT Message-Id: <202501170225.50H2P3HJ028262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 40462a376a32 - main - genl: stop using struct _getfamily_attrs, snl_genl_ctrl_mcast_group List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40462a376a324c19845a5f696c565069142ef326 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=40462a376a324c19845a5f696c565069142ef326 commit 40462a376a324c19845a5f696c565069142ef326 Author: Gleb Smirnoff AuthorDate: 2025-01-17 02:20:13 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-17 02:24:32 +0000 genl: stop using struct _getfamily_attrs, snl_genl_ctrl_mcast_group This program has two modes: monitor a single family and dump known families. The former uses directly snl_get_genl_family_info() which uses supposedly internal struct _getfamily_attrs as the argument. The latter uses a parser named genl_family_parser that makes a mixture of local definitions and definitions from . While the struct genl_family_parser is local, it points at struct snl_genl_ctrl_mcast_groups and struct snl_genl_ctrl_mcast_group that are supposedly private to netlink_snl_generic.h, as are hanging off the underscored _getfamily_attrs. Rewrite this mess by using same parser for both modes, that is fully implemented locally. This parser has another very important difference to the one declared in the header library. It will copy strings out of the message into memory allocated within the snl_state. With the header library parser strings point into received packet and contents will be overwritten on next netlink message. This is not a bug with existing genl(1) program, but it would be with future changes. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D48479 --- usr.bin/genl/genl.c | 149 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 112 insertions(+), 37 deletions(-) diff --git a/usr.bin/genl/genl.c b/usr.bin/genl/genl.c index dd0c3af30c9c..cb01c6bcdd26 100644 --- a/usr.bin/genl/genl.c +++ b/usr.bin/genl/genl.c @@ -81,43 +81,103 @@ static struct snl_attr_parser ap_nlevent_get[] = { #undef _OUT SNL_DECLARE_GENL_PARSER(nlevent_get_parser, ap_nlevent_get); +/* + * We run our own parser(s) for CTRL_CMD_GETFAMILY instead of interfaces + * provided by . One reason is that we want the parsed + * string attributes to point into long living memory, instead of inside of + * just received message, hence we use snl_attr_get_stringn() instead of the + * snl_attr_get_string(). The shared library uses the latter to avoid creating + * ambiguous memory leaks. Second reason is that genl(1) usage of the data is + * more extended than typical application that cares only of its own family and + * usually one group. We are going to cycle around all available. + */ struct genl_ctrl_op { uint32_t id; uint32_t flags; }; - struct genl_ctrl_ops { uint32_t num_ops; struct genl_ctrl_op **ops; }; - +static struct snl_attr_parser nla_p_getops[] = { #define _OUT(_field) offsetof(struct genl_ctrl_op, _field) -static struct snl_attr_parser _nla_p_getops[] = { - { .type = CTRL_ATTR_OP_ID, .off = _OUT(id), .cb = snl_attr_get_uint32}, - { .type = CTRL_ATTR_OP_FLAGS, .off = _OUT(flags), .cb = snl_attr_get_uint32 }, + { + .type = CTRL_ATTR_OP_ID, + .off = _OUT(id), + .cb = snl_attr_get_uint32 + }, + { + .type = CTRL_ATTR_OP_FLAGS, + .off = _OUT(flags), + .cb = snl_attr_get_uint32 + }, +#undef _OUT +}; +SNL_DECLARE_ATTR_PARSER_EXT(genl_ctrl_op_parser, sizeof(struct genl_ctrl_op), + nla_p_getops, NULL); + +struct genl_mcast_group { + uint32_t id; + const char *name; }; +struct genl_mcast_groups { + uint32_t num_groups; + struct genl_mcast_group **groups; +}; +static struct snl_attr_parser nla_p_getmc[] = { +#define _OUT(_field) offsetof(struct genl_mcast_group, _field) + { + .type = CTRL_ATTR_MCAST_GRP_NAME, + .off = _OUT(name), + .cb = snl_attr_get_stringn, + }, + { + .type = CTRL_ATTR_MCAST_GRP_ID, + .off = _OUT(id), + .cb = snl_attr_get_uint32, + }, #undef _OUT -SNL_DECLARE_ATTR_PARSER_EXT(genl_ctrl_op_parser, - sizeof(struct genl_ctrl_op), - _nla_p_getops, NULL); +}; +SNL_DECLARE_ATTR_PARSER_EXT(genl_mc_parser, sizeof(struct genl_mcast_group), + nla_p_getmc, NULL); struct genl_family { uint16_t id; - char *name; + const char *name; uint32_t version; uint32_t hdrsize; uint32_t max_attr; - struct snl_genl_ctrl_mcast_groups mcast_groups; + struct genl_mcast_groups mcast_groups; struct genl_ctrl_ops ops; }; +static struct snl_attr_parser nla_p_getfamily[] = { #define _OUT(_field) offsetof(struct genl_family, _field) -static struct snl_attr_parser _nla_p_getfamily[] = { - { .type = CTRL_ATTR_FAMILY_ID , .off = _OUT(id), .cb = snl_attr_get_uint16 }, - { .type = CTRL_ATTR_FAMILY_NAME, .off = _OUT(name), .cb = snl_attr_get_string }, - { .type = CTRL_ATTR_VERSION, .off = _OUT(version), .cb = snl_attr_get_uint32 }, - { .type = CTRL_ATTR_VERSION, .off = _OUT(hdrsize), .cb = snl_attr_get_uint32 }, - { .type = CTRL_ATTR_MAXATTR, .off = _OUT(max_attr), .cb = snl_attr_get_uint32 }, + { + .type = CTRL_ATTR_FAMILY_ID, + .off = _OUT(id), + .cb = snl_attr_get_uint16, + }, + { + .type = CTRL_ATTR_FAMILY_NAME, + .off = _OUT(name), + .cb = snl_attr_get_stringn, + }, + { + .type = CTRL_ATTR_VERSION, + .off = _OUT(version), + .cb = snl_attr_get_uint32, + }, + { + .type = CTRL_ATTR_VERSION, + .off = _OUT(hdrsize), + .cb = snl_attr_get_uint32, + }, + { + .type = CTRL_ATTR_MAXATTR, + .off = _OUT(max_attr), + .cb = snl_attr_get_uint32, + }, { .type = CTRL_ATTR_OPS, .off = _OUT(ops), @@ -128,11 +188,11 @@ static struct snl_attr_parser _nla_p_getfamily[] = { .type = CTRL_ATTR_MCAST_GROUPS, .off = _OUT(mcast_groups), .cb = snl_attr_get_parray, - .arg = &_genl_ctrl_mc_parser, + .arg = &genl_mc_parser, }, -}; #undef _OUT -SNL_DECLARE_GENL_PARSER(genl_family_parser, _nla_p_getfamily); +}; +SNL_DECLARE_GENL_PARSER(genl_family_parser, nla_p_getfamily); static struct op_capability { uint32_t flag; @@ -162,15 +222,15 @@ dump_operations(struct genl_ctrl_ops *ops) } static void -dump_mcast_groups( struct snl_genl_ctrl_mcast_groups *mcast_groups) +dump_mcast_groups(struct genl_mcast_groups *mcast_groups) { if (mcast_groups->num_groups == 0) return; printf("\tmulticast groups: \n"); for (uint32_t i = 0; i < mcast_groups->num_groups; i++) printf("\t - ID: %#02x, Name: %s\n", - mcast_groups->groups[i]->mcast_grp_id, - mcast_groups->groups[i]->mcast_grp_name); + mcast_groups->groups[i]->id, + mcast_groups->groups[i]->name); } static void @@ -222,39 +282,53 @@ parser_fallback(struct snl_state *ss __unused, struct nlmsghdr *hdr __unused) printf("New unknown message\n"); } -int -monitor_mcast(int argc __unused, char **argv) +/* Populated by monitor_mcast() and may be used by protocol parser callbacks. */ +static struct genl_family attrs; + +static int +monitor_mcast(int argc, char **argv) { struct snl_state ss; + struct snl_writer nw; struct nlmsghdr *hdr; - struct _getfamily_attrs attrs; struct pollfd pfd; bool found = false; bool all = false; void (*parser)(struct snl_state *ss, struct nlmsghdr *hdr); - parser = parser_fallback; - - if (!snl_init(&ss, NETLINK_GENERIC)) - err(EXIT_FAILURE, "snl_init()"); - if (argc < 1 || argc > 2) { usage(); return (EXIT_FAILURE); } - if (!snl_get_genl_family_info(&ss, argv[0], &attrs)) - errx(EXIT_FAILURE, "Unknown family '%s'", argv[0]); + if (!snl_init(&ss, NETLINK_GENERIC)) + err(EXIT_FAILURE, "snl_init()"); + snl_init_writer(&ss, &nw); + snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY); + snl_add_msg_attr_string(&nw, CTRL_ATTR_FAMILY_NAME, argv[0]); + if ((hdr = snl_finalize_msg(&nw)) == NULL) + err(EXIT_FAILURE, "snl_finalize_msg"); + if (!snl_send_message(&ss, hdr)) + err(EXIT_FAILURE, "snl_send_message"); + hdr = snl_read_reply(&ss, hdr->nlmsg_seq); + if (hdr == NULL) + err(EXIT_FAILURE, "snl_read_reply"); + if (hdr->nlmsg_type == NLMSG_ERROR) + err(EXIT_FAILURE, "netlink(4) returned error"); + memset(&attrs, 0, sizeof(attrs)); + if (!snl_parse_nlmsg(&ss, hdr, &genl_family_parser, &attrs)) + err(EXIT_FAILURE, "snl_parse_nlmsg CTRL_CMD_GETFAMILY"); + if (argc == 1) all = true; - for (unsigned int i = 0; i < attrs.mcast_groups.num_groups; i++) { - if (all || strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name, - argv[1]) == 0) { + for (u_int i = 0; i < attrs.mcast_groups.num_groups; i++) { + if (all || + strcmp(attrs.mcast_groups.groups[i]->name, argv[1]) == 0) { found = true; if (setsockopt(ss.fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, - &attrs.mcast_groups.groups[i]->mcast_grp_id, - sizeof(attrs.mcast_groups.groups[i]->mcast_grp_id)) + &attrs.mcast_groups.groups[i]->id, + sizeof(attrs.mcast_groups.groups[i]->id)) == -1) err(EXIT_FAILURE, "Cannot subscribe to command " "notify"); @@ -265,6 +339,7 @@ monitor_mcast(int argc __unused, char **argv) if (!found) errx(EXIT_FAILURE, "No such multicast group '%s'" " in family '%s'", argv[1], argv[0]); + parser = parser_fallback; for (size_t i= 0; i < nitems(mcast_parsers); i++) { if (strcmp(mcast_parsers[i].family, argv[0]) == 0) { parser = mcast_parsers[i].parser; From nobody Fri Jan 17 02:31:54 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ3f30gl4z5kGNC; Fri, 17 Jan 2025 02:31:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ3f26dDYz3c0Y; Fri, 17 Jan 2025 02:31:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737081114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Eu55K+fdjyf//fBBFl2q4GF4SdEgHOW7TghZty3JutY=; b=R/RhWyDVM4MqgZUg2VZr4ht2sIyIF9y5InzqhixCLRVB0L/DQvfnBqx2OjAPBuFiJgv6dD AAmtKZKHpQ64LAzAdGOoy8c/sNgdUh5NHzZ3L9wcBwqTubcG2aGeDoju7Bn1dwCPVOgmJ0 BYYLSHTpod3wodiLWEULs2fmCmquYaXpZxVMSf3cyHdx9H2Ea9SBIPM7IemfuBw5c/N4Bu TKeqQaqJ+LnSuJqPBMrSxF3s78de1y+r5qZOXuCwu6SFzv9X32Fqh8MXcdJByhx5YeJfTK AVbOSzPZh50J0cIHuiZuyzZvhU6b6fqZiNeTuZ1ak9BhD8pfpHUQ0g7ygzMurA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737081114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Eu55K+fdjyf//fBBFl2q4GF4SdEgHOW7TghZty3JutY=; b=EI5FO0jW9FWH/+NuKjhN0phfcUv2/En/LmiGX4b2lhFMqb71IH6wTKQnZQbmc0qXeHlZ/C 34f1ZTjZF6IV40+KiuZoPVhwQcMtXMkWQAmLXp5UDSMCc6pLFbpUqhk4fBWqBRmuo1t1U1 7FL1i7MmjzW3w9qLfZhTcbPscjAXnGWqHOre29+NG/kaDGpgFldp5SCSBFnf7qKtW7lyFI aS2UAYNnUk/T+Jp6+XBvtZ5KiwjhI6rfB98XPCILhfq+cvw6fIyMfNiMPv67RMniKYDaZA oFbxRYGTNpWP/T+kj2gZYU/er3DpCfIi/rpGJ9Bnj9tbZ4FwxLWpSUYpXwqhpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737081114; a=rsa-sha256; cv=none; b=ujqOg9WbUAQ0mKmaMNzwcmGpXRMY0gb2C9acKuSrSfLnlNsut554Docga1PFvrIlYJu9qM AtYcUa2V1XghQhWlW5qORu0I3XOMoBni8E3Ip2S5N1Fxery1Fgp2xmTJ4fkdMN3KTVYd/+ 5FmLBs1ItH3JTtlLC+nK3UdWy7rPxLwULw2nMn+cDYpj1Y5MIfnUpZ4ZGMY5BQPbfE/FhI bw+spUttQw70JSb9cY9a/jGUXHXa033kQ5gKiRZwTUnOLSnLIQ7F6aL6GYCQI+wwAmx1KR TQBQti0b6DmFJe4NzmsUHAEsrmpZ62QNI+0YXKW02LM6rWzu1ijggYSNBpD9Dw== 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 4YZ3f26DQPz106k; Fri, 17 Jan 2025 02:31:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H2Vsls044419; Fri, 17 Jan 2025 02:31:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H2VsT1044416; Fri, 17 Jan 2025 02:31:54 GMT (envelope-from git) Date: Fri, 17 Jan 2025 02:31:54 GMT Message-Id: <202501170231.50H2VsT1044416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 1e9bca400b9c - main - sockets: assert VNET set in sopeeraddr() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1e9bca400b9c7ae3dc3f31aa48df69cf2259e16c Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=1e9bca400b9c7ae3dc3f31aa48df69cf2259e16c commit 1e9bca400b9c7ae3dc3f31aa48df69cf2259e16c Author: Gleb Smirnoff AuthorDate: 2025-01-17 02:31:15 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-17 02:31:15 +0000 sockets: assert VNET set in sopeeraddr() Most callers already have the context set, it was only bare syscall that needs it to set. --- sys/kern/uipc_socket.c | 4 ++-- sys/kern/uipc_syscalls.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 426316ac6ce8..46a7053f2872 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2030,11 +2030,11 @@ sopeeraddr(struct socket *so, struct sockaddr *sa) #endif int error; - CURVNET_SET(so->so_vnet); + CURVNET_ASSERT_SET(); + error = so->so_proto->pr_peeraddr(so, sa); KASSERT(sa->sa_len <= len, ("%s: protocol %p sockaddr overflow", __func__, so->so_proto)); - CURVNET_RESTORE(); return (error); } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index e0bb7ace92c6..91fcdf9a7a9d 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1433,7 +1433,9 @@ kern_getpeername(struct thread *td, int fd, struct sockaddr *sa) error = ENOTCONN; goto done; } + CURVNET_SET(so->so_vnet); error = sopeeraddr(so, sa); + CURVNET_RESTORE(); #ifdef KTRACE if (error == 0 && KTRPOINT(td, KTR_STRUCT)) ktrsockaddr(sa); From nobody Fri Jan 17 02:31:55 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ3f4244Tz5kH04; Fri, 17 Jan 2025 02:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ3f40qX2z3cMT; Fri, 17 Jan 2025 02:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737081116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cCsuWDcy2Y3/MQL3IEIx65v91ppQOYQk5L3auj6zyEQ=; b=bxtMMeQXGxblJzFZ0Obdg4tWA8NDQpI+QIn1L4fAllBQnHzmF4qSmJUUhdUaGTOpUva+z2 RwDYc7WI9oFZdpfsGkmXMCwEQ1USXc+RCSFysOHUqSphOVsXx2BUQBzOxNSSJf//Z2znkD ZAaDUz2UowgPconwEsT/s30hvl7bvQjdF3LLsQ1bC/QOL88VwFoG3Vw9k/YMZ7/Sd1AlHd +RRabWK5rNfT1UywFnNI8lorNutUC/hBXijcEaAxdoa/+wB+/DDHlpHVqB1nQdsVKaKMIu 6ruDEfPPSGSWo7gAI7Ez0ODapNz5Gne1LKh2MJvA7HnSG0Dd95ABn/fIY7MO0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737081116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cCsuWDcy2Y3/MQL3IEIx65v91ppQOYQk5L3auj6zyEQ=; b=dqI+BzdtQ7/H5V9qjJlbYxG0ITYggl/bpR3SVurMyTRLSVSc7EbIcr2GQvP/pRr7Y5MCG0 MsGCefTiftOIaXTv0EWtXvYLcKbGcQDaeWe5kWGXNofbBYPjfFx76TldStbvySjevShy7E ijiObWSBSrfL3xPWCR/3yPwvsdhtZ3XP3yHNWYF4TPhQtDLG5m8vJF2igHBFeGaIX3UUpa Pw5Gqx0rz+td6kQqryfD60/Yr3eiipMIzQVDQMy7YEnxn+G5NdDzKQlg/qbM1Wv8cYAVcg M6OU4y8k+v8rWYKgt22LqaC94viMFpi1r9OsBxCRYTK4xUcsmZF/l91Aq3TO2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737081116; a=rsa-sha256; cv=none; b=CMtrLT0IJkxYj0YvO8jUPJ3MnoOYQ9WCQWwwTu/qAK/rW7cBqB40BR0dxwJHo9kKUdjlAE BmmfRjxd7jjjKD6QDrnuoPfwzPe0azfd3L8XS/hSlU6G34p/5xhheH9ulJQR2kUk+aWJ7O IJPBGysrbF3KqtaZBn6AgPqJ5PNjQ7HVBvtBB4iQ0SOC6Jx0/5YD1A/FUt1uUMf4A9bSe1 JFY+hTIKSkc65wj7tdxh+5+iR4sUNMqr7UkGpeppujrmwNtlFxj5CBM6NBh2qVCs+7RGkB kbO66e7P8viGNOcjuue72TG6qbFXleDPswP02WPs1C+UAlVtt9NvkHPX17n8XA== 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 4YZ3f40QVWz106l; Fri, 17 Jan 2025 02:31:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H2VtJV044467; Fri, 17 Jan 2025 02:31:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H2VtNN044464; Fri, 17 Jan 2025 02:31:55 GMT (envelope-from git) Date: Fri, 17 Jan 2025 02:31:55 GMT Message-Id: <202501170231.50H2VtNN044464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: a1be7978f187 - main - netisr: avoid VNET recursion warning in netisr_register() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1be7978f1879313c141882a1e0812b468dead57 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a1be7978f1879313c141882a1e0812b468dead57 commit a1be7978f1879313c141882a1e0812b468dead57 Author: Gleb Smirnoff AuthorDate: 2025-01-17 02:31:15 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-17 02:31:15 +0000 netisr: avoid VNET recursion warning in netisr_register() While here, move some assertions to the top of the function. --- sys/net/netisr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/netisr.c b/sys/net/netisr.c index 4ae1aa9ab89d..e9b8fa4d833c 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -395,6 +395,9 @@ netisr_register(const struct netisr_handler *nhp) /* * Test that the requested registration is valid. */ + CURVNET_ASSERT_SET(); + KASSERT(IS_DEFAULT_VNET(curvnet), ("%s: curvnet %p is not vnet0 %p", + __func__, curvnet, vnet0)); KASSERT(nhp->nh_name != NULL, ("%s: nh_name NULL for %u", __func__, proto)); KASSERT(nhp->nh_handler != NULL, @@ -454,15 +457,12 @@ netisr_register(const struct netisr_handler *nhp) npwp->nw_qlimit = netisr_proto[proto].np_qlimit; } + V_netisr_enable[proto] = 1; #ifdef VIMAGE - /* - * Test that we are in vnet0 and have a curvnet set. - */ - KASSERT(curvnet != NULL, ("%s: curvnet is NULL", __func__)); - KASSERT(IS_DEFAULT_VNET(curvnet), ("%s: curvnet %p is not vnet0 %p", - __func__, curvnet, vnet0)); VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { + if (vnet_iter == curvnet) + continue; CURVNET_SET(vnet_iter); V_netisr_enable[proto] = 1; CURVNET_RESTORE(); From nobody Fri Jan 17 02:31:57 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ3f53kyFz5kGVy; Fri, 17 Jan 2025 02:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ3f51s9rz3cMX; Fri, 17 Jan 2025 02:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737081117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gv6kjQp/agWfBOgmt2LpIwHrVnE/crp8gzZIZ0eNdEM=; b=TcQ09zr0quTqtB+I1ysV41T8j0vncuwFDSwQAatlzCruPB1alouUpfysUIDtcM51IgIQfn Kf/co7sYUUDPhNtTzk0r7d3N1SMznpJXK8dOy9YbJWH5yjA08iqLCGYw1d/E7QUMC8Gi26 brRiYJ4NgSpuqrxsk/t3teXj92DIol5Qaixn2QRyRzQrSc6O2kvRAomZemxD5zXiCDVY/a QTZr5l1XyzdP2qB0eSnBXI3ELts5FpInLrUCnXAujfe9Eyb+e1y4AdkDWCy1j9qbR/0vVM OoaKhUvcPkBQtSHbCtGwqwadAEbUfVa6DOmg50b2hiAmOp0oaWjrzLZxhFvK6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737081117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gv6kjQp/agWfBOgmt2LpIwHrVnE/crp8gzZIZ0eNdEM=; b=o1qnFwfZk/Y/4kdjthKnzXSA8FPHALoD6asJx7w9u10pVM7tJG8/3jrdJfq/iYorJ2VpI6 EQ63BKXATkAzIwYVqAu4OkCjv9T2oWtlIIW5tFXJEp5bKVDGbqQgpNSB5YoZNoUNnxCWr6 99VBvzUeHMTMdDN4YQyKj7rTJQnwmHPR+4eYTMyZetdod1GjoKI1xHgDjW7V2OpvnD53Ox 3geqL7S+rB7VaKz+xnKS11CYK4hldiKa0rgv4h3pWSENyBaRkxVa3/YcktCZMdSlT37rAK CGu4BTrYXzSO3NSEL4R88XeKkE9yUWNoZj6SyYHso9RiuHDqzJdaTO/wUmRrhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737081117; a=rsa-sha256; cv=none; b=uxAtur1+Rv7xlNMg/6RHmKRDjg+P0GEoZ6IaUuozfQhvugisuKvDw4FT24qSwAu08DUaO5 68ia2oyJVvnQSxXGtmwOuqJnHG77l2g+GampaSYUbz0OMM1eVC7/Fi/j6VPRmB0wGyo7BY UmgrdyRIBHDfVS9mZJijeS5obONthjomKagKJ/cXcbLyYnA+smmGEpX0nNTQbyc3QCqoFZ OqBEz7+vcW0pMhUVMciBMXjhnhyG5h2SMPPAQmQq01Wrk6CuPHP4/gR6Ji5aWoBWLIs7Ct QPVwqi36zfi2CWNo1Jiv4j890xUyCXzIAkZvsDRu2irvQBqw7pgRTrcmuwpRlQ== 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 4YZ3f517PTz10Cm; Fri, 17 Jan 2025 02:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H2VvmX044512; Fri, 17 Jan 2025 02:31:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H2VvoQ044509; Fri, 17 Jan 2025 02:31:57 GMT (envelope-from git) Date: Fri, 17 Jan 2025 02:31:57 GMT Message-Id: <202501170231.50H2VvoQ044509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 4c0e435bfbad - main - unix: avoid VNET recursion in unp_connectat() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c0e435bfbad52358ad6c6508cf3dca2e7b45227 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=4c0e435bfbad52358ad6c6508cf3dca2e7b45227 commit 4c0e435bfbad52358ad6c6508cf3dca2e7b45227 Author: Gleb Smirnoff AuthorDate: 2025-01-17 02:31:15 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-17 02:31:15 +0000 unix: avoid VNET recursion in unp_connectat() While that might be a cool feature, but you can't connect two sockets in different VNETs. It is just technically impossible right now. This CURVNET_SET() was always setting the same context. --- sys/kern/uipc_usrreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 3d7e5bcc5ad0..c1f1c07da268 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1897,6 +1897,8 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam, int error, len; bool connreq; + CURVNET_ASSERT_SET(); + if (nam->sa_family != AF_UNIX) return (EAFNOSUPPORT); if (nam->sa_len > sizeof(struct sockaddr_un)) @@ -1991,11 +1993,9 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam, goto bad2; } if (connreq) { - if (SOLISTENING(so2)) { - CURVNET_SET(so2->so_vnet); + if (SOLISTENING(so2)) so2 = sonewconn(so2, 0); - CURVNET_RESTORE(); - } else + else so2 = NULL; if (so2 == NULL) { error = ECONNREFUSED; From nobody Fri Jan 17 02:53:07 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ46Y2dlzz5kJ1L; Fri, 17 Jan 2025 02:53:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ46Y22KCz3fBl; Fri, 17 Jan 2025 02:53:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737082389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DtWuQJMYKWZLkde+2M8Hm8XcKhsOm7Oq9JQZ1kYzJLw=; b=KwX0S5Iu/pTqnnezz4rx7UOMIvr3Nbvfn8+fHRyo9Ej7SqTo8Psv4cFBKVzDgPSrZWhe1s X2evwHb+p3/RxsTluREGSjlUiQW8jQZIQiCGWsI/gGGt7qrha79M7s5dgZ9viRfETur0QZ 6BkybxVcJEInMFixrJbaEMptVkRWJO1HZvF/WMjwEo41fKSaLtmba+C5JsqTSrbM8lC9Oe +IyCuey3ErGWk1iBW6Ep5SDq08Yxn1W3MlOTgFg3GPhK2rzGH6KJonPkYw8Crj82bIXEV4 Y2DBtB0GANRUR1+PPzrq4+0FghXOB8LA4f41oCWpSzWPWCy2RKbvuKfZBB26Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737082389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DtWuQJMYKWZLkde+2M8Hm8XcKhsOm7Oq9JQZ1kYzJLw=; b=ZpHf026bfj+8F2lflbr7InpnSTZyRzY6hYX3y9GTY92NWEVnIuBGzRtdJcBqrHdJRxXhAj 2BZSy8AcK7mVJZWXGKM958+OET5Px6zpYYBGf4SgI1q55M7MZO/+yyHTDXPZ24hWEO0rOb BQp98UzCX54Wv2fpYNWHB5InT5QN7MIZKp9pobi0w9CdjdFl40cpLR+3zTkEJ96EX4yf/2 somz48G50qPeGhlSUkvmnFTMYn0UahtI0N+SHRAw8+BpmGVjGmyoOHon5dwTnP2jJOdm/y JqsZtjQXpP+TKFlG7SaWDZPvrH0rLO6oKINEcNLxmzg4hDbWk0NT5la7agyKJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737082389; a=rsa-sha256; cv=none; b=YKpBL2Z36SA7v8MwHGMFiFc8X7XJaQ/OGmgVkN5dmU5tqu5pwhjVWa0p0EVnJS82DzTumZ p19Z2yWWx2ndgMSugV7BJh9g6zKWEf/Fu3Q7qzse2aFWYc6LoQek5RDuQKwhcDeZRSwc5A hWhdxJT7yDDyZn3xL5aSNmMC/hOrh1fkXKrsufcgcfTsh+NYC612UHizIonXedhN+lR4i7 RYN+6SfQ/+BGW6BRjSP5Buk04rndNBkwQfkId321jFCJRv98Rs2HzIjBXjh8Y5UJWRVD2N 9Q7Lj5MdhkhpCa0oGsiepbls2zEoKTHPPmkEr33tMY4srmHgxLrPog/p9trgKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YZ46X5lmPz154Q; Fri, 17 Jan 2025 02:53:08 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: Date: Thu, 16 Jan 2025 20:53:07 -0600 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 9ded074e875c - main - Refactor makesyscalls.lua into a library To: Brooks Davis Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Warner Losh References: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> <25a28def-fbfd-49df-a2bf-dc4ef6609440@FreeBSD.org> Content-Language: en-US From: Kyle Evans In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/16/25 16:43, Brooks Davis wrote: > On Thu, Jan 16, 2025 at 03:52:22PM -0600, Kyle Evans wrote: >> On 10/30/24 16:08, Brooks Davis wrote: >>> The branch main has been updated by brooks: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=9ded074e875c29cb92d5f643801990d7bb23cca4 >>> >>> commit 9ded074e875c29cb92d5f643801990d7bb23cca4 >>> Author: agge3 >>> AuthorDate: 2024-10-21 21:42:13 +0000 >>> Commit: Brooks Davis >>> CommitDate: 2024-10-30 21:04:30 +0000 >>> >>> Refactor makesyscalls.lua into a library >>> * main.lua replicates the functionality of makesyscalls.lua >>> * Individual files are generated by their associated module >>> * Modules can be called as standalone scripts to generate a specific >>> file >>> * Data and procedures are performed by objects instead of procedual code >>> * Bitmasks are replaced by declarative types >>> * Temporary files are no longer produced, writing is stored in memory >>> * Comments provide explanation to functions and semantics >>> Google Summer of Code 2024 Final Work Product >>> Co-authored-by: Warner Losh >>> Co-authored-by: Kyle Evans >>> Co-authored-by: Brooks Davis >>> Sponsored by: Google (GSoC 24) >>> Pull Request: https://github.com/freebsd/freebsd-src/pull/1362 >>> Signed-off-by: agge3 >>> --- >>> sys/tools/syscalls/README.md | 49 +++ >>> sys/tools/syscalls/config.lua | 312 +++++++++++++++++ >>> sys/tools/syscalls/core/freebsd-syscall.lua | 147 ++++++++ >>> sys/tools/syscalls/core/scarg.lua | 163 +++++++++ >>> sys/tools/syscalls/core/scret.lua | 45 +++ >>> sys/tools/syscalls/core/syscall.lua | 497 +++++++++++++++++++++++++++ >>> sys/tools/syscalls/main.lua | 64 ++++ >>> sys/tools/syscalls/scripts/init_sysent.lua | 193 +++++++++++ >>> sys/tools/syscalls/scripts/libsys_h.lua | 111 ++++++ >>> sys/tools/syscalls/scripts/syscall_h.lua | 97 ++++++ >>> sys/tools/syscalls/scripts/syscall_mk.lua | 90 +++++ >>> sys/tools/syscalls/scripts/syscalls.lua | 109 ++++++ >>> sys/tools/syscalls/scripts/syscalls_map.lua | 74 ++++ >>> sys/tools/syscalls/scripts/sysproto_h.lua | 242 +++++++++++++ >>> sys/tools/syscalls/scripts/systrace_args.lua | 268 +++++++++++++++ >>> sys/tools/syscalls/tools/generator.lua | 113 ++++++ >>> sys/tools/syscalls/tools/util.lua | 194 +++++++++++ >>> 17 files changed, 2768 insertions(+) >>> >>> [...] >>> diff --git a/sys/tools/syscalls/core/freebsd-syscall.lua b/sys/tools/syscalls/core/freebsd-syscall.lua >>> new file mode 100644 >>> index 000000000000..193b1e43563c >>> --- /dev/null >>> +++ b/sys/tools/syscalls/core/freebsd-syscall.lua >>> @@ -0,0 +1,147 @@ >>> [...] >>> +function FreeBSDSyscall:parseSysfile() >>> + local file = self.sysfile >>> + local config = self.config >>> + local commentExpr = "^%s*;.*" >>> + >>> + if file == nil then >>> + return nil, "No file given" >>> + end >>> + >>> + self.syscalls = {} >>> + >>> + local fh, msg = io.open(file) >>> + if fh == nil then >>> + return nil, msg >>> + end >>> + >>> + local incs = "" >>> + local defs = "" >>> + local s >>> + for line in fh:lines() do >>> + line = line:gsub(commentExpr, "") -- Strip any comments. >>> + -- NOTE: Can't use pure pattern matching here because of >>> + -- the 's' test and this is shorter than a generic pattern >>> + -- matching pattern. >>> + if line == nil or line == "" then >>> + goto skip -- Blank line, skip this line. >>> + elseif s ~= nil then >>> + -- If we have a partial system call object s, >>> + -- then feed it one more line. >>> + if s:add(line) then >>> + -- Append to system call list. >>> + for t in s:iter() do >>> + if t:validate(t.num - 1) then >>> + table.insert(self.syscalls, t) >>> + else >>> + util.abort(1, >>> + "Skipped system call " .. >>> + "at number " .. t.num) >>> + end >>> + end >>> + s = nil >>> + end >>> + elseif line:match("^#%s*include") then >>> + incs = incs .. line .. "\n" >>> + elseif line:match("%%ABI_HEADERS%%") then >>> + local h = self.config.abi_headers >>> + if h ~= nil and h ~= "" then >>> + incs = incs .. h .. "\n" >>> + end >>> + elseif line:match("^#%s*define") then >>> + defs = defs .. line.. "\n" >>> + elseif line:match("^#") then >>> + util.abort(1, "Unsupported cpp op " .. line) >> >> This specifically is kind of a huge regression, and I don't really know how to >> cope with it. We've guaranteed for years that we'll copy preprocessor >> directives through to all output files. We don't use that upstream in >> FreeBSD, but we work with downstreams/vendors that make extensive use of it in >> their syscall definitions. >> >> I don't really know what the answer is to this, but we probably shouldn't have >> dropped it without some discussion first. This is going to be a bit of a >> headache... > > This response seems rather hyperbolic. This change was up for review > for months and the feature is unused in tree so there was no way to know > it was important. > Re-reading, yes, this was a bit dramatic; my apologies. There's plenty of frustration here, mostly amplified by the fact that I was on the review just as much as you folks and have worked in environments that use it- it certainly should have stuck out to me, but I just didn't have the time into it that I'd hoped I would. I would've also really liked to see an "XXX" comment at a minimum drawing attention to it or a call-out in the commit message, given that the syscall definition documentation isn't that lengthy and this is one of the few guarantees we make it. I think there's some compromise to be had, but... > It would be helpful to work through some examples understand what people > need here and if it really has to be a refactor to pass things through > or if adding some new tags and config values could do the job. > ... I'll respond to this this weekend, hopefully. I'd like to condense what I'm aware of into some formal test cases in sys/tools that I can point to so that we have something less abstract to debate the merits of, and also so that we have something we can verify the functionality against. > The quickest workaround would probably to revert these commits locally > (I took care to isolate them for exactly this reason): > > 5212b9500116 sysent: GC sys/tools/makesyscalls.lua > 204d065dac81 sysent: switch to refactored makesyscalls.lua > > You might also need to revert this commit or implement it in > makesyscalls.lua: > > bbc0f33b1317 sysent: add a NOLIB modifer to prevent stub generation > > If we need be, I'd even be ok with temporarily restoring makesyscalls.lua > and back porting easy features, but maintaining two is certainly not > viable indefinitely. > This isn't urgent enough to warrant any of that- it's just something that I'd like to work out how we can solve (preferably in the short-to-mid term), because there good uses for at least a subset of what we supported before. I don't think we need to go as far as supporting arbitrary preprocessor, but if we could at least devise something for conditional syscall slots that'd probably be sufficient and workable. Thanks, Kyle Evans From nobody Fri Jan 17 04:19:44 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ62S3vYkz5kNqS; Fri, 17 Jan 2025 04:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ62S2yM6z3lJS; Fri, 17 Jan 2025 04:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737087584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d+JmmmKYPQ4M2Fb2MNTkkP63XykRVKoRLP2pk2qji0Q=; b=hy5b/P9MjxtiOuPP0/Vb22mxSAHL5g3Rn388tD2gi3YsXS9+6xicTBEpRLF3LMOG56f6Ej 9Wg7tELeXiz/6DUlSYAg0Tx7iqM2ycNHHJXME2elRB8r1Flbfa5uf+iVCG+zpk1XrMzdrr meM4DNN76ecywxZEQ1iM9upmSg+SZcGl2iFexA9eNCHNE5eAnrClSw/wPQDyYmMnOXSEJa SPB1WmMb44gzpRHq+7Tbqs+nAqh5ZpW62OWv7M4aMeYSUIG2je1eqqAROdVd1kzdpKQ2+C k6aFI+I7AB3gryYbKTvZ3u0CNARkO3eXg7URb90uvF6p0hUczCbjzdCdOIdXEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737087584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d+JmmmKYPQ4M2Fb2MNTkkP63XykRVKoRLP2pk2qji0Q=; b=pep0ZCSk0f150B0GSd6IfVfitzMQoaAhvnDIFF5D1ggQgYKii6RvlfGnLNDL2XgSswnsGS 4EvlKTnQCSMFqyxcGm9+YQrKxv9Qv/rprRbm02KPNDLVvgurYhRy45kLs1udL3fTY4dg/u g6Hi0Zm0A5WwcmSqM6APDUApdxyE+WoZqrEQFN72HJY9zmt+GWo/xkbArR9DPWaBW+cLut qXog85UstkN/mf9yJ2+qerMxq15okcw0GPrqLnG8PQn0d9ut/Wg4d7UekO5HuIB7herx1S vAi50QJLKjq9wa/7lHouLscFC21851KWpYi7U0qS8+IhdA5Vuzu7dd+nUQC5ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737087584; a=rsa-sha256; cv=none; b=NN/Lmd6NLVN1zDkDkl3lTrJCnvmndTRrKVC1rfxiooh/v26SPvLClnaXzNXXvm3VTlkzLW Z5v7oXvu8rXApDl+FsEFGelf8S8gcAwLeDX4K6oWO1QMGK1q/t+bWJ/P+wRCpSp50eRIK+ GUCcJSwmo9d1b9nc2xtVhMMqh0jMc06W62ylYKxq7LoMyhAEOhJiXXWtw41YbmRsOlvBif QXztGwpSvxmOrxFPGDO1E9yDkP+LIZwYa4kbjoKROmI6SN2xuEewPaCcRLZwrxRaX2807B 36zkBw75PpWTqUR1ji2PX5s/nW6CYogknu/qZFYERmFyD1n+lxgyR670QIS1pA== 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 4YZ62S2CNXz12dL; Fri, 17 Jan 2025 04:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H4JieY037809; Fri, 17 Jan 2025 04:19:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H4JisN037806; Fri, 17 Jan 2025 04:19:44 GMT (envelope-from git) Date: Fri, 17 Jan 2025 04:19:44 GMT Message-Id: <202501170419.50H4JisN037806@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 13d81ef632ec - main - genl.1: Improve grammar List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13d81ef632ec6ca5e6936ab77e8ac67a8c430033 Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=13d81ef632ec6ca5e6936ab77e8ac67a8c430033 commit 13d81ef632ec6ca5e6936ab77e8ac67a8c430033 Author: Cy Schubert AuthorDate: 2025-01-17 04:18:24 +0000 Commit: Cy Schubert CommitDate: 2025-01-17 04:18:24 +0000 genl.1: Improve grammar Make the first sentence read more smoothly. MFC after: 3 days --- usr.bin/genl/genl.1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.bin/genl/genl.1 b/usr.bin/genl/genl.1 index e11bfbc440ab..df9e5984f938 100644 --- a/usr.bin/genl/genl.1 +++ b/usr.bin/genl/genl.1 @@ -40,8 +40,7 @@ .Sh DESCRIPTION The .Nm -utility is design to provide access to the user to generic netlink -protocols. +utility provides user access to generic netlink protocols. .Pp The following commands are available: .Bl -tag -width indent From nobody Fri Jan 17 04:33:34 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ6LQ5byLz5kPw6; Fri, 17 Jan 2025 04:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ6LQ2tt1z3mcQ; Fri, 17 Jan 2025 04:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737088414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z6aZHG3YXet4qgtiEfBfuqTijjtEKCZRSnyyyOXbTrY=; b=n4Af6fRBffRx8Mx62CT66fg7TtfDy3hRUGQ2ImUJyq8b5jICVv8YBFGPb1hWnRcONgvGl+ P5UZpFH6G2S0tsBWmJos+iJDV4bf/WUmbRvgqkBuuQ1lcvbb0WDixpE+kjBIEqKicN4pjB 0TSJbsnmfUxemWAdTFJlLg2nOlAUoRP39xQ3TSV/U/M5iLLUBKP/fv0CeImpXLN9IvK0kf rj7ZfO5n19VoBxp966UTy7SmyF5o8NPI7K8yobZ5rUI/aWAGo4+S0j0wjQt39S05VZR9lJ Q8abdtbAClYFOeklG7pZYqFJBJ8FMJtzoafaREZn3Vy7T8M6rIPDkf7XggP/JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737088414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z6aZHG3YXet4qgtiEfBfuqTijjtEKCZRSnyyyOXbTrY=; b=T6cQtu6nkLY/Zd9OV4fj2CtIQGTHFL0KhfIKqz1e39fNnESNn54XjKqoeJfINGaPoYGV94 QuIYYy+HCcSZRhAc7y5zUCOHi/JcWo9ZTrELGpDJnl3HEJ3bJO9evj1xqPRVWpwF81LxpH xoxW0JsLYB2ZVe7Kna5j1VGx+ixL/vSak6jT5rkK5MU4cAq5oB6xJ7MKJM0IRmu/YMTNUb YTnRn8v+pXIBPHs0TScs/vkEepwLNqcUZA6DZq6x2QnWoKqjYnZNU+8/VdBk67MUyKtyUs YInfgJtzERBRH0l5JTn3V3oa7iGhw1Ncq8K76X93uBksQITwEhKLienxnicpSg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737088414; a=rsa-sha256; cv=none; b=OBoNOUBvB+Do/nyTUeBdzYWhKSKGQGsnDwexhYd8r1w6vj2mhfuiWCpHZFORDAirmcICuB h8yjYA5hNEqCZPspJHT6RyYMBXEDXvaV7M+IgDW5x794EfXKp81iix72nE+rz9gm+F1fEf Gpr23Ab3UsGNrQwaP9ia5l1WUcuCOS74f3myZWGiPMYcXIwXvRlXe6MqNbqfpQ0nSFY/ZS lfGtAlLMZGjSoCCvGVJvOXst5WNvYeRGzHo1Dxep70xW267SukNKxOx4AjqxiIpj0gKyda uujGEtyig2zBws4qBdHVh3rHIfO1w/GW+6kr5KfMhP5v3EASisQQHws2Klsdqg== 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 4YZ6LQ2Gqcz12tT; Fri, 17 Jan 2025 04:33:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H4XY8x072737; Fri, 17 Jan 2025 04: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 50H4XYgN072734; Fri, 17 Jan 2025 04:33:34 GMT (envelope-from git) Date: Fri, 17 Jan 2025 04:33:34 GMT Message-Id: <202501170433.50H4XYgN072734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 38d947b53cbc - main - netisr: fix compilation without VIMAGE List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38d947b53cbca845926bdd91272ce1c65ba59ecb Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=38d947b53cbca845926bdd91272ce1c65ba59ecb commit 38d947b53cbca845926bdd91272ce1c65ba59ecb Author: Gleb Smirnoff AuthorDate: 2025-01-17 04:29:40 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-17 04:32:53 +0000 netisr: fix compilation without VIMAGE - Don't use bare vnet(4) definitions in the KASSERT, they aren't available on a kernel without VIMAGE. Just through MPASS() here. This is more of documenting assertion rather than an assertion that may actually fire on an unmodified kernel. - V_netisr_enable is different to the rest of V_ prefixed globals. On a kernel without VIMAGE it basically doesn't exist, instead of being present as a single instance. Fixes: a1be7978f1879313c141882a1e0812b468dead57 --- sys/net/netisr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/net/netisr.c b/sys/net/netisr.c index e9b8fa4d833c..7b4368276c58 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -396,8 +396,7 @@ netisr_register(const struct netisr_handler *nhp) * Test that the requested registration is valid. */ CURVNET_ASSERT_SET(); - KASSERT(IS_DEFAULT_VNET(curvnet), ("%s: curvnet %p is not vnet0 %p", - __func__, curvnet, vnet0)); + MPASS(IS_DEFAULT_VNET(curvnet)); KASSERT(nhp->nh_name != NULL, ("%s: nh_name NULL for %u", __func__, proto)); KASSERT(nhp->nh_handler != NULL, @@ -457,8 +456,8 @@ netisr_register(const struct netisr_handler *nhp) npwp->nw_qlimit = netisr_proto[proto].np_qlimit; } - V_netisr_enable[proto] = 1; #ifdef VIMAGE + V_netisr_enable[proto] = 1; VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { if (vnet_iter == curvnet) From nobody Fri Jan 17 07:28:21 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZBD608WYz5kbMt; Fri, 17 Jan 2025 07:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZBD56ZTNz41CQ; Fri, 17 Jan 2025 07:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737098901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D01kJesutVPDn7mxht/9KStaJkH93BuI6Netb6e8azo=; b=YPNIVepP3FQBewDKdKW+NUwX90/PtD9WRQt/V/WvZrcfwPPgH98J97ROpYzBjT6xFBFCgs hdj9EXFp2tiYw7rUxiKI3cLz26Oallv6nr3H+gP4WlP38DDcOjKs/apXxEfTGMRvxoV5ia ldIXjbRNrzhWCddruE49cTPfaOOin27GtkdSn45Ihfl6vtRo54BB46twP/qDMYmKr9iJ6P hI3VdIkBThWV+MkmyeQGMWQQP7xnNLywIZo1SLftyF8fPwu7I9P1cbPNyHXhIm64NwWkVx p3YYSIKcVGjTplHOVkTnt03RGCQ3RhlbyXLMzUkQC5Z3E9vTV+L4dSf/l5RA2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737098901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D01kJesutVPDn7mxht/9KStaJkH93BuI6Netb6e8azo=; b=eHNZ92MW76py4CtcmwKHezE7Rd2x0phX4L8Nv9VksOM6+JA1X+tV2RkrHKRwwFvH6yao4j eBXgL4MlVOjuJAFswcUnZF4VnC1O8zSXExCsILuIZpap+c+l1psH2gMVCp6rrixeDwj2tt m5PkfI2A/CMHbQ5sk6OspqooRPp1Mpv5VjbAsuDLakoWXCg3RifS5P74ZtCs2U1FlgI+XB rUyz5Isc38FDrrW1xL898sHaUTMisKRIiK+YxCQ1KwxKxuCxWnB/HiKUGLBVZ3GVY86QIE edIgt5uH/EguXjXK2b/yjtV3EF/P/MaH+kLLTALJipof/2kf3BiySIctiv1KIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737098901; a=rsa-sha256; cv=none; b=EROD2WY15grF/p6u/Ane7htFj58iAnb+X+x5vIiKh3JQlWg92G3bAAvVHIrS2Dz/p5RjUE AdNXkYZUSk5Uc9eRL+nKfPf7zibZYVjlCXyGje0vFhBPZJ/COy9eVaPSgOVEYlRg/UAdHC TwAWHwM1vG+0Mb8QNbGbcTN6vJV55+GlOxL/c4mwNJ/uZxGcxRlmyujmJ8XpUf9V+XpAvl r1lbtQ6T49718shyjdGh8pK8Xd5TUuXLDcH4IUG21sYN/IrvN5NJhsc9uRbRXJ9WFeSiLj hjBZLVUHAJnNklZI6RBM/P0wm+gFmRbR7vUJldokTI7f3GfIev2mImXoE/qDCw== 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 4YZBD55sMmz16Pt; Fri, 17 Jan 2025 07:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H7SLnf091896; Fri, 17 Jan 2025 07:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H7SLbU091893; Fri, 17 Jan 2025 07:28:21 GMT (envelope-from git) Date: Fri, 17 Jan 2025 07:28:21 GMT Message-Id: <202501170728.50H7SLbU091893@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 9d04973b4adc - main - krpc/clnt_vc: remove always false check List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9d04973b4adc1b6312043fc313e4bf2c85593904 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=9d04973b4adc1b6312043fc313e4bf2c85593904 commit 9d04973b4adc1b6312043fc313e4bf2c85593904 Author: Gleb Smirnoff AuthorDate: 2025-01-17 03:52:34 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-17 07:27:21 +0000 krpc/clnt_vc: remove always false check We just initialized ct_closeit to false a few lines above. --- sys/rpc/clnt_vc.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c index 91556dddebaa..2f2674e694af 100644 --- a/sys/rpc/clnt_vc.c +++ b/sys/rpc/clnt_vc.c @@ -234,12 +234,8 @@ clnt_vc_create( */ xdrmem_create(&xdrs, ct->ct_mcallc, MCALL_MSG_SIZE, XDR_ENCODE); - if (! xdr_callhdr(&xdrs, &call_msg)) { - if (ct->ct_closeit) { - soclose(ct->ct_socket); - } + if (! xdr_callhdr(&xdrs, &call_msg)) goto err; - } ct->ct_mpos = XDR_GETPOS(&xdrs); XDR_DESTROY(&xdrs); ct->ct_waitchan = "rpcrecv"; @@ -252,12 +248,8 @@ clnt_vc_create( sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz); recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz); error = soreserve(ct->ct_socket, sendsz, recvsz); - if (error != 0) { - if (ct->ct_closeit) { - soclose(ct->ct_socket); - } + if (error != 0) goto err; - } cl->cl_refs = 1; cl->cl_ops = &clnt_vc_ops; cl->cl_private = ct; From nobody Fri Jan 17 07:28:22 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZBD71KZSz5kbN1; Fri, 17 Jan 2025 07:28:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZBD66xfwz419H; Fri, 17 Jan 2025 07:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737098903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gbQKCRPsq9hFAMngOcSfUn4uhlhczcTw7AHO8AAijPU=; b=amh0L0L+v8wrxHPkGYP9aesrj1MUFWwkfePUiV8jI+bbSFoAHdLUhIwqYiIdlk9tRFyxKK phglP12+85Bopm/AZbLUXbiGHle2ji/ixf0ZvFjPrIMmc2Ky8CWe2GbHCCO0GCbqXqkWrs k44o4gZ6aA9cg9Xqc3dr7X46RklyYCh8XOEqO0NVIh+h+Wwzl9nQ9Rrb36naiV3ieC3V1j TjI6Fv2KE9oXSyx9GZeU8PFE6g9cZ1p8FsARbC6WLgJ7BQEILUjrfdmXBeFVyp6sXLiCiy N/i/IyLrfGnbkFLieGgQMM5lyLfFAh8+MiHZL9lnCDXO2/X3A1kiA2FKLOsGqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737098903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gbQKCRPsq9hFAMngOcSfUn4uhlhczcTw7AHO8AAijPU=; b=qhtPUZuDt2lDKXl9Fj40ohIr4dLU5Pjpf0/JJLGeMLEO2ymLk3RBbEaNRwBXlcKUmJyrdI mh8q4pY11Y6JAaoKjETkmsHuCyAOUtPkjuFWRpJAwZ5uQ95nT4rDo/kAdOlOyH+kX8R3mR RAIO9E7haCZpfF/3yLZPbYb3VFq1RKNRXucGp7KWoZCCF1AMIT4ApTBxy9L4RjHmgkcmis xItbu42cLNZ3CdUSsTyvlqSoqHC52UHKJ32QXDfyWSI/aQdDA8w7oYPW2snz7WnY4flJtV 5x2570ZrFk5J4FSxvck5NulySmsPT8kKnRCMkMDR1nOIUFc8CEGIef6pK05oWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737098903; a=rsa-sha256; cv=none; b=e3yQJ7YALKaK5lS7DUc828uvadq1kJ3AX4M29iQCuUlkfGBqfUt0w9RRHqeLHONv25C5sT LRZ6JckrWrsreS5MtlWmh2u8XExgRCikDC8tIeL4s6sR35UcCSPm6m1A345v8G2pNYIyXt 9YhgMoiUf5IwxmZyOuxO1YqvnxUcfMxNkwp/nPRZCp8IHSI8/WuiW147TOm+g8xWQCeY7t pnVK6kfbzJndgOW9hq61rnb/m9vYY4AAzhc2kGz7I5WWUv20ZMMykMqEstLH+HFFHrtDN8 inADOhSxJ/+iun7pIhONmePsM+9Qxj4MR4Wv4W7sN2A1iiwqC+uSqlqx+f3IBA== 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 4YZBD66WWjz177M; Fri, 17 Jan 2025 07:28:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H7SMrs091952; Fri, 17 Jan 2025 07:28:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H7SMLU091949; Fri, 17 Jan 2025 07:28:22 GMT (envelope-from git) Date: Fri, 17 Jan 2025 07:28:22 GMT Message-Id: <202501170728.50H7SMLU091949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: d9f9a73a3363 - main - krpc/clnt_vc: in clnt_vc_destroy() use more lapidary logic List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d9f9a73a3363737aef4bae8ef6d71a2159005436 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d9f9a73a3363737aef4bae8ef6d71a2159005436 commit d9f9a73a3363737aef4bae8ef6d71a2159005436 Author: Gleb Smirnoff AuthorDate: 2025-01-17 03:59:30 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-17 07:27:21 +0000 krpc/clnt_vc: in clnt_vc_destroy() use more lapidary logic on whether to close the socket or leave it. --- sys/rpc/clnt_vc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c index 2f2674e694af..e201072b2ee7 100644 --- a/sys/rpc/clnt_vc.c +++ b/sys/rpc/clnt_vc.c @@ -849,7 +849,7 @@ static void clnt_vc_destroy(CLIENT *cl) { struct ct_data *ct = (struct ct_data *) cl->cl_private; - struct socket *so = NULL; + struct socket *so; SVCXPRT *xprt; uint32_t reterr; @@ -867,19 +867,14 @@ clnt_vc_destroy(CLIENT *cl) SVC_RELEASE(xprt); } - if (ct->ct_socket) { - if (ct->ct_closeit) { - so = ct->ct_socket; - } - } - /* Wait for the upcall kthread to terminate. */ while ((ct->ct_rcvstate & RPCRCVSTATE_UPCALLTHREAD) != 0) msleep(&ct->ct_sslrefno, &ct->ct_lock, 0, "clntvccl", hz); mtx_unlock(&ct->ct_lock); - mtx_destroy(&ct->ct_lock); + + so = ct->ct_closeit ? ct->ct_socket : NULL; if (so) { if (ct->ct_sslrefno != 0) { /* From nobody Fri Jan 17 07:38:54 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZBSG6JTbz5kbqV; Fri, 17 Jan 2025 07:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZBSG5gw8z427M; Fri, 17 Jan 2025 07:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737099534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AOFpTWgFjNuEpze7kdnodxyd3ypvU48wV9OyTnhpqP0=; b=Y0HF4kBAQktm6DN51edZmk+7vl87psygTgsPY3St+T8Ru/7g695TzTyrj9eaZCru393BUw e3lqCwanOFlTc0g3wn436lE5XjXSz6Ys8iOB8u4omjcQtGqxNK+AKBhUs/LROC4p39Ol+x nVuXwfc5YoIe8MpmtqoENIASMC+AiEHTNP0LisVEZVXosa4q/yXMfwIkeuE1/p7jaN4EoI 3kEbjnX5Vneuhib2T4vUMFFPdkrdVYfbPfaOiHbuEwjQrMOZY00fYJTznSOjQp5usje5ub E44cjjOQAo9Y8mNa1lrnVj8Hqvp0c2JoJqZnV7gX4HB3yN8NUhg8k4yQsaw7tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737099534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AOFpTWgFjNuEpze7kdnodxyd3ypvU48wV9OyTnhpqP0=; b=t3CnQ+xw+wCOiRgvUVs6poMyiATIFhK/YLy3dZGQoyQDhl3iB1IX0mj0f910+krYB21has FupQ8+9S0JI53ee/ZlN2AjxTC+j2xb8hto9Zbb42BsWNhePhGcTldBfQIfSRC/HI8MSGLq lQ90kLt80HlnuwXjRIRDYzrmV0Sk1Yy04rbJ4PeItjo0hXQROMig+ErCxqKEofkbn/vn7C vHflmotInSufSNV1uiUrZc4nVbmar6KZxf2+ZRYnph9XwgcNV8I/Fdw6eOfmkcXBe0mE9X XPqX0N9DNC6XTKS9Mr6xCeFtv1bsSoPyIb9uPJtFNlIF5lTzr17t52OqWmxb4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737099534; a=rsa-sha256; cv=none; b=treBhNwASXm+uEdhF/N3PMISxXaRc8pkpZ0PVS/dBrcj1sOOh9Abb4hI/O7zcYRv8MbG/p Ku4D0Jy5TcGAoEiL9w4M6Eh3u+a07kQawib2N8+NO4uFyEEI4VaZFWZgS9kdHW1uBo4aun ctBBlGlTnsCHlIItjFHGrawW9c3T1zAM8jqRsFRvK4of5Sp5ijiS2VWJ4xcU97aUj3LDBC 0wi4P0AX110xGun6bW2ykhBEz+BQOKsHw3VG/6+j0+9iIug6loo3/ajwEtO3mQq3TZ7udo 0xKsI+UlgMXFIR/sOUBiNTcy6pI5TYQ/+UG99FTAaYKwXWeLfrAR+Td1MwT5Ww== 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 4YZBSG4x1wz17s1; Fri, 17 Jan 2025 07:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H7cstv010722; Fri, 17 Jan 2025 07:38:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H7csAx010719; Fri, 17 Jan 2025 07:38:54 GMT (envelope-from git) Date: Fri, 17 Jan 2025 07:38:54 GMT Message-Id: <202501170738.50H7csAx010719@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: b2ff4cb1931c - main - krpc/clnt_vc: set vnet(9) context in clnt_vc kthread List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2ff4cb1931c2e1509a5741f6743322699ad1e00 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b2ff4cb1931c2e1509a5741f6743322699ad1e00 commit b2ff4cb1931c2e1509a5741f6743322699ad1e00 Author: Gleb Smirnoff AuthorDate: 2025-01-17 07:38:43 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-17 07:38:43 +0000 krpc/clnt_vc: set vnet(9) context in clnt_vc kthread The per-client kthread to offload TLS stuff was added ab0c29af0512d. Let it run in the vnet(9) that matches associated socket. --- sys/rpc/clnt_vc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c index e201072b2ee7..d26e6c294af6 100644 --- a/sys/rpc/clnt_vc.c +++ b/sys/rpc/clnt_vc.c @@ -1265,6 +1265,7 @@ clnt_vc_dotlsupcall(void *data) enum clnt_stat ret; uint32_t reterr; + CURVNET_SET(ct->ct_socket->so_vnet); mtx_lock(&ct->ct_lock); ct->ct_rcvstate |= RPCRCVSTATE_UPCALLTHREAD; while (!ct->ct_closed) { @@ -1300,4 +1301,5 @@ clnt_vc_dotlsupcall(void *data) mtx_unlock(&ct->ct_lock); CLNT_RELEASE(cl); kthread_exit(); + CURVNET_RESTORE(); } From nobody Fri Jan 17 12:06:13 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZJNk29Mkz5ktR4; Fri, 17 Jan 2025 12:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZJNk02yvz3QJB; Fri, 17 Jan 2025 12:06:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737115574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dcADDBO99IGHnc7hRWu1xiJqPWX8A4rQqtbjppV5kp8=; b=U07xyG1Kx+mduBCrSF2Y/bnM9CCd0XuaQeiqskDkxHlbVmskM3DwxllCec3/0U31Q9m/1W EHlUNs8Y3bWdu9lBWqWaJkNYAnrBbSxIMitw+D5WU+83W4xaD3bC5L6+lcSXHbIdUGv0Qq dllKgKYkhd6I3VOAFAELeuFYAOGmTPgtxJFbe1hzorWkSy1pUrCTF/5+40QiHYk0XrfJCR sKwH+BqUzGxnyhM3pRPbMmvbOp5vlEreQrJ4moBm8w9nnvDUN0LYAiJfy9f54YjgffuQaz VatwVWK7Dav4oUdy9HiDbYn8cHBdeBSIIQ78e0xsrrjMkPHZXQOLuJ5LeKxIpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737115574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dcADDBO99IGHnc7hRWu1xiJqPWX8A4rQqtbjppV5kp8=; b=ftE2T6gJ9PX976yzaUK1vxqynP4y5F+eseDVRFasMewUlA9T9AXrOA6wlaamNfdFmeYG9V 0gIPYMe8P5xLl111alP2Ib8XRzBLZxq7O145P2OLcs3ZWxOuTrbzoahPV9bfk2xbZO3e3t T9F0+9bA74i+XvP/u4xT3SZNxTIh7TzQMJMb69kDoS5F+TtmmZuOFzZ3YFZ8OCauO5wTmq b5F3anpN+AbnlKp/lnVeF+3hDLD/rqXMiz8tqGzLjAh/wreS+1Bb2tIyf86QCt6ocYdR0Q HzgscAzqHwEtHwzPEdz/PMaDUTYkulQwq2nEDjn6CnVPNJ+/SEGI59b8BM328A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737115574; a=rsa-sha256; cv=none; b=qYakDyyvIZCtEpQw4A9KOpEF4SAnkND+CVL14fs+68CB2Vt+iJwM4a5Z75pafEgxJR++4u bl0GQUwg1wvoJcoByM8MM8b9y2LcuDPZZ5X9IvJi88E5WlX4IJ3/VBs0ijyp3lG9GV0aU8 XU6m19tKRguv4upkzjPT6zrciFV31kQACsvqs+xhoUN4sRQNedNQT8RzTDb38YerjHlwGz WbVgfhM8RxXq+8utsCLW6uTNeAFdIlly6yvt2xf3dt+eViw6oAOgGNb1ik0ZEBfn66G0Ma j+ohCPivnxl+NpE9vyitYTKJFzTsjEK89fPtLPxdaui2r4xBMNXMacwu1r+QSA== 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 4YZJNj6k4Fz1qj; Fri, 17 Jan 2025 12:06: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 50HC6DM9015310; Fri, 17 Jan 2025 12:06:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HC6DHg015307; Fri, 17 Jan 2025 12:06:13 GMT (envelope-from git) Date: Fri, 17 Jan 2025 12:06:13 GMT Message-Id: <202501171206.50HC6DHg015307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 541ea3d7828e - main - pf: verify that ABORT chunks are not mixed with DATA chunks List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 541ea3d7828e0ede161ac2d8ef3e8419657ef5cb Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=541ea3d7828e0ede161ac2d8ef3e8419657ef5cb commit 541ea3d7828e0ede161ac2d8ef3e8419657ef5cb Author: Kristof Provost AuthorDate: 2025-01-06 09:06:01 +0000 Commit: Kristof Provost CommitDate: 2025-01-17 08:40:29 +0000 pf: verify that ABORT chunks are not mixed with DATA chunks RFC4960 3.3.7: DATA chunks MUST NOT be bundled with ABORT. MFC after: 2 weeks Sponsored by: Orange Business Services --- sys/netpfil/pf/pf_norm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 9f1eaf7c4d76..c9a7f7d2df04 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -2138,6 +2138,14 @@ pf_scan_sctp(struct pf_pdesc *pd) if ((pd->sctp_flags & PFDESC_SCTP_SHUTDOWN_COMPLETE) && (pd->sctp_flags & ~PFDESC_SCTP_SHUTDOWN_COMPLETE)) return (PF_DROP); + if ((pd->sctp_flags & PFDESC_SCTP_ABORT) && + (pd->sctp_flags & PFDESC_SCTP_DATA)) { + /* + * RFC4960 3.3.7: DATA chunks MUST NOT be + * bundled with ABORT. + */ + return (PF_DROP); + } return (PF_PASS); } From nobody Fri Jan 17 12:06:15 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZJNl2Vx7z5ktWH; Fri, 17 Jan 2025 12:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZJNl1TnSz3Q4L; Fri, 17 Jan 2025 12:06:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737115575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jEYsHSzoaoHnAH8Nm7p2nVrvfsQ2p+5i92+66LeIyW4=; b=piDyQm6Cp4h4LoL2dQf1v1z8+ustdymVuyOaORpI+PmfyCWA4vKOzvs+Ndc5BfR87VupYR 0OekhK1IkBrFCPAX53SYWD9D4Qi3zYc1S3oT/lnduUv/9wfveEcc/AqEgITi875D/gP3qM RR//AufTe5LzA4F6cxrowtLvJQ9uzUxgHh1tV38cy+LBCTMi6htMh4X7XIbupBa7dtSKON Hg1A+2H1ChXccheKyuQ+7PM6mS++yxA0GrlYVg+r0PLodffV25i9vJxvyxxsqfvXNimH7t 3OASAjP5487uRmopf2/RIxiX7ZhSxraXFv8bO66M1sqLzT5ZCc5qABrkkTlr0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737115575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jEYsHSzoaoHnAH8Nm7p2nVrvfsQ2p+5i92+66LeIyW4=; b=j4CJaG83tY9e5SEOIOLRLnx9MIU3hKk5YK/vLzlUaPNzP9RltHVXBw76mLb2qgj6x/SOZw JV5pQRAggjb6rR44mLtWdsahNgHFssRgBNlMtVYqPTCtQiQXe5us1t2DzTaxEvHM0UiY9s x2R+V2pRiwTNJbzKZmMCmrH2KqpjbE7Iroc7j9UqXD0c5sm5gyYTB9+541lFKF3G88zRpy jU4KN8wJFpcxhtYH5a0mPhAUHM0vFGYv/FfMRjPQnZ301FsBcPzGxEkExsnZAdqN8dUogE uM6V2qitpvxaYr/WlU5mev/C5rCX5XwiP3rLmpa49ZsmqlE0WzJOf/VQpbRrhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737115575; a=rsa-sha256; cv=none; b=Ie1b1osA7UFd31ioKWDgYGacW/jEoSRU03eYEXTaL30NyqoCfGm1SKjd2suSFCJVZ7s0Za xOO7Lc/OvW4CphT1t0IQYRCZteqKlKIZVhWr1PuKL6T1Bs7K2CaAQhxOw+slz6Rf3LqqZR GtHyXFYS80VWRGLjBnvpf5Y6h/2dhpHgPWBewf2+O4VIK5CImrZ7rlJ8mzABYFUhHW4jc9 LdIsgZDQRvQIjGvb3d4pcmNdah6Dq0hV2KqI1gONbinfdasHyACpUf0D4OlvY39TfJdsXU Hj5itz4jzwdT0L/mP/cV15jag9gAh0cSbEqOy/322HNwixf7IZguF2T1OAwH3w== 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 4YZJNl0ykZz2jm; Fri, 17 Jan 2025 12:06: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 50HC6Fi6015363; Fri, 17 Jan 2025 12:06:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HC6FN0015360; Fri, 17 Jan 2025 12:06:15 GMT (envelope-from git) Date: Fri, 17 Jan 2025 12:06:15 GMT Message-Id: <202501171206.50HC6FN0015360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 4713d2fd5663 - main - pf: verify SCTP v_tag before updating connection state List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4713d2fd5663eb64aa582dabced21d253c901a66 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4713d2fd5663eb64aa582dabced21d253c901a66 commit 4713d2fd5663eb64aa582dabced21d253c901a66 Author: Kristof Provost AuthorDate: 2025-01-06 09:06:58 +0000 Commit: Kristof Provost CommitDate: 2025-01-17 08:40:32 +0000 pf: verify SCTP v_tag before updating connection state Make it harder to manipulate the firewall state by verifying the v tag before we update states. MFC after: 2 weeks Sponsored by: Orange Business Services --- sys/netpfil/pf/pf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index cfab6a828d5f..7b0ee24965b9 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -7149,6 +7149,9 @@ pf_test_state_sctp(struct pf_kstate **state, struct pf_pdesc *pd, return (PF_DROP); } + if (pf_sctp_track(*state, pd, reason) != PF_PASS) + return (PF_DROP); + /* Track state. */ if (pd->sctp_flags & PFDESC_SCTP_INIT) { if (src->state < SCTP_COOKIE_WAIT) { @@ -7180,9 +7183,6 @@ pf_test_state_sctp(struct pf_kstate **state, struct pf_pdesc *pd, (*state)->timeout = PFTM_SCTP_CLOSED; } - if (pf_sctp_track(*state, pd, reason) != PF_PASS) - return (PF_DROP); - (*state)->expire = pf_get_uptime(); /* translate source/destination address, if necessary */ From nobody Fri Jan 17 12:06:16 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZJNn1452z5ksZS; Fri, 17 Jan 2025 12:06: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZJNm3M7yz3QTG; Fri, 17 Jan 2025 12:06:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737115576; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wNyAKwwcQRVjoIWzoTQ0foTrVqPVY0YFK79bqD0/noM=; b=vjRFXpCbCUOYCZMHbc86dadhkZ0+Q6sBSfbM1udqKqGG+yMd/uuf26EAf6C/CQaWjAut0j ruXx53VMnErktk42PA6hRxYLAGQ++RGzs+6koutR67hsgQlo+7cHRtLV88+sTp/Sb/ru9P BZJu035RAFEMXocJR4XbYkV3U/8CmB8oLLgIPoCyV5KZd37dpuoBPuWkrKm4qX9RlLRn3L YV5LU3lTZG82+dqAOuyQMx4KR0RVK5wdodIvaQQe+6tEMUuGEugYBVuiYz+H3ytInB1TXz YP3CBtoQxDuvQvEGlJYq28lJMGT2BoaV/ny+f91vl+nZwV/bLd+TEgZKYXg89w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737115576; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wNyAKwwcQRVjoIWzoTQ0foTrVqPVY0YFK79bqD0/noM=; b=Z/RWfKwmGEI8vEhyAvy8QbvhXr1oKQZuzKp5iBk1QQnU/+WpfhxfnNFD1IZo6tdyxd23rO u205HqcYNcnCL/yOjPiO6TkDKEzcz1M0RVEt1LqmYl2byanawKwfaF6sEUzFBVhbwXAyFv +wDbxdBLTez1pLtQVshaB5A7GcXcxjSw/5Qc5V/0PKlVkSTu545iDFJA9q+mBppVjTvwCf R5T9E+0p1Vi0yTgoZQe9lzC2WHipVk3f73EOuvWUuFgflLsYACVs+uTtWW0JpjnHaTtyka WZ5FhbxXBBofLPNcU2Rq+T6Z+22iS/+DklIXFXvnvv56iG+rbTJGpRyQqRH9Ww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737115576; a=rsa-sha256; cv=none; b=ZAOKG7jp0q4aFFwuiR1GXAdjAxVBdWbeoSZ/xPiayKdr5dNQ1zZNmjdfgWzuEF/zg5HMid ttx5yrK8QWUKaJibRprhhDeyj+SonB2M7Kzaq0Tt4mUZuPwri5alFeGRNm1+lAf4dy6k2C L/sriaeQw6pTSyLjbOGEvS3oOUwGS0ysxcggz0xzGa2rYciqLlH0QjWselPUsW4RExDT5f LyjqYSWNL4K2uKCzvxvhu8dHD/C8NRqLnUjsQ0JKqg6V8/zna3YhZEKNvJgEL7VpEXjace VP2WKTulwJZWHovukWcxnBPn25nValUEHs3Wd8+8ltPoBrbDvtlLsFURGQqrNQ== 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 4YZJNm1knBz2Vj; Fri, 17 Jan 2025 12:06: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 50HC6GdA015421; Fri, 17 Jan 2025 12:06:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HC6GoX015418; Fri, 17 Jan 2025 12:06:16 GMT (envelope-from git) Date: Fri, 17 Jan 2025 12:06:16 GMT Message-Id: <202501171206.50HC6GoX015418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e4f2733df8c9 - main - pf: add 'allow-related' to always allow SCTP multihome extra connections List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4f2733df8c9d2fd0c5e8fdc8bec002bf39811f3 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e4f2733df8c9d2fd0c5e8fdc8bec002bf39811f3 commit e4f2733df8c9d2fd0c5e8fdc8bec002bf39811f3 Author: Kristof Provost AuthorDate: 2025-01-09 20:28:46 +0000 Commit: Kristof Provost CommitDate: 2025-01-17 08:41:25 +0000 pf: add 'allow-related' to always allow SCTP multihome extra connections Allow users to choose to allow permitted SCTP connections to set up additional multihomed connections regardless of the ruleset. That is, allow an already established connection to set up flows that would otherwise be disallowed. In case of if-bound connections we initially set the extra associations to be floating, because we don't know what path they'll be taking when they're created. Once we see the first traffic we can bind them. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D48453 --- sbin/pfctl/parse.y | 21 ++++++++++-- share/man/man5/pf.conf.5 | 6 +++- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.c | 24 ++++++++++++++ sys/netpfil/pf/pf.h | 1 + tests/sys/netpfil/pf/sctp.py | 76 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 126 insertions(+), 3 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index ff2e2d2c93b7..4a7bd3125372 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -173,7 +173,7 @@ enum { PF_STATE_OPT_MAX, PF_STATE_OPT_NOSYNC, PF_STATE_OPT_SRCTRACK, PF_STATE_OPT_MAX_SRC_CONN_RATE, PF_STATE_OPT_MAX_SRC_NODES, PF_STATE_OPT_OVERLOAD, PF_STATE_OPT_STATELOCK, PF_STATE_OPT_TIMEOUT, PF_STATE_OPT_SLOPPY, - PF_STATE_OPT_PFLOW }; + PF_STATE_OPT_PFLOW, PF_STATE_OPT_ALLOW_RELATED }; enum { PF_SRCTRACK_NONE, PF_SRCTRACK, PF_SRCTRACK_GLOBAL, PF_SRCTRACK_RULE }; @@ -526,7 +526,7 @@ int parseport(char *, struct range *r, int); %token DNPIPE DNQUEUE RIDENTIFIER %token LOAD RULESET_OPTIMIZATION PRIO %token STICKYADDRESS ENDPI MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE -%token MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY PFLOW +%token MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY PFLOW ALLOW_RELATED %token TAGGED TAG IFBOUND FLOATING STATEPOLICY STATEDEFAULTS ROUTE SETTOS %token DIVERTTO DIVERTREPLY BRIDGE_TO RECEIVEDON NE LE GE AFTO %token STRING @@ -2648,6 +2648,14 @@ pfrule : action dir logquick interface route af proto fromto } r.rule_flag |= PFRULE_PFLOW; break; + case PF_STATE_OPT_ALLOW_RELATED: + if (r.rule_flag & PFRULE_ALLOW_RELATED) { + yyerror("state allow-related option: " + "multiple definitions"); + YYERROR; + } + r.rule_flag |= PFRULE_ALLOW_RELATED; + break; case PF_STATE_OPT_TIMEOUT: if (o->data.timeout.number == PFTM_ADAPTIVE_START || @@ -4490,6 +4498,14 @@ state_opt_item : MAXIMUM NUMBER { $$->next = NULL; $$->tail = $$; } + | ALLOW_RELATED { + $$ = calloc(1, sizeof(struct node_state_opt)); + if ($$ == NULL) + err(1, "state_opt_item: calloc"); + $$->type = PF_STATE_OPT_ALLOW_RELATED; + $$->next = NULL; + $$->tail = $$; + } | STRING NUMBER { int i; @@ -6432,6 +6448,7 @@ lookup(char *s) { "af-to", AFTO}, { "all", ALL}, { "allow-opts", ALLOWOPTS}, + { "allow-related", ALLOW_RELATED}, { "altq", ALTQ}, { "anchor", ANCHOR}, { "antispoof", ANTISPOOF}, diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 7e2c96c07473..a517015b5ff8 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -27,7 +27,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 9, 2025 +.Dd January 10, 2025 .Dt PF.CONF 5 .Os .Sh NAME @@ -2513,6 +2513,10 @@ Cannot be used with modulate or synproxy state. States created by this rule are exported on the .Xr pflow 4 interface. +.It Ar allow-related +Automatically allow connections related to this one, regardless of rules that +might otherwise affect them. +This currently only applies to SCTP multihomed connection. .El .Pp Multiple options can be specified, separated by commas: diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 3f109d31ccde..6c9d75bb1365 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1660,6 +1660,7 @@ struct pf_pdesc { #define PFDESC_SCTP_ADD_IP 0x1000 u_int16_t sctp_flags; u_int32_t sctp_initiate_tag; + struct pf_krule *related_rule; struct pf_sctp_multihome_jobs sctp_multihome_jobs; }; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 7b0ee24965b9..07b7aa543dbd 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -464,6 +464,14 @@ BOUND_IFACE(struct pf_kstate *st, struct pf_pdesc *pd) if (st->rule->rt == PF_REPLYTO || (pd->af != pd->naf)) return (V_pfi_all); + /* + * If this state is created based on another state (e.g. SCTP + * multihome) always set it floating initially. We can't know for sure + * what interface the actual traffic for this state will come in on. + */ + if (pd->related_rule) + return (V_pfi_all); + /* Don't overrule the interface for states created on incoming packets. */ if (st->direction == PF_IN) return (k); @@ -5702,6 +5710,10 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, } while (r != NULL) { + if (pd->related_rule) { + *rm = pd->related_rule; + break; + } pf_counter_u64_add(&r->evaluations, 1); PF_TEST_ATTRIB(pfi_kkif_match(r->kif, pd->kif) == r->ifnot, r->skip[PF_SKIP_IFP]); @@ -7165,6 +7177,15 @@ pf_test_state_sctp(struct pf_kstate **state, struct pf_pdesc *pd, dst->scrub->pfss_v_tag = pd->sctp_initiate_tag; } + /* + * Bind to the correct interface if we're if-bound. For multihomed + * extra associations we don't know which interface that will be until + * here, so we've inserted the state on V_pf_all. Fix that now. + */ + if ((*state)->kif == V_pfi_all && + (*state)->rule->rule_flag & PFRULE_IFBOUND) + (*state)->kif = pd->kif; + if (pd->sctp_flags & (PFDESC_SCTP_COOKIE | PFDESC_SCTP_HEARTBEAT_ACK)) { if (src->state < SCTP_ESTABLISHED) { pf_set_protostate(*state, psrc, SCTP_ESTABLISHED); @@ -7378,6 +7399,9 @@ again: j->pd.sctp_flags |= PFDESC_SCTP_ADD_IP; PF_RULES_RLOCK(); sm = NULL; + if (s->rule->rule_flag & PFRULE_ALLOW_RELATED) { + j->pd.related_rule = s->rule; + } ret = pf_test_rule(&r, &sm, &j->pd, &ra, &rs, NULL); PF_RULES_RUNLOCK(); diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 10431d9b77d9..5de85c1fe7ef 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -617,6 +617,7 @@ struct pf_rule { #define PFRULE_IFBOUND 0x00010000 /* if-bound */ #define PFRULE_STATESLOPPY 0x00020000 /* sloppy state tracking */ #define PFRULE_PFLOW 0x00040000 +#define PFRULE_ALLOW_RELATED 0x00080000 #define PFRULE_AFTO 0x00200000 /* af-to rule */ #ifdef _KERNEL diff --git a/tests/sys/netpfil/pf/sctp.py b/tests/sys/netpfil/pf/sctp.py index 38bb9f2dff74..230dbae0d327 100644 --- a/tests/sys/netpfil/pf/sctp.py +++ b/tests/sys/netpfil/pf/sctp.py @@ -426,6 +426,82 @@ class TestSCTP(VnetTestTemplate): assert re.search(r"all sctp 192.0.2.4:.*192.0.2.3:1234", states) assert re.search(r"all sctp 192.0.2.4:.*192.0.2.2:1234", states) + @pytest.mark.require_user("root") + def test_disallow_related(self): + srv_vnet = self.vnet_map["vnet2"] + + ToolsHelper.print_output("/sbin/pfctl -e") + ToolsHelper.pf_rules([ + "block proto sctp", + "pass inet proto sctp to 192.0.2.3", + "pass on lo"]) + + # Sanity check, we can communicate with the primary address. + client = SCTPClient("192.0.2.3", 1234) + client.send(b"hello", 0) + rcvd = self.wait_object(srv_vnet.pipe) + print(rcvd) + assert rcvd['ppid'] == 0 + assert rcvd['data'] == "hello" + + # This shouldn't work + success=False + try: + client.newpeer("192.0.2.2") + client.send(b"world", 0) + rcvd = self.wait_object(srv_vnet.pipe) + print(rcvd) + assert rcvd['ppid'] == 0 + assert rcvd['data'] == "world" + success=True + except: + success=False + assert not success + + # Check that we have a state for 192.0.2.3, but not 192.0.2.2 to 192.0.2.1 + states = ToolsHelper.get_output("/sbin/pfctl -ss") + assert re.search(r"all sctp 192.0.2.1:.*192.0.2.3:1234", states) + assert not re.search(r"all sctp 192.0.2.1:.*192.0.2.2:1234", states) + + @pytest.mark.require_user("root") + def test_allow_related(self): + srv_vnet = self.vnet_map["vnet2"] + + ToolsHelper.print_output("/sbin/pfctl -e") + ToolsHelper.pf_rules([ + "set state-policy if-bound", + "block proto sctp", + "pass inet proto sctp to 192.0.2.3 keep state (allow-related)", + "pass on lo"]) + + # Sanity check, we can communicate with the primary address. + client = SCTPClient("192.0.2.3", 1234) + client.send(b"hello", 0) + rcvd = self.wait_object(srv_vnet.pipe) + print(rcvd) + assert rcvd['ppid'] == 0 + assert rcvd['data'] == "hello" + + success=False + try: + client.newpeer("192.0.2.2") + client.send(b"world", 0) + rcvd = self.wait_object(srv_vnet.pipe) + print(rcvd) + assert rcvd['ppid'] == 0 + assert rcvd['data'] == "world" + success=True + finally: + # Debug output + ToolsHelper.print_output("/sbin/pfctl -ss") + ToolsHelper.print_output("/sbin/pfctl -sr -vv") + assert success + + # Check that we have a state for 192.0.2.3 and 192.0.2.2 to 192.0.2.1 + states = ToolsHelper.get_output("/sbin/pfctl -ss") + assert re.search(r"epair.*sctp 192.0.2.1:.*192.0.2.3:1234", states) + assert re.search(r"epair.*sctp 192.0.2.1:.*192.0.2.2:1234", states) + class TestSCTPv6(VnetTestTemplate): REQUIRED_MODULES = ["sctp", "pf"] TOPOLOGY = { From nobody Fri Jan 17 15:18:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZNfs51dpz5l5w9; Fri, 17 Jan 2025 15:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZNfs45Wtz42d8; Fri, 17 Jan 2025 15:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737127125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NOdl09di78/g664CEYdu9Q6rhhxfWOSDTcrKw9gBYLU=; b=exJKeBENl9QfETCgY+ugcXi27bSeCAU5lqq6KVbiMw+G8hwXbbfHvUB4pkF5+p7fuk3Quz DGsCkRlwetVBsm1s/Y2KFVexY/8UGf9eezKw3ptAOan40374cpBgMpXa4PHLQz5I7wy6xU buBf6US4Q8kV/QViQkcP25Ke+s5uqyNRCt8SpUqefVggzSchs0HMZBHBFd1h2YM878XmU6 a4ISxp8xu9D7IoBRuvCc4PJpFJVsM2SbG9R8y+d6OWCeOaA+2Cc2P6BqGsBno0JLSBNRrQ 6ITmdI+qtDTO60MKwUZJS7phNixkUM6nczFbL11K3Lozdbf/OqOUDaZNBiPDDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737127125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NOdl09di78/g664CEYdu9Q6rhhxfWOSDTcrKw9gBYLU=; b=h2lzQ0xCzMrVidCEdcx53vUqjPuJNF4drb7eSKL+dM5oH7gTjtm36q9rAQrsw6xsF3C8ja t1JQpDmXoRFZuF7pnku9aX5dBQYWDivgZaHYwh9dTc9rFNiSZixtpmjPddkekk+JrQLjyO 4HjNRyDIBRjNfT+wZYsSekzakyMhgY7D19CmVyy/tUy50FZaZKlNZf6d5FiR/hCOeCo3yR cWk+NZ1q+7+Qhh/6VX5nv0/h+6paaJjICId6AKntih/QrZyyMyMBG9GvTcX2paWH9HR1b1 Ys1R/NLuvaYbmyYtyQWjAq5omuOOwFXmMlVpSty7dEEf10yDAwzpQGeNyaADeg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737127125; a=rsa-sha256; cv=none; b=P68JmkfabGraLp2MsUTOhKw/RdO5Tfj1MoFwBzuYRnMJX5oLUWZ674YOWjWRK+9tPIOWG2 mkiKEh43o674/fd8UiX9qge5K186o/ApuMIUot/3Ib1KYoeDPmGIylX+Kx8S0Qwcn5cFoD KxcZTQqa8yg8B2vbWC/xz99lpIp1w+08rFL49WiUTFGx8vmz1xKZCxNvPxPYG3GnDG/76W NibpyGyCEEeCp66LfewQo+KbL+TSSqpkKqqfxM8/eTn0xjC5YaXt/+ujQPG4PaqwQXvxd6 oJA4SS+bchQ1Ih8iCn6Z3Tqf4kaI8ob8NIGYN2n3Dd4o4LBLitLqbhyOTwhpzA== 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 4YZNfs3JMKz7pj; Fri, 17 Jan 2025 15:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50HFIjBg074744; Fri, 17 Jan 2025 15:18:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HFIjGl074741; Fri, 17 Jan 2025 15:18:45 GMT (envelope-from git) Date: Fri, 17 Jan 2025 15:18:45 GMT Message-Id: <202501171518.50HFIjGl074741@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: d355c28a0954 - main - depend-cleanup: bea89d038ac5 also moved memchr List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d355c28a0954de487e45c4349631c2b9449ba28d Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d355c28a0954de487e45c4349631c2b9449ba28d commit d355c28a0954de487e45c4349631c2b9449ba28d Author: Ed Maste AuthorDate: 2025-01-17 15:05:26 +0000 Commit: Ed Maste CommitDate: 2025-01-17 15:17:45 +0000 depend-cleanup: bea89d038ac5 also moved memchr Commit bea89d038ac5 added strlcat but also introduced a memchr wrapper in the source tree rather than using the autogenerated one used for AARCH64_STRING_FUNCS. Move memchr.S to MDSRS and add a cleanup rule for the old wrapper. Reviewed by: fuz Sponsored by: The FreeBSD Foundation Fixes: bea89d038ac5 ("lib/libc/aarch64/string: add strlcat SIMD implementation") Differential Revision: https://reviews.freebsd.org/D48502 --- lib/libc/aarch64/string/Makefile.inc | 2 +- tools/build/depend-cleanup.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc index 9574aad95933..f0f0f6495782 100644 --- a/lib/libc/aarch64/string/Makefile.inc +++ b/lib/libc/aarch64/string/Makefile.inc @@ -4,7 +4,6 @@ # AARCH64_STRING_FUNCS= \ - memchr \ memcmp \ memcpy \ memmove \ @@ -19,6 +18,7 @@ AARCH64_STRING_FUNCS= \ # SIMD-enhanced routines not derived from Arm's code MDSRCS+= \ + memchr.S \ strcmp.S \ strspn.S \ strcspn.S \ diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 30c303d4f90f..b7695370f1dd 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -270,8 +270,9 @@ if [ $MACHINE_ARCH = aarch64 ]; then # 20250110 3dc5429158cf add strncat SIMD implementation clean_dep lib/libc strncat c - # 20250110 bea89d038ac5 add strlcat SIMD implementation + # 20250110 bea89d038ac5 add strlcat SIMD implementation, and move memchr clean_dep lib/libc strlcat c + run rm -f "$OBJTOP"/lib/libc/memchr.S # 20250110 3863fec1ce2d add strlen SIMD implementation clean_dep lib/libc strlen S arm-optimized-routines From nobody Fri Jan 17 16:02:12 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZPd10GMhz5l8TQ; Fri, 17 Jan 2025 16:02: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZPd06mFHz46xD; Fri, 17 Jan 2025 16:02:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=q5O5BSI4Ff2R3FT5sLgjIqQSjUraGXa5K1PGBkziQTw=; b=GYSUtniQBshUoWqDA564Guo+tA4tCzoqv3bPj88CnUpuQWKQbCtC7KXsbEzbkA26UEo8to mzPObrxhLooHdc2/0HcE2aFhYQW9m17PFEbDQzU4tBilgZq1LjAXK9/Cz1+0yRsF7wpfOU 9Cz5ih4u4Edq1nKEC6fcZa0jc2WiSnKPXHfx35x3vOMKjkB72Uz/79jSP7r4xJbh3lHXzY wMM35cIOI/50OXWyEd75CmASru2+qt2tZbNuTa5sUvJWeHTcqZ+h+epQyLrZ6k9cfYaouq ZvEX2LYafd9E0J+T3Sec47U0v+x2HEalLGbC30dg9o7R204rcy1/KjNhtfmsNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=q5O5BSI4Ff2R3FT5sLgjIqQSjUraGXa5K1PGBkziQTw=; b=poUw+ko/GpdyCUwtVIFttQtCiSqUX0TN8M9tm8rFewuAKnlW61a2oC0VzndMONZ3cZhVdI SkfhIVbSdppk3XRyhoa1/EEVHBfwYlpsdbgEE18TLwwO1hhMZfLFtdUX8IGd6gKS622WpS m7yAFwUcBew8CQ+enjfA4sRtG7eSK4xCBaiR0iG8Wgs9WJfyqub9mJQpT5pEvRuXcuSLy3 q4ZGRtQcAhlwEy0XnrOh2cTAapuaFWGVXtcOARpDkc1GM6FzOyB4UurISOlzmb9JDal37T xj/JC0y+VYLE3WvlF60uM5qM1Oy/0kbLWKALBm56xz+r0N8AbKb+6fvT5BYFcg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737129733; a=rsa-sha256; cv=none; b=jR+/xcglr4aFopzzDiV8+25vYNEIFkd/TktV/dB8TIRe6YymxKIDdDd+gFuGnmvSHTh0LD AaVCQSVD0EcvGnFBeFgdzfhTXK1YVehNCvGu7UWmZdi7WgbDp+Pr849i20c5iMWEiw3S5T b4p/n/xFG1KWDvaTKNLRGUtjsk7L66EyRp68e/0n24Kipz2+5TMW8u0NXzVmsoEvk5lS9W uWbrCOaVQaYKwxz4yhJAVOg96U3+1YyqpF13evsLQqE8n2WUZaLrt+SkRicERdWNDKgo2m muCYpWQfifs7IlGnlKtLT93+Kr66kj+miyfcLhkpdpeyI1IsMRnjQKBRYMx15w== 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 4YZPd067tYz8Lb; Fri, 17 Jan 2025 16:02: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 50HG2CqC065698; Fri, 17 Jan 2025 16:02:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HG2CYU065695; Fri, 17 Jan 2025 16:02:12 GMT (envelope-from git) Date: Fri, 17 Jan 2025 16:02:12 GMT Message-Id: <202501171602.50HG2CYU065695@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5d28f4cab8d5 - main - pf: clean up mbuf passing for reassembly List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5d28f4cab8d5919aba1365e885a91a96c0655b59 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5d28f4cab8d5919aba1365e885a91a96c0655b59 commit 5d28f4cab8d5919aba1365e885a91a96c0655b59 Author: Kristof Provost AuthorDate: 2025-01-06 06:56:24 +0000 Commit: Kristof Provost CommitDate: 2025-01-17 16:00:08 +0000 pf: clean up mbuf passing for reassembly When we call pf_normalize_ip() or pf_normalize_ip6() we passed the mbuf twice. Once as m0, and once inside the struct pf_pdesc. Remove the former to avoid confusion when we free *m0, but don't update pd->m. This could lead to use-after-free errors e.g. if reassembly failed. PR: 283705 Reported by: Yichen Chai , Zhuo Ying Jiang Li MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 10 ++++++---- sys/netpfil/pf/pf_norm.c | 17 +++++------------ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 6c9d75bb1365..6e9418f59aef 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -2390,11 +2390,11 @@ int pf_test(sa_family_t, int, int, struct ifnet *, struct mbuf **, struct inpcb struct pf_rule_actions *); #endif #ifdef INET -int pf_normalize_ip(struct mbuf **, u_short *, struct pf_pdesc *); +int pf_normalize_ip(u_short *, struct pf_pdesc *); #endif /* INET */ #ifdef INET6 -int pf_normalize_ip6(struct mbuf **, int, u_short *, struct pf_pdesc *); +int pf_normalize_ip6(int, u_short *, struct pf_pdesc *); void pf_poolmask(struct pf_addr *, struct pf_addr*, struct pf_addr *, struct pf_addr *, sa_family_t); void pf_addr_inc(struct pf_addr *, sa_family_t); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 07b7aa543dbd..3b9c71296a2b 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -9918,12 +9918,13 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, return (-1); } - if (pf_normalize_ip(m0, reason, pd) != PF_PASS) { + if (pf_normalize_ip(reason, pd) != PF_PASS) { /* We do IP header normalization and packet reassembly here */ + *m0 = pd->m; *action = PF_DROP; return (-1); } - pd->m = *m0; + *m0 = pd->m; h = mtod(pd->m, struct ip *); pd->off = h->ip_hl << 2; @@ -9994,12 +9995,13 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, } /* We do IP header normalization and packet reassembly here */ - if (pf_normalize_ip6(m0, pd->fragoff, reason, pd) != + if (pf_normalize_ip6(pd->fragoff, reason, pd) != PF_PASS) { + *m0 = pd->m; *action = PF_DROP; return (-1); } - pd->m = *m0; + *m0 = pd->m; if (pd->m == NULL) { /* packet sits in reassembly queue, no error */ *action = PF_PASS; diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index c9a7f7d2df04..39afde04a6d1 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -1093,11 +1093,10 @@ pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag, #ifdef INET int -pf_normalize_ip(struct mbuf **m0, u_short *reason, - struct pf_pdesc *pd) +pf_normalize_ip(u_short *reason, struct pf_pdesc *pd) { struct pf_krule *r; - struct ip *h = mtod(*m0, struct ip *); + struct ip *h = mtod(pd->m, struct ip *); int mff = (ntohs(h->ip_off) & IP_MF); int hlen = h->ip_hl << 2; u_int16_t fragoff = (ntohs(h->ip_off) & IP_OFFMASK) << 3; @@ -1109,8 +1108,6 @@ pf_normalize_ip(struct mbuf **m0, u_short *reason, PF_RULES_RASSERT(); - MPASS(pd->m == *m0); - r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_SCRUB].active.ptr); /* * Check if there are any scrub rules, matching or not. @@ -1219,13 +1216,12 @@ pf_normalize_ip(struct mbuf **m0, u_short *reason, * Might return a completely reassembled mbuf, or NULL */ PF_FRAG_LOCK(); DPFPRINTF(("reass frag %d @ %d-%d\n", h->ip_id, fragoff, max)); - verdict = pf_reassemble(m0, pd->dir, reason); + verdict = pf_reassemble(&pd->m, pd->dir, reason); PF_FRAG_UNLOCK(); if (verdict != PF_PASS) return (PF_DROP); - pd->m = *m0; if (pd->m == NULL) return (PF_DROP); @@ -1257,7 +1253,7 @@ pf_normalize_ip(struct mbuf **m0, u_short *reason, #ifdef INET6 int -pf_normalize_ip6(struct mbuf **m0, int off, u_short *reason, +pf_normalize_ip6(int off, u_short *reason, struct pf_pdesc *pd) { struct pf_krule *r; @@ -1267,8 +1263,6 @@ pf_normalize_ip6(struct mbuf **m0, int off, u_short *reason, PF_RULES_RASSERT(); - pd->m = *m0; - r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_SCRUB].active.ptr); /* * Check if there are any scrub rules, matching or not. @@ -1323,9 +1317,8 @@ pf_normalize_ip6(struct mbuf **m0, int off, u_short *reason, if (pd->virtual_proto == PF_VPROTO_FRAGMENT) { /* Returns PF_DROP or *m0 is NULL or completely reassembled * mbuf. */ - if (pf_reassemble6(m0, &frag, off, pd->extoff, reason) != PF_PASS) + if (pf_reassemble6(&pd->m, &frag, off, pd->extoff, reason) != PF_PASS) return (PF_DROP); - pd->m = *m0; if (pd->m == NULL) return (PF_DROP); h = mtod(pd->m, struct ip6_hdr *); From nobody Fri Jan 17 16:02:13 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZPd229vRz5l8H4; Fri, 17 Jan 2025 16:02: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZPd20bsjz4731; Fri, 17 Jan 2025 16:02:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F1gU1585Y22fv9Y9BS7Ma/jrappjAKunLRJSYJ1mzZA=; b=D0z21TvnJXFkpDwbcd9bVWdojeUZe4nYmAdwbfmMp0OI0CpMT21HTxNjZuQJO3yAilnzyT pclEqIoyVuvbW8ymT+Z0Pgg2gXykw/nK4NCnH3HBUZiHoCH8b+A8kiSk77TzQXe87/pEeV C74i/YKY371LFKP2V6WcG9m+cvjUo8TkjTBNAUnsAY/gOMkcc6gnhyhWMGFlqNVHFNoLHX tjnQRCNAxbWRLs3PLpy0chm+xHyEBGgSn17U665BSBFuNxnet3Es0ra1y6+vPKDJSQveX7 YPqW734RbWqZB1+Ixwiir5jDiNcf5QMzlz9JHysdFSJoNTUb67vMWIc5CILNtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F1gU1585Y22fv9Y9BS7Ma/jrappjAKunLRJSYJ1mzZA=; b=qR0tj1Du2MEjrfMZbRHDGspnI7xCeVQPKIoaR/sZUSC40sXoNiyaXv9n4NMr/x/Uk7OA0L 23BdRjNoosnNomfbMxaMv4JbApiIRh0Q6fxZqLblpiLp4vDrok81X12zwwJ49UMiJGPGQQ 73Y3vGQR7/AetOXv7JC/GEepfG1AMULZMo3YvftmPK3OiP6u5ftyRl5hw8g+KvJD9LcX83 y5CPaHWXOlWMrmKdYcLTXmzPIQYwZGLP7l3WMb/nfPGAlx5mna4yotc4WrFU/YCnLXQD1b uVdUfDSWwPQOsvJrQC0ZBo+XMzhNb5pagEkAp8mN2uiQ2RDn109EI0dCxOZxyA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737129734; a=rsa-sha256; cv=none; b=ByzgcgPbzSKkWQjgMCRDGT3IrygXOr7g7xF9QN2ekz3jMmNY063cvA2Z3NdD8fh0LFRuaE V8scY+vJgIpGxWTr7c97I5Oyk1GWiiAexkVmf5OX+dZdvcobsZikstFUel+4x4PG7RLfg9 aWRhaYzoCCfVpbBuP4p0z7MhWaGJiOm1ZshLny8xHvHsiHCmD3gnzZ+jBN1EYLWsWzM0b4 lFkEhfinGHFu7XKouTmAxcwwtsKgP615KhcmG/cDOW+53rN9HT3O0RKwlln/VzoU4Tcxni 1LSdiwZJC46UbcVC8d9Mx7NeUctMPXfTctC3sKlpkzClrz4EgvHkbA3aBiWWPA== 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 4YZPd203Ljz8v1; Fri, 17 Jan 2025 16:02: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 50HG2DBB065736; Fri, 17 Jan 2025 16:02:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HG2DmR065733; Fri, 17 Jan 2025 16:02:13 GMT (envelope-from git) Date: Fri, 17 Jan 2025 16:02:13 GMT Message-Id: <202501171602.50HG2DmR065733@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 76e00c722bee - main - dummymbuf: add 'enlarge' List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76e00c722bee123f902febce7b637ea7afa5e364 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=76e00c722bee123f902febce7b637ea7afa5e364 commit 76e00c722bee123f902febce7b637ea7afa5e364 Author: Kristof Provost AuthorDate: 2025-01-06 10:39:32 +0000 Commit: Kristof Provost CommitDate: 2025-01-17 16:00:08 +0000 dummymbuf: add 'enlarge' Teach dummymbuf to replace mbufs with larger ones. This can be useful for testing for bugs that depend on mbuf layout. Sponsored by: Rubicon Communications, LLC ("Netgate") --- share/man/man4/dummymbuf.4 | 4 +++- sys/net/dummymbuf.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/share/man/man4/dummymbuf.4 b/share/man/man4/dummymbuf.4 index 844a7c0565bd..08926d2824c6 100644 --- a/share/man/man4/dummymbuf.4 +++ b/share/man/man4/dummymbuf.4 @@ -26,7 +26,7 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd August 2, 2024 +.Dd January 6, 2025 .Dt DUMMYMBUF 4 .Os .Sh NAME @@ -121,6 +121,8 @@ tail mbuf(s) left empty. .Pp As a result, only the layout of a mbuf chain is altered, its content logically is left intact. +.It enlarge +Unconditionally replace the mbuf with an mbuf of the specified size. .El .Sh SYSCTL VARIABLES The following variables are available: diff --git a/sys/net/dummymbuf.c b/sys/net/dummymbuf.c index ff566cfb87c3..e88087e1572f 100644 --- a/sys/net/dummymbuf.c +++ b/sys/net/dummymbuf.c @@ -209,6 +209,37 @@ bad: return (NULL); } +static struct mbuf * +dmb_m_enlarge(struct mbuf *m, struct rule *rule) +{ + struct mbuf *n; + int size; + + size = (int)strtol(rule->opargs, NULL, 10); + if (size < 0 || size > MJUM16BYTES) + goto bad; + + if (!(m->m_flags & M_PKTHDR)) + goto bad; + if (m->m_pkthdr.len <= 0) + return (m); + + if ((n = m_get3(size, M_NOWAIT, MT_DATA, M_PKTHDR)) == NULL) + goto bad; + + m_move_pkthdr(n, m); + m_copydata(m, 0, m->m_pkthdr.len, n->m_ext.ext_buf); + n->m_len = m->m_pkthdr.len; + + n->m_next = m; + + return (n); + +bad: + m_freem(m); + return (NULL); +} + static bool read_rule(const char **cur, struct rule *rule, bool *eof) { @@ -278,6 +309,9 @@ read_rule(const char **cur, struct rule *rule, bool *eof) if (strstr(*cur, "pull-head") == *cur) { rule->op = dmb_m_pull_head; *cur += strlen("pull-head"); + } else if (strstr(*cur, "enlarge") == *cur) { + rule->op = dmb_m_enlarge; + *cur += strlen("enlarge"); } else { return (false); } From nobody Fri Jan 17 16:02:15 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZPd34mqKz5l7xH; Fri, 17 Jan 2025 16:02: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZPd31T24z47GR; Fri, 17 Jan 2025 16:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l4PgFEaSb4y1oYwc/YjAlYUTihe9PQ9kX9S0skApkXQ=; b=c7begsevFqh4R2xtU9VgK7BehBAAXpmDkN2QHUI/vbHn3uhf6+u4YgFiAirYTT3pLYBnw1 xc+9+hJ706yZxai0C9FumBkshNCdkP5gCQkuAtPAH4/axFS6YD38GLsY1uzE9vxrM2Dmwn YUsi+BSSu1V+q2AZnNp1mLa5hRPE3Jo3DOGskRq9F1nawuwYig1yyJpDsXkIUWjlolPsTA 1hZ9l0XC2+Wt5UGnUlKd0CumscnFQAfmdXA2yOtpJwif2y3Tkd5qjVYZj5mv5g7P1b0D0r tGMcJuD5c8idrECLI7duAmqQIMbVGhenfRhWH4eCfXmNsQIzGBH+ZBTmHy8uqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l4PgFEaSb4y1oYwc/YjAlYUTihe9PQ9kX9S0skApkXQ=; b=eBnnwBin7UIVcQzfPh0Ay/qpuA20ZFhXQr+0jxLI3f92YTUVeXXqDvgXQj9GcOOFxXvzfc IXt/QMwWotxxNdHhCvxzwGgDXsDbwAZ4d7H2nk+EwqCFsViUeeUray63xIf9EqwqPU/vuZ PIotMlywlgKDzq+rqK3U9varbBAJYY7eRQplAT+ArYLMrz03VscDTptbKlXhFGNeSYJbnl nCEtSiE4YdlC0b6sBARHEBOT5mt0CIn0ZnS1sticT21p3eDko74bvprJ67VsXN/I9unWGd it7hit0HArUdcjhjf1YZPstSl8G7YsgDgiM/0sPGV6xvA2fnxdRsj93kADpp1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737129735; a=rsa-sha256; cv=none; b=AYp8buWKj306t5btmm/RMbbQRA/Vh5n1aGcSCywpK5JJE4nMvE46s2q2PQ49Apsmy6J3bC Bpr0kvd3gmMzMiBIS8LW1j+3s5+zfprBL8qfS+iGKKecASHWrfrgUnVHsUs0pe8EBYw/rS ZUuLtzg4nCClvVlZU2v47bp50Up4DmSkYHsduwBg+OS8tzGneO8mglPCet/ccvonth3WxU 5hW16z//TeC6lLUHT3E1V780VloxmWLcligFCkkMMPuhRP/VlnohLFI/YcNm0eO2W4i2/s nfIHGSwncu7UgyU3kpqCQe53FsJoahm1BuxBs/+Z+26jxxfMGN5tNi7HaOTP0Q== 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 4YZPd310qzz95h; Fri, 17 Jan 2025 16:02: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 50HG2F7s065794; Fri, 17 Jan 2025 16:02:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HG2FlB065791; Fri, 17 Jan 2025 16:02:15 GMT (envelope-from git) Date: Fri, 17 Jan 2025 16:02:15 GMT Message-Id: <202501171602.50HG2FlB065791@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7f846fc0e7ce - main - pf tests: reproduce use-after-free in fragment reassembly List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f846fc0e7ce30c80e3265c957a138d7192af397 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7f846fc0e7ce30c80e3265c957a138d7192af397 commit 7f846fc0e7ce30c80e3265c957a138d7192af397 Author: Kristof Provost AuthorDate: 2025-01-06 10:48:40 +0000 Commit: Kristof Provost CommitDate: 2025-01-17 16:00:41 +0000 pf tests: reproduce use-after-free in fragment reassembly Produce an IPv6 packet that's longer than 65535 bytes so it'll get dropped in pf_reassemble6(). This can then causes pf_normalize_ip6() to return an error, which led pf_setup_pdesc() to fail to update *m0, eventually ending up with pf_scrub() attempting to modify *m0 (now different from pd->m), a freed mbuf. This does depend on pf_join_fragment()'s call to m_cat() freeing the relevant mbuf rather than adding it to the chain. Accomplish this by ensuring there's sufficient free space, by having dummymbuf re-allocate larger mbufs for our fragments. PR: 283705 Reported by: Yichen Chai , Zhuo Ying Jiang Li Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/frag6.py | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/tests/sys/netpfil/pf/frag6.py b/tests/sys/netpfil/pf/frag6.py index f54381fba8cb..f274fc28a3bf 100644 --- a/tests/sys/netpfil/pf/frag6.py +++ b/tests/sys/netpfil/pf/frag6.py @@ -2,6 +2,7 @@ import pytest import logging import threading import time +import random logging.getLogger("scapy").setLevel(logging.CRITICAL) from atf_python.sys.net.tools import ToolsHelper from atf_python.sys.net.vnet import VnetTestTemplate @@ -19,7 +20,7 @@ class DelayedSend(threading.Thread): sp.send(self._packet) class TestFrag6(VnetTestTemplate): - REQUIRED_MODULES = ["pf"] + REQUIRED_MODULES = ["pf", "dummymbuf"] TOPOLOGY = { "vnet1": {"ifaces": ["if1"]}, "vnet2": {"ifaces": ["if1"]}, @@ -27,12 +28,15 @@ class TestFrag6(VnetTestTemplate): } def vnet2_handler(self, vnet): + ifname = vnet.iface_alias_map["if1"].name ToolsHelper.print_output("/sbin/pfctl -e") ToolsHelper.pf_rules([ - "scrub fragment reassemble", + "scrub fragment reassemble min-ttl 10", "pass", "block in inet6 proto icmp6 icmp6-type echoreq", ]) + ToolsHelper.print_output("/sbin/pfilctl link -i dummymbuf:inet6 inet6") + ToolsHelper.print_output("/sbin/sysctl net.dummymbuf.rules=\"inet6 in %s enlarge 3000;\"" % ifname) def check_ping_reply(self, packet): print(packet) @@ -59,6 +63,38 @@ class TestFrag6(VnetTestTemplate): for p in packets: assert not p.getlayer(sp.ICMPv6EchoReply) + @pytest.mark.require_user("root") + def test_overlong(self): + "Test overly long fragmented packet" + + # Import in the correct vnet, so at to not confuse Scapy + import scapy.all as sp + + curr = 0 + pkts = [] + + frag_id = random.randint(0,0xffffffff) + gran = 1200 + + i = 0 + while curr <= 65535: + ipv61 = sp.IPv6(src="2001:db8::1", dst="2001:db8::2") + more = True + g = gran + if curr + gran > 65535: + more = False + g = 65530 - curr + if i == 0: + pkt = ipv61 / sp.IPv6ExtHdrHopByHop(options=[sp.PadN(optlen=2), sp.Pad1()]) / \ + sp.IPv6ExtHdrFragment(id = frag_id, offset = curr // 8, m = more) / bytes([i] * g) + else: + pkt = ipv61 / sp.IPv6ExtHdrFragment(id = frag_id, offset = curr // 8, m = more) / bytes([i] * g) + pkts.append(pkt) + curr += gran + i += 1 + + sp.send(pkts, inter = 0.1) + class TestFrag6_Overlap(VnetTestTemplate): REQUIRED_MODULES = ["pf"] TOPOLOGY = { From nobody Fri Jan 17 16:05:29 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZPhn35SDz5l842; Fri, 17 Jan 2025 16:05:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZPhn2XLhz48tp; Fri, 17 Jan 2025 16:05:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NBEH58XEo/p9I/XbjkfzWPLkPzPQr2RFI6ZnH8ogqAw=; b=sv3uGmCO/LL0bDM6NakwJjJkV2flM6nAoskrMQU5VNxaRa0GnbhCuCenQtx7UjN7NbsxeE WK2aMFR8xZJNKFx4ziGgo9Ivjw2N7kL4i2M4EaPvx0Ad3sWtD0fTYchoTQ1ujhC75qp3NW kM9RKIrfqgTcXb0cnYudyr19aS0pH0ZsJnT/EGsWl1OyjuH1eOfVNtbi6K+poJc8ppaG6x n6gzmNXawhEZutLic/flXaxMfLgpJzQzdt+lnJbKmXbw9WgFEKaaC5zRG8mCDyvW0wBkGW k1Bc+81/rjJeGv6UhuVXkalowFfHs8spk+BsF6/pt298KNBS6UTcOUTCLIF6nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NBEH58XEo/p9I/XbjkfzWPLkPzPQr2RFI6ZnH8ogqAw=; b=YNx8X3IN/MhSSao9zuqRNCTtO1li4wUX4JUoh/7NwZVOZ8npjHcNAdlqvZ293Yr6rXrRqD AVgNGXGNSMgSB6GCoyukWjHdsd2ZVrvXxL7Gcz4pdwa4b00GxACLeeKITHmWlWOoot/A4W 0PyviAYMmUxLXT+VESG1sK7sW0pueBh3Qsd7ZdYnq7315MZKKc/4k7DhgtgXhkNgvj+evQ cTYx2xO4MOWfCCdj9X8f/QyF5uKA1LnM1Rp4pq+RANa4pUbO3blgLZkSgS+QycQVOBP2Vg uCOqGy7gFkBX70/IheF7wMbyTvtcBD9DVEZrdB5xGaHwbLs4hpqazT2IGA3zmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737129929; a=rsa-sha256; cv=none; b=lCGCsnjMtyDkk0wDF/JzkuFE2CzN04qaxSaAUFu4yrf/59kC8lgGV/J8nNPVXYxDuvcnvv Vl7JIwbPLOP0pI9dJt3FEOSjShi/AVWmxHaTA1mdKP9bxq1+jliue5YmijhkW7Xdgsrprn jR3rnHEfidXKFAulIrpsL9yKv9lSyiUb+4RN98WjcZPJti9ll3oDLpWLXYdsS1swPxHSny XyVLBC+5M8Sfm0bAtUQwIzIbt5ECRdc2flSfbfIgN5JYdb2ZOL43ryePrenc57UFmU/UfP kUd68YxViXs5fi8uZ+ctTATsRrE8cXZ4NwUVzBeAFUkVabOXGpWgmWxF6Fycww== 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 4YZPhn279jz95n; Fri, 17 Jan 2025 16:05: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 50HG5Txc066995; Fri, 17 Jan 2025 16:05:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HG5T8a066992; Fri, 17 Jan 2025 16:05:29 GMT (envelope-from git) Date: Fri, 17 Jan 2025 16:05:29 GMT Message-Id: <202501171605.50HG5T8a066992@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 31a8b9782dc3 - main - iwm: update rate tables from OpenBSD List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31a8b9782dc354ebd735db7036d7945f160b2527 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=31a8b9782dc354ebd735db7036d7945f160b2527 commit 31a8b9782dc354ebd735db7036d7945f160b2527 Author: Adrian Chadd AuthorDate: 2024-12-27 03:30:22 +0000 Commit: Adrian Chadd CommitDate: 2025-01-17 16:04:58 +0000 iwm: update rate tables from OpenBSD These are from an earlier version of the driver (22-Oct-2021) which I started to sync against back in 2021. These pull in the rest of the VHT and HT rates. Since that driver has functioning 802.11n support, it makes a good intermediary checkpoint. Locally tested: * 7260, STA mode, 11g and 11a modes Differential Revision: https://reviews.freebsd.org/D48209 Obtained from: OpenBSD (at a6e25c727a2214219715b51ba6af2221d7e0d674, 22-Oct-2021) --- sys/dev/iwm/if_iwm.c | 62 +++++++++++++++++++++++++++++++++++-------------- sys/dev/iwm/if_iwmreg.h | 24 +++++++++++-------- 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index c8eb46ed9795..15ef139fd5a5 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -197,32 +197,60 @@ _Static_assert(nitems(iwm_nvm_channels_8000) <= IWM_NUM_CHANNELS_8000, #define IWM_NUM_2GHZ_CHANNELS 14 #define IWM_N_HW_ADDR_MASK 0xF -/* - * XXX For now, there's simply a fixed set of rate table entries - * that are populated. - */ const struct iwm_rate { - uint8_t rate; + uint16_t rate; uint8_t plcp; + uint8_t ht_plcp; } iwm_rates[] = { - { 2, IWM_RATE_1M_PLCP }, - { 4, IWM_RATE_2M_PLCP }, - { 11, IWM_RATE_5M_PLCP }, - { 22, IWM_RATE_11M_PLCP }, - { 12, IWM_RATE_6M_PLCP }, - { 18, IWM_RATE_9M_PLCP }, - { 24, IWM_RATE_12M_PLCP }, - { 36, IWM_RATE_18M_PLCP }, - { 48, IWM_RATE_24M_PLCP }, - { 72, IWM_RATE_36M_PLCP }, - { 96, IWM_RATE_48M_PLCP }, - { 108, IWM_RATE_54M_PLCP }, + /* Legacy */ /* HT */ + { 2, IWM_RATE_1M_PLCP, IWM_RATE_HT_SISO_MCS_INV_PLCP }, + { 4, IWM_RATE_2M_PLCP, IWM_RATE_HT_SISO_MCS_INV_PLCP }, + { 11, IWM_RATE_5M_PLCP, IWM_RATE_HT_SISO_MCS_INV_PLCP }, + { 22, IWM_RATE_11M_PLCP, IWM_RATE_HT_SISO_MCS_INV_PLCP }, + { 12, IWM_RATE_6M_PLCP, IWM_RATE_HT_SISO_MCS_0_PLCP }, + { 18, IWM_RATE_9M_PLCP, IWM_RATE_HT_SISO_MCS_INV_PLCP }, + { 24, IWM_RATE_12M_PLCP, IWM_RATE_HT_SISO_MCS_1_PLCP }, + { 26, IWM_RATE_INVM_PLCP, IWM_RATE_HT_MIMO2_MCS_8_PLCP }, + { 36, IWM_RATE_18M_PLCP, IWM_RATE_HT_SISO_MCS_2_PLCP }, + { 48, IWM_RATE_24M_PLCP, IWM_RATE_HT_SISO_MCS_3_PLCP }, + { 52, IWM_RATE_INVM_PLCP, IWM_RATE_HT_MIMO2_MCS_9_PLCP }, + { 72, IWM_RATE_36M_PLCP, IWM_RATE_HT_SISO_MCS_4_PLCP }, + { 78, IWM_RATE_INVM_PLCP, IWM_RATE_HT_MIMO2_MCS_10_PLCP }, + { 96, IWM_RATE_48M_PLCP, IWM_RATE_HT_SISO_MCS_5_PLCP }, + { 104, IWM_RATE_INVM_PLCP, IWM_RATE_HT_MIMO2_MCS_11_PLCP }, + { 108, IWM_RATE_54M_PLCP, IWM_RATE_HT_SISO_MCS_6_PLCP }, + { 128, IWM_RATE_INVM_PLCP, IWM_RATE_HT_SISO_MCS_7_PLCP }, + { 156, IWM_RATE_INVM_PLCP, IWM_RATE_HT_MIMO2_MCS_12_PLCP }, + { 208, IWM_RATE_INVM_PLCP, IWM_RATE_HT_MIMO2_MCS_13_PLCP }, + { 234, IWM_RATE_INVM_PLCP, IWM_RATE_HT_MIMO2_MCS_14_PLCP }, + { 260, IWM_RATE_INVM_PLCP, IWM_RATE_HT_MIMO2_MCS_15_PLCP }, }; #define IWM_RIDX_CCK 0 #define IWM_RIDX_OFDM 4 #define IWM_RIDX_MAX (nitems(iwm_rates)-1) #define IWM_RIDX_IS_CCK(_i_) ((_i_) < IWM_RIDX_OFDM) #define IWM_RIDX_IS_OFDM(_i_) ((_i_) >= IWM_RIDX_OFDM) +#define IWM_RVAL_IS_OFDM(_i_) ((_i_) >= 12 && (_i_) != 22) + +/* Convert an MCS index into an iwm_rates[] index. */ +const int iwm_mcs2ridx[] = { + IWM_RATE_MCS_0_INDEX, + IWM_RATE_MCS_1_INDEX, + IWM_RATE_MCS_2_INDEX, + IWM_RATE_MCS_3_INDEX, + IWM_RATE_MCS_4_INDEX, + IWM_RATE_MCS_5_INDEX, + IWM_RATE_MCS_6_INDEX, + IWM_RATE_MCS_7_INDEX, + IWM_RATE_MCS_8_INDEX, + IWM_RATE_MCS_9_INDEX, + IWM_RATE_MCS_10_INDEX, + IWM_RATE_MCS_11_INDEX, + IWM_RATE_MCS_12_INDEX, + IWM_RATE_MCS_13_INDEX, + IWM_RATE_MCS_14_INDEX, + IWM_RATE_MCS_15_INDEX, +}; struct iwm_nvm_section { uint16_t length; diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h index d9c7bb7a89f9..296d07bc4b31 100644 --- a/sys/dev/iwm/if_iwmreg.h +++ b/sys/dev/iwm/if_iwmreg.h @@ -4481,9 +4481,7 @@ struct iwm_beacon_filter_cmd { #define IWM_RATE_HT_SISO_MCS_9_PLCP IWM_RATE_HT_SISO_MCS_INV_PLCP /* - * These serve as indexes into - * struct iwm_rate_info fw_rate_idx_to_plcp[IWM_RATE_COUNT]; - * TODO: avoid overlap between legacy and HT rates + * These serve as indexes into struct iwm_rate iwm_rates[IWM_RIDX_MAX]. */ enum { IWM_RATE_1M_INDEX = 0, @@ -4500,28 +4498,34 @@ enum { IWM_RATE_9M_INDEX, IWM_RATE_12M_INDEX, IWM_RATE_MCS_1_INDEX = IWM_RATE_12M_INDEX, + IWM_RATE_MCS_8_INDEX, + IWM_FIRST_HT_MIMO2_RATE = IWM_RATE_MCS_8_INDEX, IWM_RATE_18M_INDEX, IWM_RATE_MCS_2_INDEX = IWM_RATE_18M_INDEX, IWM_RATE_24M_INDEX, IWM_RATE_MCS_3_INDEX = IWM_RATE_24M_INDEX, + IWM_RATE_MCS_9_INDEX, IWM_RATE_36M_INDEX, IWM_RATE_MCS_4_INDEX = IWM_RATE_36M_INDEX, + IWM_RATE_MCS_10_INDEX, IWM_RATE_48M_INDEX, IWM_RATE_MCS_5_INDEX = IWM_RATE_48M_INDEX, + IWM_RATE_MCS_11_INDEX, IWM_RATE_54M_INDEX, IWM_RATE_MCS_6_INDEX = IWM_RATE_54M_INDEX, IWM_LAST_NON_HT_RATE = IWM_RATE_54M_INDEX, - IWM_RATE_60M_INDEX, - IWM_RATE_MCS_7_INDEX = IWM_RATE_60M_INDEX, - IWM_LAST_HT_RATE = IWM_RATE_MCS_7_INDEX, - IWM_RATE_MCS_8_INDEX, - IWM_RATE_MCS_9_INDEX, + IWM_RATE_MCS_7_INDEX, + IWM_LAST_HT_SISO_RATE = IWM_RATE_MCS_7_INDEX, + IWM_RATE_MCS_12_INDEX, + IWM_RATE_MCS_13_INDEX, + IWM_RATE_MCS_14_INDEX, + IWM_RATE_MCS_15_INDEX, + IWM_LAST_HT_RATE = IWM_RATE_MCS_15_INDEX, IWM_LAST_VHT_RATE = IWM_RATE_MCS_9_INDEX, IWM_RATE_COUNT_LEGACY = IWM_LAST_NON_HT_RATE + 1, - IWM_RATE_COUNT = IWM_LAST_VHT_RATE + 1, + IWM_RATE_COUNT = IWM_LAST_HT_RATE + 1, }; - #define IWM_RATE_BIT_MSK(r) (1 << (IWM_RATE_##r##M_INDEX)) /* fw API values for legacy bit rates, both OFDM and CCK */ From nobody Fri Jan 17 16:05:30 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZPhp5dVsz5l88m; Fri, 17 Jan 2025 16:05: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZPhp4M8nz4949; Fri, 17 Jan 2025 16:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w5zXWvcdcM20hTI6MV/tt4xzldwcdQHSMt2laJiPbuA=; b=CSZwkIDGHpcAIpTYeaYeVXJO5eQ0EPTZtd2C701iOnZoEYRvFym6Wh8C6wvURqtB7tJNJM sdQR8Cd91iLVXeabtzC158VlvQ8WiLQW35ADXpc9f0qByDjezPX4AirDjW2Yn572tC6oc7 uok5HfDIc4ndLNQXohVna/K7ZkRyTM757fW6nQ+HZMwLDZPFt+JqeB5bQmQK4S3TDs67NS tQ46oC3oK4xHOKCXt073wg75jSPeYGQpFm5aGcSYAaMdBdk0vqnWRiamRZeDN3QYLIB0Ng /ALQH6RuF+EXfsSBx0AjHCuI6vWPQtxLWMUQ4P0RHvLL/Se+LaX0juf+/rIXiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737129930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w5zXWvcdcM20hTI6MV/tt4xzldwcdQHSMt2laJiPbuA=; b=j1I7PVET5Q+nCLeeR3gL/tvFFGHM4h3Yw0LuzrR8VLQ8niop/hHIabqQNG4mdhk7YF5139 gaGkAoMbWRBk0by4R5qzZ5BEaKchZjhK2hS8EM4NLeA8X2LCxjjUVXrakUR1KOipPg/7qI ZdJ4feksB6tCibBsw8EOHjsRtLdH1cT0S7NuGFAgsZJkplJ6/pGUdMP2VwLcNfIiak6a0u 6j/w9ojg/LphOCKLrTwuFWg4ZuKzKfYaDHiAcQB9Aucy5W2VdLO/YJhFyjrKOL37XJKihe vYhFLKns17cDQh9eV1fq+qHe6MvKaeKEYs4g1OOUdA9ptat9pMWxosBJ7YF/XQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737129930; a=rsa-sha256; cv=none; b=mEYoaDWpm0NtT/r+PGQscrCzBAJjV6DUKvjbEjMeoa+TcHsIgZc0drAQiuz5MTDhEH/GHp CKI2L/Jjd1ff63KPZW7fcMxM7gQ0stJfM0/VnsQqe1VorU7W+jHdk52u7KY/MJhFoVOjXn Xe/niZZzbq424Fe24ysxqfeurDXNP4frCxq97PZvTjLM7jgxQUBg2RqwG+PjZzCSUxKkdH e5vInbCkDHSeRjMWp9p8h7izN5Xi7XTyG2hvH1wwi8SlIJO4bD10VZz7weRzxfwK5fLvhv 591i+Lf9WKmeqMvvGsj+ZAUwJRHTqKq1IlklXNKuLjAlHSFdjnDZdlBclUu/Tg== 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 4YZPhp3jqNz981; Fri, 17 Jan 2025 16:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50HG5UWk067037; Fri, 17 Jan 2025 16:05:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HG5U1j067034; Fri, 17 Jan 2025 16:05:30 GMT (envelope-from git) Date: Fri, 17 Jan 2025 16:05:30 GMT Message-Id: <202501171605.50HG5U1j067034@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: d7df65349960 - main - iwm: add sku_cap_mimo_disable; populate sku_cap_11n_enable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7df65349960c96f3982c21ee1d4eaaab2a4ca74 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=d7df65349960c96f3982c21ee1d4eaaab2a4ca74 commit d7df65349960c96f3982c21ee1d4eaaab2a4ca74 Author: Adrian Chadd AuthorDate: 2024-12-27 03:48:55 +0000 Commit: Adrian Chadd CommitDate: 2025-01-17 16:05:13 +0000 iwm: add sku_cap_mimo_disable; populate sku_cap_11n_enable This is a flag to be used to disable >1 antenna support, even if the radio supports it. Also populate sku_cap_11n_enable, which indicates HT is available. It's a no-op right now; it's one of the requirements for properly configuring HT support and transmit/receive antenna configurations. Obtained from: OpenBSD (at a6e25c727a2214219715b51ba6af2221d7e0d674, 22-Oct-2021) Differential Revision: https://reviews.freebsd.org/D48210 Reviewed by: bz --- sys/dev/iwm/if_iwm.c | 3 ++- sys/dev/iwm/if_iwmvar.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 15ef139fd5a5..248bfd056580 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -2220,7 +2220,8 @@ iwm_parse_nvm_data(struct iwm_softc *sc, sku = iwm_get_sku(sc, nvm_sw, phy_sku); data->sku_cap_band_24GHz_enable = sku & IWM_NVM_SKU_CAP_BAND_24GHZ; data->sku_cap_band_52GHz_enable = sku & IWM_NVM_SKU_CAP_BAND_52GHZ; - data->sku_cap_11n_enable = 0; + data->sku_cap_11n_enable = sku & IWM_NVM_SKU_CAP_11N_ENABLE; + data->sku_cap_mimo_disable = sku & IWM_NVM_SKU_CAP_MIMO_DISABLE; data->n_hw_addrs = iwm_get_n_hw_addrs(sc, nvm_sw); diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index 63201e5b3120..f31057c07b9b 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -200,6 +200,7 @@ struct iwm_nvm_data { int sku_cap_11n_enable; int sku_cap_amt_enable; int sku_cap_ipan_enable; + int sku_cap_mimo_disable; uint8_t radio_cfg_type; uint8_t radio_cfg_step; From nobody Fri Jan 17 16:13:24 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZPsx0X8Jz5l91w; Fri, 17 Jan 2025 16:13:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZPsw6vTMz3Bwq; Fri, 17 Jan 2025 16:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737130405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KNyX8D/3OjG4WlPiIhDKm9WK18bfTGs8NbNpinDQ858=; b=w3ktP0qb95ZfKeZniPMDc9xSCSWpF3tW24U4S1DtmaOWzBn2faDNaIz2Et3OYmdCVpVcLS bJgqUPoEfcNObOK/hmWJG7YxCO7fv7RHzQJbxK3cJWltl+Lt0Cx+58mUT+710qEHCFphTe bCtaYwIBYjboUmUqqxekhOEILZPvy5lyHmE16TNpLhKGqkXgFs3y2kgHeG72KdZfsRYh7T uwoxFVmY/A2i/PUPng7blPT3JD58dzclWj5uO/6bQ9ciHL6wJxV0bLRaSY0ziILz+L+Epg 4ugvriQ6Ko3zQoncCHLfgFJBN+7HWQadlPyYFT2cs8CT2lasRsaG9qbknHgF5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737130405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KNyX8D/3OjG4WlPiIhDKm9WK18bfTGs8NbNpinDQ858=; b=ZGVexUFoPQ8dml5HBUkHJYoUyKZNuVdPwqxniXutfzEoWK9GN4Y0J926kdlKjmoXgd7Ebx pZsBGyWWoFom/DANzyCn5o4H0qbOO0A8ue0utAwdJ329iywNuuFObt8VlTXytMUuiQseWW 8caLE1Vncc1mFcX4+rE5PP85vSV6VNzToIvCVM74ak4ikZGHBvMfCUomiOjhOk6Y4EM5h8 2Ht2gU0Q+tLxuYXwLo4u5DhiUihOW1yorgE951z462QY91SeJi/+u1akFE6MhPAUqmiIvK duuVYjS4jUiCCUYrcYDMcpXaO1Y1dGzD0STTXRj7qzQ8ae515Vs0osDTQx1VQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737130405; a=rsa-sha256; cv=none; b=ZwOskscaS79p6Fln0gKD4clEn7ZiIUmzqRGd65gO6eBKcg9H2wuN6r3lARCjuRimPlZvfh 4LdGgeoISUtq+6cItl+XUE5ZU17gpMzQ1S/YeBLHOgjPRf68iZ3elm17S22tpbEEdAKwCn kOI0+ldNEqd49tRdb1CWku0IBvNPloaNbNmGRAF4DWOwC6azb1ILTNWNxXK03+0GnqsZuu wdHJV4/9qBW98FE6CBb/3Xe5NWDeRuC5PciZCczZvQjxcIW5tSn/6Ain3V8nkg2oIrUK57 3Up1vQTp0LDD8GhGadGQq7A2up/qahH+W9Bbg8ggn0mOnj5Av6ceFmFLpPrCYw== 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 4YZPsw6SH4z8n6; Fri, 17 Jan 2025 16:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50HGDO2v085746; Fri, 17 Jan 2025 16:13:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HGDOmo085743; Fri, 17 Jan 2025 16:13:24 GMT (envelope-from git) Date: Fri, 17 Jan 2025 16:13:24 GMT Message-Id: <202501171613.50HGDOmo085743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b8cdbe1852ef - main - iwmbtfw: Check firmware exists before trying to upload it List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8cdbe1852ef5df4ba3c7a021d9632bde2e61327 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b8cdbe1852ef5df4ba3c7a021d9632bde2e61327 commit b8cdbe1852ef5df4ba3c7a021d9632bde2e61327 Author: Gavin Atkinson AuthorDate: 2025-01-07 00:02:20 +0000 Commit: Ed Maste CommitDate: 2025-01-17 16:11:34 +0000 iwmbtfw: Check firmware exists before trying to upload it In the case of an Intel 7260 device, the device needs to be put into something called "manufacturer mode" before the firmware is uploaded. The firmware is then upladed, and the card is taken out of this mode, at which point it disconnects and reconnects to the USB bus, and is at that point usable. However, iwmbtfw(8) puts the device into manufacturer mode before verifying that there exists a copy of the firmware to upload. As a result, in the case where there is no firmware available on disk, the device is put into manufacturer mode, the firmware can't be found so isn't uploaded, and the card is brought out of manufacturer mode, so it disconnects and reconnects to the USB bus. Enter devd(8). There are rules in /etc/devd/iwmbtfw.conf to call iwmbtfw(8) when the device appears. When there's no firmware on disk, devd will call iwmbtfw, iwmbtfw will try to do its thing and fail, the device will dis/reconnect, and devd will notice the device reappear and start the whole loop again. Fix is to verify that the firmware exists before putting the device into its special mode. The fix only changes things for the 7260 and not the other chips supported, I don't believe the issue exists with other chips as those do not need to be switched into manufacturer mode before uploading. PR: 283896 Reviewed by: emaste --- usr.sbin/bluetooth/iwmbtfw/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/usr.sbin/bluetooth/iwmbtfw/main.c b/usr.sbin/bluetooth/iwmbtfw/main.c index c2b67ce01906..9c899d374e92 100644 --- a/usr.sbin/bluetooth/iwmbtfw/main.c +++ b/usr.sbin/bluetooth/iwmbtfw/main.c @@ -518,6 +518,13 @@ main(int argc, char *argv[]) iwmbt_debug("firmware_path = %s", firmware_path); + /* Check firmware file exists before changing HW mode */ + r = access(firmware_path, R_OK); + if (r) { + perror("Failed to open firmware"); + goto shutdown; + } + /* Enter manufacturer mode */ r = iwmbt_enter_manufacturer(hdl); if (r < 0) { From nobody Fri Jan 17 16:24:12 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZQ6N5HN0z5l94h; Fri, 17 Jan 2025 16:24: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZQ6N4JB4z3F6Q; Fri, 17 Jan 2025 16:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737131052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nRavFO/8fIT3jraFPzIxNnzOMyLaa6iSp6j4Jl9WJhM=; b=jK98IGL1dBF0EvF3+WNde0MjOxfpnQsYMN4pXosakm2zZZV8f6QiB5o1XCLqIPZHoQaI3m Y4BOW2X2RwABMuFtC3J+tnCUXt1IJV5F8p7TRi1iqECftTBzLFtxJETsaeX01M7be3E5dj KyU2ADvlUoWed8gz0OLpSKAnI5zeL3WhUpnGBjry2ktKiy1PDIbznCfCiuKmBHQCJj42oT nGepH7RPGil8EE2sncj33v2ljGZfSNT15NbKdKZNl+2wSQvAUiwI49/IZpBujn2cVT4uZF /Ic4kh0tDTDEWwiugX7EbBYIILOqXOvirx53YStZ2DVMaiShx/U71mPWN9KeYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737131052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nRavFO/8fIT3jraFPzIxNnzOMyLaa6iSp6j4Jl9WJhM=; b=fCpjSd2hKpUBm+6fqO/ilj6CNd6FKuFn2VX6VV2doHDL8crIoTyiG2VFc8vTxYjgYKUP37 BZSWZfO81oMDM1F4Urz1WJE+IjPM28G08F7y9VGDLFLhM/2w/JWcGEGDutAavbtaiDZwOU W4t3YAdF18V0nxV9l0F/c+iv30kQuV8sLy0oXT5kqPKQQ0ujSJn//Ot8T3MmzWQY1fYZ25 RcEBFoQOEwS9E36SxDOO10tKPo6qPjE5ne0u+evoQcysAsCw0CK0CGXDf7oYmC8vRRp+A1 m8Mid4zjsPB8w8HAsfjm2RVN/uZSk88fmQ3vnvTaYm3flgsxF9dEh34KM1le9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737131052; a=rsa-sha256; cv=none; b=tUzNYrUq0NI+ShPJn2P/cXi25ZhNXtm4twME02iqT6c/aWvKQZVR7wiLlO5OfuHIRBvEJC 6SqgNOUfqA3xV6s8SrSv5UxcPP0a2Gqw/3X26JZnmRbBYo4jfsqhMFSn5Qdu8/1R63pUd2 J1zHLKrI7dAevuvBOF8jExwYLVAHSx58dPooY86z6/LODUIzevZsGVIayPPCwSEmH+8ISm cT5gaO37d4dL3rV2mMN7PuUXFQQCrlV25RDY/FM/FbKLq/32nxSy0fZiw8coOddT7/38fo hhFvxfv/Ymp72qevAS4VKHyk3inNuEZBdKLbsCgZnWiOja+aKyf4pEAly7pW3Q== 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 4YZQ6N3W1Gz94y; Fri, 17 Jan 2025 16:24: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 50HGOCvV004988; Fri, 17 Jan 2025 16:24:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HGOCjT004985; Fri, 17 Jan 2025 16:24:12 GMT (envelope-from git) Date: Fri, 17 Jan 2025 16:24:12 GMT Message-Id: <202501171624.50HGOCjT004985@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 72f092ee0194 - main - libc: Add include path for aarch64 memchr.S List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 72f092ee019447c76ecb483c3f475313cf9dd5dd Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=72f092ee019447c76ecb483c3f475313cf9dd5dd commit 72f092ee019447c76ecb483c3f475313cf9dd5dd Author: Ed Maste AuthorDate: 2025-01-17 16:22:39 +0000 Commit: Ed Maste CommitDate: 2025-01-17 16:23:56 +0000 libc: Add include path for aarch64 memchr.S Reported by: bapt Sponsored by: The FreeBSD Foundation Fixes: d355c28a0954 ("depend-cleanup: bea89d038ac5 also moved memchr") --- lib/libc/aarch64/string/Makefile.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc index f0f0f6495782..35523fb954be 100644 --- a/lib/libc/aarch64/string/Makefile.inc +++ b/lib/libc/aarch64/string/Makefile.inc @@ -54,3 +54,7 @@ CLEANFILES+= ${FUNC}.S MDSRCS+= ${FUNC}.S CFLAGS.${FUNC}.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string .endfor + +# memchr.S is a wrapper in the src tree for the implementation from +# arm-optimized-routines +CFLAGS.memchr.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string From nobody Fri Jan 17 17:56:49 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZS9F5NPdz5lGLy; Fri, 17 Jan 2025 17:56:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZS9F4p6hz3YT2; Fri, 17 Jan 2025 17:56:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737136609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yBmZV1LDgSaNAtBSZnoigWxPyOyhK4j7lltpTQnLLFw=; b=UGm+TUMp8ZKfv3/6thhZWSLdXdR35sjd9tDdXxUjKYXEZ+V8o60yB0PXajRU/jAUoXnCk9 k0yeNfMF50J8fEN7xPZa2WP+FaAY4DQg+HV/D0qL+Weg74Plqt1qrj4hhmMQO3vbqQqmla jEQiYFKsl2g5FBTgW19s6pxpLP9pswnWJIZYQOofgujt4FjkGwaIIyiBqJp9nMMWFU+x6C PtwVCmKA+aKkmxF3ShbFgIoh+T1r3a4660RmXmqX2WjWCPU/NlIHd0pYha5TkXq4U6GCpi OoQXuIBvBar75K1dTg3fZMzjCmCbTY8lYaOhVZJhByKGYsIV8/s7Nw2PzNbepA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737136609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yBmZV1LDgSaNAtBSZnoigWxPyOyhK4j7lltpTQnLLFw=; b=X3RGeVdoI8nTrFnUMddkFGVaK3U+g4KXyFQoFAjS7ADNuOImCpuz/NZ2+ooRpTuoDM4nq6 5mJlZKmuE2pemIXB8sVMJEoEdD6g361refChHHreQfxt+gZ2XeZxA7JQi/kBokPR8gZniA Ep/7mkARx5pJ2w4Z97eEXU1+ffNUKEzK/x0ykorVp+uRihw0DWge4D85fyZaoGFRRiFuQX hHJr7VGAKUdf/3NEE7D2+wE6be0KJNnhEMQCMP4k35zeQX1tRCMf8GXVXlw5fNFfsesHpZ XJMX7NXr5gpwT51HgPlsLYZhPwXj6jIFrocFggO9BDbwXPs5Jul5DRf6a6zECQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737136609; a=rsa-sha256; cv=none; b=qiH2xM3nzYnSTDK07G+fs6rpatXsmcdyoTaAZUG3hvTwu0LyJlbkWhvBOR5ZSy2AIfo0RA 5VmKDhzIV4H+GHYJtwf5EixpEbwfgg/dqF6WCa3DgCB8+72vHRKJNoGMDLq5kvfRL958DR HZlvzQr61JFq5NP3KX+mfGTG9MgDkzeGu/9mcXiLoHGE2lJggSgFqQAiumvERsEOHuZV+e khDFKkQHZUrD5WdUhg1LWtKKruwEq5lUdZTOWjO8/LeqqQhrUnR4IENfAkpYysdkqjywE/ diZ92ZDi2+2TdJykAZSRAgWzIrn7JrtW40cMiQbmBmj/4M1co8DIl2y43Ip5jA== 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 4YZS9F4MDMzD0R; Fri, 17 Jan 2025 17:56:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50HHunCT073412; Fri, 17 Jan 2025 17:56:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HHun74073409; Fri, 17 Jan 2025 17:56:49 GMT (envelope-from git) Date: Fri, 17 Jan 2025 17:56:49 GMT Message-Id: <202501171756.50HHun74073409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 98bebc20cef7 - main - Revert "certctl: Set METALOG ownership to root:wheel" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98bebc20cef7527ccb15f8defc9d52e803a0d506 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=98bebc20cef7527ccb15f8defc9d52e803a0d506 commit 98bebc20cef7527ccb15f8defc9d52e803a0d506 Author: Ed Maste AuthorDate: 2025-01-17 17:49:01 +0000 Commit: Ed Maste CommitDate: 2025-01-17 17:56:30 +0000 Revert "certctl: Set METALOG ownership to root:wheel" This introduces a circular dependency because it requires an existing dbdir for install -N, which might not yet exist. I imagine we can use install -o 0 -g -0, avoiding the need for the dbdir, but install emits uname=0 gname=0 rather than uid=0 gid=0. So just revert for now pending a full fix. This reverts commit 10fa3f2518d4582c98d74527f79af9f30b1eceab. PR: 283340 Event: January 2025 Bug-busting session Sponsored by: The FreeBSD Foundation --- usr.sbin/certctl/certctl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index d336a02fd4ea..864302ab1160 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -334,7 +334,7 @@ fi : ${METALOG:=${DESTDIR}/METALOG} INSTALLFLAGS= if "$UNPRIV" ; then - INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR} -N ${DESTDIR}${DISTBASE}/etc -o root -g wheel" + INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR}" fi : ${LOCALBASE:=$(sysctl -n user.localbase)} : ${TRUSTPATH:=${DESTDIR}${DISTBASE}/usr/share/certs/trusted:${DESTDIR}${LOCALBASE}/share/certs:${DESTDIR}${LOCALBASE}/etc/ssl/certs} From nobody Fri Jan 17 18:23:44 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZSmJ6Kbvz5lHs1; Fri, 17 Jan 2025 18:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZSmJ5Zt0z3ffF; Fri, 17 Jan 2025 18:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737138224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pd5vxJ2qpJQnowbkWVC57VfyfKlPQePd21RjU2AY+XQ=; b=VbYjfN7dBSKc7bzk/VPIaHzupmIVSeWB2tJxTRvgLMkODK1OmlIbDoudPIrgRhF8EhnPri qpQFUh7InsxWi9VcuZDpAKmhbiMKnvY3HCtI2UGVayvTnG/0GKOIKFQPg1+QZpNIGDtR5p gEoJmhm5I3b4rVGbQ4XNAqZNpPmGZ0Bp80wvxwuu2Eo0DMhcERMoo/N35xtaV4wSQC9VjE FCROwYqJlCAmW3eyXf5FNgVb+3XzXGAJM9ev0NEA4/dJ2l8eshFLSjqA3izAA4LqOzV2ZP suwbOyDHOc/4jRqgsQuvMvGykOgqZdqHH96J4Xc4mQL6B+tMKIuqbj42Sx/WTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737138224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pd5vxJ2qpJQnowbkWVC57VfyfKlPQePd21RjU2AY+XQ=; b=nj+QZBJLh38QN0DLlDuloeSGPmZNa61LeiIsVQ2tM97hJ3eVZ9nFv/fH6gnXZa2PoouoaC 7GJwANigfsIO5/kNyWE0P02nmQtPkzKwF++HxAXOGT3/m1W2EQXFICs/uAvBdcB6fXjDsr JKKCO0QJ/T0B12FnGcZALgG18LtL46HSG8Nhmf1vmm0iplcl4EPPUOlg1XvtJa780z5mOj VAHBZACEFSugAjkiSegEa6iDlXnMabzkbOMv9ajRTGTxQ1fP+N1uvKMx1OQD5GkvNwXX5r LfJTAR9B7l9Iq6g4qOjr8udg6Kb2kwNxvchtxDdAQCSrPKTchpK3QRd2L4f/IA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737138224; a=rsa-sha256; cv=none; b=HtQ3vUUYLzPgpGNugsQZ5B+6jOsLKfBG1QTlwN2QSUl5lH6Wmr7hCtQY4D0i6vGfTjjuhu +i3fdFmophe7Zze4SaSmwrmQatPs6QOAqtiNyOgANxrxrmOTdKUtyrZVWBHLLdnY+lObpN 1FKw35g9B1bKgYBRcdGMvXgAHtsXNdqSD3ZreOXqRnoxogQiaMLPRiXf0tYbpBSONn4foP M1uNSdyR4sJWI21byqTmNvEYCPqSN1eOtXrj87H8NmT2I4QYT9K4CbVLCRz0yKGYxu0ZtT m5UaVmNaDs68P319+yfWjv675YUt2nX2S/riLgTTMhb70DHgqI7ZadEVdtFy9A== 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 4YZSmJ55vWzD4D; Fri, 17 Jan 2025 18:23:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50HINiLm027329; Fri, 17 Jan 2025 18:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HINin7027326; Fri, 17 Jan 2025 18:23:44 GMT (envelope-from git) Date: Fri, 17 Jan 2025 18:23:44 GMT Message-Id: <202501171823.50HINin7027326@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 473681a1a506 - main - libc: Fix getentropy POSIX 2024 conformance issues List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 473681a1a506daafdae17900fcb42830e0dcb26e Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=473681a1a506daafdae17900fcb42830e0dcb26e commit 473681a1a506daafdae17900fcb42830e0dcb26e Author: Ed Maste AuthorDate: 2024-11-16 15:14:21 +0000 Commit: Ed Maste CommitDate: 2025-01-17 18:23:23 +0000 libc: Fix getentropy POSIX 2024 conformance issues GETENTROPY_MAX should be defined in limits.h. EINVAL is the return value for buflen > GETENTROPY_MAX. PR: 282783 Reviewed by: markj, asomers, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47689 --- include/limits.h | 4 ++++ lib/libc/gen/getentropy.3 | 14 ++++---------- lib/libc/gen/getentropy.c | 5 +++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/limits.h b/include/limits.h index 99cfa67b3ed2..ed8844e65642 100644 --- a/include/limits.h +++ b/include/limits.h @@ -137,6 +137,10 @@ #define MB_LEN_MAX 6 /* 31-bit UTF-8 */ +#if __POSIX_VISIBLE >= 202405 +#define GETENTROPY_MAX 256 +#endif + #include #if __POSIX_VISIBLE diff --git a/lib/libc/gen/getentropy.3 b/lib/libc/gen/getentropy.3 index 5bbbc80e2414..5f7ee32ebbfc 100644 --- a/lib/libc/gen/getentropy.3 +++ b/lib/libc/gen/getentropy.3 @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd November 20, 2024 +.Dd January 17, 2025 .Dt GETENTROPY 3 .Os .Sh NAME @@ -60,8 +60,8 @@ The .Fa buf parameter points to an invalid address. -.It Bq Er EIO -Too many bytes requested, or some other fatal error occurred. +.It Bq Er EINVAL +Too many bytes requested. .El .Sh SEE ALSO .Xr getrandom 2 , @@ -69,7 +69,7 @@ Too many bytes requested, or some other fatal error occurred. .Xr random 4 .Sh STANDARDS .Fn getentropy -nearly conforms to +conforms to .St -p1003.1-2024 . .Sh HISTORY The @@ -80,9 +80,3 @@ The .Fx libc compatibility shim first appeared in .Fx 12.0 . -.Sh BUGS -.In limits.h -does not define -.Dv GETENTROPY_MAX . -Some error values do not match -.St -p1003.1-2024 . diff --git a/lib/libc/gen/getentropy.c b/lib/libc/gen/getentropy.c index ff5475f9fdb0..6b8ad697b7e0 100644 --- a/lib/libc/gen/getentropy.c +++ b/lib/libc/gen/getentropy.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -47,8 +48,8 @@ __ssp_real(getentropy)(void *buf, size_t buflen) { ssize_t rd; - if (buflen > 256) { - errno = EIO; + if (buflen > GETENTROPY_MAX) { + errno = EINVAL; return (-1); } From nobody Fri Jan 17 18:35:17 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZT1f2Rghz5lJMm; Fri, 17 Jan 2025 18:35:18 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZT1f1fZ3z3kDp; Fri, 17 Jan 2025 18:35:18 +0000 (UTC) (envelope-from brooks@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737138918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ljykCQvyffKJuxA0ENBzGxqQ3dx+MEJs9IeIvV7ft/w=; b=rxydgm1UJGrKUzQwSczUtU2ZQVe+kjxwHGuZTMn+8Dy9ia1qPiJCUbbh/vH3KVRQkswoxe f2ZohSciESR4LDeWN253bqJ7N0b5HfyavfZ7tv6RBgCh6zyOXfTHtRLSRbVOXppXxKvYuP KnNmIPBY1zo3g81SRWdGdAJF2kwJhx0zcbj6B/+L2tCC+wcwslPBGPemvHMYyPTZffWX3a 09+Mvx3o9EE8hAuCz0m1E4/rfeRGT5WoYT3zKN2HDXHmZ6/IDwn48DKLZYeqk8M7/bWS3l EJVb2/FeIpg1aqlwMmOXgy3U3jb2GORx7Mf2EC5fB4iWlHH2ms8wm3qT3z04aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737138918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ljykCQvyffKJuxA0ENBzGxqQ3dx+MEJs9IeIvV7ft/w=; b=XpDKMOmkDdmrtDtRYCV7FlUjrxxF13c6nadd0Kbi9ZJ+LjKGlVX8ys4TWICaRv9b927l4Y rcpyPy7LuVD7Smk3/l61Wq5a1Tn4IGp/8azBFOONM3LA5/wllo5RXXQ/qvBPf/EsMxVoy3 pSxLQBV4AeY54BrDULPSVbU7hOSvlcmDo720WTMbnLRli0BRphtcch4xYVM+0r5oH9H0O/ JSr1oOXvMirXPDf19b89SYkgQWLodd9mEtKADu+CsJSiYn+pwV+lXZbW0/Q5QaF5g/Sayu i5VFcXB5opdeWVUHPgI7Q8pjunXoO/HqWEpCJ8uCowiZ7rfuabSipATo5tTNBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737138918; a=rsa-sha256; cv=none; b=JPEOM0zA7DvKjy0M9xw81HO78b8Hn/VPkomXp0QsRaMok9CgMkAHM87y3gaXjUffiNxnrH uA51J9KHetQfp35ZHEZyHFtgkcPNTjQYvX3dTYpjBo5vjKH0huPaVhCXUQmBtH1wUTPUnB TR8DidLifTTfCk5b8n6vFqRWUvCsNy72kX0Mv3vAKlmVP0cIIAIC/Jw4oEKONgEWd7F9ek 1i5eQhtnCgbHM0iGSddCOKmq2KdmBsyHWIhjiLndhEpebLbgkE/IP5djhz878SOGMXMxr1 66/PfZnK1iT1CEStiwYR4S0CA1diBTOrBTOHjBF59W4DwhlvcE++pDgfIhjwcQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: brooks/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4YZT1f0X4pzCSN; Fri, 17 Jan 2025 18:35:18 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 7B5513C01A0; Fri, 17 Jan 2025 18:35:17 +0000 (UTC) Date: Fri, 17 Jan 2025 18:35:17 +0000 From: Brooks Davis To: Kyle Evans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Warner Losh Subject: Re: git: 9ded074e875c - main - Refactor makesyscalls.lua into a library Message-ID: References: <202410302108.49UL8tGl053622@gitrepo.freebsd.org> <25a28def-fbfd-49df-a2bf-dc4ef6609440@FreeBSD.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Jan 16, 2025 at 08:53:07PM -0600, Kyle Evans wrote: > On 1/16/25 16:43, Brooks Davis wrote: > > On Thu, Jan 16, 2025 at 03:52:22PM -0600, Kyle Evans wrote: > > > On 10/30/24 16:08, Brooks Davis wrote: > > > > The branch main has been updated by brooks: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=9ded074e875c29cb92d5f643801990d7bb23cca4 > > > > > > > > commit 9ded074e875c29cb92d5f643801990d7bb23cca4 > > > > Author: agge3 > > > > AuthorDate: 2024-10-21 21:42:13 +0000 > > > > Commit: Brooks Davis > > > > CommitDate: 2024-10-30 21:04:30 +0000 > > > > > > > > Refactor makesyscalls.lua into a library > > > > * main.lua replicates the functionality of makesyscalls.lua > > > > * Individual files are generated by their associated module > > > > * Modules can be called as standalone scripts to generate a specific > > > > file > > > > * Data and procedures are performed by objects instead of procedual code > > > > * Bitmasks are replaced by declarative types > > > > * Temporary files are no longer produced, writing is stored in memory > > > > * Comments provide explanation to functions and semantics > > > > Google Summer of Code 2024 Final Work Product > > > > Co-authored-by: Warner Losh > > > > Co-authored-by: Kyle Evans > > > > Co-authored-by: Brooks Davis > > > > Sponsored by: Google (GSoC 24) > > > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1362 > > > > Signed-off-by: agge3 > > > > --- > > > > sys/tools/syscalls/README.md | 49 +++ > > > > sys/tools/syscalls/config.lua | 312 +++++++++++++++++ > > > > sys/tools/syscalls/core/freebsd-syscall.lua | 147 ++++++++ > > > > sys/tools/syscalls/core/scarg.lua | 163 +++++++++ > > > > sys/tools/syscalls/core/scret.lua | 45 +++ > > > > sys/tools/syscalls/core/syscall.lua | 497 +++++++++++++++++++++++++++ > > > > sys/tools/syscalls/main.lua | 64 ++++ > > > > sys/tools/syscalls/scripts/init_sysent.lua | 193 +++++++++++ > > > > sys/tools/syscalls/scripts/libsys_h.lua | 111 ++++++ > > > > sys/tools/syscalls/scripts/syscall_h.lua | 97 ++++++ > > > > sys/tools/syscalls/scripts/syscall_mk.lua | 90 +++++ > > > > sys/tools/syscalls/scripts/syscalls.lua | 109 ++++++ > > > > sys/tools/syscalls/scripts/syscalls_map.lua | 74 ++++ > > > > sys/tools/syscalls/scripts/sysproto_h.lua | 242 +++++++++++++ > > > > sys/tools/syscalls/scripts/systrace_args.lua | 268 +++++++++++++++ > > > > sys/tools/syscalls/tools/generator.lua | 113 ++++++ > > > > sys/tools/syscalls/tools/util.lua | 194 +++++++++++ > > > > 17 files changed, 2768 insertions(+) > > > > > > > > [...] > > > > diff --git a/sys/tools/syscalls/core/freebsd-syscall.lua b/sys/tools/syscalls/core/freebsd-syscall.lua > > > > new file mode 100644 > > > > index 000000000000..193b1e43563c > > > > --- /dev/null > > > > +++ b/sys/tools/syscalls/core/freebsd-syscall.lua > > > > @@ -0,0 +1,147 @@ > > > > [...] > > > > +function FreeBSDSyscall:parseSysfile() > > > > + local file = self.sysfile > > > > + local config = self.config > > > > + local commentExpr = "^%s*;.*" > > > > + > > > > + if file == nil then > > > > + return nil, "No file given" > > > > + end > > > > + > > > > + self.syscalls = {} > > > > + > > > > + local fh, msg = io.open(file) > > > > + if fh == nil then > > > > + return nil, msg > > > > + end > > > > + > > > > + local incs = "" > > > > + local defs = "" > > > > + local s > > > > + for line in fh:lines() do > > > > + line = line:gsub(commentExpr, "") -- Strip any comments. > > > > + -- NOTE: Can't use pure pattern matching here because of > > > > + -- the 's' test and this is shorter than a generic pattern > > > > + -- matching pattern. > > > > + if line == nil or line == "" then > > > > + goto skip -- Blank line, skip this line. > > > > + elseif s ~= nil then > > > > + -- If we have a partial system call object s, > > > > + -- then feed it one more line. > > > > + if s:add(line) then > > > > + -- Append to system call list. > > > > + for t in s:iter() do > > > > + if t:validate(t.num - 1) then > > > > + table.insert(self.syscalls, t) > > > > + else > > > > + util.abort(1, > > > > + "Skipped system call " .. > > > > + "at number " .. t.num) > > > > + end > > > > + end > > > > + s = nil > > > > + end > > > > + elseif line:match("^#%s*include") then > > > > + incs = incs .. line .. "\n" > > > > + elseif line:match("%%ABI_HEADERS%%") then > > > > + local h = self.config.abi_headers > > > > + if h ~= nil and h ~= "" then > > > > + incs = incs .. h .. "\n" > > > > + end > > > > + elseif line:match("^#%s*define") then > > > > + defs = defs .. line.. "\n" > > > > + elseif line:match("^#") then > > > > + util.abort(1, "Unsupported cpp op " .. line) > > > > > > This specifically is kind of a huge regression, and I don't really know how to > > > cope with it. We've guaranteed for years that we'll copy preprocessor > > > directives through to all output files. We don't use that upstream in > > > FreeBSD, but we work with downstreams/vendors that make extensive use of it in > > > their syscall definitions. > > > > > > I don't really know what the answer is to this, but we probably shouldn't have > > > dropped it without some discussion first. This is going to be a bit of a > > > headache... > > > > This response seems rather hyperbolic. This change was up for review > > for months and the feature is unused in tree so there was no way to know > > it was important. > > > > Re-reading, yes, this was a bit dramatic; my apologies. There's plenty of > frustration here, mostly amplified by the fact that I was on the review just > as much as you folks and have worked in environments that use it- it certainly > should have stuck out to me, but I just didn't have the time into it that I'd > hoped I would. > > I would've also really liked to see an "XXX" comment at a minimum drawing > attention to it or a call-out in the commit message, given that the syscall > definition documentation isn't that lengthy and this is one of the few > guarantees we make it. I think there's some compromise to be had, but... > > > It would be helpful to work through some examples understand what people > > need here and if it really has to be a refactor to pass things through > > or if adding some new tags and config values could do the job. > > > > ... I'll respond to this this weekend, hopefully. I'd like to condense what > I'm aware of into some formal test cases in sys/tools that I can point to so > that we have something less abstract to debate the merits of, and also so that > we have something we can verify the functionality against. I've implemented simple support for ifdef's syscall variants in https://github.com/freebsd/freebsd-src/pull/1575. It's not robust at all and may be missing some bits in newly generated files, but it's probably not much worse than what's in 14. I agree some tests would be good. I think I'd deviate from the norm and run them as part of the top level `make sysent` for ease of develoment. > > The quickest workaround would probably to revert these commits locally > > (I took care to isolate them for exactly this reason): > > > > 5212b9500116 sysent: GC sys/tools/makesyscalls.lua > > 204d065dac81 sysent: switch to refactored makesyscalls.lua > > > > You might also need to revert this commit or implement it in > > makesyscalls.lua: > > > > bbc0f33b1317 sysent: add a NOLIB modifer to prevent stub generation > > > > If we need be, I'd even be ok with temporarily restoring makesyscalls.lua > > and back porting easy features, but maintaining two is certainly not > > viable indefinitely. > > > > This isn't urgent enough to warrant any of that- it's just something that I'd > like to work out how we can solve (preferably in the short-to-mid term), > because there good uses for at least a subset of what we supported before. I > don't think we need to go as far as supporting arbitrary preprocessor, but if > we could at least devise something for conditional syscall slots that'd > probably be sufficient and workable. I think the right midterm solution is probably a combination of generating the files at buildtime (one of the goals of the refactoring) and some sort of overlay framework so you can replace syscalls on a per-arch basis. -- Brooks From nobody Fri Jan 17 19:20:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZV25492Mz5lLxV; Fri, 17 Jan 2025 19: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZV253X0Lz3sZ6; Fri, 17 Jan 2025 19: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=1737141645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nDtBj1NHI5QQ9F7zQxDR490Y4Z/I05OaRIxpnlpb+qs=; b=dcUtUa1O/rDuIJvUUqbL5TF1PMyIv5gXOXwriRXxqyioSdxawdMw++9XHbF00vjBvRg+WU 97hgM9y7Cp2Zy2lNcs5Frfe3Mzrxo7u8oORP3JHQU4pGrkXXRlGvNm/Q8D89f4MVW5wHW7 /tqju4CNBNfS1uSPbj7BFAOO2O14o9oG7iYnSnzYN9mEy8BCjvxtaJC4FdY7Aa24zdWKrO vj38eiORrHBtBj3Ivi+S1+3Hud2BNDsbPeAGfdtkfCXjtOuec4o/TkAolRgIDXLrXmYGyI /p6GZX8438ZHgqxr0IAqjwPtYBYjOYK3MHot3OA0gAuVBIebuMj2/kQy0Xnz3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737141645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nDtBj1NHI5QQ9F7zQxDR490Y4Z/I05OaRIxpnlpb+qs=; b=bnEjuzBLWevUlksIN9YzPNkzHTwgiCtOt3XfkiLaWJIcBQkSaeePIic9FsJbsGkV6P8YEq G1OHb+m0zVaA7e2Q1r7bMmDprG0/fa1oOzENprcbvBbiUxs8gyiGPb5yhJog9My3VNKrM7 lrmd7YLys3xKH/3BmgwbYn/8gBaVLQ1tJNubJaInB6wKCk9oeHnVRI7QxwPW9XFPcOV0D2 dIElAkXAE/yoBX91SHpDM5/4g2OZEpazEpAJVIMLlU4v6Cq+jDE9iQ4AvZFJ6krNl39QgW ZqvNCxPqG8eEJ6nu8qYsf6OXmMWE6Y9HV68hdDnUQ0T7J+JvSZndpZKbJrmMNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737141645; a=rsa-sha256; cv=none; b=kSR+6RQTBkazkWM6wUsWiwiHhSHvLOk+JA4j7NYMO4jW3f/eOW8cMtNw1QARtLp82uBlXM 0pMqsUWmalLwePNGyuXemwLwPfphYwlJbVRt5qI0l1e1tEuKlgqvGqJf2g6DC+iiM+G+bc 3XhoJalqrIHYmlWtcVtmB8rNzIbY+Tl8vcQUNPyVqWckYz3rbZBItV0XTHcE0PQ2J+l/Ix RF0NdZn2Vslwu5Vz2h+UGLvaN59aA34tDHhhWv+0lZj+k9UuuxJJ7iuhKKVBeHWgahegcC x8Klyeoe3p6cXgE5HBRR1vf4OHwwenV3Zi1F9ucC5PQA9nvHgELc//J3ksf88A== 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 4YZV2532f6zWYq; Fri, 17 Jan 2025 19: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 50HJKjpp020620; Fri, 17 Jan 2025 19: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 50HJKjMd020617; Fri, 17 Jan 2025 19:20:45 GMT (envelope-from git) Date: Fri, 17 Jan 2025 19:20:45 GMT Message-Id: <202501171920.50HJKjMd020617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c4380d5b9383 - main - rtsold: Add -i to the usage message List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4380d5b9383e2a062840573b36ab643b65b2610 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4380d5b9383e2a062840573b36ab643b65b2610 commit c4380d5b9383e2a062840573b36ab643b65b2610 Author: Mark Johnston AuthorDate: 2025-01-17 15:14:22 +0000 Commit: Mark Johnston CommitDate: 2025-01-17 19:20:14 +0000 rtsold: Add -i to the usage message PR: 266634 Fixes: 231bac4ccc43 ("rtsol/rtsold: Add option to skip random delay") MFC after: 1 week (cherry picked from commit 9e9e64b693ab1e08cca46e26e468160542c33f3a) --- usr.sbin/rtsold/rtsold.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c index 91c80d178bc7..e0b168a379bf 100644 --- a/usr.sbin/rtsold/rtsold.c +++ b/usr.sbin/rtsold/rtsold.c @@ -792,17 +792,17 @@ usage(const char *progname) { if (strcmp(progname, "rtsold") == 0) { - fprintf(stderr, "usage: rtsold [-dDfFm1] [-O script-name] " + fprintf(stderr, "usage: rtsold [-dDfFim1] [-O script-name] " "[-M script-name ] [-A script-name ] " "[-p pidfile] [-R script-name] interface ...\n"); - fprintf(stderr, "usage: rtsold [-dDfFm1] [-O script-name] " + fprintf(stderr, "usage: rtsold [-dDfFim1] [-O script-name] " "[-M script-name ] [-A script-name ] " "[-p pidfile] [-R script-name] -a\n"); } else { - fprintf(stderr, "usage: rtsol [-dDF] [-O script-name] " + fprintf(stderr, "usage: rtsol [-dDFi] [-O script-name] " "[-M script-name ] [-A script-name ] " "[-p pidfile] [-R script-name] interface ...\n"); - fprintf(stderr, "usage: rtsol [-dDF] [-O script-name] " + fprintf(stderr, "usage: rtsol [-dDFi] [-O script-name] " "[-M script-name ] [-A script-name ] " "[-p pidfile] [-R script-name] -a\n"); } From nobody Fri Jan 17 20:30:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZWZM2bGHz5lQ7Y; Fri, 17 Jan 2025 20:30: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZWZM1lc3z44rt; Fri, 17 Jan 2025 20:30:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737145819; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q90Yk9BfyD/ON8IlaxPVjA3ytALrgW8CxTR50w5oyCE=; b=CnkHDi6uHS6vq/+Pr2PIE/BHc2zAKFR37nncTEiEEyo8WpLYjAWCi1vaFXxlh1asv550u7 S2845A/jxDsBywe/e8YLT2h8juivRn0uAI5twn+SyLCNkwvRKTzGCe3TNR2jiQbYzX2GNp QT9pgqoCTh8f7To9Dh+p9s3Lt5zZqjWz+2Z+sIVUlp/M58EKpp1VchHoMkhxTezzSzGRbu ddXzw4bKURnOp6aI1iFTgpJmfSfsOZkunaUztNjU4umPsc103l/YRWeibX24nvAMoR8ZuT fjrWtDIxg/fGp8FvOCwKOotL53LKd5I6wMSnXYUCrdxZ7BcHGVjZD1xIaXP11Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737145819; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Q90Yk9BfyD/ON8IlaxPVjA3ytALrgW8CxTR50w5oyCE=; b=TlTjmpooxFTWHi/+TTIZtG0BO8Hl7t8i9bGgwoUCGfvQop+u/sumLGI+v3yj9NDKYCZFFT b+mnYxVrk+F31KdT6TkUDKGzB41DHyl46y3a28Wp63/qL8ggjVqMHAzEeqUzdrqa3AluOI gPvRJvQqWvYiZo8ToU1WC7pSwHwr/lYh3lFqnKXBVMNRlU4co1WN+iabBCuE6BXYwDYEkv pq9obb5yekGf3UrX9PbDeZEpQYR0lgxH7+eUCrKOTUL+SzKxLZRurdFGVszzAZjBLFLiyz 0wnJrfNpKQ3/4XJ1d4N5bNQmYtEA8Izxnkprw6l9mmZahxl2z2wBV+DPfQheYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737145819; a=rsa-sha256; cv=none; b=w+PRl9JSt49Aq731Tk84R6CJ7D4tI8USUnT5ymuhhQp2xUmoYN+Amcizbzyj6Gki9Ov4ib 9Kvj6IutVxHg4bph823LMEd6tyj0cxKUlYJpxvoohABfpjnpnz3uqgRN+HgsCNmN5jsCDV SCAkIqczEVNwxaRz9hwIZVaLUYaQBtFepmJT/taRrdmXWIAUVQaQOE7D7erJTXnUXa281m t1CKhDlMJ8Jl70qlYhmDW+P3+4iRhkj2DfnTqiL4VpE2g5perVt2BnblIvNO5vKnltxztX MvYFGvTAtEy+SezopJYlGutkPxCoEBLfosIjYrsmcTy630oQnEYjJaSsf5ynBQ== 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 4YZWZM1CwPzZ3F; Fri, 17 Jan 2025 20:30: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 50HKUJjs037743; Fri, 17 Jan 2025 20:30:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HKUJx8037740; Fri, 17 Jan 2025 20:30:19 GMT (envelope-from git) Date: Fri, 17 Jan 2025 20:30:19 GMT Message-Id: <202501172030.50HKUJx8037740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 194242604ae4 - main - nfscl: Simplify the deleg argument for nfscl_deleg() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 194242604ae4644ced49fac03d9ddc6994ea9e95 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=194242604ae4644ced49fac03d9ddc6994ea9e95 commit 194242604ae4644ced49fac03d9ddc6994ea9e95 Author: Rick Macklem AuthorDate: 2025-01-17 20:29:11 +0000 Commit: Rick Macklem CommitDate: 2025-01-17 20:29:11 +0000 nfscl: Simplify the deleg argument for nfscl_deleg() The deleg argument to nfscl_deleg() is a "struct nfscldeleg **" although the returned pointer value is never used by callers. This patch changes the argument to "struct nfscldeleg *" to simplify the call and avoid any confusion w.r.t. use of the returned value. This patch should not create any NFS semantics change. --- sys/fs/nfs/nfs_var.h | 2 +- sys/fs/nfsclient/nfs_clrpcops.c | 6 +++--- sys/fs/nfsclient/nfs_clstate.c | 10 +++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 950e0c097457..00d5b914f4af 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -606,7 +606,7 @@ int nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *); int nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *, bool, bool); int nfscl_deleg(mount_t, struct nfsclclient *, u_int8_t *, int, - struct ucred *, NFSPROC_T *, struct nfscldeleg **); + struct ucred *, NFSPROC_T *, struct nfscldeleg *); void nfscl_lockinit(struct nfsv4lock *); void nfscl_lockexcl(struct nfsv4lock *, void *); void nfscl_lockunlock(struct nfsv4lock *); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index c35d0c6295b9..07f046a82d8b 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -452,7 +452,7 @@ nfsrpc_open(vnode_t vp, int amode, struct ucred *cred, NFSPROC_T *p) NFSUNLOCKNODE(np); (void) nfscl_deleg(nmp->nm_mountp, op->nfso_own->nfsow_clp, - nfhp->nfh_fh, nfhp->nfh_len, cred, p, &dp); + nfhp->nfh_fh, nfhp->nfh_len, cred, p, dp); } } else if (NFSHASNFSV4N(nmp)) { /* @@ -485,7 +485,7 @@ nfsrpc_open(vnode_t vp, int amode, struct ucred *cred, NFSPROC_T *p) NFSUNLOCKNODE(np); (void) nfscl_deleg(nmp->nm_mountp, op->nfso_own->nfsow_clp, - nfhp->nfh_fh, nfhp->nfh_len, cred, p, &dp); + nfhp->nfh_fh, nfhp->nfh_len, cred, p, dp); } } else { error = EIO; @@ -2511,7 +2511,7 @@ nfsrpc_create(vnode_t dvp, char *name, int namelen, struct vattr *vap, */ if (dp != NULL) (void) nfscl_deleg(nmp->nm_mountp, owp->nfsow_clp, - (*nfhpp)->nfh_fh, (*nfhpp)->nfh_len, cred, p, &dp); + (*nfhpp)->nfh_fh, (*nfhpp)->nfh_len, cred, p, dp); nfscl_ownerrelease(nmp, owp, error, newone, unlocked); if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID || error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 0a1eb51e279f..8a82fe77690e 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -432,9 +432,9 @@ nfscl_newopen(struct nfsclclient *clp, struct nfscldeleg *dp, */ int nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, - int fhlen, struct ucred *cred, NFSPROC_T *p, struct nfscldeleg **dpp) + int fhlen, struct ucred *cred, NFSPROC_T *p, struct nfscldeleg *dp) { - struct nfscldeleg *dp = *dpp, *tdp; + struct nfscldeleg *tdp; struct nfsmount *nmp; KASSERT(mp != NULL, ("nfscl_deleg: mp NULL")); @@ -457,7 +457,6 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, NFSUNLOCKCLSTATE(); return (NFSERR_BADSTATEID); } - *dpp = NULL; TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, nfsdl_list); LIST_INSERT_HEAD(NFSCLDELEGHASH(clp, nfhp, fhlen), dp, nfsdl_hash); @@ -475,18 +474,15 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp, (tdp->nfsdl_flags & NFSCLDL_READ) != 0) { TAILQ_REMOVE(&clp->nfsc_deleg, tdp, nfsdl_list); LIST_REMOVE(tdp, nfsdl_hash); - *dpp = NULL; TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp, nfsdl_list); LIST_INSERT_HEAD(NFSCLDELEGHASH(clp, nfhp, fhlen), dp, nfsdl_hash); dp->nfsdl_timestamp = NFSD_MONOSEC + 120; } else { - *dpp = NULL; tdp = dp; /* Return this one. */ } } else { - *dpp = tdp; tdp = NULL; } } @@ -1637,7 +1633,7 @@ nfscl_expireopen(struct nfsclclient *clp, struct nfsclopen *op, } if (dp != NULL) nfscl_deleg(nmp->nm_mountp, clp, op->nfso_fh, - op->nfso_fhlen, cred, p, &dp); + op->nfso_fhlen, cred, p, dp); } /* From nobody Fri Jan 17 21:10:37 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZXSs4jD4z5kDyC; Fri, 17 Jan 2025 21:10: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZXSs1XtZz47dM; Fri, 17 Jan 2025 21:10:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737148237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TFKylcMHdmJM97fEfNpTGFq7Zz3v+tBtvZ1q17U0xiI=; b=DFp6HW/sdho+Bah5Mr1qPkeYH9Z3AmcVluopdPApmwT+Ygphsoen1OVbeafHTDe9EvhPVr oY8CvI6z3pxvGKeWPC4kpoJDyq7GQ7K/8nO0BVhjlzv2PZUOfwc7NVt3JR4AM1h4xZyZdR N/IPDd7z/3gRsVPDTO7C/jy9k20tTU49lVPew5nMcbbD0TC6FP2WncjuEHeDfMZ8AWV6lr 5k3v1HJss8bg2FgAFt2PNLXvdzBKPYSuGUs2cCxTH4SqS+yL6O2SrRT8p6BXcwL2Ug6CoB qVjCMP8rhrUgoCYspURqdJSf98FyIbRPnanp0iMvpiYIJSyrD91ktUosbMahuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737148237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TFKylcMHdmJM97fEfNpTGFq7Zz3v+tBtvZ1q17U0xiI=; b=hJkFUsMmFVGU6bkgf65SIC4uNBcvMV//RpvDVe7oSc03qCgdJ42muGa8QheO+lSeooWR1R /9egTvAvVJaGbkYPPjYe1XM2FtefIUfrw729n68umNWXzoCm3n3ZW7AdOUUanuwR734LSM QNHlcMfKHrWguvD1tkDuNAWxgxBhWtcmMx023TvbIVKGmeQB3YcTHiEK0pWFGVxzrQ377f kABuS3fkDzRmpnWqsMHmf9U+qfYtauI9W5uamye56EEQyRlrknYHWyo8BjyZgqndongcd+ sN43LpDshWyP4NqS50W9SyAAI3+Yhzsp0Me1nhpPJBSVgYyopf1l7xo5R1JI9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737148237; a=rsa-sha256; cv=none; b=Q1AvHBxGaVwsDyHZ8Nj6N4HTqtJZgta62T3Q9Wr/9K1sDezlFpB8EXRBdIvhQNwQKBSJ0t +JU9onTho532ULMQWYcDaynRog/9JepTDnSbiMt1zzxwVmf1rnzIgjxrNcEMlXJ03rb/RT HKeRZ8wMVCowM1opdqdU2kLIGDR4MFvivd2eTmKO8ac4/mXFmLW7MGREoXdtjmxGtpHolL nmcwo6v1sF5q6/RBA2mhfTYmtiM8U1gQ63oGG67w9ScYbzqkkAGgvatGf6fE5Rva7gZ5X2 06DP6SA5PpEIrkUEwqD11I5r6Eolk0giI0ZMqdOSkzAqRSat/cjuWyIsxU0jFw== 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 4YZXSs10CGzb6Z; Fri, 17 Jan 2025 21:10: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 50HLAb7b004394; Fri, 17 Jan 2025 21:10:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HLAbia004391; Fri, 17 Jan 2025 21:10:37 GMT (envelope-from git) Date: Fri, 17 Jan 2025 21:10:37 GMT Message-Id: <202501172110.50HLAbia004391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a8b49e7c6629 - main - cam: Add 3e/3 as a fatal code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8b49e7c66292852339481536f039719e7914200 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a8b49e7c66292852339481536f039719e7914200 commit a8b49e7c66292852339481536f039719e7914200 Author: Warner Losh AuthorDate: 2025-01-17 21:06:32 +0000 Commit: Warner Losh CommitDate: 2025-01-17 21:07:40 +0000 cam: Add 3e/3 as a fatal code We see this error: (da4:mps0:0:3:0): SCSI sense: HARDWARE FAILURE asc:3e,3 (Logical unit failed self-test) for drives that have failed. Our vendor tells us there's no recovery from that state, though we can still grab logs from the drives and run their diagnostics. Drives in this state need to bascially be remanufactured because some part of them has failed. The prior default behavior is to retry, and retrying takes a long time to work out. Instead, short-circuit the retries and fail right away. I selected ENXIO because no I/O to LBAs is possible for drives in this state (both my experience and per vendor). Some googling suggests that other vendors behave identically, but it was inconclusive. Should this be too pessimistic, we can adjust in the future. Also, this is with some aging drives in our fleet, and if we have more than one drive in this state, our systems take so long to get to mountroot that the watchdog fires sometimes. Adding this patch makes them boot reliably again. MFC After: 1 week Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D48505 --- sys/cam/scsi/scsi_all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index a26354e3dd97..0f31757cae25 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -2308,7 +2308,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x3E, 0x02, SS_RDEF, "Timeout on logical unit") }, /* DTLPWROMAEBKVF */ - { SST(0x3E, 0x03, SS_RDEF, /* XXX TBD */ + { SST(0x3E, 0x03, SS_FATAL | ENXIO, "Logical unit failed self-test") }, /* DTLPWROMAEBKVF */ { SST(0x3E, 0x04, SS_RDEF, /* XXX TBD */ From nobody Fri Jan 17 21:42:26 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZY9Z3WJdz5kGrD; Fri, 17 Jan 2025 21:42:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZY9Z2WCLz4F20; Fri, 17 Jan 2025 21:42:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737150146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YOB6qdoqH7au9s9IRbJlqvhdRzycpO0593kHzOfiraA=; b=dKdplNtv0/rtorysVomr0PAgMdHZs2GC7v7N2nfAn4eAmhHwQLfJed1PuGICbkzGnoa9W6 rOol5Z0bUFY3qaGagkBWVxZziPy8Ixq9aJpanWQnZ+CaGWWc1+2Pb7zdef9s4sRlhTacrW 1/b5hPyMwx3SDPfEcfxpK2/t/6bJTKHQoLxHFT0SNhF7Lh3g/99hKzoBpKpLW5WcGjMA0t UHtodxnwqn0ocu3EltACLf6X7UZbYtkT2W5bIQDBoZ6jmeGQdbVd3hbYf4mlr5TDUQy9Gu wejdSYEyKMuXaPc3cw8spqXItSoZRH65RltASxTdWHurguBbUeNBnzKFMVSoQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737150146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YOB6qdoqH7au9s9IRbJlqvhdRzycpO0593kHzOfiraA=; b=IjGexh13Lhh/+w2fEvpSEIsskSVe2AMQlwUgDdHEnBMTv2mU/6YOAlO36gl57xYp2ycA4t ZiCST+CWR+0NVOHbpArR01crs2PY7LzHLOsuDpFEVWI4edIC3mxfkSb8G190Gx6pdMasnj w9WmmqcN8dd7staYCnOalk90Hdc7CMP2HtKmFfJCGjV/A8w4pF/mOw6O0U04Ys1qu8lxZw 3kYHme2vEeWSuIKzgk1Qu8QGrugB/W0WeXO2vCQYUW+DYC8+UqbyXcZ9tWdZsW9exvr2hv d7snDGlQteU/Lryh/yHp4MHK71IjwMXcM8/ID1umEQNJ29+phiuODvNejVxkDw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737150146; a=rsa-sha256; cv=none; b=Vz3Kum4iXRsbNRC05siDJieOSK72IptuiGutGnbVZtPzKBW/xHKibIs1wzvrPrKyuyasEV WMtC7/bshgW55UXFby84GFhIPBBxLyRmM1gYZQrAWZ/QpF1n1oqwXxs0sFgr1EzD101UXN f4t88Rl6QYYRaQA97fr78bYjvY0JpkstGJbrh0NKbdZkZZD2O09VMC5uq4tsNBYqIZLESu gpWRnIFD8jh6Xy9UgwJdb0VwcuR9WzTT3PyE2ebJp8lo0xskerGyEqYpPWFzEwStqE9gUl Rr2oE43dVUT7GGfBLt1KTJ4PncdVFOsPEmSX0iK5AzrXLtrztQ7+rqS+OZ02+w== 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 4YZY9Z1sl6zcQK; Fri, 17 Jan 2025 21:42:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50HLgQIA061072; Fri, 17 Jan 2025 21:42:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HLgQ4Y061069; Fri, 17 Jan 2025 21:42:26 GMT (envelope-from git) Date: Fri, 17 Jan 2025 21:42:26 GMT Message-Id: <202501172142.50HLgQ4Y061069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 4d15b58365ea - main - certctl: Set METALOG ownership to root:wheel List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d15b58365ea706129bedfdb37e0c5e8661a640f Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4d15b58365ea706129bedfdb37e0c5e8661a640f commit 4d15b58365ea706129bedfdb37e0c5e8661a640f Author: Pat Maddox AuthorDate: 2024-12-15 09:20:24 +0000 Commit: Ed Maste CommitDate: 2025-01-17 21:41:02 +0000 certctl: Set METALOG ownership to root:wheel This sets the correct ownership values when building base.txz This is an updated version of commit 10fa3f2518d4, omitting the `-N ${DESTDIR}${DISTBASE}/etc` from the original commit. install(1) does not validate the arguments passed to -o or -g (see PR283355) so there's no need to have the passwd db available for now. Future work includes plumbing the appropriate passwd db path through certctl, and validating uid and gid in install(1). PR: 283340 Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D48506 --- usr.sbin/certctl/certctl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index 864302ab1160..458f5c53682f 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -334,7 +334,7 @@ fi : ${METALOG:=${DESTDIR}/METALOG} INSTALLFLAGS= if "$UNPRIV" ; then - INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR}" + INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR} -o root -g wheel" fi : ${LOCALBASE:=$(sysctl -n user.localbase)} : ${TRUSTPATH:=${DESTDIR}${DISTBASE}/usr/share/certs/trusted:${DESTDIR}${LOCALBASE}/share/certs:${DESTDIR}${LOCALBASE}/etc/ssl/certs} From nobody Fri Jan 17 21:43:35 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZYBw2sgdz5kH9G; Fri, 17 Jan 2025 21:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZYBw0mY0z4FrD; Fri, 17 Jan 2025 21:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737150216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TmUkgx2KS8ooFa1ShXY2HT3STDeDhgI/nrbMmqLxK+4=; b=jpr5RIqhhvnH+7v+B/mm/yURuTdsxwbMVVqiQcYtYRXXeGGz3C/ophk1YtoE0XmG0ojIuI WX0oyAsD50PJOBcCmMz9Pwii7XpNfPnpydFQ2sAS/Dt4KzkLQ/pDJBHR0nvH2yeNiqMxxv ddbJ6P5sazJHdBiF04tooxe6JRNhoM2aLihc5KkPRnF54CbzWMOdmfaM45gcqTk7wD8zuY x/X/k+FKvbBrItPDmXvS1zeyybNt/eYzuSbvukBj9T4txRY+CZnmjqJyFVA1PYbnix8bdA SVtU//9i1N3s4sLVs+Rz8u0R9UOIa97DTOyleoyCxSk4wm0Da4ofhmMEB9wr6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737150216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TmUkgx2KS8ooFa1ShXY2HT3STDeDhgI/nrbMmqLxK+4=; b=q+PZ7AIxOTyf5nW9KL3kpqXtn8PuuxCugJOnvhdqOAfS/sq1olHOASE4r/UkJS65rs46hR 64PCtrM+DRj/aTPjBoij42QGhBqKePEp5fIylVWDBCdFSGu2qcwcRpWMY3CaL29e5qQ2WS ZvXj+Vd5sQpcC4x8ypKup18bPzF34A69m/0cIWGQJc8NZh69K5EgcwtpQSol2Lcopc2ZZs 6rLUJgEjWrakL3amRV+nxIbIBz+3ZU0a/5GE/cZmYBu2DSWG7PGyMboGsqGYFrAhinb5gJ oB8M9rbwAFGLzDtD3FWMUrlDRxp5Xbqz+hywgRN7Eqk2StRJkjUBeHLrHWn/xw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737150216; a=rsa-sha256; cv=none; b=Fqsq3hwx4OOWh2EDsq83Xe+021TxKgCsOeGONMH7Vr4iaiMKDUEtmafGCb9IrOWMEqzTbs VrWjJ459l3xmPksPd6eORydOAgbKt/O9axWutvksswXfficjvdzQTlryvXEBX184XODf8p 4aCr00ZTAv7sHbopqdEwveJCXeVPq/LNL86zewcDplM5ozztlkA1OUjT0TYMvW67IQ9YZi C4g1pFBkrQA7kg6JQHP+bHh/GxgiQ+Uh0vze5v8VwYqvm/TPUXYdwbJKi8DBAniTBhb4qy 0/2nqea3e6YhahsRAygQUT2J/G6I6nAeWTIxuReOVVD8NkbJNPAq0CcXnI27Tw== 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 4YZYBw0HDRzcTR; Fri, 17 Jan 2025 21:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50HLhZAf061310; Fri, 17 Jan 2025 21:43:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HLhZNx061307; Fri, 17 Jan 2025 21:43:35 GMT (envelope-from git) Date: Fri, 17 Jan 2025 21:43:35 GMT Message-Id: <202501172143.50HLhZNx061307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: f26fe2c6669d - main - ctld: correctly parse LUN size on 32-bit arches List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f26fe2c6669d56621ac85f5279aa85503cbf59bc Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=f26fe2c6669d56621ac85f5279aa85503cbf59bc commit f26fe2c6669d56621ac85f5279aa85503cbf59bc Author: Alan Somers AuthorDate: 2025-01-17 17:36:08 +0000 Commit: Alan Somers CommitDate: 2025-01-17 21:43:09 +0000 ctld: correctly parse LUN size on 32-bit arches Disk offset values must always be 64-bit, not size_t. PR: 214874 Submitted by: pprocacci@gmail.com MFC after: 2 weeks Event: January 2025 Bug-busting session --- usr.sbin/ctld/ctld.c | 2 +- usr.sbin/ctld/ctld.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 346d1908aa6f..497e0f6e7600 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -1568,7 +1568,7 @@ lun_set_serial(struct lun *lun, const char *value) } void -lun_set_size(struct lun *lun, size_t value) +lun_set_size(struct lun *lun, int64_t value) { lun->l_size = value; diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index e1bab1a8e3b8..3f4b653d6896 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -349,7 +349,7 @@ void lun_set_device_id(struct lun *lun, const char *value); void lun_set_path(struct lun *lun, const char *value); void lun_set_scsiname(struct lun *lun, const char *value); void lun_set_serial(struct lun *lun, const char *value); -void lun_set_size(struct lun *lun, size_t value); +void lun_set_size(struct lun *lun, int64_t value); void lun_set_ctl_lun(struct lun *lun, uint32_t value); struct option *option_new(struct options *os, From nobody Sat Jan 18 06:08:16 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZmPF0ccXz5kt0k; Sat, 18 Jan 2025 06:08: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZmPF035Rz3xrF; Sat, 18 Jan 2025 06:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737180497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vVanuR/Wngb5NAXYFkDu4UmSz4jq/0lzSdyHn0CY4X0=; b=NStsicyMkUxrbcIXJbvufWW8Um99gs60YQ7YoenTuD9y74JQFkIPUpqoer/REDxo8zI3DH 0TgrKUZS4raP3DGo7+MPJshBmO9+93PMpfP0Oj4jNtsJJ+V2LpNo6M0e1YKJiWTecMOuZh Oh3NciAkDq0Kh6aps5mfaP2CkPJAv8TsculCqsmE0MwKGhTRYc8SwF+ffWNglniJMs3qpk OcmkCBb6iRODXa1pVIdATQnkRMyZqDAwvNRDgZMPZgsS6CHeKOaPF5ut+yiEmIbIEXJYYw 2XzfQJG3zcjMyw3Qmyp1v1tyjkNhMdnaFZ1IusSlwis5+G07riJ8SLiqstXWnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737180497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vVanuR/Wngb5NAXYFkDu4UmSz4jq/0lzSdyHn0CY4X0=; b=OXuJKuJK7lt+A7qNEM6WGxTnIhdCIoPlD+S0pejufrWIGEOTkdPEKIZWYriaDSNX4faDEF q3eAIu//yKqSfo8GkMR/kwZrTYx48UwyP8MsrlT4uVwqEOJRMBjLNgUo5Z1gvKa+WJvT3J HKUtZ3Cfk1Z+CAAIr0Mgr59M2j0A8GbddJWKM4cBFxIIrAp0CxkOs+zbYiFibvvwtCvl8Y ls/b3kpvJuk8P1Ma+xhTtpjw4YnPYcO3/FbF8+N1JPZ811J3HOPiRkivSCf5yK8xxGoR3V ZRVAtgFenjIfUXpqrCX9nCnS8VBS7zOTmjqwQ8QDoPkvO6idf5Yoyjhi+qTdcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737180497; a=rsa-sha256; cv=none; b=n4r1UE+mYQCqTMPjlsUJ+vMys5hqgL+BGCTvqZHa4AsJZc19Z4BZHOfLK21bw0wrde20PZ tOZgKajKMpHRgJOO0dOyaaIbNq0cJVAH0KgaTRel1k+K5DMrLksDEm6ZZuLodNC5xqELDG 1hqIIUaYplnaLGvdmsi7hjDtkRjxEJ5hEJH6AmBz53I8GajGDRVrYhRtp1t2zAZVXb9OVv bPsqvCwse08fEXXUijgxIQzp8YniqUzaeV8N9/TLR3Lv2wrfIZ2/2HUv/nwkYGYvr+TIQ2 8aQwspRheXRwZy8P878kQAJzYkPQWep55Fflee4pBkMdfkXTXWeppdzGvJT5uQ== 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 4YZmPD6hL8zsTj; Sat, 18 Jan 2025 06:08: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 50I68GTv071425; Sat, 18 Jan 2025 06:08:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50I68Gfa071422; Sat, 18 Jan 2025 06:08:16 GMT (envelope-from git) Date: Sat, 18 Jan 2025 06:08:16 GMT Message-Id: <202501180608.50I68Gfa071422@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 6a876e97f702 - main - krpc/clnt_vc: clear vnet context before kthread_exit() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a876e97f702c277ea41ad9c90709a4b079c74a3 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6a876e97f702c277ea41ad9c90709a4b079c74a3 commit 6a876e97f702c277ea41ad9c90709a4b079c74a3 Author: Gleb Smirnoff AuthorDate: 2025-01-18 05:59:15 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-18 06:06:42 +0000 krpc/clnt_vc: clear vnet context before kthread_exit() Fixes: b2ff4cb1931c2e1509a5741f6743322699ad1e00 --- sys/rpc/clnt_vc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c index d26e6c294af6..2e890f3b482b 100644 --- a/sys/rpc/clnt_vc.c +++ b/sys/rpc/clnt_vc.c @@ -1300,6 +1300,6 @@ clnt_vc_dotlsupcall(void *data) wakeup(&ct->ct_sslrefno); mtx_unlock(&ct->ct_lock); CLNT_RELEASE(cl); - kthread_exit(); CURVNET_RESTORE(); + kthread_exit(); } From nobody Sat Jan 18 06:08:17 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZmPG1TRDz5ksjN; Sat, 18 Jan 2025 06:08: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZmPG0ljqz3xsx; Sat, 18 Jan 2025 06:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737180498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0paNKTvlMEBd5naWJpQgDAc39PfU34S4b6FdNg7Vjvk=; b=Vkp/+wuiWOSoeUlpJIJyzM2dz32VmZSghxuhLSSGUIewa5NtFewbLhh/uQV0nmGf8HtiZR Q5ccYxcWslconAiPmqTJq41kg6G5sZ1twgFeh4Z3+AGt7fw2my0dOturpUbLapMmH26S10 6WmWnAAtO6yv3FKRDw6+MoFwdRs5qK59pPoZEpZSuoMovtuZkLxqlOdFmNML6xn6ShE57t PzUGxHV1Mk4QlTSf5+0DvK1aBLwaSlSWiYEsLtpTTwHGJYVCDNZC4OIubPRvGJQHZVq2X7 bmp5gcjgX/4g0YAyrKWXteoWo3B3EL6yyLxmOzEWNAOclXHVHPkCYSDvu6QkcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737180498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0paNKTvlMEBd5naWJpQgDAc39PfU34S4b6FdNg7Vjvk=; b=DsJuy5swhV5Luj+Z8bmanQYpK6GhtpFICbj5Tf2yKz24Rrx8l/NUUl3pXujjXg8rKKmxgg eaRnCRDG0sKKly42lrMBP9dESi0f+KqzG2Gxw4vzBJZPp4zQIRoP4htOt2KesKpBSiOhyO LoeZ69R9ojhGb9yjUgkawpJzV3joSU4wcxoXBmGii4JmMnlowM+iEDhBEsMKsJdOsTnuKp ZFjOHVD7jip5hqn/jj6tp2Bjn7hw0SUubepTEhk5onKL3MDLuW+bfn+RUlxJ3RW0YKvXgj ctYFcbv70HAkSo11+u9tRVk6BIRBrA16VyV+x+AjutCXHlMSFKHlvS21Qqcujw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737180498; a=rsa-sha256; cv=none; b=U4Aaw0K7HoJKk42BUzusb0jRZBe3LNF1VVdOyBtkGIZCAnsT2wkalXTYpD4Jix1fo+Mzo/ Iw0qfrygf3q3ubmWYfYP+JT5P7iS6F/Ii3wWKi7Vy6ViGWzRoS4gp/tJsy+z7WKDjRmQg3 0S28wEBDuRQ07h9UjOeT9FU55NNHIMrZZs5P3iv93oxsT7E69CaUQ05eIwUxSqvgSfQZKc JP01x+hmfROXyCxNP+Bshaw86Md3pt7C6/0IQGiZGB/7yMp0bZCB1XVuyOPmtRJjC/QpCY Fe5/oQkL56cSFztPiWYUxzqMcuG8GAQipnXLzexkqCX5jfzFRwNvWz8ec4Sxjw== 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 4YZmPG0HgGzsB3; Sat, 18 Jan 2025 06:08: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 50I68HtF071481; Sat, 18 Jan 2025 06:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50I68Hk6071478; Sat, 18 Jan 2025 06:08:17 GMT (envelope-from git) Date: Sat, 18 Jan 2025 06:08:17 GMT Message-Id: <202501180608.50I68Hk6071478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 488660360a71 - main - krpc/svc_vc: keep the vnet context during calls into rpctls List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 488660360a71f65a31d3709559554c1a90f7220e Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=488660360a71f65a31d3709559554c1a90f7220e commit 488660360a71f65a31d3709559554c1a90f7220e Author: Gleb Smirnoff AuthorDate: 2025-01-18 06:01:46 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-18 06:07:45 +0000 krpc/svc_vc: keep the vnet context during calls into rpctls --- sys/rpc/svc_vc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c index 9fc4108a5149..f70aabc5425d 100644 --- a/sys/rpc/svc_vc.c +++ b/sys/rpc/svc_vc.c @@ -493,6 +493,7 @@ svc_vc_destroy_common(SVCXPRT *xprt) if (xprt->xp_socket) { if ((xprt->xp_tls & (RPCTLS_FLAGS_HANDSHAKE | RPCTLS_FLAGS_HANDSHFAIL)) != 0) { + CURVNET_SET(xprt->xp_socket->so_vnet); if ((xprt->xp_tls & RPCTLS_FLAGS_HANDSHAKE) != 0) { /* * If the upcall fails, the socket has @@ -505,7 +506,6 @@ svc_vc_destroy_common(SVCXPRT *xprt) xprt->xp_sslproc, &reterr); } /* Must sorele() to get rid of reference. */ - CURVNET_SET(xprt->xp_socket->so_vnet); sorele(xprt->xp_socket); CURVNET_RESTORE(); } else @@ -853,13 +853,13 @@ tryagain: if ((xprt->xp_tls & RPCTLS_FLAGS_HANDSHAKE) != 0 && error == ENXIO) { KRPC_VNET(svc_vc_tls_alerts)++; - KRPC_CURVNET_RESTORE(); /* Disable reception. */ xprt->xp_dontrcv = TRUE; sx_xunlock(&xprt->xp_lock); ret = rpctls_srv_handlerecord(xprt->xp_sslsec, xprt->xp_sslusec, xprt->xp_sslrefno, xprt->xp_sslproc, &reterr); + KRPC_CURVNET_RESTORE(); sx_xlock(&xprt->xp_lock); xprt->xp_dontrcv = FALSE; if (ret != RPC_SUCCESS || reterr != RPCTLSERR_OK) { From nobody Sun Jan 19 13:32:19 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YbZC724j5z5lFW4; Sun, 19 Jan 2025 13:32: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YbZC71P7Tz3Rj8; Sun, 19 Jan 2025 13:32:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737293539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J3irkfsldD8M2A8H/HD3F4RDldiC8o/t4lDn/7+mRyI=; b=ZdFFpH79vdwKmIlsz+77kaNF6K2NEbc0ODzlAea9vO3SczINskT++tbS36m24uj1hqY8mT 6B24kc4eOOdzosiGcMdtFUXmxwxFWLDbkRYycBFqXX1zkZD8EB4Wgkktwy+5R8mNLmOeuS SRDiOzWV71Ge7spLZreYudjzP/Zr2oBOEJ6SXe1P1ttNd9PrdAf2OyzV57R9qB2PNZsZk5 bM9ujBwRxDaaQ9GdO/wn0oRhV20PnUuN79bfCgurxTXetKNIxwGq3XxJPMxGDqwhhHIUv/ 4ftEwtUWZiYG1Fy1dd6juyT10mJ6aNe6DZobuXwJl8NfBALop7edzbacaLbkSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737293539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J3irkfsldD8M2A8H/HD3F4RDldiC8o/t4lDn/7+mRyI=; b=xs6utp00+nvFG3VsJ7xo7cp+9BLUXVX6wS4oqGJGci6SJHnt9XxkpUWEZ+A87nrV+5tLeZ i0UQYxwCIDOyrXBeANmtYo/k+P4zKWnluzycIxrkb9lfOtuplTZnY+eGFvRoFC2F2M8OA6 KrZQ8YGIPQK3L5ZkCDi7rxwWKNNGFPSZS/OGCR20YzjS6GHHb1ylGjlHuelZ84NYzuaMFc XzeU19BCyEIy2nLQRPcdnpSRu2gnXb7rl0c6COHJc/uLpGMMEnp6vuZzUZcYbh1KPr4GTj zgABN97sr8Qp/HZLd856xesWSIO374ONefGEt9OYpTWtZQGepAH82xgF3U6euA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737293539; a=rsa-sha256; cv=none; b=B2Nezd+HApP167NoqqAe99EFLo+h0N9DJol71Bq5+vSNp/XSIs5hkb+toUHFxMAUzJJudd uR+M2uyxf0JEzlPXoiLp24wITgvQuBEP8N1SbFZ2akDhe5TP89OwC5Y6MPl4dJQEETkq8l C7AfEFLOX7hEIxri/u7Q7SeEbOB4J3j2ibuoOzuNEQR9AyP4QK5v23byOWPBpGP7NyA3Nj dLtgMH7Np+1FenFhbDTrXj1dmLe0125AZ69asi+tlOl/pDtareAxzKmDuIZ5l+rW9H/D2e 5AkRq2/ttZddMHo6IL2alqGNgx72wS73Le9W4sXyrbVex8NFHgmISyVyCokTPw== 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 4YbZC70rf9zsSm; Sun, 19 Jan 2025 13:32: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 50JDWJEw005319; Sun, 19 Jan 2025 13:32:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50JDWJ9T005316; Sun, 19 Jan 2025 13:32:19 GMT (envelope-from git) Date: Sun, 19 Jan 2025 13:32:19 GMT Message-Id: <202501191332.50JDWJ9T005316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f5cf173de0dc - main - kill.1: mention special PID 0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f5cf173de0dc62dbf47a8bbdcae28aac947d90a6 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f5cf173de0dc62dbf47a8bbdcae28aac947d90a6 commit f5cf173de0dc62dbf47a8bbdcae28aac947d90a6 Author: artembunichev AuthorDate: 2025-01-19 12:49:14 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-19 13:29:27 +0000 kill.1: mention special PID 0 PR: 284158 MFC after: 3 days --- bin/kill/kill.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/kill/kill.1 b/bin/kill/kill.1 index ce9cb06382f8..02357ff60c19 100644 --- a/bin/kill/kill.1 +++ b/bin/kill/kill.1 @@ -79,6 +79,9 @@ of the default .Pp The following PIDs have special meanings: .Bl -tag -width indent +.It 0 +The signal is sent to all processes whose group ID is equal to the process +group ID of the sender, and for which the process has permission. .It -1 If superuser, broadcast the signal to all processes; otherwise broadcast to all processes belonging to the user. From nobody Sun Jan 19 13:32:20 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YbZC85rzVz5lFW7; Sun, 19 Jan 2025 13:32: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YbZC82H7zz3RLj; Sun, 19 Jan 2025 13:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737293540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F61vXgNBpxUJOm6QHuwHKwnnlgbCC7YLY04WdX4TBb8=; b=gpgd5dOVxEs6dhUZWm0pDC+qdVAtVLahl4/P8qvPOGBvKZxTuLc8fnbmbaM+2tbvGPMLGS m1zv4NoJ98LDM8YbRThi53NdL3+tQ0kT89DSx9zqeFrydeX0N9ZSK3/o/AvzJDdMFntLrP NBIDr3SaVsYRYs/MpONp2zK8SMfTzwKfVMlI8j+44v7F9bzXwi44nxkLWqvFoDflQCmy+h wkI5DjOusDmd+7c4CkNyNV7ismsCrcXz+umDkmg5BAr365U4yBxwsD42Gf2NcwrhYYkfCr h/yJd3f6A3N0ZDcsMJzy1j2Iom7YWgeQ0exDxI24Sya72Dv1FODdsznlR2kHqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737293540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F61vXgNBpxUJOm6QHuwHKwnnlgbCC7YLY04WdX4TBb8=; b=ppA0shYuwQP+6mPCzh8XGnWIJkEbICAbab3zSWsrE1HysnvVACyUDdNet4pALxKx4ga9CJ dPSJKYAhImz4/Vjysyd0ZeI4e4m0c1tVJn0ViUR027JF/eQNJ2btKKTQ0tk+L8Ul2dThVB 7Kj2iv6XRlTMwkeliZVUnXEoUqrBe6nBpsXOnRsVaHUKDLWTHKuFFNgpoTMhxQClId9kNL 35IZqsx/LLgvwsp2+E9W6HjUMZiYx0o5B/DQHTovRqTwwPzl1s58X9zF+eEY/gIaeK9brR +4w1TlKxyXWhlnv8bB+A43DERnKf8opnjMJYcE2p/sVwV9zEvHzicHdyeYsfog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737293540; a=rsa-sha256; cv=none; b=w6NeRMlTn+lbSdPz20dDTPrsUZxEOFRdoSkTFBUqjtHeO1TRk7UyDT+ymE9p0dAcHSHNTc UBgTleaBajMP5ny+Mcp3FBCjJwxLTevEyw7X0/OxbCBl6wiEDQU3g5zkStRSv8GS9iFNw+ hc+DovmcoY/fKt++71KuwSp5DpuiiaqYJbp3ou8qR5r57yY71KoXqfh8a5yn4s6uTFkv2w p2rWyT68gZEx46+3o+B+iY78eIlZ8sdOEC4lCV76NIIe4YlubcV/jXAJiPv9FSPl7kELLc cOBNeoOmFTTi6wX1e5mIo8cPmbkTjOfQhTCObW5mz532dpIJVTR0PNwGM+7ECA== 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 4YbZC81qWDzrwb; Sun, 19 Jan 2025 13:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50JDWKEb005353; Sun, 19 Jan 2025 13:32:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50JDWKUQ005350; Sun, 19 Jan 2025 13:32:20 GMT (envelope-from git) Date: Sun, 19 Jan 2025 13:32:20 GMT Message-Id: <202501191332.50JDWKUQ005350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d6c2d4fe975c - main - kill.1: mention special meaning of PGID as a PID List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6c2d4fe975c70975bdc6bec76d044408f6dcb8c Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d6c2d4fe975c70975bdc6bec76d044408f6dcb8c commit d6c2d4fe975c70975bdc6bec76d044408f6dcb8c Author: artembunichev AuthorDate: 2025-01-19 12:58:55 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-19 13:31:36 +0000 kill.1: mention special meaning of PGID as a PID PR: 284158 MFC after: 3 days --- bin/kill/kill.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/kill/kill.1 b/bin/kill/kill.1 index 02357ff60c19..003d09f09339 100644 --- a/bin/kill/kill.1 +++ b/bin/kill/kill.1 @@ -85,6 +85,9 @@ group ID of the sender, and for which the process has permission. .It -1 If superuser, broadcast the signal to all processes; otherwise broadcast to all processes belonging to the user. +.It - Ns Ar PGID +The signal is sent to all processes that belong to the specified +process group ID (PGID). .El .Pp Some of the more commonly used signals: From nobody Sun Jan 19 16:18:17 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ybdtd3ySnz5lQtT; Sun, 19 Jan 2025 16:18: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ybdtd3NfDz3hjl; Sun, 19 Jan 2025 16:18:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737303497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wH1J/laaCzZiHMRJOXLQuJ7dgUGQo7tqcNriSuTYadM=; b=R4cgBT2DAAdMqUj3uv/Q4SQJ7baaUbZSfuGcgVG5Ch6FNC40+WYzR5XyXLrKwDhxpWRYox pUI0P2t8GzdbKv/3i2wGnBnJQOg/MNwmOJBtbLcBiW5abQtrba6/B1p8qUjPliSOBm0qt7 24QDSGCxtJlH07tSvR5XpS9PO5cxpBK/3TbIWBXY2pln7MNb7djkkJ55o8TooIXm7JGVvy RdxwaoamgG947X9PTbW38ZZlcjyXSHEKlmLNm7UN+IT7O9f0a6rawCko87BEOYFvUbrUly r9Q97QgABd45zo8oLyo1aL/RL/ItHq2vKDQLj/F0cCrFNfRO9WPFlOqstIyg6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737303497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wH1J/laaCzZiHMRJOXLQuJ7dgUGQo7tqcNriSuTYadM=; b=COAnRO+1jLkPPaR0hskzsWg4sQzMk29pkGOSKubQuXVSxXGXP7N0iXYuCjJcjMIo0GHBW7 inppZSDPVaHIEX/Xagu8ZwLwJAoWYCK1fHH7o6uQ5t4VtuWE3A0VUMwwHfTygVP9XPOAQs OJ+4EDWRnz0hWW1yXKid4WmB/jckxZNTC2pYNNHFp8s5CW/GQ+g+kWfsgwkGW23G19Lp9F oIuIVM9l53psT/RyKmiYenJWieMLrFCR2EDMtvzx7bZXocUNUaStm5rUqq1vyS00Onk0Ac ZPoz7h30RgMSUfjqLqVIW7ePljhyUK1f2YDgiJ1XdGuk9NM+NnoP7cn74GRuCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737303497; a=rsa-sha256; cv=none; b=IKcRP+DC9FOnRGtDAd0GGGAdbtkkjVjI49n8LPcKmc16oYyhcLc4Q+Tzy8x4N6bq0yuLBC UvKdRsEdpCn96hNdGdyWOqpeY8W0FDqI1bS3jMA8AbCqpG+VQlK6WfYNghOQmFGTTyF0F7 zxGQ+Im8u53/sI6LQKdoJbomRLY5hqh6fDL6VZk3r09DCWnDYGrV+ewY5kA8COJoG3IirX tuUzQmBAqFY2hPR+2Nskj8q7nzs7a3Q/vH8hmRf4rSotnQ0f03dfsPuKCmLCb4MXE4N3LG fUtDZK3VZwEQOemW5Gzg0MWMSe/EKT8stoV+G0bTeI8EJcOeXtojBYKOpFe7ew== 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 4Ybdtd2hVwzxS9; Sun, 19 Jan 2025 16:18: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 50JGIHYW005683; Sun, 19 Jan 2025 16:18:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50JGIH1I005680; Sun, 19 Jan 2025 16:18:17 GMT (envelope-from git) Date: Sun, 19 Jan 2025 16:18:17 GMT Message-Id: <202501191618.50JGIH1I005680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c5056a3931b4 - main - getentropy tests: Update after commit 473681a1a506da List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5056a3931b41a803a24b89400d38d5c5f843612 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c5056a3931b41a803a24b89400d38d5c5f843612 commit c5056a3931b41a803a24b89400d38d5c5f843612 Author: Mark Johnston AuthorDate: 2025-01-19 16:17:05 +0000 Commit: Mark Johnston CommitDate: 2025-01-19 16:17:05 +0000 getentropy tests: Update after commit 473681a1a506da - Use GETENTROPY_MAX instead of hard-coding the value. - Check for EINVAL instead of EIO Fixes: 473681a1a506 ("libc: Fix getentropy POSIX 2024 conformance issues") --- lib/libc/tests/gen/getentropy_test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libc/tests/gen/getentropy_test.c b/lib/libc/tests/gen/getentropy_test.c index 156d3a94a7de..6ac9d5678ea6 100644 --- a/lib/libc/tests/gen/getentropy_test.c +++ b/lib/libc/tests/gen/getentropy_test.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -62,13 +63,13 @@ ATF_TC_BODY(getentropy_sizes, tc) char buf[512]; ATF_REQUIRE_EQ(getentropy(buf, sizeof(buf)), -1); - ATF_REQUIRE_EQ(errno, EIO); - ATF_REQUIRE_EQ(getentropy(buf, 257), -1); - ATF_REQUIRE_EQ(errno, EIO); + ATF_REQUIRE_EQ(errno, EINVAL); + ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX + 1), -1); + ATF_REQUIRE_EQ(errno, EINVAL); /* Smaller sizes always succeed: */ - ATF_REQUIRE_EQ(getentropy(buf, 256), 0); - ATF_REQUIRE_EQ(getentropy(buf, 128), 0); + ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX), 0); + ATF_REQUIRE_EQ(getentropy(buf, GETENTROPY_MAX / 2), 0); ATF_REQUIRE_EQ(getentropy(buf, 0), 0); } From nobody Sun Jan 19 17:00:38 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YbfqW0HXcz5lTJZ; Sun, 19 Jan 2025 17:00: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YbfqV6ckqz3nY9; Sun, 19 Jan 2025 17:00:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737306039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ljo761V8ZJlioZoXJ2hIeJU/7D2W/H7C9YrcoMaugC0=; b=iMmwW+Y8Hr+n4QM2crJuz2Vm0BrK82GGbyqLMR86yIDkF7Dqa9AVyCbi9gdaywrT6XqV6v ctx7nbT22NzeZdRObAY0Cg7WDFiUUBg0TXpRAWCCAV5Zga6a1o9vS5vXj5b0ih90uOdPok FsQXwn4bNPEEV0uXS0q0OOFRokRC5kPnCFgeB0TcTFn8bNeKQxeCNYGvEZwGaekvUv9bio mJbQ5G0Nl+zmR14irVirDnoqlDUe5pBpMQXa6YfPNyblFViEgfNXdRocJka/StSIX3HUcg GuPoyEADHSqPUHLBi6svese1pW4eC5iOCfunL9k7tLq6tEVycNPcHimTAUIwBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737306039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ljo761V8ZJlioZoXJ2hIeJU/7D2W/H7C9YrcoMaugC0=; b=G9V94nQ/g2RQR1jqnZrx19P4TStc0GcnKPyf2wdOCDfX3+Wygcz10399O6/H/7IfGhNQTv RTlg29VXbfOU3Chjm9v9PSlQ/CqOk5vNE2DT00KlfyUKujIbhpFd/JWqLhc7EGTPdsbCGo 64HXFDRybYCrdRVXJnKHzVc57iNch6Q51m9IIbnVD8e9UTZOO2HNEG9BB4OhIQoPt4vXwD 29qJTchyEyp6smB1742Fjz6EPSUiFE/7aiGfbvX5UDkt/1m0GiNMsW5PTU8aPdl3s3VqdJ aOlKeI7jHgFM/SUytVuYrGlLMWFZrV1jqzrSwAHTpafGpBzlFNTCPPUe4+kLtw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737306039; a=rsa-sha256; cv=none; b=CiYgLCy0JsguyEAN+z6bjxyKpO4PYD8LKLqO9Jvl9VD5WdkcUD63TYV+yOfdHKgFoVESpF HExpamm53oA8n8Bh6zhPiIgKR3DZ45/pkCiU2Q1X607fa4vGYzZec4gXXq0u4ZU3aDG0pE w4Jmona5jMrOjr9ZI12aCsCyqVPWnw23hhwrJFCAoO+uiM6cSpwM+ByjIqbJwpHUCwYVqG R6AB6VtYK2DztNA8k3tT2b0RKplZ0fkrQ2i7sptD9MT8Jz6aruwcWaWHWoq8UF4JiuguU2 Ym7IV13Rwm0YqSZ3TuI37YhsWoGXOFWkY8o682zH/pUq/m0ArJ5kIIF4PpKgtg== 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 4YbfqV69yNzyVM; Sun, 19 Jan 2025 17:00: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 50JH0cIW090475; Sun, 19 Jan 2025 17:00:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50JH0c9a090472; Sun, 19 Jan 2025 17:00:38 GMT (envelope-from git) Date: Sun, 19 Jan 2025 17:00:38 GMT Message-Id: <202501191700.50JH0c9a090472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Bright Subject: git: 2f35419fb26d - main - stand/efihttp: Add device type check to efihttp_fs_open() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dab X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f35419fb26d1e45850696a8e732a12874bc1078 Auto-Submitted: auto-generated The branch main has been updated by dab: URL: https://cgit.FreeBSD.org/src/commit/?id=2f35419fb26d1e45850696a8e732a12874bc1078 commit 2f35419fb26d1e45850696a8e732a12874bc1078 Author: Yongbo Yao AuthorDate: 2025-01-19 16:50:18 +0000 Commit: David Bright CommitDate: 2025-01-19 17:00:26 +0000 stand/efihttp: Add device type check to efihttp_fs_open() Ensure the open operation targets an HTTP device. Return EINVAL if not, to prevent potential system crashes when used on other devices. Differential Revision: https://reviews.freebsd.org/D48439 Reviewed by: dab, imp, vangyzen Sponsored by: Dell Technologies --- stand/efi/libefi/efihttp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/efi/libefi/efihttp.c b/stand/efi/libefi/efihttp.c index bcc0f7e4d79e..fd0ed744047c 100644 --- a/stand/efi/libefi/efihttp.c +++ b/stand/efi/libefi/efihttp.c @@ -565,6 +565,8 @@ efihttp_fs_open(const char *path, struct open_file *f) if (!efihttp_init_done) return (ENXIO); + if (f->f_dev != &efihttp_dev) + return (EINVAL); /* * If any path fails to open, try with a trailing slash in * case it's a directory.